dev-mcp-server 0.0.3 โ†’ 1.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 (58) hide show
  1. package/.env.example +23 -55
  2. package/README.md +609 -219
  3. package/cli.js +486 -160
  4. package/package.json +2 -2
  5. package/src/agents/BaseAgent.js +113 -0
  6. package/src/agents/dreamer.js +165 -0
  7. package/src/agents/improver.js +175 -0
  8. package/src/agents/specialists.js +202 -0
  9. package/src/agents/taskDecomposer.js +176 -0
  10. package/src/agents/teamCoordinator.js +153 -0
  11. package/src/api/routes/agents.js +172 -0
  12. package/src/api/routes/extras.js +115 -0
  13. package/src/api/routes/git.js +72 -0
  14. package/src/api/routes/ingest.js +60 -40
  15. package/src/api/routes/knowledge.js +59 -41
  16. package/src/api/routes/memory.js +41 -0
  17. package/src/api/routes/newRoutes.js +168 -0
  18. package/src/api/routes/pipelines.js +41 -0
  19. package/src/api/routes/planner.js +54 -0
  20. package/src/api/routes/query.js +24 -0
  21. package/src/api/routes/sessions.js +54 -0
  22. package/src/api/routes/tasks.js +67 -0
  23. package/src/api/routes/tools.js +85 -0
  24. package/src/api/routes/v5routes.js +196 -0
  25. package/src/api/server.js +134 -6
  26. package/src/context/compactor.js +151 -0
  27. package/src/context/contextEngineer.js +181 -0
  28. package/src/context/contextVisualizer.js +140 -0
  29. package/src/core/conversationEngine.js +231 -0
  30. package/src/core/indexer.js +169 -143
  31. package/src/core/ingester.js +141 -126
  32. package/src/core/queryEngine.js +286 -236
  33. package/src/cron/cronScheduler.js +260 -0
  34. package/src/dashboard/index.html +1181 -0
  35. package/src/lsp/symbolNavigator.js +220 -0
  36. package/src/memory/memoryManager.js +186 -0
  37. package/src/memory/teamMemory.js +111 -0
  38. package/src/messaging/messageBus.js +177 -0
  39. package/src/monitor/proactiveMonitor.js +337 -0
  40. package/src/pipelines/pipelineEngine.js +230 -0
  41. package/src/planner/plannerEngine.js +202 -0
  42. package/src/plugins/builtin/stats-plugin.js +29 -0
  43. package/src/plugins/pluginManager.js +144 -0
  44. package/src/prompts/promptEngineer.js +289 -0
  45. package/src/sessions/sessionManager.js +166 -0
  46. package/src/skills/skillsManager.js +263 -0
  47. package/src/storage/store.js +127 -105
  48. package/src/tasks/taskManager.js +151 -0
  49. package/src/tools/BashTool.js +154 -0
  50. package/src/tools/FileEditTool.js +280 -0
  51. package/src/tools/GitTool.js +212 -0
  52. package/src/tools/GrepTool.js +199 -0
  53. package/src/tools/registry.js +1380 -0
  54. package/src/utils/costTracker.js +69 -0
  55. package/src/utils/fileParser.js +176 -153
  56. package/src/utils/llmClient.js +355 -206
  57. package/src/watcher/fileWatcher.js +137 -0
  58. package/src/worktrees/worktreeManager.js +176 -0
package/README.md CHANGED
@@ -1,333 +1,723 @@
1
- # ๐Ÿง  Dev MCP Server โ€” Model Context Platform
1
+ # ๐Ÿง  Dev MCP Server โ€” Model Context Platform v1.0
2
2
 
3
- > AI that understands **your** codebase, not just the internet.
3
+ > **45 tools ยท 10 specialist agents ยท 10 pre-built teams ยท Dreamer ยท Compactor ยท Prompt Engineering ยท Plugins ยท Cron ยท Worktrees**
4
+ >
5
+ > An AI system that understands your codebase, learns from every interaction, dreams while you sleep, and coordinates teams of specialist agents โ€” all grounded in your *actual* code, not generic knowledge.
4
6
 
5
- Inspired by *"How I Built an MCP Server That Made Developers Faster and Work Easier"* โ€” a full implementation of the **Model Context Platform** concept: instead of generic AI answers, every response is grounded in your actual code, error logs, API behavior, and bug history.
7
+ **Inspired by:**
8
+ - *"How I Built an MCP Server That Made Developers Faster"* โ€” the original RAG-over-codebase concept
9
+ - **Claude Code** โ€” 40+ tools, agent teams, coordinator, dreamer, context engineering, pipelines, plugins, worktrees, cron, prompt engineering
6
10
 
7
11
  ---
8
12
 
9
- ## The Problem It Solves
13
+ ## Why This Exists
10
14
 
11
- Every team has this invisible tax:
15
+ Every dev team pays an invisible tax:
12
16
  - Debugging code you didn't write, with zero context
13
- - Explaining things that are already written *somewhere*
14
- - Digging through 10 files to understand one API
15
- - Answering the same question for the third time this week
17
+ - Junior devs waiting on seniors for answers buried somewhere in the codebase
18
+ - AI that gives generic answers to specific, system-level problems
19
+ - Knowledge that lives in someone's head and dies when they leave
16
20
 
17
- The root cause isn't bad code. It's a **context problem** โ€” knowledge scattered across services, logs, configs, and people's heads.
21
+ **The root cause isn't bad code. It's scattered context.**
18
22
 
19
- ---
20
-
21
- ## What It Does
22
-
23
- Before answering any question, the AI looks up your **actual system**. It knows:
24
-
25
- - Your data models and DTOs
26
- - Your naming conventions and code patterns
27
- - Your most common bugs and how you fixed them
28
- - Your API behaviour โ€” including weird edge cases
29
- - How your modules connect to each other
23
+ Dev MCP Server fixes this by giving your AI permanent, growing knowledge of your actual system โ€” then making it smarter over time, automatically.
30
24
 
31
25
  ---
32
26
 
33
- ## The 3 Core Queries
27
+ ## Architecture
34
28
 
