/coograph:coograph-docs-restructure Optional. An area name to migrate just that area of an already-approved restructure.from coograph
Restructures project instruction and map files back under tier budgets. Proposes an OpenSpec, then migrates one area per agent after approval, verifying every kept fact against the code. Use when layout.py --budget or a retro reports STRUCTURAL, or when maps have turned into changelogs.
Ships in coograph. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Restructure the project's instruction files into the three tiers in
.github/layout/README.md: always-loaded root files (9K combined), workspace
routers (about 2K each), and on-demand feature docs (8K each), plus GOTCHAS.md.
Two phases with a hard stop between them: Propose writes an OpenSpec and
stops; Apply runs only after the user approves it.
Read .github/layout/README.md once before starting. It defines the tiers, the
config, the feature-doc frontmatter and the gotcha format.
The rule that matters most: no current-state fact is lost, and no stale fact survives. Old map sections are often out of date. Every fact is checked against the code and gets one of three marks:
[x] file:line: the code confirms it. Keep it.[kept: not in code]: the code can neither confirm nor contradict it (a deploy
step, a console setting, a renewal date, team process). Keep it: in the area
doc, or in GOTCHAS.md when it is a trap. "Not provable from code" is never a
reason to drop.[dropped: <reason>]: only when the code contradicts it, it is history rather
than current state, or it duplicates another area.Look for a non-archived openspec/changes/*-docs-restructure/.
Approval is recorded on disk, not only in the conversation: the line
approved: <YYYY-MM-DD> in the change's .openspec.yaml (Phase 1 writes it
when the user approves, before the first Phase 2 edit).
proposal.md yet: an aborted Phase 1. Reuse that directory and its date, and continue at Step 2. Keep notes/layout-before.json when it parses as JSON with a tiers key; otherwise retake it (Step 1). Never create a second directory with a new date.proposal.md but no approved: line: show it and ask whether to continue with it or discard it. Never start a second one alongside it.tasks.md. Do not re-run Phase 1. Never regenerate notes/areas/*.md, notes/gotchas.md, notes/rules.md or notes/layout-before.json: they hold the only record of the original facts and the before numbers. Phase 2 only adds marks to them ([x], [kept: ...], [dropped: ...]) and writes notes/layout-after.json./coograph-docs-restructure auth): it applies only to an approved restructure. Run just that area's task. If no approved restructure exists, say so and stop.Create the change directory now, so the snapshot lives with the change and is archived with it (a later restructure then takes a fresh one):
python3 .github/layout/layout.py --budget
mkdir -p openspec/changes/<YYYY-MM-DD>-docs-restructure/notes
python3 .github/layout/layout.py --json > openspec/changes/<YYYY-MM-DD>-docs-restructure/notes/layout-before.tmp && mv openspec/changes/<YYYY-MM-DD>-docs-restructure/notes/layout-before.tmp openspec/changes/<YYYY-MM-DD>-docs-restructure/notes/layout-before.json
If .github/layout/layout.py is missing, the project predates the layout
checker: tell the user to sync coograph (git pull in the coograph checkout) or
re-run /coograph-init, and stop.
From the JSON, record per file: tier, tokens, over budget, dated headings, duplicate paragraphs, table padding. These are the "before" numbers for the proposal; copy them, do not recompute.
Then list every instruction-like file the config does not know about yet, so
nothing is missed: **/AGENTS.md, **/CLAUDE.md, **/*.instructions.md,
docs/**/*.md that describe behaviour, CONVENTIONS.md, .cursor/rules/*.
Use the code-graph first (get_minimal_context), then git ls-files patterns.
package.json workspaces, pnpm-workspace.yaml,
turbo.json, nx.json, go.work, the [workspace] table of Cargo.toml,
or top-level directories that hold their own manifest. None means a
single-package repo: no routers.CLAUDE.md, AGENTS.md,
.github/copilot-instructions.md, .cursor/, .windsurfrules,
CONVENTIONS.md, .clinerules exist. Every rule must stay reachable from
each tool's entry file.## Login (openspec 2026-09-01))
names an area and a change, so several dated headings collapse into one area.
Aim for 5 to 15 areas. An area whose current state will not fit in 8K is two
areas.duplicate_paragraphs lists the exact ones; also look for the same rule
reworded). Each gets one home: hard rules and workflow in AGENTS.md, code
conventions in .github/copilot-instructions.md, Claude-only extras in
CLAUDE.md, which imports the other two with @.GOTCHAS.md entry with paths: (and commands: where a
command triggers it).openspec/changes/<YYYY-MM-DD>-docs-restructure/ with the usual files:
proposal.md: Why (the before numbers and the structural reasons, copied
from Step 1), Goals (the after budgets), the area table, Decisions (where each
hard rule lives; which files become routers; what happens to each old map),
Risks.layout.json proposal in the Decisions section: always_loaded, routers
(one glob per workspace), docs, gotchas, budgets. Keep the seed budgets
unless the user asks otherwise.notes/areas/<area>.md, one per area: every fact the old files state about
it, one line each, with its source (apps/web/AGENTS.md § Login). This is
the fact list Apply ticks off.notes/gotchas.md: every gotcha candidate with its source.notes/rules.md: every rule in the root files, its current homes, and its
one new home.tasks.md, in this order:
docs/features/<area>.md, every fact in
notes/areas/<area>.md marked [x], [kept: ...] or [dropped: <reason>]);GOTCHAS.md (every candidate placed or dropped with a reason);AGENTS.md cut to commands, gotcha pointers and
an area index, plus a one-line <workspace>/CLAUDE.md holding
@AGENTS.md when Claude Code is in use);notes/rules.md, routing table
filled);.github/layout/layout.json;layout.py --budget exits 0, every notes/areas/*.md line
is marked, /coograph-review run.Stop. Tell the user what the restructure will do in five lines (areas,
files removed, files created, before and after budgets) and wait for approval.
Do not edit any instruction file before approval. On approval, add
approved: <YYYY-MM-DD> to the change's .openspec.yaml first; Step 0 reads it
to tell a resume from a fresh start.
Work through tasks.md in order.
For each area task, delegate to one subagent (the @Explore agent for reading,
then write the doc yourself, or one general agent per area where the tool
supports it). Give it:
notes/areas/<area>.md fact list;get_minimal_context, query_graph), then by reading the files.
Mark it [x] with the confirming file:line; [kept: not in code] when the
code can neither confirm nor contradict it (keep it in the doc); or
[dropped: <reason>] only when the code contradicts it, it is history, or it
duplicates another area.Feature doc template:
---
paths:
- <glob for every directory this area's code lives in, across workspaces>
---
# <Area>
<one paragraph: what this area does for the user>
## Core
- <current-state facts, bullets, no dates>
## Web
- ...
## Mobile
- ...
## Functions / backend
- ...
## Rules
- <constraints specific to this area>
Bullets, not wide tables (a table padded by a formatter costs more than its
text). No dated headings, no "added in", no "(openspec ...)": history lives in
openspec/changes/archive/ and git. Keep each doc under 8K tokens
(layout.py --budget checks it).
GOTCHAS.md: entries in the format of .github/layout/README.md, each under
800 bytes. A gotcha the code contradicts (the trap was
fixed) is dropped in notes/gotchas.md with the reason; one the code cannot
confirm either way is kept.auth → docs/features/auth.md). Nothing else. About 2K tokens.notes/rules.md. Fill the routing table in AGENTS.md
(Touching <glob> → read docs/features/<area>.md).python3 .github/layout/layout.py --budget
python3 .github/layout/layout.py --json > openspec/changes/<YYYY-MM-DD>-docs-restructure/notes/layout-after.json
--budget must exit 0. Report before and after per tier from the two JSON
files. Every line in every notes/areas/*.md and notes/gotchas.md carries a
mark ([x], [kept: ...] or [dropped: <reason>]); count each mark and report
the counts. Then run
/coograph-review on the change.
If --budget still fails, the area split is wrong: split the over-budget doc,
update the OpenSpec, and say so. Do not trim facts to fit.
GOTCHAS.md is never always-loaded: never @-import it.layout.json is the user's: propose its contents in the
OpenSpec, write it only in Apply.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub paullukic/coograph --plugin coograph18 skills in this plugin
/coograph-applyImplement tasks from an OpenSpec change. Use when the user wants to start or continue implementing a proposed change./coograph-archiveArchive a completed change. Use when implementation is done and the change is ready to be moved to the archive./coograph-debugRoot-cause a bug or build error with minimal investigation, then apply the smallest fix. Reproduce, gather evidence, fix, verify, with a 3-attempt circuit breaker. Use for failing builds, tests, or runtime errors./coograph-disable-multi-modelsTurn off per-task model selection for this project. Every agent inherits the session model and Coograph stops suggesting mappings. Use when the user says they do not want multiple models, wants one model for everything, or wants the suggestions to stop./coograph-doctorHealth check of a Coograph install. Runs a read-only script that checks the code graph, its server and MCP configs, unfilled placeholders, per-tool files, git and Claude Code hooks, openspec/config.yaml and pending sync copies, then offers the fix for each problem. Trigger when the user types `/coograph-doctor` or `$coograph-doctor`, or asks to "check the install", "run the doctor", or why coograph seems broken./coograph-exploreEnter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.Other plugins' skills for the same job