diff --git a/OKF/CONTEXT.md b/OKF/CONTEXT.md index 0ae0bd2..d5e4594 100644 --- a/OKF/CONTEXT.md +++ b/OKF/CONTEXT.md @@ -102,9 +102,11 @@ in the blueprint's frontmatter. _Avoid_: research, investigation, spike. **Line cap**: The per-file limit a page kind carries — 110 for SKILL.md and OKF pages, -150 for blueprints. Over it errors: a legal move always exists. -_Avoid_: limit, budget. +250 for `ROADMAP.md`, `CONTEXT.md`, a guide, or a blueprint (B-031), +selected by declared `type:`, not path. Over it errors: a legal move +always exists. _Avoid_: limit, budget. **House cap**: -The 110 itself — the line cap SKILL.md and OKF pages share. Topic-named -siblings load on demand and carry no cap. +The 110 itself — the line cap SKILL.md and most OKF pages share. The +wide-cap kinds are worked against, not read cold — see **Line cap**. +Topic-named siblings load on demand and carry no cap. diff --git a/OKF/blueprints/B-031-widen-the-okf-line-cap-and-add-a-guide-page-type.md b/OKF/blueprints/B-031-widen-the-okf-line-cap-and-add-a-guide-page-type.md new file mode 100644 index 0000000..6e4fcff --- /dev/null +++ b/OKF/blueprints/B-031-widen-the-okf-line-cap-and-add-a-guide-page-type.md @@ -0,0 +1,126 @@ +--- +type: Blueprint +status: implemented +traces-to: user request 2026-10-01 +sounded: 2026-10-01 +cites: + - skills/loop/write-OKF/scripts/okf-check + - skills/loop/write-OKF/okf-layout.md + - skills/loop/write-OKF/split-page.md + - OKF/learnings/okf-format.md +muster: false # Verify runs okf-check against real + synthetic fixtures and checks exit codes — observes the cap/type logic directly, not just "tests pass" +--- + +# 031 — widen the OKF line cap and add a Guide page type + +## Justification + +A downstream consumer (`gcbds-ta-tgt-report`) wants `OKF/` to be a repo's +single source of truth, with nothing durable left in `docs/` for a human +to read and silently drift out of sync with what an agent sees. Two +gaps block that: (1) `ROADMAP.md` and `CONTEXT.md` have no split +mechanism — `ROADMAP.md` prunes, never splits; `CONTEXT.md` is "one +canonical glossary... never splits" — so the current 110-line cap is the +only ceiling they have, with nowhere to go at cap+1 besides losing +content; (2) worked-example/howto docs (dataset-config walkthroughs, +external-notebook provenance writeups) have no spine page at all to live +on — `modules/`/`analyses/` are warrant-exempt but still capped at 110, +too tight for a tutorial with inline code. + +This traces to a user request in conversation, reconciled against prior +art already in this repo's history: an unmerged branch +(commit `e84fdf486ae6`, blueprints then-numbered 027/028, both now stale +— collide with `main`'s current B-030 numbering and predate the +`R-`/`B-` filename-prefix convention B-030 introduced) had independently +raised `ROADMAP.md`+blueprint+`CONTEXT.md` caps to 250 using a +`type:`-frontmatter-based selection. That design is reused here; the +branch itself is not merged or rebased — redone fresh against `main`. + +## Contract + +- `scripts/okf-check`'s line-cap check changes from two tiers + (`CAP = 110`, `BLUEPRINT_CAP = 150`) to two tiers at different + thresholds: `CAP = 110` stays the default; a new `WIDE_CAP = 250` + applies when either `"blueprints" in rel.parts` (unchanged path rule) + **or** the page's frontmatter `type:` is `"Roadmap"`, `"Glossary"`, or + `"Guide"` (new — type-based, not path-based, so it follows `ROADMAP.md` + / `CONTEXT.md` by declared kind rather than filename). +- A new page type `Guide` is added to the OKF spine: pages live at + `OKF/guides/.md`, carry `type: Guide`, and are warrant-exempt the + same way `modules/`/`analyses/` are (not root-scoped per + `page-warrant.md`'s "root pages and `decisions/`" scope line). + `OKF/guides/` is proposed nowhere by `taxonomy-scan.md` — a guide is + always authored, never scan-proposed, so it carries no `okf:derived` + fence. +- A guide over the 250-line cap grows from `.md` into `/` + (`guide.md` + sibling files) the same directory-growth shape + blueprints already use at their own cap — except a guide's sibling + files are typically extracted runnable code (the inline R/Python block + pulled out of the prose into a real script the guide then cites), + not blueprint-style notes. +- `okf-layout.md`'s page-set diagram, Conformance page-type list, Page + contracts section (a new `Guide` bullet), and Rules section's cap + sentence are updated to state the above. +- `split-page.md`'s opening cap sentence and a new "When the page is a + guide" section (parallel to the existing "When the page is a + blueprint" one) are added, naming code-extraction as the move. +- `OKF/learnings/okf-format.md` gains one new believed/true/source entry + recording a real footgun found while rigging the stale branch's B-028: + a blueprint's Verify step that pads and then restores (`jj restore` / + `git restore`) a file the *same blueprint* edits silently loses the + edit, because restore pulls from the parent and `describe` does not + move the change there until `jj new` — so the file reverts to + pre-edit state while the Verify still prints `OK`. + +## Seams touched + +- `skills/loop/write-OKF/scripts/okf-check` — the `CAP`/`BLUEPRINT_CAP` + constants and the cap-selection branch inside the per-page loop. +- `skills/loop/write-OKF/okf-layout.md` — spine diagram, Conformance + page-type enum, Page contracts section, Rules section. +- `skills/loop/write-OKF/split-page.md` — opening sentence, new Guide + section. +- `OKF/learnings/okf-format.md` — one new append-only entry. +- `OKF/CONTEXT.md` — **Line cap** / **House cap** glossary entries, which + state the current 110/150 numbers and must track the new ones. + +## Verify + +```bash +cd skills/loop/write-OKF +# 1. No regression: this repo's own OKF still validates. +python3 scripts/okf-check ../../../OKF +# 2. The new cap/type logic actually fires, both directions. +python3 - <<'PY' +import pathlib, subprocess, sys, tempfile +root = pathlib.Path(tempfile.mkdtemp()) / "OKF" +root.mkdir() +(root / "index.md").write_text( + '---\nokf_version: "0.1"\n---\n# t\n- [a](a.md)\n- [b](b.md)\n' +) +filler = "\n" * 200 +(root / "a.md").write_text(f'---\ntype: Roadmap\n---\n# a\n{filler}') +(root / "b.md").write_text(f'---\ntype: Architecture\n---\n# b\n{filler}') +r = subprocess.run([sys.executable, "scripts/okf-check", str(root)], + capture_output=True, text=True) +out = r.stdout + r.stderr +assert "a.md: over the" not in out, "Roadmap page wrongly capped at 110" +assert "b.md: over the 110-line cap" in out, "Architecture page should still cap at 110" +print("OK — Roadmap exempt, Architecture still capped") +PY +``` + +Both must exit/print clean — the real-repo check exits 0, the synthetic +check prints `OK`. + +## Out of scope + +- Merging or rebasing the stale `e84fdf486ae6` branch — its design is + reused, its history is not. +- Applying this to `gcbds-ta-tgt-report`'s `docs/` — a separate + follow-up once this blueprint ships, not part of this Verify. +- Raising any cap beyond the two tiers stated (`decisions/`, + `modules/`, `analyses/`, `LEARNINGS.md`/`learnings/` stay at 110). +- A second guardrail blueprint for the Verify-restore footgun (the + stale branch's B-029) — recorded as a `LEARNINGS.md` entry only, + prose, not tooling, unless a future `/rig` run hits it again. diff --git a/OKF/blueprints/index.md b/OKF/blueprints/index.md index 93687d0..1ae7df3 100644 --- a/OKF/blueprints/index.md +++ b/OKF/blueprints/index.md @@ -37,3 +37,4 @@ superseded-by-NNN`. Numbers are permanent — supersede, never renumber. - [028](B-028-convert-cross-skill-links-to-skill-names.md) — convert cross-skill links to unchecked skill names — implemented - [029](B-029-prefix-register-filenames-and-validate-okf-structure.md) — validate OKF directory completeness and normalize blueprints/ferries indexing — implemented - [030](B-030-migrate-register-filenames-to-their-prefix.md) — migrate decision and blueprint filenames to their R-/B- prefix — implemented +- [031](B-031-widen-the-okf-line-cap-and-add-a-guide-page-type.md) — widen the OKF line cap and add a Guide page type — implemented diff --git a/OKF/learnings/okf-format.md b/OKF/learnings/okf-format.md index c02af65..312a635 100644 --- a/OKF/learnings/okf-format.md +++ b/OKF/learnings/okf-format.md @@ -36,3 +36,14 @@ status: live visibility principle it follows from. A decision that *extends* a live one without changing it is that one applied, not a new one. Source: warrant test, session 2026-07-22; 020 stays unspent. +- Believed: a Verify step that pads a file and then restores it is safe + once the padding is described in prose. True: `jj restore` (and `git + restore` / `git checkout --`) restores from the **parent** revision, + and `describe` does not move the working-copy edits there — they stay + on `@` until the next `jj new`. A Verify that pads and restores a path + the *same blueprint* also edits throws that edit away, silently, + possibly more than once, while every step still prints `OK`. A Verify + may only pad-and-restore paths outside its own blueprint's edits; a + path inside them needs a different check shape (diff against a named + commit, not restore-and-compare). Source: a prior unmerged exploration + of B-031's own cap-raise, discovered while sounding it. diff --git a/skills/loop/write-OKF/okf-layout.md b/skills/loop/write-OKF/okf-layout.md index 8cdfc65..70b506d 100644 --- a/skills/loop/write-OKF/okf-layout.md +++ b/skills/loop/write-OKF/okf-layout.md @@ -23,6 +23,8 @@ OKF/ │ # moored: .md, pinned with sealed: ├── modules/ # proposable, never mandatory: .md per code ├── analyses/ # directory / analysis directory a scan found +├── guides/ # authored, never scan-proposed: .md howtos +│ # grows into / (guide.md + extracted code) └── LEARNINGS.md # debunked claims, gotchas — append-only, sourced; # splits into learnings/ (index.md + .md) ``` @@ -40,8 +42,9 @@ loop, not on disk. - `index.md` carries **only** `okf_version: "0.1"` in its frontmatter — the one field the spec permits there. Reserved name, lowercase. - Page types: `Summary`, `Architecture`, `Glossary` (CONTEXT and - `context/*`), `Roadmap`, `Learnings`, `Decision`, `Index`, `Blueprint`, - `Ferry Map`. New page kinds coin a new type — types are producer-defined. + `context/*`), `Roadmap`, `Guide`, `Learnings`, `Decision`, `Index`, + `Blueprint`, `Ferry Map`. New page kinds coin a new type — types are + producer-defined. - **Warrant and pins** — `purpose`, `answers[]`, `cites[]`, their scope, and the moored-ferry `sealed:` block: [page-warrant.md](page-warrant.md). - **Cite grammar** — a `cites:` entry is `path`, `path:line`, or @@ -74,10 +77,12 @@ loop, not on disk. - **CONTEXT.md** — glossary per model-domain's context-format.md. **One canonical glossary per bounded context — never per issue.** Issue-local terms live in their blueprint until they recur. Splits into - `context/.md` only when multi-context; over the cap in a - single-context repo is that rule already broken. + `context/.md` only when multi-context; carries the wide cap + (`type: Glossary`) in a single-context repo precisely because it has + no other move. - **ROADMAP.md** — chart's skeleton (locked decisions, phases with - verify steps, risks, out-of-scope). At the cap it **prunes**, never + verify steps, risks, out-of-scope). Carries the wide cap + (`type: Roadmap`) for the same reason. At the cap it **prunes**, never splits: a discharged phase collapses to one line naming what shipped and its blueprint numbers, which hold the detail. - **decisions/** — the why-register: one file per settled decision, @@ -105,6 +110,14 @@ loop, not on disk. `type` (plus `review-base:` when the ferry mustered), pinning the deliberation it dropped to the commit *before* the collapse — fields and drift rule in [page-warrant.md](page-warrant.md). +- **guides/** — authored howtos with worked examples (dataset-config + walkthroughs, external-provenance writeups) — never scan-proposed, no + `okf:derived` fence, warrant-exempt like `modules/`/`analyses/` + (outside `page-warrant.md`'s "root pages and `decisions/`" scope). + Carries the wide cap. At the cap it **extracts**: inline runnable code + moves out of the prose into sibling files, `.md` growing into + `/` (`guide.md` + the extracted files) the same way a blueprint + grows into `NNN-/`. - **LEARNINGS.md** — what was believed / what is true / source. Never edited retroactively, only appended or superseded. At the cap it splits into `learnings/`: the page itself moves to `learnings/index.md` and the @@ -117,12 +130,14 @@ loop, not on disk. - Durable knowledge only — no session state, no high-frequency logs (that's `/write-handoff` territory). - One fact, one home; cross-link with relative paths. -- Every page ≤110 lines, a blueprint ≤150; grow by splitting + indexing, - not by scrolling. Over cap is an **error**, not a warning, because every - kind above has a move at cap+1 — [split-page.md](split-page.md). +- Every page ≤110 lines; `ROADMAP.md`, `CONTEXT.md`, `guides/*` and a + blueprint ≤250 — the pages worked against, not read cold. Grow by + splitting + indexing, not by scrolling. Over cap is an **error**, not + a warning, because every kind above has a move at cap+1 — + [split-page.md](split-page.md). - A growth-path directory is created **lazily** — when the cap forces it, never scaffolded empty at init. - Blueprints may grow from `NNN-.md` into `NNN-/` directories - (blueprint.md + notes) — the glossary never moves in there. Over 150 + (blueprint.md + notes) — the glossary never moves in there. Over 250 lines reads as **scope** first: two blueprints, or a `/ferry`. diff --git a/skills/loop/write-OKF/scripts/okf-check b/skills/loop/write-OKF/scripts/okf-check index 029e704..b14ec0a 100755 --- a/skills/loop/write-OKF/scripts/okf-check +++ b/skills/loop/write-OKF/scripts/okf-check @@ -21,7 +21,7 @@ import sys from pathlib import Path CAP = 110 -BLUEPRINT_CAP = 150 +WIDE_CAP = 250 # Roadmap, Glossary, Guide, and blueprints — worked against, not read cold LINE_SUFFIX = re.compile(r"\d+(-\d+)?") @@ -314,8 +314,12 @@ def main(argv): if not fields.get("type"): errors.append(f"{rel}: missing type:") # Every page kind has a growth path at cap+1, so the cap is an - # error: a legal move always exists. See split-page.md. - cap = BLUEPRINT_CAP if "blueprints" in rel.parts else CAP + # error: a legal move always exists. See split-page.md. Wide + # pages are selected by declared type, not path, so ROADMAP.md + # and CONTEXT.md get the wider cap wherever they live. + wide = ("blueprints" in rel.parts + or fields.get("type") in ("Roadmap", "Glossary", "Guide")) + cap = WIDE_CAP if wide else CAP if len(text.splitlines()) > cap: errors.append(f"{rel}: over the {cap}-line cap") diff --git a/skills/loop/write-OKF/split-page.md b/skills/loop/write-OKF/split-page.md index 1edfdb1..4f04d56 100644 --- a/skills/loop/write-OKF/split-page.md +++ b/skills/loop/write-OKF/split-page.md @@ -1,9 +1,10 @@ # Splitting a page at the cap -`okf-check` errors when a page passes its cap — 110 lines, 150 for a -blueprint. This is that error's procedure. Which move a page gets is its -contract in [okf-layout.md](okf-layout.md); this page is *how* to make the -move without losing content or breaking the bundle. +`okf-check` errors when a page passes its cap — 110 lines, 250 for +`ROADMAP.md`, `CONTEXT.md`, a guide, or a blueprint. This is that error's +procedure. Which move a page gets is its contract in +[okf-layout.md](okf-layout.md); this page is *how* to make the move +without losing content or breaking the bundle. ## The move is pure @@ -75,13 +76,25 @@ deleted once. ## When the page is a blueprint -Over 150 lines, ask what is long before splitting the file. A blueprint +Over 250 lines, ask what is long before splitting the file. A blueprint naming three things in its slug is over-*scoped*, not over-written: compound work that still fits one session becomes two blueprints, and work past one session goes to `/ferry`, whose own trigger is exactly this. The `NNN-/` directory form is for a blueprint's notes, not for a blueprint that should have been two. +## When the page is a guide + +Over 250 lines, ask what is *prose* and what is *code* before splitting +the file — a guide runs long because a worked example is frozen inline, +not because the procedure itself is over-scoped. Extract: pull each +runnable block out into a real sibling file (a script the guide can +cite instead of embed), the same `.md` → `/` move a +blueprint makes at its own cap, except the directory holds extracted +code alongside `guide.md`, not notes. Only split into two guides when +the *procedure* names two unrelated howtos, the same over-scope test a +blueprint gets. + ## Done criteria - `scripts/okf-check ` exits 0, output pasted.