35
- | Query | Endpoint | Example |
36
- | ------------------------------------ | ------------------------ | ---------------------------------------------------- |
37
- | ๐Ÿ› **Why is this failing?** | `POST /api/query/debug` | `"Why is ClassCastException thrown in UserService?"` |
38
- | ๐Ÿ” **Where is this used?** | `POST /api/query/usage` | `"Where is getUserById called?"` |
39
- | ๐Ÿ’ฅ **If I change this, what breaks?** | `POST /api/query/impact` | `"If I change the User model, what breaks?"` |
29
+ ```
30
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
31
+ โ”‚ Dev MCP Server v1.0 โ”‚
32
+ โ”‚ โ”‚
33
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
34
+ โ”‚ โ”‚ INGESTION LAYER โ”‚ โ”‚
35
+ โ”‚ โ”‚ Files/Dirs/Raw โ†’ FileParser โ†’ Chunker โ†’ Store โ†’ TF-IDF Indexer โ”‚ โ”‚
36
+ โ”‚ โ”‚ FileWatcher (live re-ingest on change) โ”‚ โ”‚
37
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
38
+ โ”‚ โ†“ โ”‚
39
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
40
+ โ”‚ โ”‚ CONTEXT ENGINEERING LAYER โ”‚ โ”‚
41
+ โ”‚ โ”‚ ContextEngineer (budget/priority/rank) + Compactor (sliding window) โ”‚ โ”‚
42
+ โ”‚ โ”‚ MemoryManager (persistent facts) + Improver (usage feedback) โ”‚ โ”‚
43
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
44
+ โ”‚ โ†“ โ”‚
45
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
46
+ โ”‚ โ”‚ 45-TOOL REGISTRY โ”‚ โ”‚
47
+ โ”‚ โ”‚ bash ยท file_read/write/edit/delete ยท grep ยท git_* ยท http_request โ”‚ โ”‚
48
+ โ”‚ โ”‚ json_query/transform ยท regex_test ยท crypto_hash ยท datetime โ”‚ โ”‚
49
+ โ”‚ โ”‚ run_tests ยท lint ยท api_test ยท mock_generate ยท code_complexity โ”‚ โ”‚
50
+ โ”‚ โ”‚ docker ยท system_info ยท log_analyze ยท dependency_analysis โ”‚ โ”‚
51
+ โ”‚ โ”‚ generate_diagram ยท kb_search ยท memory_search ยท think ยท + 20 more โ”‚ โ”‚
52
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
53
+ โ”‚ โ†“ โ”‚
54
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
55
+ โ”‚ โ”‚ AGENT LAYER โ”‚ โ”‚
56
+ โ”‚ โ”‚ โ”‚ โ”‚
57
+ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚
58
+ โ”‚ โ”‚ โ”‚ 10 Specialist Agents (real Anthropic tool-use loop) โ”‚ โ”‚ โ”‚
59
+ โ”‚ โ”‚ โ”‚ Debug ยท Arch ยท Security ยท Docs ยท Refactor ยท Perf โ”‚ โ”‚ โ”‚
60
+ โ”‚ โ”‚ โ”‚ Test ยท DevOps ยท Data ยท Planner โ”‚ โ”‚ โ”‚
61
+ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚
62
+ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚
63
+ โ”‚ โ”‚ โ”‚ ORCHESTRATION โ”‚ โ”‚ โ”‚
64
+ โ”‚ โ”‚ โ”‚ TaskDecomposer โ†’ subtasks โ†’ specialist routing โ”‚ โ”‚ โ”‚
65
+ โ”‚ โ”‚ โ”‚ TeamCoordinator โ†’ 10 named teams โ†’ consolidated report โ”‚ โ”‚ โ”‚
66
+ โ”‚ โ”‚ โ”‚ PipelineEngine โ†’ 6 multi-step resilient workflows โ”‚ โ”‚ โ”‚
67
+ โ”‚ โ”‚ โ”‚ Inter-Agent Messaging โ†’ agents send messages to each other โ”‚ โ”‚ โ”‚
68
+ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚
69
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
70
+ โ”‚ โ†“ โ”‚
71
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
72
+ โ”‚ โ”‚ BACKGROUND INTELLIGENCE โ”‚ โ”‚
73
+ โ”‚ โ”‚ Dreamer (5 phases) ยท Improver ยท Cron Scheduler โ”‚ โ”‚
74
+ โ”‚ โ”‚ Proactive Monitor (5 checks) ยท Team Memory Sync โ”‚ โ”‚
75
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
76
+ โ”‚ โ†“ โ”‚
77
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
78
+ โ”‚ โ”‚ REST API โ”‚ โ”‚ CLI (REPL) โ”‚ โ”‚ Dashboard โ”‚ โ”‚ Plugin System โ”‚ โ”‚
79
+ โ”‚ โ”‚ 40+ routes โ”‚ โ”‚ /commands โ”‚ โ”‚ /dashboard โ”‚ โ”‚ user extensions โ”‚ โ”‚
80
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
81
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
82
+ ```
40
83
 
41
84
  ---
42
85
 
43
86
  ## Quick Start
44
87
 
45
- ### Option A โ€” via npx (no install required)
46
-
47
- ```bash
48
- # In your project root (where your .env lives):
49
- npx dev-mcp-server ingest ./src
50
- npx dev-mcp-server query "Why is getUserById throwing?"
51
- npx dev-mcp-server query -i # interactive REPL
52
- ```
53
-
54
- > **Note:** `npx` will look for `.env` in the directory you run the command from,
55
- > so make sure your credentials are there before running.
56
-
57
- ### Option B โ€” local install
58
-
59
88
  ```bash
60
89
  git clone <repo>
61
90
  cd dev-mcp-server
62
91
  npm install
63
- cp .env.example .env
64
- # Edit .env โ€” choose your LLM provider and add credentials
65
- ```
92
+ cp .env.example .env # Add your ANTHROPIC_API_KEY
66
93
 
67
- ```bash
68
94
  # Ingest your codebase
69
95
  node cli.js ingest ./src
70
96
 
71
- # Ask questions
72
- node cli.js query -i # interactive REPL
73
- node cli.js query "Why is getUserById failing?"
74
- node cli.js debug "ClassCastException" --stack "at UserService:45"
75
- node cli.js stats
97
+ # Start interactive REPL (recommended)
98
+ node cli.js query -i
99
+
100
+ # Or start the REST API + Dashboard
101
+ npm start
102
+ open http://localhost:3000/dashboard
76
103
  ```
77
104
 
