feat(moor): graduate ferry decisions and collapse the moored ferry

Implements blueprint 003, phase 7's second half. moor gains two steps:
every resolved D-<n> 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/<topic>/ collapses into
ferries/<topic>.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 <noreply@anthropic.com>
This commit is contained in:
Łukasz Boryń 2026-07-21 23:05:34 +02:00
parent 1d75c42c89
commit 2e9e6a7f44
9 changed files with 148 additions and 35 deletions

View File

@ -25,7 +25,7 @@ behind that claim, and what it debunked: [LEARNINGS.md](LEARNINGS.md).
## Locked decisions ## 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. Each line is the question its decision settles. Cite by number.
## Architecture ## 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 plans with zero empty ceremonial pages; `grep -rL "^purpose:"` over
`OKF/**.md` returns only `index.md`; after moving a cited symbol, `OKF/**.md` returns only `index.md`; after moving a cited symbol,
refresh reports DRIFT and leaves every judgement zone byte-identical. refresh reports DRIFT and leaves every judgement zone byte-identical.
7. **Why-register + ferry collapse** — create `OKF/decisions/` (indexed 7. **Why-register + ferry collapse** — `OKF/decisions/` indexed by
by question, warrant frontmatter); migrate decisions 1–15 in, retire question with warrant frontmatter; moor gains the graduation and
empty `adr/`, shed debunked claims to LEARNINGS.md. moor gains the collapse steps with the `sealed:` pin. **Verify:** every decision
graduation and collapse steps with the `sealed:` pin; refresh resolves reachable from `decisions/index.md`; moor a fixture ferry → directory
pins. **Verify:** ROADMAP ≤110 lines and every decision reachable from becomes one pinned page, decisions numbered, `jj show <change>`
`decisions/index.md`; `grep -rL "^type:" OKF/` still returns only resolves, a shape-broken pin fails `okf-check`. ✅ verified 2026-07-21
`index.md`; moor a fixture ferry → directory becomes one page, (blueprint 002) and 2026-07-22 (003; fixture moored by hand, okf-check
decisions numbered, `jj show <change>` resolves; corrupt the pin → clean there and on OKF/, caps hold). Refresh's DRIFT rule is prose —
refresh reports DRIFT. Ships in two blueprints — register first, ferry no runner, per 003's out-of-scope.
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).
**Execution order: 7 → 6.** Phase 7 is small, closes the cap breach now, **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 and makes octobot's own OKF *run* the register before phase 6 freezes it

View File

@ -1,6 +1,6 @@
--- ---
type: Blueprint type: Blueprint
status: locked status: implemented
traces-to: ROADMAP.md phase 7 (decisions 14, 15) traces-to: ROADMAP.md phase 7 (decisions 14, 15)
--- ---

View File

@ -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.

View File

@ -28,3 +28,4 @@ Format: `NNN — <question it settles> — <verdict> — <status>`.
- [014](014-ferry-decisions-graduate-at-moor.md) — What happens to a resolved ferry decision at moor? — it graduates here — live - [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 - [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 - [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

View File

@ -18,14 +18,17 @@ your task needs. Humans welcome too.
## Decisions ## Decisions
- [decisions/index.md](decisions/index.md) — the why-register, indexed by - [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 ## Blueprints
- [001](blueprints/001-add-write-readme-r.md) — add write-readme-r skill — draft - [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 - [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 ## Ferries
Open ferries link their `MAP.md`; moored ones link the collapsed page
that replaced it — `<topic> — moored <date> → <topic>.md`.
- [python-siblings](ferries/python-siblings/MAP.md) — Python siblings for bdd/diagnose — 0/3 resolved - [python-siblings](ferries/python-siblings/MAP.md) — Python siblings for bdd/diagnose — 0/3 resolved

View File

@ -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 - terms that recurred beyond the ferry → `CONTEXT.md` per
model-domain; the delivered phase → checked off in `ROADMAP.md`; model-domain; the delivered phase → checked off in `ROADMAP.md`;
- relative dates → ISO 8601; dead cross-links fixed. - relative dates → ISO 8601; dead cross-links fixed.
4. **PRUNE + INDEX** — sweep the arrived ferry for unextracted 4. **GRADUATE** — every resolved `D-<n>` that passes model-domain's
warrant test becomes `decisions/NNN-<slug>.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/<topic>/` becomes `ferries/<topic>.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-<n>` files still exist
(`jj log -r @- --no-graph -T 'change_id ++ " " ++ commit_id'`):
```yaml
sealed:
change: <jj change id>
commit: <git hash>
date: <ISO 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: follow-ups; every open thread gets a home + backlink:
- small and implementable → new blueprint `NNN-<slug>.md` with - small and implementable → new blueprint `NNN-<slug>.md` with
`traces-to` citing the source decision; `traces-to` citing the source decision;
- big or multi-session → a new ferry, or a `ROADMAP.md` entry; - big or multi-session → a new ferry, or a `ROADMAP.md` entry;
- neither → a `LEARNINGS.md` note, so it stays findable. - neither → a `LEARNINGS.md` note, so it stays findable.
Then rebuild the touched `index.md` lines (`<topic> — arrived → Then rebuild the touched `index.md` lines — the ferry's changes shape
MAP.md`; blueprint status lines) and run the conformance check: with its state, `<topic> — moored <date> → <topic>.md`, which is what
`grep -rL "^type:" OKF/ --include='*.md'` returns only `index.md`. keeps the collapsed page reachable once its `MAP.md` is gone; the
register gains its new lines; blueprint statuses go current.
## Output / done criteria ## 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 - The arrived ferry contains no forward-looking work — every follow-up
has a new home with a backlink. has a new home with a backlink.
- `index.md` matches reality: ferry marked arrived, blueprint statuses - `index.md` matches reality: the ferry line moored and pointing at the
current, no dangling links. collapsed page, blueprint statuses current, no dangling links.
- Ferry directory and blueprints intact — status flipped, zero deletions. - `ferries/<topic>/` is gone, `ferries/<topic>.md` carries the pin, and
every graduated number is reachable from `decisions/index.md`.
## Guardrails ## Guardrails
- **Never delete** a ferry directory, decision file, or blueprint — they - **Never collapse without a resolvable pin** — `jj show <change>` must
are the why-record. Supersede, don't delete. 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 - **OKF files only** — moor never touches source code, configs, or
skills. skills.
- **Never auto-promote a decision** — an architecturally load-bearing - **Never graduate a decision that fails the warrant test** — a
decision is only *flagged* as a candidate; model-domain's warrant test resolution answering no question another page lacks stays in the
gates `OKF/decisions/`. collapsed page; model-domain's test gates `OKF/decisions/`.
- **Never moor a ferry with open decisions** — that's resolving by - **Never moor a ferry with open decisions** — that's resolving by
neglect. Go back to the ferry skill. neglect. Go back to the ferry skill.

View File

@ -52,8 +52,12 @@ contract: [okf-layout.md](okf-layout.md).
4. Every ARCHITECTURE.md claim must be **traceable to a file** — cite 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. `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 5. Keep `index.md` complete: every page and every `blueprints/` entry
listed, one line each (`NNN — title — status`); every ferry one line listed, one line each (`NNN — title — status`); every ferry one line,
(`<topic> — n/m resolved → MAP.md`) — decisions stay in MAP.md only. in the shape its state calls for per
[okf-layout.md](okf-layout.md).
6. **Resolve the pins**: for each moored `ferries/<topic>.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 ## Output / done criteria
- **`scripts/okf-check <okf-dir>` run and its output pasted**, exiting 0. - **`scripts/okf-check <okf-dir>` run and its output pasted**, exiting 0.

View File

@ -19,7 +19,8 @@ OKF/
├── ROADMAP.md # phased plan — architect owns content ├── ROADMAP.md # phased plan — architect owns content
├── decisions/ # the why-register — index.md + NNN-<slug>.md ├── decisions/ # the why-register — index.md + NNN-<slug>.md
├── blueprints/ # NNN-<slug>.md only — flat, grep-able namespace ├── blueprints/ # NNN-<slug>.md only — flat, grep-able namespace
├── ferries/ # <topic>/ — MAP.md + D-<n>-<slug>.md decision files ├── ferries/ # open: <topic>/ — MAP.md + D-<n>-<slug>.md files
│ # moored: <topic>.md, pinned with sealed:
└── LEARNINGS.md # debunked claims, gotchas — append-only, sourced └── LEARNINGS.md # debunked claims, gotchas — append-only, sourced
``` ```
@ -63,9 +64,29 @@ OKF/
- **blueprints/** — blueprint output; status lives in frontmatter, so the - **blueprints/** — blueprint output; status lives in frontmatter, so the
"tracker" is `grep -r "^status:" OKF/blueprints/`. index.md lists one "tracker" is `grep -r "^status:" OKF/blueprints/`. index.md lists one
line per blueprint: `NNN — title — status`. line per blueprint: `NNN — title — status`.
- **ferries/** — one directory per ferry; MAP.md is the per-ferry index. - **ferries/** — **directory means open, file means moored.** An open
index.md lists one line per ferry: `<topic> — n/m resolved → MAP.md`; ferry is `<topic>/` with MAP.md as its per-ferry index; index.md lists
decisions are never listed in index.md (single source: MAP.md). `<topic> — 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
`<topic>.md` — problem shape, rejected alternatives, graduated
numbers — indexed `<topic> — moored <date> → <topic>.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: <jj change id>
commit: <git hash>
date: <ISO 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 - **LEARNINGS.md** — what was believed / what is true / source. Never
edited retroactively, only appended or superseded. edited retroactively, only appended or superseded.

View File

@ -3,8 +3,13 @@
Errors (exit 1): missing type, missing warrant, duplicate answer, Errors (exit 1): missing type, missing warrant, duplicate answer,
unresolvable cite, page unreachable from index.md, register index line 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. 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 re
import sys import sys
@ -92,6 +97,33 @@ def cite_resolves(cite, page, okf):
return any((root / path).exists() for root in roots) 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): def check_register(okf, warrants, errors):
"""Register index lines must quote their decision's own question.""" """Register index lines must quote their decision's own question."""
index = okf / "decisions" / "index.md" index = okf / "decisions" / "index.md"
@ -165,6 +197,7 @@ def main(argv):
if not cite_resolves(cite, page, okf): if not cite_resolves(cite, page, okf):
errors.append(f"{rel}: unresolvable cite: {cite}") errors.append(f"{rel}: unresolvable cite: {cite}")
check_ferries(okf, errors)
check_register(okf, warrants, errors) check_register(okf, warrants, errors)
for line in warnings: for line in warnings: