Skip to content

feat(board): knowledge board emits the state.json cockpit feed #104

Closed

Description

@Jammy2211

Overview

Phase 1 of the organ cockpit (PyAutoBrain#416) defined the per-organ state.json v1 feed — contract board/state_schema.json, validator + CLI board/_state.py in PyAutoBrain — and made the Brain and Heart boards emit it. The cockpit page of a later phase reads only this feed, so every organ board must publish one. This member makes the Memory knowledge board emit it, mirroring PyAutoHeart#238. Bundle organ-cockpit-feeds (sibling member: PyAutoHands), epic organ-cockpit.

Plan

  • scripts/board.py gains to_state(snapshot), fmt == "state" and a --state flag beside --badge.
  • knowledge_board.yml renders _site/state.json and validates it with the checked-out Brain validator (fails the job on drift).
  • Tests in tests/test_board.py pin keys, enums, the Z timestamp, item links and the grey no-data path; no Brain import, no tenant literals.
Detailed implementation plan

Affected Repositories

  • PyAutoMemory (primary)

Branch Survey

Repository Current Branch Dirty?
./organs/PyAutoMemory main (behind 2, ff) clean — no other claim

Suggested branch: feature/memory-state-feed
Worktree: ~/Code/PyAutoLabs-wt/organ-cockpit-feeds/ (shared with the Hands member)

Implementation Steps

  1. scripts/board.py — to_state(snapshot) -> dict (stdlib): status grey when _totals(snapshot)["pages"] == 0; yellow if the inbox or interests digest is stale (_inbox_freshness(...)["stale"]) or any wiki carries stubs/todos; else green. Memory has no red condition (nothing can break) — the docstring says so. headline = the badge message (N pages · P% cited). updated = snapshot generated as whole-second …Z, unparseable → now. pages_url = pages_url(snapshot). items = stale inbox/interests → yellow with the board URL; each wiki with stubs/todos → info with the existing _stub_prompt/_todo_prompt payload; inbox papers waiting → info with _queue_issue_url. fmt == "state" in render; --state in the mutually-exclusive group with --badge.
  2. .github/workflows/knowledge_board.yml — render step adds python scripts/board.py --state > _site/state.json; new step "Validate the cockpit feed against the Brain contract": python3 PyAutoBrain/board/_state.py _site/state.json (PyAutoBrain is already checked out at ./PyAutoBrain). Header comment lists state.json beside badge.json.
  3. tests/test_board.py — on the synthetic tree fixture: required keys, status enum, updated ends with Z and parses, stubs → info items with prompts, stale inbox → yellow, empty tree → grey, render(fmt="state") renders. Copy the 6-line required/enum check; do not import Brain. Tenant firewall with --root <worktree> must be OK.

Key Files

  • scripts/board.py — renderer (badge_endpoint, _totals, _inbox_freshness, _queue_issue_url, _stub_prompt, _todo_prompt, pages_url)
  • .github/workflows/knowledge_board.yml — render + validate steps
  • tests/test_board.py

Verification

  • pytest tests/test_board.py -q; python scripts/board.py --state | python ../PyAutoBrain/board/_state.py - → state: ok
  • After merge: knowledge_board.yml run green with the validate step logging state: ok; curl https://pyautolabs.github.io/PyAutoMemory/state.json validates.

Original Prompt

Click to expand starting prompt

Organ cockpit: PyAutoMemory knowledge board emits state.json

Type: feature
Target: PyAutoMemory
Repos:

  • PyAutoMemory
    Difficulty: small
    Autonomy: safe
    Priority: high
    Status: formalised
    Consequence: notify
    Witness: knowledge_board.yml run on main green with the validate step logging 'state: ok'; curl https://pyautolabs.github.io/PyAutoMemory/state.json passes the validator CLI.
    Review-minutes: 0
    Unattended: ready
    Epic: organ-cockpit

Phase 1 (issue 416 in the Brain, shipped 2026-09-26) defined the per-organ state.json v1 cockpit feed (contract board/state_schema.json, validator + CLI board/_state.py in the Brain checkout the board job already has at ./PyAutoBrain). This prompt makes the Memory knowledge board emit it, mirroring the Heart pattern.

  1. scripts/board.py in PyAutoMemory: a --state flag beside --badge rendering the v1 feed: status from the badge colour (red/orange/lightgrey/brightgreen -> red/yellow/grey/green), headline = the badge message, updated = the render timestamp as ISO-8601 Z, pages_url = https://pyautolabs.github.io/PyAutoMemory/, items = the actionable rows the board already renders (stale wiki pages, unprovenanced entries, reading-queue waits) with GitHub links.
  2. .github/workflows/knowledge_board.yml: python scripts/board.py --state > _site/state.json in the render step, then a validate step python3 PyAutoBrain/board/_state.py _site/state.json that fails the job on drift.
  3. Tests beside the existing board tests in PyAutoMemory: required keys, status enum, updated ends with Z; Memory tests must not import the Brain.

Witness: knowledge_board.yml run on main green with the validate step logging 'state: ok'; curl https://pyautolabs.github.io/PyAutoMemory/state.json passes the validator CLI.

🤖 Generated with Claude Code

Activity

  1. Jammy2211 commented on Sep 26, 2026

    @Jammy2211
    CollaboratorAuthor

    Library PR created — under Heart RED override

    PR: #105 — to_state + --state on the board renderer, workflow emits _site/state.json and validates it with PyAutoBrain/board/_state.py. pytest 219 passed (9 new; one pre-existing PYAUTO_BRAIN env failure in test_theme_finds_grouped_brain_from_outer_workspace noted for follow-up). Brain validator state: ok; tenant firewall OK.

    Heart RED override (development only). Heart readiness RED (snapshot 2026-09-26T11:27:07+00:00); verbatim reason: release validation FAILED (stage integrate) — pre-existing integrate failure, unrelated to the board code. Human authorization, live, 2026-09-26, this session: "ok io authorize you to continue" (development shipping + merge on green checks; no release).

  2. added a commit that references this issue on Sep 26, 2026
  3. Jammy2211 commented on Sep 26, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped

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