diff --git a/OKF/ROADMAP.md b/OKF/ROADMAP.md index 5bec25f..4e42b56 100644 --- a/OKF/ROADMAP.md +++ b/OKF/ROADMAP.md @@ -74,7 +74,9 @@ See [ARCHITECTURE.md](ARCHITECTURE.md); loop diagram in `README.md`. the warranted scope — `OKF/*.md` plus `decisions/` — returns only `index.md`; after moving a cited symbol, `okf-check` reports the broken cite and refresh leaves every judgement zone byte-identical. - Ships as 004 (cites + fences) then 005 (taxonomy scan). + Shipped as 004 (cites + fences) then 005 (taxonomy scan). + ✅ verified 2026-07-22 (004, then 005 — two fixtures, two different + non-empty plans; scaffolded OKF passes okf-check, ROADMAP unwritten). 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 @@ -91,9 +93,7 @@ into a contract for other repos. Numbers stay as issued — append-only. ## Risks & gotchas -- Open, for phase 6's blueprint: `cites:` pinned at `path:line` churns on - every refactor — the staleness detector is also the maintenance bill. - Candidate mitigation `path:symbol` where the language allows. +None open — 004's `path:symbol` cite shape spent phase 6's churn risk. ## Out of scope diff --git a/OKF/blueprints/005-propose-the-page-plan-from-a-repo-scan.md b/OKF/blueprints/005-propose-the-page-plan-from-a-repo-scan.md index daa070d..8804354 100644 --- a/OKF/blueprints/005-propose-the-page-plan-from-a-repo-scan.md +++ b/OKF/blueprints/005-propose-the-page-plan-from-a-repo-scan.md @@ -1,6 +1,6 @@ --- type: Blueprint -status: locked +status: implemented traces-to: ROADMAP.md phase 6, part B (decisions 007, 009, 010) --- diff --git a/OKF/index.md b/OKF/index.md index e72a571..8ba0606 100644 --- a/OKF/index.md +++ b/OKF/index.md @@ -26,7 +26,7 @@ your task needs. Humans welcome too. - [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 — implemented - [004](blueprints/004-give-cites-teeth-and-fence-derived-zone.md) — give cites teeth and fence the derived zone — implemented -- [005](blueprints/005-propose-the-page-plan-from-a-repo-scan.md) — propose the page plan from a repo scan — locked +- [005](blueprints/005-propose-the-page-plan-from-a-repo-scan.md) — propose the page plan from a repo scan — implemented ## Ferries diff --git a/skills/loop/write-OKF/SKILL.md b/skills/loop/write-OKF/SKILL.md index 3e3ce8a..6a0b0c0 100644 --- a/skills/loop/write-OKF/SKILL.md +++ b/skills/loop/write-OKF/SKILL.md @@ -27,14 +27,19 @@ contract: [okf-layout.md](okf-layout.md). ## Scaffold mode 1. **Confirm the first write** — creating `OKF/` in a repo is a new convention; get a yes before writing anything. -2. Materialise the skeleton from [templates/](templates/) — headers, - `type` frontmatter, and `TODO(scribe)` markers only. **Never invent - facts**: an empty section with a TODO beats a fabricated architecture - claim. -3. Fill only what is *derivable from disk right now*: SUMMARY from an - existing README, ARCHITECTURE bones from the directory tree and - manifests, ROADMAP/CONTEXT stay TODO until - [architect](../architect/SKILL.md) / model-domain produce them. +2. **Propose the page plan, don't assume one** — run + `scripts/okf-scan `, show the candidate lines, and let the + user cut, rename, and add the spine pages no tree walk can see. What + survives becomes `index.md`, from [templates/](templates/). Contract: + [taxonomy-scan.md](taxonomy-scan.md). +3. **Materialise what the plan lists *and* a producer can fill.** A page + is listed when planned, written when its producer has something to + say: SUMMARY from an existing README, ARCHITECTURE bones from the + directory tree and manifests, while ROADMAP and CONTEXT stay + listed-not-written until [architect](../architect/SKILL.md) / + model-domain produce them. **Never invent facts** — an empty section + with a TODO beats a fabricated architecture claim, and an unwritten + page beats an empty one. 4. Wire `AGENTS.md`: insert the block from [agents-md-hook.md](agents-md-hook.md) (create the file if absent; append if it exists — never overwrite prose). diff --git a/skills/loop/write-OKF/okf-layout.md b/skills/loop/write-OKF/okf-layout.md index c2893e5..9ac6c7e 100644 --- a/skills/loop/write-OKF/okf-layout.md +++ b/skills/loop/write-OKF/okf-layout.md @@ -21,9 +21,17 @@ OKF/ ├── blueprints/ # NNN-.md only — flat, grep-able namespace ├── ferries/ # open: / — MAP.md + D--.md files │ # moored: .md, pinned with sealed: +├── modules/ # proposable, never mandatory: .md per code +├── analyses/ # directory / analysis directory a scan found └── LEARNINGS.md # debunked claims, gotchas — append-only, sourced ``` +The spine above is a diagram, not a required page set — `okf-check` +demands no particular page, only reachability, type, and warrant. +`modules/` and `analyses/` are *proposed* from a repo's shape by +[taxonomy-scan.md](taxonomy-scan.md); the rest have producers in the +loop, not on disk. + ## Conformance (OKF v0.1) - Every page except `index.md` opens with YAML frontmatter carrying a diff --git a/skills/loop/write-OKF/scripts/okf-scan b/skills/loop/write-OKF/scripts/okf-scan new file mode 100755 index 0000000..ae266cf --- /dev/null +++ b/skills/loop/write-OKF/scripts/okf-scan @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""Propose OKF page candidates from a repo's shape. Usage: okf-scan + +One candidate per line on stdout, index.md-ready: + + /.md — + +Every line names the disk evidence that warranted it; no evidence, no +line. The scan proposes only — it never writes a page, never edits +index.md, never culls or ranks. Contract: ../taxonomy-scan.md +""" +import sys +from pathlib import Path + +NOTEBOOKS = {".ipynb", ".Rmd", ".qmd"} +CODE = {".py", ".R", ".r", ".js", ".jsx", ".ts", ".tsx", ".go", ".rs", + ".java", ".rb", ".c", ".h", ".cc", ".cpp", ".hpp", ".sh", ".sql"} +SOURCE_ROOTS = ("src", "lib", "R") + + +def directories(root): + """Every directory under root, minus dot-directories and its own OKF/.""" + for path in sorted(root.rglob("*")): + parts = path.relative_to(root).parts + if not path.is_dir() or parts[0] == "OKF": + continue + if any(part.startswith(".") for part in parts): + continue + yield path + + +def analysis_evidence(directory): + """A directory holding a notebook, or one named analysis/analyses. + + The notebook wins as evidence when both hold — a file is the more + concrete warrant. + """ + for entry in sorted(directory.iterdir()): + if entry.is_file() and entry.suffix in NOTEBOOKS: + return entry + return directory if directory.name in ("analysis", "analyses") else None + + +def module_evidence(directory, root): + """A directory holding code, one level under the root or a source root.""" + if str(directory.relative_to(root).parent) not in (".", *SOURCE_ROOTS): + return None + for entry in sorted(directory.iterdir()): + if entry.is_file() and entry.suffix in CODE: + return entry + return None + + +def main(argv): + if len(argv) != 2: + print("usage: okf-scan ", file=sys.stderr) + return 2 + root = Path(argv[1]).resolve() + if not root.is_dir(): + print(f"not a directory: {root}", file=sys.stderr) + return 2 + + plan = {} + for directory in directories(root): + evidence, page = analysis_evidence(directory), "analyses" + if evidence is None: + evidence, page = module_evidence(directory, root), "modules" + if evidence is None: + continue + page = f"{page}/{directory.name}.md" + if page in plan: + continue + rel = evidence.relative_to(root) + plan[page] = f"{rel}/" if evidence.is_dir() else str(rel) + + for page in sorted(plan): + print(f"{page} — {plan[page]}") + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/skills/loop/write-OKF/taxonomy-scan.md b/skills/loop/write-OKF/taxonomy-scan.md new file mode 100644 index 0000000..506473a --- /dev/null +++ b/skills/loop/write-OKF/taxonomy-scan.md @@ -0,0 +1,64 @@ +# Taxonomy scan contract + +The page taxonomy is derived per repo, not fixed — a scan turns a repo's +shape into a page plan a user locks into `index.md`. Page set and +conformance: [okf-layout.md](okf-layout.md). Warrants: +[page-warrant.md](page-warrant.md). + +## The boundary + +**The scan proposes; it never writes and never culls.** +`scripts/okf-scan ` prints one candidate per line to stdout, +index.md-ready, and exits 0 whatever it finds (2 on usage): + +``` +/.md — +``` + +Every line names the disk evidence that warranted it. **No evidence, no +line.** The scan writes no page, edits no `index.md`, ranks nothing, and +removes nothing — culling is the user's, at lock time. It is not a +validator either; `okf-check` owns conformance. + +## The two signals + +Both directory-shaped, both language-blind. Dot-directories and the +repo's own `OKF/` are skipped. + +- **`analyses/.md`** — a directory holding a `.ipynb`, `.Rmd`, or + `.qmd`, or one named `analysis`/`analyses`. One page each, named for + the directory; the notebook is the evidence when both hold. +- **`modules/.md`** — a directory holding at least one code file, + one level under the repo root or under a single source root (`src/`, + `lib/`, `R/`), and not already an analyses candidate. + +A code file is one with a known source extension — that list is how you +spot code at all, not language awareness: no import graphs, no +per-language heuristics, no size thresholds, no ranking. **A threshold +is a decision to make**, and this scan makes none. + +## What a scan cannot see + +**A scan proposes only what a scan can see.** `modules/` and `analyses/` +are read off disk. The spine — `SUMMARY`, `ARCHITECTURE`, `CONTEXT`, +`ROADMAP`, `LEARNINGS`, `decisions/` — is written by loop skills out of +conversation, and no tree walk finds a glossary. That is the producer +seam [SKILL.md](SKILL.md) already draws at scaffold step 3; decision +[010](../../../OKF/decisions/010-two-zone-pages.md) draws it from the +other side, module and analysis pages being the only ones with a derived +zone at all. `context/.md` has no disk signal either — a +bounded context is model-domain's to name. + +## Proposal → locked plan + +1. Run the scan; show the user the candidate lines. +2. The user edits the list — cut, rename, add spine pages the scan + cannot see. What survives goes into `index.md`, one line + hook each. +3. Materialise only the pages a producer can fill *now*. + +**A page is listed when planned, written when its producer has something +to say.** `index.md` may name a page that does not exist yet; no TODO +shell is written for it. `okf-check` cuts both ways here — an absent +link target is skipped, so plan-without-page is legal, while a page +nobody lists errors `not reachable from index.md`. An unwritten page +cannot be an empty ceremonial one. diff --git a/skills/loop/write-OKF/templates/ARCHITECTURE.md.tpl b/skills/loop/write-OKF/templates/ARCHITECTURE.md.tpl index 25cd1d2..63a0bec 100644 --- a/skills/loop/write-OKF/templates/ARCHITECTURE.md.tpl +++ b/skills/loop/write-OKF/templates/ARCHITECTURE.md.tpl @@ -1,5 +1,9 @@ --- type: Architecture +purpose: Map the modules, their seams, and the flows that explain most behaviour. +answers: + - "What are this project's modules and seams, and how does behaviour flow through them?" +# cites: one path per claim, added as the TODOs below are filled. --- # — architecture diff --git a/skills/loop/write-OKF/templates/CONTEXT.md.tpl b/skills/loop/write-OKF/templates/CONTEXT.md.tpl new file mode 100644 index 0000000..53f4ed1 --- /dev/null +++ b/skills/loop/write-OKF/templates/CONTEXT.md.tpl @@ -0,0 +1,19 @@ +--- +type: Glossary +purpose: Hold the one canonical glossary for this bounded context. +answers: + - "What does each domain term in this project mean, canonically?" +# cites: one path per term whose meaning a file carries. +--- + +# — context + + + +## Terms + +TODO(model-domain) — one entry per canonical term: the name, what it +means here, and what it is *not* to be confused with. diff --git a/skills/loop/write-OKF/templates/LEARNINGS.md.tpl b/skills/loop/write-OKF/templates/LEARNINGS.md.tpl index d2f15a1..191a243 100644 --- a/skills/loop/write-OKF/templates/LEARNINGS.md.tpl +++ b/skills/loop/write-OKF/templates/LEARNINGS.md.tpl @@ -1,5 +1,9 @@ --- type: Learnings +purpose: Keep what was believed, what turned out true, and the source that settled it. +answers: + - "Which beliefs about this project were debunked, and what replaced them?" +# cites: one path per claim, added as the TODOs below are filled. --- # — learnings diff --git a/skills/loop/write-OKF/templates/ROADMAP.md.tpl b/skills/loop/write-OKF/templates/ROADMAP.md.tpl new file mode 100644 index 0000000..2a80b3f --- /dev/null +++ b/skills/loop/write-OKF/templates/ROADMAP.md.tpl @@ -0,0 +1,30 @@ +--- +type: Roadmap +purpose: Carry only what is still ahead — phases, their verify steps, and live risk. +answers: + - "What is this project building next, and how is each phase verified?" +# cites: decisions/index.md once the why-register has its first entry. +--- + +# — roadmap + + + +## Locked decisions + +TODO(architect) — the why-register: [decisions/index.md](decisions/index.md). + +## Phases + +TODO(architect) — numbered, append-only, each with a **Verify:** step +concrete enough to run. + +## Risks & gotchas + +TODO(architect) — what could still sink a phase, deleted once spent. + +## Out of scope + +TODO(architect) — what was considered and deliberately left out. diff --git a/skills/loop/write-OKF/templates/SUMMARY.md.tpl b/skills/loop/write-OKF/templates/SUMMARY.md.tpl index caa16fa..95d8701 100644 --- a/skills/loop/write-OKF/templates/SUMMARY.md.tpl +++ b/skills/loop/write-OKF/templates/SUMMARY.md.tpl @@ -1,5 +1,9 @@ --- type: Summary +purpose: Say what this project is and where to read next, for an agent landing cold. +answers: + - "What is this project, and where should an agent start reading?" +# cites: one path per claim, added as the TODOs below are filled. --- # — summary diff --git a/skills/loop/write-OKF/templates/index.md.tpl b/skills/loop/write-OKF/templates/index.md.tpl index 51cf20c..6d52d08 100644 --- a/skills/loop/write-OKF/templates/index.md.tpl +++ b/skills/loop/write-OKF/templates/index.md.tpl @@ -15,6 +15,14 @@ your task needs. Humans welcome too. - [ROADMAP.md](ROADMAP.md) — phased plan with verify steps. - [LEARNINGS.md](LEARNINGS.md) — gotchas and debunked claims. +A page is listed when planned, written when its producer has something to +say — CONTEXT and ROADMAP wait for model-domain and architect. + +## Modules & analyses + +- TODO(scribe): the locked page plan from the taxonomy scan, one line + each — `modules/.md`, `analyses/.md`. + ## Decisions - `decisions/index.md` — TODO(scribe): the why-register; link it here