Skip to content

cortex: the schema and the repo skeleton — phase 1 of cortex-birth (PyAutoMind#379) - #1

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/cortex-schema-skeleton
Sep 1, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/cortex-schema-skeleton

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

The Cortex skeleton — phase 1 of the cortex-birth epic (PyAutoLabs/PyAutoMind#379). This PR decides what the Cortex is as files: a run-and-ruling registry (project → phase → runs → rulings) with the ten-state phase model, GitHub-ref gates, the append-only rulings ledger of record ("a verdict recorded only outside the Cortex does not exist"), the rolling-board batch schema, and one stdlib lifecycle script.

  • Schemas and docs (AGENTS.md, REFERENCE.md, README.md, rulings/AGENTS.md, batches/**/AGENTS.md, batches/packets/TEMPLATE.md): phase header keys and the transition table; run lines in SLURM notation (342091_[0-8,10]) with pulled_to:/after:/resumes:/where: continuation lines; ruling ids R-YYYYMMDD-nn, one file per phase, chains not trees, supersede never edit; one review vocabulary accept | rerun | drop | leave-to-finish; the laptop-lane closures quoted verbatim.
  • projects.yaml — the science body map in a documented restricted YAML subset (stdlib-parsed, PyYAML-parity tested); code, not ledger, like repos.yaml. Live map empty; rows are phase 3.
  • scripts/cortex.py — check (hermetic; every rule in REFERENCE.md), gates [--grade [--write]] (PR gates clear only on merge; closed-not-planned issues are dead gates; unreadable fails closed; --grade reports, --write flips), rule, move, new. Minimal in-place header edits; injectable date and fetch.
  • scripts/ledger_merge.py — the Mind's classifier with phases/ rulings/ batches/ + epics.md as ledger, plus append-only enforcement: any non-add status under rulings/** needs a human.
  • Workflows — cortex_check.yml (check + pytest on push/PR) and ledger_merge.yml (auto-merge ledger-only claude/** branches; cortex.py check runs on the trial-merge tree so two branches assigning the same ruling id cannot both land).
  • docs/schema_decisions.md — 37 dated entries: every choice the epic left open, so phase 2's Brain conductor reads decisions rather than guessing.
  • Tests — tests/fixtures/skeleton (ten phases, one per state; five rulings incl. a chain and a leave-to-finish; a batch record and review) and tests/fixtures/empty are the witness; 123 tests cover every check rule as a negative, every legal and refused transition, rule/gates/new, and the YAML-subset parity.
  • Generated by repos_sync.py --write: CLAUDE.md, the session hook, .claude/settings.json, and the organism-map/history/remote blocks in AGENTS.md.

Deviations from the phase prompt, all recorded in schema_decisions.md: projects.yaml is code not ledger; no Mind PR (the hook propagation already fans out to every body-map row); no skills/, so no install.sh change.

Scripts Changed

  • scripts/cortex.py (new, 1613 lines) — the five verbs
  • scripts/ledger_merge.py (new) — classifier + append-only leg
  • tests/test_cortex.py, tests/test_ledger_merge.py, tests/fixtures/**
  • .github/workflows/cortex_check.yml, .github/workflows/ledger_merge.yml

Test Plan

  • python3 scripts/cortex.py check --root tests/fixtures/skeleton → OK (the witness); empty and the live tree → OK
  • python3 -m pytest tests -q → 123 passed
  • repos_sync.py --check --root <worktree> → 15 legs OK with the Cortex checkout present
  • cortex_check.yml green on this PR

Generated by the PyAutoLabs agent workflow.

Jammy2211 and others added 2 commits September 1, 2026 17:58
…PyAutoMind#379)

Bootstrap of the run-and-ruling registry: AGENTS/README/REFERENCE in the
Mind register, projects.yaml (restricted YAML subset, empty map, one
commented worked example), epics.md with mind-half:, rulings/AGENTS.md
(append-only, supersede-never-edit), the rolling-board batches docs with
the one review grammar, policy copies, docs/schema_decisions.md (31 dated
decisions), cortex_check.yml and ledger_merge.yml (trial-merge check), the
repos_sync-generated CLAUDE.md / .claude/ and spliced AGENTS.md blocks, and
the test fixtures (skeleton: one project, one phase per state, five rulings
with one chain, one batch record + review; empty). scripts/ and tests/*.py
follow in part B.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SESCzU1FcwktEAdTZfmf3j
… part B (PyAutoMind#379)

scripts/cortex.py — check · gates · rule · move · new, stdlib only,
main(argv), --root and --today on every verb; the light-header parser and
in-place header editor; the restricted-YAML loop for projects.yaml; every
check rule in REFERENCE.md as a leg over `root: Path`; gates grading with an
injectable fetch (gh api first, urllib fallback, User-Agent pyautocortex).

scripts/ledger_merge.py — the Mind's classifier re-pointed (phases/,
rulings/, batches/, epics.md) plus the append-only leg: a `git diff
--name-status` entry under rulings/ that is not `A` is code.

tests/test_cortex.py (99) and tests/test_ledger_merge.py (24): both fixtures
pass check unchanged; every check rule as a tmp_path mutation; every legal
transition and every refused one; rule ids, supersession, --also fan-out;
gates --grade/--write with an injected fetch; new; PyYAML parity.

No fixture was changed. REFERENCE.md and docs/schema_decisions.md gain the
choices the code forced (decisions 32–37): the `Reset:` key, `--pulled-to`,
the typo-guard checks, the partition default, `--also` on accepted phases,
the demotion removing `Gates-cleared:`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SESCzU1FcwktEAdTZfmf3j
@Jammy2211
Jammy2211 merged commit c24bf52 into main Sep 1, 2026
1 check passed
@Jammy2211
Jammy2211 deleted the feature/cortex-schema-skeleton branch September 2, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant