From grimoire
Use this skill when the user wants to build cross-references, backlinks, update the overview, run gap analysis, or says "grimoire compile", "build links", "update overview", or "/grimoire:compile". Uses Papyr Core for graph analysis and cross-reference auditing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/grimoire:compileThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Audit the wiki graph, repair deterministic issues, surface gaps, and build
Audit the wiki graph, repair deterministic issues, surface gaps, and build serialized indexes for downstream skills (present, serve).
SCHEMA.md in the workspace root.
If missing, tell the user to run /grimoire:init first.wiki/ directory must contain at least one article (not counting index.md,
overview.md, or log.md). If empty, tell the user to run /grimoire:ingest first.Find the grimoire workspace:
SCHEMA.md in the current directory firstwiki/ directory exists and contains markdown filesSCHEMA.md to understand the topic, scope, and taxonomyExecute the Papyr Core analysis script against the workspace root:
node ${CLAUDE_PLUGIN_ROOT}/dist/compile.js {workspace}
The script auto-detects the nested wiki/ directory. Passing
{workspace}/wiki directly also works and is treated identically.
This produces JSON artifacts in {workspace}/wiki/.compile/:
| File | Contents |
|---|---|
audit.json | Link validation, orphan analysis, centrality, components, hubs, authorities |
graph.json | Full graph structure (nodes, edges, backlinks, orphans, statistics) |
search-index.json | Serialized FlexSearch index (used by serve and present) |
analytics.json | Content analytics (word distribution, reading time, tag analysis, graph metrics) |
notes.json | Lightweight manifest (slug, title, tags, word count, headings, links) |
overview-metadata.json | Enforcement evidence for Step 5. Top-5 centrality articles, the required-citation slug list, coverage stats, and topic clusters (support pages filtered). Step 9 audits wiki/overview.md against this file |
taxonomy-proposal.json | Enforcement trigger for Step 5.5. Conditional — present ONLY when all three Step 5.5 conditions are met (5+ content articles, 5+ unique tags, SCHEMA taxonomy not "defined"). Contains deterministic tag cooccurrence groupings. Absence = Step 5.5 can be skipped |
If the script fails, show the error to the user and stop. Do not proceed with partial data.
Read {workspace}/wiki/.compile/audit.json and {workspace}/wiki/.compile/analytics.json.
Classify every finding into one of two categories:
These have one correct resolution. Fix them without asking:
Broken internal links — orphanedLinks in audit.json maps source → broken targets.
For each broken link:
notes.json to get the list of valid slugs.One-directional backlinks — Read graph.json backlinks. For each edge A→B,
check if B→A also exists. If not, add [[A-slug]] to B's See Also section with
a brief relationship note.
Stale index entries — Compare notes.json slugs against wiki/index.md:
Orphan content articles — Check orphanedNotes in audit.json. Ignore support
pages (index, overview, log). For actual content articles with zero incoming links:
centrality scores and shared tagsThese require domain knowledge. Report them but do not auto-fix:
Potential duplicate concepts — articles with overlapping tags AND overlapping
headings (compare notes.json headings and tags across articles)
Taxonomy gaps — from analytics.json tag analysis:
components that could be split into taxonomy categoriesMissing cross-references — articles in the same connected component that share tags but have no direct link between them
Coverage distribution — from analytics.json content stats:
For each fix identified in Step 3, apply it to the wiki files:
wiki/index.md to add missing entries or remove stale onesDo not modify raw files. Raw sources are immutable. Do not modify frontmatter unless a field is clearly wrong (e.g., broken slug in sources).
Read {workspace}/wiki/.compile/overview-metadata.json FIRST. It
gives you the deterministic inputs for the overview:
topCentralityArticles — the 5 articles you must read in full before
writing (their prose grounds the narrative; the statistics alone
aren't enough)requiredCitations — the slugs that must appear as [[slug]]
wikilinks in the overview. Step 9 audits this. If you skip any, the
compile will loop back here until it's fixedcoverageStats — article count, source count, cross-refs, total
words; use these verbatim in the ## Coverage sectiontopicClusters — connected-component groupings for ## Topic ClustersNow read the full content of each topCentralityArticles entry and
rewrite wiki/overview.md using the compile analysis. Structure:
# {Topic} — Overview
{2-3 paragraph synthesis of what the wiki covers, informed by the articles and their
connections. Not a list of articles — a narrative about the state of knowledge.}
## Coverage
{Summary statistics: N articles, N sources, N cross-references, N words total.
Note the strongest clusters and most-connected articles.}
## Topic Clusters
{List the connected components or tag-based clusters. For each, name the key
articles and their relationships.}
## Open Questions
{Questions that the current articles raise but don't answer. Derived from:
- Gap analysis (thin areas, missing cross-references)
- Contradictions between articles
- Topics referenced but not covered}
## Coverage Gaps
{Taxonomy areas with few or no articles. Areas mentioned in articles but not
covered by their own article.}
Read the existing overview.md first. Preserve any human-written open questions that are still relevant. Add new ones from the analysis.
This step is conditional and inserted between Step 5 and Step 6. It does not renumber subsequent steps to avoid disrupting existing references.
Check for {workspace}/wiki/.compile/taxonomy-proposal.json.
Conditions (computed deterministically by lib/compile.ts — you don't need
to re-check them):
SCHEMA.md taxonomy is not explicitly "defined" (emergent or unspecified
both qualify)Read {workspace}/wiki/.compile/taxonomy-proposal.json. It gives you:
conditions — the three metrics as computed at compile timecandidateGroups — tag clusters already grouped by cooccurrence (≥2
shared articles), each with an articles list and a cooccurrence scoreuncategorizedArticles — content slugs that fit no proposed groupFor each candidateGroup: propose a human-readable category name based
on the tag cluster. The grouping is already done; your job is to name
what the machine surfaced.
Present the proposal to the user. Format:
Taxonomy Proposal:
Category: {name}
Tags: {tag1, tag2, tag3}
Articles: [[slug1]], [[slug2]]
Category: {name}
Tags: {tag1, tag2}
Articles: [[slug3]]
Uncategorized:
Articles: [[slug4]] (doesn't fit any cluster)
Ask: "Approve this taxonomy? (approve / edit / reject)"
If approved:
SCHEMA.md: change taxonomy: "emergent" to taxonomy: "defined"
and add the categories list with their constituent tags.wiki/{category}/{slug}.md)? Important: make sure your workspace is
committed to git first — this restructures files and rewrites links."[[category/slug]] paths.wiki/index.md to reflect the new structure.If rejected, skip and continue to Step 6.
If edited, apply the user's changes to the proposal, re-present, and ask again (approve / edit / reject) until the user approves or rejects.
Before printing the final summary (Step 8), run these machine-checkable audits. If any fail, loop back to the indicated step with a direct instruction to correct the problem. Do not mark compile complete with any failure unresolved.
{workspace}/wiki/.compile/overview-metadata.json and
{workspace}/wiki/overview.md.requiredCitations, verify that [[{slug}]] appears
literally in the overview markdown.{workspace}/wiki/.compile/taxonomy-proposal.json exists, verify
that a taxonomy proposal was presented to the user in this session
(the user either approved, edited, or rejected it).Confirm that wiki/overview.md was modified in this run (mtime newer
than the start of the compile invocation). If not, overview was not
updated — loop back to Step 5.
Save the report to {workspace}/wiki/.compile/compile-report.md:
# Compile Report — {date}
## Fixes Applied
{For each fix: what was wrong, what was changed, which file was edited}
## Heuristic Issues
{For each issue: description, affected articles, suggested action}
## Graph Summary
- Notes: {N}
- Cross-references: {N} total, {N} valid, {N} orphaned
- Orphan notes: {list or "none"}
- Connected components: {N}
- Most connected: {top 3 by centrality}
- Graph density: {N}
## Coverage Analysis
- Total words: {N}
- Average words per article: {N}
- Thinnest articles: {list with word counts}
- Tag distribution: {top tags with counts}
## Recommendations
{2-3 actionable next steps based on the analysis. Examples:
- "Consider writing an article on X — it's referenced by 3 articles but doesn't exist"
- "Articles A and B overlap significantly — consider merging"
- "The Y cluster has only 1 article — scout for more sources on this topic"}
Append a compile entry:
## {YYYY-MM-DD} — Compiled
- Fixes applied: {N} (backlinks: {N}, broken links: {N}, index entries: {N})
- Heuristic issues: {N} surfaced
- Graph: {N} notes, {N} links, {N} components
- Coverage gaps: {N} identified
Print a summary:
Compile complete.
Fixes applied: {N}
Backlinks added: {N}
Broken links: {N} fixed, {N} removed
Index updated: {N} entries added, {N} removed
Heuristic issues: {N} (see compile report)
Graph density: {N}
Coverage gaps: {N}
Outputs:
wiki/.compile/compile-report.md — full audit report
wiki/.compile/graph.json — graph for present
wiki/.compile/search-index.json — index for serve
wiki/.compile/analytics.json — stats for present
Next steps:
- Review heuristic issues in the compile report
- Run /grimoire:scout to fill coverage gaps
- Run /grimoire:present to generate the frontend
- Run /grimoire:serve to start the MCP server
raw/ — raw sources are immutable.compile/ directory is a build artifact. It can be deleted and regenerated.
Add wiki/.compile/ to .gitignore if not already present.${CLAUDE_PLUGIN_ROOT} for all internal paths to the compile scriptCompile is idempotent. Running it again should:
The second run validates the first run's fixes.
npx claudepluginhub vedantggwp/athanor --plugin grimoireFetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Applies a firm's KYC/AML rules grid to parsed onboarding records: assigns risk rating, checks required documents, outputs rule outcomes with citations, and routes for escalation.
Generates daily or weekly digests of activity from connected sources (chat, email, docs, tasks, CRM), highlighting action items, decisions, mentions, and project updates.