knowledge-agent
thedotmack/claude-mem
Build and query AI-powered knowledge bases from your observation history to create focused "brains" on specific topics.
What is knowledge-agent?
Knowledge agents let you compile filtered observations into conversational AI sessions that answer questions about past work patterns, decisions, and expertise. Build a corpus from your observations, prime it into an AI session, then query it conversationally—useful for creating focused "brains" like "everything about hooks" or "all bugfixes from last month".
- Filter observations by project, type, concepts, files, dates, or semantic search to build focused corpora
- Prime a corpus into an AI session that persists across multiple queries
- Query the knowledge base conversationally with follow-up questions maintaining context
- Rebuild corpora to incorporate new observations and reprime for fresh context
- List all corpora with statistics and priming status
How to install knowledge-agent
npx skills add https://github.com/thedotmack/claude-mem --skill knowledge-agent- claude-mem installed and observations already recorded
- Access to observation history with project, type, concept, and file metadata
How to use knowledge-agent
- 1.Run build_corpus with filters (project, types, concepts, files, query, dateStart/dateEnd, limit) to create a focused corpus
- 2.Run prime_corpus to load the corpus into an AI session
- 3.Run query_corpus with your question; follow-up questions maintain context automatically
- 4.Run list_corpora to see all available corpora and their stats
- 5.Run rebuild_corpus when new observations are added, then reprime_corpus for a fresh session
Use cases
- Create a hooks expertise corpus and ask questions about lifecycle behavior and timing
- Compile all decisions from the last month into a corpus to review decision patterns
- Build a corpus of bugfixes for a specific service to understand common issues
- Query past work patterns to understand project architecture and design decisions
- Maintain a focused brain on a specific topic and update it as new observations are added
- Developers reviewing their own work patterns and decisions
- Teams compiling institutional knowledge on specific systems or services
- Engineers onboarding to understand past decisions and architecture
- Anyone building custom knowledge bases from their observation history
knowledge-agent FAQ
Priming loads a corpus into an AI session (one-time setup). Querying asks questions of that primed session. Prime once, then query multiple times.
Run rebuild_corpus to refresh it with new observations, then reprime_corpus to load the updated knowledge into a fresh session.
Yes. After querying, follow-up questions maintain context within the same primed session until you reprime.
Combine project, types (decision/bugfix/feature/refactor/discovery/change), concepts, and files. Semantic search via query also works. Focused filters produce better results than broad ones.
Run reprime_corpus to clear prior Q&A context and reload the corpus into a new session.
Full instructions (SKILL.md)
Source of truth, from thedotmack/claude-mem.
name: knowledge-agent description: Build and query AI-powered knowledge bases from claude-mem observations. Use when users want to create focused "brains" from their observation history, ask questions about past work patterns, or compile expertise on specific topics.
Knowledge Agent
Build and query AI-powered knowledge bases from claude-mem observations.
What Are Knowledge Agents?
Knowledge agents are filtered corpora of observations compiled into a conversational AI session. Build a corpus from your observation history, prime it (loads the knowledge into an AI session), then ask it questions conversationally.
Think of them as custom "brains": "everything about hooks", "all decisions from the last month", "all bugfixes for the worker service".
Workflow
Step 1: Build a corpus
build_corpus name="hooks-expertise" description="Everything about the hooks lifecycle" project="claude-mem" concepts="hooks" limit=500
Filter options:
project— filter by project nametypes— comma-separated: decision, bugfix, feature, refactor, discovery, changeconcepts— comma-separated concept tagsfiles— comma-separated file paths (prefix match)query— semantic search querydateStart/dateEnd— ISO date rangelimit— max observations (default 500)
Step 2: Prime the corpus
prime_corpus name="hooks-expertise"
This creates an AI session loaded with all the corpus knowledge. Takes a moment for large corpora.
Step 3: Query
query_corpus name="hooks-expertise" question="What are the 5 lifecycle hooks and when does each fire?"
The knowledge agent answers from its corpus. Follow-up questions maintain context.
Step 4: List corpora
list_corpora
Shows all corpora with stats and priming status.
Tips
- Focused corpora work best — "hooks architecture" beats "everything ever"
- Prime once, query many times — the session persists across queries
- Reprime for fresh context — if the conversation drifts, reprime to reset
- Rebuild to update — when new observations are added, rebuild then reprime
Maintenance
Rebuild a corpus (refresh with new observations)
rebuild_corpus name="hooks-expertise"
After rebuilding, reprime to load the updated knowledge:
Reprime (fresh session)
reprime_corpus name="hooks-expertise"
Clears prior Q&A context and reloads the corpus into a new session.
Related skills
More from thedotmack/claude-mem and the wider catalog.
mem-search
Search persistent cross-session memory to find previous solutions and past work.
smart-explore
Token-optimized structural code search using tree-sitter AST parsing for efficient codebase exploration.
make-plan
Create detailed, phased implementation plans with documentation discovery before execution.
do
Execute phased implementation plans by orchestrating specialized subagents for each task.
timeline-report
Generate narrative reports analyzing a project's complete development history from claude-mem's persistent timeline.
claude-code-plugin-release
Automated semantic versioning and release workflow for Claude Code plugins with manifest sync, git tagging, and GitHub releases.