Use this skill when the target OKF bundle is large enough that a single agent
context cannot hold the whole concept graph — the failure mode where concepts get
silently dropped. It orchestrates Codex subagents in parallel and uses the
deterministic okf tools as the coordination substrate.
Why single-pass authoring fails on large bundles
The ordinary authoring flow keeps the concept inventory, drafts, citations, and
validator output in one conversation. On a large bundle that overflows the
window and concepts are lost. The fix is not "try harder" — it is to move
coordination onto disk and fan out:
- A plan is the ledger. Every concept to author is one row in
.okf/plan.csv, with a shard column assigning disjoint file ownership.
- Workers fan out in parallel. Codex spawns one authoring subagent per row
(
spawn_agents_on_csv), each owning a single path, so writes never collide.
- Coverage is audited deterministically.
okf coverage diffs the plan
against files on disk. This — not any single agent's diligence — is what makes
the bundle provably exhaustive.
scouts (∥) → mapper → .okf/plan.csv ──spawn_agents_on_csv──▶ workers (∥, one per row)
│
reconcile (tools): okf coverage → okf index → okf lint --strict │
▼
review (∥): citation-auditor · graph-reviewer · skeptical-reviewer
└────────── repair loop until coverage is COMPLETE ──────────┘
One-time setup
Codex spawns only the subagents that exist in .codex/agents/. Install the
bundled role definitions once, and raise the parallelism ceiling.
- Install the subagents:
- MCP:
okf_install_agents, or
- CLI:
python tools/okf_tool.py install-agents
This copies okf-source-scout, okf-concept-mapper, okf-authoring-worker,
okf-citation-auditor, okf-graph-reviewer, and okf-skeptical-reviewer
into .codex/agents/.
- Raise concurrency in
~/.codex/config.toml (default max_threads is 6):[agents]
max_threads = 10
max_depth = 1
Orchestration workflow
Run this from the orchestrator (the main Codex thread). Keep the orchestrator
context thin: it holds the plan and coverage summaries, not concept bodies.
- Scope. Infer purpose, target consumer, freshness, and source boundaries.
Define a source policy before writing.
- Scout sources in parallel. Split the topic into subtopics and spawn one
okf-source-scout per subtopic, giving each a unique short id prefix
derived from its subtopic (e.g. auth, pay): "Spawn one source scout per
subtopic, wait for all, and merge their source tables." Deduplicate the
merged rows, then write the result to <bundle>/.okf/sources.csv with
columns source_id,title,url,publisher,date,source_type,reliability,used_for.
This file is the citation database every authoring worker resolves
source_ids against - a worker cannot cite what is not in it. (.okf/ is
skipped by scan_bundle, so it never becomes bundle content.)
- Map concepts. Hand the merged source table and goal to
okf-concept-mapper
and get back one exhaustive concept inventory (JSON array). Over-enumerate;
coverage will catch extras, but it cannot invent a concept nobody planned.
- Build the plan. Turn the inventory into a sharded ledger:
- MCP:
okf_plan_bundle with bundle_path, inventory, and
shards (match max_threads).
- CLI:
python tools/okf_tool.py plan <bundle> --inventory inventory.json --shards 10
This writes <bundle>/.okf/plan.csv and plan.md.
- Fan out authoring. Spawn authoring workers over the plan CSV:
spawn_agents_on_csv(
csv_path = "<bundle>/.okf/plan.csv",
agent = "okf-authoring-worker",
id_column = "path",
instruction = "Author the OKF concept at {path}. type={type}, title={title}. "
"description: {description}. Cite sources {source_ids}. "
"Write only {path}; then mark it done and report the result.",
max_concurrency = 10,
)
Each worker writes exactly one file and calls report_agent_job_result once.
For inventories larger than max_threads, spawn_agents_on_csv queues the
rows into waves automatically — you do not need to batch by hand.
- Reconcile deterministically (tools, not model context):
okf coverage <bundle> — the gate; exits non-zero until every planned
concept exists and is complete. For rows with source_ids, coverage also
checks that the authored file has a # Citations section.
okf index <bundle> — regenerate root and directory indexes centrally.
okf lint <bundle> --strict — conformance + quality.
- Repair loop. Run coverage with retry output, then re-spawn authoring
workers over
<bundle>/.okf/retry.csv:python tools/okf_tool.py coverage <bundle> --retry-csv
spawn_agents_on_csv(csv_path = "<bundle>/.okf/retry.csv", ...)
Re-run coverage and repeat until status is COMPLETE. When coverage is
complete, the retry CSV is removed.
- Review in parallel. Over disjoint directories, spawn
okf-citation-auditor,
okf-graph-reviewer, and okf-skeptical-reviewer. Feed their findings back
into a repair wave, then re-run coverage and lint --strict.
- Finalize. Add a
log.md entry, create/refresh bundle-local AGENTS.md
(okf_generate_chatgpt_usage), and package.
Coordination invariants
- Disjoint ownership. One concept path per plan row; a worker writes only its
path. Duplicate paths are rejected at plan time — that is the anti-collision
guarantee, so git worktrees are not required for authoring.
- Central indexes. Never let workers write
index.md; generate indexes once
at reconcile time so they stay coherent.
- Truth is on disk.
okf coverage derives completeness from files, not from
the status column. A worker that marks a row done without a complete file is
reported as a status mismatch.
- Sources are on disk.
.okf/sources.csv is the single citation database.
Workers resolve source_ids against it; never route source tables through
agent-to-agent messages.
- Thin orchestrator. Pass concept bodies through the filesystem and pass only
tables/summaries between agents. This is what keeps a large bundle inside
budget.
Completion criteria
Before the final response, report:
- bundle path and packaging format;
- planned vs. authored concept counts and the number of shards/workers used;
- final
okf coverage status (must be COMPLETE) and lint --strict result;
- review findings addressed and any accepted residual warnings;
- most important source/citation constraints and freshness assumptions.
1---2name: okf-parallel-build3description: Build a large, exhaustive OKF bundle by fanning out many Codex subagents in parallel over a durable concept ledger, then reconciling and auditing coverage deterministically so no concept is dropped.4---56Use this skill when the target OKF bundle is large enough that a single agent7context cannot hold the whole concept graph — the failure mode where concepts get8silently dropped. It orchestrates Codex subagents in parallel and uses the9deterministic `okf` tools as the coordination substrate.1011## Why single-pass authoring fails on large bundles1213The ordinary authoring flow keeps the concept inventory, drafts, citations, and14validator output in one conversation. On a large bundle that overflows the15window and concepts are lost. The fix is not "try harder" — it is to move16coordination **onto disk** and fan out:17181. **A plan is the ledger.** Every concept to author is one row in19 `.okf/plan.csv`, with a `shard` column assigning disjoint file ownership.202. **Workers fan out in parallel.** Codex spawns one authoring subagent per row21 (`spawn_agents_on_csv`), each owning a single path, so writes never collide.223. **Coverage is audited deterministically.** `okf coverage` diffs the plan23 against files on disk. This — not any single agent's diligence — is what makes24 the bundle provably exhaustive.2526```27scouts (∥) → mapper → .okf/plan.csv ──spawn_agents_on_csv──▶ workers (∥, one per row)28 │29 reconcile (tools): okf coverage → okf index → okf lint --strict │30 ▼31 review (∥): citation-auditor · graph-reviewer · skeptical-reviewer32 └────────── repair loop until coverage is COMPLETE ──────────┘33```3435## One-time setup3637Codex spawns only the subagents that exist in `.codex/agents/`. Install the38bundled role definitions once, and raise the parallelism ceiling.39401. Install the subagents:41 - MCP: `okf_install_agents`, or42 - CLI: `python tools/okf_tool.py install-agents`43 This copies `okf-source-scout`, `okf-concept-mapper`, `okf-authoring-worker`,44 `okf-citation-auditor`, `okf-graph-reviewer`, and `okf-skeptical-reviewer`45 into `.codex/agents/`.462. Raise concurrency in `~/.codex/config.toml` (default `max_threads` is 6):47 ```toml48 [agents]49 max_threads = 1050 max_depth = 151 ```5253## Orchestration workflow5455Run this from the orchestrator (the main Codex thread). Keep the orchestrator56context thin: it holds the plan and coverage summaries, not concept bodies.57581. **Scope.** Infer purpose, target consumer, freshness, and source boundaries.59 Define a source policy before writing.602. **Scout sources in parallel.** Split the topic into subtopics and spawn one61 `okf-source-scout` per subtopic, giving each a unique short id prefix62 derived from its subtopic (e.g. `auth`, `pay`): *"Spawn one source scout per63 subtopic, wait for all, and merge their source tables."* Deduplicate the64 merged rows, then write the result to `<bundle>/.okf/sources.csv` with65 columns `source_id,title,url,publisher,date,source_type,reliability,used_for`.66 This file is the citation database every authoring worker resolves67 `source_ids` against - a worker cannot cite what is not in it. (`.okf/` is68 skipped by `scan_bundle`, so it never becomes bundle content.)693. **Map concepts.** Hand the merged source table and goal to `okf-concept-mapper`70 and get back one exhaustive concept inventory (JSON array). Over-enumerate;71 coverage will catch extras, but it cannot invent a concept nobody planned.724. **Build the plan.** Turn the inventory into a sharded ledger:73 - MCP: `okf_plan_bundle` with `bundle_path`, `inventory`, and74 `shards` (match `max_threads`).75 - CLI: `python tools/okf_tool.py plan <bundle> --inventory inventory.json --shards 10`76 This writes `<bundle>/.okf/plan.csv` and `plan.md`.775. **Fan out authoring.** Spawn authoring workers over the plan CSV:78 ```79 spawn_agents_on_csv(80 csv_path = "<bundle>/.okf/plan.csv",81 agent = "okf-authoring-worker",82 id_column = "path",83 instruction = "Author the OKF concept at {path}. type={type}, title={title}. "84 "description: {description}. Cite sources {source_ids}. "85 "Write only {path}; then mark it done and report the result.",86 max_concurrency = 10,87 )88 ```89 Each worker writes exactly one file and calls `report_agent_job_result` once.90 For inventories larger than `max_threads`, `spawn_agents_on_csv` queues the91 rows into waves automatically — you do not need to batch by hand.926. **Reconcile deterministically** (tools, not model context):93 - `okf coverage <bundle>` — the gate; exits non-zero until every planned94 concept exists and is complete. For rows with `source_ids`, coverage also95 checks that the authored file has a `# Citations` section.96 - `okf index <bundle>` — regenerate root and directory indexes centrally.97 - `okf lint <bundle> --strict` — conformance + quality.987. **Repair loop.** Run coverage with retry output, then re-spawn authoring99 workers over `<bundle>/.okf/retry.csv`:100 ```101 python tools/okf_tool.py coverage <bundle> --retry-csv102 spawn_agents_on_csv(csv_path = "<bundle>/.okf/retry.csv", ...)103 ```104 Re-run coverage and repeat until status is COMPLETE. When coverage is105 complete, the retry CSV is removed.1068. **Review in parallel.** Over disjoint directories, spawn `okf-citation-auditor`,107 `okf-graph-reviewer`, and `okf-skeptical-reviewer`. Feed their findings back108 into a repair wave, then re-run coverage and `lint --strict`.1099. **Finalize.** Add a `log.md` entry, create/refresh bundle-local `AGENTS.md`110 (`okf_generate_chatgpt_usage`), and package.111112## Coordination invariants113114- **Disjoint ownership.** One concept path per plan row; a worker writes only its115 path. Duplicate paths are rejected at plan time — that is the anti-collision116 guarantee, so git worktrees are not required for authoring.117- **Central indexes.** Never let workers write `index.md`; generate indexes once118 at reconcile time so they stay coherent.119- **Truth is on disk.** `okf coverage` derives completeness from files, not from120 the `status` column. A worker that marks a row `done` without a complete file is121 reported as a status mismatch.122- **Sources are on disk.** `.okf/sources.csv` is the single citation database.123 Workers resolve `source_ids` against it; never route source tables through124 agent-to-agent messages.125- **Thin orchestrator.** Pass concept bodies through the filesystem and pass only126 tables/summaries between agents. This is what keeps a large bundle inside127 budget.128129## Completion criteria130131Before the final response, report:132133- bundle path and packaging format;134- planned vs. authored concept counts and the number of shards/workers used;135- final `okf coverage` status (must be COMPLETE) and `lint --strict` result;136- review findings addressed and any accepted residual warnings;137- most important source/citation constraints and freshness assumptions.