78
- ### Option C โ€” REST API server
105
+ ---
106
+
107
+ ## The 45-Tool Registry
108
+
109
+ Every tool has an Anthropic-compatible `tool_use` schema. Agents invoke them natively in the real API loop.
110
+
111
+ | Group | Tools |
112
+ | ------------------ | ------------------------------------------------------------------------------------------------------- |
113
+ | **execution** | `bash` |
114
+ | **files** | `file_read`, `file_write`, `file_edit` (str_replace), `file_delete`, `dir_list` |
115
+ | **search** | `grep` (ripgrep + fallback), `find_files` |
116
+ | **git** | `git_status`, `git_diff`, `git_log`, `git_commit` (AI message), `git_branches` |
117
+ | **network** | `http_request`, `network_check` (ping/port/dns) |
118
+ | **data** | `json_query`, `json_transform`, `regex_test`, `crypto_hash`, `datetime`, `schema_validate`, `text_diff` |
119
+ | **config** | `env_read` (masks secrets) |
120
+ | **package** | `npm_info` (list/outdated/audit) |
121
+ | **testing** | `run_tests` (Jest/Mocha), `lint` (ESLint), `api_test` (curl), `mock_generate` |
122
+ | **code-quality** | `format_code` (Prettier), `code_complexity` |
123
+ | **analysis** | `log_analyze`, `dependency_analysis` (circular/unused/vulns) |
124
+ | **docs** | `generate_diagram` (Mermaid), `generate_changelog` (from git) |
125
+ | **infrastructure** | `docker` (ps/logs/exec/inspect) |
126
+ | **system** | `system_info`, `process_info` |
127
+ | **ai** | `token_count`, `think` (CoT scratchpad), `run_skill` |
128
+ | **knowledge** | `kb_search`, `memory_search` |
129
+ | **tasks** | `task_manage` |
130
+ | **navigation** | `symbol_navigate` (definition/references/outline) |
131
+ | **control** | `sleep` |
79
132
 
80
133
  ```bash
81
- npm start
82
- # Runs at http://localhost:3000
134
+ # Execute any tool directly
135
+ curl -X POST http://localhost:3000/api/registry/execute \
136
+ -d '{"tool": "code_complexity", "input": {"path": "./src/services"}}'
137
+
138
+ # List all tools
139
+ curl http://localhost:3000/api/registry
83
140
  ```
84
141
 
85
142
  ---
86
143
 
87
- ## LLM Providers
144
+ ## 10 Specialist Agents
88
145
 
89
- The server supports three backends. Switch between them with a single environment variable โ€” no code changes needed.
146
+ Each agent runs the **real Anthropic tool-use loop** โ€” it can call any of its assigned tools multiple times, chain tool calls, and reason between steps.
90
147
 
91
- ### Anthropic (default)
148
+ | Agent | Tools Available | Specialty |
149
+ | -------------------- | ------------------------------------------------------------------------------------ | -------------------------------- |
150
+ | `DebugAgent` | bash, file_read, grep, kb_search, git_diff, log_analyze, think... | Root cause analysis, exact fixes |
151
+ | `ArchitectureAgent` | file_read, dir_list, grep, generate_diagram, code_complexity, dependency_analysis... | Module coupling, design review |
152
+ | `SecurityAgent` | bash, grep, api_test, env_read, regex_test, log_analyze... | OWASP audit, vuln scanning |
153
+ | `DocumentationAgent` | file_read, kb_search, symbol_navigate, generate_diagram, generate_changelog... | JSDoc, READMEs, API docs |
154
+ | `RefactorAgent` | file_read, file_edit, grep, code_complexity, lint, format_code, text_diff... | Duplication, readability |
155
+ | `PerformanceAgent` | file_read, grep, log_analyze, system_info, run_tests, bash... | N+1 queries, memory leaks |
156
+ | `TestAgent` | file_read, file_write, run_tests, grep, mock_generate, symbol_navigate... | Test writing and coverage |
157
+ | `DevOpsAgent` | bash, docker, system_info, process_info, network_check, env_read... | CI/CD, Docker, infra |
158
+ | `DataAgent` | json_query, json_transform, schema_validate, grep, regex_test, mock_generate... | Schemas, data pipelines |
159
+ | `PlannerAgent` | kb_search, memory_search, task_manage, git_log, generate_diagram, think... | Task breakdown, planning |
92
160
 
93
- ```env
94
- LLM_PROVIDER=anthropic
95
- ANTHROPIC_API_KEY=sk-ant-your-key-here
96
- LLM_MODEL=claude-opus-4-5 # optional, this is the default
161
+ ```bash
162
+ # Run any agent
163
+ curl -X POST http://localhost:3000/api/agents/SecurityAgent \
164
+ -d '{"task": "Audit the auth module for vulnerabilities"}'
165
+
166
+ # Decompose a complex task across multiple agents
167
+ curl -X POST http://localhost:3000/api/agents/decompose/run \
168
+ -d '{"task": "Audit payment module for security issues, perf problems, and missing docs", "parallel": false}'
97
169
  ```
98
170
 
99
- ### Ollama (local / self-hosted)
171
+ ---
172
+
173
+ ## 10 Pre-Built Teams
174
+
175
+ Teams run **sequentially** โ€” each agent sees what the previous found and builds on it.
100
176
 
101
- Run any model locally โ€” no API key needed.
177
+ | Team | Agents | Use Case |
178
+ | ---------------- | --------------------------------- | --------------------------------- |
179
+ | `full-audit` | Security + Perf + Refactor + Docs | Complete codebase health check |
180
+ | `feature-review` | Arch + Security + Test + Docs | Review before merging |
181
+ | `bug-triage` | Debug + Perf + Docs | Triage a production bug |
182
+ | `onboarding` | Arch + Docs + Debug + Planner | New developer getting up to speed |
183
+ | `refactor-safe` | Arch + Refactor + Test + Security | Safe, verified refactoring |
184
+ | `release-prep` | Docs + Security + Test + DevOps | Pre-release checklist |
185
+ | `data-audit` | Data + Security + Perf | Data layer audit |
186
+ | `ci-setup` | DevOps + Test + Security | Fix or set up CI/CD |
187
+ | `post-mortem` | Debug + Perf + Planner + Docs | Incident post-mortem |
188
+ | `greenfield` | Arch + Security + Planner + Test | Plan a new feature/service |
102
189
 
103
190
  ```bash
