k0ntext 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +623 -0
  3. package/bin/k0ntext.js +12 -0
  4. package/dist/agents/cleanup-agent.d.ts +39 -0
  5. package/dist/agents/cleanup-agent.d.ts.map +1 -0
  6. package/dist/agents/cleanup-agent.js +56 -0
  7. package/dist/agents/cleanup-agent.js.map +1 -0
  8. package/dist/agents/performance-agent.d.ts +37 -0
  9. package/dist/agents/performance-agent.d.ts.map +1 -0
  10. package/dist/agents/performance-agent.js +91 -0
  11. package/dist/agents/performance-agent.js.map +1 -0
  12. package/dist/analyzer/index.d.ts +5 -0
  13. package/dist/analyzer/index.d.ts.map +1 -0
  14. package/dist/analyzer/index.js +5 -0
  15. package/dist/analyzer/index.js.map +1 -0
  16. package/dist/analyzer/intelligent-analyzer.d.ts +111 -0
  17. package/dist/analyzer/intelligent-analyzer.d.ts.map +1 -0
  18. package/dist/analyzer/intelligent-analyzer.js +537 -0
  19. package/dist/analyzer/intelligent-analyzer.js.map +1 -0
  20. package/dist/cli/commands/cleanup.d.ts +3 -0
  21. package/dist/cli/commands/cleanup.d.ts.map +1 -0
  22. package/dist/cli/commands/cleanup.js +24 -0
  23. package/dist/cli/commands/cleanup.js.map +1 -0
  24. package/dist/cli/commands/export.d.ts +9 -0
  25. package/dist/cli/commands/export.d.ts.map +1 -0
  26. package/dist/cli/commands/export.js +72 -0
  27. package/dist/cli/commands/export.js.map +1 -0
  28. package/dist/cli/commands/import.d.ts +9 -0
  29. package/dist/cli/commands/import.d.ts.map +1 -0
  30. package/dist/cli/commands/import.js +62 -0
  31. package/dist/cli/commands/import.js.map +1 -0
  32. package/dist/cli/commands/performance.d.ts +9 -0
  33. package/dist/cli/commands/performance.d.ts.map +1 -0
  34. package/dist/cli/commands/performance.js +36 -0
  35. package/dist/cli/commands/performance.js.map +1 -0
  36. package/dist/cli/commands/validate.d.ts +9 -0
  37. package/dist/cli/commands/validate.d.ts.map +1 -0
  38. package/dist/cli/commands/validate.js +82 -0
  39. package/dist/cli/commands/validate.js.map +1 -0
  40. package/dist/cli/commands/watch.d.ts +9 -0
  41. package/dist/cli/commands/watch.d.ts.map +1 -0
  42. package/dist/cli/commands/watch.js +72 -0
  43. package/dist/cli/commands/watch.js.map +1 -0
  44. package/dist/cli/generate.d.ts +3 -0
  45. package/dist/cli/generate.d.ts.map +1 -0
  46. package/dist/cli/generate.js +194 -0
  47. package/dist/cli/generate.js.map +1 -0
  48. package/dist/cli/index.d.ts +9 -0
  49. package/dist/cli/index.d.ts.map +1 -0
  50. package/dist/cli/index.js +448 -0
  51. package/dist/cli/index.js.map +1 -0
  52. package/dist/cli/sync.d.ts +26 -0
  53. package/dist/cli/sync.d.ts.map +1 -0
  54. package/dist/cli/sync.js +163 -0
  55. package/dist/cli/sync.js.map +1 -0
  56. package/dist/config/cleanup-config.d.ts +26 -0
  57. package/dist/config/cleanup-config.d.ts.map +1 -0
  58. package/dist/config/cleanup-config.js +21 -0
  59. package/dist/config/cleanup-config.js.map +1 -0
  60. package/dist/db/client.d.ts +284 -0
  61. package/dist/db/client.d.ts.map +1 -0
  62. package/dist/db/client.js +688 -0
  63. package/dist/db/client.js.map +1 -0
  64. package/dist/db/index.d.ts +6 -0
  65. package/dist/db/index.d.ts.map +1 -0
  66. package/dist/db/index.js +6 -0
  67. package/dist/db/index.js.map +1 -0
  68. package/dist/db/schema.d.ts +41 -0
  69. package/dist/db/schema.d.ts.map +1 -0
  70. package/dist/db/schema.js +226 -0
  71. package/dist/db/schema.js.map +1 -0
  72. package/dist/embeddings/index.d.ts +5 -0
  73. package/dist/embeddings/index.d.ts.map +1 -0
  74. package/dist/embeddings/index.js +5 -0
  75. package/dist/embeddings/index.js.map +1 -0
  76. package/dist/embeddings/openrouter.d.ts +133 -0
  77. package/dist/embeddings/openrouter.d.ts.map +1 -0
  78. package/dist/embeddings/openrouter.js +455 -0
  79. package/dist/embeddings/openrouter.js.map +1 -0
  80. package/dist/index.d.ts +14 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +18 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/mcp.d.ts +29 -0
  85. package/dist/mcp.d.ts.map +1 -0
  86. package/dist/mcp.js +257 -0
  87. package/dist/mcp.js.map +1 -0
  88. package/docs/ARCHIVE/MIGRATE_TO_NEW_REPO.md +222 -0
  89. package/docs/ARCHIVE/MIGRATE_TO_UNIFIED.md +220 -0
  90. package/docs/CLEANUP.md +76 -0
  91. package/docs/MCP_QUICKSTART.md +219 -0
  92. package/docs/QUICKSTART.md +119 -0
  93. package/docs/TROUBLESHOOTING.md +611 -0
  94. package/package.json +100 -0
  95. package/skills/context-optimize/SKILL.md +86 -0
  96. package/skills/implement/SKILL.md +150 -0
  97. package/skills/plan/SKILL.md +143 -0
  98. package/skills/research/SKILL.md +103 -0
  99. package/skills/validate/SKILL.md +62 -0
  100. package/skills/verify-docs/SKILL.md +77 -0
  101. package/src/agents/cleanup-agent.ts +96 -0
  102. package/src/agents/performance-agent.ts +117 -0
  103. package/src/analyzer/index.ts +10 -0
  104. package/src/analyzer/intelligent-analyzer.ts +640 -0
  105. package/src/cli/commands/cleanup.ts +26 -0
  106. package/src/cli/commands/export.ts +82 -0
  107. package/src/cli/commands/import.ts +73 -0
  108. package/src/cli/commands/performance.ts +40 -0
  109. package/src/cli/commands/validate.ts +98 -0
  110. package/src/cli/commands/watch.ts +83 -0
  111. package/src/cli/generate.ts +219 -0
  112. package/src/cli/index.ts +510 -0
  113. package/src/cli/sync.ts +194 -0
  114. package/src/config/cleanup-config.ts +42 -0
  115. package/src/db/client.ts +949 -0
  116. package/src/db/index.ts +19 -0
  117. package/src/db/schema.ts +241 -0
  118. package/src/embeddings/index.ts +11 -0
  119. package/src/embeddings/openrouter.ts +592 -0
  120. package/src/index.ts +57 -0
  121. package/src/mcp.ts +354 -0
  122. package/templates/AI_CONTEXT.md.template +245 -0
  123. package/templates/base/README.md +260 -0
  124. package/templates/base/RPI_WORKFLOW_PLAN.md +325 -0
  125. package/templates/base/agents/api-developer.md +76 -0
  126. package/templates/base/agents/context-engineer.md +525 -0
  127. package/templates/base/agents/core-architect.md +76 -0
  128. package/templates/base/agents/database-ops.md +76 -0
  129. package/templates/base/agents/deployment-ops.md +76 -0
  130. package/templates/base/agents/integration-hub.md +76 -0
  131. package/templates/base/analytics/README.md +114 -0
  132. package/templates/base/automation/config.json +58 -0
  133. package/templates/base/automation/generators/code-mapper.js +308 -0
  134. package/templates/base/automation/generators/index-builder.js +321 -0
  135. package/templates/base/automation/hooks/post-commit.sh +83 -0
  136. package/templates/base/automation/hooks/pre-commit.sh +103 -0
  137. package/templates/base/ci-templates/README.md +108 -0
  138. package/templates/base/ci-templates/github-actions/context-check.yml +144 -0
  139. package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -0
  140. package/templates/base/commands/analytics.md +238 -0
  141. package/templates/base/commands/auto-sync.md +172 -0
  142. package/templates/base/commands/collab.md +194 -0
  143. package/templates/base/commands/context-optimize.md +226 -0
  144. package/templates/base/commands/help.md +485 -0
  145. package/templates/base/commands/rpi-implement.md +164 -0
  146. package/templates/base/commands/rpi-plan.md +147 -0
  147. package/templates/base/commands/rpi-research.md +145 -0
  148. package/templates/base/commands/session-resume.md +144 -0
  149. package/templates/base/commands/session-save.md +112 -0
  150. package/templates/base/commands/validate-all.md +77 -0
  151. package/templates/base/commands/verify-docs-current.md +86 -0
  152. package/templates/base/config/base.json +57 -0
  153. package/templates/base/config/environments/development.json +13 -0
  154. package/templates/base/config/environments/production.json +17 -0
  155. package/templates/base/config/environments/staging.json +13 -0
  156. package/templates/base/config/local.json.example +21 -0
  157. package/templates/base/context/.meta/generated-at.json +18 -0
  158. package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -0
  159. package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -0
  160. package/templates/base/context/FILE_OWNERSHIP.md +57 -0
  161. package/templates/base/context/INTEGRATION_POINTS.md +92 -0
  162. package/templates/base/context/KNOWN_GOTCHAS.md +195 -0
  163. package/templates/base/context/TESTING_MAP.md +95 -0
  164. package/templates/base/context/WORKFLOW_INDEX.md +129 -0
  165. package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -0
  166. package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -0
  167. package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -0
  168. package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -0
  169. package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -0
  170. package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -0
  171. package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -0
  172. package/templates/base/knowledge/README.md +98 -0
  173. package/templates/base/knowledge/sessions/README.md +88 -0
  174. package/templates/base/knowledge/sessions/TEMPLATE.md +150 -0
  175. package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -0
  176. package/templates/base/knowledge/shared/decisions/README.md +49 -0
  177. package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -0
  178. package/templates/base/knowledge/shared/patterns/README.md +62 -0
  179. package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -0
  180. package/templates/base/plans/PLAN_TEMPLATE.md +316 -0
  181. package/templates/base/plans/active/.gitkeep +0 -0
  182. package/templates/base/plans/completed/.gitkeep +0 -0
  183. package/templates/base/research/RESEARCH_TEMPLATE.md +245 -0
  184. package/templates/base/research/active/.gitkeep +0 -0
  185. package/templates/base/research/completed/.gitkeep +0 -0
  186. package/templates/base/schemas/agent.schema.json +141 -0
  187. package/templates/base/schemas/anchors.schema.json +54 -0
  188. package/templates/base/schemas/automation.schema.json +93 -0
  189. package/templates/base/schemas/command.schema.json +134 -0
  190. package/templates/base/schemas/hashes.schema.json +40 -0
  191. package/templates/base/schemas/manifest.schema.json +117 -0
  192. package/templates/base/schemas/plan.schema.json +136 -0
  193. package/templates/base/schemas/research.schema.json +115 -0
  194. package/templates/base/schemas/roles.schema.json +34 -0
  195. package/templates/base/schemas/session.schema.json +77 -0
  196. package/templates/base/schemas/settings.schema.json +244 -0
  197. package/templates/base/schemas/staleness.schema.json +53 -0
  198. package/templates/base/schemas/team-config.schema.json +42 -0
  199. package/templates/base/schemas/workflow.schema.json +126 -0
  200. package/templates/base/session/checkpoints/.gitkeep +2 -0
  201. package/templates/base/session/current/state.json +20 -0
  202. package/templates/base/session/history/.gitkeep +2 -0
  203. package/templates/base/settings.json +3 -0
  204. package/templates/base/standards/COMPATIBILITY.md +219 -0
  205. package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -0
  206. package/templates/base/standards/QUALITY_CHECKLIST.md +211 -0
  207. package/templates/base/standards/README.md +66 -0
  208. package/templates/base/sync/anchors.json +6 -0
  209. package/templates/base/sync/hashes.json +6 -0
  210. package/templates/base/sync/staleness.json +10 -0
  211. package/templates/base/team/README.md +168 -0
  212. package/templates/base/team/config.json +79 -0
  213. package/templates/base/team/roles.json +145 -0
  214. package/templates/base/tools/bin/claude-context.js +151 -0
  215. package/templates/base/tools/lib/anchor-resolver.js +276 -0
  216. package/templates/base/tools/lib/config-loader.js +363 -0
  217. package/templates/base/tools/lib/detector.js +350 -0
  218. package/templates/base/tools/lib/diagnose.js +206 -0
  219. package/templates/base/tools/lib/drift-detector.js +373 -0
  220. package/templates/base/tools/lib/errors.js +199 -0
  221. package/templates/base/tools/lib/index.js +36 -0
  222. package/templates/base/tools/lib/init.js +192 -0
  223. package/templates/base/tools/lib/logger.js +230 -0
  224. package/templates/base/tools/lib/placeholder.js +201 -0
  225. package/templates/base/tools/lib/session-manager.js +354 -0
  226. package/templates/base/tools/lib/validate.js +521 -0
  227. package/templates/base/tools/package.json +49 -0
  228. package/templates/handlebars/aider-config.hbs +146 -0
  229. package/templates/handlebars/antigravity.hbs +377 -0
  230. package/templates/handlebars/claude.hbs +183 -0
  231. package/templates/handlebars/cline.hbs +62 -0
  232. package/templates/handlebars/continue-config.hbs +116 -0
  233. package/templates/handlebars/copilot.hbs +130 -0
  234. package/templates/handlebars/partials/gotcha-list.hbs +11 -0
  235. package/templates/handlebars/partials/header.hbs +3 -0
  236. package/templates/handlebars/partials/workflow-summary.hbs +16 -0
  237. package/templates/handlebars/windsurf-rules.hbs +69 -0
  238. package/templates/hooks/post-commit.hbs +28 -0
  239. package/templates/hooks/pre-commit.hbs +46 -0
