From 2e9e6a7f44a266d59e628d9d5f2fb4ffd0c8c80b Mon Sep 17 00:00:00 2001 From: Lukasz Boryn Date: Tue, 21 Jul 2026 23:05:34 +0200 Subject: [PATCH] feat(moor): graduate ferry decisions and collapse the moored ferry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements blueprint 003, phase 7's second half. moor gains two steps: every resolved D- that passes the warrant test graduates into the why-register at the next free number, resolution body verbatim and blocked-by edges dropped; then ferries// collapses into ferries/.md carrying a sealed: pin (jj change id, git hash, ISO date) read off @-, since the sealing commit cannot name itself. Directory means open, file means moored, so `ls OKF/ferries/` finally answers what deliberation is in flight. Both guardrails that contradicted decisions 14/15 narrow rather than gain exceptions: never collapse without a resolvable pin, never graduate a decision that fails the warrant test. Done-criteria gate on okf-check, deferred from blueprint 002 pending this rule. okf-check learns the ferry shape rule — a page directly under ferries/ carries all three sealed: fields with a hex hash and an ISO date, and may not coexist with its directory. Shape only: resolving the pin needs the repo in hand, so refresh owns it, and a validator that cannot exit 0 on a tree copied outside its jj repo trains people to ignore it. That split earns decision 017. Verified against a throwaway scratch jj repo moored by hand per the rewritten SKILL.md: blueprint 003's Verify block PASS, okf-check clean on the fixture and on OKF/, moor at 106 lines and ROADMAP at 106. Co-Authored-By: Claude Opus 4.8 --- OKF/ROADMAP.md | 23 ++++---- .../003-graduate-and-collapse-ferries.md | 2 +- .../017-pin-drift-splits-by-visibility.md | 21 +++++++ OKF/decisions/index.md | 1 + OKF/index.md | 7 ++- skills/loop/moor/SKILL.md | 57 +++++++++++++++---- skills/loop/write-OKF/SKILL.md | 8 ++- skills/loop/write-OKF/okf-layout.md | 29 ++++++++-- skills/loop/write-OKF/scripts/okf-check | 35 +++++++++++- 9 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 OKF/decisions/017-pin-drift-splits-by-visibility.md diff --git a/OKF/ROADMAP.md b/OKF/ROADMAP.md index 7f7f15e..5d6670a 100644 --- a/OKF/ROADMAP.md +++ b/OKF/ROADMAP.md @@ -25,7 +25,7 @@ behind that claim, and what it debunked: [LEARNINGS.md](LEARNINGS.md). ## Locked decisions -16 live, in the why-register: [decisions/index.md](decisions/index.md). +17 live, in the why-register: [decisions/index.md](decisions/index.md). Each line is the question its decision settles. Cite by number. ## Architecture @@ -73,18 +73,15 @@ See [ARCHITECTURE.md](ARCHITECTURE.md); loop diagram in `README.md`. plans with zero empty ceremonial pages; `grep -rL "^purpose:"` over `OKF/**.md` returns only `index.md`; after moving a cited symbol, refresh reports DRIFT and leaves every judgement zone byte-identical. -7. **Why-register + ferry collapse** — create `OKF/decisions/` (indexed - by question, warrant frontmatter); migrate decisions 1–15 in, retire - empty `adr/`, shed debunked claims to LEARNINGS.md. moor gains the - graduation and collapse steps with the `sealed:` pin; refresh resolves - pins. **Verify:** ROADMAP ≤110 lines and every decision reachable from - `decisions/index.md`; `grep -rL "^type:" OKF/` still returns only - `index.md`; moor a fixture ferry → directory becomes one page, - decisions numbered, `jj show ` resolves; corrupt the pin → - refresh reports DRIFT. Ships in two blueprints — register first, ferry - collapse second (graduation needs the register to exist). Both close - on `okf-check` exiting 0 with output pasted. Register ✅ verified - 2026-07-21 (blueprint 002; okf-check clean, ROADMAP under the cap). +7. **Why-register + ferry collapse** — `OKF/decisions/` indexed by + question with warrant frontmatter; moor gains the graduation and + collapse steps with the `sealed:` pin. **Verify:** every decision + reachable from `decisions/index.md`; moor a fixture ferry → directory + becomes one pinned page, decisions numbered, `jj show ` + resolves, a shape-broken pin fails `okf-check`. ✅ verified 2026-07-21 + (blueprint 002) and 2026-07-22 (003; fixture moored by hand, okf-check + clean there and on OKF/, caps hold). Refresh's DRIFT rule is prose — + no runner, per 003's out-of-scope. **Execution order: 7 → 6.** Phase 7 is small, closes the cap breach now, and makes octobot's own OKF *run* the register before phase 6 freezes it diff --git a/OKF/blueprints/003-graduate-and-collapse-ferries.md b/OKF/blueprints/003-graduate-and-collapse-ferries.md index 68aa810..e7e8d9c 100644 --- a/OKF/blueprints/003-graduate-and-collapse-ferries.md +++ b/OKF/blueprints/003-graduate-and-collapse-ferries.md @@ -1,6 +1,6 @@ --- type: Blueprint -status: locked +status: implemented traces-to: ROADMAP.md phase 7 (decisions 14, 15) --- diff --git a/OKF/decisions/017-pin-drift-splits-by-visibility.md b/OKF/decisions/017-pin-drift-splits-by-visibility.md new file mode 100644 index 0000000..f51e12a --- /dev/null +++ b/OKF/decisions/017-pin-drift-splits-by-visibility.md @@ -0,0 +1,21 @@ +--- +type: Decision +purpose: Stop the next agent from "fixing" okf-check to resolve sealed: pins. +answers: + - "Why doesn't `okf-check` verify that a `sealed:` pin resolves?" +cites: + - skills/loop/write-OKF/scripts/okf-check + - skills/loop/write-OKF/SKILL.md +status: live +reversible: yes — the resolution check is a few lines either side +--- + +# 017 — pin drift splits by what each tool can see + +`okf-check` validates the **shape** of a moored ferry's `sealed:` pin — +three fields, hex hash, ISO date — and stops there. Resolving the change +id belongs to **refresh**, which has the repo in hand. The obvious +alternative, one tool doing both, breaks the rule that gives the +validator its teeth: an OKF tree copied out of its jj repo would fail a +check it cannot possibly satisfy, and a validator that cannot exit 0 +outside its home repo trains people to ignore it. diff --git a/OKF/decisions/index.md b/OKF/decisions/index.md index cdb43d1..c9c3dcf 100644 --- a/OKF/decisions/index.md +++ b/OKF/decisions/index.md @@ -28,3 +28,4 @@ Format: `NNN — — — `. - [014](014-ferry-decisions-graduate-at-moor.md) — What happens to a resolved ferry decision at moor? — it graduates here — live - [015](015-moor-collapses-ferry-directory.md) — What shape does a ferry take once it is moored? — one page, pinned with `sealed:` — live - [016](016-one-okf-check-validator.md) — How is OKF conformance enforced? — `okf-check`, output pasted — live +- [017](017-pin-drift-splits-by-visibility.md) — Why doesn't `okf-check` verify that a `sealed:` pin resolves? — it cannot see the repo; refresh owns resolution — live diff --git a/OKF/index.md b/OKF/index.md index 02b686c..3bf1b62 100644 --- a/OKF/index.md +++ b/OKF/index.md @@ -18,14 +18,17 @@ your task needs. Humans welcome too. ## Decisions - [decisions/index.md](decisions/index.md) — the why-register, indexed by - the question each decision settles. 16 live. + the question each decision settles. 17 live. ## Blueprints - [001](blueprints/001-add-write-readme-r.md) — add write-readme-r skill — draft - [002](blueprints/002-extract-why-register.md) — extract the why-register from ROADMAP — implemented -- [003](blueprints/003-graduate-and-collapse-ferries.md) — graduate ferry decisions and collapse the moored ferry — locked +- [003](blueprints/003-graduate-and-collapse-ferries.md) — graduate ferry decisions and collapse the moored ferry — implemented ## Ferries +Open ferries link their `MAP.md`; moored ones link the collapsed page +that replaced it — ` — moored → .md`. + - [python-siblings](ferries/python-siblings/MAP.md) — Python siblings for bdd/diagnose — 0/3 resolved diff --git a/skills/loop/moor/SKILL.md b/skills/loop/moor/SKILL.md index 2673741..9d41e7b 100644 --- a/skills/loop/moor/SKILL.md +++ b/skills/loop/moor/SKILL.md @@ -36,31 +36,64 @@ the wiki so the next cold-start agent reads reality, not history. - terms that recurred beyond the ferry → `CONTEXT.md` per model-domain; the delivered phase → checked off in `ROADMAP.md`; - relative dates → ISO 8601; dead cross-links fixed. -4. **PRUNE + INDEX** — sweep the arrived ferry for unextracted +4. **GRADUATE** — every resolved `D-` that passes model-domain's + warrant test becomes `decisions/NNN-.md` at the next free + number, carrying the frontmatter of + [DECISION-FORMAT.md](../../engineering/model-domain/DECISION-FORMAT.md) + plus a question-shaped `decisions/index.md` line. The `Resolution` + body moves **verbatim** — one home, never two copies; `Options` and + `Why it must be decided` stay behind for step 5. `blocked-by` edges + drop; the register is not a dependency graph. A resolution that + fails the warrant test graduates nowhere and stays in the collapsed + page — graduation is the default, not an obligation. +5. **COLLAPSE** — `ferries//` becomes `ferries/.md`: + problem shape, rejected alternatives, pointers to the numbers that + graduated. Directory means open, file means moored, so `ls + OKF/ferries/` answers what deliberation is still in flight. The page + opens `type: Ferry Map`, then the pin — read off `@-`, because the + sealing commit cannot name itself and the parent is where the + `D-` files still exist + (`jj log -r @- --no-graph -T 'change_id ++ " " ++ commit_id'`): + ```yaml + sealed: + change: + commit: + date: + ``` + Then remove the directory. History is the archive of record; the pin + is the way back into it. +6. **PRUNE + INDEX** — sweep the arrived ferry for unextracted follow-ups; every open thread gets a home + backlink: - small and implementable → new blueprint `NNN-.md` with `traces-to` citing the source decision; - big or multi-session → a new ferry, or a `ROADMAP.md` entry; - neither → a `LEARNINGS.md` note, so it stays findable. - Then rebuild the touched `index.md` lines (` — arrived → - MAP.md`; blueprint status lines) and run the conformance check: - `grep -rL "^type:" OKF/ --include='*.md'` returns only `index.md`. + Then rebuild the touched `index.md` lines — the ferry's changes shape + with its state, ` — moored → .md`, which is what + keeps the collapsed page reachable once its `MAP.md` is gone; the + register gains its new lines; blueprint statuses go current. ## Output / done criteria +- **`write-OKF/scripts/okf-check OKF/` run and its output pasted**, + exiting 0. A claim of conformance is not a gate. - The arrived ferry contains no forward-looking work — every follow-up has a new home with a backlink. -- `index.md` matches reality: ferry marked arrived, blueprint statuses - current, no dangling links. -- Ferry directory and blueprints intact — status flipped, zero deletions. +- `index.md` matches reality: the ferry line moored and pointing at the + collapsed page, blueprint statuses current, no dangling links. +- `ferries//` is gone, `ferries/.md` carries the pin, and + every graduated number is reachable from `decisions/index.md`. ## Guardrails -- **Never delete** a ferry directory, decision file, or blueprint — they - are the why-record. Supersede, don't delete. +- **Never collapse without a resolvable pin** — `jj show ` must + resolve *before* the directory goes. The pin is what makes the removal + recoverable; without it the deliberation is simply deleted. +- **Never delete** a blueprint or a graduated decision file — they are + the why-record. Supersede, don't delete. - **OKF files only** — moor never touches source code, configs, or skills. -- **Never auto-promote a decision** — an architecturally load-bearing - decision is only *flagged* as a candidate; model-domain's warrant test - gates `OKF/decisions/`. +- **Never graduate a decision that fails the warrant test** — a + resolution answering no question another page lacks stays in the + collapsed page; model-domain's test gates `OKF/decisions/`. - **Never moor a ferry with open decisions** — that's resolving by neglect. Go back to the ferry skill. diff --git a/skills/loop/write-OKF/SKILL.md b/skills/loop/write-OKF/SKILL.md index df186f4..ceb1f86 100644 --- a/skills/loop/write-OKF/SKILL.md +++ b/skills/loop/write-OKF/SKILL.md @@ -52,8 +52,12 @@ contract: [okf-layout.md](okf-layout.md). 4. Every ARCHITECTURE.md claim must be **traceable to a file** — cite `path` (or `path:line`) inline. A claim you can't cite doesn't go in. 5. Keep `index.md` complete: every page and every `blueprints/` entry - listed, one line each (`NNN — title — status`); every ferry one line - (` — n/m resolved → MAP.md`) — decisions stay in MAP.md only. + listed, one line each (`NNN — title — status`); every ferry one line, + in the shape its state calls for per + [okf-layout.md](okf-layout.md). +6. **Resolve the pins**: for each moored `ferries/.md`, check its + `sealed:` change id against the repo and report DRIFT if it is gone. + `okf-check` validates the pin's shape; only refresh can resolve it. ## Output / done criteria - **`scripts/okf-check ` run and its output pasted**, exiting 0. diff --git a/skills/loop/write-OKF/okf-layout.md b/skills/loop/write-OKF/okf-layout.md index 0422014..68b1cff 100644 --- a/skills/loop/write-OKF/okf-layout.md +++ b/skills/loop/write-OKF/okf-layout.md @@ -19,7 +19,8 @@ OKF/ ├── ROADMAP.md # phased plan — architect owns content ├── decisions/ # the why-register — index.md + NNN-.md ├── blueprints/ # NNN-.md only — flat, grep-able namespace -├── ferries/ # / — MAP.md + D--.md decision files +├── ferries/ # open: / — MAP.md + D--.md files +│ # moored: .md, pinned with sealed: └── LEARNINGS.md # debunked claims, gotchas — append-only, sourced ``` @@ -63,9 +64,29 @@ OKF/ - **blueprints/** — blueprint output; status lives in frontmatter, so the "tracker" is `grep -r "^status:" OKF/blueprints/`. index.md lists one line per blueprint: `NNN — title — status`. -- **ferries/** — one directory per ferry; MAP.md is the per-ferry index. - index.md lists one line per ferry: ` — n/m resolved → MAP.md`; - decisions are never listed in index.md (single source: MAP.md). +- **ferries/** — **directory means open, file means moored.** An open + ferry is `/` with MAP.md as its per-ferry index; index.md lists + ` — n/m resolved → MAP.md` and never its decisions (single + source: MAP.md). [moor](../moor/SKILL.md) graduates the resolved + decisions into `decisions/` and collapses the directory into + `.md` — problem shape, rejected alternatives, graduated + numbers — indexed ` — moored → .md`. The two + shapes may never coexist. A moored page carries `sealed:` after its + `type`, pinning the deliberation it dropped to the commit *before* the + collapse: + + ```yaml + sealed: + change: + commit: + date: + ``` + + Pin drift splits by what each tool can see: `okf-check` validates the + **shape** (all three fields, hex hash, ISO date), because it must exit + 0 on a tree copied outside its jj repo; **refresh** has the repo in + hand and validates **resolution**, reporting DRIFT when the change id + no longer resolves. - **LEARNINGS.md** — what was believed / what is true / source. Never edited retroactively, only appended or superseded. diff --git a/skills/loop/write-OKF/scripts/okf-check b/skills/loop/write-OKF/scripts/okf-check index ca78e63..f7ef7af 100755 --- a/skills/loop/write-OKF/scripts/okf-check +++ b/skills/loop/write-OKF/scripts/okf-check @@ -3,8 +3,13 @@ Errors (exit 1): missing type, missing warrant, duplicate answer, unresolvable cite, page unreachable from index.md, register index line -disagreeing with its decision file. Warnings (exit 0): page over the +disagreeing with its decision file, moored ferry with a malformed +`sealed:` pin or a surviving directory. Warnings (exit 0): page over the 110-line cap, page with no cites. + +Pin *shape* only — whether the change id still resolves needs the repo in +hand, which is write-OKF refresh's job, not a validator that must exit 0 +on an OKF tree copied outside its jj repo. """ import re import sys @@ -92,6 +97,33 @@ def cite_resolves(cite, page, okf): return any((root / path).exists() for root in roots) +def pin(text): + """Fields of `sealed:`, the one nested block the frontmatter carries.""" + head = text.partition("\n---")[0] if text.startswith("---\n") else "" + block = re.search(r"^sealed:\n((?:[ \t]+.*\n?)+)", head, re.M) + return dict(re.findall(r"([a-z]+):\s*(\S+)", block.group(1))) if block else {} + + +def check_ferries(okf, errors): + """A page directly under ferries/ is a moored ferry: pinned, collapsed.""" + ferries = okf / "ferries" + if not ferries.is_dir(): + return + for page in sorted(ferries.glob("*.md")): + rel = page.relative_to(okf.parent) + if (ferries / page.stem).is_dir(): + errors.append(f"{rel}: coexists with ferries/{page.stem}/ — open or moored, never both") + fields = pin(page.read_text()) + missing = [f for f in ("change", "commit", "date") if f not in fields] + if missing: + errors.append(f"{rel}: sealed: missing {', '.join(missing)}") + continue + if not re.fullmatch(r"[0-9a-f]{8,64}", fields["commit"]): + errors.append(f"{rel}: sealed: commit is not a hex hash: {fields['commit']}") + if not re.fullmatch(r"\d{4}-\d{2}-\d{2}", fields["date"]): + errors.append(f"{rel}: sealed: date is not ISO 8601: {fields['date']}") + + def check_register(okf, warrants, errors): """Register index lines must quote their decision's own question.""" index = okf / "decisions" / "index.md" @@ -165,6 +197,7 @@ def main(argv): if not cite_resolves(cite, page, okf): errors.append(f"{rel}: unresolvable cite: {cite}") + check_ferries(okf, errors) check_register(okf, warrants, errors) for line in warnings: