@tencent-ai/codebuddy-code 2.125.4-next.41bad82.202607231203 → 2.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/codebuddy-headless.js +11 -11
  3. package/dist/codebuddy.js +13 -13
  4. package/dist/web-ui/docs/cn/cli/agent-teams.md +6 -0
  5. package/dist/web-ui/docs/cn/cli/cli-reference.md +3 -2
  6. package/dist/web-ui/docs/cn/cli/costs.md +7 -7
  7. package/dist/web-ui/docs/cn/cli/daemon.md +8 -2
  8. package/dist/web-ui/docs/cn/cli/env-vars.md +16 -6
  9. package/dist/web-ui/docs/cn/cli/hooks.md +26 -4
  10. package/dist/web-ui/docs/cn/cli/http-api.md +98 -5
  11. package/dist/web-ui/docs/cn/cli/iam.md +1 -1
  12. package/dist/web-ui/docs/cn/cli/models.md +43 -13
  13. package/dist/web-ui/docs/cn/cli/permissions.md +2 -1
  14. package/dist/web-ui/docs/cn/cli/plugins-reference.md +2 -0
  15. package/dist/web-ui/docs/cn/cli/release-notes/README.md +15 -0
  16. package/dist/web-ui/docs/cn/cli/release-notes/v2.120.0.md +31 -0
  17. package/dist/web-ui/docs/cn/cli/release-notes/v2.121.0.md +42 -0
  18. package/dist/web-ui/docs/cn/cli/release-notes/v2.121.1.md +20 -0
  19. package/dist/web-ui/docs/cn/cli/release-notes/v2.121.2.md +23 -0
  20. package/dist/web-ui/docs/cn/cli/release-notes/v2.121.3.md +21 -0
  21. package/dist/web-ui/docs/cn/cli/release-notes/v2.122.0.md +52 -0
  22. package/dist/web-ui/docs/cn/cli/release-notes/v2.123.0.md +28 -0
  23. package/dist/web-ui/docs/cn/cli/release-notes/v2.123.1.md +13 -0
  24. package/dist/web-ui/docs/cn/cli/release-notes/v2.124.0.md +30 -0
  25. package/dist/web-ui/docs/cn/cli/release-notes/v2.124.1.md +22 -0
  26. package/dist/web-ui/docs/cn/cli/release-notes/v2.125.0.md +44 -0
  27. package/dist/web-ui/docs/cn/cli/release-notes/v2.125.1.md +22 -0
  28. package/dist/web-ui/docs/cn/cli/release-notes/v2.125.2.md +13 -0
  29. package/dist/web-ui/docs/cn/cli/release-notes/v2.125.3.md +30 -0
  30. package/dist/web-ui/docs/cn/cli/release-notes/v2.125.4.md +33 -0
  31. package/dist/web-ui/docs/cn/cli/sdk-hooks.md +30 -0
  32. package/dist/web-ui/docs/cn/cli/settings.md +38 -4
  33. package/dist/web-ui/docs/cn/cli/slash-commands.md +2 -2
  34. package/dist/web-ui/docs/cn/cli/sub-agents.md +116 -11
  35. package/dist/web-ui/docs/cn/cli/troubleshooting.md +55 -0
  36. package/dist/web-ui/docs/cn/cli/web-ui.md +1 -0
  37. package/dist/web-ui/docs/en/cli/agent-teams.md +6 -0
  38. package/dist/web-ui/docs/en/cli/cli-reference.md +3 -2
  39. package/dist/web-ui/docs/en/cli/costs.md +4 -4
  40. package/dist/web-ui/docs/en/cli/daemon.md +8 -2
  41. package/dist/web-ui/docs/en/cli/env-vars.md +16 -6
  42. package/dist/web-ui/docs/en/cli/hooks.md +26 -4
  43. package/dist/web-ui/docs/en/cli/http-api.md +98 -5
  44. package/dist/web-ui/docs/en/cli/models.md +43 -13
  45. package/dist/web-ui/docs/en/cli/permissions.md +2 -1
  46. package/dist/web-ui/docs/en/cli/plugins-reference.md +10 -0
  47. package/dist/web-ui/docs/en/cli/release-notes/README.md +15 -0
  48. package/dist/web-ui/docs/en/cli/release-notes/v2.120.0.md +31 -0
  49. package/dist/web-ui/docs/en/cli/release-notes/v2.121.0.md +42 -0
  50. package/dist/web-ui/docs/en/cli/release-notes/v2.121.1.md +20 -0
  51. package/dist/web-ui/docs/en/cli/release-notes/v2.121.2.md +23 -0
  52. package/dist/web-ui/docs/en/cli/release-notes/v2.121.3.md +21 -0
  53. package/dist/web-ui/docs/en/cli/release-notes/v2.122.0.md +52 -0
  54. package/dist/web-ui/docs/en/cli/release-notes/v2.123.0.md +28 -0
  55. package/dist/web-ui/docs/en/cli/release-notes/v2.123.1.md +13 -0
  56. package/dist/web-ui/docs/en/cli/release-notes/v2.124.0.md +30 -0
  57. package/dist/web-ui/docs/en/cli/release-notes/v2.124.1.md +22 -0
  58. package/dist/web-ui/docs/en/cli/release-notes/v2.125.0.md +44 -0
  59. package/dist/web-ui/docs/en/cli/release-notes/v2.125.1.md +22 -0
  60. package/dist/web-ui/docs/en/cli/release-notes/v2.125.2.md +13 -0
  61. package/dist/web-ui/docs/en/cli/release-notes/v2.125.3.md +30 -0
  62. package/dist/web-ui/docs/en/cli/release-notes/v2.125.4.md +33 -0
  63. package/dist/web-ui/docs/en/cli/sdk-hooks.md +30 -0
  64. package/dist/web-ui/docs/en/cli/settings.md +37 -3
  65. package/dist/web-ui/docs/en/cli/slash-commands.md +2 -2
  66. package/dist/web-ui/docs/en/cli/sub-agents.md +114 -9
  67. package/dist/web-ui/docs/en/cli/troubleshooting.md +55 -0
  68. package/dist/web-ui/docs/en/cli/web-ui.md +3 -0
  69. package/dist/web-ui/docs/search-index-en.json +1 -1
  70. package/dist/web-ui/docs/search-index-zh.json +1 -1
  71. package/dist/web-ui/docs/sidebar-en.json +1 -1
  72. package/dist/web-ui/docs/sidebar-zh.json +1 -1
  73. package/package.json +2 -3
  74. package/product.cloudhosted.json +2 -2
  75. package/product.internal.json +2 -2
  76. package/product.ioa.json +2 -2
  77. package/product.json +2 -2
  78. package/product.selfhosted.json +2 -2
  79. package/dist/web-ui/docs/cn/cli/brokered-shell-macos.md +0 -778
  80. package/dist/web-ui/docs/en/cli/brokered-shell-macos.md +0 -778