104
- # Install Ollama: https://ollama.com
105
- ollama pull llama3 # or mistral, codellama, phi3, etc.
106
- ```
191
+ # Run a named team
192
+ curl -X POST http://localhost:3000/api/agents/teams/post-mortem \
193
+ -d '{"task": "Production outage last night โ€” getUserById returning null"}'
107
194
 
108
- ```env
109
- LLM_PROVIDER=ollama
110
- OLLAMA_BASE_URL=http://localhost:11434 # optional, this is the default
111
- LLM_MODEL=llama3 # optional, this is the default
195
+ # Auto-select the best team
196
+ curl -X POST http://localhost:3000/api/agents/teams/auto \
197
+ -d '{"task": "Prepare the v1.0 release"}'
112
198
  ```
113
199
 
114
- ### Azure OpenAI
200
+ ---
115
201
 
116
- ```env
117
- LLM_PROVIDER=azure
118
- AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com
119
- AZURE_OPENAI_API_KEY=your-azure-key-here
120
- AZURE_OPENAI_DEPLOYMENT=gpt-4o # your deployment name in Azure AI Studio
121
- AZURE_OPENAI_API_VERSION=2024-05-01-preview # optional, has a sensible default
122
- ```
202
+ ## 6 Pre-Built Pipelines
123
203
 
124
- > The deployment name is also used as `LLM_MODEL`. If you want to override the model
125
- > label independently, set `LLM_MODEL` explicitly.
204
+ Multi-step workflows where each step feeds the next. Resilient โ€” a failing step doesn't stop the pipeline.
205
+
206
+ | Pipeline | Steps | Use Case |
207
+ | --------------------------- | ------------------------------------------------- | -------------------- |
208
+ | `debug-pipeline` | retrieve โ†’ debug โ†’ create-tasks โ†’ save-memory | Debug + action items |
209
+ | `security-audit-pipeline` | retrieve โ†’ architecture โ†’ security โ†’ create-tasks | Full security scan |
210
+ | `onboarding-pipeline` | retrieve โ†’ architecture โ†’ docs โ†’ grep-todos | New dev onboarding |
211
+ | `feature-planning-pipeline` | retrieve โ†’ decompose โ†’ plan โ†’ create-tasks | Plan a feature |
212
+ | `code-review-pipeline` | retrieve โ†’ git-review โ†’ security โ†’ save-memory | Code review |
213
+ | `impact-analysis-pipeline` | retrieve โ†’ architecture โ†’ debug โ†’ plan โ†’ tasks | Change impact |
214
+
215
+ ```bash
216
+ curl -X POST http://localhost:3000/api/pipelines/security-audit-pipeline \
217
+ -d '{"task": "Audit the API layer"}'
218
+ ```
126
219
 
127
220
  ---
128
221
 
129
- ## Ingest & Ignore Rules
222
+ ## The Dreamer โ€” 5-Phase Background Intelligence
223
+
224
+ Runs every 30 minutes automatically. No commands needed.
130
225
 
131
- ### Default ignore list
226
+ | Phase | What it does |
227
+ | ------------------- | -------------------------------------------------- |
228
+ | **Consolidate** | Merges duplicate memories, resolves contradictions |
229
+ | **Patterns** | Scans codebase for conventions, anti-patterns |
230
+ | **Suggestions** | Generates proactive improvements nobody asked for |
231
+ | **Knowledge Graph** | Connects related facts across memories |
232
+ | **Prune** | Removes stale/unused memories older than 30 days |
132
233
 
133
- The following patterns are always excluded, regardless of any other configuration:
234
+ ```bash
235
+ # Check what the dreamer found
236
+ curl http://localhost:3000/api/agents/dreamer/status
134
237
 
238
+ # Trigger immediately
239
+ curl -X POST http://localhost:3000/api/agents/dreamer/now
135
240
  ```
136
- **/node_modules/** **/.git/** **/dist/**
137
- **/build/** **/coverage/** **/*.min.js
138
- **/package-lock.json **/yarn.lock
241
+
242
+ ---
243
+
244
+ ## Context Compactor
245
+
246
+ Sliding-window compaction keeps conversations fresh without hitting token limits.
247
+
248
+ - **Window**: keeps last 6 messages verbatim (always fresh)
249
+ - **Body**: older messages โ†’ compressed summary
250
+ - **Multi-tier**: if the summary itself is too long, compress it again
251
+ - **Importance scoring**: tool results and key decisions weighted higher
252
+
253
+ ```bash
254
+ # Check if a conversation needs compaction
255
+ curl -X POST http://localhost:3000/api/compact/check \
256
+ -d '{"messages": [...]}'
257
+
258
+ # Compact
259
+ curl -X POST http://localhost:3000/api/compact/compact \
260
+ -d '{"messages": [...], "sessionId": "my-session"}'
261
+
262
+ # Deep compact (compress the summary too)
263
+ curl -X POST http://localhost:3000/api/compact/deep-compact \
264
+ -d '{"messages": [...]}'
139
265
  ```
140
266
 
141
- ### .gitignore integration
267
+ ---
142
268
 
143
- By default the server reads the `.gitignore` in the directory being ingested and adds those patterns on top of the baseline. This means anything your team already ignores in git is also ignored during ingestion โ€” no duplicate config.
269
+ ## Prompt Engineering System
144
270
 
145
- ```env
146
- # Disable .gitignore integration (enabled by default):
147
- INGEST_USE_GITIGNORE=false
271
+ 8 built-in templates + analyse/improve/generate/A-B test any prompt.
272
+
273
+ | Template | Description |
274
+ | --------------------- | ------------------------------------------------ |
275
+ | `chain-of-thought` | Step-by-step reasoning before answering |
276
+ | `role-expert` | Frame as domain expert with 20+ years experience |
277
+ | `few-shot` | Provide examples before the actual task |
278
+ | `structured-output` | Force JSON output with a schema |
279
+ | `critique-and-revise` | Self-critique and improve an answer |
280
+ | `least-to-most` | Break into simpler sub-problems first |
281
+ | `react-agent` | ReAct (Reason + Act) prompting pattern |
282
+ | `socratic` | Lead to the answer through questions |
283
+
284
+ ```bash
285
+ # Analyse a prompt for weaknesses
286
+ curl -X POST http://localhost:3000/api/prompts/analyse \
287
+ -d '{"prompt": "Tell me about authentication"}'
288
+
289
+ # Auto-improve a prompt
290
+ curl -X POST http://localhost:3000/api/prompts/improve \
291
+ -d '{"prompt": "Tell me about authentication", "goal": "security audit context"}'
292
+
293
+ # Apply a template
294
+ curl -X POST http://localhost:3000/api/prompts/apply \
295
+ -d '{"template": "chain-of-thought", "variables": {"prompt": "Why is getUserById slow?"}}'
296
+
297
+ # A/B test two prompts
298
+ curl -X POST http://localhost:3000/api/prompts/ab-test \
299
+ -d '{"promptA": "...", "promptB": "...", "testInput": "..."}'
300
+
301
+ # Inject chain-of-thought into any prompt
302
+ curl -X POST http://localhost:3000/api/prompts/cot \
303
+ -d '{"prompt": "Debug this error", "style": "detailed"}'
148
304
  ```
