Lukasz Boryn 1b6a5c3ae8 feat(write-OKF): give cites teeth and fence the derived zone
Blueprint 004. A `cites:` entry now takes three shapes: `path`,
`path:line` (the number is a reading aid, never validated), and
`path:symbol`, which resolves only if the symbol is a literal substring
of the file — so a cite breaks when the thing it cites moves.

Cite drift belongs to okf-check, not refresh: a cite needs only the
working tree, so decision 017's visibility split leaves refresh's DRIFT
rule covering `sealed:` pins alone.

okf-check also validates derived-zone shape — at most one begin/end pair
per page, begin first — with each marker anchored to its whole line, so
a page that documents the markers is not fenced by mentioning them.

The warrant contract and the `sealed:` block move to page-warrant.md,
buying okf-layout.md the headroom for the two new contracts. ROADMAP
phase 6 records its split into 004 (cites + fences) and 005 (taxonomy
scan) and corrects the two Verify clauses this change made false.

Blueprint 004's Verify: PASS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 00:45:22 +02:00

4.5 KiB

name, description, disable-model-invocation
name description disable-model-invocation
write-OKF Scaffold or refresh a project's OKF (open-knowledge-format) wiki — the agent-first knowledge folder at ./OKF/ that AGENTS.md points every agent at before it touches code. true

write-OKF

The OKF is a Karpathy-LLM-wiki-style knowledge substrate: dense synthesis, not raw dumps; agents read it before code; every page inspectable, versioned, agent-maintained. Layout and Google-OKF-v0.1 conformance contract: okf-layout.md.

When to use

  • User says "scribe OKF", "/write-OKF", "set up the knowledge folder", "refresh the wiki".
  • Another loop skill (architect, weave) requires an OKF/ that is absent or stale.

Mode detection

State Mode
no ./OKF/ Scaffold
./OKF/ exists Refresh

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/ — 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 / model-domain produce them.
  4. Wire AGENTS.md: insert the block from agents-md-hook.md (create the file if absent; append if it exists — never overwrite prose).
  5. Migrate legacy artifacts with consent: root CONTEXT.md → OKF/CONTEXT.md, docs/Roadmap.md → OKF/ROADMAP.md, docs/adr/ → OKF/decisions/. Offer, show the move, wait for yes.

Refresh mode

  1. Diff wiki against reality: code and manifests on disk, jj log (or git log) since the last scribe commit, session learnings.
  2. Smallest edit per delta — never rewrite a page wholesale.
  3. Supersede, don't delete: outdated claims get struck with a pointer to the replacement, mirroring architect/revise.md discipline.
  4. Every ARCHITECTURE.md claim must be traceable to a file — cite path:symbol when a symbol carries the claim, path or path:line otherwise; grammar in okf-layout.md. 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, in the shape its state calls for per 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. DRIFT stops at pins — a cite needs no repo, so okf-check owns cite drift whole.
  7. Regenerate inside the fences only: a page's okf:derived region is rewritten wholesale, and every byte outside it is judgement zone — append or supersede, never scan-edit. An unfenced page is all judgement.

Output / done criteria

  • scripts/okf-check <okf-dir> run and its output pasted, exiting 0. Invoke it by this skill's own base directory — skills/loop/... resolves only inside octobot. A claim of conformance is not a gate.
  • OKF/ matches okf-layout.md including its conformance block; index.md links every page that exists.
  • AGENTS.md carries the hook block.
  • Scaffold: no fabricated content — unfillable sections carry TODO(scribe).
  • Refresh: every edit traces to a named delta (commit, file, or session fact); superseded claims remain visible.
  • Nothing committed — hand to commit-atomic-jj (docs(okf): ...).

Guardrails

  • Never fabricate architecture, dependencies, or domain terms.
  • Never duplicate content between pages — one fact, one home, cross-link the rest.
  • Never write raw logs, transcripts, or scratch into OKF — durable synthesis only.
  • Never exceed 110 lines per page — split and index instead.
  • Never move legacy files without explicit consent.

See also