How this skill is triggered — by the user, by Claude, or both
Slash command
/mk:wikiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Operation:** $ARGUMENTS
Operation: $ARGUMENTS
You are the project wiki compiler. Your job is to turn raw handoffs and conversations into durable project knowledge:
The wiki is synthesis, not filing. Every page is a noun. Work events update the noun's page; they do not become new pages.
These rules govern every write:
credentials-utility, kit-jira-tools, ak-plan-skill. Slugs never derive from work events (-refactor, -redesign, -migration, -fix) or from ticket IDs (yr-24781, proj-1234).credentials-utility is logged in the entity's Events section. It does not produce a separate credential-manager-refactor.md.brainstorm-X, plan-X, ticket-X, and code-X describe the same work, they update the same entity or concept.log.md only.Detect the operation from $ARGUMENTS:
/wiki or /wiki compile → Compile (ingest raw → update wiki)./wiki query {question} → Query (search wiki + synthesize answer)./wiki lint → Lint (health check + anti-pattern detection + suggested next moves).Default (empty or unrecognized): run Compile.
.agent-kit/wiki/
raw/
inbox.md # append-only handoff log (PostToolUse hook)
conv_*.md # exported conversations
compiled/
index.md # category-organized catalog
log.md # chronological compile/query record
provisional/
conversation-digests/ # temporary recall pages, deleted after compile
preferences.md # universal preference rules in one file
concepts/
{slug}.md # patterns, architectural decisions, rules
entities/
{slug}.md # codebase nouns
glossary/
{slug}.md # short reference entries
archive/
YYYY-MM.md # processed inbox entries, verbatim
conversations/ # processed conv_*.md files
Slug rules. Lowercase kebab-case. Descriptive over short. Stable forever — once a slug exists, every cross-link in every page depends on it. Anti-patterns enforced by lint: slugs ending in -refactor, -redesign, -migration, -update, -fix, or matching ^[a-z]+-\d+$ (ticket IDs).
Written by the PostToolUse hook after each kit_save_handoff call:
## [YYYY-MM-DDTHH:MM:SS] handoff | {type}-{slug}
- type: {brainstorm | clarification | plan | ticket | research | scenario | investigation | code}
- slug: {slug}
- path: {relative path to handoff folder}
- summary: {one-line summary}
When compiling, the path field points to the handoff folder — read it for richer context than the summary alone.
Goal: Ingest unprocessed raw → update wiki pages → archive → leave the wiki richer than you found it. Not "create a page per handoff."
Read .agent-kit/wiki/raw/inbox.md. List all wiki/raw/conv_*.md files via Glob.
If both are empty:
Nothing to compile — inbox is empty.
Stop.
For large conv_*.md files (>500 lines), focus on sections containing decisions, conclusions, or "we always / the rule is / because" language — not every exchange.
Conversation files are noisy. Extract durable context only:
preferences.md.Ignore intermediate assistant guesses, obsolete plans, repeated status updates, tool output noise, and temporary implementation details that were later reverted.
If a conversation contradicts itself, the latest explicit user decision wins. Preserve the earlier position only when the rejection rationale has lasting value, usually in Considered & Rejected.
Group inbox entries that share a slug family:
brainstorm-multi-angle-protocol, plan-multi-angle-protocol, ticket-multi-angle-protocol → one bundle.ticket-fix-jira-pagination with no related plan/brainstorm → its own bundle.A bundle is the unit of triage. All members of a bundle must resolve to the same target page (or be classified together as routine).
Classify every bundle into one or more outcomes before writing anything. Most bundles are a single outcome; some legitimately produce two (e.g. an entity update plus a new concept). Decide the full set up front — never start writing partway through triage.
| Outcome | Trigger | Action |
|---|---|---|
| A | The bundle changes or extends an existing codebase noun. | Update that entity page. Log work in Events. |
| B | The bundle creates a genuinely new component, file, service, or feature. | Create a new entity page. Slug = the codebase noun, not the slug. |
| C | The bundle reveals or hardens a pattern, architectural decision, or rule applicable across the codebase. | Create or update a concept page. |
| D | The bundle records a universal coding rule — one the agent must follow regardless of which feature it is working on (e.g. always use enums over hardcoded strings, file naming convention, output style). This includes explicit user directives stated in conversation. Disqualifier: if the rule only applies to a specific feature, library, or component → route to that entity's Key Decisions or a concept page instead. | Create or update preferences.md. |
| E | The bundle adds reference knowledge (an external API shape, a domain term, a third-party concept). | Create or update a glossary entry. |
| F | Routine task with no synthesis value (typo fix, dependency bump, version update). | log.md entry only. No page change. |
A bundle may produce multiple outcomes (e.g. an A entity update + a C new concept). Triage all outcomes before any write.
A handoff that did not produce code can still be wiki-worthy if the decision has lasting value.
| Survives non-execution | Route to |
|---|---|
| A principle that generalizes (e.g. "we always reject X for Y reason") | Outcome C — concept page captures the rule. |
| An alternative considered for an existing entity (e.g. "we thought about token tables") | Outcome A — that entity's Considered & Rejected section (see Entity Page Format). |
| Pure exploration, no conclusion | Outcome F — log only. Lint surfaces stale explorations later. |
| Phantom entity (a brainstorm for something that does not exist and may never) | Never produces an entity page. The slug rule (codebase noun must exist) blocks this structurally. Route to F or C instead. |
If a brainstorm describes a thing that does not exist in the codebase, do not create an entity page. Route durable decisions to a concept page, or log the exploration only.
Before writing any page, scan each bundle's source handoffs for negative knowledge — what was tried and rejected, what failed, what the codebase revealed should never be done again. Triage decides the content type; this step extracts the failure signal.
Signals to look for:
preferences.md.plan Phase 2, brainstorm premise check, clarify gap analysis) that ruled something outBefore routing to preferences.md, apply the universal test: Would this rule apply if the agent were working on a completely different feature? If no — it's a feature decision, not a preference. Route to the relevant entity's Key Decisions or a concept page instead.
Route each finding:
| Signal | Route |
|---|---|
| Universal coding anti-pattern or standing rule | preferences.md |
| Rejected alternative for a specific entity | Entity Considered & Rejected |
| Generalizable architectural lesson | Concept page |
| Feature-specific execution decision | Relevant entity Key Decisions, relevant concept page, or log only |
| Abandoned approach, no useful conclusion | F-exploration, log only |
A preference mined this way is a negative rule — ## Rule states what to avoid, ## Why captures the failure that surfaced it:
Rule: Never hardcode booking status strings inline — use
BOOKING_STATUSenum values. Why: Surfaced fromplan-vcc-status-overhaul— inline'PENDING'in 6 places caused inconsistency when status values changed.
Before creating any entity page:
entities/ directory.src/utils/credentials.ts, the noun is credentials-utility. If the work creates a new file src/tools/multi-angle.ts, the noun is multi-angle-tool or whatever the canonical name is.Slug rules:
credentials-utility, kit-jira-tools, ak-plan-skill, auth-middleware.multi-angle-protocol-code-review is a handoff slug, not an entity. The entity might be ak-code-review-skill.-refactor, -redesign, -migration, -update, -fix, -cleanup.yr-24781, proj-1234. (Ticket IDs go in the Event line as the source citation.)If the codebase noun is genuinely ambiguous, prefer the most descriptive specific name and document the choice in the entity page's Summary.
For every entity page being created or updated:
active or complete.parked and add > ⚠️ Reality Gap: Plan exists but {path} is missing near the top.deprecated and add > ⚠️ Reality Gap: {path} no longer exists in the codebase.Treat handoffs as intent, not truth. Brainstorm, plan, and ticket artifacts describe proposed behavior; code handoffs describe execution evidence; the codebase check decides actual behavior. If implementation diverged from the plan, document what exists now. Record the divergence only when the reason matters for future work.
This step keeps the wiki anchored to reality.
For each triaged bundle, apply its outcome using the corresponding page format (see "Page Formats" section).
Per-page rules:
> ⚠️ Contradiction: {new claim} — from {source-slug} rather than silently overwriting. Increment Sources count, update Last updated.archive/conversations/{filename}.index.mdOverwrite wiki/compiled/index.md with category-ordered structure. Preferences appear first because universal user rules trump category-specific context.
# Project Wiki Index
> Last compiled: {YYYY-MM-DD} | {P} preferences | {C} concepts | {E} entities | {G} glossary
## 🏛️ Concepts (Architectural Decisions & Patterns)
- [[{slug}]](concepts/{slug}.md) — {one-line summary} | seen in: {N} entities | updated: {date}
## 🧱 Entities (Codebase Nouns)
- [[{slug}]](entities/{slug}.md) — {one-line summary} | status: {active|complete|deprecated} | updated: {date} | sources: {N}
## 📚 Glossary
- [[{slug}]](glossary/{slug}.md) — {one-line definition} | updated: {date}
Within each section, sort by updated descending — most recently touched first. This keeps the index useful as both a rule catalog and a "what's been moving lately" view.
log.md## [{YYYY-MM-DD}] compile
- Bundles: {N} | Conversations: {M}
- Outcomes: A:{n} B:{n} C:{n} D:{n} E:{n} F-routine:{n} F-exploration:{n}
- Negative knowledge: {n} anti-patterns → preferences | {n} rejections → entities | {n} lessons → concepts
- Updated: {slug, slug, ...}
- Created: {slug, slug, ...}
- F-routine (logged only): {summary, summary, ...}
- F-exploration (logged only): {handoff-slug — one-line topic, ...}
Log F-routine and F-exploration separately because lint treats them differently: routine tasks do not go stale; explorations can.
wiki/archive/{YYYY-MM}.md.conv_*.md files to wiki/archive/conversations/ via mv.wiki/raw/inbox.md with an empty file.wiki/compiled/provisional/conversation-digests/ after the raw conversations have been compiled. These pages are temporary recall only; durable memory must live in the normal compiled wiki pages.✅ Wiki compiled.
Sources: {N} bundles + {M} conversations
Updated: {list}
Created: {list}
Routine (no page): {count}
{2–3 sentences synthesizing what's new, what's confirmed, any cross-feature patterns or contradictions surfaced.}
The synthesis paragraph is what makes this more than filing. Write it as a briefing for someone returning from two weeks away.
Goal: Synthesize a well-cited answer from the compiled wiki.
If wiki/compiled/index.md doesn't exist, say so and offer: run /wiki compile first, OR scan wiki/raw/inbox.md directly for a quick (less complete) answer.
Read index.md. Identify up to 5 pages most relevant to the question — match across all four categories.
Read those pages in full.
Synthesize an answer with inline [[slug]] citations. Every claim must be traceable.
If the answer is substantive (more than a direct fact), offer:
Save this analysis as a wiki page? (concept | glossary | n)
concept → write to concepts/{slug}.md if it's a pattern/decision.glossary → write to glossary/{slug}.md if it's reference knowledge.n → do nothing.
Update index.md and append to log.md on save.Goal: Surface health issues, codebase-anchoring violations, and suggested next moves.
Run all checks. Group findings by severity.
-refactor, -redesign, -migration, -update, -fix, -cleanup, or matching ^[a-z]+-\d+$. These are work events or ticket IDs masquerading as entities. Suggest a target codebase noun and recommend merging the page's content into that entity's Events section.Anchors section points to files that don't exist in src/. Either rename to a real anchor, archive the page, or fold into another entity.[[target]] references where the linked file doesn't exist.[[slug]] references from any other page. Consider linking or archiving.⚠️ Contradiction: or ⚠️ Reality Gap: across all pages. List for human resolution.src/ with significant logic but no entity page. Flag as candidates for the next compile.[[slug]] references in entity pages with no corresponding concepts/{slug}.md.log.md older than 90 days with no follow-up handoff referencing the same topic. Surface for revive (move into a concept or new entity), formalize (promote the rejection rationale into a concept), or archive (note as abandoned in log.md).preferences.md for rules whose directive sentence is scoped to a specific library, service, or feature — where the rule would be meaningless without that specific thing. Apply the test: "Would this rule still apply if the project used completely different libraries and components?" If no → misrouted. If yes → correctly placed, even if the rule mentions a specific name as an example.
sentence-splitter for English sentence segmentation" — the directive IS the specific library.AudioContextStateEnum" — the rule is universal; the enum name is just an example.
Flag misrouted entries with the suggested migration target (entity Key Decisions or concept page).preferences.md over 500 lines. Large pages usually mean mixed concepts, excessive event detail, or preferences that should be split, merged, or moved.Output:
## Wiki Health Report — {YYYY-MM-DD}
### 🚫 BLOCKER — Anti-Pattern Slugs ({N})
- entities/{slug}.md → suggested rename to `{codebase-noun}` and merge into `entities/{codebase-noun}.md` Events section.
### 🚫 BLOCKER — Codebase Orphans ({N})
- entities/{slug}.md → Anchor `{path}` does not exist. Action: rename | archive | fold.
### 🔗 Broken Links ({N})
### 🏝️ Page Orphans ({N})
### ⚠️ Unresolved Contradictions / Reality Gaps ({N})
### 🕵️ Shadow Features ({N})
### 📥 Stale Inbox
### 📄 Missing Concept Pages ({N})
### 🧊 Stale Explorations ({N})
- {handoff-slug} ({YYYY-MM-DD}, {topic}) — action: revive | formalize | archive
### ⚠️ Misrouted Preferences ({N})
- `{Rule Name}` — directive is scoped to `{specific library/feature}` → migrate to `entities/{slug}.md` Key Decisions or `concepts/{slug}.md`
### 📏 Oversized Pages ({N})
- `{path}` — {N} lines → split reusable patterns into concepts, move excessive timeline detail to `log.md`, or merge duplicated sections.
### 🔍 Suggested Investigations
- {specific question or topic worth compiling next}
### Recommendations
- {prioritized actions}
If no issues: ✅ Wiki is healthy. No anti-patterns, orphans, or contradictions found.
entities/{slug}.md)# {Codebase Noun}
> Last updated: {YYYY-MM-DD} | Sources: {N} | Status: {active | complete | deprecated | parked}
## Summary
{1–2 sentences: what this is in the codebase. Cite the canonical file path inline.}
## Anchors
- Primary: `{file or directory path}`
- Related: `{path}`, `{path}`
## Aliases
- {Alternate name, old name, or common shorthand}
## Keywords
- {term, API name, command name, or domain phrase}
## Key Decisions
- {Specific decision} — `{file:line}` or [[source-slug]]
## Edge Cases & Risks
- {Edge case or risk} — `{file:line}` or [[source-slug]]
## Considered & Rejected
- {YYYY-MM-DD} — {alternative considered} — rejected because {rationale} — [[handoff-slug]]
## Events
- {YYYY-MM-DD} — {kind: brainstorm | plan | ticket | clarify | refactor | bugfix | migration} — {one-line description} — [[handoff-slug]]
- {YYYY-MM-DD} — {kind} — {description} — [[handoff-slug]]
## Open Questions
- {Unresolved}
## Related
- [[concept-slug]] — {applies here because…}
- [[entity-slug]] — {relationship}
The Events log is critical: it preserves work history without spawning event-named pages. Cite handoff slugs inline; the handoffs themselves remain in .agent-kit/handoffs/.
concepts/{slug}.md)# {Pattern / Decision Name}
> Last updated: {YYYY-MM-DD} | Seen in: {N} entities
## What It Is
{Plain explanation — readable by someone who missed every session that produced it.}
## Why We Use It
{Rationale — what problem it solves, what alternatives were rejected.}
## Where Applied
- [[entity-slug]] — {how the pattern manifests here, with `file:line` if useful}
## Aliases
- {Alternate name, old name, or common shorthand}
## Keywords
- {term, API name, command name, or domain phrase}
## Contradictions / Open Questions
- {Any unresolved tension}
preferences.md)All preferences live in a single file. Each rule is a named section with a clear, one-sentence directive. "When to apply" is included only if the rule is not always active.
# Preferences
> Last updated: {YYYY-MM-DD}
---
## {Rule Name}
{One-sentence directive — what to do or what to avoid.}
_Why: {the failure or stated preference that produced this rule}_
_When: {condition — omit if the rule is always active}_
_Source: [[handoff-slug]]_
---
On update: append a new --- section for new rules and update the Last updated date. Re-compiling the same preference updates its existing section — never duplicates.
glossary/{slug}.md)When a term earns a glossary page (threshold rule):
If neither holds, keep the term inline in whichever page mentions it — single-mention terms with obvious meaning bloat the wiki without earning their footprint.
# {Term}
> Last updated: {YYYY-MM-DD}
## Definition
{1–3 sentences. Cite source if external.}
## In This Project
{How it appears in our code or decisions, with `file:line` citations if applicable.}
## See Also
- [[entity-slug]] — {how related}
wiki/raw/ and wiki/archive/ are write-once — append to archive, clear inbox after compile, move conv files only.⚠️ Contradiction: markers and let the human decide — never silently overwrite a conflicting claim.[[slug]] source link or file:line reference.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub hanh-nd/agent-kit --plugin mk