149
305
 
150
- ### Extra ignore patterns
306
+ ---
151
307
 
152
- Add any additional glob patterns via a comma-separated env var:
308
+ ## 8 Built-In Skills
153
309
 
154
- ```env
155
- INGEST_EXTRA_IGNORE=**/fixtures/**,**/__snapshots__/**,**/test-data/**
310
+ Named, reusable prompt workflows. Run with one command.
311
+
312
+ | Skill | What it does |
313
+ | -------------------- | ------------------------------------------------ |
314
+ | `add-error-handling` | Wrap async code in try/catch with proper logging |
315
+ | `document-function` | Generate complete JSDoc with examples |
316
+ | `check-security` | OWASP-style targeted security audit |
317
+ | `explain-flow` | Trace full execution flow of a function |
318
+ | `find-similar` | Find duplicate/similar logic in the codebase |
319
+ | `write-tests` | Generate Jest unit tests with mocks |
320
+ | `performance-audit` | Find N+1 queries, memory leaks, blocking I/O |
321
+ | `migration-plan` | Step-by-step safe migration plan |
322
+
323
+ ```bash
324
+ node cli.js query -i
325
+ โฏ /skill run write-tests getUserById
326
+ โฏ /skill run check-security AuthController.js
327
+ โฏ /skill run add-error-handling UserService.js
156
328
  ```
157
329
 
158
- All three sources (baseline + `.gitignore` + `INGEST_EXTRA_IGNORE`) are merged and deduplicated before each directory ingest. The log output tells you exactly what was applied:
330
+ ---
159
331
 
332
+ ## Plugin System
333
+
334
+ Extend the system with custom plugins โ€” add tools, agents, routes, or startup hooks.
335
+
336
+ ```javascript
337
+ // plugins/my-plugin.js
338
+ module.exports = {
339
+ name: 'my-plugin',
340
+ version: '1.0.0',
341
+ async register(app, { toolRegistry, agentRegistry }) {
342
+ // Add a custom tool
343
+ toolRegistry.addTool({
344
+ schema: { name: 'my_tool', description: '...', input_schema: { ... } },
345
+ execute: async (input) => 'result',
346
+ });
347
+ // Add a custom route
348
+ app.get('/api/my-plugin/hello', (req, res) => res.json({ hello: 'world' }));
349
+ },
350
+ };
160
351
  ```
161
- Ignore sources: baseline, .gitignore (12 patterns), INGEST_EXTRA_IGNORE (2 patterns)
352
+
353
+ ```bash
354
+ # List installed plugins
355
+ curl http://localhost:3000/api/plugins
356
+
357
+ # Enable/disable a plugin
358
+ curl -X POST http://localhost:3000/api/plugins/my-plugin/enable
162
359
  ```
163
360
 
164
361
  ---
165
362
 
166
- ## Configuration Reference
167
-
168
- Copy `.env.example` to `.env` and fill in the relevant section for your chosen provider.
169
-
170
- | Variable | Default | Description |
171
- | -------------------------- | ------------------------ | ----------------------------------------------- |
172
- | `LLM_PROVIDER` | `anthropic` | LLM backend: `anthropic` \| `ollama` \| `azure` |
173
- | `LLM_MODEL` | *(per provider)* | Model or deployment name override |
174
- | `ANTHROPIC_API_KEY` | โ€” | Required when `LLM_PROVIDER=anthropic` |
175
- | `OLLAMA_BASE_URL` | `http://localhost:11434` | Ollama server URL |
176
- | `AZURE_OPENAI_ENDPOINT` | โ€” | Required when `LLM_PROVIDER=azure` |
177
- | `AZURE_OPENAI_API_KEY` | โ€” | Required when `LLM_PROVIDER=azure` |
178
- | `AZURE_OPENAI_DEPLOYMENT` | โ€” | Required when `LLM_PROVIDER=azure` |
179
- | `AZURE_OPENAI_API_VERSION` | `2024-05-01-preview` | Azure API version |
180
- | `INGEST_USE_GITIGNORE` | `true` | Read `.gitignore` during ingest |
181
- | `INGEST_EXTRA_IGNORE` | โ€” | Comma-separated extra glob patterns to ignore |
182
- | `PORT` | `3000` | HTTP server port |
183
- | `LOG_LEVEL` | `info` | `error` \| `warn` \| `info` \| `debug` |
363
+ ## Worktree Manager
364
+
365
+ Git worktree isolation for safe experimentation. Run agents on a branch without touching your working tree.
366
+
367
+ ```bash
368
+ # Create an isolated worktree for a risky refactor
369
+ curl -X POST http://localhost:3000/api/worktrees \
370
+ -d '{"branch": "refactor/auth-system", "path": "/tmp/worktrees/auth"}'
371
+
372
+ # Run an agent in the worktree (safe, isolated)
373
+ curl -X POST http://localhost:3000/api/agents/RefactorAgent \
374
+ -d '{"task": "Refactor auth module", "cwd": "/tmp/worktrees/auth"}'
375
+
376
+ # Delete when done
377
+ curl -X DELETE http://localhost:3000/api/worktrees/auth
378
+ ```
184
379
 
185
380
  ---
186
381
 
187
- ## API Reference
382
+ ## Cron Scheduler
188
383
 
189
- ### Ingest
384
+ Schedule agent tasks to run automatically โ€” daily security scans, weekly audits, etc.
190
385
 
191
386
  ```bash
192
- # Ingest a file
193
- curl -X POST http://localhost:3000/api/ingest/file \
194
- -H "Content-Type: application/json" \
195
- -d '{"filePath": "./src/services/UserService.js"}'
196
-
197
- # Ingest a directory
198
- curl -X POST http://localhost:3000/api/ingest/directory \
199
- -H "Content-Type: application/json" \
200
- -d '{"dirPath": "./src"}'
201
-
202
- # Ingest raw text (paste an error log, bug description, etc.)
203
- curl -X POST http://localhost:3000/api/ingest/raw \
204
- -H "Content-Type: application/json" \
205
- -d '{
206
- "content": "ClassCastException at UserService line 45: Mongoose doc passed to UserDTO. Fix: call .toObject() first.",
207
- "kind": "log",
208
- "label": "production-bug-2024-03-15"
209
- }'
387
+ # Schedule a daily security check at 9am
388
+ curl -X POST http://localhost:3000/api/cron \
389
+ -d '{"name": "daily-security", "schedule": "0 9 * * *", "task": "Security audit of auth module", "agent": "SecurityAgent"}'
390
+
391
+ # List all scheduled jobs
392
+ curl http://localhost:3000/api/cron
393
+
394
+ # Trigger manually
395
+ curl -X POST http://localhost:3000/api/cron/daily-security/run
210
396
  ```
