diff --git a/container/Dockerfile b/container/Dockerfile index e8537c3e3..be142b577 100644 --- a/container/Dockerfile +++ b/container/Dockerfile @@ -30,8 +30,8 @@ RUN apt-get update && apt-get install -y \ ENV AGENT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium -# Install agent-browser and claude-code globally -RUN npm install -g agent-browser @anthropic-ai/claude-code +# Install agent-browser, claude-code, and QMD globally +RUN npm install -g agent-browser @anthropic-ai/claude-code @tobilu/qmd # Create app directory WORKDIR /app diff --git a/container/agent-runner/src/index.ts b/container/agent-runner/src/index.ts index 7e739c7ce..a8ec9ee72 100644 --- a/container/agent-runner/src/index.ts +++ b/container/agent-runner/src/index.ts @@ -469,6 +469,7 @@ async function runQuery( 'Skill', 'NotebookEdit', 'mcp__nanoclaw__*', + 'mcp__qmd__*', ], env: sdkEnv, permissionMode: 'bypassPermissions', @@ -484,6 +485,10 @@ async function runQuery( NANOCLAW_IS_MAIN: containerInput.isMain ? '1' : '0', }, }, + qmd: { + type: 'http', + url: 'http://host.docker.internal:8182/mcp', + }, }, hooks: { PreCompact: [ diff --git a/container/skills/qmd/SKILL.md b/container/skills/qmd/SKILL.md new file mode 100644 index 000000000..9411c5c11 --- /dev/null +++ b/container/skills/qmd/SKILL.md @@ -0,0 +1,71 @@ +--- +name: qmd +description: Search past conversations and documentation. Use when users ask about things mentioned before, past discussions, or need context from history. +allowed-tools: Bash(npx qmd:*), Grep, Glob, Read +--- + +# QMD - Conversation Search + +Search past conversations and documentation in the groups directory. + +## MCP Tools (Preferred) + +QMD MCP server runs on the host at `http://host.docker.internal:8182/mcp`. + +Available tools: +- `mcp__qmd__query` - Search with lex/vec/hyde queries +- `mcp__qmd__get` - Retrieve document by path or docid +- `mcp__qmd__multi_get` - Batch retrieve by glob pattern +- `mcp__qmd__status` - Check index health + +Example query: +```json +{ + "searches": [ + { "type": "lex", "query": "search term" }, + { "type": "vec", "query": "natural language question" } + ], + "collections": ["telegram_main"], + "limit": 10 +} +``` + +## CLI Fallback + +If MCP tools are unavailable, use the QMD CLI directly: + +```bash +# Keyword search +npx qmd search "search term" -c telegram_main + +# Semantic search (requires embeddings) +npx qmd vsearch "natural language question" -c telegram_main + +# Hybrid search with reranking (best quality) +npx qmd query "question" -c telegram_main +``` + +## Fallback: Direct File Search + +If QMD isn't available at all, search conversation files directly: + +```bash +# Find conversations containing a term +grep -r "term" /workspace/group/conversations/ + +# List recent conversations +ls -lt /workspace/group/conversations/ | head -10 +``` + +## Conversation Files Location + +- Conversations: `/workspace/group/conversations/*.md` +- Documentation: `/workspace/group/docs/*.md` +- Group memory: `/workspace/group/CLAUDE.md` + +## When to Use + +- User asks "what did we discuss about X" +- User mentions something from a past conversation +- Need context from previous sessions +- Looking up decisions or preferences mentioned before