| name | knowledge-agent |
| description | Build and query AI-powered knowledge bases from claude-mem observation history. Creates focused "brains" from past session data — all decisions about hooks, all bugfixes in a module, all architecture choices from a month. TRIGGER when: user asks "what did we decide about X", "summarize all work on Y", "build a brain for Z", or wants to query patterns from past sessions. Requires claude-mem to be installed and running. |
| origin | claude-mem |
| owner | surfingalien |
knowledge-agent
You're a pragmatic executor focused on shipping results and measuring impact. You use AI to amplify your effect and automation to eliminate busywork.
Your Role
Build and query AI-powered knowledge bases from claude-mem observation history. Think of these as custom brains filtered by topic, time range, or concern:
- "Everything about the Anthropic API integration"
- "All architecture decisions from the last month"
- "Every bugfix in the trading pipeline"
- "All decisions about Railway deployment config"
When to Use
- You want to ask questions about past sessions without re-reading transcripts
- A recurring pattern keeps appearing and you want to understand its history
- Onboarding: build a brain for a domain, then ask it questions
- Pre-planning: understand all past decisions on a topic before making a new one
- Post-incident: pull all observations related to a system that just broke
Requires: claude-mem installed and at least one prior session of observations recorded.
Workflow
Step 1: Build a Corpus
Define what goes into the brain:
claude-mem corpus build \
--name "anthropic-integration" \
--filter "anthropic OR claude-api OR model_call" \
--output ~/.claude-mem/corpora/anthropic-integration.json
claude-mem corpus build \
--name "may-architecture" \
--since "2026-05-01" \
--until "2026-05-31" \
--output ~/.claude-mem/corpora/may-architecture.json
claude-mem corpus build \
--name "trading-pipeline" \
--filter "trading OR market OR portfolio" \
--output ~/.claude-mem/corpora/trading-pipeline.json
Step 2: Prime the Knowledge Agent
Load the corpus into a Claude session:
claude-mem prime --corpus ~/.claude-mem/corpora/anthropic-integration.json
claude-mem context --corpus anthropic-integration
Step 3: Query the Brain
Once primed, ask questions conversationally:
- "What retry strategy did we settle on for the Anthropic API?"
- "Did we ever resolve the rate limiting issue?"
- "What was the reasoning for choosing PostgreSQL over SQLite?"
- "Show me all the times we changed the streaming implementation"
- "What bugs did we fix in the stock agent last month?"
Step 4: Export Findings
For planning or documentation purposes:
claude-mem corpus export \
--corpus anthropic-integration \
--format markdown \
--output docs/anthropic-integration-history.md
Use Cases for Your Stack
FinSurfing Architecture Brain
claude-mem corpus build \
--name "finsurfing-architecture" \
--filter "architecture OR schema OR route OR migration" \
--since "2026-01-01"
Query: "What's the current approach to database connection pooling?"
Query: "Have we ever discussed moving from Express to a different framework?"
Anthropic API Integration Brain
claude-mem corpus build \
--name "claude-api-decisions" \
--filter "anthropic OR claude OR model OR prompt OR token"
Query: "What system prompt patterns have worked best for stock analysis?"
Query: "What was the decision on streaming vs non-streaming responses?"
Trading Intelligence Brain
claude-mem corpus build \
--name "trading-intel" \
--filter "trading OR market OR portfolio OR ai-trader OR signal"
Query: "What AI-Trader integration approaches have we explored?"
Query: "What data sources are we pulling market data from?"
my-claude-agents Development Brain
claude-mem corpus build \
--name "agents-repo" \
--filter "skill OR agent OR claude-code OR plugin OR command"
Query: "What's the naming convention we settled on for new skills?"
Query: "What skills were pulled from external repos and when?"
Building a Team Knowledge Base
For shared context across sessions on a project:
- Build corpus at end of each major phase
- Store in
docs/knowledge/ alongside the repo
- Prime at start of new sessions with
claude-mem context --corpus <name>
- Keeps institutional memory even as session context resets
Corpus Design Tips
- Narrow is better — A brain about one topic answers faster and more accurately than a brain about everything
- Name for recall — Name corpora so you remember what they contain 6 months later
- Timestamp-anchor — Add
--since to avoid stale observations polluting answers
- Rebuild after major work — Corpora are snapshots; rebuild after a big sprint
Related Skills
mem-search — Quick keyword search across all observations (no corpus needed)
timeline-report — Narrative history of a project (good for full chronology)
learn-codebase — Use to prime from source files rather than observation history