@@ -0,0 +1,611 @@
1
+ # Troubleshooting Guide
2
+
3
+ Common issues and solutions for Claude Context Engineering.
4
+
5
+ ---
6
+
7
+ ## Quick Diagnosis
8
+
9
+ Run diagnostics to automatically detect issues:
10
+
11
+ ```bash
12
+ # Using the unified package
13
+ k0ntext stats
14
+
15
+ # Or using the legacy tools (deprecated)
16
+ npx .k0ntext/tools/bin/claude-context.js diagnose
17
+ ```
18
+
19
+ To attempt auto-fix:
20
+
21
+ ```bash
22
+ npx .k0ntext/tools/bin/claude-context.js diagnose --fix
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Issue Categories
28
+
29
+ 1. [Installation Issues](#installation-issues)
30
+ 2. [Initialization Failures](#initialization-failures)
31
+ 3. [Context Budget Problems](#context-budget-problems)
32
+ 4. [Validation Errors](#validation-errors)
33
+ 5. [Agent/Command Issues](#agentcommand-issues)
34
+ 6. [Performance Issues](#performance-issues)
35
+ 7. [MCP Server Issues](#mcp-server-issues)
36
+
37
+ ---
38
+
39
+ ## Installation Issues
40
+
41
+ ### TSG-001: CLI Tools Won't Install
42
+
43
+ **Symptoms:**
44
+ - `npm install` fails in `.k0ntext/tools/`
45
+ - Missing dependencies errors
46
+
47
+ **Diagnosis:**
48
+ ```bash
49
+ node --version # Should be 16+
50
+ npm --version # Should be 8+
51
+ ```
52
+
53
+ **Solutions:**
54
+
55
+ **A. Update Node.js**
56
+ ```bash
57
+ # Using nvm (recommended)
58
+ nvm install 18
59
+ nvm use 18
60
+ ```
61
+
62
+ **B. Clear npm cache**
63
+ ```bash
64
+ npm cache clean --force
65
+ cd .k0ntext/tools && rm -rf node_modules && npm install
66
+ ```
67
+
68
+ **C. Use yarn instead**
69
+ ```bash
70
+ cd .k0ntext/tools && yarn install
71
+ ```
72
+
73
+ ---
74
+
75
+ ### TSG-002: Template Files Not Found
76
+
77
+ **Symptoms:**
78
+ - "AI_CONTEXT.md not found" errors
79
+ - Missing `.k0ntext/` directory
80
+
81
+ **Solutions:**
82
+
83
+ **A. Verify copy was complete**
84
+ ```bash
85
+ ls -la .k0ntext/
86
+ # Should contain: agents/, commands/, context/, indexes/, settings.json, README.md
87
+ ```
88
+
89
+ **B. Re-copy from template**
90
+ ```bash
91
+ cp -r /path/to/template/.claude ./.claude
92
+ cp /path/to/template/AI_CONTEXT.md ./AI_CONTEXT.md
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Initialization Failures
98
+
99
+ ### TSG-010: Tech Stack Not Detected
100
+
101
+ **Symptoms:**
102
+ - "Could not detect technology stack"
103
+ - Generic placeholders remain after initialization
104
+
105
+ **Diagnosis:**
106
+ ```bash
107
+ # Check for expected files
108
+ ls package.json requirements.txt go.mod Cargo.toml pyproject.toml
109
+ ```
110
+
111
+ **Solutions:**
112
+
113
+ **A. Provide explicit hint**
114
+ ```bash
115
+ @context-engineer "Initialize for Python FastAPI with PostgreSQL"
116
+ ```
117
+
118
+ **B. Create detection files**
119
+ If your project is non-standard, create a minimal detection file:
120
+ ```bash
121
+ # For Python
122
+ echo "# Auto-generated for detection" > requirements.txt
123
+
124
+ # For Node
125
+ echo '{"name":"my-project"}' > package.json
126
+ ```
127
+
128
+ **C. Manual initialization**
129
+ Edit `AI_CONTEXT.md` directly and replace `{{PLACEHOLDER}}` values manually.
130
+
131
+ ---
132
+
133
+ ### TSG-011: Too Many Workflows Discovered (>15)
134
+
135
+ **Symptoms:**
136
+ - Agent discovers 20+ workflows
137
+ - Documentation becomes unwieldy
138
+
139
+ **Solutions:**
140
+
141
+ **A. Let agent merge automatically**
142
+ The agent should merge related workflows. If not:
143
+ ```bash
144
+ @context-engineer "Merge workflows: auth-login and auth-register into authentication"
145
+ ```
146
+
147
+ **B. Focus on critical paths**
148
+ ```bash
149
+ @context-engineer "Initialize focusing only on critical user paths"
150
+ ```
151
+
152
+ ---
153
+
154
+ ### TSG-012: Too Few Workflows Discovered (<8)
155
+
156
+ **Symptoms:**
157
+ - Agent only finds 2-3 workflows
158
+ - Major functionality not documented
159
+
160
+ **Solutions:**
161
+
162
+ **A. Provide hints about areas to explore**
163
+ ```bash
164
+ @context-engineer "Initialize and explore: user auth, payments, notifications, admin panel"
165
+ ```
166
+
167
+ **B. Add workflows manually**
168
+ ```bash
169
+ @context-engineer "Document workflow: [workflow-name]"
170
+ ```
171
+
172
+ ---
173
+
174
+ ### TSG-013: Initialization Interrupted
175
+
176
+ **Symptoms:**
177
+ - `INIT_PROGRESS.json` exists
178
+ - Partial documentation
179
+
180
+ **Solutions:**
181
+
182
+ **A. Resume initialization**
183
+ ```bash
184
+ npx .k0ntext/tools/bin/claude-context.js init --resume
185
+ # Or in Claude Code:
186
+ @context-engineer "Resume initialization"
187
+ ```
188
+
189
+ **B. Start fresh**
190
+ ```bash
191
+ rm .k0ntext/INIT_PROGRESS.json
192
+ @context-engineer "Initialize context engineering for this repository"
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Context Budget Problems
198
+
199
+ ### TSG-020: Context Budget Exceeded
200
+
201
+ **Symptoms:**
202
+ - Claude responses truncated
203
+ - "Context limit" warnings
204
+ - Degraded response quality
205
+
206
+ **Diagnosis:**
207
+ Check current utilization by reviewing loaded content.
208
+
209
+ **Solutions:**
210
+
211
+ **A. Use progressive loading**
212
+ 1. Load category index first (~5k tokens)
213
+ 2. Load only relevant domain index (~15k tokens)
214
+ 3. Load specific workflow only when needed
215
+
216
+ **B. Compact current context**
217
+ Ask Claude to summarize and archive current findings:
218
+ ```
219
+ Summarize findings so far and archive. I need to load fresh context.
220
+ ```
221
+
222
+ **C. Start fresh session**
223
+ For complex tasks, create a handoff document and start new session:
224
+ ```bash
225
+ /collab handoff
226
+ ```
227
+
228
+ ---
229
+
230
+ ### TSG-021: High Token Usage for Simple Tasks
231
+
232
+ **Symptoms:**
233
+ - 60%+ context utilization for basic tasks
234
+ - Loading unnecessary documentation
235
+
236
+ **Solutions:**
237
+
238
+ **A. Follow the 3-level chain**
239
+ Don't load detail files unless needed:
240
+ ```
241
+ Level 1: CATEGORY_INDEX.md (~5k)
242
+ Level 2: domain index (~15k)
243
+ Level 3: workflow detail (~40k) - only if implementing
244
+ ```
245
+
246
+ **B. Use targeted searches**
247
+ Instead of loading entire workflow:
248
+ ```
249
+ Search for the specific function: [function name] in [file pattern]
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Validation Errors
255
+
256
+ ### TSG-030: Schema Validation Failed
257
+
258
+ **Symptoms:**
259
+ - `settings.json` validation errors
260
+ - Invalid configuration
261
+
262
+ **Diagnosis:**
263
+ ```bash
264
+ npx .k0ntext/tools/bin/claude-context.js validate --schema
265
+ ```
266
+
267
+ **Solutions:**
268
+
269
+ **A. Auto-fix with defaults**
270
+ ```bash
271
+ npx .k0ntext/tools/bin/claude-context.js diagnose --fix
272
+ ```
273
+
274
+ **B. Manual fix**
275
+ Compare your `settings.json` with the schema in `.k0ntext/schemas/settings.schema.json`.
276
+
277
+ ---
278
+
279
+ ### TSG-031: Broken Markdown Links
280
+
281
+ **Symptoms:**
282
+ - Links to files that don't exist
283
+ - 404 in documentation navigation
284
+
285
+ **Diagnosis:**
286
+ ```bash
287
+ npx .k0ntext/tools/bin/claude-context.js validate --links
288
+ ```
289
+
290
+ **Solutions:**
291
+
292
+ **A. Update links after file moves**
293
+ After refactoring, update documentation:
294
+ ```bash
295
+ # Find all references to old path
296
+ grep -r "old/path" .k0ntext/
297
+ # Update to new path
298
+ ```
299
+
300
+ **B. Regenerate affected workflows**
301
+ ```bash
302
+ @context-engineer "Refresh workflow: [workflow-name]"
303
+ ```
304
+
305
+ ---
306
+
307
+ ### TSG-032: Line Numbers Outdated
308
+
309
+ **Symptoms:**
310
+ - `file:line` references point to wrong code
311
+ - Accuracy below 60% threshold
312
+
313
+ **Diagnosis:**
314
+ ```bash
315
+ npx .k0ntext/tools/bin/claude-context.js validate --lines --threshold 60
316
+ ```
317
+
318
+ **Solutions:**
319
+
320
+ **A. Run verification for modified files**
321
+ ```bash
322
+ /verify-docs-current path/to/modified/file.py
323
+ ```
324
+
325
+ **B. Refresh all workflows**
326
+ ```bash
327
+ @context-engineer "Audit and refresh all workflow documentation"
328
+ ```
329
+
330
+ **C. Accept drift within tolerance**
331
+ Line numbers within ±10 lines are acceptable. Focus on function names as anchors.
332
+
333
+ ---
334
+
335
+ ### TSG-033: Remaining Placeholders
336
+
337
+ **Symptoms:**
338
+ - `{{PLACEHOLDER}}` text visible in AI_CONTEXT.md
339
+ - Incomplete initialization
340
+
341
+ **Diagnosis:**
342
+ ```bash
343
+ npx .k0ntext/tools/bin/claude-context.js validate --placeholders
344
+ ```
345
+
346
+ **Solutions:**
347
+
348
+ **A. Complete initialization**
349
+ ```bash
350
+ @context-engineer "Complete placeholder replacement"
351
+ ```
352
+
353
+ **B. Manual replacement**
354
+ Search and replace remaining placeholders in AI_CONTEXT.md with actual values.
355
+
356
+ ---
357
+
358
+ ## Agent/Command Issues
359
+
360
+ ### TSG-040: Agent Not Found
361
+
362
+ **Symptoms:**
363
+ - "@agent-name" doesn't work
364
+ - "Agent not recognized" errors
365
+
366
+ **Solutions:**
367
+
368
+ **A. Check agent exists**
369
+ ```bash
370
+ ls .k0ntext/agents/
371
+ ```
372
+
373
+ **B. Use correct invocation**
374
+ ```bash
375
+ # Correct
376
+ @context-engineer "task description"
377
+
378
+ # Not
379
+ /context-engineer "task description"
380
+ ```
381
+
382
+ ---
383
+
384
+ ### TSG-041: Command Not Found
385
+
386
+ **Symptoms:**
387
+ - "/rpi-research" doesn't work
388
+ - Command not recognized
389
+
390
+ **Solutions:**
391
+
392
+ **A. Check command exists**
393
+ ```bash
394
+ ls .k0ntext/commands/
395
+ ```
396
+
397
+ **B. Verify command is registered**
398
+ Check `settings.json` includes the command:
399
+ ```json
400
+ "commands": {
401
+ "rpi_commands": ["/rpi-research", "/rpi-plan", "/rpi-implement"],
402
+ "validation_commands": ["/context-optimize"]
403
+ }
404
+ ```
405
+
406
+ ---
407
+
408
+ ## Performance Issues
409
+
410
+ ### TSG-050: Slow Initialization
411
+
412
+ **Symptoms:**
413
+ - Initialization takes 30+ minutes
414
+ - Agent seems stuck
415
+
416
+ **Solutions:**
417
+
418
+ **A. For large codebases (>100k LOC)**
419
+ ```bash
420
+ @context-engineer "Initialize focusing on src/ directory only"
421
+ ```
422
+
423
+ **B. Increase timeout**
424
+ Edit `settings.json`:
425
+ ```json
426
+ "rpi_workflow": {
427
+ "research_timeout_minutes": 60
428
+ }
429
+ ```
430
+
431
+ ---
432
+
433
+ ### TSG-051: Slow Validation
434
+
435
+ **Symptoms:**
436
+ - Validation takes several minutes
437
+ - Especially on large documentation sets
438
+
439
+ **Solutions:**
440
+
441
+ **A. Validate specific checks only**
442
+ ```bash
443
+ # Just schema
444
+ npx .k0ntext/tools/bin/claude-context.js validate --schema
445
+
446
+ # Just structure
447
+ npx .k0ntext/tools/bin/claude-context.js validate --structure
448
+ ```
449
+
450
+ **B. Skip external link checking**
451
+ Ensure this is disabled (default):
452
+ ```json
453
+ "validation": {
454
+ "link_check_external": false
455
+ }
456
+ ```
457
+
458
+ ---
459
+
460
+ ## MCP Server Issues
461
+
462
+ ### TSG-060: MCP Server Won't Start
463
+
464
+ **Symptoms:**
465
+ - `mcp:start` exits immediately
466
+ - "Database not found" or "Missing OPENROUTER_API_KEY"
467
+
468
+ **Diagnosis:**
469
+ ```bash
470
+ npx k0ntext mcp:status
471
+ ```
472
+
473
+ **Solutions:**
474
+
475
+ **A. Initialize the database first**
476
+ ```bash
477
+ npx k0ntext mcp:init
478
+ ```
479
+
480
+ **B. Set the OpenRouter API key**
481
+ ```bash
482
+ export OPENROUTER_API_KEY="your-api-key-here"
483
+ ```
484
+
485
+ **C. Start the server again**
486
+ ```bash
487
+ npx k0ntext mcp:start
488
+ ```
489
+
490
+ ---
491
+
492
+ ### TSG-061: MCP Sync Exports Missing
493
+
494
+ **Symptoms:**
495
+ - `mcp:sync` finishes without generating files
496
+ - Output files remain unchanged
497
+
498
+ **Diagnosis:**
499
+ ```bash
500
+ npx k0ntext mcp:sync --status
501
+ ```
502
+
503
+ **Solutions:**
504
+
505
+ **A. Force overwrite managed files**
506
+ ```bash
507
+ npx k0ntext mcp:sync --force
508
+ ```
509
+
510
+ **B. Recreate database index**
511
+ ```bash
512
+ rm -f .k0ntext.db
513
+ npx k0ntext mcp:init
514
+ ```
515
+
516
+ **C. Ensure database exists**
517
+ ```bash
518
+ ls -la .k0ntext.db
519
+ ```
520
+
521
+ ---
522
+
523
+ ## New Error Codes (v3.0.0)
524
+
525
+ ### TSG-062: Generate Command Failed
526
+
527
+ **Error:** `Failed to generate context files`
528
+
529
+ **Diagnosis:**
530
+ 1. Check if database is initialized: `k0ntext stats`
531
+ 2. Verify OpenRouter API key is set
532
+ 3. Check file permissions for output directory
533
+
534
+ **Solution:**
535
+ ```bash
536
+ # Re-initialize database
537
+ k0ntext init
538
+ k0ntext index
539
+
540
+ # Retry generation
541
+ k0ntext generate
542
+ ```
543
+
544
+ ---
545
+
546
+ ### TSG-063: Sync Command Failed
547
+
548
+ **Error:** `Synchronization failed`
549
+
550
+ **Diagnosis:**
551
+ 1. Check sync status: `k0ntext sync --check`
552
+ 2. Verify tool configurations exist
553
+ 3. Check for conflicts
554
+
555
+ **Solution:**
556
+ ```bash
557
+ # Check status
558
+ k0ntext sync --check
559
+
560
+ # Force sync if needed
561
+ k0ntext sync --force
562
+
563
+ # Sync from specific tool
564
+ k0ntext sync --from claude
565
+ ```
566
+
567
+ ---
568
+
569
+ ### TSG-064: MCP Server Not Starting
570
+
571
+ **Error:** `MCP server failed to start`
572
+
573
+ **Diagnosis:**
574
+ 1. Verify build: `cd packages/ai-context && npm run build`
575
+ 2. Check port availability
576
+ 3. Verify OpenRouter API key
577
+
578
+ **Solution:**
579
+ ```bash
580
+ # Rebuild
581
+ cd packages/ai-context
582
+ npm run build
583
+
584
+ # Test MCP server
585
+ npm run start:mcp
586
+ ```
587
+
588
+ ---
589
+
590
+ ## Getting Help
591
+
592
+ If your issue isn't listed:
593
+
594
+ 1. **Run full diagnostics:**
595
+ ```bash
596
+ npx .k0ntext/tools/bin/claude-context.js diagnose --verbose
597
+ ```
598
+
599
+ 2. **Check logs:**
600
+ ```bash
601
+ cat .k0ntext/logs/claude.log
602
+ ```
603
+
604
+ 3. **Report an issue:**
605
+ https://github.com/SireJeff/k0ntext/issues
606
+
607
+ Include:
608
+ - Error message
609
+ - Diagnostic output
610
+ - Tech stack
611
+ - Steps to reproduce
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "k0ntext",
3
+ "version": "3.0.0",
4
+ "description": "Unified AI Context Engineering - Intelligent context for Claude, Copilot, Cline, and more with OpenRouter-powered initialization",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "k0ntext": "./bin/k0ntext.js"
9
+ },
10
+ "type": "module",
11
+ "files": [
12
+ "bin/",
13
+ "dist/",
14
+ "src/",
15
+ "templates/",
16
+ "skills/",
17
+ "docs/"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "dev": "tsc --watch",
25
+ "start": "node dist/cli/index.js",
26
+ "start:mcp": "node dist/mcp.js",
27
+ "test": "vitest",
28
+ "test:run": "vitest run",
29
+ "lint": "eslint src/",
30
+ "clean": "rm -rf dist",
31
+ "prepublishOnly": "npm run build && npm test",
32
+ "publish:dry": "npm pack --dry-run",
33
+ "publish:public": "npm publish --access public"
34
+ },
35
+ "keywords": [
36
+ "k0ntext",
37
+ "context-engineering",
38
+ "claude",
39
+ "claude-code",
40
+ "copilot",
41
+ "github-copilot",
42
+ "cline",
43
+ "antigravity",
44
+ "cursor",
45
+ "windsurf",
46
+ "aider",
47
+ "ai",
48
+ "llm",
49
+ "mcp",
50
+ "model-context-protocol",
51
+ "openrouter",
52
+ "embeddings",
53
+ "semantic-search",
54
+ "sqlite",
55
+ "vector-database"
56
+ ],
57
+ "author": "SireJeff",
58
+ "license": "MIT",
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "git+https://github.com/SireJeff/k0ntext.git"
62
+ },
63
+ "bugs": {
64
+ "url": "https://github.com/SireJeff/k0ntext/issues"
65
+ },
66
+ "homepage": "https://github.com/SireJeff/k0ntext#readme",
67
+ "engines": {
68
+ "node": ">=18.0.0"
69
+ },
70
+ "dependencies": {
71
+ "@modelcontextprotocol/sdk": "^1.26.0",
72
+ "ajv": "^8.12.0",
73
+ "ajv-formats": "^2.1.1",
74
+ "better-sqlite3": "^12.6.2",
75
+ "chalk": "^5.3.0",
76
+ "commander": "^11.1.0",
77
+ "glob": "^10.5.0",
78
+ "ora": "^8.0.1",
79
+ "sqlite-vec": "^0.1.3",
80
+ "sqlite-vec-windows-x64": "^0.1.7-alpha.2",
81
+ "zod": "^3.22.4"
82
+ },
83
+ "devDependencies": {
84
+ "@types/better-sqlite3": "^7.6.8",
85
+ "@types/node": "^20.10.0",
86
+ "@typescript-eslint/eslint-plugin": "^6.13.0",
87
+ "@typescript-eslint/parser": "^6.13.0",
88
+ "eslint": "^8.55.0",
89
+ "typescript": "^5.3.0",
90
+ "vitest": "^1.0.0"
91
+ },
92
+ "peerDependencies": {
93
+ "claude-code": ">=1.0.33"
94
+ },
95
+ "peerDependenciesMeta": {
96
+ "claude-code": {
97
+ "optional": true
98
+ }
99
+ }
100
+ }