211
397
 
212
- ### Query
398
+ ---
399
+
400
+ ## Team Memory Sync
401
+
402
+ Shared memory store that all agents on a team can read and write โ€” knowledge that persists across sessions and users.
213
403
 
214
404
  ```bash
215
- # General question โ€” auto-detects debug / usage / impact mode
216
- curl -X POST http://localhost:3000/api/query \
217
- -H "Content-Type: application/json" \
218
- -d '{"question": "Why does getUserById sometimes throw ClassCastException?"}'
219
-
220
- # Force debug mode
221
- curl -X POST http://localhost:3000/api/query/debug \
222
- -H "Content-Type: application/json" \
223
- -d '{"error": "ClassCastException", "stackTrace": "at UserService.getUserById:45"}'
224
-
225
- # Usage search
226
- curl -X POST http://localhost:3000/api/query/usage \
227
- -H "Content-Type: application/json" \
228
- -d '{"symbol": "getUserById"}'
229
-
230
- # Impact analysis
231
- curl -X POST http://localhost:3000/api/query/impact \
232
- -H "Content-Type: application/json" \
233
- -d '{"target": "UserDTO", "changeDescription": "add a new required field"}'
234
-
235
- # Streaming (Server-Sent Events)
236
- curl -X POST http://localhost:3000/api/query/stream \
237
- -H "Content-Type: application/json" \
238
- -d '{"question": "How does user status update work end to end?"}'
405
+ # Write to team memory
406
+ curl -X POST http://localhost:3000/api/team-memory \
407
+ -d '{"team": "backend", "content": "UserService.getUserById has a known ClassCastException bug", "type": "bug"}'
408
+
409
+ # All agents automatically read team memory on queries
410
+ # Or read it explicitly
411
+ curl "http://localhost:3000/api/team-memory?team=backend"
239
412
  ```
240
413
 
241
- ### Knowledge Base
414
+ ---
415
+
416
+ ## Inter-Agent Messaging
417
+
418
+ Agents can send structured messages to each other during complex workflows.
242
419
 
243
420
  ```bash
244
- curl http://localhost:3000/api/knowledge/stats
245
- curl "http://localhost:3000/api/knowledge/search?q=ClassCastException&topK=5"
246
- curl http://localhost:3000/api/knowledge/files
247
- curl -X POST http://localhost:3000/api/knowledge/rebuild
248
- curl -X DELETE http://localhost:3000/api/ingest/clear
421
+ # Send a message from one agent to another
422
+ curl -X POST http://localhost:3000/api/messages \
423
+ -d '{"from": "DebugAgent", "to": "SecurityAgent", "content": "Found ClassCastException โ€” check if it exposes user data", "priority": "high"}'
424
+
425
+ # An agent reads its inbox
426
+ curl "http://localhost:3000/api/messages/inbox/SecurityAgent"
249
427
  ```
250
428
 
251
429
  ---
252
430
 
253
- ## Supported File Types
431
+ ## Context Visualizer
254
432
 
255
- | Category | Extensions |
256
- | -------- | ------------------------------------------------------------------------------------------------ |
257
- | Code | `.js` `.ts` `.jsx` `.tsx` `.mjs` `.cjs` `.py` `.java` `.go` `.rb` `.php` `.cs` `.cpp` `.c` `.rs` |
258
- | Config | `.json` `.yaml` `.yml` `.env` `.toml` `.xml` |
259
- | Docs | `.md` `.txt` |
260
- | Logs | `.log` |
261
- | Schema | `.sql` `.graphql` `.gql` |
262
- | Scripts | `.sh` `.bash` |
433
+ See exactly what's in the context window for any query โ€” which chunks were selected, their scores, token budget used.
434
+
435
+ ```bash
436
+ curl -X POST http://localhost:3000/api/context/visualize \
437
+ -d '{"query": "Why is getUserById failing?", "mode": "debug"}'
438
+ # Returns: { chunks, budgetUsed, dropped, engineeredScores, memoryContext }
439
+ ```
263
440
 
264
441
  ---
265
442
 
266
- ## What to Ingest
443
+ ## 3 Core Queries (the original concept)
444
+
445
+ ```bash
446
+ # ๐Ÿ› Why is this failing?
447
+ node cli.js query "Why is ClassCastException happening in UserService?"
448
+
449
+ # ๐Ÿ” Where is this used?
450
+ node cli.js query "Where is getUserById called across the codebase?"
267
451
 
268
- The key insight: **ingest real stuff, not clean summaries**.
452
+ # ๐Ÿ’ฅ What breaks if I change this?
453
+ node cli.js query "If I change the UserDTO schema, what breaks?"
454
+ ```
455
+
456
+ ---
457
+
458
+ ## CLI Commands
269
459
 
270
460
  ```bash
271
- node cli.js ingest ./src # actual source code
272
- node cli.js ingest ./logs # real error logs โ€” the ugly ones
273
- node cli.js ingest ./config # environment configs and schemas
274
- node cli.js ingest ./docs # ADRs, runbooks, onboarding notes
461
+ node cli.js ingest <path> # Ingest a file or directory
462
+ node cli.js query -i # Interactive REPL (recommended)
463
+ node cli.js query "question" # Single query
464
+ node cli.js debug "error message" # Quick debug
465
+ node cli.js plan "task" # Generate execution plan
466
+ node cli.js git <commit|review|diff|log>
467
+ node cli.js grep <pattern> # Search codebase
468
+ node cli.js tasks [list|add|done]
469
+ node cli.js memory [list|add|stats|clear]
470
+ node cli.js sessions [list|export]
471
+ node cli.js doctor # Environment health check
472
+ node cli.js stats # System overview
473
+ node cli.js cost # Token usage & cost
474
+ node cli.js clear # Reset knowledge base
275
475
  ```
276
476
 
277
- Paste knowledge directly in the interactive REPL:
477
+ ### REPL slash commands
278
478
 
