Load targeted knowledge from .agents/knowledge/ to inform the current session.
Process
1. Determine Focus Area
If the user provided a focus argument, use it. Otherwise, infer from:
- The current git branch name
- Recent git log (last 3-5 commits)
- Any files currently modified (git diff --name-only)
2. Load and Filter Knowledge
Read all .jsonl files in .agents/knowledge/:
.agents/knowledge/
├── patterns.jsonl
├── gotchas.jsonl
├── decisions.jsonl
├── anti-patterns.jsonl
├── codebase-facts.jsonl
└── api-behaviors.jsonl
For each entry, check relevance by matching:
tagsagainst the focus keywordsaffectedFilesagainst files being modifiedtypeagainst the work type (e.g., "bug fix" → prioritize gotchas + anti-patterns)
3. Prioritize by Relevance
Sort matched entries:
- High confidence + direct file match → Always show
- High confidence + tag match → Show if ≤10 results
- Medium confidence + file match → Show if ≤15 results
- Everything else → Skip (available via direct read if needed)
4. Present Knowledge Brief
Output a compact brief:
## Knowledge Brief: [focus area]
### Must-Know (directly relevant)
- 🔴 [anti-pattern or gotcha]: ...
- 🟢 [pattern]: ...
### Context (good to know)
- 📐 [decision]: ...
- 📦 [codebase-fact]: ...
### Caution
- ⚠️ [gotcha]: ...
---
*N entries loaded from knowledge base. Last reflection: [date]*
Rules:
- Keep the brief under 30 lines — this is a primer, not a dump
- Anti-patterns and gotchas come first — preventing mistakes is highest value
- If nothing matches, say so and suggest running
/self-reflectafter this session - Never load ALL entries — that defeats the purpose
5. Bump Usage Counters
For each entry actually surfaced in the brief, increment its usageCount by 1 and set updatedAt to now. This is a relevance signal /evolve uses later — entries that get surfaced often but never re-confirmed (low helpfulCount) may be too generic; entries with high outdatedReports relative to helpfulCount are pruning candidates.
Auto-Prime
When working on this project, automatically run a lightweight prime at session start:
- Read the last 3 entries from each knowledge file (most recent)
- If any are directly relevant to the current branch/task, mention them
- Otherwise, stay silent — don't clutter the session with irrelevant knowledge