$npx -y skills add tody-agent/codymaster --skill cm-deep-searchOptional power-up — detects oversized codebases/docs and suggests tobi/qmd for local semantic search. Bridges cm-continuity (working memory) with long-term document retrieval. Zero-config detection, non-intrusive suggestion.
| 1 | # Deep Search — Semantic Memory Power-Up |
| 2 | |
| 3 | > **When your project outgrows AI's context window, bring the search engine to your docs.** |
| 4 | > Optional integration with [tobi/qmd](https://github.com/tobi/qmd) — BM25 + Vector + LLM re-ranking, 100% local. |
| 5 | |
| 6 | ## When to Trigger |
| 7 | |
| 8 | **This skill is NOT invoked directly.** It is triggered automatically by other skills when they detect an oversized project. |
| 9 | |
| 10 | ### Detection Thresholds |
| 11 | |
| 12 | During codebase scan (Phase 1a of `cm-brainstorm-idea`, Step 2 of `cm-dockit`, etc.), check: |
| 13 | |
| 14 | ``` |
| 15 | TRIGGER if ANY of these are true: |
| 16 | → docs/ folder contains >50 markdown files |
| 17 | → Project has >200 source files total |
| 18 | → User mentions "meeting notes", "historical PRDs", "old specs" |
| 19 | → User asks "find that file that talked about X from before" |
| 20 | → cm-dockit just generated >30 doc files |
| 21 | ``` |
| 22 | |
| 23 | ### What to Say (Non-Intrusive) |
| 24 | |
| 25 | When threshold is met, suggest naturally — DO NOT block or force: |
| 26 | |
| 27 | ```markdown |
| 28 | 💡 **Pro Tip: Deep Search** |
| 29 | |
| 30 | This project has [X doc files / Y source files] — quite large for AI to read directly. |
| 31 | You can install **[qmd](https://github.com/tobi/qmd)** to create semantic search |
| 32 | across all your documentation, helping AI find the right context faster. |
| 33 | |
| 34 | Quick install: |
| 35 | \`\`\`bash |
| 36 | npm install -g @tobilu/qmd |
| 37 | qmd collection add ./docs --name project-docs |
| 38 | qmd context add qmd://project-docs "Project documentation for [project-name]" |
| 39 | qmd embed |
| 40 | \`\`\` |
| 41 | |
| 42 | Then AI can search using: `qmd query "your question"` |
| 43 | ``` |
| 44 | |
| 45 | --- |
| 46 | |
| 47 | ## Setup Guide (when user agrees to install) |
| 48 | |
| 49 | ### Step 1: Install |
| 50 | |
| 51 | ```bash |
| 52 | # Node.js |
| 53 | npm install -g @tobilu/qmd |
| 54 | |
| 55 | # Or Bun |
| 56 | bun install -g @tobilu/qmd |
| 57 | ``` |
| 58 | |
| 59 | ### Step 2: Index project docs |
| 60 | |
| 61 | ```bash |
| 62 | # Add collections |
| 63 | qmd collection add ./docs --name docs |
| 64 | qmd collection add ./src --name source --mask "**/*.{ts,tsx,js,jsx,py,go,rs}" |
| 65 | |
| 66 | # Add context (helps AI understand each collection's purpose) |
| 67 | qmd context add qmd://docs "Technical documentation for [project-name]" |
| 68 | qmd context add qmd://source "Source code for [project-name]" |
| 69 | |
| 70 | # Create vector embeddings |
| 71 | qmd embed |
| 72 | ``` |
| 73 | |
| 74 | ### Step 3: Setup MCP Server (for Codex/Cursor/Antigravity) |
| 75 | |
| 76 | Add to MCP config: |
| 77 | |
| 78 | ```json |
| 79 | { |
| 80 | "mcpServers": { |
| 81 | "qmd": { |
| 82 | "command": "qmd", |
| 83 | "args": ["mcp"] |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | ``` |
| 88 | |
| 89 | Or run HTTP mode for shared server: |
| 90 | |
| 91 | ```bash |
| 92 | qmd mcp --http --daemon |
| 93 | ``` |
| 94 | |
| 95 | ### Step 4: Verify |
| 96 | |
| 97 | ```bash |
| 98 | # Check index |
| 99 | qmd status |
| 100 | |
| 101 | # Test search |
| 102 | qmd query "authentication flow" |
| 103 | ``` |
| 104 | |
| 105 | --- |
| 106 | |
| 107 | ## Usage with CodyMaster Skills |
| 108 | |
| 109 | ### With `cm-brainstorm-idea` (Phase 1: DISCOVER) |
| 110 | |
| 111 | When AI needs to understand the full picture of a large project: |
| 112 | |
| 113 | ```bash |
| 114 | # Find all docs related to the topic being brainstormed |
| 115 | qmd query "user authentication redesign" --json -n 10 |
| 116 | |
| 117 | # Get full content of important docs |
| 118 | qmd get "docs/architecture.md" --full |
| 119 | ``` |
| 120 | |
| 121 | ### With `cm-planning` (Phase A: Brainstorm) |
| 122 | |
| 123 | When searching for specs, PRDs, or past decisions related to the feature being planned: |
| 124 | |
| 125 | ```bash |
| 126 | qmd query "payment integration decisions" --files --min-score 0.4 |
| 127 | ``` |
| 128 | |
| 129 | ### With `cm-dockit` (Post-generation) |
| 130 | |
| 131 | After `cm-dockit` finishes generating docs, index them so AI can search from any session: |
| 132 | |
| 133 | ```bash |
| 134 | qmd collection add ./docs --name project-knowledge |
| 135 | qmd embed |
| 136 | ``` |
| 137 | |
| 138 | ### With `cm-continuity` (Tier 4: External Memory) |
| 139 | |
| 140 | `cm-continuity` manages working memory (500 words). `qmd` extends it with long-term semantic search: |
| 141 | |
| 142 | ``` |
| 143 | Tier 1: Sensory Memory → temporary variables in session (not persisted) |
| 144 | Tier 2: Working Memory → CONTINUITY.md (~500 words) |
| 145 | Tier 3: Long-Term Memory → learnings.json, decisions.json |
| 146 | Tier 4: External Semantic → qmd (optional, text search for large docs) |
| 147 | Tier 5: Structural Code → CodeGraph (optional, AST graph for code — see cm-codeintell) |
| 148 | ``` |
| 149 | |
| 150 | > **qmd** finds text across docs/code. **CodeGraph** finds symbols, call graphs, and impact. |
| 151 | > They complement each other — use both for maximum intelligence on large projects. |
| 152 | |
| 153 | --- |
| 154 | |
| 155 | ## 🛑 Staleness Prevention |
| 156 | |
| 157 | The biggest risk of Semantic Search is **stale index / new source**. If AI reads outdated docs and generates incorrect code, the consequences are severe. |
| 158 | |
| 159 | CodyMaster handles this with 3 mechanisms: |
| 160 | |
| 161 | ### 1. The "Post-Execution" Sync |
| 162 | Whenever AI completes a task that changes/creates a large number of files (e.g., `cm-dockit` generates docs, `cm-execution` refactors source code): |
| 163 | ```bash |
| 164 | # This runs quickly because qmd only embeds changed files (incremental) |
| 165 | qmd embed |
| 166 | ``` |
| 167 | > **AI Rule:** If the project has qmd enabled, AI must automatically run `qmd embed` via terminal before finishing a task. |
| 168 | |
| 169 | ### 2. The "Pre-Flight" Check |
| 170 | Before starting `cm-brainstorm-idea` or `cm-planning` on a project using qmd, AI calls the MCP tool to perform a health check: |
| 171 | ```json |
| 172 | // AI auto-runs this MCP tool |
| 173 | { |
| 174 | "name": "status", |
| 175 | "arguments": {} |
| 176 | } |
| 177 | ` |