88 lines
2.6 KiB
Markdown
88 lines
2.6 KiB
Markdown
---
|
|
summary: "Search and retrieve TekDek knowledge base using qmd (BM25 + semantic search + reranking)"
|
|
read_when:
|
|
- Searching for TekDek knowledge (personas, projects, storylines, brands, operations)
|
|
- Looking up past decisions, context, or documentation
|
|
- Answering questions that might be in the knowledge base
|
|
- Adding new knowledge to the knowledge base
|
|
---
|
|
|
|
# QMD — TekDek Knowledge Base
|
|
|
|
qmd is our local search engine. It indexes all markdown docs in the workspace and knowledge base, and supports keyword, semantic, and hybrid search with reranking.
|
|
|
|
## Collections
|
|
|
|
- **workspace** (`qmd://workspace/`) — Core agent files: IDENTITY.md, MEMORY.md, SOUL.md, USER.md, daily logs, etc.
|
|
- **knowledge** (`qmd://knowledge/`) — TekDek KB: personas, projects, storylines, brands, operations
|
|
|
|
## Knowledge Base Structure
|
|
|
|
```
|
|
/data/.openclaw/workspace/knowledge/
|
|
├── personas/ — One .md file per Coder persona
|
|
├── projects/ — One .md file per TekDek project
|
|
├── storyline/ — Storyline arcs, relationship dynamics
|
|
├── brands/ — Per-persona brand guides
|
|
└── operations/ — Processes, decisions, meeting notes
|
|
```
|
|
|
|
## Search Commands
|
|
|
|
```bash
|
|
# Fast keyword search
|
|
qmd search "query"
|
|
|
|
# Semantic/vector search
|
|
qmd vsearch "query"
|
|
|
|
# Best quality: hybrid + reranking (use this for most queries)
|
|
qmd query "query"
|
|
|
|
# Search within a specific collection
|
|
qmd search "query" -c knowledge
|
|
qmd query "persona quirks" -c knowledge
|
|
|
|
# Get a specific file
|
|
qmd get "knowledge/personas/example.md"
|
|
|
|
# Export results for agent use
|
|
qmd query "topic" --json -n 10
|
|
qmd query "topic" --all --files --min-score 0.4
|
|
```
|
|
|
|
## MCP Tools (available via MCP server)
|
|
|
|
- `query` — Hybrid search with reranking (best quality)
|
|
- `get` — Retrieve document by path or docid
|
|
- `multi_get` — Batch retrieve by glob or docids
|
|
- `status` — Index health and collection info
|
|
|
|
## Adding Knowledge
|
|
|
|
When new TekDek content is created (new persona, project, storyline beat, etc.), create a markdown file in the appropriate `knowledge/` subdirectory, then re-index:
|
|
|
|
```bash
|
|
qmd collection sync workspace
|
|
qmd collection sync knowledge
|
|
# Then re-embed if needed:
|
|
qmd embed
|
|
```
|
|
|
|
## Re-indexing
|
|
|
|
Run after adding/changing files:
|
|
|
|
```bash
|
|
qmd collection sync workspace && qmd collection sync knowledge
|
|
qmd embed # slow on CPU — only run when needed
|
|
```
|
|
|
|
## Tips
|
|
|
|
- `qmd query` is best quality but slowest (uses LLM reranking)
|
|
- `qmd search` is fast and good for known terms
|
|
- `qmd vsearch` is good for fuzzy/conceptual queries
|
|
- Always check `qmd status` if results seem stale
|
|
- The MCP server (`qmd mcp`) can be used for tighter tool integration
|