[Senate] Recurring code health sweep

← All Specs

Goal

> ## Continuous-process anchor
>
> This spec describes an instance of one of the retired-script themes
> documented in docs/design/retired_scripts_patterns.md. Before
> implementing, read:
>
> 1. The "Design principles for continuous processes" section of that
> atlas — every principle is load-bearing. In particular:
> - LLMs for semantic judgment; rules for syntactic validation.
> - Gap-predicate driven, not calendar-driven.
> - Idempotent + version-stamped + observable.
> - No hardcoded entity lists, keyword lists, or canonical-name tables.
> - Three surfaces: FastAPI + orchestra + MCP.
> - Progressive improvement via outcome-feedback loop.
> 2. The theme entry in the atlas matching this task's capability:
> X2 (pick the closest from Atlas A1–A7, Agora AG1–AG5,
> Exchange EX1–EX4, Forge F1–F2, Senate S1–S8, Cross-cutting X1–X2).
> 3. If the theme is not yet rebuilt as a continuous process, follow
> docs/planning/specs/rebuild_theme_template_spec.md to scaffold it
> BEFORE doing the per-instance work.
>
> **Specific scripts named below in this spec are retired and must not
> be rebuilt as one-offs.** Implement (or extend) the corresponding
> continuous process instead.

Run a periodic (weekly) conservative scan of the SciDEX codebase to identify dead code,
duplication, sprawl, and quality issues. Produce a prioritized findings report. Never
remove code — only flag for review.

Acceptance Criteria

☑ Script code_health_scan.py that produces a structured report
☑ Reports stored in docs/code_health/ with timestamped filenames
☑ Scan categories: dead files, duplicate functions, god files, root sprawl, migration issues, raw DB connections
☑ Each finding rated: severity (low/medium/high), confidence (likely/certain), effort (small/medium/large)
☑ Report includes "safe to act" vs "needs investigation" classification
☑ Integrated with Senate dashboard (findings count on /senate)

Scan Checks

1. Dead File Detection

def find_dead_files():
    """Files not imported by any other file and not in systemd/cron."""
    # Check: grep -r "import X" / "from X import"
    # Check: systemd services
    # Check: crontab
    # Exclude: migrations (run standalone), test files, __init__.py

2. Duplicate Function Detection

def find_duplicate_functions():
    """Functions defined in 3+ files with same name."""
    # Parse AST of all .py files
    # Group function definitions by name
    # Flag names appearing 3+ times

3. God File Detection

def find_god_files(threshold=2000):
    """Files exceeding line count threshold."""
    # wc -l for all .py files
    # Flag anything > threshold

4. Version-Suffixed Files

def find_versioned_files():
    """Files with _v[0-9]+ suffix — likely superseded."""
    # Regex: *_v\d+\.py
    # Check if a non-versioned equivalent exists

5. Stale Files

def find_stale_files(days=90):
    """Files not modified in N days and not imported anywhere."""
    # git log --diff-filter=M --since="90 days ago"
    # Cross-reference with import analysis

Report Format

# Code Health Report — 2026-04-03

## Summary
- Dead files: 12 (high confidence), 8 (needs investigation)
- Duplicate functions: 6 groups (48 total definitions)
- God files: 2 (api.py: 30K, tools.py: 3.3K)
- Version-suffixed: 27 files
- Stale files: 34 (>90 days, no imports)

## Findings

### [HIGH] api.py is 30,283 lines
- Severity: high | Confidence: certain | Effort: large
- Action: Break into modules (see task 6a532994)

### [MEDIUM] get_db() defined 48 times
- Severity: medium | Confidence: certain | Effort: medium
- Action: Consolidate to shared module (see task 18157380)
...

