/wiki-sdd:wikifrom wiki-sdd
Bootstraps an existing project to use an Obsidian-based agent wiki, scaffolding vault structure and writing project instructions with wiki integration sections.
Ships in wiki-sdd. 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.
Read when SKILL.md points to them.
Wire the current project into the ~/llm-wiki agent wiki so wiki-aware skills can find context, scope, and the issue tracker convention. The wiki is the canonical surface for cross-session orientation; this skill is the on-ramp from a consumer project.
This is a prompt-driven bootstrap, not a deterministic script. Explore, present what you found, confirm with the user, then write.
In the consumer project:
AGENTS.md or the harness's equivalent — § Harness placement) populated from templates/project-agents.md.template with four sections: ## First read, ## Wiki integration (carrying WIKI_SCOPE, WIKI_ISSUE_TRACKER, WIKI_TRIAGE_LABELS), ## Sub-agent spawning, and ## Identifiers in replies (wiki identifiers are addresses: the reply says the thing in plain words first).wiki MCP server is not already available (plugin-bundled or user-registered). Shows the canonical npx @bartolli/kmd mcp --default-root <vault-path> JSON and lets the user place it.Both are idempotent — if a section/entry already exists, update in place rather than duplicate.
In the vault, only when no vault exists yet (new-vault bootstrap):
kmd init (starter vault.yaml with empty scopes, the 11 served templates, and the projects/, research/, notes/ domain dirs), the user's first scope then added to vault.yaml per references/vault-yaml.md § Minimal starter. Two forms: kmd init <vault-dir> [--set-default] for a global vault, kmd init --local for a vault the repo carries (§ Local vs global vault).projects/, research/, notes/) under ~/llm-wiki/vault/~/llm-wiki/vault/vault.yaml under scopes: — adding a new scope requires explicit user approval per the vault blueprintprime(scope, task?) for orientation, search(query, scope?, kind?, limit?) for retrieval — mirrored as kmd prime <scope> [--task <text>] and kmd search <query> for a harness without MCP tools, same server in-processwiki://template/{domain}/{kind}, or via kmd resource <uri> where the harness reads no resources (11 templates: project-{index, primer, spec, adr, plan, ops, story}, research-{index, article, src}, note) — served from templates/ at the vault root, re-read on every call; a missing file errors at resource-read timeA consumer project becomes wiki-aware by declaring WIKI_SCOPE: <scope> in its project instructions (AGENTS.md or the harness's equivalent). The agent reads this at session start and calls prime(scope) automatically — the wiki MCP tool, or kmd prime <scope> where the harness exposes no MCP tools.
Every kmd entry point (MCP server, hooks, bare CLI) resolves its vault through one chain: explicit argument > project tier > --default-root > $WIKI_VAULT > global default_vault (~/.kmd/config.yaml). Two setups fall out, and the bootstrap's first real decision is which one the project wants:
kmd init <vault-dir> --set-default scaffolds it and records it as the machine default; registrations point at it via --default-root.kmd init --local from inside the repo scaffolds <git-root>/vault/ plus a .kmd/ state home (index and hook state stay in the repo, gitignored). No registration change is needed — the project tier resolves ahead of the default for every command run inside the repo. A team variant commits .kmd/config.yaml with a repo-relative vault: path instead.How the MCP server learns which project it serves differs per harness — § Harness placement, row Project-vault signal, names each. Gate hooks are project-aware everywhere without any of this — they read the project from each event.
prime answers UNKNOWN_SCOPEThe error's valid scopes list names every scope of the vault that actually answered — read it first, it tells you which vault the server bound. Two distinct causes:
kmd config from the project root — it prints the vault the chain resolves and the rank that won; that is what the MCP server should be serving. Then fix the harness's project signal:
vault.yaml always takes explicit user approval.Hooks resolving correctly while prime serves the wrong vault is the signature of case 1 — hooks read the project from each event, the MCP server binds once at launch from its own signal.
/wiki is the on-ramp. The other wiki-aware skills form a workflow loop, each consuming what the previous produced:
| Skill | Reads | Writes |
|---|---|---|
/intent | wiki state via prime(scope) (MCP tool or kmd prime); codebase (brownfield) | index.md, primer.md, glossary.md, lazy adr-{topic}.md |
/to-stories | conversation; glossary.md; existing ADRs | thin plan-{name}.md + per-story plan/{name}/story-N-{slug}.md |
/triage | story files; a forwarded review | mutates triage_state / category in story frontmatter; adr-no-{slug}.md on wontfix; a position per review finding before any fix |
/to-issues | story files; codebase | refined ## Slices in story body; remote issues in GH/GitLab mode |
/tdd | story scenarios as test spec; referenced specs | code + tests; ticks the slice, archives the story at the last tick |
/retro | the session's own claims, gates, and drift from the slice in progress | findings closed in the session — fixes with the check that ran, story Decisions lines, steps prepared up to the operator's approval; an intent only for what is blocked, with the blocker named; sightings bumps; a dated note under the scope's notes/ — invocable any time, never a story, never the primer |
/handoff | fully-resolved stories; every plan's Story Index; the retro's residue | archive flips for the sweep's strays on approval, reconciled Story Index, the primer under budget in the canonical-dense register — gated on a retro note newer than the scope's last edit |
/to-triggers | a stated rule, or a protocol rule that just failed to fire | tested trigger entries under vault.yaml triggers_extra — on demand, outside the loop |
Typical session arc for new work: /intent → /to-stories → /triage → /to-issues → /tdd (per slice) → repeat triage when stories complete or intents reach two sightings → /retro whenever drift is suspected and always before the close → /handoff closes the session. /to-triggers joins whenever a rule proves it needs to become a gate.
When the agent edits files in the vault, four global skills cover Obsidian-flavored markdown and adjacent file types. They are NOT wiki-aware (no WIKI_SCOPE knowledge), but they handle the file format that the wiki uses:
| Skill | When to use |
|---|---|
obsidian-markdown | Authoring .md files in the vault — wikilinks, callouts, embeds, frontmatter, tags. Triggers on most edits inside ~/llm-wiki/vault/. |
obsidian-bases | Editing .base files in vault/views/. Bases are human-navigation surfaces (table/card views over the vault); agents rarely author them but should use this skill when asked. |
obsidian-cli | Only when a live Obsidian instance is genuinely needed — plugin/theme dev, screenshots, Dataview re-render. Not the canonical search/read surface — use the wiki MCP search tool and filesystem Read instead. |
json-canvas | Editing .canvas files (mind maps, flowcharts). Not in the standard wiki authoring loop. |
These compose with the wiki-aware skills: /to-stories writes story files (using wiki://template/project/story — MCP resource, or kmd resource <uri> — for structure and frontmatter), and obsidian-markdown handles the Obsidian-flavored body content (wikilinks, callouts) inside that file.
This skill runs anywhere SKILL.md skills are supported — same slash-invocation dialect — but where files land differs per harness:
| Claude Code | Codex | CoCo (Cortex Code) | Kiro (IDE and CLI) | |
|---|---|---|---|---|
| Skill files | wiki-sdd plugin, or ~/.claude/skills/wiki/ | wiki-sdd plugin via codex plugin add | wiki-sdd plugin, or ~/.snowflake/cortex/skills/wiki/ (.claude/skills/ is read too) | the wiki-sdd power, imported from the Package folder (Powers panel → Add Custom Power → Import power from a folder); the skills ride the power |
| MCP registration | .mcp.json at the project root, or user-level settings | plugin-bundled, or [mcp_servers.wiki] in ~/.codex/config.toml | plugin-bundled, or mcpServers in ~/.snowflake/cortex/mcp.json | power-bundled (mcp.json, activated on a keyword match) — it serves the machine default, so kmd config set default_vault <path> once per seat is the precondition; a project vault takes a workspace .kiro/settings/mcp.json from templates/mcp-entry-kiro.json.template — the operator's file; both merge, workspace wins |
| Project-vault signal | automatic (plugin maps the project dir) | export KMD_PROJECT_DIR="$PWD" in the launching shell | automatic when launched from the project root; export KMD_PROJECT_DIR="$PWD" when using -w | workspace-level .kiro/settings/mcp.json naming the project vault — the operator's file |
| Project instructions | CLAUDE.md or AGENTS.md (step 7) | AGENTS.md | AGENTS.md, CLAUDE.md, or CORTEX.md — all read | AGENTS.md, read automatically; .kiro/steering/*.md when inclusion modes are wanted |
Project-vault signal, in detail: the Claude Code plugin maps the project directory automatically; CoCo's plugin server inherits the directory the session was launched from, so a project vault resolves on its own (but -w/--workdir does not move it — export KMD_PROJECT_DIR="$PWD" covers that case); Codex needs export KMD_PROJECT_DIR="$PWD" in the shell that launches it (its adapter README documents this — Codex gives plugin MCP servers no workspace signal of its own); the Kiro power's bundled server has no project signal and serves the machine default, so a project vault takes a workspace-level .kiro/settings/mcp.json naming it — the operator's file.
Wrong vault bound (prime answered from the default instead of the project vault):
/reload-plugins) so the plugin re-registers with the project directory.export KMD_PROJECT_DIR="$PWD" before starting — plugin MCP servers get a scrubbed environment, and the bundled registration forwards WIKI_VAULT and KMD_PROJECT_DIR through it for exactly this.KMD_PROJECT_DIR in the launching shell, often masked by an ambient WIKI_VAULT export that pins the default. export KMD_PROJECT_DIR="$PWD", then restart the Codex session so the MCP server inherits it.kmd config set default_vault <path>) it dies at bind and the power lists no tools; a workspace .kiro/settings/mcp.json naming the project vault, placed by the operator, and a reconnect.Standalone registration placement:
.mcp.json, or user-level settings — let the user choose the scope.[mcp_servers.wiki] in ~/.codex/config.toml with the same command/args shape; env_vars = ["KMD_PROJECT_DIR"] lets a per-shell export reach the server for project vaults.mcpServers in ~/.snowflake/cortex/mcp.json, same shape. Prefer a globally installed kmd as the command over npx — CoCo gives plugin MCP servers only HOME, LOGNAME, PATH, SHELL, TERM, and USER, so anything the server needs from the environment must be declared in the entry's own env block (${VAR:-fallback} interpolates there)..kiro/settings/mcp.json (workspace) or ~/.kiro/settings/mcp.json (user), from templates/mcp-entry-kiro.json.template — Kiro wraps the same entry in mcpServers and adds disabled and autoApprove; pre-approving prime and search keeps orientation friction-free, and env values support ${VARIABLE} expansion. The Kiro CLI can register the same server via kiro-cli mcp add (defer to its --help for current flags rather than guessing them).Project instructions: Kiro picks up AGENTS.md automatically (always included, no inclusion modes); a .kiro/steering/ file is the native alternative when the user wants conditional inclusion — the same three sections apply.
Gate hooks on Kiro: the power carries no hook wiring — the standard has none, and Kiro loads none from a power — so this is the one harness where the bootstrap writes a file for the gates. Write ~/.kiro/hooks/wiki-sdd.json from the installed power's dev.kiro/hooks/wiki-sdd.json.template, replacing {{PACKAGE_ROOT}} with the installed power's absolute path — Kiro copies an imported folder into ~/.kiro/powers/installed/<name>/, so for this power it is ~/.kiro/powers/installed/wiki-sdd, and the template lives there too. Write nothing under .kiro/settings/ — a project vault's entry there is the operator's, and the seat's permissions deny the agent that path. The outcome, once the workspace is trusted and the session restarted: the gates live on the seat — prompt-time reminders, tool denies, validate + sync after vault writes, the handoff gate — through the engine on PATH at 0.17.4 or newer (npm i -g @bartolli/kmd).
The plugin registers kmd hook on the harness's events — this bootstrap adds no wiring step, except on a harness that loads no hooks from a plugin, where § Harness placement names the one file the step writes. Three behaviors ride along: prompt-time reminders, tool gates, and auto validate + sync after every vault write (the resync protocol runs as an event; validation findings return as hook feedback and hold the sync until fixed). The bootstrap's only responsibilities toward them: declare repo: on each scope in vault.yaml so the engine resolves the active scope from the session's working directory, and leave the trigger sections empty — vault-owned triggers grow from observed failures (references/vault-yaml.md § Harness gate triggers), never from upfront speculation. When that moment arrives — the user says "add a rule/hook/trigger for…", or a prose rule just failed to fire — route to /to-triggers: it interviews the intent, authors the matching mechanics, dry-runs fire and near-miss cases, and writes vault.yaml only on approval.
Read the current state. Don't assume.
git remote -v — does this repo have a remote? GitHub? GitLab? Or no remote?AGENTS.md or the harness's equivalent — § Harness placement). Is there already a ## Wiki block?wiki MCP server already registered for this project (§ Harness placement, row MCP registration)?vault.yaml in the vault root — the scopes: field is the authoritative scope vocabulary.prime and search tools from a wiki MCP server are already available in the session. Without them the same surface is the CLI: kmd prime, kmd search, kmd resource.If vault.yaml does not exist (new vault): this is vault bootstrap, not just project bootstrap. First settle the § Local vs global vault decision with the user — a vault the repo carries versus one personal wiki serving many projects — then run the matching init form:
kmd init <vault-dir> --set-default — scaffolds and records the machine default in one step (--set-default is the only non-interactive route to writing default_vault; an interactive TTY init offers it as a prompt).kmd init --local from inside the repo — scaffolds <git-root>/vault/ plus the .kmd/ state home with its .gitignore; every kmd command run inside the repo resolves this vault from then on, no registration or env changes.Either form scaffolds the starter vault.yaml (empty scopes), the 11 served templates, and the projects/, research/, notes/ domain dirs, refusing a non-empty target. Then add the user's first scope to the generated vault.yaml per references/vault-yaml.md § Minimal starter. The file is fail-loud — the MCP server and kmd tooling refuse to run on an invalid one — so validate (kmd validate) before continuing. Trigger sections start empty and stay empty at bootstrap; when the first rule earns a gate, /to-triggers authors it.
If the user declares a custom kind (an object-form kinds entry, now or later): offer to co-author its template at templates/{name}.md right away — protocol in references/vault-yaml.md § Custom kinds. A declared kind without its template draws a kmd validate warning until the file exists.
Ask the user which wiki scope this project belongs to. Show the scopes from vault.yaml as options.
If the user names a scope already in vault.yaml: proceed.
If the user names a scope NOT in vault.yaml: STOP. Per the vault blueprint, new scopes require explicit user approval. Surface this clearly — list the current scopes from vault.yaml and explain:
"
<requested-scope>is not in the wiki's scope vocabulary (currently:<comma-separated scopes from vault.yaml>). Adding a new scope requires updating~/llm-wiki/vault/vault.yamland is a deliberate vocabulary extension. Do you want to (a) approve adding<scope>to the vocabulary, (b) pick an existing scope, or (c) abort?"
If (a): add the new scope entry to vault.yaml's scopes: field (with status: active), AND offer to run /intent next to scaffold projects/{scope}/.
Detect:
git remote -v shows a github.com host → recommend WIKI_ISSUE_TRACKER: githubgit remote -v shows a gitlab.com (or self-hosted GitLab) host → recommend WIKI_ISSUE_TRACKER: gitlabWIKI_ISSUE_TRACKER: localState your recommendation with reasoning. Let the user override.
Behavior implications (mention briefly):
github / gitlab: /to-issues mirrors ready-for-agent slices to the remote tracker; story files in the wiki remain canonical.local: slices and triage state live entirely in story files under plan/{plan-name}/story-N-{slug}.md; no remote calls.Default to Matt Pocock's canonical roles:
needs-triage — story needs evaluationneeds-info — agent waits on user clarification (in a solo-operator context, this means the agent needs a decision from the user)ready-for-agent — fully specified, AFK-readyready-for-human — needs human implementation (judgment, external access, hardware)wontfix — will not be actionedIn a solo-operator context, needs-info semantically reads as "the agent is blocked on a user decision." This is the intended interpretation — flag it once during setup so the user understands the role mapping.
If the user wants to override any label string (because their issue tracker uses different conventions), capture the mapping in WIKI_TRIAGE_LABELS: as a JSON object.
Default: WIKI_TRIAGE_LABELS: {"needs-triage":"needs-triage","needs-info":"needs-info","ready-for-agent":"ready-for-agent","ready-for-human":"ready-for-human","wontfix":"wontfix","bug":"bug","enhancement":"enhancement"}
Check whether the wiki MCP server is already available to this session — look for it in the available tools list (a prime and search tool from a wiki-named server).
If a wiki-sdd plugin is installed: the plugin bundles the server registration; the vault resolves through the chain — the project tier first, then the plugin's configured default where the harness prompts for one, then $WIKI_VAULT, then the machine default. Nothing to register. One note before skipping to step 7: a project vault may additionally need the harness's project-vault signal (§ Harness placement) — without it, prime/search serve the default vault while the hooks correctly follow the project one.
If the skill is standalone (no plugin) and no wiki MCP server is available: the user needs to register it. Show the canonical registration JSON from templates/mcp-entry.json.template with the vault path filled in:
{
"mcpServers": {
"wiki": {
"command": "npx",
"args": ["-y", "@bartolli/kmd", "mcp", "--default-root", "/absolute/path/to/vault"]
}
}
}
--default-root vs a bare positional: --default-root keeps the resolution chain live — a project carrying its own vault wins over the registered default automatically. A bare positional ("mcp", "/path") pins that vault unconditionally and disables project awareness; offer it only when the user explicitly wants one registration locked to one vault.
Placement is harness-specific — § Harness placement, Standalone registration placement, names the file per harness. For any other harness, show the generic JSON and let the user place it per their harness's MCP docs; don't prescribe OS-specific paths.
Whenever a vault resolved in step 5 — global, project tier, or the one prime answered from — run the engine's report before writing project instructions:
kmd init --upgrade [<vault-root>]
Exit 0 means the vault is current with the engine's starter. Exit 1 means it is behind: the report names each missing kind, status, methodology, template file, or domain dir, and lists templates the vault holds in an edited form as differs (kept). Show the report verbatim. On the user's approval, apply it:
kmd init --upgrade [<vault-root>] --apply
The apply is additive and idempotent — it appends to vault.yaml in place, writes only missing template files, creates missing domain dirs, and never touches scopes, tags, triggers, or an edited template. Never narrate what the deltas will be; the report is the source of truth, and a vault scaffolded by this engine's kmd init is current by construction.
CLI route only — the two-tool MCP freeze leaves no resource for this. The session-start orientation also names a vault behind the starter, and a template file missing error from a served template names the same command.
Pick the file to edit: the project-instructions file the harness reads (§ Harness placement, row Project instructions). If one exists at the project root, edit it — the same template applies to every name. If none exists, ask which one to create — don't pick for the user.
Use the bundled template at templates/project-agents.md.template. Fill these placeholders:
| Placeholder | Source |
|---|---|
{{scope}} | The validated scope from step 2 |
{{issue_tracker}} | github / gitlab / local from step 3 |
{{triage_labels}} | The JSON map from step 4 |
If a ## First read, ## Wiki integration, ## Sub-agent spawning, or ## Identifiers in replies section already exists in the target file, update those sections in place rather than appending duplicates. Don't overwrite user edits to surrounding sections.
Per-scope adaptations to the template:
projects/{{scope}}/ops/ops-slicing-protocol. If that file doesn't exist in the vault, change "if it exists" to "if/when it exists" — keep the pointer so future readers know where to look.WIKI_ISSUE_TRACKER, WIKI_TRIAGE_LABELS) that aren't in the original minimal shape. They're inert if unused; /to-issues reads WIKI_ISSUE_TRACKER, /triage reads WIKI_TRIAGE_LABELS.Show the rendered template to the user before writing. Let them edit. Then write.
Tell the user setup is complete and which wiki-aware skills will now read from these files. Mention they can edit the file directly later if WIKI_SCOPE or WIKI_ISSUE_TRACKER changes.
Suggest the next step:
projects/<scope>/index.md already exists in the vault → "You're set up. Try /intent to refine intent or kick off a new workstream."<scope> yet. Run /intent to scaffold it."vault.yaml. Always confirm with the user.wiki-sdd plugin is installed, its bundled registration already covers it.npx @bartolli/kmd mcp --default-root <vault-path> for standalone registration — don't construct pnpm/tsx dev paths, and don't pin the bare positional unless the user asks for a locked registration. Let the user choose where to place the registration (§ Harness placement).## First read, ## Wiki integration, ## Sub-agent spawning, ## Identifiers in replies sections before writing — update in place if found.templates/project-agents.md.template rather than emitting the structure inline. Edits to the template propagate to all future bootstraps.kmd init (<vault-dir> [--set-default] global, --local project) — the engine embeds the template set; filenames are the server's URI→file contract and the content is served to future agents as-is; never author templates inline, rename files, or assemble the structure by hand./intent automatically — suggest it as the next step, but let the user invoke it.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub bartolli/kmd --plugin wiki-sdd10 skills in this plugin
/handoffThis skill should be used to close a session so the next one starts cold from corrected truth. Operator-invoked, gated on a retro note newer than the scope's last edit. Rewrites the primer within its budget first, then runs the status sweep (fully-resolved stories proposed for archiving, flipped only on approval) and reconciles every plan's Story Index — Focus, Next, Open, Read order, about 300 words, nothing another surface derives — confirms the index synced, and prints the one line the next session starts with. Use when the user says "/handoff", "hand off", "close the session", "wrap up the session", "prep the primer", "get the primer ready", "cold session prep", or "what does the next session start with"./intentInterview-style grilling that captures intent, sharpens vocabulary, and scaffolds wiki structure for a project scope. Use when the user wants to start a new workstream, refine an existing scope's intent, stress-test a plan against the project's domain language, or write a `glossary.md` (terms + relationships). Walks one question at a time, recommends an answer for each, and creates artifacts (`index.md`, `primer.md`, `glossary.md`, lazy ADRs) inline as decisions crystallize. Auto-detects greenfield (scope folder missing → scaffold) vs brownfield (scope exists → refine + cross-reference code). Triggers on phrases like "grill me", "grill the plan", "let's nail down what we're building", "set up a new scope", "refine the intent", "capture the intent", "write an intent", or `/intent`./retroThis skill should be used for a session retrospective at any point in a session — mid-session when drift is suspected, after a bug-hunting detour, after compaction, before a release cut, and always before /handoff. Asks three questions — 'What are you least confident about?', 'What's the biggest thing we're missing? What don't I realize?', and 'Where are we relative to the slice we started, and what were the detours?' — then works each finding while the context is hot — fixes it, prepares it up to the operator's approval, or asks — and files an intent only for what is blocked, with the blocker named — never a new story and never the primer. Use when the user says "/retro", "run the retro", "lightweight retro", "mid-session retro", "session retro", "retro protocol", "check for drift", "what are we least confident about", "what are we missing", or "what don't you realize"./signal-denseCanonical-vocabulary mode for agentic threads where assistant output re-enters context. Composable register predicates (technical, affect, safety, beginner) bind rule application; canonical handles, typed entities, and direct predicates extend an implicit KG across turns. Trigger on "signal-dense", "dense mode", "canonical mode", /dense, /signal-dense. Activate proactively in long technical threads, architecture reviews, ontology and KG work, and extended implementation sessions.
/tddImplement a single `ready-for-agent` slice from a wiki user story using disciplined red-green-refactor with vertical tracer bullets. Reads the slice description, the story's Gherkin scenarios (as the test specification), `glossary.md` (for vocabulary), and the referenced specs/ADRs. Refuses horizontal slicing (write-all-tests-then-all-impl). Ticks the slice checkbox when done. Use when the user says "let's TDD slice X", "implement slice 2 of story Y", "/tdd", "red-green-refactor this", or wants to start vertical-slice implementation on a wiki-tracked story./to-issuesBreak a wiki user story into vertical-slice tracer-bullet checkboxes (or refine existing slices), and in `github`/`gitlab` mode mirror `ready-for-agent` slices to the remote issue tracker with wikilinks back to the story file. Operates on `kind: story` files in the wiki. Quizzes the user on slice granularity, AFK vs HITL, and blocked-by dependencies. Use when the user says "break this story into slices", "refine the slicing", "/to-issues", "post these to GitHub", "publish issues from this story", or wants to validate vertical-slice rules on an existing story.