Skip to content

feat: noise-filter the health sync dashboard + repo_cleanup hygiene nudge #41

Description

@Jammy2211

Overview

The venv-startup health table (scripts/health_sync.sh) dumps raw git status --porcelain per repo — ~1,000 lines on a typical day, almost all regenerated dataset artifacts. Heart already classifies real-vs-noise (heart/noise.py + noise_globs in config/repos.yaml) for the deep census, but the startup dashboard never applies it, burying the handful of real items. This wires the existing classifier into the dashboard, and adds a hygiene nudge that keeps /repo_cleanup running semi-regularly.

Plan

  • Reuse heart.noise classification in the startup table: MOD/UNTR count real files only, a new NOISE column carries the rest.
  • List only real files in the "Dirty files:" section; collapse noise to a one-line per-repo summary; health --all restores the full raw listing.
  • Extend noise_globs for the classes the 2026-07-09 sweep found slipping through (*.npy, tracer_imaging/point.json, point-dataset .csv, dataset.json).
  • Graceful fallback to today's raw output when the classifier is unavailable.
  • Hygiene nudge: warn when the last /repo_cleanup audit stamp (~/.cache/pyauto/repo_cleanup_last_audit.json) is missing or >7 days old.
Detailed implementation plan

Affected Repositories

  • PyAutoHeart (primary)

Branch Survey

Repository Current Branch Dirty?
./PyAutoHeart main clean

Suggested branch: feature/health-sync-noise-filter

Implementation Steps

  1. heart/noise.py: add split_lines(porcelain_lines, noise_globs) -> (real_lines, noise_lines) preserving porcelain codes; reimplement classify_dirty on top of it (behavior unchanged). Add --batch <in-dir> --real-out <out-dir> CLI mode: per porcelain file <in-dir>/<name>, write real-only lines to <out-dir>/<name>, print <name>\t<real_mod>\t<real_untr>\t<noise>. One python call for all repos keeps the <10s budget.
  2. config/repos.yaml: extend noise_globs with *.npy, *tracer_*.json, *point_dataset*.csv, *dataset.json.
  3. scripts/health_sync.sh: two passes — gather (existing loop, no printing; porcelain to $tmp/p/<name>), one python3 -m heart.noise --batch call, then print. Table gains NOISE column; * flag only when real>0, new ~ flag when noise>0; follow-up categorisation keeps total counts (conservative for pulls). Dirty listing = real lines + noise summary line; --all = full raw. Python failure → raw fallback with (noise classification unavailable) note. After the table: hygiene nudge when the audit stamp is stale (${PYAUTO_CLEANUP_NUDGE_DAYS:-7}).
  4. scripts/health.sh: route a leading-dash first arg (health --all) to _health_sync.
  5. tests/test_noise.py: split_lines code preservation, rename handling, batch round-trip via tmp_path, classify_dirty regression.

Key Files

  • heart/noise.py — classifier; gains line-level + batch API
  • scripts/health_sync.sh — the startup dashboard
  • scripts/health.sh — dispatcher
  • config/repos.yamlnoise_globs
  • tests/test_noise.py — coverage

Follow-up (separate task)

One-line edit to PyAutoBrain/skills/repo_cleanup — "write the audit stamp after the audit phase" — deferred: PyAutoBrain checkout is claimed by clone-mitosis-agent. Until then the stamp is written manually by sweep runs (2026-07-09's run wrote one).

Original Prompt

Click to expand starting prompt

Noise-filter the health_sync startup table + recurring repo_cleanup cadence

Type: feature
Target: PyAutoHeart
Difficulty: small
Autonomy: supervised
Priority: normal

Original request (verbatim)

When I open my virtual enviroment and it runs health, I still get a lot of
stuff: [~1,000-line dirty-file dump across HowTo*/workspace repos] […]
Is there an agent in PyAutoBrain whose job it is to clean this up? […]
I normally just run the health agent and let it do a "full" census of
everything so I think it should be catgching this stuff too?

do both, and make sure theres a plant hat will ensure repo_cleanup runs
semi regularly

Context

The venv-startup health table comes from PyAutoHeart/scripts/health_sync.sh
(_health_sync), which dumps raw git status --porcelain per repo. Heart
already has a real-vs-noise classifier — heart/noise.py + noise_globs in
config/repos.yaml — that matches essentially all of the ~1,000 regenerated
dataset artifacts flooding the output (*.fits, *data.json, *model.json,
*tracer.json, *.png, *test_report.md, …). The deep census classifies;
the startup dashboard doesn't. The handful of real items (staged notebook
deletions in autolens_workspace_test, personal notes, untracked AGENTS.md
files) are buried.

Scope

  • Make health_sync.sh reuse the heart.noise classification: MOD/UNTR
    columns show noise-collapsed counts (e.g. 315 dirty → 313 noise, 2 real),
    and the "Dirty files:" listing shows real files only, with a per-repo
    one-line noise summary.
  • Add an --all flag to restore today's full raw listing.
  • Keep the table fast (classification is fnmatch on porcelain already in hand;
    no extra git calls) and keep working when heart.noise/PyYAML is
    unavailable (fall back to raw counts, flagged as unclassified).
  • Update/extend Heart tests covering the sync table if any exist.
  • Cadence leg: establish a semi-regular /repo_cleanup cadence — a
    scheduled weekly audit-only run (read-only phase 1 report, e.g. alongside
    the existing morning-health crons) that surfaces the report for the user;
    mutations stay interactive per the skill's confirmation rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions