@phuetz/code-buddy 0.1.24 → 0.1.26

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 (258) hide show
  1. package/README.md +1049 -741
  2. package/dist/agent/codebuddy-agent.d.ts +5 -0
  3. package/dist/agent/codebuddy-agent.js +46 -1
  4. package/dist/agent/codebuddy-agent.js.map +1 -1
  5. package/dist/agent/execution/agent-executor.d.ts +12 -0
  6. package/dist/agent/execution/agent-executor.js +147 -6
  7. package/dist/agent/execution/agent-executor.js.map +1 -1
  8. package/dist/agent/lessons-tracker.d.ts +50 -0
  9. package/dist/agent/lessons-tracker.js +234 -0
  10. package/dist/agent/lessons-tracker.js.map +1 -0
  11. package/dist/agent/message-queue.d.ts +39 -2
  12. package/dist/agent/message-queue.js +67 -2
  13. package/dist/agent/message-queue.js.map +1 -1
  14. package/dist/agent/middleware/index.d.ts +1 -0
  15. package/dist/agent/middleware/index.js +1 -0
  16. package/dist/agent/middleware/index.js.map +1 -1
  17. package/dist/agent/middleware/workflow-guard.d.ts +21 -0
  18. package/dist/agent/middleware/workflow-guard.js +94 -0
  19. package/dist/agent/middleware/workflow-guard.js.map +1 -0
  20. package/dist/agent/repo-profiler.d.ts +61 -0
  21. package/dist/agent/repo-profiler.js +295 -0
  22. package/dist/agent/repo-profiler.js.map +1 -0
  23. package/dist/agent/response-constraint.d.ts +61 -0
  24. package/dist/agent/response-constraint.js +91 -0
  25. package/dist/agent/response-constraint.js.map +1 -0
  26. package/dist/agent/todo-tracker.d.ts +67 -0
  27. package/dist/agent/todo-tracker.js +245 -0
  28. package/dist/agent/todo-tracker.js.map +1 -0
  29. package/dist/agent/tool-handler.d.ts +11 -0
  30. package/dist/agent/tool-handler.js +79 -1
  31. package/dist/agent/tool-handler.js.map +1 -1
  32. package/dist/agent/types.d.ts +20 -2
  33. package/dist/agent/wide-research.d.ts +93 -0
  34. package/dist/agent/wide-research.js +232 -0
  35. package/dist/agent/wide-research.js.map +1 -0
  36. package/dist/channels/index.d.ts +2 -0
  37. package/dist/channels/index.js +2 -0
  38. package/dist/channels/index.js.map +1 -1
  39. package/dist/channels/pro/callback-router.d.ts +54 -0
  40. package/dist/channels/pro/callback-router.js +178 -0
  41. package/dist/channels/pro/callback-router.js.map +1 -0
  42. package/dist/channels/pro/ci-watcher.d.ts +86 -0
  43. package/dist/channels/pro/ci-watcher.js +343 -0
  44. package/dist/channels/pro/ci-watcher.js.map +1 -0
  45. package/dist/channels/pro/diff-first.d.ts +63 -0
  46. package/dist/channels/pro/diff-first.js +187 -0
  47. package/dist/channels/pro/diff-first.js.map +1 -0
  48. package/dist/channels/pro/enhanced-commands.d.ts +83 -0
  49. package/dist/channels/pro/enhanced-commands.js +218 -0
  50. package/dist/channels/pro/enhanced-commands.js.map +1 -0
  51. package/dist/channels/pro/index.d.ts +19 -0
  52. package/dist/channels/pro/index.js +21 -0
  53. package/dist/channels/pro/index.js.map +1 -0
  54. package/dist/channels/pro/pro-features.d.ts +79 -0
  55. package/dist/channels/pro/pro-features.js +203 -0
  56. package/dist/channels/pro/pro-features.js.map +1 -0
  57. package/dist/channels/pro/run-commands.d.ts +59 -0
  58. package/dist/channels/pro/run-commands.js +122 -0
  59. package/dist/channels/pro/run-commands.js.map +1 -0
  60. package/dist/channels/pro/run-tracker.d.ts +74 -0
  61. package/dist/channels/pro/run-tracker.js +252 -0
  62. package/dist/channels/pro/run-tracker.js.map +1 -0
  63. package/dist/channels/pro/scoped-auth.d.ts +97 -0
  64. package/dist/channels/pro/scoped-auth.js +340 -0
  65. package/dist/channels/pro/scoped-auth.js.map +1 -0
  66. package/dist/channels/pro/text-formatter.d.ts +27 -0
  67. package/dist/channels/pro/text-formatter.js +269 -0
  68. package/dist/channels/pro/text-formatter.js.map +1 -0
  69. package/dist/channels/pro/types.d.ts +242 -0
  70. package/dist/channels/pro/types.js +14 -0
  71. package/dist/channels/pro/types.js.map +1 -0
  72. package/dist/channels/streaming-policy.d.ts +66 -0
  73. package/dist/channels/streaming-policy.js +266 -0
  74. package/dist/channels/streaming-policy.js.map +1 -0
  75. package/dist/channels/telegram/ci-watcher.d.ts +5 -0
  76. package/dist/channels/telegram/ci-watcher.js +5 -0
  77. package/dist/channels/telegram/ci-watcher.js.map +1 -0
  78. package/dist/channels/telegram/client.d.ts +28 -0
  79. package/dist/channels/telegram/client.js +147 -1
  80. package/dist/channels/telegram/client.js.map +1 -1
  81. package/dist/channels/telegram/diff-first.d.ts +5 -0
  82. package/dist/channels/telegram/diff-first.js +5 -0
  83. package/dist/channels/telegram/diff-first.js.map +1 -0
  84. package/dist/channels/telegram/enhanced-commands.d.ts +6 -0
  85. package/dist/channels/telegram/enhanced-commands.js +6 -0
  86. package/dist/channels/telegram/enhanced-commands.js.map +1 -0
  87. package/dist/channels/telegram/index.d.ts +6 -0
  88. package/dist/channels/telegram/index.js +6 -0
  89. package/dist/channels/telegram/index.js.map +1 -1
  90. package/dist/channels/telegram/pro-formatter.d.ts +30 -0
  91. package/dist/channels/telegram/pro-formatter.js +276 -0
  92. package/dist/channels/telegram/pro-formatter.js.map +1 -0
  93. package/dist/channels/telegram/run-commands.d.ts +5 -0
  94. package/dist/channels/telegram/run-commands.js +6 -0
  95. package/dist/channels/telegram/run-commands.js.map +1 -0
  96. package/dist/channels/telegram/run-tracker.d.ts +5 -0
  97. package/dist/channels/telegram/run-tracker.js +5 -0
  98. package/dist/channels/telegram/run-tracker.js.map +1 -0
  99. package/dist/channels/telegram/scoped-auth.d.ts +6 -0
  100. package/dist/channels/telegram/scoped-auth.js +5 -0
  101. package/dist/channels/telegram/scoped-auth.js.map +1 -0
  102. package/dist/channels/telegram/types.d.ts +34 -0
  103. package/dist/codebuddy/client.js +14 -1
  104. package/dist/codebuddy/client.js.map +1 -1
  105. package/dist/commands/dev/index.d.ts +12 -0
  106. package/dist/commands/dev/index.js +231 -0
  107. package/dist/commands/dev/index.js.map +1 -0
  108. package/dist/commands/dev/workflows.d.ts +31 -0
  109. package/dist/commands/dev/workflows.js +214 -0
  110. package/dist/commands/dev/workflows.js.map +1 -0
  111. package/dist/commands/execpolicy.d.ts +17 -0
  112. package/dist/commands/execpolicy.js +155 -0
  113. package/dist/commands/execpolicy.js.map +1 -0
  114. package/dist/commands/knowledge.d.ts +13 -0
  115. package/dist/commands/knowledge.js +142 -0
  116. package/dist/commands/knowledge.js.map +1 -0
  117. package/dist/commands/lessons.d.ts +11 -0
  118. package/dist/commands/lessons.js +129 -0
  119. package/dist/commands/lessons.js.map +1 -0
  120. package/dist/commands/pairing.d.ts +14 -0
  121. package/dist/commands/pairing.js +132 -0
  122. package/dist/commands/pairing.js.map +1 -0
  123. package/dist/commands/research/index.d.ts +13 -0
  124. package/dist/commands/research/index.js +91 -0
  125. package/dist/commands/research/index.js.map +1 -0
  126. package/dist/commands/run-cli/index.d.ts +11 -0
  127. package/dist/commands/run-cli/index.js +49 -0
  128. package/dist/commands/run-cli/index.js.map +1 -0
  129. package/dist/commands/todos.d.ts +9 -0
  130. package/dist/commands/todos.js +119 -0
  131. package/dist/commands/todos.js.map +1 -0
  132. package/dist/config/toml-config.d.ts +21 -0
  133. package/dist/config/toml-config.js +15 -0
  134. package/dist/config/toml-config.js.map +1 -1
  135. package/dist/context/enhanced-compression.js +12 -1
  136. package/dist/context/enhanced-compression.js.map +1 -1
  137. package/dist/context/observation-variator.d.ts +44 -0
  138. package/dist/context/observation-variator.js +83 -0
  139. package/dist/context/observation-variator.js.map +1 -0
  140. package/dist/context/precompaction-flush.d.ts +40 -0
  141. package/dist/context/precompaction-flush.js +134 -0
  142. package/dist/context/precompaction-flush.js.map +1 -0
  143. package/dist/context/restorable-compression.d.ts +80 -0
  144. package/dist/context/restorable-compression.js +228 -0
  145. package/dist/context/restorable-compression.js.map +1 -0
  146. package/dist/daemon/daily-reset.d.ts +77 -0
  147. package/dist/daemon/daily-reset.js +175 -0
  148. package/dist/daemon/daily-reset.js.map +1 -0
  149. package/dist/daemon/index.d.ts +1 -0
  150. package/dist/daemon/index.js +1 -0
  151. package/dist/daemon/index.js.map +1 -1
  152. package/dist/index.js +53 -0
  153. package/dist/index.js.map +1 -1
  154. package/dist/knowledge/knowledge-manager.d.ts +77 -0
  155. package/dist/knowledge/knowledge-manager.js +244 -0
  156. package/dist/knowledge/knowledge-manager.js.map +1 -0
  157. package/dist/observability/run-store.d.ts +133 -0
  158. package/dist/observability/run-store.js +419 -0
  159. package/dist/observability/run-store.js.map +1 -0
  160. package/dist/observability/run-viewer.d.ts +33 -0
  161. package/dist/observability/run-viewer.js +254 -0
  162. package/dist/observability/run-viewer.js.map +1 -0
  163. package/dist/optimization/cache-breakpoints.d.ts +52 -0
  164. package/dist/optimization/cache-breakpoints.js +97 -0
  165. package/dist/optimization/cache-breakpoints.js.map +1 -0
  166. package/dist/persistence/session-store.d.ts +3 -1
  167. package/dist/persistence/session-store.js +1 -1
  168. package/dist/persistence/session-store.js.map +1 -1
  169. package/dist/prompts/system-base.js +51 -7
  170. package/dist/prompts/system-base.js.map +1 -1
  171. package/dist/prompts/variation-injector.d.ts +55 -0
  172. package/dist/prompts/variation-injector.js +171 -0
  173. package/dist/prompts/variation-injector.js.map +1 -0
  174. package/dist/prompts/workflow-rules.d.ts +10 -0
  175. package/dist/prompts/workflow-rules.js +79 -0
  176. package/dist/prompts/workflow-rules.js.map +1 -0
  177. package/dist/sandbox/execpolicy.d.ts +45 -0
  178. package/dist/sandbox/execpolicy.js +80 -0
  179. package/dist/sandbox/execpolicy.js.map +1 -1
  180. package/dist/sandbox/os-sandbox.d.ts +25 -0
  181. package/dist/sandbox/os-sandbox.js +73 -0
  182. package/dist/sandbox/os-sandbox.js.map +1 -1
  183. package/dist/security/security-audit.d.ts +10 -0
  184. package/dist/security/security-audit.js +116 -0
  185. package/dist/security/security-audit.js.map +1 -1
  186. package/dist/security/shell-env-policy.d.ts +45 -0
  187. package/dist/security/shell-env-policy.js +141 -0
  188. package/dist/security/shell-env-policy.js.map +1 -0
  189. package/dist/security/ssrf-guard.d.ts +61 -0
  190. package/dist/security/ssrf-guard.js +382 -0
  191. package/dist/security/ssrf-guard.js.map +1 -0
  192. package/dist/security/write-policy.d.ts +57 -0
  193. package/dist/security/write-policy.js +117 -0
  194. package/dist/security/write-policy.js.map +1 -0
  195. package/dist/services/prompt-builder.js +37 -0
  196. package/dist/services/prompt-builder.js.map +1 -1
  197. package/dist/themes/theme-schema.d.ts +10 -10
  198. package/dist/tools/ask-human-tool.d.ts +62 -0
  199. package/dist/tools/ask-human-tool.js +112 -0
  200. package/dist/tools/ask-human-tool.js.map +1 -0
  201. package/dist/tools/bash/bash-tool.d.ts +15 -0
  202. package/dist/tools/bash/bash-tool.js +62 -0
  203. package/dist/tools/bash/bash-tool.js.map +1 -1
  204. package/dist/tools/bash/command-validator.d.ts +1 -0
  205. package/dist/tools/bash/command-validator.js +5 -0
  206. package/dist/tools/bash/command-validator.js.map +1 -1
  207. package/dist/tools/create-skill-tool.d.ts +87 -0
  208. package/dist/tools/create-skill-tool.js +142 -0
  209. package/dist/tools/create-skill-tool.js.map +1 -0
  210. package/dist/tools/fetch-tool.js +5 -3
  211. package/dist/tools/fetch-tool.js.map +1 -1
  212. package/dist/tools/hooks/default-hooks.js +24 -23
  213. package/dist/tools/hooks/default-hooks.js.map +1 -1
  214. package/dist/tools/index.d.ts +1 -0
  215. package/dist/tools/index.js +1 -0
  216. package/dist/tools/index.js.map +1 -1
  217. package/dist/tools/plan-tool.d.ts +22 -0
  218. package/dist/tools/plan-tool.js +128 -0
  219. package/dist/tools/plan-tool.js.map +1 -0
  220. package/dist/tools/registry/attention-tools.d.ts +32 -0
  221. package/dist/tools/registry/attention-tools.js +225 -0
  222. package/dist/tools/registry/attention-tools.js.map +1 -0
  223. package/dist/tools/registry/index.d.ts +9 -1
  224. package/dist/tools/registry/index.js +30 -2
  225. package/dist/tools/registry/index.js.map +1 -1
  226. package/dist/tools/registry/knowledge-tools.d.ts +46 -0
  227. package/dist/tools/registry/knowledge-tools.js +293 -0
  228. package/dist/tools/registry/knowledge-tools.js.map +1 -0
  229. package/dist/tools/registry/lessons-tools.d.ts +48 -0
  230. package/dist/tools/registry/lessons-tools.js +359 -0
  231. package/dist/tools/registry/lessons-tools.js.map +1 -0
  232. package/dist/tools/registry/plan-tools.d.ts +2 -0
  233. package/dist/tools/registry/plan-tools.js +7 -0
  234. package/dist/tools/registry/plan-tools.js.map +1 -0
  235. package/dist/tools/registry/script-tools.d.ts +2 -0
  236. package/dist/tools/registry/script-tools.js +7 -0
  237. package/dist/tools/registry/script-tools.js.map +1 -0
  238. package/dist/tools/registry/tool-aliases.d.ts +44 -0
  239. package/dist/tools/registry/tool-aliases.js +130 -0
  240. package/dist/tools/registry/tool-aliases.js.map +1 -0
  241. package/dist/tools/run-script-tool.d.ts +13 -0
  242. package/dist/tools/run-script-tool.js +146 -0
  243. package/dist/tools/run-script-tool.js.map +1 -0
  244. package/dist/tools/web-search.d.ts +25 -0
  245. package/dist/tools/web-search.js +68 -6
  246. package/dist/tools/web-search.js.map +1 -1
  247. package/dist/utils/config-validation/schema.d.ts +2 -2
  248. package/dist/utils/debug-logger.d.ts +1 -1
  249. package/dist/utils/rtk-compressor.d.ts +13 -10
  250. package/dist/utils/rtk-compressor.js +83 -34
  251. package/dist/utils/rtk-compressor.js.map +1 -1
  252. package/dist/utils/stable-json.d.ts +27 -0
  253. package/dist/utils/stable-json.js +50 -0
  254. package/dist/utils/stable-json.js.map +1 -0
  255. package/dist/webhooks/webhook-manager.d.ts +7 -0
  256. package/dist/webhooks/webhook-manager.js +29 -0
  257. package/dist/webhooks/webhook-manager.js.map +1 -1
  258. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Code Buddy
