feat(loop): add scribe-OKF skill — open-knowledge-format scaffold and refresh

- feat(scribe-OKF): mode-routed SKILL.md (scaffold vs refresh) with okf-layout contract
- feat(scribe-OKF): AGENTS.md hook block with Karpathy behavioral guardrails
- feat(scribe-OKF): TODO-marker templates for INDEX, SUMMARY, ARCHITECTURE, LEARNINGS
This commit is contained in:
Łukasz Boryń 2026-07-19 23:16:05 +02:00
parent 878a5e063d
commit 03ddb4ed01
7 changed files with 231 additions and 0 deletions

View File

@ -0,0 +1,80 @@
---
name: scribe-OKF
description: 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.
disable-model-invocation: true
---
# scribe-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 contract: [okf-layout.md](okf-layout.md).
## When to use
- User says "scribe OKF", "/scribe-OKF", "set up the knowledge folder",
"refresh the wiki".
- Another loop skill ([architect](../architect/SKILL.md),
[implement](../implement/SKILL.md)) 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/](templates/) — headers 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) / domain-modeling produce them.
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).
5. Migrate legacy artifacts *with consent*: root `CONTEXT.md` →
`OKF/CONTEXT.md`, `docs/Roadmap.md` → `OKF/ROADMAP.md`,
`docs/adr/` → `OKF/adr/`. 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](../architect/revise.md) discipline.
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 `specs/` entry listed,
one line each.
## Output / done criteria
- `OKF/` matches [okf-layout.md](okf-layout.md); `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
[jj-atomic](../../productivity/jj-atomic/SKILL.md)
(`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
- [../architect/SKILL.md](../architect/SKILL.md) — writes ROADMAP.md.
- [../blueprint/SKILL.md](../blueprint/SKILL.md) — writes specs/.
- [../../engineering/domain-modeling/SKILL.md](../../engineering/domain-modeling/SKILL.md)
— owns CONTEXT.md content; scribe only places it.

View File

@ -0,0 +1,41 @@
# AGENTS.md hook block
Insert verbatim (create `AGENTS.md` if absent; append if it exists —
never overwrite existing prose). `<project>` substituted from SUMMARY.md.
```markdown
## Knowledge — read before you code
This project keeps an agent-first wiki at [`OKF/`](OKF/INDEX.md)
(open-knowledge-format). Before extending or modifying <project>:
1. Read [`OKF/INDEX.md`](OKF/INDEX.md), then the pages it flags for your
task — at minimum `SUMMARY.md`; `ARCHITECTURE.md` before structural
work.
2. Use the canonical vocabulary from [`OKF/CONTEXT.md`](OKF/CONTEXT.md)
in code, tests, and commit messages. Don't coin synonyms.
3. Non-trivial changes start from a spec in `OKF/specs/` — write one
(blueprint skill) before implementing; cite its number in the commit.
4. Learned something that contradicts the wiki? Update the wiki in the
same change (supersede, don't delete) or append to
`OKF/LEARNINGS.md`.
## Behavioral guardrails
- State assumptions explicitly; name the simpler approach you are
rejecting; surface tradeoffs. Push back when warranted — if something
is unclear, stop and ask rather than guess.
- Do exactly what the task requires, nothing more. No speculative
abstractions, no drive-by refactors.
- A green test suite is a claim, not a proof — verify against the
spec's stated check before calling work done.
```
## Rules
- The guardrails section is the octobot-house Karpathy distillation —
keep it verbatim so every scaffolded project carries the same contract.
- If the target repo already has an AGENTS.md knowledge section, merge
by hand and show the diff; never duplicate the block.
- `CLAUDE.md`-only repos: offer a one-line `CLAUDE.md` pointer to
AGENTS.md instead of duplicating the block there.

View File

@ -0,0 +1,47 @@
# OKF layout contract
OKF = **open-knowledge-format**: a file-based, agent-first project wiki at
the repo root. Inspired by Karpathy's LLM-wiki pattern (precomputed
synthesis agents read before code) as implemented by LangChain's OpenWiki —
format-compatible in spirit, dependency-free in practice.
```
OKF/
├── INDEX.md # map of the wiki — the ONE file AGENTS.md points at
├── SUMMARY.md # what the project is, for an agent landing cold
├── ARCHITECTURE.md # modules, seams, main flows — codebase-design vocab
├── CONTEXT.md # canonical domain glossary (domain-modeling owns content)
├── context/ # only in multi-context repos: <subroot>.md per
│ # bounded context, indexed from INDEX.md
├── ROADMAP.md # phased plan — architect owns content
├── adr/ # 0001-<slug>.md — three-of-three rule (domain-modeling)
├── specs/ # NNN-<slug>.md blueprints; ferry-<topic>/ decision maps
└── LEARNINGS.md # debunked claims, gotchas — append-only, sourced
```
## Page contracts (one line each in INDEX.md)
- **INDEX.md** — every existing page + spec, one line + hook each. No
content of its own beyond the map.
- **SUMMARY.md** — ≤1 screen: what it is, who for, how run, where to start
reading. The cold-start page.
- **ARCHITECTURE.md** — module map with seams; every claim cites a file
path. Uses codebase-design vocabulary (module, interface, seam, adapter).
- **CONTEXT.md** — glossary per domain-modeling's CONTEXT-FORMAT.md.
**One canonical glossary per bounded context — never per issue.**
Issue-local terms live in their spec until they recur.
- **ROADMAP.md** — architect's skeleton (locked decisions, phases with
verify steps, risks, out-of-scope).
- **specs/** — blueprint output; status lives in frontmatter, so the
"tracker" is `grep -r "^status:" OKF/specs/`.
- **LEARNINGS.md** — what was believed / what is true / source. Never
edited retroactively, only appended or superseded.
## Rules
- Durable knowledge only — no session state, no high-frequency logs
(that's [handoff](../../productivity/handoff/SKILL.md) territory).
- One fact, one home; cross-link with relative paths.
- Every page ≤110 lines; grow by splitting + indexing, not by scrolling.
- Specs may grow from `NNN-<slug>.md` into `NNN-<slug>/` directories
(spec.md + notes) — the glossary never moves in there.

View File

@ -0,0 +1,22 @@
# <project> — architecture
<!-- Every claim cites a file path. Vocabulary: module / interface / seam /
adapter (see octobot codebase-design). A claim you can't cite to a
file doesn't belong here. -->
## Module map
TODO(scribe) — one entry per top-level module:
- **<module>** (`path/`) — what it hides behind which interface; who
calls it.
## Main flows
TODO(scribe) — the 1–3 flows that explain most behaviour, each as a short
ordered list of `module → module` hops with file citations.
## Seams
TODO(scribe) — where behaviour can be altered without editing in place:
DI points, adapters, config boundaries. Cite each.

View File

@ -0,0 +1,21 @@
# <project> — OKF index
Open-knowledge-format wiki. Agents: read this page first, then the pages
your task needs. Humans welcome too.
## Pages
- [SUMMARY.md](SUMMARY.md) — what this project is; start here cold.
- [ARCHITECTURE.md](ARCHITECTURE.md) — modules, seams, main flows.
- [CONTEXT.md](CONTEXT.md) — canonical domain glossary.
- [ROADMAP.md](ROADMAP.md) — phased plan with verify steps.
- [LEARNINGS.md](LEARNINGS.md) — gotchas and debunked claims.
## Decisions
- `adr/` — TODO(scribe): list ADRs here as they land.
## Specs
- `specs/` — TODO(scribe): list specs here as blueprint writes them
(`NNN — title — status`).

View File

@ -0,0 +1,6 @@
# <project> — learnings
<!-- Append-only. Format per entry: what was believed / what is true /
source (commit, issue, run output). Supersede, never rewrite. -->
- TODO(scribe): first learning lands here.

View File

@ -0,0 +1,14 @@
# <project> — summary
<!-- ≤1 screen. The cold-start page: an agent that reads only this should
know what the project is and where to go next. -->
**What**: TODO(scribe) — one paragraph: what this project does and for whom.
**Stack**: TODO(scribe) — languages, key frameworks, task runner.
**Run it**: TODO(scribe) — the 1–3 commands that build / test / run.
**Read next**: [ARCHITECTURE.md](ARCHITECTURE.md) for structure,
[CONTEXT.md](CONTEXT.md) for vocabulary, [ROADMAP.md](ROADMAP.md) for
where this is heading.