Skip to content

feat: batch watch — live terminal view of a running shift #575

Closed

Description

@Jammy2211

Overview

Add a read-only pyauto-brain batch watch command: a live terminal view of a running shift. It shows the time left, each task's state and pick reason, PR/CI health and the budgets, and refreshes in place. It reads only what the shift watcher already records. It is a follow-up from the orchestrator pilot (#574), wanted before the first live shift.

Prompt: PyAutoMind/draft/feature/pyautobrain/batch_watch_live_view.md

Plan

  • Add batch watch (with --once, --interval), which reads the brief, counters.json, the leases and tick.log.
  • Share per-task state wording with the digest, so the live view and the digest never disagree.
  • On a live shift: at most one claude agents --json per refresh; gh pr checks cached per interval.
  • Strictly read-only: no write to the slot, Mind or GitHub, enforced by a test.
  • Docs paragraph in the batch AGENTS.md and the pilot README.

Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary (a non-PASS Witness → human /prm).

Detailed implementation plan

Affected repositories

  • PyAutoBrain (primary)

Work classification

Library (Brain organ code)

Branch survey

Repository Current branch Dirty?
PyAutoBrain main clean

Suggested branch: feature/batch-watch-live-view
Worktree root: ~/Code/PyAutoLabs-wt/batch-watch-live-view/

Implementation steps

  1. _digest.task_state(task, counters, leases, agents, health). Factored out of _line, which keeps byte-identical digest output. It adds live-only states: running, blocked (stalled since), awaiting redispatch.
  2. New agents/conductors/batch/_watch.py. snapshot() (reads via _orchestrator.read_counters and leases), render(), and a watch() loop. The header shows slot, SHADOW/LIVE, time to review-at: or "closed", STOP, last tick and action. Then the task lines (state, why, PR + health, redispatch count), budgets against max-sessions:, token-budget: and merge-cap:, and the last 5 tick.log actions. A slot with no folder yet prints "no tick yet".
  3. _batch.py: add the watch verb plus --once and --interval (default and minimum 30 s); it reuses --record and --home.
  4. Network: claude agents --json only when live and leases exist; gh pr checks only for unmerged PRs, cached per interval.
  5. Tests tests/test_batch_watch.py: shadow, live and no-tick fixtures; slot bytes identical after --once; digest/watch state parity; header time logic. Plus the firewall check (--root <worktree>) and the full Brain suite (2 test_prompt_budget failures already exist on main).
  6. Witness: --once output on the real shadow slot 2026-11-05-am and on the live fixture, pasted into the PR.
  7. Docs: batch AGENTS.md (shift watcher section) and the pilot README line.

Out of scope: the watcher opening a brief before dispatched:. That is logged on #574 and is a separate fix.

Key files

  • agents/conductors/batch/_digest.py: shared task state
  • agents/conductors/batch/_watch.py: new
  • agents/conductors/batch/_batch.py: verb wiring
  • tests/test_batch_watch.py: new

🤖 Generated with Claude Code

Activity

  1. Jammy2211 commented on Nov 4, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged in #576 (28fb9175) as a glance-tier in-turn merge: Witness PASS, CI green on both pytest legs, Heart YELLOW acknowledged by the human.

    pyauto-brain batch watch --record <brief> [--once] [--interval N] is a live, read-only view of a running shift. From a task worktree, pass --home ~/Code/PyAutoLabs-wt/.orchestrator; from the canonical checkout the default state home is correct.

    Revert: git revert -m 1 28fb9175 in PyAutoBrain.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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