@@ -0,0 +1,44 @@
1
+ # 🚀 CodeBuddy Code v2.125.0 Release
2
+
3
+ ## 📦 Version Information
4
+
5
+ | Component | Version |
6
+ |-----------|---------|
7
+ | CodeBuddy Code CLI | v2.125.0 |
8
+ | Agent SDK JS | v0.3.222 |
9
+ | Agent SDK Python | v0.3.221 |
10
+
11
+ ## ✨ New Features
12
+
13
+ ### Infinite Scroll for Plugin List
14
+
15
+ The installed and marketplace browse lists now use infinite scroll with load-more on reaching the bottom, along with a one-click back-to-top button, making it smoother to browse large numbers of plugins.
16
+
17
+ ### Subagent-scoped MCP Support
18
+
19
+ Subagents can now declare dedicated `mcpServers` configurations in their definitions:
20
+
21
+ - Inline MCP servers are only created when the current subagent starts, visible only to that subagent, and automatically cleaned up when finished — without polluting the main agent or other subagents
22
+ - String references can reuse existing global MCP servers
23
+ - ToolSearch / DeferExecuteTool can discover and invoke tools provided by scoped MCP within the current subagent
24
+ - When `--strict-mcp-config` strict mode is enabled, scoped MCP for trusted built-in product subagents is allowed via a whitelist
25
+
26
+ ## 🔧 Improvements
27
+
28
+ - **OOM forensics fallback**: Long-running sessions (e.g., `/goal`) can automatically write a heap snapshot when approaching the heap limit for post-mortem analysis. Disabled by default; enable via environment variable when needed
29
+ - **Skill visibility isolation**: Skills with `disable: true` are no longer hard-removed from the menu. Instead, they are excluded from the model's default context but can still be manually triggered by users via the `/` menu
30
+
31
+ ## 🐛 Bug Fixes
32
+
33
+ - **Custom model tool image results**: Fixed an issue where overly strict image validation by some third-party gateways on tool-returned images caused request failures
34
+ - **Daemon restart host loss**: Fixed an issue where `daemon restart` without arguments silently fell back to the default host configuration
35
+ - **Session file recovery**: Fixed a memory exception caused by internal artifact index files when loading/rewinding old sessions
36
+ - **stream-json resume replay timestamps**: Fixed an issue where replayed historical messages during session resume showed the replay time instead of the original creation time
37
+ - **File watcher ENOSPC**: Fixed a crash on Linux when mounting file watchers on large project directories exhausted the system's inotify limit
38
+ - **WebSearch time keywords**: Fixed an issue where time-related searches such as "today", "this year", and "latest" did not use the current time to construct queries
39
+ - **Plugin session isolation**: Fixed an issue where plugin management operations could incorrectly reuse the previous session's plugin combination in a new session
40
+ - **AskUserQuestion interaction**: Fixed an issue where ACP clients skipping questions could cause approval waits to hang
41
+
42
+ ## 📝 Documentation Updates
43
+
44
+ - Improved documentation for built-in subagents and scenario model configuration methods, parsing priorities, and usage entry points
@@ -0,0 +1,22 @@
1
+ # 🚀 CodeBuddy Code v2.125.1 Release
2
+
3
+ ## 📦 Version Information
4
+
5
+ | Component | Version |
6
+ |-----------|---------|
7
+ | CodeBuddy Code CLI | v2.125.1 |
8
+ | Agent SDK JS | v0.3.223 |
9
+ | Agent SDK Python | v0.3.222 |
10
+
11
+ ## 🔧 Improvements
12
+
13
+ - **No-persistence session mode**: Added the `--no-session-persistence` flag. Session context is kept in memory only, without creating or appending to local session records, while retaining read-only access to existing history. Suitable for temporary or privacy-sensitive scenarios.
14
+
15
+ ## 🐛 Bug Fixes
16
+
17
+ - **More reliable managed session startup**: The system now automatically assigns available ports and establishes connections only after the service is truly ready, avoiding session startup failures caused by port conflicts.
18
+ - **Sub-agent registration**: Fixed an issue where a plugin-designated main session agent was duplicated as an invocable sub-agent, while preserving the normal invocation of member agents within the same plugin.
19
+ - **Agent team tool visibility**: When the agent team feature is disabled, the related team creation, deletion tools, and team collaboration prompts are now hidden synchronously to prevent accidental triggers.
20
+ - **Chinese/encoding garbled text fix**: Restored encoding detection for file reads and Shell output, resolving the issue where Chinese content displayed as garbled text in some non-UTF-8 (GBK/CP936, etc.) scenarios.
21
+ - **Clearer local hook blocking messages**: When a workspace-configured hook is missing or actively blocks execution, it no longer shows a generic "service error." Instead, the conversation now clearly indicates that a local hook intercepted the request along with the reason, aligning with mainstream implementations.
22
+ - **WebUI cross-origin access**: Fixed an issue where the automatic CORS relaxation logic did not take effect when starting WebUI with `--host 0.0.0.0`. The `--serve` / daemon startup modes can now be accessed directly in cloud VM environments such as anydev without manually configuring CORS origins.
@@ -0,0 +1,13 @@
1
+ # 🚀 CodeBuddy Code v2.125.2 Release
2
+
3
+ ## 📦 Version Information
4
+
5
+ | Component | Version |
6
+ |-----------|---------|
7
+ | CodeBuddy Code CLI | v2.125.2 |
8
+ | Agent SDK JS | v0.3.224 |
9
+ | Agent SDK Python | v0.3.223 |
10
+
11
+ ## 🐛 Bug Fixes
12
+
13
+ - **Custom model conversation reporting**: Fixed an issue where conversations using custom models in WorkBuddy Desktop were not counted in activity statistics (activity map, consecutive login days, etc.). Custom model conversations now report normally.
@@ -0,0 +1,30 @@
1
+ # 🚀 CodeBuddy Code v2.125.3 Release
2
+
3
+ > This is a re-published release: v2.125.1 and v2.125.2 failed to publish due to release process anomalies, and the production environment remained at v2.125.0. v2.125.3 has been rebuilt and published, fully including all changes from the two aforementioned versions.
4
+
5
+ ## 📦 Version Information
6
+
7
+ | Component | Version |
8
+ |-----------|---------|
9
+ | CodeBuddy Code CLI | v2.125.3 |
10
+ | Agent SDK JS | v0.3.225 |
11
+ | Agent SDK Python | v0.3.224 |
12
+
13
+ ## ✨ New Features
14
+
15
+ ### No-Persistence Session
16
+
17
+ Added the `--no-session-persistence` option. Session context is kept in memory only, without creating or appending to local transcripts, while retaining read-only access to existing history. Suitable for temporary sessions and sensitive scenarios.
18
+
19
+ ## 🔧 Improvements
20
+
21
+ - **WorkBuddy managed session startup**: The system now assigns available ports and establishes connections only after the service is truly ready, avoiding session startup failures caused by port conflicts.
22
+
23
+ ## 🐛 Bug Fixes
24
+
25
+ - **Custom model conversation reporting**: Fixed an issue where conversations using custom models in WorkBuddy Desktop were not counted in activity statistics (activity map, consecutive login days, etc.). Custom model conversations now report normally.
26
+ - **Sub-agent registration**: Fixed an issue where a plugin-designated main session agent via `settings.agent` was duplicated as an invocable sub-agent, while preserving the invocation of member agents within the same plugin.
27
+ - **Agent team tools**: When agent teams are disabled, lazily loaded TeamCreate, TeamDelete, and Agent tools' team collaboration prompts are now hidden synchronously.
28
+ - **Chinese/encoding garbled text**: Restored encoding detection for file reads and Shell output, resolving the issue where Chinese content displayed as garbled text in some non-UTF-8 (GBK/CP936, etc.) scenarios.
29
+ - **Local hook blocking visibility**: When a workspace hook script is missing or blocks with a non-zero exit code, the blocking reason is now written to history as a message and the session terminates cleanly. The client can precisely identify it as a local hook interception, instead of only seeing a generic service error.
30
+ - **WebUI CORS**: Fixed an issue where the automatic CORS relaxation logic did not take effect when starting WebUI with `--host 0.0.0.0`. The `--serve` / daemon startup modes can now be accessed normally in cloud VM environments without manually setting environment variables.
@@ -0,0 +1,33 @@
1
+ # 🚀 CodeBuddy Code v2.125.4 Release
2
+
3
+ > This is a re-published release: v2.125.1, v2.125.2, and v2.125.3 all failed to publish due to release process anomalies, and the production environment remained at v2.125.0. v2.125.4 has been rebuilt and published, fully including all changes from the three aforementioned versions, plus a new interaction experience fix.
4
+
5
+ ## 📦 Version Information
6
+
7
+ | Component | Version |
8
+ |-----------|---------|
9
+ | CodeBuddy Code CLI | v2.125.4 |
10
+ | Agent SDK JS | v0.3.226 |
11
+ | Agent SDK Python | v0.3.225 |
12
+
13
+ ## ✨ New Features
14
+
15
+ ### No-Persistence Session
16
+
17
+ Added the `--no-session-persistence` option. Session context is kept in memory only, without creating or appending to local transcripts, while retaining read-only access to existing history. Suitable for temporary sessions and sensitive scenarios.
18
+
19
+ ## 🔧 Improvements
20
+
21
+ - **WorkBuddy managed session startup**: The system now assigns available ports and establishes connections only after the service is truly ready, avoiding session startup failures caused by port conflicts.
22
+
23
+ ## 🐛 Bug Fixes
24
+
25
+ - **Main page tab switching lag**: Fixed an issue where switching tabs on the main page caused lag, improving page interaction smoothness.
26
+ - **MCP OAuth token exchange**: Fixed an issue where, in HTTP/SSE type MCP server scenarios through a gateway proxy, the token exchange returned a 404 after successful OAuth authorization. The callback phase now reuses the discovery results cached during the initial authorization flow, ensuring the token request is sent to the correct authorization server.
27
+ - **MCP config path isolation**: Fixed an issue where the `CODEBUDDY_CONFIG_DIR` environment variable could not isolate user/local-level MCP configuration file paths. MCP configuration now follows this environment variable override consistently with other configurations, preventing accidental writes to the host machine's real configuration in multi-instance and automated testing isolation scenarios.
28
+ - **Custom model conversation reporting**: Fixed an issue where conversations using custom models in WorkBuddy Desktop were not counted in activity statistics (activity map, consecutive login days, etc.). Custom model conversations now report normally.
29
+ - **Sub-agent registration**: Fixed an issue where a plugin-designated main session agent via `settings.agent` was duplicated as an invocable sub-agent, while preserving the invocation of member agents within the same plugin.
30
+ - **Agent team tools**: When agent teams are disabled, lazily loaded TeamCreate, TeamDelete, and Agent tools' team collaboration prompts are now hidden synchronously.
31
+ - **Chinese/encoding garbled text**: Restored encoding detection for file reads and Shell output, resolving the issue where Chinese content displayed as garbled text in some non-UTF-8 (GBK/CP936, etc.) scenarios.
32
+ - **Local hook blocking visibility**: When a workspace hook script is missing or blocks with a non-zero exit code, the blocking reason is now written to history as a message and the session terminates cleanly. The client can precisely identify it as a local hook interception, instead of only seeing a generic service error.
33
+ - **WebUI CORS**: Fixed an issue where the automatic CORS relaxation logic did not take effect when starting WebUI with `--host 0.0.0.0`. The `--serve` / daemon startup modes can now be accessed normally in cloud VM environments without manually setting environment variables.
@@ -512,6 +512,36 @@ return {
512
512
 
513
513
  :::
514
514
 
515
+ ### PostToolUse Special Output
516
+
517
+ You can append context to the Agent (`additionalContext`), or use `updatedToolOutput` to **replace** the tool result that will be sent to the Agent (applies to all tools, commonly used to compress verbose output to save tokens):
518
+
519
+ ::: code-group
520
+
521
+ ```typescript [TypeScript]
522
+ return {
523
+ continue: true,
524
+ hookSpecificOutput: {
525
+ hookEventName: 'PostToolUse',
526
+ // Replace tool result (result may become shorter); alternatively use additionalContext to append (result only grows longer)
527
+ updatedToolOutput: compress(input.tool_response)
528
+ }
529
+ };
530
+ ```
531
+
532
+ ```python [Python]
533
+ return {
534
+ "continue_": True,
535
+ "hookSpecificOutput": {
536
+ "hookEventName": "PostToolUse",
537
+ # Replace tool result (result may become shorter); alternatively use additionalContext to append (result only grows longer)
538
+ "updatedToolOutput": compress(input_data.get("tool_response"))
539
+ }
540
+ }
541
+ ```
542
+
543
+ :::
544
+
515
545
  ## Examples
516
546
 
517
547
  ### Complete Example: Bash Command Auditing
@@ -37,6 +37,16 @@ The `settings.json` file is the official mechanism for configuring CodeBuddy Cod
37
37
  "DEBUG": "codebuddy:*"
38
38
  },
