Skip to content

Commit f4ca5d8

Browse files
committed
docs: add agent-specific knowledge base documentation
- Document isolated knowledge storage per agent - Add folder structure diagram showing agent separation - Explain agent isolation benefits and switching workflow - Fix command syntax for agent usage and knowledge commands
1 parent 417be89 commit f4ca5d8

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

docs/knowledge-management.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,66 @@ Configure knowledge base behavior:
166166
`q settings knowledge.defaultIncludePatterns '["**/*.rs", "**/*.md"]'` # Default include patterns
167167
`q settings knowledge.defaultExcludePatterns '["target/**", "node_modules/**"]'` # Default exclude patterns
168168

169+
## Agent-Specific Knowledge Bases
170+
171+
### Isolated Knowledge Storage
172+
173+
Each agent maintains its own isolated knowledge base, ensuring that knowledge contexts are scoped to the specific agent you're working with. This provides better organization and prevents knowledge conflicts between different agents.
174+
175+
### Folder Structure
176+
177+
Knowledge bases are stored in the following directory structure:
178+
179+
```
180+
~/.q/knowledge_bases/
181+
├── q_cli_default/ # Default agent knowledge base
182+
│ ├── contexts.json # Metadata for all contexts
183+
│ ├── context-id-1/ # Individual context storage
184+
│ │ ├── data.json # Semantic search data
185+
│ │ └── bm25_data.json # BM25 search data (if using Fast index)
186+
│ └── context-id-2/
187+
│ ├── data.json
188+
│ └── bm25_data.json
189+
├── my-custom-agent/ # Custom agent knowledge base
190+
│ ├── contexts.json
191+
│ ├── context-id-3/
192+
│ │ └── data.json
193+
│ └── context-id-4/
194+
│ └── data.json
195+
└── another-agent/ # Another agent's knowledge base
196+
├── contexts.json
197+
└── context-id-5/
198+
└── data.json
199+
```
200+
201+
### How Agent Isolation Works
202+
203+
- **Automatic Scoping**: When you use `/knowledge` commands, they automatically operate on the current agent's knowledge base
204+
- **No Cross-Agent Access**: Agent A cannot access or search knowledge contexts created by Agent B
205+
- **Independent Configuration**: Each agent can have different knowledge base settings and contexts
206+
- **Migration Support**: Legacy knowledge bases are automatically migrated to the default agent on first use
207+
208+
### Agent Switching
209+
210+
When you switch between agents, your knowledge commands will automatically work with that agent's specific knowledge base:
211+
212+
```bash
213+
# Working with default agent
214+
/knowledge add /path/to/docs
215+
216+
# Switch to custom agent
217+
q chat --agent my-custom-agent
218+
219+
# This creates a separate knowledge base for my-custom-agent
220+
/knowledge add /path/to/agent/docs
221+
222+
# Switch back to default
223+
q chat
224+
225+
# Only sees the original project-docs, not agent-specific-docs
226+
/knowledge show
227+
```
228+
169229
## How It Works
170230

171231
#### Indexing Process

0 commit comments

Comments
 (0)