Skip to content

feat(PyAutoBrain): hygiene conductor — phase 3 perf mode #91

Description

@Jammy2211

Overview

Phase 3 (final core phase) of the PyAutoBrain hygiene conductor (P1 scaffold #88, P2 modes #90). Bring the perf mode live — developer-loop cost: slow unit tests, slow integration-mode workspace scripts, and import time — completing all five modes. Keeps the phase-2 shape: cheap read-only pre-scan + delegate; the conductor never runs heavy audits and never mutates a repo. Umbrella: PyAutoMind/issued/hygiene_agent.md.

Plan

  • import-cost pre-scan — time python3 -c "import <pkg>" per library in a subprocess (best-effort; the conductor stays bash and never imports the JAX stack itself). Report per-library import seconds; libraries over threshold are the actionable signal; not-importable → advisory.
  • consult Heart for heavy signals — slow tests/scripts are already tracked by PyAutoHeart's script_timing / test_run legs; perf surfaces those (via vitals / pyauto-heart) rather than re-running them, and routes the slow items. ("measurement lives in Heart; hygiene acts.")
  • delegate fixes — slow function → /refactor or /bug; JAX-adaptation surfaced as a recommendation, never an automatic rewrite.
  • extend --json perf row from staged to real rows; flip perf live in the conductor + veneer (nothing then remains staged); default worklist ranks the perf import signal alongside tidy debris.
Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary)

Work Classification

Library (Brain-source)

Implementation Steps

  1. agents/conductors/hygiene/hygiene.sh — add prescan_perf (subprocess import timing per library, best-effort, threshold flag) + a Heart-timing consult (surface script_timing/test_run findings); make perf a live mode (drop the staged branch); extend the --json row.
  2. agents/conductors/hygiene/AGENTS.md — flip perf from staged → live; document the import-pre-scan + Heart-consult + delegate.
  3. skills/hygiene/hygiene.md — remove the "perf staged" note (nothing staged now).
  4. tests/test_hygiene_conductor.py — extend hermetic tests for the perf row shape (it is no longer staged).

Key Files

  • agents/conductors/hygiene/hygiene.sh — the conductor to extend.
  • agents/_common.shconsult_vitals_verdict / resolve_heart for the Heart consult.

Charter guard

The import timing runs in a subprocess — the conductor never imports JAX/the science stack into the Brain process (stdlib/bash only).

Testing

pyauto-brain hygiene perf emits real import timings + surfaced Heart findings (human + --json); nothing reports staged; PyAutoBrain tests/ green.

Deferred (NOT this phase)

A standing PyAutoHeart import_time (or cli_noise) leg — adding Heart legs is a PyAutoHeart change; keep phase 3 PyAutoBrain-only and note the leg as a follow-up if the import pre-scan proves worth promoting to a tracked Heart signal.

Autonomy

--auto, effective supervised (header supervised ∧ feature-medium cap safe). Parks at ship sign-off. Merge/close human.

Original Prompt

Click to expand starting prompt

Phase 3 (final): bring the hygiene conductor's perf mode live — dev-loop cost (slow unit tests, slow integration-mode scripts, import time). Keep phase-2 shape (pre-scan + delegate; never mutate). import-cost pre-scan times python3 -c "import pkg" per library in a subprocess (conductor never imports JAX); consult Heart's script_timing/test_run for slow tests/scripts and route to refactor/bug; JAX-adapt is a judgement recommendation. Flip perf live (nothing staged after). Defer a standing Heart import_time leg. Done when perf emits real timings + Heart findings, nothing staged, tests green.

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