Approach

  • Build code_health_scan.py with all 5 scan checks
  • Output markdown report to docs/code_health/YYYY-MM-DD.md
  • Store summary metrics in PostgreSQL table code_health_snapshots
  • Add summary widget to /senate page
  • Set up as recurring Orchestra task (weekly frequency)
  • Work Log

    2026-04-20 16:44 PT — Worktree orchestra/task/2e7f22a0-recurring-code-health-sweep — Weekly sweep cycle

    • Ran code health scan: python3 scripts/code_health_scan.py --save --skip-db
    • Results: 239 Python files, 67,925 LOC, 95 findings (4 high / 19 medium / 72 low), 23 safe-to-act, 72 needs-investigation
    • Generated artifacts: docs/code_health/2026-04-20_164422.{md,json}
    • Key findings: main() (140 defs), setUp() (40 defs), get_db() (39 defs) as top duplicate functions; 93 root-level files
    • Action taken: Archived 23 safe-to-act one-off scripts to scripts/archive/oneoff_scripts/:
    backfill_convergence_50.py, backfill_hypothesis_stats.py, backfill_hypothesis_type_cost_timeline.py,
    backfill_notebook_stubs.py, backfill_target_pathway.py,
    enrich_experiment_descriptions.py, enrich_experiment_protocols.py, enrich_papers_missing_abstracts.py,
    enrich_papers_pubmed_metadata.py, enrich_protocols.py, enrich_thin_hypotheses_batch2.py, enrich_top10_evidence.py,
    fix_entity_link_400_v2.py, fix_mermaid_wiki_style.py, fix_task_status_propagation.py,
    link_orphan_hypotheses.py,
    run_debate_for_corrupted_analysis.py, run_debate_llm.py, run_debate_microglial_20260420.py,
    seed_epistemic_tiers_audit.py, wiki_quality_fix_5faca020_20260420.py,
    demo_smoke_check.py, extract_more_edges.py
    All verified: one-off-prefix patterns, not imported anywhere
    • Verification scan: 216 files, 62,642 LOC, 70 findings, 0 safe-to-act
    • Archive now has 392 one-off scripts
    • Committed and pushed: c566fd962
    • Result: Recurring code health sweep completed; 23/23 safe-to-act items resolved.

    2026-04-18 11:24 PT — Worktree orchestra/task/2e7f22a0-recurring-code-health-sweep — Weekly sweep cycle

    • Ran code health scan: python3 scripts/code_health_scan.py --save --skip-db
    • Results: 213 Python files, 59,883 LOC, 68 findings (4 high / 17 medium / 47 low), 10 safe-to-act, 58 needs-investigation
    • Generated artifacts: scripts/docs/code_health/2026-04-18_182402.{md,json}
    • Key findings: main() (117 defs), setUp() (40 defs), get_db() (37 defs) as top duplicate functions; 67 root-level files
    • Action taken: Archived 1 safe-to-act one-off script to scripts/archive/oneoff_scripts/:
    enrich_hypotheses_pmids.py (was safe-to-act: one-off-prefix enrich_*, not imported anywhere)
    • Archive now has 368 one-off scripts
    • Committed and pushed: fc24c30c9
    • Result: Recurring code health sweep completed; 1/1 safe-to-act items resolved.
    • Ran code health scan: python3 scripts/code_health_scan.py --save --skip-db
    • Results: 199 Python files, 55,245 LOC, 163 findings (4 high / 18 medium / 141 low), 3 safe-to-act, 148 needs-investigation (markdown summary showed 15 from pattern breakdown; JSON had 0 actual findings)
    • Generated artifacts: scripts/docs/code_health/2026-04-17_011607.{md,json}
    • Key findings: god files — api.py, tools.py, post_process.py; main() (104 defs), setUp() (40 defs), get_db() (36 defs); 181 root-level files
    • Action taken: Archived 3 safe-to-act one-off scripts to scripts/archive/oneoff_scripts/:
    backfill_convergence_50.py, backfill_hypothesis_stats.py, backfill_kg_edges.py
    All verified: no imports, no systemd refs, no cron refs
    (backfill_hypothesis_stats.py and backfill_kg_edges.py were already in archive with older versions; updated to newer 205/240-line versions from scripts/)
    • Verification scan: 196 files, 54,709 LOC, 160 findings (4 high / 18 medium / 138 low), 0 safe-to-act
    • Committed and pushed: e1ad225dc
    • Result: Recurring code health sweep completed; 3/3 safe-to-act items resolved.

    2026-04-16 13:04 PT — Worktree orchestra/task/2e7f22a0-recurring-code-health-sweep — Weekly sweep cycle

    • Ran code health scan: python3 scripts/code_health_scan.py --save --skip-db
    • Results: 193 Python files, 54,571 LOC, 158 findings (4 high / 18 medium / 136 low), 12 safe-to-act, 146 needs-investigation
    • Generated artifacts: scripts/docs/code_health/2026-04-16_130329.{md,json}
    • Key findings: god files — api.py, tools.py, post_process.py; main() (101 defs), setUp() (40 defs), get_db() (36 defs) as top duplicate functions; 175 root-level files
    • Action taken: Archived 12 safe-to-act one-off scripts to scripts/archive/oneoff_scripts/:
    backfill_hypothesis_predictions.py, backfill_hypothesis_type_cost_timeline.py,
    backfill_notebook_stubs.py, backfill_target_pathway.py,
    enrich_hypotheses.py, enrich_hypotheses_pubmed_citations.py,
    register_quest_meta_dashboard.py, register_seaad_external_dataset.py,
    cleanup_figure_artifacts.py, demo_smoke_check.py, run_debate_llm.py,
    seed_notebooks_from_files.py
    All verified: no imports, no systemd refs, no cron refs
    • Verification scan: 181 files, 51,162 LOC, 146 findings (0 safe-to-act) ✅
    • Committed and pushed: 066678d63
    • Result: Recurring code health sweep completed; 12/12 safe-to-act items resolved.

    2026-04-13 19:19 PT — Worktree task-2dc94a3b-verified — Weekly sweep cycle

    • Ran code health scan: python3 scripts/code_health_scan.py --save --skip-db
    • Results: 225 Python files, 64,638 LOC, 192 findings (6 high / 17 medium / 169 low), 50 safe-to-act, 142 needs-investigation
    • Generated artifacts: scripts/docs/code_health/2026-04-13_191454.{md,json}
    • Key findings: god files — api.py, tools.py (now 8,169 lines), post_process.py, seed_docs.py, artifact_registry.py; main() (131 defs), get_db() (41 defs), setUp() (40 defs) as top duplicate functions; 207 root-level files
    • Action taken: Archived 50 safe-to-act one-off scripts to archive/oneoff_scripts/:
    add_mermaid_, backfill_, enrich_, fix_, generate_, crosslink_, populate_*,
    register_, demo_, seed_docs.py, link_checker.py, wiki_quality_*.py
    All verified: no imports, no systemd refs, no cron refs
    • Verification scan: 175 files, 49,268 LOC, 137 findings (0 safe-to-act) ✅
    • Committed and pushed: 065c1fb39
    • Result: Recurring code health sweep completed; 50/50 safe-to-act items resolved.

    2026-04-12 10:23 PT — Worktree task-ed5bc822-ce5a-4be9-88cc-a608839e6b07 — Weekly sweep cycle

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 574 Python files, 213,307 LOC, 124 findings (12 high / 16 medium / 96 low), 8 safe-to-act, 116 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-12_102341.md
    - docs/code_health/2026-04-12_102341.json
    • Key findings: api.py (49,647 lines, +601 since 04:11 sweep), tools.py (8,169 lines, +3,094), post_process.py (2,276 lines), seed_docs.py (2,066 lines), artifact_registry.py (2,057 lines) as god files; main() (267 defs), migrate() (79 defs), get_db() (70 defs) as top duplicate functions; 222 root-level files
    • Delta vs 2026-04-10 sweep: +124 files, +45,265 LOC, +15 findings, +35 root files
    • Safe-to-act items: 1 migration collision (060), 7 one-off scripts (backfill_, enrich_, fix_, run_, seed_, link_)
    • Notable: tools.py grew from 5,075 → 8,169 lines (+61% in one day); root file count grew from 187 → 222 (+35 in 2 days)
    • No code changes made — conservative sweep only
    • Result: Recurring code health sweep completed; report generated.

    2026-04-12 04:11 PT — Worktree task-6c12af1f-5748-4d2f-8303-b669c64ca8dd — Weekly sweep cycle

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 530 Python files, 194,657 LOC, 127 findings (11 high / 22 medium / 94 low), 14 safe-to-act, 113 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-12_040635.md
    - docs/code_health/2026-04-12_040635.json
    • Key findings: api.py (49,046 lines, +2,155 since 2026-04-10), tools.py (5,075 lines, +216), post_process.py (2,246 lines), seed_docs.py (2,066 lines), artifact_registry.py (2,057 lines) as god files; main() (240 defs, +38), migrate() (77 defs, +14), get_db() (65 defs, +11) as top duplicate functions; 211 root-level files (+21)
    • Delta vs 2026-04-10 sweep: +78 files, +26,283 LOC, +12 findings
    • Safe-to-act items: 6 migration number collisions (006, 010, 039×3, 040, 041, 068), 6 one-off scripts (backfill×2, enrich×2, extract, generate)
    • Skipped 2 safe-to-act items requiring investigation: link_checker.py (in scidex-linkcheck.service — scanner missed systemd ref), seed_docs.py (2,066-line god file, seed_* prefix but substantial)
    • Action taken: Fixed 7 migration collisions and archived 6 one-off scripts
    - Renumbered migrations: 006_add_security_review_table.py → 077, 010_add_notebook_health_table.py → 078, 039_agent_reputation.py → 079, 039_add_comments_and_votes_tables.py → 080, 040_add_artifact_versioning.py → 081, 041_finalize_paper_id_refs.py → 082, 068_world_model_improvements.py → 083
    - Archived scripts: backfill_capsule_example.py, backfill_rocrate_capsule.py, enrich_pass3_8a4bcadf.py, enrich_pass4_8a4bcadf.py, extract_figures_batch_recurring.py, generate_tau_report.py
    • Verification scan (2026-04-12 04:11): 524 files, 193,691 LOC, 115 findings (11 high / 16 medium / 88 low), 2 safe-to-act (link_checker + seed_docs, intentionally deferred)
    • Result: Recurring code health sweep completed; 12 of 14 safe-to-act items resolved.

    2026-04-10 10:04 PT — Worktree task-58625dd2-35cd-49c7-a2db-ae6f339474a2 — Weekly sweep cycle

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 452 Python files, 168,374 LOC, 115 findings (9 high / 19 medium / 87 low), 8 safe-to-act, 107 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-10_100424.md
    - docs/code_health/2026-04-10_100424.json
    • Key findings: api.py (46,891 lines, +3,791 since 2026-04-08), tools.py (4,859 lines, +390), post_process.py (2,100 lines) as god files; main() (202 defs, -163), get_db() (54 defs, -30), migrate() (63 defs, +1) as top duplicate functions; 190 root-level files (-251)
    • Delta vs 2026-04-08 weekly sweep: -216 files, -36,629 LOC, -252 findings
    • Safe-to-act items: 3 migration number collisions (060, 061, 062), 2 task-ID-suffixed files, 1 batch/slot file, 2 one-off-prefix files
    • Action taken: Fixed 3 migration number collisions and archived 5 one-off scripts
    - Renumbered migrations: 060_site_analytics_tables.py → 067, 061_nomination_followup_state.py → 063, 062_contribution_settlement_ledger.py → 064
    - Archived scripts: enrich_borderline_diagrams_8a4bcadf.py, enrich_pass2_8a4bcadf.py, run_debates_for_analyses.py, extract_figures_batch_slot0.py, recalibrate_scores.py
    • Verification scan (2026-04-10 10:26): 448 files, 167,684 LOC, 107 findings, 0 safe-to-act
    • Result: Recurring code health sweep completed; all 8 safe-to-act items resolved.

    2026-04-07 01:32 PDT — Worktree d37373c9 — Weekly sweep cycle

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 226,990 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_013247.md
    - docs/code_health/2026-04-07_013247.json
    • Key findings: api.py (46,722 lines, +47 since last sweep), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • api.py growth trend continued and root sprawl remained steady at 479 files
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-08 22:35 PDT — Weekly sweep #2 pass 2: archive 21 more scripts, fix scanner

    • Expanded scanner: Added 13 new one-off prefixes (20→33): cleanup, dedup, recover, repair, restore, polish, recalibrate, init, assemble, decompose, render, find, snapshot, import
    • Fixed scanner BASE path: Path("/home/ubuntu/scidex")Path(__file__).resolve().parent for worktree compatibility
    • Fixed migration 060 collision: renumbered 060_market_resolution_and_portfolios.py066_market_resolution_and_portfolios.py
    • Archived 21 scripts (4 from previous patterns + 15 from new patterns + 2 cluster):
    add_wiki_infoboxes3, create_trem2_demo, extract_kg_edges, fix_wiki_mermaid_diagrams,
    cleanup_crosslinks, dedup_analyses, import_forge_tools, import_neurowiki, neurowiki_audit,
    recover_analyses, repair_kg_edges, restore_unicode_mermaid, polish_demo_analyses,
    recalibrate_market, recalibrate_scores, init_orchestra_db, assemble_provenance_demo,
    decompose_gap_subproblems, snapshot_prices, render_missing_notebooks, find_papers_without_figures
    • Post-archive: 397 files, 147,637 LOC, 169 root-level, 100 findings (0 safe-to-act)
    • Cumulative: 300 total scripts archived, findings 452→100

    2026-04-08 — Weekly sweep #2: archive 121 more one-off scripts

    • Expanded scanner: Added 15 new one-off prefixes to _ONEOFF_PREFIXES: add, create, fix, expand, generate, extract, run, bulk, link, upgrade, seed, apply, patch, register, demo
    • Fixed scanner bug: "migration" in str(f) was excluding apply_resource_migration.py — changed to check "migrations/" directory path only
    • Pre-archive scan: 539 files, 180K LOC, 311 root-level, 238 findings (15 high, 9 medium, 214 low), 121 safe-to-act
    • Archived 121 safe-to-act one-off scripts to archive/oneoff_scripts/:
    22 add_, 20 create_, 15 fix_, 12 expand_, 11 generate_, 9 extract_,
    5 link_, 5 run_, 4 demo_, 4 register_, 4 seed_, 3 apply_, 3 bulk_, 2 patch_, 2 upgrade_*
    • All verified: not imported anywhere, not in systemd services, not in crontab
    • Post-archive: ~418 files, ~146K LOC, 190 root-level, 117 investigate-only findings
    • Cumulative: 279 total scripts archived (158 prior + 121 this sweep)
    • Trend: 726→668→418 files, 227K→205K→146K LOC, 452→367→117 findings
    • Report: docs/code_health/2026-04-08_weekly_2.md

    2026-04-08 — Weekly sweep: archive 130 one-off scripts

    • Ran scan: 668 files, 205K LOC, 441 root-level, 367 findings (22 high, 2 medium, 343 low)
    • Archived 130 safe-to-act one-off scripts to archive/oneoff_scripts/:
    75 enrich_, 24 backfill_, 14 crosslink_, 12 migrate_, 4 populate_*, 1 task-ID-suffixed
    • All verified: not imported anywhere, not in systemd services, not in crontab
    • Cumulative: 158 total scripts archived (28 prior + 130 this sweep)
    • Projected post-merge: ~538 files, ~311 root-level, 237 investigate-only findings
    • Trend vs 2026-04-07: 726→668 files (-58), 227K→205K LOC (-22K), 452→367 findings (-85)
    • Report: docs/code_health/2026-04-08_weekly.md

    2026-04-08 18:30 PDT — Worktree 587c0b6b — Improve one-off detection + archive 28 scripts

    • Enhanced scanner classification: Added detect_one_off_pattern() to identify one-off scripts
    by task-ID suffix, batch/cycle/run/slot numbering, numbered duplicates, and common one-off
    prefixes (enrich_, backfill_, crosslink_, populate_, migrate_). These are now classified as
    safe_to_act in unreferenced file findings.
    • Archived 28 one-off scripts to archive/oneoff_scripts/: task-ID suffixed (7),
    batch/cycle/slot numbered (18), numbered duplicates (3). All verified: no imports anywhere.
    ~8K lines removed from active tree.
    • Updated report: Report now includes one-off pattern breakdown table. Fixed duplicate
    action summary in markdown output.
    • Post-archival metrics: 695 files, 211K LOC, 395 findings (158 safe-to-act, 237 investigate)
    • Cumulative improvement: 740→695 files, 463→395 findings, 0→158 safe-to-act

    2026-04-08 — Worktree 587c0b6b — Fix classification + archive versioned dead code

    • Fixed classify_finding() bug: function existed but was never called (dead code). The override
    in run_scan() required confidence=="certain" AND effort=="small", but versioned/unreferenced
    files both use confidence: "likely", so 0 findings were ever classified as safe_to_act.
    Replaced with proper per-check-type classification using classify_finding().
    • Archived 49 version-suffixed files: removed from source locations (root, kg_expansion/,
    enrichment/, mermaid/, migrations/, scripts/). All verified: no imports, no systemd refs, no cron
    refs, copies already exist in archive/versioned_scripts/ and archive/versioned_scripts_subdir/.
    - 21 files with base equivalents (safe_to_act by scanner)
    - 28 files without base equivalents (also already archived, no imports — safe)
    • Net reduction: -49 versioned files, ~20K LOC removed from active tree
    • Scan now properly classifies safe_to_act findings (versioned files with base equivalents)

    2026-04-08 18:17 PDT — Worktree d4ef89b7 — Weekly sweep cycle (fourth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 742 Python files, 227,919 LOC, 464 findings (22 high / 48 medium / 394 low), 0 safe-to-act, 464 needs-investigation
    • Result: Recurring code health sweep completed; no code changes required.

    2026-04-08 18:14 PDT — Worktree d4ef89b7 — Weekly sweep cycle (third pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 741 Python files, 226,829 LOC, 464 findings (22 high / 48 medium / 394 low), 0 safe-to-act, 464 needs-investigation
    • Result: Recurring code health sweep completed; no code changes required.

    2026-04-08 18:07 PDT — Worktree d4ef89b7 — Weekly sweep cycle (second pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 740 Python files, 229,840 LOC, 463 findings (22 high / 48 medium / 393 low), 0 safe-to-act, 463 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-08_180700.md
    - docs/code_health/2026-04-08_180700.json
    • Key findings: api.py (46,769 lines), tools.py (4,463 lines) as god files; main() (432 defs), get_db() (89 defs), migrate() (62 defs) as top duplicate functions; 492 root-level files (target <80)
    • Delta vs prior pass (18:00): +1 Python file (739→740), +475 LOC (229,365→229,840), same finding count (463)
    • Result: Recurring code health sweep completed; no code changes required.

    2026-04-08 18:00 PDT — Worktree d4ef89b7 — Weekly sweep cycle

    • Ran code health scan: python3 code_health_scan.py --skip-db
    • Results: 739 Python files, 229,365 LOC, 463 findings (22 high / 48 medium / 393 low), 0 safe-to-act, 463 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-08_180023.md
    - docs/code_health/2026-04-08_180023.json
    • Key findings: api.py (46,805 lines), tools.py (4,463 lines) as god files; main() (431 defs), get_db() (89 defs), migrate() (62 defs) as top duplicate functions; 492 root-level files (target <80)
    • Delta vs prior sweep: +1 Python file, +264 LOC, +1 finding, api.py grew +66 lines, main() +17 defs, get_db() +1 def, root files +1
    • Result: Recurring code health sweep completed; no code changes required.

    2026-04-07 07:20 PDT — Worktree d37373c9 — Weekly sweep cycle (one-hundred-and-nineteenth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 738 Python files, 229,101 LOC, 462 findings (22 high / 48 medium / 392 low), 0 safe-to-act, 462 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_072012.md
    - docs/code_health/2026-04-07_072012.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 491 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 07:13 PDT — Worktree d37373c9 — Weekly sweep cycle (one-hundred-and-fifteenth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 738 Python files, 229,101 LOC, 462 findings (22 high / 48 medium / 392 low), 0 safe-to-act, 462 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_071314.md
    - docs/code_health/2026-04-07_071314.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 491 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 07:05 PDT — Worktree d37373c9 — Weekly sweep cycle (one-hundred-and-twelfth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 738 Python files, 229,101 LOC, 462 findings (22 high / 48 medium / 392 low), 0 safe-to-act, 462 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_070537.md
    - docs/code_health/2026-04-07_070537.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 491 root-level files (target <80)
    • Metrics stable vs prior sweep — +1 Python file, +141 LOC, +1 finding vs one-hundred-and-ninth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 06:57 PDT — Worktree d37373c9 — Weekly sweep cycle (one-hundred-and-ninth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 737 Python files, 228,960 LOC, 461 findings (22 high / 48 medium / 391 low), 0 safe-to-act, 461 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_065725.md
    - docs/code_health/2026-04-07_065725.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 490 root-level files (target <80)
    • Metrics stable vs prior sweep — +1 Python file, +309 LOC, +1 finding vs one-hundred-and-seventh pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 06:50 PDT — Worktree d37373c9 — Weekly sweep cycle (one-hundred-and-seventh pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 736 Python files, 228,651 LOC, 460 findings (22 high / 48 medium / 390 low), 0 safe-to-act, 460 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_065012.md
    - docs/code_health/2026-04-07_065012.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 489 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 06:39 PDT — Worktree d37373c9 — Weekly sweep cycle (one-hundred-and-sixth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 736 Python files, 228,651 LOC, 460 findings (22 high / 48 medium / 390 low), 0 safe-to-act, 460 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_063935.md
    - docs/code_health/2026-04-07_063935.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 489 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 06:32 PDT — Worktree d37373c9 — Weekly sweep cycle (one-hundred-and-third pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 736 Python files, 228,651 LOC, 460 findings (22 high / 48 medium / 390 low), 0 safe-to-act, 460 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_063150.md
    - docs/code_health/2026-04-07_063150.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 489 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 06:25 PDT — Worktree d37373c9 — Weekly sweep cycle (one-hundredth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 736 Python files, 228,651 LOC, 460 findings (22 high / 48 medium / 390 low), 0 safe-to-act, 460 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_062528.md
    - docs/code_health/2026-04-07_062528.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 489 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 06:14 PDT — Worktree d37373c9 — Weekly sweep cycle (ninety-ninth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 736 Python files, 228,651 LOC, 460 findings (22 high / 48 medium / 390 low), 0 safe-to-act, 460 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_061431.md
    - docs/code_health/2026-04-07_061431.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 489 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 06:08 PDT — Worktree d37373c9 — Weekly sweep cycle (ninety-sixth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 736 Python files, 228,651 LOC, 460 findings (22 high / 48 medium / 390 low), 0 safe-to-act, 460 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_060803.md
    - docs/code_health/2026-04-07_060803.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 489 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 06:01 PDT — Worktree d37373c9 — Weekly sweep cycle (ninety-second pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 736 Python files, 228,651 LOC, 460 findings (22 high / 48 medium / 390 low), 0 safe-to-act, 460 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_060153.md
    - docs/code_health/2026-04-07_060153.json
    • Key findings: api.py (46,739 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 489 root-level files (target <80)
    • Metrics stable vs prior sweep — minor increase (+2 files, +361 LOC, +2 findings) vs ninetieth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 05:55 PDT — Worktree d37373c9 — Weekly sweep cycle (ninetieth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 734 Python files, 228,299 LOC, 458 findings (22 high / 48 medium / 388 low), 0 safe-to-act, 458 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_055542.md
    - docs/code_health/2026-04-07_055542.json
    • Key findings: api.py (46,738 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 487 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs eighty-ninth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 05:48 PDT — Worktree d37373c9 — Weekly sweep cycle (eighty-seventh pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 734 Python files, 228,290 LOC, 458 findings (22 high / 48 medium / 388 low), 0 safe-to-act, 458 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_054814.md
    - docs/code_health/2026-04-07_054814.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 487 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs eighty-sixth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 05:41 PDT — Worktree d37373c9 — Weekly sweep cycle (eighty-third pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 734 Python files, 228,290 LOC, 458 findings (22 high / 48 medium / 388 low), 0 safe-to-act, 458 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_054116.md
    - docs/code_health/2026-04-07_054116.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 487 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs eighty-second pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 05:33 PDT — Worktree d37373c9 — Weekly sweep cycle (eighty-first pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 734 Python files, 228,290 LOC, 458 findings (22 high / 48 medium / 388 low), 0 safe-to-act, 458 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_053333.md
    - docs/code_health/2026-04-07_053333.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 487 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs eightieth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 05:26 PDT — Worktree d37373c9 — Weekly sweep cycle (seventy-seventh pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 734 Python files, 228,290 LOC, 458 findings (22 high / 48 medium / 388 low), 0 safe-to-act, 458 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_052645.md
    - docs/code_health/2026-04-07_052645.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 487 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs seventy-sixth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 05:20 PDT — Worktree d37373c9 — Weekly sweep cycle (seventy-sixth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 734 Python files, 228,290 LOC, 458 findings (22 high / 48 medium / 388 low), 0 safe-to-act, 458 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_052024.md
    - docs/code_health/2026-04-07_052024.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 487 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs seventy-fifth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 05:11 PDT — Worktree d37373c9 — Weekly sweep cycle (seventy-third pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 734 Python files, 228,290 LOC, 458 findings (22 high / 48 medium / 388 low), 0 safe-to-act, 458 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_051129.md
    - docs/code_health/2026-04-07_051129.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 487 root-level files (target <80)
    • Metrics stable vs prior sweep — +5 Python files, +818 LOC vs seventy-second pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 05:04 PDT — Worktree d37373c9 — Weekly sweep cycle (sixty-fifth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 729 Python files, 227,472 LOC, 454 findings (22 high / 48 medium / 384 low), 0 safe-to-act, 454 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_050449.md
    - docs/code_health/2026-04-07_050449.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 482 root-level files (target <80)
    • Metrics stable vs prior sweep — +1 Python file, +44 LOC vs sixty-fourth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 04:57 PDT — Worktree d37373c9 — Weekly sweep cycle (sixty-fourth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 728 Python files, 227,428 LOC, 454 findings (22 high / 48 medium / 384 low), 0 safe-to-act, 454 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_045749.md
    - docs/code_health/2026-04-07_045749.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 481 root-level files (target <80)
    • Metrics stable vs prior sweep — no significant change vs sixty-third pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 04:46 PDT — Worktree d37373c9 — Weekly sweep cycle (sixty-third pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 728 Python files, 227,428 LOC, 454 findings (22 high / 48 medium / 384 low), 0 safe-to-act, 454 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_044621.md
    - docs/code_health/2026-04-07_044621.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 481 root-level files (target <80)
    • Metrics stable vs prior sweep — no significant change vs sixty-second pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 04:39 PDT — Worktree d37373c9 — Weekly sweep cycle (sixty-second pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 727 Python files, 227,225 LOC, 453 findings (22 high / 48 medium / 383 low), 0 safe-to-act, 453 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_043929.md
    - docs/code_health/2026-04-07_043929.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 480 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs sixty-first pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 04:29 PDT — Worktree d37373c9 — Weekly sweep cycle (sixty-first pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 727 Python files, 227,225 LOC, 453 findings (22 high / 48 medium / 383 low), 0 safe-to-act, 453 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_042939.md
    - docs/code_health/2026-04-07_042939.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 480 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs sixtieth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 04:22 PDT — Worktree d37373c9 — Weekly sweep cycle (fifty-sixth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 727 Python files, 227,225 LOC, 453 findings (22 high / 48 medium / 383 low), 0 safe-to-act, 453 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_042225.md
    - docs/code_health/2026-04-07_042225.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 480 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs fifty-fifth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 04:11 PDT — Worktree d37373c9 — Weekly sweep cycle (fifty-fifth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 727 Python files, 227,225 LOC, 453 findings (22 high / 48 medium / 383 low), 0 safe-to-act, 453 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_041104.md
    - docs/code_health/2026-04-07_041104.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 480 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs fifty-fourth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 04:04 PDT — Worktree d37373c9 — Weekly sweep cycle (fifty-third pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 727 Python files, 227,225 LOC, 453 findings (22 high / 48 medium / 383 low), 0 safe-to-act, 453 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_040437.md
    - docs/code_health/2026-04-07_040437.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 480 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs fifty-second pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:56 PDT — Worktree d37373c9 — Weekly sweep cycle (fourteenth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 727 Python files, 227,225 LOC, 453 findings (22 high / 48 medium / 383 low), 0 safe-to-act, 453 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_035622.md
    - docs/code_health/2026-04-07_035622.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 480 root-level files (target <80)
    • Metrics stable vs prior sweep — no change vs thirteenth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:49 PDT — Worktree d37373c9 — Weekly sweep cycle (thirteenth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 727 Python files, 227,225 LOC, 453 findings (22 high / 48 medium / 383 low), 0 safe-to-act, 453 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_034900.md
    - docs/code_health/2026-04-07_034900.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 480 root-level files (target <80)
    • Metrics stable vs prior sweep — +1 Python file, +196 LOC, +1 finding vs twelfth pass
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:42 PDT — Worktree d37373c9 — Weekly sweep cycle (twelfth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,032 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_034224.md
    - docs/code_health/2026-04-07_034224.json
    • Key findings: api.py (46,729 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:35 PDT — Worktree d37373c9 — Weekly sweep cycle (eleventh pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,029 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_033542.md
    - docs/code_health/2026-04-07_033542.json
    • Key findings: api.py (46,726 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:29 PDT — Worktree d37373c9 — Weekly sweep cycle (tenth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,029 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_032916.md
    - docs/code_health/2026-04-07_032916.json
    • Key findings: api.py (46,726 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:23 PDT — Worktree d37373c9 — Weekly sweep cycle (ninth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,029 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_032319.md
    - docs/code_health/2026-04-07_032319.json
    • Key findings: api.py (46,726 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:16 PDT — Worktree d37373c9 — Weekly sweep cycle (eighth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,029 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_031716.md
    - docs/code_health/2026-04-07_031716.json
    • Key findings: api.py (46,726 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:10 PDT — Worktree d37373c9 — Weekly sweep cycle (seventh pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,029 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_031003.md
    - docs/code_health/2026-04-07_031003.json
    • Key findings: api.py (46,726 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 03:02 PDT — Worktree d37373c9 — Weekly sweep cycle (sixth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,029 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_030246.md
    - docs/code_health/2026-04-07_030246.json
    • Key findings: api.py (46,726 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 02:56 PDT — Worktree d37373c9 — Weekly sweep cycle (fifth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,029 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_025602.md
    - docs/code_health/2026-04-07_025602.json
    • Key findings: api.py (46,726 lines), tools.py (4,463 lines) as god files; main() (414+ defs), get_db() (88 defs), migrate() (61 defs) as top duplicate functions; 479 root-level files (target <80)
    • Metrics stable vs prior sweep — no new regressions detected
    • Result: Recurring code health sweep completed; no additional code changes required.

    2026-04-07 02:47 PDT — Worktree d37373c9 — Weekly sweep cycle (fourth pass)

    • Ran code health scan: python3 code_health_scan.py --save --skip-db
    • Results: 726 Python files, 227,014 LOC, 452 findings (22 high / 48 medium / 382 low), 0 safe-to-act, 452 needs-investigation
    • Generated artifacts:
    - docs/code_health/2026-04-07_024730.md
    - docs/code_health/2026-04-07_024730.json
    • Key findings: api.py (46,726 lines), tools.py (4,463 lines) as

    Tasks using this spec (1)
    [Senate] Recurring code health sweep
    Code Health blocked P94
    File: 2e7f22a0_673_code_health_sweep_spec.md
    Modified: 2026-04-25 23:40
    Size: 50.0 KB