39
39
  "model": "gpt-5",
40
+ "subagents": {
41
+ "agents": {
42
+ "Explore": { "model": "lite" },
43
+ "Plan": { "model": "reasoning" }
44
+ }
45
+ },
46
+ "variantModels": {
47
+ "lite": "<fast-model-id>",
48
+ "reasoning": "<reasoning-model-id>"
49
+ },
40
50
  "cleanupPeriodDays": 30,
41
51
  "includeCoAuthoredBy": false,
42
52
  "statusLine": {
@@ -65,8 +75,8 @@ The `settings.json` file is the official mechanism for configuring CodeBuddy Cod
65
75
  | `disableAllHooks` | Disable all [hooks](hooks.md) | `true` |
66
76
  | `allowUntrustedFrontmatterHooks` | Whether to allow execution of frontmatter `hooks` fields from agents/skills with **non-product-builtin** sources (including local user `.codebuddy/agents\|skills/*.md` and the plugin marketplace). Defaults to `false` to prevent untrusted md files from silently launching shell commands; only product-builtin agents/skills are unaffected. | `true` |
67
77
  | `model` | Override the default model used by CodeBuddy Code | `"gpt-5"` |
68
- | `subagents` | Specify models per built-in sub-agent granularity. Structure: `{"agents": {"<sub-agent-name>": {"model": "..."}}}` (`agents` key = sub-agent name, e.g. `Explore`; `model` = model ID / alias / variant `lite`\|`reasoning` / `inherit`). Each sub-agent is independent, supporting both global and project scopes. Can be visually edited in the `/agents` panel. Priority: env `CODEBUDDY_CODE_SUBAGENT_MODEL` (applies to all) > project > global > built-in default > inherit main model. See [Sub-Agents Documentation](sub-agents.md) | `{"agents": {"Explore": {"model": "gpt-5.1-codex"}, "general-purpose": {"model": "claude-opus-4"}}}` |
69
- | `variantModels` | Mapping from scenario variant to model (key = `lite`\|`reasoning`; value = model ID / alias). Affects all logic using that variant (e.g., sub-agents like `Explore` that declare `lite`). Can be edited in the "Scenario Variants" section of the `/model` panel. Priority: env (`CODEBUDDY_SMALL_FAST_MODEL` / `CODEBUDDY_BIG_SLOW_MODEL`, per variant) > project > global > model-level `relatedModels` > main model fallback | `{"lite": "gpt-5.1-codex-lite", "reasoning": "gpt-5.5"}` |
78
+ | `subagents` | Specify models per built-in sub-agent name. Structure: `{"agents": {"<sub-agent-name>": {"model": "..."}}}`; `model` supports model ID, alias, `lite` / `reasoning` or `inherit` / `default`. Each sub-agent is independent, supporting both global and project scopes. Can be visually edited in the `/agents` panel. Priority: `CODEBUDDY_CODE_SUBAGENT_MODEL` > tool invocation `model` parameter for this call > project settings > global user settings > built-in declaration > main model. See [Sub-Agents Documentation](sub-agents.md) | `{"agents": {"Explore": {"model": "lite"}, "Plan": {"model": "reasoning"}}}` |
79
+ | `variantModels` | Map common scenario variants to models. Key is `lite` or `reasoning`, value is model ID or alias. This mapping affects all logic using the corresponding variant. Can be edited in the **Scenario Models** section of `/model`. Priority: corresponding variant environment variable > project settings > global user settings > main model's `relatedModels` > applicable product built-in default > main model | `{"lite": "<fast-model-id>", "reasoning": "<reasoning-model-id>"}` |
70
80
  | `agent` | Override the agent name used by the main thread (built-in or custom agent), applying that agent's system prompt, tool restrictions, and model configuration. Priority: `product.json default` → `plugin agent` → `settings.json agent` → `CLI --agent` | `"my-reviewer"` |
71
81
  | `statusLine` | Configure a custom status line to display context. See [statusLine documentation](#status-line-configuration) | `{"type": "command", "command": "~/.codebuddy/statusline.sh"}` |
72
82
  | `enableAllProjectMcpServers` | Auto-approve all MCP servers defined in the project's `.mcp.json` file | `false` |
@@ -448,7 +458,31 @@ Set to `0` or a negative value to disable timeout protection (not recommended; a
448
458
 
449
459
  ## Sub-Agent Configuration
450
460
 
451
- CodeBuddy Code supports custom AI sub-agents configurable at user and project levels. These sub-agents are stored as Markdown files with YAML frontmatter:
461
+ CodeBuddy Code supports independently selecting models for built-in sub-agents, as well as creating custom sub-agents via Markdown files.
462
+
463
+ Built-in sub-agents and scenario models can be combined in user-level or project-level `settings.json`:
464
+
465
+ ```json
466
+ {
467
+ "subagents": {
468
+ "agents": {
469
+ "Explore": { "model": "lite" },
470
+ "Plan": { "model": "reasoning" }
471
+ }
472
+ },
473
+ "variantModels": {
474
+ "lite": "<fast-model-id>",
475
+ "reasoning": "<reasoning-model-id>"
476
+ }
477
+ }
478
+ ```
479
+
480
+ * Use `/agents` to edit built-in sub-agent mappings; use the **Scenario Models** section of `/model` to edit `lite` and `reasoning` mappings.
481
+ * **Global** writes to user settings, **Project** writes to shared project settings.
482
+ * `subagents` merges by sub-agent name, `variantModels` merges by variant name. Project-level overriding `Explore` will not delete other sub-agent configurations at the user level; project-level overriding `reasoning` will not delete user-level `lite` either.
483
+ * Selecting **Inherit / Default** in `/agents`, or selecting **Default** in `/model`, will delete the corresponding entry for the selected scope and restore the lower-priority resolution chain.
484
+
485
+ Custom sub-agents are stored as Markdown files with YAML frontmatter:
452
486
 
453
487
  * **User sub-agents**: `~/.codebuddy/agents/` - Available across all projects
454
488
  * **Project sub-agents**: `.codebuddy/agents/` - Project-specific, shareable with the team
@@ -15,7 +15,7 @@ These commands are used to manage your CodeBuddy Code sessions. Here is the curr
15
15
  | `/doctor` | | ✅ Supported | Check the status and environment of CodeBuddy Code. |
16
16
  | `/status` | | ✅ Supported | Display the status of the current repository and session. |
17
17
  | `/add-dir` | `<path>` | ✅ Supported | Add a working directory. Specify the path of the directory to add. |
18
- | `/agents` | | ✅ Supported | Manage experimental AI agents |
18
+ | `/agents` | | ✅ Supported | Manage built-in and custom AI agents; view the effective routing values and their sources for built-in sub-agents, and save model settings to Global or Project scope. Specific scenario models can be viewed in `/model`. |
19
19
  | `/branch` | `[name]` | ✅ Supported | Create a branch at the current conversation point, copying active conversation history to a new session and automatically switching to it. Optionally specify a branch name. |
20
20
  | `/btw` | `<question>` | ✅ Supported | Quick side question without interrupting the current Agent workflow. Useful for asking brief questions while the Agent is executing a task. Answers are generated based on existing context. |
21
21
  | `/compact`| | ✅ Supported | Compress context. |
@@ -25,7 +25,7 @@ These commands are used to manage your CodeBuddy Code sessions. Here is the curr
25
25
  | `/init` | | ✅ Supported | Initialize a new CodeBuddy repository. |
26
26
  | `/mcp` | | ✅ Supported | Manage MCP connections. |
27
27
  | `/memory`| | ✅ Supported | Manage long-term memory |
28
- | `/model` | `[list \| model-name]` | ✅ Supported | Switch or view the currently used AI model. Opens an interactive selection interface when used without parameters, `list` lists available models, or directly switches to the specified model when provided with a model name (e.g., `/model gpt-4o`). |
28
+ | `/model` | `[list \| model-name]` | ✅ Supported | Switch or view the main model. Opens an interactive interface when used without parameters; you can also view or edit the effective models, sources, and Global / Project settings for `lite` / `reasoning` in the **Scenario Models** section. `list` lists available models; when provided with a model name, directly switches the main model. |
29
29
  | `/model:text-to-image` | `[list \| model-id]` | ✅ Supported | Switch or view the currently used text-to-image model. Opens an interactive selection interface when used without parameters, `list` lists available models, or directly switches to the specified model when provided with a model ID. |
30
30
  | `/model:image-to-image` | `[list \| model-id]` | ✅ Supported | Switch or view the currently used image-to-image model. Opens an interactive selection interface when used without parameters, `list` lists available models, or directly switches to the specified model when provided with a model ID. |
31
31
  | `/permissions` | | ✅ Supported | Manage tool permissions and workspace directory access permissions. |
@@ -131,19 +131,121 @@ the sub-agent should follow.
131
131
  | `name` | Yes | Unique identifier using lowercase letters and hyphens |
132
132
  | `description` | Yes | Natural language description of the sub-agent's purpose |
133
133
  | `tools` | No | Comma-separated list of specific tools. If omitted, inherits all tools from the main thread. You can use `Defer(X)` / `NoDefer(X)` modifiers to adjust the deferred loading status of tools. See [Tool Deferred Loading Override](tool-defer-overlay.md) for details |
134
- | `model` | No | Model to use for this sub-agent. Can be a model alias (`gpt-5.1-codex`, `gemini-3.0-flash`, etc.) or `'inherit'` to use the main conversation's model. If omitted, defaults to configured sub-agent model |
134
+ | `model` | No | Model ID, name or alias, scenario variant `lite` / `reasoning`, or `inherit` / `default`. When omitted or set to `inherit` / `default`, no specific model is forced and model selection continues through the normal sub-agent resolution chain |
135
135
  | `permissionMode` | No | Permission mode for the sub-agent. Valid values: `default`, `acceptEdits`, `bypassPermissions`, `plan`, `ignore`. Controls how the sub-agent handles permission requests |
136
136
  | `skills` | No | Comma-separated skill names to auto-load when the sub-agent starts |
137
+ | `mcpServers` | No | Sub-agent dedicated MCP server declarations. Supports referencing existing global MCP servers, or declaring private inline MCP servers for the current sub-agent. See details below. |
138
+
139
+ ### Sub-Agent Dedicated MCP Servers
140
+
141
+ `mcpServers` is used to declare MCP servers that are only visible during a specific sub-agent's runtime. It does not write to the global MCP configuration, nor does it make the MCP servers automatically visible to the main conversation or other sub-agents.
142
+
143
+ Two syntaxes are supported.
144
+
145
+ **Referencing an existing global MCP server**:
146
+
147
+ ```yaml
148
+ ---
149
+ name: docs-searcher
150
+ description: Use existing docs MCP for retrieval
151
+ tools:
152
+ - Read
153
+ mcpServers:
154
+ - docs
155
+ ---
156
+ ```
157
+
158
+ Here `docs` must already be a globally connected MCP server. The sub-agent only borrows it; when the sub-agent ends, it will not close it.
159
+
160
+ **Declaring an inline MCP server**:
161
+
162
+ ```yaml
163
+ ---
164
+ name: browser-checker
165
+ description: Use private MCP for browser checks
166
+ tools:
167
+ - ToolSearch
168
+ - DeferExecuteTool
169
+ mcpServers:
170
+ - browser_private:
171
+ type: stdio
172
+ command: node
173
+ args:
174
+ - /absolute/path/to/browser-mcp-server.js
175
+ defer_loading: true
176
+ ---
177
+ ```
178
+
179
+ Inline MCP servers are only created within that sub-agent's session and automatically closed when the sub-agent ends. They do not enter the global MCP pool.
180
+
181
+ #### Security Strategy
182
+
183
+ | Source | `mcpServers` Behavior |
184
+ |---|---|
185
+ | User sub-agent: `~/.codebuddy/agents/*.md` | Inline MCP allowed. |
186
+ | Project sub-agent: `.codebuddy/agents/*.md` | Inline MCP allowed, but requires project-local approval. |
187
+ | Plugin agent | `mcpServers` is ignored. |
188
+ | `strictMcpConfig=true` | Skip all agent frontmatter/product `mcpServers`. |
189
+
190
+ Project sub-agent inline MCP requires writing to project-local configuration, located at the current workspace's `.codebuddy/settings.local.json`:
191
+
192
+ ```json
193
+ {
194
+ "enabledMcpjsonServers": ["browser_private"]
195
+ }
196
+ ```
197
+
198
+ You can also approve via CLI settings at launch:
199
+
200
+ ```bash
201
+ codebuddy --settings '{"enabledMcpjsonServers":["browser_private"]}'
202
+ ```
203
+
204
+ Note: Here we use the server name, consistent with the existing PROJECT MCP approval method. Do not write to the user's global `settings.json`, because project MCP approval only reads project-local and CLI scope.
205
+
206
+ #### Direct and Deferred
207
+
208
+ Scoped MCP uses the same deferred loading strategy as CodeBuddy's global MCP. By default, MCP tools use deferred loading: the model first discovers tools via `ToolSearch`, then invokes them via `DeferExecuteTool`.
209
+
210
+ Default deferred configuration example:
211
+
212
+ ```yaml
213
+ tools:
214
+ - ToolSearch
215
+ - DeferExecuteTool
216
+ mcpServers:
217
+ - finance_data:
218
+ type: stdio
219
+ command: node
220
+ args:
221
+ - /absolute/path/to/finance-mcp-server.js
222
+ ```
223
+
224
+ If you want MCP tools to appear directly in the sub-agent's tool list, you can explicitly disable defer:
225
+
226
+ ```yaml
227
+ mcpServers:
228
+ - finance_data:
229
+ type: stdio
230
+ command: node
231
+ args:
232
+ - /absolute/path/to/finance-mcp-server.js
233
+ defer_loading: false
234
+ ```
235
+
236
+ You can also use the `Defer(...)` / `NoDefer(...)` modifiers in the `tools` field to adjust the deferred loading behavior of individual tools.
237
+
238
+
137
239
 
138
240
  ### Model Selection
139
241
 
140
242
  The `model` field allows you to control which [AI model](models.md) the sub-agent uses:
141
243
 
142
- * **Model Alias**: Use one of the available aliases: `gpt-5.1-codex`, `gemini-3.0-flash`, `gemini-3.1-pro`, `gpt-5.1-codex`, etc.
143
- * **`'inherit'`**: Use the same model as the main conversation (useful for consistency)
144
- * **Omitted**: If not specified, uses the default model configured for sub-agents
244
+ * **Model ID, name or alias**: Directly select an available model
245
+ * **Scenario variant**: Use `lite` or `reasoning`, then map to a specific model via `/model` or `variantModels`
246
+ * **`inherit` / `default`, or omitted**: No specific model is forced; model selection continues through the resolution chain in order of environment variables, per-invocation parameters, sub-agent settings, built-in declarations, and main conversation model
145
247
 
146
- > **Note**: Using `'inherit'` is particularly useful when you want the sub-agent to adapt to the main conversation's model choice, ensuring consistent capabilities and response styles throughout the session.
248
+ > **Note**: When using `inherit`, if there is no higher-priority configuration, the sub-agent will ultimately inherit the main conversation model, which helps maintain consistent functionality and response style.
147
249
 
148
250
  ### Available Tools
149
251
 
@@ -171,6 +273,9 @@ The `/agents` command provides a comprehensive sub-agent management interface:
171
273
  This opens an interactive menu where you can:
172
274
 
173
275
  * View all available sub-agents (built-in, user, and project)
276
+ * View the effective routing values and their sub-agent layer sources for built-in sub-agents; specific scenario variant models can be viewed in `/model`
277
+ * Set models or `lite` / `reasoning` scenario variants for built-in sub-agents via **Edit Model**
278
+ * View built-in sub-agent definitions via **View Definition**
174
279
  * Create new sub-agents with guided setup
175
280
  * Edit existing custom sub-agents, including their tool access
176
281
  * Delete custom sub-agents
@@ -189,7 +294,7 @@ Built-in sub-agents (such as `Explore`, `general-purpose`, `Plan`) can also have
189
294
  * Scenario variants `lite` / `reasoning`.
190
295
  * All available models (same as `/model`).
191
296
  3. Use `Tab` to switch between **Global** and **Project** save scopes, `Enter` to confirm.
192
- 4. The list instantly refreshes to show "effective model + source".
297
+ 4. The list instantly refreshes to show "effective routing value + sub-agent layer source". The value may be a specific model, or `lite` / `reasoning`; the specific model that the scenario variant ultimately maps to and its source can be viewed in the **Scenario Models** section of `/model`.
193
298
 
194
299
  The **SOURCE** column in the panel shows the source of each sub-agent's currently effective model, making default orchestration transparent:
195
300
 
@@ -269,7 +374,7 @@ The General-Purpose sub-agent is a powerful agent suitable for complex multi-ste
269
374
 
270
375
  **Key Features:**
271
376
 
272
- * **Model**: Uses default model for more robust reasoning
377
+ * **Model**: Uses default orchestration, can be independently adjusted for this sub-agent via `/agents`
273
378
  * **Tools**: Has access to all tools
274
379
  * **Mode**: Can read and write files, execute commands, make modifications
275
380
  * **Purpose**: Complex research tasks, multi-step operations, code modifications
@@ -301,7 +406,7 @@ The Plan sub-agent is a specialized built-in agent designed for use during plan
301
406
 
302
407
  **Key Features:**
303
408
 
304
- * **Model**: Uses default model for more robust analysis
409
+ * **Model**: Uses default orchestration, can be independently adjusted for this sub-agent via `/agents`
305
410
  * **Tools**: Has access to Read, Glob, Grep, and Bash tools for codebase exploration
306
411
  * **Purpose**: Search files, analyze code structure, and gather context
307
412
  * **Automatic Invocation**: When CodeBuddy Code is in plan mode and needs to research the codebase, it will automatically use this agent
@@ -328,7 +433,7 @@ The Explore sub-agent is a fast, lightweight agent optimized for searching and a
328
433
 
329
434
  **Key Features:**
330
435
 
331
- * **Model**: Uses gemini-3.0-flash for fast, low-latency searches
436
+ * **Model**: Built-in declaration is `lite` scenario variant; actual model is determined by corresponding environment variables, project and user `variantModels`, main model `relatedModels`, and default orchestration
332
437
  * **Mode**: Strict read-only - cannot create, modify, or delete files
333
438
  * **Available Tools**:
334
439
  * Glob - File pattern matching
@@ -58,6 +58,61 @@ netstat -an | grep PORT_NUMBER
58
58
 
59
59
  ---
60
60
 
61
+ ## Memory Overflow (OOM) Troubleshooting
62
+
63
+ **Symptom**: Long-running sessions (especially self-continuing loops like `/goal`, or ultra-long context tasks) crash after running for several hours, with the terminal showing:
64
+
65
+ ```
66
+ FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
67
+ ```
68
+
69
+ ### Why It Happens
70
+
71
+ - Node/V8 default heap limit is approximately 4GB (64-bit). In ultra-long sessions, conversation history, tool results, etc. accumulate in memory, and the heap may climb to the limit.
72
+ - Auto context compression triggers based on **the ratio of tokens to the model window** (approximately 92%). **With large-window models (e.g., 1M context), tokens are far from the threshold, but the process's actual heap has already hit the 4GB limit** — compression cannot save it in time.
73
+ - Hard OOM (`FatalProcessOutOfMemory`) is terminated directly by V8, bypassing all JS exception handling. By default, **no heap snapshot is left behind**, making it difficult to determine post-mortem what consumed memory.
74
+
75
+ ### Immediate Relief
76
+
77
+ - Use `/clear` to clear context, or `/compact` to proactively compress before continuing.
78
+ - Break large tasks into multiple rounds / multiple sessions to avoid unbounded accumulation in a single session.
79
+ - Temporarily raise the heap limit (only treats the symptom, delays OOM):
80
+
81
+ ```bash
82
+ # Raise to 8GB and start (will be inherited by child processes)
83
+ NODE_OPTIONS=--max-old-space-size=8192 codebuddy
84
+ ```
85
+
86
+ ### Heap Snapshot for Root Cause Analysis (Disabled by Default, Enable as Needed)
87
+
88
+ CodeBuddy has a built-in "near-heap-limit self-heal snapshot": when the process heap exceeds a high watermark of the V8 heap limit, it automatically writes a heap snapshot for post-mortem analysis of object retention trees. **Because snapshot files are very large (≈ 1.5x the heapUsed at the time; GB-scale heaps produce multi-GB files), it is disabled by default** and only enabled when reproducing/investigating OOM:
89
+
90
+ ```bash
91
+ # Enable (default 85% watermark)
92
+ CODEBUDDY_CODE_HEAP_SNAPSHOT_NEAR_LIMIT_PCT=on codebuddy
93
+ # Custom watermark: 0.9 or 90 both mean 90%
94
+ CODEBUDDY_CODE_HEAP_SNAPSHOT_NEAR_LIMIT_PCT=90 codebuddy
95
+ # Disable (default): not set / 0 / off / false
96
+ ```
97
+
98
+ - Snapshot location: `~/.codebuddy/diagnostics/<YYYY-MM-DD>/oom-nearlimit-<pid>-<timestamp>.heapsnapshot` (layered by day, same as log directory).
99
+ - Only **one snapshot per process** (written once after exceeding the watermark, to avoid repeatedly writing GB-scale files and causing secondary OOM when near the limit).
100
+ - A warning log is emitted on trigger: `[WorkflowMemProbe] near heap limit ...`.
101
+
102
+ Analysis: Use Chrome DevTools → **Memory** → **Load** to load the `.heapsnapshot`, and examine **Retainers / object retention trees** to identify the largest objects and their reference chains.
103
+
104
+ > Note: Node's built-in `--heapsnapshot-near-heap-limit` / `v8.setHeapSnapshotNearHeapLimit` was not used — it can only write to the process's current working directory, cannot specify a path, and only triggers when approaching the 100% true limit (by which point writing a GB-scale snapshot itself may cause secondary OOM). Here we use 85% high watermark to capture early and save to a unified diagnostics directory.
105
+
106
+ ### Feedback to Developers
107
+
108
+ Please attach:
109
+
110
+ - The terminal's `FATAL ERROR: ... heap out of memory` and the native stack trace that follows;
111
+ - The `[WorkflowMemProbe] tick ... heap=used/total` heartbeat from `~/.codebuddy/logs/<date>/` before the crash (shows the heap growth curve);
112
+ - If snapshot was enabled: `~/.codebuddy/diagnostics/<date>/oom-nearlimit-*.heapsnapshot`.
113
+
114
+ ---
115
+
61
116
  ## Permission Confirmation Dialog Unresponsive / Only ESC Closes It
62
117
 
63
118
  **Symptom**: The TUI shows a tool permission confirmation dialog. Pressing number keys / Enter to confirm doesn't dismiss the dialog, but ESC closes it normally — and after closing, the task has actually already started executing.
@@ -79,6 +79,9 @@ The default view for conversing with the Agent. Key features:
79
79
  - **Question panels**: Answer multi-choice questions from the Agent
80
80
  - **Task progress**: Monitor background tasks and team progress in real time
81
81
  - **Session management**: Create new chats, browse history, and switch sessions
82
+ - **Working directory management**: Add/remove additional working directories, expanding the Agent's file access scope (stacked icon in bottom toolbar)
83
+ - **Working directory management**: Add/remove additional working directories to expand the Agent's file access scope (bottom toolbar stacked icon)
84
+ - **Working directory management**: Add/remove additional working directories to expand the Agent's file access scope (stacked icon in the bottom toolbar)
82
85
 
83
86
  ### Terminal View
84
87