Knowledge Base
Manage a structured knowledge base at context/knowledge/ for capturing durable facts, entities, and patterns across sessions.
Arguments
$ARGUMENTS - Subcommand: init, add <topic>, update <topic>, or omit for status
Context
- Knowledge index: !
cat context/knowledge/index.md 2>/dev/null | head -50
- Knowledge files: !
find context/knowledge -maxdepth 1 -name "*.md" 2>/dev/null | head -20
- Project root: !
git rev-parse --show-toplevel 2>/dev/null | head -1
- CLAUDE.md exists: !
find . -maxdepth 1 \( -name CLAUDE.md -o -name AGENTS.md \) 2>/dev/null | head -2
Instructions
Subcommand: init
Create the knowledge base directory and seed it with an index file.
- Create
context/knowledge/ directory
- Write
context/knowledge/index.md with this template:
# Knowledge Index
Structured knowledge for future knowledge graph ingestion. Each file covers a topic/domain.
| File | Topic | Key Entities | Last Updated |
|------|-------|-------------|-------------|
## Coverage Map
Which context files are captured in knowledge:
| Context File | Knowledge File(s) | Coverage |
|-------------|-------------------|----------|
- If the project has a
.gitignore, verify context/knowledge/ is not ignored
- Report the path created and suggest initial topics based on what is visible in the repo (CLAUDE.md, AGENTS.md, README, directory structure)
Subcommand: add
Create a new topic file and register it in the index.
- Read the existing index to avoid duplicates
- Ask what entities and facts to capture if not obvious from conversation context
- Create
context/knowledge/<topic>.md with a heading and structured content
- Update
context/knowledge/index.md — add a row to the index table with the file name, topic description, key entities, and today's date
- Report what was added
Subcommand: update
Update an existing topic file with new knowledge.
- Read
context/knowledge/index.md to find the topic file
- Read the topic file
- Propose additions or corrections as diffs
- Apply after user approval
- Update the Last Updated date in
context/knowledge/index.md
Subcommand: (no args) — status
Show the current state of the knowledge base:
- Number of topic files and total coverage
- Topics with the oldest Last Updated dates
- Coverage gaps (context files or CLAUDE.md sections not yet captured)
Knowledge File Format
Each topic file should follow this pattern:
# Topic Name
Brief description of what this file covers.
## Section
- **Entity**: Description or fact
- **Entity**: Description or fact
## Section
...
Guidelines for content:
- Use bold for entity names and key terms
- Group related facts under clear section headings
- Include specific values, names, versions — not vague summaries
- Each fact should stand alone (no "as mentioned above" references)
- Date-stamp volatile facts (pricing, team composition, versions)
What Belongs in Knowledge
- People, roles, org structure
- Technical infrastructure and architecture decisions
- Product features, business logic, domain concepts
- Integration partners, vendors, external services
- Debugging insights that will recur
- Non-obvious tool or dependency behavior
What Does NOT Belong in Knowledge
- Operational items (todos, plans, schedules)
- Session-specific transients
- Information already in CLAUDE.md or AGENTS.md
- Speculation or unverified claims
- Full documents (link to them instead, capture key facts)
1---2name: knowledge3description: Initialize or update a project knowledge base for durable cross-session knowledge capture. Use for setting up or updating project knowledge bases.4---5# Knowledge Base67Manage a structured knowledge base at `context/knowledge/` for capturing durable facts, entities, and patterns across sessions.89## Arguments1011- `$ARGUMENTS` - Subcommand: `init`, `add <topic>`, `update <topic>`, or omit for status1213## Context1415- Knowledge index: !`cat context/knowledge/index.md 2>/dev/null | head -50`16- Knowledge files: !`find context/knowledge -maxdepth 1 -name "*.md" 2>/dev/null | head -20`17- Project root: !`git rev-parse --show-toplevel 2>/dev/null | head -1`18- CLAUDE.md exists: !`find . -maxdepth 1 \( -name CLAUDE.md -o -name AGENTS.md \) 2>/dev/null | head -2`1920## Instructions2122### Subcommand: init2324Create the knowledge base directory and seed it with an index file.25261. Create `context/knowledge/` directory272. Write `context/knowledge/index.md` with this template:2829```markdown30# Knowledge Index3132Structured knowledge for future knowledge graph ingestion. Each file covers a topic/domain.3334| File | Topic | Key Entities | Last Updated |35|------|-------|-------------|-------------|3637## Coverage Map3839Which context files are captured in knowledge:4041| Context File | Knowledge File(s) | Coverage |42|-------------|-------------------|----------|43```44453. If the project has a `.gitignore`, verify `context/knowledge/` is not ignored464. Report the path created and suggest initial topics based on what is visible in the repo (CLAUDE.md, AGENTS.md, README, directory structure)4748### Subcommand: add <topic>4950Create a new topic file and register it in the index.51521. Read the existing index to avoid duplicates532. Ask what entities and facts to capture if not obvious from conversation context543. Create `context/knowledge/<topic>.md` with a heading and structured content554. Update `context/knowledge/index.md` — add a row to the index table with the file name, topic description, key entities, and today's date565. Report what was added5758### Subcommand: update <topic>5960Update an existing topic file with new knowledge.61621. Read `context/knowledge/index.md` to find the topic file632. Read the topic file643. Propose additions or corrections as diffs654. Apply after user approval665. Update the Last Updated date in `context/knowledge/index.md`6768### Subcommand: (no args) — status6970Show the current state of the knowledge base:71- Number of topic files and total coverage72- Topics with the oldest Last Updated dates73- Coverage gaps (context files or CLAUDE.md sections not yet captured)7475## Knowledge File Format7677Each topic file should follow this pattern:7879```markdown80# Topic Name8182Brief description of what this file covers.8384## Section8586- **Entity**: Description or fact87- **Entity**: Description or fact8889## Section9091...92```9394Guidelines for content:95- Use bold for entity names and key terms96- Group related facts under clear section headings97- Include specific values, names, versions — not vague summaries98- Each fact should stand alone (no "as mentioned above" references)99- Date-stamp volatile facts (pricing, team composition, versions)100101## What Belongs in Knowledge102103- People, roles, org structure104- Technical infrastructure and architecture decisions105- Product features, business logic, domain concepts106- Integration partners, vendors, external services107- Debugging insights that will recur108- Non-obvious tool or dependency behavior109110## What Does NOT Belong in Knowledge111112- Operational items (todos, plans, schedules)113- Session-specific transients114- Information already in CLAUDE.md or AGENTS.md115- Speculation or unverified claims116- Full documents (link to them instead, capture key facts)