279
479
  ```
280
- โฏ node cli.js query -i
281
- โฏ We fixed a bug last week where the Mongoose document wasn't being converted
282
- to a plain object before passing to UserDTO. Always call .toObject() first.
480
+ /plan <task> Generate execution plan
481
+ /git Git status
482
+ /git commit AI-generated commit message
483
+ /git review AI code review
484
+ /agent <name> <task> Run a specialist agent
485
+ /team <name> <task> Run an agent team
486
+ /skill run <name> <target>
487
+ /grep <pattern> Search codebase
488
+ /lsp <symbol> Go to definition
489
+ /memory Show memories
490
+ /memory add <text> Add memory manually
491
+ /compact Compress conversation history
492
+ /cost Token usage & cost
493
+ /doctor Environment health
494
+ /help Show all commands
495
+ /exit Save & exit
283
496
  ```
284
497
 
285
- > *"Docs lie. Or rather, docs go stale. Code doesn't."*
286
-
287
498
  ---
288
499
 
289
- ## Architecture
500
+ ## Complete REST API
290
501
 
291
502
  ```
292
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
293
- โ”‚ Dev MCP Server โ”‚
294
- โ”‚ โ”‚
295
- โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
296
- โ”‚ โ”‚ Ingester โ”‚โ”€โ”€โ”€โ–ถโ”‚ Store โ”‚โ”€โ”€โ–ถโ”‚ Indexer โ”‚ โ”‚
297
- โ”‚ โ”‚ โ”‚ โ”‚ (JSON) โ”‚ โ”‚ (TF-IDF Search) โ”‚ โ”‚
298
- โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
299
- โ”‚ โ”‚ โ”‚ โ”‚
300
- โ”‚ โ–ผ โ–ผ โ”‚
301
- โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
302
- โ”‚ โ”‚ CLI โ”‚ โ”‚ Query Engine โ”‚ โ”‚
303
- โ”‚ โ”‚ (REPL) โ”‚ โ”‚ Retrieval + LLM Client โ”‚ โ”‚
304
- โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
305
- โ”‚ โ”‚ โ”‚
306
- โ”‚ โ”Œโ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
307
- โ”‚ โ”‚ Anthropic / โ”‚โ”‚
308
- โ”‚ โ”‚ Ollama / โ”‚โ”‚
309
- โ”‚ โ”‚ Azure OpenAI โ”‚โ”‚
310
- โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
311
- โ”‚ โ”‚
312
- โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
313
- โ”‚ โ”‚ Express REST API โ”‚ โ”‚
314
- โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
315
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
503
+ # Core
504
+ GET /health # System health + KB stats
505
+ GET /dashboard # Web UI
506
+ GET / # API map
507
+
508
+ # Ingest
509
+ POST /api/ingest/file # { filePath }
510
+ POST /api/ingest/directory # { dirPath }
511
+ POST /api/ingest/raw # { content, kind, label }
512
+ DELETE /api/ingest/clear
513
+
514
+ # Query (auto-detects debug/usage/impact mode)
515
+ POST /api/query # { question, mode?, topK? }
516
+ POST /api/query/debug # { error, stackTrace? }
517
+ POST /api/query/usage # { symbol }
518
+ POST /api/query/impact # { target, changeDescription? }
519
+ POST /api/query/stream # SSE streaming
520
+
521
+ # Multi-turn Conversation
522
+ POST /api/chat # { message, convId? }
523
+ POST /api/chat/follow-up # { message, convId }
524
+ GET /api/chat # list conversations
525
+ DELETE /api/chat/:id
526
+
527
+ # Knowledge Base
528
+ GET /api/knowledge/stats
529
+ GET /api/knowledge/search?q=<query>
530
+ GET /api/knowledge/files
531
+ POST /api/knowledge/rebuild
532
+
533
+ # Tools Registry
534
+ GET /api/registry # list all 45 tools
535
+ GET /api/registry/groups
536
+ POST /api/registry/execute # { tool, input }
537
+
538
+ # Agents (10 specialists)
539
+ GET /api/agents # list agents + stats
540
+ POST /api/agents/:name # { task }
541
+ POST /api/agents/:name/reset
542
+ POST /api/agents/decompose/run # { task, parallel? }
543
+ POST /api/agents/decompose/plan
544
+
545
+ # Teams (10 teams)
546
+ GET /api/agents/teams/list
547
+ POST /api/agents/teams/:name # { task }
548
+ POST /api/agents/teams/auto # { task }
549
+ POST /api/agents/teams/custom # { agents[], task }
550
+
551
+ # Dreamer
552
+ GET /api/agents/dreamer/status
553
+ POST /api/agents/dreamer/now
554
+ POST /api/agents/dreamer/start # { intervalMinutes? }
555
+ POST /api/agents/dreamer/stop
556
+
557
+ # Improver
558
+ GET /api/agents/improver/summary
559
+ POST /api/agents/improver/feedback # { queryId, rating, comment? }
560
+
561
+ # Pipelines
562
+ GET /api/pipelines
563
+ POST /api/pipelines/:name # { task }
564
+ POST /api/pipelines/custom/run # { steps[], task }
565
+
566
+ # Skills
567
+ GET /api/skills
568
+ POST /api/skills/:name # { target }
569
+ POST /api/skills # create custom skill
570
+ DELETE /api/skills/:name
571
+
572
+ # Prompt Engineering
573
+ GET /api/prompts/templates
574
+ POST /api/prompts/analyse # { prompt }
575
+ POST /api/prompts/improve # { prompt, goal? }
576
+ POST /api/prompts/generate # { task }
577
+ POST /api/prompts/ab-test # { promptA, promptB, testInput }
578
+ POST /api/prompts/apply # { template, variables }
579
+ POST /api/prompts/cot # { prompt, style? }
580
+
581
+ # Context
582
+ POST /api/compact/compact # { messages[] }
583
+ POST /api/compact/deep-compact
584
+ POST /api/compact/check # { messages[] }
585
+ POST /api/context/visualize # { query, mode? }
586
+
587
+ # Git
588
+ GET /api/git/status
589
+ GET /api/git/diff
590
+ POST /api/git/commit
591
+ POST /api/git/review
592
+ GET /api/git/log
593
+ GET /api/git/branches
594
+
595
+ # LSP / Symbol Navigation
596
+ GET /api/lsp/definition/:symbol
597
+ GET /api/lsp/references/:symbol
598
+ POST /api/lsp/hover # { symbol, filePath? }
599
+ GET /api/lsp/outline?path=<file>
600
+ GET /api/lsp/symbols?q=<query>
601
+ POST /api/lsp/rename # { oldName, newName }
602
+
603
+ # File Operations
604
+ GET /api/files/read?path=<file>
605
+ POST /api/files/str-replace # { filePath, old_str, new_str }
606
+ POST /api/files/insert-after # { filePath, afterStr, insertText }
607
+ POST /api/files/rewrite # { filePath, content }
608
+ POST /api/files/ai-edit # { filePath, instruction }
609
+ POST /api/files/undo # { filePath }
610
+
611
+ # Shell
612
+ POST /api/tools/bash # { command, approved? }
613
+ POST /api/tools/bash/permit # { command, level }
614
+ GET /api/tools/grep?pattern=<p>
615
+ GET /api/tools/grep/definitions/:sym
616
+ GET /api/tools/grep/imports/:mod
617
+ GET /api/tools/grep/todos
618
+
619
+ # Memory
620
+ GET /api/memory
621
+ POST /api/memory # { content, type, tags? }
622
+ DELETE /api/memory/:id
623
+ DELETE /api/memory
624
+
625
+ # Team Memory
626
+ GET /api/team-memory?team=<name>
627
+ POST /api/team-memory # { team, content, type }
628
+ DELETE /api/team-memory/:id
629
+
630
+ # Tasks
631
+ GET /api/tasks
632
+ POST /api/tasks # { title, priority }
633
+ PATCH /api/tasks/:id
634
+ POST /api/tasks/:id/notes
635
+ DELETE /api/tasks/:id
636
+
637
+ # Sessions
638
+ GET /api/sessions
639
+ POST /api/sessions
640
+ GET /api/sessions/:id
641
+ GET /api/sessions/:id/export
642
+ DELETE /api/sessions/:id
643
+
644
+ # Planner
645
+ POST /api/plan # { task }
646
+ POST /api/plan/compact # { messages[] }
647
+ GET /api/plan/doctor
648
+ GET /api/cost?sessionId=<id>
649
+
650
+ # Monitor
651
+ GET /api/monitor/status
652
+ GET /api/monitor/alerts
653
+ POST /api/monitor/run-all
654
+ POST /api/monitor/run/:checkId
655
+ POST /api/monitor/alerts/:id/acknowledge
656
+ POST /api/monitor/acknowledge-all
657
+
658
+ # Plugins
659
+ GET /api/plugins
660
+ POST /api/plugins/:name/enable
661
+ POST /api/plugins/:name/disable
662
+
663
+ # Worktrees
664
+ GET /api/worktrees
665
+ POST /api/worktrees # { branch, path }
666
+ DELETE /api/worktrees/:name
667
+
668
+ # Cron
669
+ GET /api/cron
670
+ POST /api/cron # { name, schedule, task, agent }
671
+ POST /api/cron/:name/run
672
+ DELETE /api/cron/:name
673
+
674
+ # Inter-Agent Messaging
675
+ POST /api/messages # { from, to, content, priority }
676
+ GET /api/messages/inbox/:agent
677
+ POST /api/messages/:id/read
678
+
679
+ # Watcher
680
+ GET /api/watcher/status
681
+ POST /api/watcher/watch # { path }
682
+ POST /api/watcher/unwatch # { path }
316
683
  ```
