|
| 1 | +# ty-qmd |
| 2 | + |
| 3 | +QMD integration for TaskYou. Provides semantic search over task history, project documentation, and knowledge bases during task execution. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +[QMD](https://github.com/tobi/qmd) is an on-device search engine that combines BM25 full-text search, vector semantic search, and LLM re-ranking. This extension integrates QMD with TaskYou to: |
| 8 | + |
| 9 | +1. **Index task history** - Completed tasks become searchable knowledge |
| 10 | +2. **Search during execution** - Claude can query past work for context |
| 11 | +3. **Project documentation** - Index markdown, meeting notes, docs alongside tasks |
| 12 | + |
| 13 | +## Architecture |
| 14 | + |
| 15 | +``` |
| 16 | +┌─────────────────────────────────────────────────────────────┐ |
| 17 | +│ TaskYou Task Execution │ |
| 18 | +├─────────────────────────────────────────────────────────────┤ |
| 19 | +│ │ |
| 20 | +│ Claude ──MCP──▶ taskyou-mcp ──proxy──▶ qmd mcp server │ |
| 21 | +│ │ │ │ |
| 22 | +│ │ ▼ │ |
| 23 | +│ │ ┌───────────────┐ │ |
| 24 | +│ │ │ QMD Index │ │ |
| 25 | +│ │ │ - tasks │ │ |
| 26 | +│ │ │ - docs │ │ |
| 27 | +│ │ │ - notes │ │ |
| 28 | +│ ▼ └───────────────┘ │ |
| 29 | +│ ┌─────────────┐ │ |
| 30 | +│ │ TaskYou DB │◀──────── ty-qmd sync │ |
| 31 | +│ └─────────────┘ │ |
| 32 | +│ │ |
| 33 | +└─────────────────────────────────────────────────────────────┘ |
| 34 | +``` |
| 35 | + |
| 36 | +## Features |
| 37 | + |
| 38 | +### Task History Search |
| 39 | + |
| 40 | +When a task completes, ty-qmd exports it to a searchable collection: |
| 41 | + |
| 42 | +```bash |
| 43 | +# Index completed tasks |
| 44 | +ty-qmd sync |
| 45 | + |
| 46 | +# Search past tasks |
| 47 | +ty-qmd search "authentication implementation" |
| 48 | +``` |
| 49 | + |
| 50 | +Each task becomes a document containing: |
| 51 | +- Title and description |
| 52 | +- Completion summary |
| 53 | +- Key files modified |
| 54 | +- Project context |
| 55 | + |
| 56 | +### MCP Sidecar Mode |
| 57 | + |
| 58 | +Run QMD as an MCP sidecar during task execution: |
| 59 | + |
| 60 | +```bash |
| 61 | +# Start qmd MCP server for Claude to use |
| 62 | +ty-qmd serve |
| 63 | +``` |
| 64 | + |
| 65 | +This exposes QMD tools to Claude: |
| 66 | +- `qmd_search` - Fast keyword search |
| 67 | +- `qmd_vsearch` - Semantic similarity search |
| 68 | +- `qmd_query` - Hybrid search with re-ranking |
| 69 | +- `qmd_get` - Retrieve full documents |
| 70 | + |
| 71 | +### Project Documentation Indexing |
| 72 | + |
| 73 | +Index project docs alongside tasks: |
| 74 | + |
| 75 | +```bash |
| 76 | +# Add project docs to qmd |
| 77 | +ty-qmd index-project ~/Projects/myapp --mask "**/*.md" |
| 78 | + |
| 79 | +# Add meeting notes |
| 80 | +ty-qmd index-project ~/Notes/meetings --name meetings |
| 81 | +``` |
| 82 | + |
| 83 | +## Installation |
| 84 | + |
| 85 | +### Prerequisites |
| 86 | + |
| 87 | +1. Install QMD: |
| 88 | + ```bash |
| 89 | + bun install -g github:tobi/qmd |
| 90 | + ``` |
| 91 | + |
| 92 | +2. Build ty-qmd: |
| 93 | + ```bash |
| 94 | + cd extensions/ty-qmd |
| 95 | + go build -o ty-qmd ./cmd |
| 96 | + ``` |
| 97 | + |
| 98 | +### Configuration |
| 99 | + |
| 100 | +Config at `~/.config/ty-qmd/config.yaml`: |
| 101 | + |
| 102 | +```yaml |
| 103 | +qmd: |
| 104 | + binary: qmd |
| 105 | + index: ~/.cache/qmd/index.sqlite |
| 106 | + |
| 107 | +sync: |
| 108 | + # Auto-sync completed tasks |
| 109 | + auto: true |
| 110 | + # Sync interval when running as daemon |
| 111 | + interval: 5m |
| 112 | + # Task statuses to index |
| 113 | + statuses: |
| 114 | + - done |
| 115 | + - archived |
| 116 | + # Export format for task documents |
| 117 | + format: markdown |
| 118 | + |
| 119 | +collections: |
| 120 | + # Default collection for tasks |
| 121 | + tasks: ty-tasks |
| 122 | + # Project-specific collections |
| 123 | + projects: |
| 124 | + workflow: workflow-docs |
| 125 | +``` |
| 126 | +
|
| 127 | +## Commands |
| 128 | +
|
| 129 | +```bash |
| 130 | +# Sync completed tasks to QMD |
| 131 | +ty-qmd sync [--all] [--project <name>] |
| 132 | + |
| 133 | +# Search across all indexed content |
| 134 | +ty-qmd search <query> [-n <count>] |
| 135 | + |
| 136 | +# Run MCP server for Claude integration |
| 137 | +ty-qmd serve |
| 138 | + |
| 139 | +# Index project documentation |
| 140 | +ty-qmd index-project <path> [--name <collection>] [--mask <glob>] |
| 141 | + |
| 142 | +# Show sync status |
| 143 | +ty-qmd status |
| 144 | +``` |
| 145 | + |
| 146 | +## Integration with TaskYou |
| 147 | + |
| 148 | +### Option 1: MCP Server Chaining |
| 149 | + |
| 150 | +Configure taskyou to spawn qmd MCP server alongside Claude: |
| 151 | + |
| 152 | +```yaml |
| 153 | +# In taskyou config |
| 154 | +execution: |
| 155 | + mcp_servers: |
| 156 | + - name: qmd |
| 157 | + command: qmd |
| 158 | + args: [mcp] |
| 159 | +``` |
| 160 | +
|
| 161 | +### Option 2: Proxy Mode |
| 162 | +
|
| 163 | +The taskyou MCP server can proxy to qmd, exposing its tools: |
| 164 | +
|
| 165 | +```go |
| 166 | +// In internal/mcp/server.go |
| 167 | +// Add qmd tools to tools/list |
| 168 | +// Forward qmd_* calls to qmd process |
| 169 | +``` |
| 170 | + |
| 171 | +### Option 3: Pre-Execution Context |
| 172 | + |
| 173 | +Before executing a task, search for relevant past tasks: |
| 174 | + |
| 175 | +```bash |
| 176 | +# In task execution hook |
| 177 | +ty-qmd search "$TASK_TITLE" --json | head -5 >> context.md |
| 178 | +``` |
| 179 | + |
| 180 | +## Use Cases |
| 181 | + |
| 182 | +### 1. Learning from Past Work |
| 183 | + |
| 184 | +``` |
| 185 | +Task: "Implement OAuth login" |
| 186 | +
|
| 187 | +Claude searches: "OAuth authentication implementation" |
| 188 | +Finds: Task #42 "Add Google OAuth" - completed 2 weeks ago |
| 189 | +Context: Used passport.js, stored tokens in Redis, added refresh logic |
| 190 | +``` |
| 191 | + |
| 192 | +### 2. Project-Specific Knowledge |
| 193 | + |
| 194 | +``` |
| 195 | +Task: "Add caching to API" |
| 196 | +
|
| 197 | +Claude searches in project docs: "caching architecture" |
| 198 | +Finds: architecture.md, redis-patterns.md |
| 199 | +Context: Project uses Redis, 15-minute TTL standard, cache-aside pattern |
| 200 | +``` |
| 201 | + |
| 202 | +### 3. Similar Bug Fixes |
| 203 | + |
| 204 | +``` |
| 205 | +Task: "Fix race condition in worker" |
| 206 | +
|
| 207 | +Claude searches: "race condition fix worker" |
| 208 | +Finds: Task #128 "Fix concurrent map access" |
| 209 | +Context: Used sync.Mutex, added goroutine-safe map wrapper |
| 210 | +``` |
| 211 | + |
| 212 | +## Task Export Format |
| 213 | + |
| 214 | +When syncing tasks to QMD, each task is exported as markdown: |
| 215 | + |
| 216 | +```markdown |
| 217 | +--- |
| 218 | +task_id: 42 |
| 219 | +project: workflow |
| 220 | +status: done |
| 221 | +completed: 2024-01-15 |
| 222 | +tags: [auth, oauth] |
| 223 | +--- |
| 224 | + |
| 225 | +# Add Google OAuth |
| 226 | + |
| 227 | +Implement Google OAuth 2.0 login flow for the web app. |
| 228 | + |
| 229 | +## Summary |
| 230 | + |
| 231 | +Added OAuth with passport.js. Tokens stored in Redis with 1h expiry. |
| 232 | +Implemented refresh token rotation. |
| 233 | + |
| 234 | +## Key Files |
| 235 | + |
| 236 | +- src/auth/oauth.ts |
| 237 | +- src/auth/strategies/google.ts |
| 238 | +- src/middleware/session.ts |
| 239 | + |
| 240 | +## Related Tasks |
| 241 | + |
| 242 | +- #38: Add session management |
| 243 | +- #45: Add OAuth scopes |
| 244 | +``` |
| 245 | + |
| 246 | +## Development |
| 247 | + |
| 248 | +### Building |
| 249 | + |
| 250 | +```bash |
| 251 | +cd extensions/ty-qmd |
| 252 | +go build -o ty-qmd ./cmd |
| 253 | +``` |
| 254 | + |
| 255 | +### Testing |
| 256 | + |
| 257 | +```bash |
| 258 | +go test ./... |
| 259 | +``` |
| 260 | + |
| 261 | +## Future Ideas |
| 262 | + |
| 263 | +- **Automatic tagging** - Use QMD's LLM to auto-tag tasks |
| 264 | +- **Related task suggestions** - Show similar past tasks when creating new ones |
| 265 | +- **Knowledge graph** - Build task relationship graph from semantic similarity |
| 266 | +- **Cross-project search** - Search across all indexed projects |
| 267 | +- **Embedding visualization** - Visualize task clusters in embedding space |
0 commit comments