6
6
 
7
- ### Multi-AI Personal Assistant with OpenClaw-Inspired Architecture
7
+ ### Your AI-Powered Development Tool & Personal Assistant
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/@phuetz/code-buddy"><img src="https://img.shields.io/npm/v/@phuetz/code-buddy.svg?style=flat-square&color=ff6b6b&label=version" alt="npm version"/></a>
@@ -22,149 +22,62 @@
22
22
 
23
23
  <br/>
24
24
 
25
- **A powerful multi-AI terminal agent inspired by [OpenClaw](https://github.com/openclaw/openclaw) architecture. Supports Grok, Claude, ChatGPT, Gemini, LM Studio, and Ollama with advanced memory, multi-channel messaging, and intelligent context management.**
25
+ **A multi-AI terminal agent that writes code, runs commands, searches the web, talks to you, and manages your projects — from your terminal, your phone, or running 24/7 in the background.**
26
26
 
27
27
  <br/>
28
28
 
29
- [Quick Start](#-quick-start) |
29
+ [Quick Start](#quick-start) |
30
+ [Development Tool](#development-tool) |
31
+ [Personal Assistant](#personal-assistant) |
32
+ [Channels](#multi-channel-messaging) |
33
+ [Autonomous Agent](#autonomous-agent) |
34
+ [Security](#security--trust) |
30
35
  [CLI Reference](#cli-reference) |
31
- [Architecture](#-architecture) |
32
- [Channels](#-multi-channel-support) |
33
- [Security](#-security) |
34
- [API](#-api-server)
36
+ [API](#api-server--integrations)
35
37
 
36
38
  </div>
37
39
 
38
40
  ---
39
41
 
40
- ## What's New
41
-
42
- ### OpenClaw-Inspired Features
43
-
44
- Code Buddy incorporates advanced patterns from the [OpenClaw](https://github.com/openclaw/openclaw) project:
45
-
46
- | Module | Status | Description |
47
- |:-------|:------:|:------------|
48
- | **Tool Policy System** | ✅ 100% | Fine-grained tool permissions with allowlist/denylist |
49
- | **Bash Allowlist** | ✅ 100% | Secure command execution with pattern matching |
50
- | **Context Window Guard** | ✅ 100% | Automatic context management with 34 test cases |
51
- | **Smart Compaction** | 100% | Multi-stage conversation compression |
52
- | **Context Pruning** | 100% | TTL-based message expiration |
53
- | **Hybrid Search** | 100% | Combined keyword + semantic search |
54
- | **Lifecycle Hooks** | ✅ 100% | Pre/post hooks with 52 test cases |
55
- | **Connection Profiles** | ✅ 100% | Multi-provider switching with 57 tests |
56
- | **Desktop Automation** | 100% | Screen capture, OCR, UI control |
57
- | **Gemini Vision** | 100% | Native image support via `inlineData` (base64 data URLs) |
58
- | **Auto-Capture Memory** | 100% | Pattern-based memory extraction |
59
- | **Memory Lifecycle** | 100% | Auto-recall and auto-capture hooks |
60
-
61
- ### Phase 3Streaming & Security
62
-
63
- | Module | Status | Description |
64
- |:-------|:------:|:------------|
65
- | **Middleware Pipeline** | 100% | Composable before/after turn hooks (cost limit, context warning, turn limit) |
66
- | **Reasoning Events** | 100% | Streaming chain-of-thought display with collapsible UI |
67
- | **Trust Folders** | 100% | Directory-level tool permissions via `.codebuddy-trust.json` |
68
- | **Agent Profiles** | 100% | Predefined agent configs (secure, minimal, power-user) |
69
- | **Tool Streaming** | ✅ 100% | Real-time bash output via AsyncGenerator |
70
- | **TabbedQuestion UI** | ✅ 100% | Multi-option interactive prompts |
71
-
72
- ### Phase 4 — Autonomous Agent
73
-
74
- | Module | Status | Description |
75
- |:-------|:------:|:------------|
76
- | **Daemon Mode** | ✅ 100% | Background process with PID management, auto-restart (max 3) |
77
- | **Cron-Agent Bridge** | ✅ 100% | Scheduled task execution via CodeBuddyAgent instances |
78
- | **Task Planner** | ✅ 100% | DAG-based decomposition with topological sort and parallel execution |
79
- | **Screen Observer** | ✅ 100% | Periodic screenshots, perceptual diff, event triggers |
80
- | **Proactive Agent** | ✅ 100% | Push notifications, question/response, rate limiting, quiet hours |
81
- | **Orchestrator** | ✅ 100% | Multi-agent supervisor (sequential/parallel/race/all strategies) |
82
- | **Self-Healing** | ✅ 100% | Error pattern recognition, auto-recovery with exponential backoff |
83
- | **Checkpoint Rollback** | ✅ 100% | Auto-checkpoint before risky ops, rollback to last good state |
84
- | **Shared Context** | ✅ 100% | Thread-safe key-value store with optimistic locking |
85
-
86
- ### Phase 5 — OpenClaw-Inspired Platform
87
-
88
- | Module | Status | Description |
89
- |:-------|:------:|:------------|
90
- | **Doctor Command** | ✅ 100% | Environment/deps/config diagnostics (`buddy doctor`) |
91
- | **Onboarding Wizard** | ✅ 100% | Interactive setup wizard (`buddy onboard`) |
92
- | **Model Failover Chain** | ✅ 100% | Cascading provider fallback with health tracking |
93
- | **Webhook Triggers** | ✅ 100% | HMAC-verified HTTP triggers + CLI + API routes |
94
- | **Typing Indicators** | ✅ 100% | Presence & typing events for channels |
95
- | **Live Canvas** | ✅ 100% | WebSocket-driven visual workspace (A2UI) |
96
- | **Docker Sandbox** | ✅ 100% | Containerized command execution with resource limits |
97
- | **Skills Registry** | ✅ 100% | Bundled/managed/workspace skills with YAML frontmatter |
98
- | **Media Pipeline** | ✅ 100% | Ingest, track, transcode with transcription hooks |
99
- | **ACP Protocol** | ✅ 100% | Inter-agent communication router with request/response |
100
- | **Extension System** | ✅ 100% | Manifest-based plugin loader with lifecycle hooks |
101
- | **Copilot Proxy** | ✅ 100% | IDE-compatible completions backend (`/v1/completions`) |
102
-
103
- ### Phase 6 — Robustness & Developer Experience
104
-
105
- | Module | Status | Description |
106
- |:-------|:------:|:------------|
107
- | **Web Search 5-Provider Chain** | ✅ 100% | Brave MCP → Brave API → Perplexity → Serper → DuckDuckGo with country/freshness/lang |
108
- | **Apply Patch Tool** | ✅ 100% | Unified diff parser and applier with fuzz factor (Codex-inspired) |
109
- | **Bash Parser** | ✅ 100% | AST-based command parsing via tree-sitter-bash with state-machine fallback |
110
- | **Per-Model Tool Config** | ✅ 100% | Capabilities, context window, patch format per model family |
111
- | **Head/Tail Truncation** | ✅ 100% | Smart output truncation keeping start + end of large results |
112
- | **Session Locks** | ✅ 100% | PID-based file locking with stale detection |
113
- | **Skill Scanner** | ✅ 100% | Static analysis of SKILL.md files for dangerous patterns (24 rules) |
114
- | **History Repair** | ✅ 100% | 5-pass self-repair for malformed LLM message sequences |
115
- | **Cache Trace** | ✅ 100% | Debug prompt construction stages (`CACHE_TRACE=true`) |
116
- | **Turn Diff Tracker** | ✅ 100% | Per-turn file change tracking with rollback capability |
117
- | **MCP Predefined Servers** | ✅ 100% | Brave Search, Playwright, Exa pre-configured in MCP |
118
- | **Headless Mode Fixes** | ✅ 100% | Clean JSON stdout, `process.exit(0)`, Gemini message sanitization |
119
- | **Gemini Conversation Repair** | ✅ 100% | 3-pass sanitization after context compression (orphan cleanup, role merge, user-start) |
120
-
121
- ### Phase 7 — Code Generation Security
122
-
123
- | Module | Status | Description |
124
- |:-------|:------:|:------------|
125
- | **Centralized Dangerous Patterns** | ✅ 100% | Single registry for all dangerous patterns (bash, code, skills) with severity levels |
126
- | **Generated Code Validator** | ✅ 100% | Pre-write security scan for eval, XSS, SQL injection, hardcoded secrets, prototype pollution |
127
- | **Pre-Write Syntax Validator** | ✅ 100% | Balanced delimiters, template literals, indentation (JS/TS/Python/YAML/HTML/CSS/JSON) |
128
- | **Atomic Rollback (apply-patch)** | ✅ 100% | All-or-nothing patch application with full file state backup |
129
- | **Atomic Transactions (multi-edit)** | ✅ 100% | Multi-file edits rolled back on first failure |
130
- | **AST Bash Command Validation** | ✅ 100% | tree-sitter integration in command validator with centralized pattern checks |
131
- | **Bash Checkpoint** | ✅ 100% | Pre-snapshot of files targeted by destructive commands (rm, mv, truncate) |
132
- | **Shell Injection Fix** | ✅ 100% | Code formatter uses `spawnSync` stdin pipe instead of `execSync` echo |
133
- | **Diff Preview in Confirmation** | ✅ 100% | Shows actual diffs before approval, magnitude-based re-confirmation for large changes |
134
- | **Architect Parallel Execution** | ✅ 100% | Dependency-wave-based parallel step execution with DAG ordering |
135
- | **Semantic Truncation** | ✅ 100% | Error-preserving output truncation (keeps error lines, stack traces from middle sections) |
136
- | **Auto-Sandbox Router** | ✅ 100% | Automatic Docker routing for dangerous commands (npm, pip, cargo, make) |
137
- | **Security Audit Logging** | ✅ 100% | JSONL audit trail for all code generation security decisions |
138
- | **Copilot Proxy Hardening** | ✅ 100% | Per-IP rate limiting, token clamping, auth bypass fix, sanitized error messages |
139
-
140
- ### Phase 8 — OpenClaw Parity (Final)
141
-
142
- | Module | Status | Description |
143
- |:-------|:------:|:------------|
144
- | **Skills Auto-Discovery** | ✅ 100% | Agent auto-finds/installs skills from hub when tool confidence is low |
145
- | **Device Node Connectors** | ✅ 100% | Real SSH, ADB, and local transports with platform-specific commands |
146
- | **Canvas Bidirectional Events** | ✅ 100% | Browser→agent event routing, data binding observers, state queries |
147
-
148
- ### Phase 9 — External Tool Integration
149
-
150
- | Module | Status | Description |
151
- |:-------|:------:|:------------|
152
- | **RTK Output Compressor** | ✅ 100% | [RTK](https://github.com/rtk-ai/rtk) integration — compresses bash output 60-90% via format-aware parsing, reducing token usage |
153
- | **ICM Memory Bridge** | ✅ 100% | [ICM](https://github.com/rtk-ai/icm) MCP server — persistent cross-session memory with episodic + semantic dual architecture |
154
- | **RTK Tool Hook** | ✅ 100% | After-hook at priority 90 auto-compresses bash results > 500 chars (configurable) |
155
- | **ICM MCP Predefined Server** | ✅ 100% | Pre-configured `icm mcp` stdio transport in MCP predefined servers |
156
- | **Integrations Config** | ✅ 100% | New `[integrations]` TOML section for RTK/ICM enable/disable and thresholds |
157
- | **Doctor RTK/ICM Checks** | ✅ 100% | `buddy doctor` reports RTK and ICM binary availability |
42
+ ## What is Code Buddy?
43
+
44
+ Code Buddy is an open-source multi-provider AI coding agent that runs in your terminal. It supports **Grok, Claude, ChatGPT, Gemini, LM Studio, and Ollama** via OpenAI-compatible APIs and provider-specific SDKs.
45
+
46
+ It works as two things at once:
47
+
48
+ - **A development tool** reads files, writes code, runs commands, creates PRs, plans complex tasks, and fixes its own mistakes across 5-50 tool calls per task.
49
+ - **A personal assistant** — talks to you by voice, remembers your preferences, monitors your screen, sends notifications to your phone via Telegram/Discord/Slack, and runs scheduled tasks 24/7 in the background.
50
+
51
+ **Key highlights:**
52
+ - 6 AI providers with automatic failover
53
+ - 40 bundled skills (PR workflow, DevOps, creative tools, smart home, media)
54
+ - 11 messaging channels (Terminal, Telegram, Discord, Slack, WhatsApp, Signal, Teams, Matrix, Google Chat, WebChat, HTTP API)
55
+ - Daemon mode for 24/7 background operation
56
+ - Multi-agent orchestration with self-healing
57
+ - Voice conversation with wake word detection
58
+ - OS sandbox with workspace-write mode (read-only / workspace-write / danger-full-access tiers)
59
+ - Docker sandbox for untrusted code execution
60
+ - Knowledge base injection (Knowledge.md files loaded into agent system prompt)
61
+ - Wide Research mode (parallel sub-agents decompose and research topics concurrently)
62
+ - Todo.md attention bias (task list appended to end of every LLM context turn — Manus AI pattern)
63
+ - Lessons.md self-improvement loop (PATTERN/RULE/CONTEXT/INSIGHT lessons injected before every turn persists corrections across sessions)
64
+ - Workflow orchestration rules in system prompt (concrete plan triggers, auto-correction protocol, verification contract)
65
+ - Restorable context compression (identifiers preserved, full content recoverable on demand)
66
+ - Pre-compaction memory flush (facts saved to MEMORY.md before context is compacted — OpenClaw pattern)
67
+ - Anthropic prompt cache breakpoints (stable/dynamic split 10× token cost savings)
68
+ - Per-channel streaming policies (Telegram, Discord, Slack, WhatsApp each get their own chunking/format rules)
69
+ - SSRF guard on all outbound fetches (IPv4 + IPv6 bypass vector blocking)
70
+ - Tool prefix naming convention (`shell_exec`, `file_read`, `browser_search`, Codex-style canonical aliases)
158
71
 
159
72
  ---
160
73
 
161
- ## Installation
74
+ ## Quick Start
162
75
 
163
76
  ### Prerequisites
164
77
 
165
78
  - **Node.js** 18.0.0 or higher
166
79
  - **ripgrep** (recommended for faster search)
167
- - **tree-sitter** + **tree-sitter-bash** (optional, for AST-based bash command parsing)
80
+ - **Docker** (required for CodeAct / Open Manus mode)
168
81
 
169
82
  ```bash
170
83
  # macOS
@@ -175,12 +88,9 @@ sudo apt-get install ripgrep
175
88
 
176
89
  # Windows
177
90
  choco install ripgrep
178
-
179
- # Optional: tree-sitter for enhanced bash security parsing
180
- npm install tree-sitter tree-sitter-bash
181
91
  ```
182
92
 
183
- ### Install Code Buddy
93
+ ### Install
184
94
 
185
95
  ```bash
186
96
  # npm (recommended)
@@ -190,9 +100,7 @@ npm install -g @phuetz/code-buddy
190
100
  npx @phuetz/code-buddy@latest
191
101
  ```
192
102
 
193
- ---
194
-
195
- ## Quick Start
103
+ ### First Run
196
104
 
197
105
  ```bash
198
106
  # Configure API key (Grok/xAI)
@@ -277,210 +185,190 @@ Code Buddy autonomously reads files, writes code, runs commands, and fixes error
277
185
 
278
186
  ---
279
187
 
280
- ## Architecture
188
+ ## Development Tool
281
189
 
282
- Code Buddy uses a **facade architecture** for clean separation of concerns:
190
+ ### Agentic Coding
283
191
 
284
- ```
285
- CodeBuddyAgent
286
-
287
- ├── AgentContextFacade # Context window and memory management
288
- │ - Token counting, compression, memory retrieval
289
-
290
- ├── SessionFacade # Session persistence and checkpoints
291
- │ - Save/load, checkpoint creation, rewind
292
-
293
- ├── ModelRoutingFacade # Model routing and cost tracking
294
- │ - Provider selection, cost calculation
295
-
296
- ├── InfrastructureFacade # MCP, sandbox, hooks, plugins
297
- │ - Hook execution, plugin loading
298
-
299
- └── MessageHistoryManager # Chat and LLM message history
300
- ```
192
+ Code Buddy operates as an autonomous coding agent. It reads your codebase, makes changes, runs commands, and iterates until the task is done.
301
193
 
302
- ### Autonomy Layer (Phase 4)
194
+ **Built-in tools:**
303
195
 
304
- ```
305
- CodeBuddyAgent
306
-
307
- ├── TaskPlanner # DAG decomposition of complex requests
308
- │ - needsPlanning() heuristic
309
- │ - createPlan() TaskGraph parallel execution
310
-
311
- ├── SupervisorAgent # Multi-agent orchestration
312
- │ - Sequential, parallel, race, all strategies
313
- │ - SharedContext with optimistic locking
314
-
315
- ├── SelfHealing # Automatic error recovery
316
- - Pattern recognition (6 built-in patterns)
317
- - Retry with exponential backoff
318
-
319
- ├── ScreenObserver # Environment monitoring
320
- │ - Periodic screenshots with perceptual diff
321
- │ - Event triggers (file_change, screen_change, time, webhook)
322
-
323
- ├── ProactiveAgent # Agent-initiated communication
324
- │ - Push notifications with priority levels
325
- │ - Rate limiting and quiet hours
326
-
327
- └── DaemonManager # Background process lifecycle
328
- - PID file management, auto-restart
329
- - Service registry, health monitoring
330
- ```
196
+ | Category | Tools |
197
+ |:---------|:------|
198
+ | **File Operations** | `view_file`, `create_file`, `str_replace_editor`, `edit_file`, `multi_edit` |
199
+ | **Search** | `search`, `codebase_map` |
200
+ | **System** | `bash`, `docker`, `kubernetes` |
201
+ | **CodeAct** | `run_script` (Python/JS/TS in Docker), `plan` (Persistent Planner) |
202
+ | **Web** | `web_search`, `web_fetch`, `browser` |
203
+ | **Patching** | `apply_patch` (unified diff with fuzz factor, Codex-inspired) |
204
+ | **Planning** | `create_todo_list`, `get_todo_list`, `update_todo_list` |
205
+ | **Media** | `screenshot`, `audio`, `video`, `ocr`, `clipboard` |
206
+ | **Documents** | `pdf`, `document`, `archive` |
207
+ | **Knowledge** | `knowledge_search`, `knowledge_add` — search/add knowledge base entries |
208
+ | **Human Input** | `ask_human` — pause execution for mid-task user clarification (120s timeout) |
209
+ | **Self-Extension** | `create_skill` write new SKILL.md files at runtime (self-authoring) |
210
+ | **Self-Improvement** | `lessons_add`, `lessons_search`, `lessons_list` — persist and recall learned patterns across sessions |
211
+ | **Verification** | `task_verify` — run tsc/tests/lint before marking tasks complete (Verification Contract) |
331
212
 
332
- ### Core Flow
213
+ **RAG-based tool selection** filters tools per query to reduce prompt tokens — only relevant tools are included in each API call.
333
214
 
334
- ```
335
- User Input → ChatInterface (Ink/React) → CodeBuddyAgent → AI Provider
336
-
337
- Tool Calls (max 50/400 rounds)
338
-
339
- Tool Execution + Confirmation
340
-
341
- Results back to API (loop)
342
- ```
215
+ ### Code Intelligence
343
216
 
344
- ---
217
+ **Web Search (5-Provider Fallback Chain):**
345
218
 
346
- ## CLI Reference
219
+ | Priority | Provider | API Key Required | Features |
220
+ |:---------|:---------|:-----------------|:---------|
221
+ | 1 | **Brave MCP** | `BRAVE_API_KEY` + MCP enabled | Full MCP integration, richest results |
222
+ | 2 | **Brave API** | `BRAVE_API_KEY` | Country, language, freshness filters |
223
+ | 3 | **Perplexity** | `PERPLEXITY_API_KEY` or `OPENROUTER_API_KEY` | AI-synthesized answers with citations |
224
+ | 4 | **Serper** | `SERPER_API_KEY` | Google Search results |
225
+ | 5 | **DuckDuckGo** | None | Free fallback (no API key needed) |
347
226
 
348
- ### Global Options
227
+ Search parameters: `country` (ISO 3166), `search_lang`, `ui_lang`, `freshness` (`pd`/`pw`/`pm`/`py` or date range), `provider` (force specific).
349
228
 
350
- | Flag | Short | Description | Default |
351
- |:-----|:------|:------------|:--------|
352
- | `--version` | `-V` | Show version number | - |
353
- | `--directory <dir>` | `-d` | Set working directory | `.` |
354
- | `--api-key <key>` | `-k` | API key (or `GROK_API_KEY` env) | - |
355
- | `--base-url <url>` | `-u` | API base URL (or `GROK_BASE_URL` env) | - |
356
- | `--model <model>` | `-m` | AI model to use (or `GROK_MODEL` env) | auto-detect |
357
- | `--prompt <prompt>` | `-p` | Single prompt, headless mode | - |
358
- | `--browser` | `-b` | Launch browser UI instead of terminal | `false` |
359
- | `--max-tool-rounds <n>` | | Max tool execution rounds | `400` |
360
- | `--security-mode <mode>` | `-s` | `suggest`, `auto-edit`, or `full-auto` | `suggest` |
361
- | `--output-format <fmt>` | `-o` | Headless output: `json`, `stream-json`, `text`, `markdown` | `json` |
362
- | `--context <patterns>` | `-c` | Glob patterns to load into context | - |
229
+ **Context management** uses smart multi-stage compaction (remove stale tool results, summarize older messages, aggressive truncation) to keep conversations within token limits across long sessions.
363
230
 
364
- ### Session & Cost
231
+ **Hybrid search** combines keyword + semantic search with configurable weights for memory retrieval.
365
232
 
366
- | Flag | Description | Default |
367
- |:-----|:------------|:--------|
368
- | `--continue` | Resume the most recent saved session | - |
369
- | `--resume <id>` | Resume a specific session (supports partial ID matching) | - |
370
- | `--max-price <dollars>` | Maximum cost in dollars before stopping | `10.0` |
371
- | `--no-cache` | Disable response caching | - |
233
+ ### 🚀 Open Manus Features (CodeAct)
372
234
 
373
- ### Autonomy & Permissions
235
+ Code Buddy implements the **Open Manus / CodeAct** architecture in a structured, phased approach, allowing it to write and execute code (Python, TypeScript, Node.js) in a secure Docker sandbox instead of relying solely on pre-defined tools.
374
236
 
375
- | Flag | Description | Default |
376
- |:-----|:------------|:--------|
377
- | `--auto-approve` | Automatically approve all tool executions | `false` |
378
- | `--dangerously-skip-permissions` | Bypass all permission checks (trusted containers only) | `false` |
379
- | `--no-self-heal` | Disable self-healing auto-correction | - |
380
- | `--allow-outside` | Allow file operations outside workspace directory | `false` |
237
+ **Phase 1: Sandboxed Execution (Hybrid Agent)**
238
+ * **RunScriptTool:** Writes and runs scripts in ephemeral Docker containers (`ubuntu:latest`, `node:22-slim`, `python:3.11-slim`).
239
+ * **Browser Automation:** Uses `Playwright` in Docker to scrape websites, interact with SPAs, and take screenshots programmatically.
240
+ * **Safety First:** Timeout (120s), Memory Limit (1GB), and ephemeral containers prevent runaway processes.
381
241
 
382
- ### Tool Control
242
+ **Phase 2: Persistent State & Planning**
243
+ * **Persistent Workspace:** Files created in `.codebuddy/workspace` persist between script executions, allowing multi-step workflows (e.g., scrape → save CSV → analyze CSV → plot chart).
244
+ * **PlanTool:** The agent maintains a `PLAN.md` file in your project root to track complex, multi-step objectives statefully.
245
+ * **Structured Loop:** The system prompt enforces a strict **PLAN → THINK → CODE → OBSERVE → UPDATE** cognitive cycle to prevent chaotic behavior.
383
246
 
384
- | Flag | Description | Example |
385
- |:-----|:------------|:--------|
386
- | `--force-tools` | Force-enable function calling for local models | - |
387
- | `--probe-tools` | Auto-detect tool support at startup | - |
388
- | `--enabled-tools <patterns>` | Only enable matching tools (glob, comma-separated) | `bash,*file*,search` |
389
- | `--disabled-tools <patterns>` | Disable matching tools (glob, comma-separated) | `bash,web_*` |
390
- | `--allowed-tools <patterns>` | Alias for `--enabled-tools` (Claude Code compat) | - |
247
+ **Phase 3: Wide Research (Parallel Agents)**
248
+ * **WideResearchOrchestrator:** Decomposes a topic into N independent subtopics via LLM, spawns N parallel CodeBuddyAgent workers (default: 5, max: 20), then aggregates results into a single comprehensive report.
249
+ * **Progress streaming:** Emits real-time events as each worker completes.
250
+ * **CLI:** `buddy research "quantum computing breakthroughs" --workers 8 --output report.md`
391
251
 
392
- ### Agent & Prompt Configuration
252
+ **Phase 4: Context Engineering (Manus AI + OpenClaw patterns)**
393
253
 
394
- | Flag | Description | Default |
395
- |:-----|:------------|:--------|
396
- | `--system-prompt <id>` | System prompt: `default`, `minimal`, `secure`, `code-reviewer`, `architect` (or custom from `~/.codebuddy/prompts/`) | `default` |
397
- | `--list-prompts` | List available system prompts and exit | - |
398
- | `--agent <name>` | Use a custom agent from `~/.codebuddy/agents/` | - |
399
- | `--list-agents` | List available custom agents and exit | - |
254
+ * **Todo.md Attention Bias** The agent maintains a `todo.md` task list that is automatically appended at the **end** of the LLM context on every turn. Because transformers attend more strongly to recent tokens, this keeps objectives in focus across long sessions without modifying the system prompt. Use `buddy todo add/done/list` or the `todo_update` tool.
255
+ * **Restorable Compression** — When the context window is compressed, file paths and URLs are extracted as identifiers and the original content is stored. The agent can call `restore_context("src/agent/types.ts")` to retrieve the full content on demand, making compression lossless for structured identifiers.
256
+ * **Pre-compaction Memory Flush (NO_REPLY)** Before compaction triggers, a silent background LLM turn extracts durable facts and saves them to `MEMORY.md`. If the model returns the `NO_REPLY` sentinel with no meaningful content, the output is suppressed entirely (no notification spam).
257
+ * **Inline Citations** — Web search results now include `[1]` `[2]` citation markers inline and a **Sources** block listing all referenced URLs.
258
+ * **Lessons.md Self-Improvement Loop** After any user correction, the agent calls `lessons_add` to persist the lesson (category: PATTERN, RULE, CONTEXT, or INSIGHT) to `.codebuddy/lessons.md`. On every turn, active lessons are injected as a `<lessons_context>` block BEFORE the todo suffix so learned patterns are always visible. Use `buddy lessons add/search/list` or the `lessons_add`/`lessons_search` tools. The `task_verify` tool runs the **Verification Contract** (tsc + tests + lint) before any task completion.
400
259
 
401
- ### Display & Debugging
260
+ **Example Prompts:**
402
261
 
403
- | Flag | Description |
404
- |:-----|:------------|
405
- | `--plain` | Minimal formatting (plain text output) |
406
- | `--no-color` | Disable colored output |
407
- | `--no-emoji` | Disable emoji in output |
408
- | `--vim` | Enable Vim keybindings for input |
409
- | `--mcp-debug` | Enable MCP protocol debugging output |
262
+ ```bash
263
+ > "Go to Google News, scrape the top headlines about AI, save them to a CSV, and then use Python to analyze the sentiment."
264
+ > "Write a script to check broken links on my documentation site."
265
+ > "Calculate the Fibonacci sequence up to 1000 and plot the growth rate."
266
+ ```
410
267
 
411
- ### Setup & Init
268
+ ### 🧬 Roots & Comparison
412
269
 
413
- | Flag | Description |
414
- |:-----|:------------|
415
- | `--init` | Initialize `.codebuddy/` directory with templates |
416
- | `--dry-run` | Preview changes without applying (simulation mode) |
417
- | `--setup` | Run interactive API key setup wizard |
418
- | `--list-models` | List available models from the API and exit |
270
+ Code Buddy is an evolution of the **OpenClaw** architecture, modernized for the TypeScript ecosystem and enhanced with **Open Manus** (CodeAct) autonomy.
419
271
 
420
- ---
272
+ | Feature | OpenClaw | Code Buddy | Open Manus |
273
+ |:---|:---|:---|:---|
274
+ | **Language** | Python | **TypeScript / Node.js** | Python |
275
+ | **Philosophy** | Tool-Based | **Hybrid (Tool + CodeAct)** | Pure CodeAct |
276
+ | **Messaging** | Multi-channel | **11+ Channels (Telegram focus)** | Web Interface |
277
+ | **Task State** | Heartbeat | **Persistent PLAN.md + Workspace** | Transient Session |
278
+ | **Concurrency** | Lane Queue | **Advanced Lane Queue + DAG** | Sequential |
279
+ | **Extensibility** | SKILL.md | **Skills Hub + Plugins + MCP** | Custom Scripts |
421
280
 
422
- ## AI Providers
281
+ **Why Code Buddy?**
282
+ It combines the **industrial-grade reliability** of OpenClaw (concurrency control, security policies, multi-channel messaging) with the **infinite flexibility** of Open Manus (dynamic script generation and execution).
423
283
 
424
- Code Buddy supports multiple AI providers with automatic failover:
284
+ > **Manus AI influence:** Wide Research (parallel sub-agent research workers), Knowledge Base injection, **todo.md attention bias** (task list at end of context each turn), and **restorable context compression** (identifier-based content recovery) are all inspired by Manus AI's context engineering research. The **pre-compaction NO_REPLY flush** pattern is from OpenClaw's compaction documentation.
425
285
 
426
- | Provider | Models | Context | Configuration |
427
- |:---------|:-------|:--------|:--------------|
428
- | **Grok** (xAI) | grok-4, grok-code-fast-1 | 128K | `GROK_API_KEY` |
429
- | **Claude** (Anthropic) | claude-sonnet-4, opus | 200K | `ANTHROPIC_API_KEY` |
430
- | **ChatGPT** (OpenAI) | gpt-4o, gpt-4-turbo | 128K | `OPENAI_API_KEY` |
431
- | **Gemini** (Google) | gemini-2.0-flash (+ vision) | 2M | `GOOGLE_API_KEY` |
432
- | **LM Studio** | Any local model | Varies | `--base-url http://localhost:1234/v1` |
433
- | **Ollama** | llama3, codellama, etc. | Varies | `--base-url http://localhost:11434/v1` |
286
+ ### Code Safety
434
287
 
435
- ### Connection Profiles
288
+ Code Buddy validates everything before it touches your files:
436
289
 
437
- Switch between providers using CLI options or configuration:
290
+ | Feature | Description |
291
+ |:--------|:------------|
292
+ | **Generated Code Validator** | Pre-write scan for eval, XSS, SQL injection, hardcoded secrets, prototype pollution |
293
+ | **Pre-Write Syntax Validator** | Balanced delimiters, template literals, indentation (JS/TS/Python/YAML/HTML/CSS/JSON) |
294
+ | **Atomic Rollback (apply-patch)** | All-or-nothing patch application with full file state backup |
295
+ | **Atomic Transactions (multi-edit)** | Multi-file edits rolled back on first failure |
296
+ | **AST Bash Validation** | tree-sitter-based command parsing with centralized dangerous pattern checks |
297
+ | **Bash Checkpoints** | Pre-snapshot of files targeted by destructive commands (rm, mv, truncate) |
298
+ | **Diff Preview** | Shows actual diffs before approval, magnitude-based re-confirmation for large changes |
299
+ | **Semantic Truncation** | Error-preserving output truncation (keeps error lines and stack traces) |
300
+ | **Security Audit Logging** | JSONL audit trail for all code generation security decisions |
438
301
 
439
- ```bash
440
- # Use LM Studio (local)
441
- buddy --base-url http://localhost:1234/v1 --api-key lm-studio
302
+ ### Task Planning
442
303
 
443
- # Use Ollama (local)
444
- buddy --base-url http://localhost:11434/v1 --model llama3
304
+ For complex multi-step requests, Code Buddy decomposes work into a **DAG (directed acyclic graph)** and executes steps in parallel where possible.
445
305
 
446
- # Use a specific model
447
- buddy --model grok-code-fast-1
448
- ```
306
+ - **TaskPlanner** — `needsPlanning()` heuristic detects complex requests, `createPlan()` produces a TaskGraph
307
+ - **Topological sort** — determines execution order with dependency tracking
308
+ - **Parallel execution** — independent steps run concurrently via dependency waves
309
+ - **Architect mode** — `--system-prompt architect` enables plan-first coding with per-step checkpoints
449
310
 
450
- ### Profile Configuration
311
+ ### CI/CD Integration
312
+
313
+ | Feature | Description |
314
+ |:--------|:------------|
315
+ | **CI Watcher** | GitHub Actions / GitLab CI / Jenkins alerts with "Fix it" auto-agent |
316
+ | **Webhook Triggers** | HMAC-SHA256 verified HTTP triggers — connect CI, monitoring, or any service |
317
+ | **Headless Mode** | `buddy -p "run tests and fix failures" --dangerously-skip-permissions` for CI pipelines |
318
+
319
+ ### Git Workflow
320
+
321
+ Code Buddy handles the full Git lifecycle through natural language:
451
322
 
452
- ```json
453
- // ~/.codebuddy/user-settings.json
454
- {
455
- "connection": {
456
- "activeProfileId": "grok",
457
- "profiles": [
458
- {
459
- "id": "grok",
460
- "name": "Grok API (xAI)",
461
- "provider": "grok",
462
- "baseURL": "https://api.x.ai/v1",
463
- "model": "grok-4-latest"
464
- },
465
- {
466
- "id": "lmstudio",
467
- "name": "LM Studio Local",
468
- "provider": "lmstudio",
469
- "baseURL": "http://localhost:1234/v1",
470
- "apiKey": "lm-studio"
471
- }
472
- ]
473
- }
474
- }
475
323
  ```
324
+ > "Create a PR for the auth changes"
325
+ > "Review the open PRs"
326
+ > "Fix the merge conflicts on feature-branch"
327
+ > "Commit everything with a good message"
328
+ ```
329
+
330
+ **Telegram enhanced commands** for remote Git operations:
331
+
332
+ | Command | Description |
333
+ |:--------|:------------|
334
+ | `/repo` | Repository info, recent commits, open PRs |
335
+ | `/branch [name]` | Branch diff stats vs main |
336
+ | `/pr [number]` | List or view PRs with merge/review buttons |
476
337
 
477
338
  ---
478
339
 
479
- ## Memory System
340
+ ## Personal Assistant
341
+
342
+ ### Voice Conversation
480
343
 
481
- Code Buddy features a sophisticated memory system inspired by OpenClaw:
344
+ Full hands-free voice interaction with wake word detection:
482
345
 
483
- ### Three Memory Subsystems
346
+ ```bash
347
+ buddy speak "Hello, I am Code Buddy" # Synthesize and play speech
348
+ buddy speak --voice af_bella "Hello world" # Use a specific voice
349
+ buddy speak --list-voices # List available voices
350
+ buddy speak --speed 1.5 "Fast speech" # Adjust speed (0.25-4.0)
351
+ buddy speak --format mp3 "Hello" # Output format (wav, mp3)
352
+ buddy speak --url http://host:8000 "Hello" # Custom AudioReader URL
353
+ ```
354
+
355
+ **7 TTS providers:** Edge TTS, espeak, macOS `say`, Piper, OpenAI, ElevenLabs, AudioReader (Kokoro-82M local)
356
+
357
+ **In-chat voice commands:**
358
+
359
+ | Command | Description |
360
+ |:--------|:------------|
361
+ | `/speak <text>` | Speak text with current TTS provider |
362
+ | `/tts on\|off` | Enable/disable TTS |
363
+ | `/tts auto` | Auto-speak all agent responses |
364
+ | `/tts provider audioreader` | Switch to AudioReader (Kokoro-82M, local, free) |
365
+ | `/tts voice ff_siwis` | Set voice (e.g., `ff_siwis` FR, `af_bella` EN) |
366
+
367
+ **Wake word detection** via Porcupine (Picovoice) with text-match fallback. Set `PICOVOICE_ACCESS_KEY` for hardware-accelerated detection, or use the built-in text matcher for free.
368
+
369
+ **Infinite voice conversation:** Enable `continuousListening` + `autoSpeak` with AudioReader for a hands-free loop: listen → STT → agent → TTS → listen.
370
+
371
+ ### Memory System
484
372
 
485
373
  | Subsystem | Storage | Purpose |
486
374
  |:----------|:--------|:--------|
@@ -489,12 +377,9 @@ Code Buddy features a sophisticated memory system inspired by OpenClaw:
489
377
  | **Prospective Memory** | SQLite | Tasks, goals, reminders |
490
378
  | **ICM (optional)** | [ICM MCP server](https://github.com/rtk-ai/icm) | Persistent cross-session memory via episodic + semantic dual architecture |
491
379
 
492
- ### Auto-Capture (OpenClaw Pattern)
493
-
494
- Automatically detects and stores important information:
380
+ **Auto-capture** detects and stores important information from conversations:
495
381
 
496
- ```typescript
497
- // Detected patterns (English + French)
382
+ ```
498
383
  "Remember that..." → Stored as instruction
499
384
  "I prefer..." → Stored as preference
500
385
  "This project uses..." → Stored as project fact
@@ -502,220 +387,604 @@ Automatically detects and stores important information:
502
387
  "We decided to..." → Stored as decision
503
388
  ```
504
389
 
505
- ### Memory Lifecycle Hooks
506
-
507
- ```typescript
508
- // Before execution: Inject relevant memories
509
- beforeExecute(context) → { injectedContext, recalledMemories }
510
-
511
- // After response: Capture important info
512
- afterResponse(context) → { capturedCount, capturedMemories }
513
-
514
- // Session end: Summarize conversation
515
- sessionEnd(sessionId) → { summaryId, memoriesStored }
516
- ```
517
-
518
- ### Deduplication
519
-
520
- - Jaccard similarity threshold: 0.95
521
- - Hash-based recent capture cache
522
- - Automatic duplicate detection
523
-
524
- ---
525
-
526
- ## Multi-Channel Support
527
-
528
- Code Buddy supports multiple messaging channels:
529
-
530
- | Channel | Status | Features |
531
- |:--------|:------:|:---------|
532
- | **Terminal** | ✅ Full | Native CLI interface (Ink/React) |
533
- | **HTTP API** | ✅ Full | REST + WebSocket |
534
- | **WebChat** | ✅ Full | Built-in HTTP + WebSocket with browser UI |
535
- | **Discord** | 🟡 Base | Bot integration, slash commands |
536
- | **Telegram** | 🟡 Base | Bot API, message handlers |
537
- | **Slack** | 🟡 Base | Bolt framework, events |
538
- | **WhatsApp** | 🟡 Base | Baileys (QR pairing, media, reconnect) |
539
- | **Signal** | 🟡 Base | signal-cli REST API (polling, groups) |
540
- | **Google Chat** | 🟡 Base | Workspace API (JWT auth, webhook events) |
541
- | **Microsoft Teams** | 🟡 Base | Bot Framework (OAuth2, adaptive cards) |
542
- | **Matrix** | 🟡 Base | matrix-js-sdk (E2EE, threads, media) |
543
-
544
- ### Channel Configuration
545
-
546
- ```typescript
547
- // Enable Discord channel
548
- const discord = new DiscordChannel({
549
- token: process.env.DISCORD_TOKEN,
550
- allowedGuilds: ['guild-id'],
551
- });
552
- await discord.connect();
553
- ```
554
-
555
- ---
556
-
557
- ## Security
390
+ **Memory lifecycle hooks** inject relevant memories before execution, capture important info after responses, and summarize conversations at session end. Deduplication via Jaccard similarity (0.95 threshold) prevents duplicates.
558
391
 
559
- ### Tool Policy System
560
-
561
- Fine-grained control over tool execution:
562
-
563
- ```typescript
564
- const policy = new ToolPolicy({
565
- allowlist: ['read_file', 'search', 'web_fetch'],
566
- denylist: ['bash', 'write_file'],
567
- requireConfirmation: ['delete_file'],
568
- });
569
- ```
392
+ ### Knowledge Base
570
393
 
571
- ### Bash Allowlist
394
+ Domain knowledge injected into the agent system prompt at startup (`src/knowledge/knowledge-manager.ts`):
572
395
 
573
- Secure command execution:
396
+ * **Sources:** `Knowledge.md` (project root), `.codebuddy/knowledge/*.md` (project-level), `~/.codebuddy/knowledge/*.md` (global)
397
+ * **YAML frontmatter:** `title`, `tags`, `scope` (restrict to specific agent modes), `priority` (injection order)
398
+ * **Agent tools:** `knowledge_search` (keyword search across all entries), `knowledge_add` (persist new knowledge to disk)
399
+ * **Injection:** Loaded entries are wrapped in a `<knowledge>` block and included in the system prompt automatically.
574
400
 
575
- ```typescript
576
- const bashPolicy = new BashAllowlist({
577
- patterns: [
578
- /^npm (install|test|run)/,
579
- /^git (status|diff|log)/,
580
- /^ls -la?/,
581
- ],
582
- blocked: [
583
- /rm -rf/,
584
- /sudo/,
585
- /curl.*\|.*sh/,
586
- ],
587
- });
401
+ ```bash
402
+ buddy knowledge list # List all loaded knowledge entries
403
+ buddy knowledge show <title> # Show a specific entry
404
+ buddy knowledge search "TypeScript conventions"
405
+ buddy knowledge add # Interactive: add a new knowledge entry
406
+ buddy knowledge remove <title> # Remove an entry
407
+ buddy knowledge context # Show the full <knowledge> block the agent sees
588
408
  ```
589
409
 
590
- ### Security Modes
410
+ ### Skills Library (40 Bundled Skills)
591
411
 
592
- | Mode | Description |
593
- |:-----|:------------|
594
- | `suggest` | Confirm all operations |
595
- | `auto-edit` | Auto-approve safe ops |
596
- | `full-auto` | Full autonomy (YOLO) |
412
+ Code Buddy includes 40 built-in SKILL.md files that provide domain-specific knowledge, best practices, and MCP server integration. Skills are loaded contextually when relevant to your project.
597
413
 
598
- ```bash
599
- /mode suggest # Maximum safety
600
- /mode full-auto # Full autonomy
414
+ | Category | Skill | Description |
415
+ |----------|-------|-------------|
416
+ | **PR Workflow** | `review-pr` | Code review checklist, inline comments, approval criteria |
417
+ | | `prepare-pr` | Branch naming, commit cleanup, PR description template |
418
+ | | `merge-pr` | Merge strategies, conflict resolution, post-merge cleanup |
419
+ | **Dev Tools** | `github` | Issues, releases, Actions workflows, gh CLI |
420
+ | | `gitlab` | GitLab API, glab CLI, CI/CD pipelines, merge requests |
421
+ | | `session-logs` | Export/search conversation history and session metadata |
422
+ | | `model-usage` | Token tracking, cost analysis, provider comparison |
423
+ | | `tmux-sessions` | Terminal multiplexing, pane layouts, session management |
424
+ | | `healthcheck` | Service monitoring, endpoint checks, alerting |
425
+ | **Project** | `project-best-practices` | Project scaffolding, structure, linting, testing conventions |
426
+ | | `csharp-avalonia` | Cross-platform desktop/mobile with C# and Avalonia UI |
427
+ | | `coding-agent` | Autonomous multi-step coding with planning and validation |
428
+ | | `skill-creator` | Author new SKILL.md files with YAML frontmatter |
429
+ | **Creative & 3D** | `blender` | Python bpy scripting, CLI rendering, Geometry Nodes |
430
+ | | `unreal-engine` | Remote Control API, Python editor scripting, Movie Render Queue |
431
+ | | `davinci-resolve` | DaVinciResolveScript Python API, color grading, render queue |
432
+ | | `ableton-live` | OSC protocol, MIDI Remote Scripts, Max for Live |
433
+ | **Design** | `figma` | REST API, Plugin API, design tokens extraction |
434
+ | | `gimp` | Python-Fu / Script-Fu scripting, batch image processing |
435
+ | | `inkscape` | Extensions API, CLI export, SVG manipulation |
436
+ | **DevOps & Infra** | `kubernetes` | kubectl, Helm, ArgoCD GitOps |
437
+ | | `terraform-ansible` | Terraform IaC + Ansible configuration management |
438
+ | | `grafana-prometheus` | Grafana HTTP API, PromQL, alerting pipelines |
439
+ | | `jenkins-ci` | Jenkins API, Groovy pipelines, shared libraries |
440
+ | **Workflow & Data** | `n8n` | REST API, webhook triggers, workflow automation |
441
+ | | `databases` | PostgreSQL, MongoDB, Redis CLI and automation |
442
+ | | `game-engines` | Unity C# + Godot GDScript, builds, scene management |
443
+ | **Utilities** | `summarize` | Text/file/URL summarization with configurable length |
444
+ | | `weather` | Weather lookups via wttr.in and OpenWeatherMap |
445
+ | **Media** | `image-gen` | Image generation via DALL-E, Stable Diffusion, Midjourney |
446
+ | | `whisper-transcribe` | Audio/video transcription with OpenAI Whisper |
447
+ | | `pdf-tools` | PDF creation, merging, text extraction, conversion |
448
+ | | `screenshot` | Screen capture, annotation, OCR text extraction |
449
+ | | `video-tools` | FFmpeg video editing, conversion, thumbnails, GIFs |
450
+ | | `gif-search` | GIF search via Giphy and Tenor APIs |
451
+ | **Communication** | `email-tools` | Email send/read via himalaya CLI and SMTP |
452
+ | | `notion` | Notion API for pages, databases, search, content blocks |
453
+ | | `blog-watcher` | RSS/Atom feed monitoring, web page change detection |
454
+ | **Smart Home** | `spotify` | Spotify playback control via spotify_player and Web API |
455
+ | | `smart-home` | Philips Hue and Home Assistant control |
456
+
457
+ Each skill includes **Direct Control** (CLI/API/scripting commands), **MCP Server Integration** (config for `.codebuddy/mcp.json`), and **Common Workflows** (step-by-step recipes). Skills are stored in `.codebuddy/skills/bundled/` and can be extended with managed or workspace skills via the Skills Registry and Hub.
458
+
459
+ **Self-authoring skills:** The agent can extend its own skill set at runtime using the `create_skill` tool, writing new SKILL.md files to `.codebuddy/skills/workspace/`. The SkillRegistry hot-reloads them within ~250ms, so newly created skills are immediately available without restarting.
460
+
461
+ ### Proactive Notifications
462
+
463
+ The agent can reach out to you — not just respond:
464
+
465
+ - **Push notifications** with priority levels (info, warning, critical)
466
+ - **Rate limiting** prevents notification spam
467
+ - **Quiet hours** — suppress non-critical notifications during configured periods
468
+ - **Multi-channel delivery** — notifications route to Telegram, Discord, Slack, or any connected channel
469
+
470
+ ### Screen Observer
471
+
472
+ Monitor your screen and environment for events:
473
+
474
+ - **Periodic screenshots** with perceptual diff detection
475
+ - **Event triggers** — `file_change`, `screen_change`, `time`, `webhook`
476
+ - **Trigger registry** — add/remove triggers dynamically
477
+
478
+ ```bash
479
+ buddy trigger list # List all event triggers
480
+ buddy trigger add <spec> # Add a trigger (format: type:condition action:target)
481
+ buddy trigger remove <id> # Remove a trigger
601
482
  ```
602
483
 
603
- ### Sandbox Isolation
484
+ ---
485
+
486
+ ## Multi-Channel Messaging
487
+
488
+ Code Buddy supports 11 messaging channels:
489
+
490
+ | Channel | Features |
491
+ |:--------|:---------|
492
+ | **Terminal** | Native CLI interface (Ink/React) |
493
+ | **HTTP API** | REST + WebSocket |
494
+ | **WebChat** | Built-in HTTP + WebSocket with browser UI |
495
+ | **Discord** | Bot integration, slash commands |
496
+ | **Telegram** | Bot API, pro features, scoped auth, CI watcher |
497
+ | **Slack** | Bolt framework, events |
498
+ | **WhatsApp** | Baileys (QR pairing, media, reconnect) |
499
+ | **Signal** | signal-cli REST API (polling, groups) |
500
+ | **Google Chat** | Workspace API (JWT auth, webhook events) |
501
+ | **Microsoft Teams** | Bot Framework (OAuth2, adaptive cards) |
502
+ | **Matrix** | matrix-js-sdk (E2EE, threads, media) |
503
+
504
+ ### Telegram (Deep Dive)
505
+
506
+ Telegram is the most feature-rich channel, giving you full agent capabilities from your phone.
507
+
508
+ **Setup:**
509
+
510
+ 1. Create a bot with [@BotFather](https://t.me/BotFather) on Telegram (`/newbot`)
511
+ 2. Configure the token:
512
+
513
+ ```bash
514
+ export TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
515
+ ```
516
+
517
+ Or in `.codebuddy/settings.json`:
518
+
519
+ ```json
520
+ {
521
+ "channels": {
522
+ "telegram": {
523
+ "type": "telegram",
524
+ "token": "123456:ABC-DEF...",
525
+ "adminUsers": ["your_telegram_user_id"],
526
+ "defaultParseMode": "Markdown"
527
+ }
528
+ }
529
+ }
530
+ ```
531
+
532
+ 3. Start Code Buddy with Telegram:
533
+
534
+ ```bash
535
+ buddy --channel telegram # Interactive with Telegram
536
+ buddy daemon start # 24/7 background mode
537
+ ```
538
+
539
+ **Deployment modes:**
540
+
541
+ | Mode | Config | Best for |
542
+ |:-----|:-------|:---------|
543
+ | **Polling** (default) | No extra config | Development, behind NAT |
544
+ | **Webhook** | `"webhookUrl": "https://your-domain.com/telegram"` | Production, lower latency |
545
+
546
+ **Supported message types:** text, images, audio, video, documents, stickers, locations, contacts, inline buttons, reply threads, typing indicators.
547
+
548
+ **What you can do via Telegram:**
549
+
550
+ | Category | Capabilities |
551
+ |:---------|:-------------|
552
+ | **Remote Coding** | Code modifications, bug fixes, refactoring, file analysis, create commits & PRs |
553
+ | **Bash Execution** | Run build, test, deploy commands — with confirmation for destructive ops |
554
+ | **Rich Media** | Send images → Gemini Vision analysis, send files (code, logs) → processed by agent |
555
+ | **Voice Messages** | Send voice notes → STT transcription → agent response |
556
+ | **Daemon Mode** | 24/7 background operation (`buddy daemon start`), cron jobs, proactive alerts |
557
+ | **Notifications** | Build failures, test results, heartbeat alerts pushed to your Telegram |
558
+ | **Interactive** | Inline buttons for confirmations, Markdown-formatted responses |
559
+
560
+ **Pro features:**
604
561
 
605
- Docker-based execution environment:
562
+ | Feature | Description |
563
+ |:--------|:------------|
564
+ | **Scoped Authorization** | Tiered permissions: `read-only` → `write-patch` → `run-tests` → `deploy` |
565
+ | **Diff-First Mode** | Preview all code changes before applying — Apply / Full Diff / Cancel buttons |
566
+ | **Run Tracker** | Step-by-step timeline of agent runs with cost, duration, artifacts |
567
+ | **CI Watcher** | GitHub Actions / GitLab CI / Jenkins alerts with "Fix it" auto-agent |
568
+ | **Secret Handles** | Map friendly names to env vars — secrets never enter LLM context |
569
+ | **Context Pins** | Pin important decisions or facts for the agent to remember |
570
+
571
+ **Enhanced commands:**
572
+
573
+ | Command | Description |
574
+ |:--------|:------------|
575
+ | `/repo` | Repository info, recent commits, open PRs |
576
+ | `/branch [name]` | Branch diff stats vs main |
577
+ | `/pr [number]` | List or view PRs with merge/review buttons |
578
+ | `/task <desc>` | Create an agent task with objective |
579
+ | `/runs` | List recent agent runs with timeline |
580
+ | `/run <id>` | View run details with Re-run/Tests/Rollback buttons |
581
+ | `/yolo [minutes]` | Timed full access (1-60 min, auto-revokes) |
582
+ | `/pins` | View pinned context |
583
+
584
+ **Example workflows:**
585
+
586
+ Fix CI failure:
587
+ ```
588
+ CI alert arrives → cause analysis → "Fix it" button
589
+ → agent creates fix → diff preview → Apply/Cancel
590
+ → changes applied → tests re-run
591
+ ```
592
+
593
+ Add feature + tests + PR:
594
+ ```
595
+ /task "add user search with tests"
596
+ → plan-first preview → approve plan
597
+ → diff-first preview → apply changes
598
+ → agent creates PR → link in chat
599
+ ```
600
+
601
+ ### DM Pairing (Access Control)
602
+
603
+ Prevents unauthorized users from consuming API credits:
604
+
605
+ 1. Unknown user messages the bot → receives a **6-character pairing code** (expires in 15 min)
606
+ 2. Bot owner approves via CLI: `buddy pairing approve --channel telegram ABC123`
607
+ 3. User is added to the persistent allowlist (`~/.codebuddy/credentials/telegram-allowFrom.json`)
608
+
609
+ Security features: rate limiting (5 failed attempts → 1h block), per-channel allowlists, admin bypass.
610
+
611
+ **Pairing CLI commands:**
612
+
613
+ ```bash
614
+ buddy pairing status # Show pairing system status
615
+ buddy pairing list # List all approved users
616
+ buddy pairing pending # List pending pairing requests
617
+ buddy pairing approve <code> # Approve a pairing request by code
618
+ buddy pairing add <id> # Manually add a user to the allowlist
619
+ buddy pairing revoke <id> # Revoke access for a user
620
+ ```
621
+
622
+ ### Other Channels
606
623
 
607
624
  ```typescript
608
- const sandbox = new DockerSandbox({
609
- image: 'codebuddy/sandbox:latest',
610
- memoryLimit: '512m',
611
- networkMode: 'none',
612
- timeout: 30000,
625
+ // Discord
626
+ const discord = new DiscordChannel({
627
+ token: process.env.DISCORD_TOKEN,
628
+ allowedGuilds: ['guild-id'],
613
629
  });
630
+ await discord.connect();
631
+
632
+ // WhatsApp (Baileys, QR pairing)
633
+ const whatsapp = new WhatsAppChannel({ dataPath: '~/.codebuddy/whatsapp' });
634
+ await whatsapp.connect(); // Scan QR code
635
+
636
+ // Signal (signal-cli REST API)
637
+ const signal = new SignalChannel({ apiUrl: 'http://localhost:8080', phoneNumber: '+1234567890' });
638
+ await signal.connect();
639
+
640
+ // Matrix (E2EE, threads)
641
+ const matrix = new MatrixChannel({ homeserverUrl: 'https://matrix.org', accessToken: '...' });
642
+ await matrix.connect();
614
643
  ```
615
644
 
616
645
  ---
617
646
 
618
- ## Context Management
647
+ ## Autonomous Agent
619
648
 
620
- ### Context Window Guard
649
+ ### Daemon Mode
621
650
 
622
- Automatic context management with configurable thresholds:
651
+ Run Code Buddy 24/7 in the background:
623
652
 
624
- ```typescript
625
- const guard = new ContextWindowGuard({
626
- maxTokens: 128000,
627
- warningThreshold: 0.8, // Warn at 80%
628
- compactionThreshold: 0.9, // Compact at 90%
629
- });
653
+ ```bash
654
+ buddy daemon start [--detach] # Start background daemon
655
+ buddy daemon stop # Stop daemon
656
+ buddy daemon restart # Restart daemon
657
+ buddy daemon status # Show daemon status and services
658
+ buddy daemon logs [--lines N] # View daemon logs
659
+ ```
660
+
661
+ Features:
662
+ - PID file management with stale detection
663
+ - Auto-restart on crash (max 3 retries)
664
+ - Service registry and health monitoring (CPU, memory)
665
+ - **Heartbeat engine** — periodic agent wake with HEARTBEAT.md checklist, smart suppression, active hours
666
+
667
+ ```bash
668
+ buddy heartbeat start # Start the heartbeat engine
669
+ buddy heartbeat stop # Stop the heartbeat engine
670
+ buddy heartbeat status # Show heartbeat status
671
+ buddy heartbeat tick # Manually trigger a single tick
672
+ ```
673
+
674
+ ### Multi-Agent Orchestration
675
+
676
+ The **SupervisorAgent** coordinates multiple agent instances:
677
+
678
+ - **Strategies** — sequential, parallel, race, all
679
+ - **Shared context** — thread-safe key-value store with optimistic locking
680
+ - **Self-healing** — error pattern recognition (6 built-in patterns), auto-recovery with exponential backoff
681
+ - **Checkpoint rollback** — auto-checkpoint before risky ops, rollback to last good state
682
+
683
+ ### YOLO Mode (Autonomous Execution)
684
+
685
+ Full autonomy with built-in guardrails for safe unattended operation:
686
+
687
+ ```bash
688
+ # Enable via CLI
689
+ /yolo on # Enable (50 auto-edits, 100 auto-commands)
690
+ /yolo safe # Restricted mode (20 edits, 30 commands, limited paths)
691
+ /yolo off # Disable
692
+ /yolo status # Show limits, counters, allow/deny lists
693
+
694
+ # Or via environment
695
+ YOLO_MODE=true buddy # Still requires /yolo on confirmation in chat
696
+ ```
697
+
698
+ **What changes in YOLO mode:**
699
+
700
+ | Setting | Normal | YOLO |
701
+ |:--------|:-------|:-----|
702
+ | Tool rounds | 50 | 400 |
703
+ | Cost limit | $10 | $100 (cap $1,000) |
704
+ | File edits | Confirm each | Auto-approve (up to limit) |
705
+ | Bash commands | Confirm each | Auto-execute safe commands |
706
+
707
+ **Autonomy levels** (fine-grained control):
708
+
709
+ ```bash
710
+ /autonomy suggest # Confirm everything
711
+ /autonomy confirm # Confirm important ops (default)
712
+ /autonomy auto # Auto-approve safe ops, confirm dangerous
713
+ /autonomy full # Auto-approve all except critical
714
+ /autonomy yolo # Full auto with guardrails
715
+ ```
716
+
717
+ **Customize allow/deny lists:**
718
+
719
+ ```bash
720
+ /yolo allow "npm run dev" # Add to auto-execute list
721
+ /yolo deny "docker rm -f" # Block a command pattern
722
+ ```
723
+
724
+ **Built-in guardrails (always active, even in YOLO):**
725
+ - Blocked paths: `.env`, `.git`, `node_modules`, `*.pem`, `*.key`, `credentials`
726
+ - Blocked commands: `rm -rf /`, `sudo`, `git push --force origin main`, `DROP DATABASE`
727
+ - Per-session limits on edits and commands
728
+ - Hard cost cap ($1,000 max even with `MAX_COST` override)
729
+
730
+ ### Cron & Scheduling
731
+
732
+ The **Cron-Agent Bridge** connects the scheduler to CodeBuddyAgent instances for recurring tasks:
733
+
734
+ ```bash
735
+ buddy trigger add time:*/30 action:run-tests # Run tests every 30 min
736
+ buddy trigger add webhook:deploy action:notify # Notify on deploy webhook
737
+ ```
738
+
739
+ Webhook triggers use HMAC-SHA256 verification with template placeholders for flexible integration.
740
+
741
+ ---
742
+
743
+ ## AI Providers
744
+
745
+ Code Buddy supports multiple AI providers with automatic failover:
746
+
747
+ | Provider | Models | Context | Configuration |
748
+ |:---------|:-------|:--------|:--------------|
749
+ | **Grok** (xAI) | grok-4, grok-code-fast-1 | 128K | `GROK_API_KEY` |
750
+ | **Claude** (Anthropic) | claude-sonnet-4, opus | 200K | `ANTHROPIC_API_KEY` |
751
+ | **ChatGPT** (OpenAI) | gpt-4o, gpt-4-turbo | 128K | `OPENAI_API_KEY` |
752
+ | **Gemini** (Google) | gemini-2.0-flash (+ vision) | 2M | `GOOGLE_API_KEY` |
753
+ | **LM Studio** | Any local model | Varies | `--base-url http://localhost:1234/v1` |
754
+ | **Ollama** | llama3, codellama, etc. | Varies | `--base-url http://localhost:11434/v1` |
755
+
756
+ **Model failover chain** — cascading provider fallback with health tracking and cooldown periods.
757
+
758
+ ### Connection Profiles
759
+
760
+ ```bash
761
+ # Use LM Studio (local)
762
+ buddy --base-url http://localhost:1234/v1 --api-key lm-studio
763
+
764
+ # Use Ollama (local)
765
+ buddy --base-url http://localhost:11434/v1 --model llama3
766
+
767
+ # Use a specific model
768
+ buddy --model grok-code-fast-1
769
+ ```
770
+
771
+ **Profile configuration** in `~/.codebuddy/user-settings.json`:
772
+
773
+ ```json
774
+ {
775
+ "connection": {
776
+ "activeProfileId": "grok",
777
+ "profiles": [
778
+ {
779
+ "id": "grok",
780
+ "name": "Grok API (xAI)",
781
+ "provider": "grok",
782
+ "baseURL": "https://api.x.ai/v1",
783
+ "model": "grok-4-latest"
784
+ },
785
+ {
786
+ "id": "lmstudio",
787
+ "name": "LM Studio Local",
788
+ "provider": "lmstudio",
789
+ "baseURL": "http://localhost:1234/v1",
790
+ "apiKey": "lm-studio"
791
+ }
792
+ ]
793
+ }
794
+ }
630
795
  ```
631
796
 
632
- ### Smart Compaction
797
+ **Auth profile manager** — API key rotation (round-robin/priority/random strategies), session stickiness, exponential backoff on failures.
798
+
799
+ ```bash
800
+ buddy auth-profile list # List authentication profiles
801
+ buddy auth-profile add <id> <provider> # Add a profile
802
+ buddy auth-profile remove <id> # Remove a profile
803
+ buddy auth-profile reset # Reset all cooldowns
804
+ ```
633
805
 
634
- Multi-stage compression:
806
+ ---
635
807
 
636
- 1. **Stage 1**: Remove tool results older than TTL
637
- 2. **Stage 2**: Summarize older messages
638
- 3. **Stage 3**: Aggressive truncation if needed
808
+ ## Security & Trust
639
809
 
640
- ### Hybrid Search
810
+ ### Tool Policy & Bash Allowlist
641
811
 
642
- Combined keyword + semantic search:
812
+ Fine-grained control over what tools the agent can use:
643
813
 
644
814
  ```typescript
645
- const results = await hybridSearch({
646
- query: "authentication flow",
647
- keywordWeight: 0.3,
648
- semanticWeight: 0.7,
815
+ // Tool-level allow/deny
816
+ const policy = new ToolPolicy({
817
+ allowlist: ['read_file', 'search', 'web_fetch'],
818
+ denylist: ['bash', 'write_file'],
819
+ requireConfirmation: ['delete_file'],
820
+ });
821
+
822
+ // Bash command patterns
823
+ const bashPolicy = new BashAllowlist({
824
+ patterns: [/^npm (install|test|run)/, /^git (status|diff|log)/],
825
+ blocked: [/rm -rf/, /sudo/, /curl.*\|.*sh/],
649
826
  });
650
827
  ```
651
828
 
652
- ---
829
+ ### Security Modes
653
830
 
654
- ## Tools
831
+ | Mode | Description |
832
+ |:-----|:------------|
833
+ | `suggest` | Confirm all operations |
834
+ | `auto-edit` | Auto-approve safe ops |
835
+ | `full-auto` | Full autonomy (YOLO) |
655
836
 
656
- ### Built-in Tools
837
+ ```bash
838
+ /mode suggest # Maximum safety
839
+ /mode full-auto # Full autonomy
840
+ ```
657
841
 
658
- | Category | Tools |
659
- |:---------|:------|
660
- | **File Operations** | `view_file`, `create_file`, `str_replace_editor`, `edit_file`, `multi_edit` |
661
- | **Search** | `search`, `codebase_map` |
662
- | **System** | `bash`, `docker`, `kubernetes` |
663
- | **Web** | `web_search`, `web_fetch`, `browser` |
664
- | **Patching** | `apply_patch` (unified diff) |
665
- | **Planning** | `create_todo_list`, `get_todo_list`, `update_todo_list` |
666
- | **Media** | `screenshot`, `audio`, `video`, `ocr`, `clipboard` |
667
- | **Documents** | `pdf`, `document`, `archive` |
842
+ ### Trust Folders & Agent Profiles
668
843
 
669
- ### Web Search (5-Provider Fallback Chain)
844
+ - **Trust folders** — directory-level tool permissions via `.codebuddy-trust.json`
845
+ - **Agent profiles** — predefined configs: `secure` (read-only), `minimal`, `power-user`
846
+ - **Per-model tool config** — capabilities, context window, and patch format per model family
670
847
 
671
- Code Buddy automatically cascades through available search providers:
848
+ ### OS Sandbox Workspace-Write Mode
672
849
 
673
- | Priority | Provider | API Key Required | Features |
674
- |:---------|:---------|:-----------------|:---------|
675
- | 1 | **Brave MCP** | `BRAVE_API_KEY` + MCP enabled | Full MCP integration, richest results |
676
- | 2 | **Brave API** | `BRAVE_API_KEY` | Country, language, freshness filters |
677
- | 3 | **Perplexity** | `PERPLEXITY_API_KEY` or `OPENROUTER_API_KEY` | AI-synthesized answers with citations |
678
- | 4 | **Serper** | `SERPER_API_KEY` | Google Search results |
679
- | 5 | **DuckDuckGo** | None | Free fallback (no API key needed) |
850
+ Three sandbox tiers for native OS-level isolation (Codex-inspired):
680
851
 
681
- Search parameters: `country` (ISO 3166), `search_lang`, `ui_lang`, `freshness` (`pd`/`pw`/`pm`/`py` or date range), `provider` (force specific).
852
+ | Mode | Write Access | Use Case |
853
+ |:-----|:------------|:---------|
854
+ | `read-only` | None | Untrusted analysis tasks |
855
+ | `workspace-write` | Git workspace root only | Normal development (default) |
856
+ | `danger-full-access` | Unrestricted | Deployment/release scripts |
682
857
 
683
- ### MCP Predefined Servers
858
+ `.git`, `.codebuddy`, `.ssh`, `.gnupg`, `.aws` are **always read-only** regardless of mode.
684
859
 
685
- Four MCP servers are pre-configured (disabled by default):
860
+ ```typescript
861
+ const sandbox = await createSandboxForMode('workspace-write', '/my/project');
862
+ await sandbox.exec('npm', ['test']);
863
+ ```
864
+
865
+ ### Exec Policy — Prefix Rules
866
+
867
+ Codex-inspired command authorization with token-array prefix matching (safer than regex — bypasses quoting/encoding tricks):
686
868
 
687
869
  ```bash
688
- buddy mcp add brave-search # Brave Web Search (needs BRAVE_API_KEY)
689
- buddy mcp add playwright # Browser automation (no key needed)
690
- buddy mcp add exa-search # Exa neural search (needs EXA_API_KEY)
691
- buddy mcp add icm # Infinite Context Memory (needs `cargo install icm`)
692
- buddy mcp list # Show all configured servers
870
+ buddy execpolicy check "git push --force" # evaluate a shell string
871
+ buddy execpolicy check-argv git push --force # token-array (prefix rules first)
872
+ buddy execpolicy add-prefix git push --action deny # block git push with longest-match
873
+ buddy execpolicy dashboard # full policy overview
693
874
  ```
694
875
 
695
- ### RAG-Based Tool Selection
876
+ ### SSRF Guard
877
+
878
+ Comprehensive Server-Side Request Forgery protection on all outbound HTTP calls:
879
+ - Blocks RFC-1918 private ranges + loopback + link-local
880
+ - Blocks IPv4 bypass vectors: octal (`0177.0.0.1`), hex (`0x7f000001`), short form (`127.1`)
881
+ - Blocks IPv6 transition addresses: NAT64 (`64:ff9b::/96`), 6to4, Teredo, IPv4-mapped (`::ffff:127.0.0.1`)
882
+ - Async DNS resolution check before every fetch
883
+
884
+ ### Docker Sandbox
696
885
 
697
- Tools are selected based on query relevance:
886
+ Containerized command execution for untrusted operations:
698
887
 
699
888
  ```typescript
700
- // Query: "what's the weather in Paris?"
701
- // Selected tools: web_search, web_fetch
702
- // Not selected: bash, edit_file, etc.
889
+ const sandbox = new DockerSandbox({
890
+ image: 'codebuddy/sandbox:latest',
891
+ memoryLimit: '512m',
892
+ networkMode: 'none',
893
+ timeout: 30000,
894
+ });
703
895
  ```
704
896
 
897
+ **Auto-sandbox router** automatically routes dangerous commands (npm, pip, cargo, make) to Docker when available.
898
+
899
+ ### Safety Rails
900
+
901
+ | Rail | Description |
902
+ |:-----|:------------|
903
+ | **Diff-First Mode** | All code changes are previewed before applying. Users see file summaries, line counts, and can view the full unified diff. |
904
+ | **Plan-First Mode** | Multi-step tasks show the execution plan for approval before any changes are made. |
905
+ | **Scoped Permissions** | Users get only the access they need: `read-only` → `write-patch` → `run-tests` → `deploy`. |
906
+ | **Audit Trail** | Every tool execution, confirmation, and security decision is logged. |
907
+ | **Secret Handles** | API tokens and credentials are referenced by handle name only — actual values are resolved from env vars at runtime, never exposed to the LLM context. |
908
+ | **2-Step Confirmation** | Risky operations (rollback, deploy) require double confirmation with a 2-minute timeout window. |
909
+ | **Timed YOLO** | `/yolo` grants temporary full access that auto-revokes after the specified duration. |
910
+ | **DM Pairing** | Unknown users must be approved before they can interact with the bot. |
911
+
705
912
  ---
706
913
 
707
- ## API Server
914
+ ## Architecture
915
+
916
+ ### Facade Architecture
917
+
918
+ ```
919
+ CodeBuddyAgent
920
+
921
+ ├── AgentContextFacade # Context window and memory management
922
+ │ - Token counting, compression, memory retrieval
923
+
924
+ ├── SessionFacade # Session persistence and checkpoints
925
+ │ - Save/load, checkpoint creation, rewind
926
+
927
+ ├── ModelRoutingFacade # Model routing and cost tracking
928
+ │ - Provider selection, cost calculation
929
+
930
+ ├── InfrastructureFacade # MCP, sandbox, hooks, plugins
931
+ │ - Hook execution, plugin loading
932
+
933
+ └── MessageHistoryManager # Chat and LLM message history
934
+ ```
935
+
936
+ ### Autonomy Layer
937
+
938
+ ```
939
+ CodeBuddyAgent
940
+
941
+ ├── TaskPlanner # DAG decomposition of complex requests
942
+ │ - needsPlanning() heuristic
943
+ │ - createPlan() → TaskGraph → parallel execution
944
+
945
+ ├── SupervisorAgent # Multi-agent orchestration
946
+ │ - Sequential, parallel, race, all strategies
947
+ │ - SharedContext with optimistic locking
948
+
949
+ ├── SelfHealing # Automatic error recovery
950
+ │ - Pattern recognition (6 built-in patterns)
951
+ │ - Retry with exponential backoff
952
+
953
+ ├── ScreenObserver # Environment monitoring
954
+ │ - Periodic screenshots with perceptual diff
955
+ │ - Event triggers (file_change, screen_change, time, webhook)
956
+
957
+ ├── ProactiveAgent # Agent-initiated communication
958
+ │ - Push notifications with priority levels
959
+ │ - Rate limiting and quiet hours
960
+
961
+ └── DaemonManager # Background process lifecycle
962
+ - PID file management, auto-restart
963
+ - Service registry, health monitoring
964
+ ```
965
+
966
+ ### Core Flow
967
+
968
+ ```
969
+ User Input → ChatInterface (Ink/React) → CodeBuddyAgent → AI Provider
970
+
971
+ Tool Calls (max 50/400 rounds)
972
+
973
+ Tool Execution + Confirmation
974
+
975
+ Results back to API (loop)
976
+ ```
977
+
978
+ ---
708
979
 
709
- REST API with WebSocket support:
980
+ ## API Server & Integrations
710
981
 
711
- ### Starting the Server
982
+ ### REST API
712
983
 
713
984
  ```bash
714
985
  buddy server --port 3000
715
986
  ```
716
987
 
717
- ### Endpoints
718
-
719
988
  | Endpoint | Method | Description |
720
989
  |:---------|:-------|:------------|
721
990
  | `/api/health` | GET | Health check |
@@ -732,9 +1001,7 @@ buddy server --port 3000
732
1001
  | `/api/cron/jobs/{id}/trigger` | POST | Trigger a cron job |
733
1002
  | `/api/notifications/preferences` | GET/POST | Notification settings |
734
1003
  | `/api/heartbeat/status` | GET | Heartbeat engine status |
735
- | `/api/heartbeat/start` | POST | Start heartbeat |
736
- | `/api/heartbeat/stop` | POST | Stop heartbeat |
737
- | `/api/heartbeat/tick` | POST | Trigger a single tick |
1004
+ | `/api/heartbeat/start\|stop\|tick` | POST | Heartbeat control |
738
1005
  | `/api/hub/search?q=...` | GET | Search skills marketplace |
739
1006
  | `/api/hub/installed` | GET | List installed hub skills |
740
1007
  | `/api/hub/install` | POST | Install a skill |
@@ -742,34 +1009,173 @@ buddy server --port 3000
742
1009
  | `/api/identity` | GET | List loaded identity files |
743
1010
  | `/api/identity/prompt` | GET | Combined identity prompt |
744
1011
  | `/api/identity/{name}` | PUT | Update an identity file |
745
- | `/api/groups/status` | GET | Group security status |
746
- | `/api/groups/list` | GET | List configured groups |
1012
+ | `/api/groups/status\|list` | GET | Group security status/config |
747
1013
  | `/api/groups/block` | POST | Block a user globally |
748
1014
  | `/api/groups/block/{userId}` | DELETE | Unblock a user |
749
1015
  | `/api/auth-profiles` | GET/POST/DELETE | Auth profile CRUD |
750
1016
  | `/api/auth-profiles/reset` | POST | Reset all cooldowns |
751
1017
 
752
- ### WebSocket Events
1018
+ ### WebSocket Events
1019
+
1020
+ ```javascript
1021
+ const ws = new WebSocket('ws://localhost:3000/ws');
1022
+
1023
+ // Authenticate
1024
+ ws.send(JSON.stringify({
1025
+ type: 'authenticate',
1026
+ payload: { token: 'jwt-token' }
1027
+ }));
1028
+
1029
+ // Stream chat
1030
+ ws.send(JSON.stringify({
1031
+ type: 'chat_stream',
1032
+ payload: { messages: [{ role: 'user', content: 'Hello' }] }
1033
+ }));
1034
+ ```
1035
+
1036
+ ### MCP Servers
1037
+
1038
+ Four MCP servers are pre-configured (disabled by default):
1039
+
1040
+ ```bash
1041
+ buddy mcp add brave-search # Brave Web Search (needs BRAVE_API_KEY)
1042
+ buddy mcp add playwright # Browser automation (no key needed)
1043
+ buddy mcp add exa-search # Exa neural search (needs EXA_API_KEY)
1044
+ buddy mcp add icm # Infinite Context Memory (needs `cargo install icm`)
1045
+ buddy mcp list # Show all configured servers
1046
+ ```
1047
+
1048
+ ### Plugin System
1049
+
1050
+ Plugins extend Code Buddy with custom tools, commands, and providers:
1051
+
1052
+ ```
1053
+ ~/.codebuddy/plugins/
1054
+ my-plugin/
1055
+ manifest.json
1056
+ index.js
1057
+ ```
1058
+
1059
+ Plugin types: **Tool**, **Provider** (LLM/embedding/search), **Command**, **Hook**
1060
+
1061
+ ```typescript
1062
+ const plugin: Plugin = {
1063
+ async activate(context: PluginContext) {
1064
+ context.registerTool({
1065
+ name: 'my_tool',
1066
+ description: 'Custom tool',
1067
+ execute: async (args) => {
1068
+ return { success: true, output: 'Done!' };
1069
+ }
1070
+ });
1071
+
1072
+ context.registerProvider({
1073
+ id: 'my-llm',
1074
+ type: 'llm',
1075
+ async chat(messages) { return 'response'; }
1076
+ });
1077
+ }
1078
+ };
1079
+ ```
1080
+
1081
+ ### Extensions
1082
+
1083
+ Manifest-based extension system with lifecycle hooks and config schema. Extensions live in `.codebuddy/extensions/`.
1084
+
1085
+ ### Copilot Proxy
1086
+
1087
+ IDE-compatible completions backend — serves `/v1/completions` with bearer auth, per-IP rate limiting, and token clamping.
1088
+
1089
+ ### External Tools (RTK & ICM)
1090
+
1091
+ | Tool | Install | Purpose |
1092
+ |:-----|:--------|:--------|
1093
+ | **RTK** | `cargo install --git https://github.com/rtk-ai/rtk` | CLI proxy that wraps commands to reduce LLM token usage 60-90% |
1094
+ | **ICM** | `cargo install --git https://github.com/rtk-ai/icm` | MCP server for persistent cross-session memory |
1095
+
1096
+ RTK is automatically integrated via a before-hook — supported bash commands are prefixed with `rtk` transparently. Configure in `.codebuddy/config.toml` under `[integrations]`.
1097
+
1098
+ ---
1099
+
1100
+ ## CLI Reference
1101
+
1102
+ ### Global Options
1103
+
1104
+ | Flag | Short | Description | Default |
1105
+ |:-----|:------|:------------|:--------|
1106
+ | `--version` | `-V` | Show version number | - |
1107
+ | `--directory <dir>` | `-d` | Set working directory | `.` |
1108
+ | `--api-key <key>` | `-k` | API key (or `GROK_API_KEY` env) | - |
1109
+ | `--base-url <url>` | `-u` | API base URL (or `GROK_BASE_URL` env) | - |
1110
+ | `--model <model>` | `-m` | AI model to use (or `GROK_MODEL` env) | auto-detect |
1111
+ | `--prompt <prompt>` | `-p` | Single prompt, headless mode | - |
1112
+ | `--browser` | `-b` | Launch browser UI instead of terminal | `false` |
1113
+ | `--max-tool-rounds <n>` | | Max tool execution rounds | `400` |
1114
+ | `--security-mode <mode>` | `-s` | `suggest`, `auto-edit`, or `full-auto` | `suggest` |
1115
+ | `--output-format <fmt>` | `-o` | Headless output: `json`, `stream-json`, `text`, `markdown` | `json` |
1116
+ | `--context <patterns>` | `-c` | Glob patterns to load into context | - |
1117
+
1118
+ ### Session & Cost
1119
+
1120
+ | Flag | Description | Default |
1121
+ |:-----|:------------|:--------|
1122
+ | `--continue` | Resume the most recent saved session | - |
1123
+ | `--resume <id>` | Resume a specific session (supports partial ID matching) | - |
1124
+ | `--max-price <dollars>` | Maximum cost in dollars before stopping | `10.0` |
1125
+ | `--no-cache` | Disable response caching | - |
1126
+
1127
+ ### Autonomy & Permissions
1128
+
1129
+ | Flag | Description | Default |
1130
+ |:-----|:------------|:--------|
1131
+ | `--auto-approve` | Automatically approve all tool executions | `false` |
1132
+ | `--dangerously-skip-permissions` | Bypass all permission checks (trusted containers only) | `false` |
1133
+ | `--no-self-heal` | Disable self-healing auto-correction | - |
1134
+ | `--allow-outside` | Allow file operations outside workspace directory | `false` |
1135
+
1136
+ ### Tool Control
1137
+
1138
+ | Flag | Description | Example |
1139
+ |:-----|:------------|:--------|
1140
+ | `--force-tools` | Force-enable function calling for local models | - |
1141
+ | `--probe-tools` | Auto-detect tool support at startup | - |
1142
+ | `--enabled-tools <patterns>` | Only enable matching tools (glob, comma-separated) | `bash,*file*,search` |
1143
+ | `--disabled-tools <patterns>` | Disable matching tools (glob, comma-separated) | `bash,web_*` |
1144
+ | `--allowed-tools <patterns>` | Alias for `--enabled-tools` (Claude Code compat) | - |
1145
+
1146
+ ### Agent & Prompt Configuration
753
1147
 
754
- ```javascript
755
- const ws = new WebSocket('ws://localhost:3000/ws');
1148
+ | Flag | Description | Default |
1149
+ |:-----|:------------|:--------|
1150
+ | `--system-prompt <id>` | System prompt: `default`, `minimal`, `secure`, `code-reviewer`, `architect` (or custom from `~/.codebuddy/prompts/`) | `default` |
1151
+ | `--list-prompts` | List available system prompts and exit | - |
1152
+ | `--agent <name>` | Use a custom agent from `~/.codebuddy/agents/` | - |
1153
+ | `--list-agents` | List available custom agents and exit | - |
756
1154
 
757
- // Authenticate
758
- ws.send(JSON.stringify({
759
- type: 'authenticate',
760
- payload: { token: 'jwt-token' }
761
- }));
1155
+ ### Display & Debugging
762
1156
 
763
- // Stream chat
764
- ws.send(JSON.stringify({
765
- type: 'chat_stream',
766
- payload: { messages: [{ role: 'user', content: 'Hello' }] }
767
- }));
768
- ```
1157
+ | Flag | Description |
1158
+ |:-----|:------------|
1159
+ | `--plain` | Minimal formatting (plain text output) |
1160
+ | `--no-color` | Disable colored output |
1161
+ | `--no-emoji` | Disable emoji in output |
1162
+ | `--vim` | Enable Vim keybindings for input |
1163
+ | `--mcp-debug` | Enable MCP protocol debugging output |
1164
+
1165
+ ### Setup & Init
1166
+
1167
+ | Flag | Description |
1168
+ |:-----|:------------|
1169
+ | `--init` | Initialize `.codebuddy/` directory with templates |
1170
+ | `--dry-run` | Preview changes without applying (simulation mode) |
1171
+ | `--setup` | Run interactive API key setup wizard |
1172
+ | `--list-models` | List available models from the API and exit |
769
1173
 
770
1174
  ---
771
1175
 
772
- ## Slash Commands
1176
+ ## Commands
1177
+
1178
+ ### Slash Commands (In-Chat)
773
1179
 
774
1180
  | Command | Description |
775
1181
  |:--------|:------------|
@@ -784,231 +1190,136 @@ ws.send(JSON.stringify({
784
1190
  | `/memory` | Memory management |
785
1191
  | `/hooks list` | List lifecycle hooks |
786
1192
  | `/plugin list` | List plugins |
1193
+ | `/speak <text>` | Speak text with current TTS provider |
1194
+ | `/tts on\|off\|auto` | TTS control |
1195
+ | `/yolo on\|off\|safe\|status` | YOLO mode control |
1196
+ | `/autonomy suggest\|confirm\|auto\|full\|yolo` | Autonomy level |
787
1197
 
788
- ### Daemon Commands
789
-
790
- ```bash
791
- buddy daemon start [--detach] # Start background daemon
792
- buddy daemon stop # Stop daemon
793
- buddy daemon restart # Restart daemon
794
- buddy daemon status # Show daemon status and services
795
- buddy daemon logs [--lines N] # View daemon logs
796
- ```
797
-
798
- ### Trigger Commands
799
-
800
- ```bash
801
- buddy trigger list # List all event triggers
802
- buddy trigger add <spec> # Add a trigger (format: type:condition action:target)
803
- buddy trigger remove <id> # Remove a trigger
804
- ```
805
-
806
- ### Webhook Commands
1198
+ ### CLI Subcommands
807
1199
 
808
1200
  ```bash
809
- buddy webhook list # List registered webhooks
810
- buddy webhook add <name> <message> [opts] # Register a new webhook
811
- buddy webhook remove <id> # Remove a webhook
812
- ```
1201
+ # Daemon
1202
+ buddy daemon start|stop|restart|status|logs
813
1203
 
814
- ### Hub Commands (Skills Marketplace)
815
-
816
- ```bash
817
- buddy hub search <query> # Search for skills
818
- buddy hub install <name> # Install a skill from the hub
819
- buddy hub uninstall <name> # Uninstall a skill
820
- buddy hub update [name] # Update all or a specific skill
821
- buddy hub list # List installed skills
822
- buddy hub info <name> # Show details about a skill
823
- buddy hub publish <path> # Publish a skill to the hub
824
- buddy hub sync # Sync installed skills with lockfile
825
- ```
1204
+ # Triggers
1205
+ buddy trigger list|add|remove
826
1206
 
827
- ### Heartbeat Commands
1207
+ # Webhooks
1208
+ buddy webhook list|add|remove
828
1209
 
829
- ```bash
830
- buddy heartbeat start [opts] # Start the heartbeat engine
831
- buddy heartbeat stop # Stop the heartbeat engine
832
- buddy heartbeat status # Show heartbeat status
833
- buddy heartbeat tick # Manually trigger a single tick
834
- ```
1210
+ # Skills Hub
1211
+ buddy hub search|install|uninstall|update|list|info|publish|sync
835
1212
 
836
- ### Identity Commands
1213
+ # Heartbeat
1214
+ buddy heartbeat start|stop|status|tick
837
1215
 
838
- ```bash
839
- buddy identity show # Show loaded identity files (SOUL.md, USER.md, etc.)
840
- buddy identity get <name> # Show content of a specific identity file
841
- buddy identity set <name> <c> # Set content of an identity file
842
- buddy identity prompt # Show the combined identity prompt injection
843
- ```
1216
+ # Identity
1217
+ buddy identity show|get|set|prompt
844
1218
 
845
- ### Group Security Commands
1219
+ # Groups
1220
+ buddy groups status|list|block|unblock
846
1221
 
847
- ```bash
848
- buddy groups status # Show group security status
849
- buddy groups list # List configured groups
850
- buddy groups block <userId> # Add a user to the global blocklist
851
- buddy groups unblock <userId> # Remove a user from the blocklist
852
- ```
1222
+ # Auth Profiles
1223
+ buddy auth-profile list|add|remove|reset
853
1224
 
854
- ### Auth Profile Commands
1225
+ # Devices
1226
+ buddy device list|pair|remove|snap|screenshot|record|run
855
1227
 
856
- ```bash
857
- buddy auth-profile list # List authentication profiles
858
- buddy auth-profile add <id> <provider> # Add a profile (API key rotation)
859
- buddy auth-profile remove <id> # Remove a profile
860
- buddy auth-profile reset # Reset all cooldowns
861
- ```
1228
+ # Config
1229
+ buddy config show|validate|get
862
1230
 
863
- ### Device Commands
1231
+ # Security
1232
+ buddy security-audit [--deep] [--fix] [--json]
864
1233
 
865
- ```bash
866
- buddy device list # List paired devices
867
- buddy device pair --id <id> --name <name> --transport <ssh|adb|local> # Pair a device
868
- buddy device remove <id> # Remove a paired device
869
- buddy device snap <id> [-o output.png] # Take a screenshot on device
870
- buddy device screenshot <id> [-o out.png] # Alias for snap
871
- buddy device record <id> [-d 10] [-o out] # Record screen (duration in seconds)
872
- buddy device run <id> -- <command> # Run a command on device
873
- ```
1234
+ # Voice
1235
+ buddy speak [text] [--voice <name>] [--list-voices] [--speed <n>] [--format <fmt>]
874
1236
 
875
- ### Config Commands
1237
+ # Knowledge Base
1238
+ buddy knowledge list|show|search|add|remove|context
876
1239
 
877
- ```bash
878
- buddy config show [--json] # Show all environment variables and values
879
- buddy config validate # Validate current environment configuration
880
- buddy config get <name> # Show value and definition of a variable
881
- ```
1240
+ # DM Pairing
1241
+ buddy pairing status|list|pending|approve <code>|add <id>|revoke <id>
882
1242
 
883
- ### Security Audit
1243
+ # Wide Research
1244
+ buddy research "<topic>" [--workers N] [--rounds N] [--output file.md]
884
1245
 
885
- ```bash
886
- buddy security-audit # Run security audit of your environment
887
- buddy security-audit --deep # Deep scan (git history, npm audit)
888
- buddy security-audit --fix # Auto-fix file permission issues
889
- buddy security-audit --json # Output as JSON
890
- ```
1246
+ # Task List (todo.md attention bias — injected at end of every agent turn)
1247
+ buddy todo list # Show all items
1248
+ buddy todo add "task description" [-p high|medium|low]
1249
+ buddy todo done <id> # Mark completed
1250
+ buddy todo update <id> [-s in_progress] [-t "new text"]
1251
+ buddy todo remove <id> # Delete item
1252
+ buddy todo clear-done # Remove all completed
1253
+ buddy todo context # Preview the block injected into the agent
891
1254
 
892
- ### Voice & TTS Commands
1255
+ # Lessons (self-improvement loop — injected before every agent turn)
1256
+ buddy lessons list [--category PATTERN|RULE|CONTEXT|INSIGHT]
1257
+ buddy lessons add "what went wrong → correct approach" --category PATTERN
1258
+ buddy lessons search "tsc" # Find relevant lessons before a task
1259
+ buddy lessons clear [--category RULE] --yes
1260
+ buddy lessons context # Preview the <lessons_context> block
893
1261
 
894
- ```bash
895
- buddy speak "Bonjour, je suis Code Buddy" # Synthesize and play speech
896
- buddy speak --voice af_bella "Hello world" # Use a specific voice
897
- buddy speak --list-voices # List available voices
898
- buddy speak --speed 1.5 "Fast speech" # Adjust speed (0.25-4.0)
899
- buddy speak --format mp3 "Hello" # Output format (wav, mp3)
900
- buddy speak --url http://host:8000 "Hello" # Custom AudioReader URL
1262
+ # Setup
1263
+ buddy onboard # Interactive setup wizard
1264
+ buddy doctor # Environment diagnostics
901
1265
  ```
902
1266
 
903
- **In-chat voice commands:**
904
-
905
- | Command | Description |
906
- |:--------|:------------|
907
- | `/speak <text>` | Speak text with current TTS provider |
908
- | `/tts on\|off` | Enable/disable TTS |
909
- | `/tts auto` | Auto-speak all agent responses |
910
- | `/tts provider audioreader` | Switch to AudioReader (Kokoro-82M, local, free) |
911
- | `/tts voice ff_siwis` | Set voice (e.g., `ff_siwis` FR, `af_bella` EN) |
912
-
913
- **Supported TTS providers:** Edge TTS, espeak, macOS `say`, Piper, OpenAI, ElevenLabs, AudioReader (Kokoro-82M)
914
-
915
- **Infinite voice conversation:** Enable `continuousListening` + `autoSpeak` with AudioReader for a hands-free loop: listen → STT → agent → TTS → listen.
916
-
917
1267
  ---
918
1268
 
919
- ## Plugin System
1269
+ ## Configuration
920
1270
 
921
- ### Plugin Structure
1271
+ ### Environment Variables
922
1272
 
923
- ```
924
- ~/.codebuddy/plugins/
925
- my-plugin/
926
- manifest.json
927
- index.js
928
- ```
1273
+ | Variable | Description | Default |
1274
+ |:---------|:------------|:--------|
1275
+ | `GROK_API_KEY` | xAI API key | Required |
1276
+ | `ANTHROPIC_API_KEY` | Anthropic API key | - |
1277
+ | `OPENAI_API_KEY` | OpenAI API key | - |
1278
+ | `GOOGLE_API_KEY` | Google AI API key | - |
1279
+ | `SERPER_API_KEY` | Web search API key | - |
1280
+ | `GROK_BASE_URL` | Custom API endpoint | - |
1281
+ | `GROK_MODEL` | Default model | - |
1282
+ | `BRAVE_API_KEY` | Brave Search API key | - |
1283
+ | `EXA_API_KEY` | Exa neural search API key | - |
1284
+ | `PERPLEXITY_API_KEY` | Perplexity AI search key (`pplx-...`) | - |
1285
+ | `OPENROUTER_API_KEY` | OpenRouter key for Perplexity (`sk-or-...`) | - |
1286
+ | `PERPLEXITY_MODEL` | Perplexity model | `perplexity/sonar-pro` |
1287
+ | `PICOVOICE_ACCESS_KEY` | Porcupine wake word detection | - |
1288
+ | `CACHE_TRACE` | Debug prompt construction stages | `false` |
1289
+ | `YOLO_MODE` | Full autonomy | `false` |
1290
+ | `MAX_COST` | Cost limit ($) | `10` |
1291
+ | `JWT_SECRET` | API server auth | Required in prod |
1292
+ | `TELEGRAM_BOT_TOKEN` | Telegram bot token (from @BotFather) | - |
1293
+ | `DISCORD_TOKEN` | Discord bot token | - |
1294
+ | `SLACK_BOT_TOKEN` | Slack bot token | - |
929
1295
 
930
- ### Plugin Types
1296
+ **Optional Rust tools:**
931
1297
 
932
- - **Tool Plugins**: Add custom tools
933
- - **Provider Plugins**: Add LLM/embedding/search providers
934
- - **Command Plugins**: Add slash commands
935
- - **Hook Plugins**: Add lifecycle hooks
1298
+ | Tool | Install | Purpose |
1299
+ |:-----|:--------|:--------|
1300
+ | **RTK** | `cargo install --git https://github.com/rtk-ai/rtk` | CLI proxy that wraps commands to reduce LLM token usage 60-90% |
1301
+ | **ICM** | `cargo install --git https://github.com/rtk-ai/icm` | MCP server for persistent cross-session memory |
936
1302
 
937
- ### Example Plugin
1303
+ ### Project Settings
938
1304
 
939
- ```typescript
940
- const plugin: Plugin = {
941
- async activate(context: PluginContext) {
942
- context.registerTool({
943
- name: 'my_tool',
944
- description: 'Custom tool',
945
- execute: async (args) => {
946
- return { success: true, output: 'Done!' };
947
- }
948
- });
1305
+ Create `.codebuddy/settings.json`:
949
1306
 
950
- context.registerProvider({
951
- id: 'my-llm',
952
- type: 'llm',
953
- async chat(messages) { return 'response'; }
954
- });
1307
+ ```json
1308
+ {
1309
+ "systemPrompt": "You are working on a TypeScript project.",
1310
+ "tools": {
1311
+ "enabled": ["read_file", "search", "bash"],
1312
+ "disabled": ["web_search"]
1313
+ },
1314
+ "security": {
1315
+ "mode": "auto-edit",
1316
+ "bashAllowlist": ["npm *", "git *"]
955
1317
  }
956
- };
1318
+ }
957
1319
  ```
958
1320
 
959
1321
  ---
960
1322
 
961
- ## Bundled Skills (40)
962
-
963
- Code Buddy includes 40 built-in SKILL.md files that provide domain-specific knowledge, best practices, and MCP server integration for popular software. Skills are loaded contextually when relevant to your project.
964
-
965
- | Category | Skill | Description |
966
- |----------|-------|-------------|
967
- | **PR Workflow** | `review-pr` | Code review checklist, inline comments, approval criteria |
968
- | | `prepare-pr` | Branch naming, commit cleanup, PR description template |
969
- | | `merge-pr` | Merge strategies, conflict resolution, post-merge cleanup |
970
- | **Dev Tools** | `github` | Issues, releases, Actions workflows, gh CLI |
971
- | | `gitlab` | GitLab API, glab CLI, CI/CD pipelines, merge requests |
972
- | | `session-logs` | Export/search conversation history and session metadata |
973
- | | `model-usage` | Token tracking, cost analysis, provider comparison |
974
- | | `tmux-sessions` | Terminal multiplexing, pane layouts, session management |
975
- | | `healthcheck` | Service monitoring, endpoint checks, alerting |
976
- | **Project** | `project-best-practices` | Project scaffolding, structure, linting, testing conventions |
977
- | | `csharp-avalonia` | Cross-platform desktop/mobile with C# and Avalonia UI |
978
- | | `coding-agent` | Autonomous multi-step coding with planning and validation |
979
- | | `skill-creator` | Author new SKILL.md files with YAML frontmatter |
980
- | **Creative & 3D** | `blender` | Python bpy scripting, CLI rendering, Geometry Nodes |
981
- | | `unreal-engine` | Remote Control API, Python editor scripting, Movie Render Queue |
982
- | | `davinci-resolve` | DaVinciResolveScript Python API, color grading, render queue |
983
- | | `ableton-live` | OSC protocol, MIDI Remote Scripts, Max for Live |
984
- | **Design** | `figma` | REST API, Plugin API, design tokens extraction |
985
- | | `gimp` | Python-Fu / Script-Fu scripting, batch image processing |
986
- | | `inkscape` | Extensions API, CLI export, SVG manipulation |
987
- | **DevOps & Infra** | `kubernetes` | kubectl, Helm, ArgoCD GitOps |
988
- | | `terraform-ansible` | Terraform IaC + Ansible configuration management |
989
- | | `grafana-prometheus` | Grafana HTTP API, PromQL, alerting pipelines |
990
- | | `jenkins-ci` | Jenkins API, Groovy pipelines, shared libraries |
991
- | **Workflow & Data** | `n8n` | REST API, webhook triggers, workflow automation |
992
- | | `databases` | PostgreSQL, MongoDB, Redis CLI and automation |
993
- | | `game-engines` | Unity C# + Godot GDScript, builds, scene management |
994
- | **Utilities** | `summarize` | Text/file/URL summarization with configurable length |
995
- | | `weather` | Weather lookups via wttr.in and OpenWeatherMap |
996
- | **Media** | `image-gen` | Image generation via DALL-E, Stable Diffusion, Midjourney |
997
- | | `whisper-transcribe` | Audio/video transcription with OpenAI Whisper |
998
- | | `pdf-tools` | PDF creation, merging, text extraction, conversion |
999
- | | `screenshot` | Screen capture, annotation, OCR text extraction |
1000
- | | `video-tools` | FFmpeg video editing, conversion, thumbnails, GIFs |
1001
- | | `gif-search` | GIF search via Giphy and Tenor APIs |
1002
- | **Communication** | `email-tools` | Email send/read via himalaya CLI and SMTP |
1003
- | | `notion` | Notion API for pages, databases, search, content blocks |
1004
- | | `blog-watcher` | RSS/Atom feed monitoring, web page change detection |
1005
- | **Smart Home** | `spotify` | Spotify playback control via spotify_player and Web API |
1006
- | | `smart-home` | Philips Hue and Home Assistant control |
1007
-
1008
- Each skill includes **Direct Control** (CLI/API/scripting commands), **MCP Server Integration** (config for `.codebuddy/mcp.json`), and **Common Workflows** (step-by-step recipes). Skills are stored in `.codebuddy/skills/bundled/` and can be extended with managed or workspace skills via the Skills Registry.
1009
-
1010
- ---
1011
-
1012
1323
  ## Development
1013
1324
 
1014
1325
  ```bash
@@ -1048,90 +1359,88 @@ npm run build
1048
1359
 
1049
1360
  ---
1050
1361
 
1051
- ## Configuration
1362
+ ## Research & Inspiration
1052
1363
 
1053
- ### Environment Variables
1364
+ Code Buddy implements techniques from academic research and draws architectural inspiration from leading open-source projects.
1054
1365
 
1055
- | Variable | Description | Default |
1056
- |:---------|:------------|:--------|
1057
- | `GROK_API_KEY` | xAI API key | Required |
1058
- | `ANTHROPIC_API_KEY` | Anthropic API key | - |
1059
- | `OPENAI_API_KEY` | OpenAI API key | - |
1060
- | `GOOGLE_API_KEY` | Google AI API key | - |
1061
- | `SERPER_API_KEY` | Web search API key | - |
1062
- | `GROK_BASE_URL` | Custom API endpoint | - |
1063
- | `GROK_MODEL` | Default model | - |
1064
- | `BRAVE_API_KEY` | Brave Search API key | - |
1065
- | `EXA_API_KEY` | Exa neural search API key | - |
1066
- | `PERPLEXITY_API_KEY` | Perplexity AI search key (`pplx-...`) | - |
1067
- | `OPENROUTER_API_KEY` | OpenRouter key for Perplexity (`sk-or-...`) | - |
1068
- | `PERPLEXITY_MODEL` | Perplexity model | `perplexity/sonar-pro` |
1069
- | `PICOVOICE_ACCESS_KEY` | Porcupine wake word detection | - |
1070
- | `CACHE_TRACE` | Debug prompt construction stages | `false` |
1071
- | `YOLO_MODE` | Full autonomy | `false` |
1072
- | `MAX_COST` | Cost limit ($) | `10` |
1073
- | `JWT_SECRET` | API server auth | Required in prod |
1366
+ ### Scientific Papers
1074
1367
 
1075
- **Optional Rust tools (install via `cargo install`):**
1368
+ **Reasoning & Planning:**
1076
1369
 
1077
- | Tool | Install | Purpose |
1078
- |:-----|:--------|:--------|
1079
- | **RTK** | `cargo install rtk` | Compresses bash output 60-90%, reducing token usage |
1080
- | **ICM** | `cargo install icm` | MCP server for persistent cross-session memory |
1370
+ | Paper | Reference | Implementation |
1371
+ |:------|:----------|:---------------|
1372
+ | Tree of Thoughts | Yao et al., 2023 [arXiv:2305.10601](https://arxiv.org/abs/2305.10601) | `src/agent/reasoning/tree-of-thought.ts` |
1373
+ | RethinkMCTS | Zhang et al., 2024 [arXiv:2409.09584](https://arxiv.org/abs/2409.09584) | `src/agent/reasoning/mcts.ts` |
1374
+ | TALE (Token-Budget-Aware Reasoning) | [arXiv:2412.18547](https://arxiv.org/abs/2412.18547) | `src/agent/token-budget-reasoning.ts` — 68.9% token reduction |
1375
+ | FrugalGPT | Stanford, 2023 — [arXiv:2305.05176](https://arxiv.org/abs/2305.05176) | `src/optimization/model-routing.ts` — 30-70% cost reduction |
1376
+ | LLMCompiler | [arXiv:2312.04511](https://arxiv.org/abs/2312.04511) | `src/optimization/parallel-executor.ts` — 2.5-4.6x speedup |
1081
1377
 
1082
- ### Project Settings
1378
+ **Program Repair:**
1083
1379
 
1084
- Create `.codebuddy/settings.json`:
1380
+ | Paper | Reference | Implementation |
1381
+ |:------|:----------|:---------------|
1382
+ | ChatRepair | Xia et al., ISSTA 2024 — [arXiv:2403.12538](https://arxiv.org/abs/2403.12538) | `src/agent/repair/iterative-repair.ts` |
1383
+ | ITER | [arXiv:2403.00418](https://arxiv.org/abs/2403.00418) | `src/agent/repair/repair-templates.ts` — iterative template repair |
1384
+ | RepairAgent | ICSE 2024 | `src/agent/repair/repair-engine.ts` — autonomous LLM-based repair |
1385
+ | AgentCoder | Huang et al., 2023 | `src/agent/multi-agent/multi-agent-system.ts` — hierarchical multi-agent code generation |
1085
1386
 
1086
- ```json
1087
- {
1088
- "systemPrompt": "You are working on a TypeScript project.",
1089
- "tools": {
1090
- "enabled": ["read_file", "search", "bash"],
1091
- "disabled": ["web_search"]
1092
- },
1093
- "security": {
1094
- "mode": "auto-edit",
1095
- "bashAllowlist": ["npm *", "git *"]
1096
- }
1097
- }
1098
- ```
1387
+ **RAG & Context Management:**
1099
1388
 
1100
- ---
1389
+ | Paper | Reference | Implementation |
1390
+ |:------|:----------|:---------------|
1391
+ | CodeRAG | [arXiv:2509.16112](https://arxiv.org/abs/2509.16112) | `src/context/multi-path-retrieval.ts`, `src/context/dependency-aware-rag.ts` |
1392
+ | RAG-MCP | [arXiv:2505.03275](https://arxiv.org/abs/2505.03275) | `src/tools/tool-selector.ts` |
1393
+ | ToolLLM | ICLR'24 — [arXiv:2307.16789](https://arxiv.org/abs/2307.16789) | `src/agent/execution/tool-selection-strategy.ts` |
1394
+ | Comprehensive RAG Survey | [arXiv:2506.00054](https://arxiv.org/abs/2506.00054) | `src/context/codebase-rag/codebase-rag.ts` |
1395
+ | Recurrent Context Compression | [arXiv:2406.06110](https://arxiv.org/abs/2406.06110) | `src/context/context-manager-v2.ts` |
1396
+
1397
+ **Observation & Optimization:**
1398
+
1399
+ | Paper | Reference | Implementation |
1400
+ |:------|:----------|:---------------|
1401
+ | JetBrains Context Management | JetBrains Research, 2024 | `src/context/observation-masking.ts` — -7% cost, +2.6% success |
1402
+ | Complexity Trap | [arXiv:2508.21433](https://arxiv.org/abs/2508.21433) | `src/context/observation-masking.ts` |
1403
+ | Less-is-More (Tool Filtering) | arXiv, 2024 | `src/optimization/tool-filtering.ts` — 70% execution time reduction |
1404
+ | The Prompt Report | [arXiv:2406.06608](https://arxiv.org/abs/2406.06608) | `src/prompts/system-base.ts` |
1405
+
1406
+ **Testing & Memory:**
1407
+
1408
+ | Paper | Reference | Implementation |
1409
+ |:------|:----------|:---------------|
1410
+ | TDD + LLM | ICSE 2024 | `src/testing/tdd-mode.ts` — TDD improves Pass@1 by 45.97% |
1411
+ | MemGPT | UC Berkeley, 2023 | `src/memory/prospective-memory.ts` — stateful AI agents |
1101
1412
 
1102
- ## Roadmap
1103
-
1104
- ### Planned Features
1105
-
1106
- | Feature | Priority | Status |
1107
- |:--------|:---------|:-------|
1108
- | Daemon Mode (background agent) | HIGH | Done |
1109
- | Task Planner (DAG decomposition) | HIGH | ✅ Done |
1110
- | Screen Observer & Triggers | HIGH | Done |
1111
- | Proactive Agent (push notifications) | HIGH | Done |
1112
- | Multi-Agent Orchestrator | HIGH | Done |
1113
- | Self-Healing & Checkpoint Rollback | HIGH | Done |
1114
- | Canvas A2UI Visual Workspace | HIGH | Done |
1115
- | ClawHub Skills Registry | MEDIUM | Done |
1116
- | Web Search 5-Provider Chain | HIGH | Done |
1117
- | Apply Patch & Bash Parser | HIGH | Done |
1118
- | Per-Model Tool Config | MEDIUM | Done |
1119
- | Voice Wake Word Detection | MEDIUM | Done |
1120
- | TTS Providers (OpenAI, ElevenLabs, AudioReader) | MEDIUM | Done |
1121
- | Code Generation Security (Phase 7) | HIGH | Done |
1122
- | Auto-Sandbox Router | HIGH | ✅ Done |
1123
- | Semantic Output Truncation | MEDIUM | Done |
1124
- | Gateway WebSocket Control Plane | HIGH | 🔲 Planned |
1125
- | OAuth Authentication | MEDIUM | 🔲 Planned |
1126
- | Companion Apps (iOS, Android, macOS) | LOW | 🔲 Planned |
1127
- | Tailscale Integration | LOW | 🔲 Planned |
1413
+ **Fault Localization:** Ochiai, DStar, and Tarantula (Jones et al., 2002) spectrum-based techniques in `src/agent/repair/fault-localization.ts`.
1414
+
1415
+ ### Inspiration Projects
1416
+
1417
+ Code Buddy's architecture draws from these open-source projects:
1418
+
1419
+ | Project | Inspiration | Key Files |
1420
+ |:--------|:------------|:----------|
1421
+ | **[OpenClaw](https://github.com/openclaw/openclaw)** | Multi-channel messaging, DM pairing, lane queue concurrency, memory lifecycle, tool policy, skills system, heartbeat, identity system, group security, hub marketplace | 40+ files across `src/channels/`, `src/concurrency/`, `src/memory/`, `src/security/`, `src/skills/` |
1422
+ | **[OpenAI Codex CLI](https://github.com/openai/codex)** | Apply-patch unified diff, head/tail truncation, per-model tool config, turn diff tracker, security modes, OS sandbox workspace-write tiers, shell-free exec, SSRF guard, exec policy prefix rules, shell env policy, named config profiles, tool prefix naming convention, stable JSON serialization, session fork/rollout unification | `src/tools/apply-patch.ts`, `src/sandbox/os-sandbox.ts`, `src/security/ssrf-guard.ts`, `src/sandbox/execpolicy.ts`, `src/tools/registry/tool-aliases.ts`, `src/utils/stable-json.ts`, `src/observability/run-store.ts` |
1423
+ | **[Claude Code](https://github.com/anthropics/claude-code)** | Hook system, slash commands, MCP config, extended thinking, parallel subagents, headless output, Anthropic prompt cache breakpoints | `src/hooks/`, `src/commands/slash-commands.ts`, `src/mcp/config.ts`, `src/optimization/cache-breakpoints.ts` |
1424
+ | **[Gemini CLI](https://github.com/google-gemini/gemini-cli)** | Persistent checkpoints, context files, compress command, shell prefix, multimodal input | `src/checkpoints/`, `src/context/context-files.ts`, `src/input/multimodal-input.ts` |
1425
+ | **[Aider](https://github.com/paul-gauthier/aider)** | Repository map, voice input, unified diff editor, watch mode (IDE comments) | `src/context/repository-map.ts`, `src/tools/voice-input.ts`, `src/commands/watch-mode.ts` |
1426
+ | **[Cursor](https://www.cursor.com/)** | `.cursorrules` config, parallel agent system, sandboxed terminals, embedded browser | `src/config/codebuddyrules.ts`, `src/agent/parallel/`, `src/browser/embedded-browser.ts` |
1427
+ | **[Mistral Vibe](https://github.com/mistralai/mistral-vibe)** | External markdown prompts, TOML config, tool permission system, fuzzy match, update notifier | `src/prompts/`, `src/config/toml-config.ts`, `src/utils/fuzzy-match.ts` |
1428
+ | **[Conductor](https://github.com/conductor-is/conductor)** | Spec-driven development, track system | `src/tracks/` |
1429
+ | **[RTK](https://github.com/rtk-ai/rtk)** | Command proxy for 60-90% token reduction | `src/utils/rtk-compressor.ts` |
1430
+ | **[ICM](https://github.com/rtk-ai/icm)** | Persistent cross-session memory via MCP | `src/memory/icm-bridge.ts` |
1431
+ | **[Manus AI](https://manus.im)** | Wide Research (parallel sub-agent research workers), Knowledge Base injection, todo.md attention bias, restorable context compression, pre-compaction NO_REPLY flush, inline web-search citations, observation variator (anti-repetition), structured prompt variation, tool result compaction guard, disk-backed tool results, response prefill modes (tool_choice control), WebSearchMode + domain policy, message queue debounce/cap/overflow | `src/agent/wide-research.ts`, `src/context/observation-variator.ts`, `src/agent/response-constraint.ts`, `src/tools/web-search.ts`, `src/agent/message-queue.ts` |
1432
+ | **[OpenClaw](https://github.com/openclaw/openclaw)** | Multi-channel messaging, DM pairing, lane queue concurrency, memory lifecycle, tool policy, skills system, heartbeat, identity system, group security, hub marketplace, daily session reset, per-channel streaming policies | `src/channels/streaming-policy.ts`, `src/channels/`, `src/skills/`, `src/daemon/daily-reset.ts` |
1433
+
1434
+ **Other influences:** Rust (Result<T, E> pattern), AutoGPT, MetaGPT, CrewAI, ChatDev (role-based multi-agent), ReAct (reasoning + acting paradigm), Qodo/PR-Agent (RAG for code repos).
1435
+
1436
+ **Benchmarks referenced:** SWE-bench, HumanEval, MBPP, BigCodeBench, WebArena, Berkeley Function Calling Leaderboard.
1437
+
1438
+ For detailed research notes, see `docs/RESEARCH_IMPROVEMENTS.md`, `docs/RAG_TOOL_SELECTION.md`, and `deep_research/ai-coding-assistant-improvements/`.
1128
1439
 
1129
1440
  ---
1130
1441
 
1131
1442
  ## Troubleshooting
1132
1443
 
1133
- ### Common Issues
1134
-
1135
1444
  **API key not working**
1136
1445
  ```bash
1137
1446
  echo $GROK_API_KEY # Verify key is set
@@ -1161,8 +1470,7 @@ buddy
1161
1470
  - Use a faster model: `buddy --model grok-code-fast-1`
1162
1471
  - Use local LLM: `buddy --base-url http://localhost:11434/v1 --model llama3`
1163
1472
 
1164
- ### Debug Mode
1165
-
1473
+ **Debug mode**
1166
1474
  ```bash
1167
1475
  DEBUG=codebuddy:* buddy
1168
1476
  ```
@@ -1181,6 +1489,6 @@ MIT License - see [LICENSE](LICENSE) for details.
1181
1489
  **[Request Feature](https://github.com/phuetz/code-buddy/discussions)** |
1182
1490
  **[Star on GitHub](https://github.com/phuetz/code-buddy)**
1183
1491
 
1184
- <sub>Inspired by [OpenClaw](https://github.com/openclaw/openclaw) | Multi-AI: Grok | Claude | ChatGPT | Gemini | LM Studio | Ollama</sub>
1492
+ <sub>Multi-AI: Grok | Claude | ChatGPT | Gemini | LM Studio | Ollama</sub>
1185
1493
 
1186
1494
  </div>