317
684
 
318
- **How it works:**
319
- 1. **Ingest** โ€” Feed your codebase in (files, directories, raw text)
320
- 2. **Index** โ€” TF-IDF search index built over all chunks
321
- 3. **Query** โ€” Question arrives โ†’ relevant context retrieved โ†’ LLM answers based on *your* code
685
+ ---
686
+
687
+ ## Key Design Principles
688
+
689
+ 1. **AI retrieves, never guesses** โ€” every answer is grounded in your actual code
690
+ 2. **Context is a budget** โ€” spend tokens on the highest-signal information only
691
+ 3. **Agents specialise** โ€” 10 experts beat one generalist
692
+ 4. **Teams think sequentially** โ€” each agent builds on what the previous found
693
+ 5. **Pipelines are resilient** โ€” a failing step doesn't kill the workflow
694
+ 6. **Dreaming consolidates knowledge** โ€” 5-phase improvement without prompting
695
+ 7. **Memory is the nervous system** โ€” every interaction makes the system smarter
696
+ 8. **Feedback closes the loop** โ€” the improver learns what works and what doesn't
697
+ 9. **Tools are first-class** โ€” 45 typed tools with real Anthropic `tool_use` integration
698
+ 10. **Prompts are engineered** โ€” analyse, improve, template, and A/B test every prompt
322
699
 
323
700
  ---
324
701
 
325
- ## Key Design Decisions
702
+ ## Environment Variables
326
703
 
327
- **Data quality beats model quality.** The retrieval step (TF-IDF over your actual files) matters more than which AI model you use. A focused, well-curated knowledge base with a smaller model will outperform a bloated one with GPT-4.
704
+ ```env
705
+ ANTHROPIC_API_KEY=sk-ant-... # Required
706
+ PORT=3000 # Server port (default 3000)
707
+ API_KEY=your-secret-key # Optional: protect API with auth
708
+ ENABLE_DREAMER=true # Auto-start dreamer (default true)
709
+ DREAM_INTERVAL_MINUTES=30 # Dream frequency (default 30)
710
+ ENABLE_MONITOR=true # Auto-start monitor (default true)
711
+ LOG_LEVEL=info # Logging level
712
+ ```
328
713
 
329
- **No embeddings, no vector DB.** TF-IDF is deterministic, fast, and requires zero infrastructure. For most codebases (< 50k files) it's entirely sufficient.
714
+ ---
330
715
 
331
- **Provider-agnostic by design.** The `llmClient` abstraction means you can switch from Anthropic to a local Ollama model to Azure OpenAI by changing one line in `.env` โ€” useful for cost control, data residency requirements, or offline usage.
716
+ ## Supported File Types for Ingestion
332
717
 
333
- **Ingest real artefacts.** Error logs, not summaries of error logs. Actual API responses, not docs about API responses. The messier the better โ€” the system is built to handle it.
718
+ `.js` `.ts` `.jsx` `.tsx` `.py` `.java` `.go` `.rb` `.php` `.cs` `.rs` `.cpp` `.c` โ€” Code
719
+ `.json` `.yaml` `.yml` `.env` `.toml` `.xml` โ€” Config
720
+ `.md` `.txt` โ€” Documentation
721
+ `.log` โ€” Error logs
722
+ `.sql` `.graphql` `.gql` โ€” Schema
723
+ `.sh` `.bash` โ€” Scripts