Repository navigation
Description
Overview
Every organ board is a static Pages page rebuilt by a daily cron, and the human manages the ecosystem from a pile of browser tabs with nothing directing attention to a RED Heart. Phase 1 of the organ cockpit adds the two layers everything later builds on: a shared machine-readable state.json feed per organ (contract + validator in the Brain, emitted by the Brain and Heart boards) and a transition-only push alert on the Heart board. Truth stays in GitHub; no server, no Electron. Epic: organ-cockpit (PyAutoMind draft filed 2026-09-26).
Brain, Heart and Hands already publish badge.json (the cross-board headline contract) and per-organ board.json of differing shapes; this task formalises a small common feed on top rather than replacing either.
Plan
- Define a v1
state.jsoncontract (organ, repo, status, headline, updated, pages_url, items with GitHub links) with a stdlib validator and fixtures in PyAutoBrain. - Brain board emits
state.jsonnext tobadge.json/board.jsonon every publish. - Heart board emits
state.jsonfrom its readiness verdict and validates it in the workflow using the checked-out Brain validator. - Heart workflow fetches the previously published feed and sends one ntfy push only when the status changes (GREEN→RED, RED→GREEN, …); no push when unchanged or on first run.
- Unit tests pin the validator, both renderers and the alert transition logic.
- Two PRs, one issue: PyAutoBrain first (contract), PyAutoHeart second (needs the validator on Brain main).
Detailed implementation plan
Affected Repositories
- PyAutoBrain (primary)
- PyAutoHeart
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./organs/PyAutoBrain | main | clean (claimed by eyes-organ-order and cosmos-web-ring-greeting; disjoint files → parallel worktree) |
| ./organs/PyAutoHeart | main (behind 1, ff) | clean (claimed by eyes-organ-order; disjoint files → parallel worktree) |
Suggested branch: feature/organ-cockpit-state-feed
Worktree: ~/Code/PyAutoLabs-wt/organ-cockpit-state-feed/
Implementation Steps — PR 1 (PyAutoBrain)
board/state_schema.json— documented v1 contract:
{"schema_version": 1, "organ": "heart", "repo": "PyAutoHeart", "status": "green|yellow|red|stale|grey", "headline": "<one line>", "updated": "<ISO-8601 UTC>", "pages_url": "https://pyautolabs.github.io/PyAutoHeart/", "items": [{"severity": "red|yellow|info", "text": "...", "url": "<GitHub link>", "prompt": "<optional copy-for-Claude payload>"}]}board/_state.py— stdlib only (no jsonschema dependency, matching_board.py):validate_state(obj) -> list[str](empty = valid),build_state(...)helper, and apython board/_state.py <file|->CLI exiting 1 on errors so any organ workflow can validate its emission.board/_board.py—render_state(data): mapbadge_color→ status (red→red,orange→yellow,lightgrey→grey,brightgreen→green),headline(data),data["generated"]→updated, actionable rows (Heart blockers, overnight failures, community waits) →items.--applywritesstate.jsonbesidebadge.json(the writer block near line 1689, print line updated); add a--stateflag mirroring--badge.tests/fixtures/state/brain.json,tests/fixtures/state/heart.json;tests/test_state_feed.py— both fixtures validate; bad status / missing field / non-UTC stamp rejected;render_stateon thetest_board.pysample data validates.board/AGENTS.md— one paragraph namingstate.jsonas the cockpit feed alongsidebadge.json.brain_board.ymlunchanged (--apply --out _sitealready publishes the directory).
Implementation Steps — PR 2 (PyAutoHeart, after PR 1 merges)
heart/dashboard.py—to_state(board)andfmt == "state"/--stateflag: verdict → status, first red/yellow reason or "clear" → headline,board.ts→ updated,board.blockers→ items (run_url/repo_url,prompt). Workflow renders_site/state.jsonbesideboard.jsonand validates it withpython PyAutoBrain/board/_state.py _site/state.json(Brain is already checked out in the job).heart/alert.py— puretransition(previous_status, new_status) -> str | None(only when changed) andnotify(kind, state, url)POSTing to ntfy (Title/Priority/Tags headers, body = headline + items; Pushover deferred). CLIpython -m heart.alert --previous prev.json --current _site/state.json, exit 0 always, printsalert: noneoralert: green→red sent..github/workflows/heart-health.yml— before "Upload Pages artifact":curl -fsS https://pyautolabs.github.io/PyAutoHeart/state.json -o prev.json || echo '{}' > prev.json, then the CLI withHEART_NTFY_URLfrom secrets (step prints a notice and skips when unset). First run = no alert; recovery (RED→GREEN) also notifies.tests/test_alert.py— GREEN→RED one POST; GREEN→GREEN zero; RED→GREEN one; missing previous zero; POST failure never raises (mockurlopen).tests/test_dashboard.py—to_stateoutput satisfies the required-field/status rules (Heart tests do not import Brain).- Human step: create the
HEART_NTFY_URLrepo secret and install ntfy on phone/laptop (recorded in the PR body).
Key Files
PyAutoBrain/board/_board.py— board collect + renders; gainsrender_statePyAutoBrain/board/_state.py— new contract validator + CLIPyAutoBrain/board/state_schema.json— new documented contractPyAutoHeart/heart/dashboard.py— gainsto_statePyAutoHeart/heart/alert.py— new transition alertPyAutoHeart/.github/workflows/heart-health.yml— emit, validate, alert steps
Verification
- Brain:
pytest tests/test_state_feed.py tests/test_board.py;board/board.sh --apply --out /tmp/xwrites astate.jsonthat passespython board/_state.py. - Heart:
pytest tests/test_alert.py tests/test_dashboard.py;python -m heart.dashboard --cloud --state | python PyAutoBrain/board/_state.py -. - After merge + deploy:
curl https://pyautolabs.github.io/{PyAutoBrain,PyAutoHeart}/state.jsonvalidate; a verdict flip produces exactly one ntfy push and the following unchanged run produces none (the prompt's Witness).
Original Prompt
Click to expand starting prompt
Organ cockpit phase 1: state.json feed schema and Heart transition alert
Type: feature
Target: PyAutoBrain
Repos:
- PyAutoBrain
- PyAutoHeart
Difficulty: large
Autonomy: safe
Priority: high
Status: formalised
Consequence: notify
Witness: PyAutoBrain ships schema/state_schema.json and a validator with a test over fixture feeds for Brain and Heart; the two board workflows publish state.json (curl of the Pages URL returns JSON that passes the validator after the next deploy); the Heart alert step is exercised by a unit test that feeds GREEN->RED and GREEN->GREEN state pairs and asserts one POST and zero POSTs respectively.
Review-minutes: 0
Unattended: ready
Epic: organ-cockpit
Every organ dashboard is a static Pages HTML page regenerated by a daily cron. The human manages the ecosystem from those pages as a pile of browser tabs, and nothing directs attention to a RED Heart. Phase 1 of the organ cockpit adds the two layers everything later builds on, without moving truth off GitHub. This prompt covers the Brain and the Heart only; the other organs adopt the feed in follow-up prompts once the schema exists.
- A fixed state.json schema (organ, status colour, updated stamp, one-line headline, attention items each with a GitHub link) plus a validator, living in PyAutoBrain. The Brain board workflow (brain_board.yml) emits state.json next to its Pages board as the reference implementation, and the Heart board workflow (heart-health.yml) emits its own from the readiness verdict.
- A transition-only push alert on the PyAutoHeart board workflow: compare the new readiness verdict with the previous state and, only on a change such as GREEN to RED, POST to an ntfy or Pushover topic held in a repo secret.
Out of scope (later phases): the remaining organs emitting the feed (one small prompt each), the PWA cockpit page on pyautolabs.github.io reading all feeds with Heart pinned first, the start_dev Heart-RED gate, a tray-dot script, the Claude Code status line. No server, no Electron, no browser-side GitHub API reads.
Witness: PyAutoBrain ships schema/state_schema.json and a validator with a test over fixture feeds for Brain and Heart; the two board workflows publish state.json (curl of the Pages URL returns JSON that passes the validator after the next deploy); the Heart alert step is exercised by a unit test that feeds GREEN->RED and GREEN->GREEN state pairs and asserts one POST and zero POSTs respectively.
🤖 Generated with Claude Code
Activity
Jammy2211 commentedon Sep 26, 2026
Library PR created (PR 1 of 2) — under Heart RED override
PR 1 (PyAutoBrain): #417 — state.json v1 contract, validator + CLI, Brain board emits
state.json. 71 tests pass (23 new); live render validates; tenant firewall OK.PR 2 (PyAutoHeart) is committed on
feature/organ-cockpit-state-feedin the task worktree (424d745 + 0c10d3f:to_state,heart/alert.py, workflow emit/validate/alert steps; 1063 tests pass) and opens after PR 1 merges, since its workflow validation step runsPyAutoBrain/board/_state.pyfrom the checked-out Brain main. TheHEART_NTFY_URLsecret is already set on PyAutoHeart.Heart RED override (development only). Heart readiness RED (score 5, snapshot 2026-09-26T11:02:36+00:00); verbatim reasons:
PyAutoNerves: 1 commit(s) behind originPyAutoFit: 2 commit(s) behind originrelease validation FAILED (stage integrate)The first two are local-checkout staleness (fast-forwarded this session); the third is the pre-existing integrate failure, unrelated to
board/. Human authorization, live, 2026-09-26, this session: "ok merge the pr and contonue".Merge pull request #417 from PyAutoLabs/feature/organ-cockpit-state-feed
Jammy2211 commentedon Sep 26, 2026
PR 1 #417 merged (pytest 3.12/3.13 green; human merge command in session). PR 2 opened: PyAutoLabs/PyAutoHeart#238 (same RED override record in its body).
Jammy2211 commentedon Sep 26, 2026
Shipped
Validate the cockpit feed against the Brain contract→state: ok;Push a transition alert→alert: none (unknown→stale)(first run, no previously published feed — by design).python board/_state.py:red | 6 need you · partial view (2 legs unread) | 9 itemsstale | test run status unknown (no report.json) | 3 itemsHEART_NTFY_URLsecret set; the human verified the ntfy path with a manual push. Witness leg still to be observed naturally: the first Heart status change after this run sends exactly one push, the following unchanged run none.Follow-ups (later phases, not filed yet): remaining organs emit
state.json(one small prompt each — Mind, Cortex, Memory, Hands, Eyes, Gut, Nerves); PWA cockpit page on pyautolabs.github.io; start_dev Heart-RED gate; tray dot; Claude Code status line.