@kinqs/brainrouter-cli 0.3.6 → 0.3.8

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 (129) hide show
  1. package/README.md +29 -52
  2. package/agents/architect.json +18 -0
  3. package/agents/explorer.json +18 -0
  4. package/agents/reviewer.json +18 -0
  5. package/agents/verifier.json +18 -0
  6. package/agents/worker.json +18 -0
  7. package/changelog/0.2.0.md +15 -0
  8. package/changelog/0.3.0.md +20 -0
  9. package/changelog/0.3.1.md +22 -0
  10. package/changelog/0.3.2.md +15 -0
  11. package/changelog/0.3.3.md +19 -0
  12. package/changelog/0.3.4.md +20 -0
  13. package/changelog/0.3.5.md +9 -0
  14. package/changelog/0.3.6.md +9 -0
  15. package/changelog/0.3.7.md +20 -0
  16. package/changelog/0.3.8.md +30 -0
  17. package/changelog/README.md +41 -0
  18. package/dist/agent/agent.d.ts +34 -1
  19. package/dist/agent/agent.js +372 -79
  20. package/dist/agent/toolCallRecovery.d.ts +57 -0
  21. package/dist/agent/toolCallRecovery.js +130 -0
  22. package/dist/agent/toolSafety.d.ts +17 -0
  23. package/dist/agent/toolSafety.js +102 -0
  24. package/dist/cli/banner.d.ts +20 -0
  25. package/dist/cli/banner.js +47 -14
  26. package/dist/cli/cliPrompt.d.ts +40 -3
  27. package/dist/cli/cliPrompt.js +117 -25
  28. package/dist/cli/commands/_context.d.ts +3 -1
  29. package/dist/cli/commands/_helpers.d.ts +1 -1
  30. package/dist/cli/commands/config.d.ts +46 -0
  31. package/dist/cli/commands/config.js +1042 -0
  32. package/dist/cli/commands/init.d.ts +20 -0
  33. package/dist/cli/commands/init.js +64 -0
  34. package/dist/cli/commands/login.d.ts +13 -0
  35. package/dist/cli/commands/login.js +179 -0
  36. package/dist/cli/commands/mcp.d.ts +13 -11
  37. package/dist/cli/commands/mcp.js +261 -74
  38. package/dist/cli/commands/mcpInstall.d.ts +20 -0
  39. package/dist/cli/commands/mcpInstall.js +87 -0
  40. package/dist/cli/commands/orchestration.js +51 -0
  41. package/dist/cli/commands/releaseNotes.d.ts +24 -0
  42. package/dist/cli/commands/releaseNotes.js +109 -0
  43. package/dist/cli/commands/schedule.d.ts +18 -0
  44. package/dist/cli/commands/schedule.js +189 -0
  45. package/dist/cli/commands/ui.js +119 -60
  46. package/dist/cli/commands/workflow.d.ts +2 -0
  47. package/dist/cli/commands/workflow.js +54 -8
  48. package/dist/cli/ink/ChatApp.d.ts +206 -0
  49. package/dist/cli/ink/ChatApp.js +493 -0
  50. package/dist/cli/ink/Frame.d.ts +26 -0
  51. package/dist/cli/ink/Frame.js +5 -0
  52. package/dist/cli/ink/Picker.d.ts +71 -0
  53. package/dist/cli/ink/Picker.js +168 -0
  54. package/dist/cli/ink/SlashPalette.d.ts +51 -0
  55. package/dist/cli/ink/SlashPalette.js +136 -0
  56. package/dist/cli/ink/TextField.d.ts +34 -0
  57. package/dist/cli/ink/TextField.js +47 -0
  58. package/dist/cli/ink/WizardApp.d.ts +7 -0
  59. package/dist/cli/ink/WizardApp.js +422 -0
  60. package/dist/cli/ink/ambientChat.d.ts +34 -0
  61. package/dist/cli/ink/ambientChat.js +7 -0
  62. package/dist/cli/ink/consoleCapture.d.ts +11 -0
  63. package/dist/cli/ink/consoleCapture.js +33 -0
  64. package/dist/cli/ink/markdownRender.d.ts +41 -0
  65. package/dist/cli/ink/markdownRender.js +278 -0
  66. package/dist/cli/ink/renderWithResizeClear.d.ts +14 -0
  67. package/dist/cli/ink/renderWithResizeClear.js +33 -0
  68. package/dist/cli/ink/runChat.d.ts +34 -0
  69. package/dist/cli/ink/runChat.js +682 -0
  70. package/dist/cli/ink/runPicker.d.ts +31 -0
  71. package/dist/cli/ink/runPicker.js +139 -0
  72. package/dist/cli/ink/runSlashPalette.d.ts +23 -0
  73. package/dist/cli/ink/runSlashPalette.js +33 -0
  74. package/dist/cli/ink/runWizard.d.ts +22 -0
  75. package/dist/cli/ink/runWizard.js +133 -0
  76. package/dist/cli/ink/stdinHandoff.d.ts +51 -0
  77. package/dist/cli/ink/stdinHandoff.js +78 -0
  78. package/dist/cli/ink/toolFormat.d.ts +75 -0
  79. package/dist/cli/ink/toolFormat.js +206 -0
  80. package/dist/cli/ink/useTerminalSize.d.ts +35 -0
  81. package/dist/cli/ink/useTerminalSize.js +26 -0
  82. package/dist/cli/repl.d.ts +25 -3
  83. package/dist/cli/repl.js +52 -714
  84. package/dist/cli/slashSuggest.d.ts +32 -0
  85. package/dist/cli/slashSuggest.js +146 -0
  86. package/dist/cli/wizard/modelsApi.d.ts +72 -0
  87. package/dist/cli/wizard/modelsApi.js +166 -0
  88. package/dist/cli/wizard/picker.d.ts +202 -0
  89. package/dist/cli/wizard/picker.js +547 -0
  90. package/dist/cli/wizard/providers.d.ts +86 -0
  91. package/dist/cli/wizard/providers.js +190 -0
  92. package/dist/cli/wizard/runner.d.ts +13 -0
  93. package/dist/cli/wizard/runner.js +488 -0
  94. package/dist/cli/wizard/types.d.ts +122 -0
  95. package/dist/cli/wizard/types.js +109 -0
  96. package/dist/config/config.d.ts +13 -1
  97. package/dist/config/config.js +45 -3
  98. package/dist/index.js +157 -206
  99. package/dist/memory/briefing.d.ts +1 -1
  100. package/dist/memory/briefing.js +4 -4
  101. package/dist/memory/consolidation.d.ts +1 -1
  102. package/dist/orchestration/agentRegistry.d.ts +36 -0
  103. package/dist/orchestration/agentRegistry.js +64 -0
  104. package/dist/orchestration/orchestrator.d.ts +7 -0
  105. package/dist/orchestration/orchestrator.js +2 -0
  106. package/dist/orchestration/tools.d.ts +105 -3
  107. package/dist/orchestration/tools.js +167 -8
  108. package/dist/prompt/skillCatalog.d.ts +11 -0
  109. package/dist/prompt/skillCatalog.js +134 -0
  110. package/dist/prompt/skillRunner.d.ts +2 -2
  111. package/dist/prompt/skillRunner.js +2 -31
  112. package/dist/prompt/systemPrompt.js +7 -2
  113. package/dist/runtime/anthropicAdapter.d.ts +100 -0
  114. package/dist/runtime/anthropicAdapter.js +293 -0
  115. package/dist/runtime/cronParser.d.ts +23 -0
  116. package/dist/runtime/cronParser.js +122 -0
  117. package/dist/runtime/mcpClient.js +14 -11
  118. package/dist/runtime/mcpPool.d.ts +170 -0
  119. package/dist/runtime/mcpPool.js +442 -0
  120. package/dist/runtime/mcpUtils.d.ts +17 -1
  121. package/dist/runtime/mcpUtils.js +23 -0
  122. package/dist/runtime/scheduleTicker.d.ts +33 -0
  123. package/dist/runtime/scheduleTicker.js +99 -0
  124. package/dist/runtime/vendorSnippets.d.ts +45 -0
  125. package/dist/runtime/vendorSnippets.js +153 -0
  126. package/dist/state/scheduleStore.d.ts +37 -0
  127. package/dist/state/scheduleStore.js +64 -0
  128. package/package.json +14 -5
  129. package/.env.example +0 -116
package/README.md CHANGED
@@ -6,8 +6,6 @@ recall, skills, and capture.
6
6
 
7
7
  Ships the `brainrouter` binary.
8
8
 
9
- ---
10
-
11
9
  ## Install
12
10
 
13
11
  ```bash
@@ -23,52 +21,44 @@ command not found`.
23
21
 
24
22
  | How Node is installed | Use `sudo`? |
25
23
  |---|---|
26
- | Homebrew (`brew install node`) | No — global prefix is user-writable |
27
- | nvm / asdf / fnm | No — same reason |
28
- | System Node on macOS / Linux | Yes — global prefix is `/usr/local/...` |
29
-
30
- Check yours:
31
-
32
- ```bash
33
- npm config get prefix
34
- ```
24
+ | Homebrew (`brew install node`) | No — global prefix is user-writable |
25
+ | nvm / asdf / fnm | No — same reason |
26
+ | System Node on macOS / Linux | Yes — global prefix is `/usr/local/...` |
35
27
 
36
- If the path is under `/Users/...`, `/opt/homebrew/...`, or your home dir
37
- no sudo. If it's `/usr/local/...` use sudo.
28
+ Check yours: `npm config get prefix`. If the path is under `/Users/...`,
29
+ `/opt/homebrew/...`, or your home dir — no sudo. If it's `/usr/local/...` use sudo.
38
30
 
39
31
  Verify the install:
40
32
 
41
33
  ```bash
42
34
  which brainrouter # prints the path to the binary
43
- brainrouter --version # prints 0.3.5
35
+ brainrouter --version # prints 0.3.7
44
36
  ```
45
37
 
46
- ---
47
-
48
38
  ## Configure
49
39
 
50
- Two configuration surfaces, both one-time:
51
-
52
- ### 1. The chat LLM and MCP server profile
40
+ Run `brainrouter` for the first time and the **setup wizard** starts
41
+ automatically:
53
42
 
54
- ```bash
55
- brainrouter config # interactive set LLM provider, model, key, endpoint
56
- brainrouter login # interactive — set MCP server URL + API key
43
+ ```
44
+ Welcome Theme Provider API key → Model → MCP → AGENT.md → Done
57
45
  ```
58
46
 
59
- Both write to `~/.config/brainrouter/config.json`.
47
+ It writes everything to `~/.config/brainrouter/config.json` — no manual
48
+ file editing needed.
60
49
 
61
- For local-model setups (LM Studio / Ollama), point the LLM endpoint at
62
- `http://localhost:1234/v1/chat/completions` or `http://localhost:11434/v1/chat/completions`.
50
+ To re-run the wizard later: type `/init` inside the REPL.
63
51
 
64
- ### 2. (Optional) Runtime knobs `~/.config/brainrouter/cli.env` or `./brainrouter-cli.env`
52
+ To change a single setting: use `/config <key> <value>` or the `/config`
53
+ home panel. To re-configure the MCP server connection: use `/login`.
65
54
 
66
- Only needed if you want to tune sandbox, tool-loop limits, trace logging,
67
- or web-search backend. See the [`.env.example`](.env.example) bundled with
68
- this package for the full list. LLM credentials do **not** go here — they
69
- live in `config.json`.
55
+ For local-model setups (LM Studio / Ollama), point the LLM endpoint at
56
+ `http://localhost:1234/v1/chat/completions` or `http://localhost:11434/v1/chat/completions`.
70
57
 
71
- ---
58
+ **Runtime knobs** (sandbox, trace log, web-search backend, tool-loop limits)
59
+ are set as shell environment variables. See
60
+ [`brainrouter-docs/configuration.md`](https://github.com/kinqsradiollc/BrainRouter/blob/main/brainrouter-docs/configuration.md)
61
+ for the full list.
72
62
 
73
63
  ## Run
74
64
 
@@ -83,22 +73,15 @@ Inside the REPL, type `/help` for the full slash-command list (60+
83
73
  commands across session / memory / workflow / orchestration / observability
84
74
  surfaces).
85
75
 
86
- ### Offline mode
87
-
88
- If the MCP server isn't reachable, the CLI still boots — but only local
89
- tools (file edits, shell, web fetch, `spawn_agent`) work. Memory recall,
90
- capture, and skills are disabled until the server is back. The startup
91
- banner shows `⚠️ OFFLINE MODE` when this happens. Pass `--strict-mcp` to
76
+ **Offline mode** — if the MCP server isn't reachable, the CLI still boots
77
+ with only local tools (file edits, shell, web fetch, `spawn_agent`). Memory
78
+ recall, capture, and skills are disabled until the server is back. The
79
+ startup banner shows `offline` when this happens. Pass `--strict-mcp` to
92
80
  make the CLI exit instead of degrading.
93
81
 
94
- ### Stdio mode
95
-
96
- If you'd rather have the CLI spawn the MCP server as a child process
97
- instead of running it separately, use `brainrouter config` → "Set Active
98
- Server Profile" → `default` (the bundled stdio profile). You don't need
99
- to run anything else — the CLI manages the server's lifecycle.
100
-
101
- ---
82
+ **Stdio mode** — to have the CLI spawn the MCP server as a child process
83
+ instead of running it separately: open `/config`, go to MCP settings, and
84
+ pick the bundled `stdio` profile. The CLI manages the server's lifecycle.
102
85
 
103
86
  ## Workspace detection
104
87
 
@@ -113,8 +96,6 @@ BRAINROUTER_WORKSPACE=/absolute/path/to/project brainrouter
113
96
 
114
97
  Inside the REPL, run `/workspace` to confirm the active root and session key.
115
98
 
116
- ---
117
-
118
99
  ## What you also probably want
119
100
 
120
101
  A BrainRouter MCP server for the cognitive memory. The CLI works without
@@ -127,9 +108,7 @@ $EDITOR ~/.config/brainrouter/server.env # set BRAINROUTER_LLM_API_KEY,
127
108
  brainrouter-mcp --http --port 3747 # in a separate terminal
128
109
  ```
129
110
 
130
- Then `brainrouter login` and point at `http://localhost:3747/mcp`.
131
-
132
- ---
111
+ Then run `/login` inside the REPL and point at `http://localhost:3747/mcp`.
133
112
 
134
113
  ## Docs
135
114
 
@@ -138,8 +117,6 @@ Then `brainrouter login` and point at `http://localhost:3747/mcp`.
138
117
  - **Maintainer runbook**: [SETUP.md](https://github.com/kinqsradiollc/BrainRouter/blob/main/SETUP.md)
139
118
  - **Bugs / requests**: <https://github.com/kinqsradiollc/BrainRouter/issues>
140
119
 
141
- ---
142
-
143
120
  ## License
144
121
 
145
122
  MIT
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "architect",
3
+ "displayName": "Architect",
4
+ "whenToUse": "Design alternatives and tradeoffs for a feature or system change. No file writes.",
5
+ "prompt": "## Role: Architect\nYou design solutions; you do not write production code.\n\n### Memory-first opening (mandatory)\n- `memory_search` and `memory_graph_query` for the feature/domain — past architecture decisions often constrain new ones.\n- `memory_contradictions` (action: list) — if prior designs contradict the proposed change, flag it.\n- Cite any architecture_decision records you find with their recordId.\n\nAlways present at least two design alternatives with explicit tradeoffs (complexity, blast radius, reversibility, test cost).\nEnd with a clear recommendation and the smallest first vertical slice.",
6
+ "model": null,
7
+ "effort": null,
8
+ "defaultAccess": "read",
9
+ "toolScope": { "local": ["*"], "mcp": ["memory_*"] },
10
+ "disallowedTools": [],
11
+ "maxIterations": 30,
12
+ "timeoutMs": 120000,
13
+ "maxResultChars": 8000,
14
+ "subagents": [],
15
+ "delegateName": "delegate_architect",
16
+ "tier": "reasoning",
17
+ "outputContract": null
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "explorer",
3
+ "displayName": "Explorer",
4
+ "whenToUse": "Read-only codebase investigation. Returns concrete file paths, line ranges, and a short list of facts.",
5
+ "prompt": "## Role: Explorer\nYou are a read-only investigator. Do not edit files or run shell commands.\nGoal: map the relevant code, return concrete file paths with line ranges, and surface the few facts the parent needs to decide.\n\n### Memory-first opening (mandatory)\n- Step 1: `memory_search` for the topic of investigation. Past explorers may have mapped this already — do not re-discover what BrainRouter already knows.\n- Step 2: `memory_graph_query` with the dominant feature/entity name to surface related memories across 2 hops.\n- Step 3: `memory_file_history` for any file the parent specifically mentions.\n- Cite every recordId you build on. Your output begins with a `### Memory consulted` block listing the record IDs and what they told you.\n\nOutput structure: 1) Memory consulted, 2) Summary (3-5 bullets), 3) Key files with line ranges, 4) Open questions, 5) Suggested next probe.\nNever claim work is complete without naming actual files you read AND showing the memory you consulted.",
6
+ "model": null,
7
+ "effort": null,
8
+ "defaultAccess": "read",
9
+ "toolScope": { "local": ["*"], "mcp": ["memory_*"] },
10
+ "disallowedTools": [],
11
+ "maxIterations": 30,
12
+ "timeoutMs": 120000,
13
+ "maxResultChars": 8000,
14
+ "subagents": [],
15
+ "delegateName": "delegate_explorer",
16
+ "tier": "reasoning",
17
+ "outputContract": null
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "reviewer",
3
+ "displayName": "Reviewer",
4
+ "whenToUse": "Code review stance; findings first, severity-ordered. Read-only.",
5
+ "prompt": "## Role: Reviewer\nYou review changes critically. Findings first; severity-ordered (blocker, major, minor, nit).\n\n### Memory-first opening (mandatory)\n- `memory_search` for prior reviews on the same files or feature — never re-flag an issue another reviewer already decided is acceptable.\n- `memory_file_history` for each file in the diff — known regressions and prior bug fixes inform your verdict.\n- Cite related recordIds inline in each finding so the parent can see the precedent.\n\nFor each finding: file:line, what is wrong, why it matters, suggested fix.\nDo not make edits. The parent will decide what to apply.",
6
+ "model": null,
7
+ "effort": null,
8
+ "defaultAccess": "read",
9
+ "toolScope": { "local": ["*"], "mcp": ["memory_*"] },
10
+ "disallowedTools": [],
11
+ "maxIterations": 30,
12
+ "timeoutMs": 120000,
13
+ "maxResultChars": 8000,
14
+ "subagents": [],
15
+ "delegateName": "delegate_reviewer",
16
+ "tier": "reasoning",
17
+ "outputContract": null
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "verifier",
3
+ "displayName": "Verifier",
4
+ "whenToUse": "Runs tests and checks; reports pass/fail with evidence.",
5
+ "prompt": "## Role: Verifier\nYou verify that recent changes work. Run the smallest useful set of tests/typechecks.\n\n### Memory-first opening (mandatory)\n- `memory_search` for prior failure modes on these tests — flaky tests, environment caveats, and known-bad commands live in memory.\n- `memory_file_history` for any test file involved — past fixes for the same suite are highly relevant.\n\nReport: which command(s) you ran, exit codes, failing output (trimmed), and a clear PASS/FAIL verdict.\nNever claim PASS without actually executing a check. On failure, call `memory_task_update` with the blocker so the next worker can pick it up.",
6
+ "model": null,
7
+ "effort": null,
8
+ "defaultAccess": "shell",
9
+ "toolScope": { "local": ["*"], "mcp": ["memory_*"] },
10
+ "disallowedTools": [],
11
+ "maxIterations": 30,
12
+ "timeoutMs": 120000,
13
+ "maxResultChars": 8000,
14
+ "subagents": [],
15
+ "delegateName": "delegate_verifier",
16
+ "tier": "worker",
17
+ "outputContract": null
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "worker",
3
+ "displayName": "Worker",
4
+ "whenToUse": "Implementation-focused. May edit files when granted write access.",
5
+ "prompt": "## Role: Worker\nYou implement a single bounded task. Keep edits minimal and scoped.\n\n### Memory-first opening (mandatory)\n- `memory_recall` for the task topic — past instructions, conventions, and tool_preference records often dictate HOW to implement.\n- `memory_file_history` for the files you intend to touch — known fragility lives there.\n- If the parent gave you `seedRecordIds`, treat those as authoritative context.\n- `memory_task_state` if this looks like a continuation — pick up where prior work left off.\n\nRead before editing. Prefer edit_file over write_file when possible. Prefer apply_patch for multi-file edits.\nOn completion call `memory_task_update` with the outcome, then report exactly which files you changed and any follow-ups the verifier should run.",
6
+ "model": null,
7
+ "effort": null,
8
+ "defaultAccess": "write",
9
+ "toolScope": { "local": ["*"], "mcp": ["memory_*"] },
10
+ "disallowedTools": [],
11
+ "maxIterations": 30,
12
+ "timeoutMs": 120000,
13
+ "maxResultChars": 8000,
14
+ "subagents": [],
15
+ "delegateName": "delegate_worker",
16
+ "tier": "worker",
17
+ "outputContract": null
18
+ }
@@ -0,0 +1,15 @@
1
+ # 0.2.0 — 2026-05-15
2
+
3
+ Admin & dashboard polish.
4
+
5
+ - **Admin Users console** at `/users` — paginated list; create / enable / disable / delete with self-protection; API key resets.
6
+ - **Memories Hub** — debounced text search, type filter chips, active/archived toggle, inline edit modal, infinite scroll, bulk actions.
7
+ - **Expanded Profile settings** — display-name editing, masked API key with click-to-copy, rotate-key confirmation, copy-paste MCP client config (STDIO + HTTP/SSE).
8
+ - **Contradiction resolution UI** — open/resolved filter, resolve/dismiss controls, real-time pending badge in the sidebar.
9
+ - **Auth hardening** — Remember-Me JWT persistence, signup password strength, rate-limit 20 attempts / 15 min per IP, dynamic CORS via `BRAINROUTER_CORS_ORIGIN`.
10
+ - **MCP onboarding banner** with copyable SSE connection variables.
11
+
12
+ ## Fixes
13
+ - Recall Inspector no longer crashes on null/undefined potential scores.
14
+ - AuthGuard no longer flashes loading state when validating session persistence on mount.
15
+ - Stale JWT tokens cleared after protected API call failures.
@@ -0,0 +1,20 @@
1
+ # 0.3.0 — 2026-05-16
2
+
3
+ Terminal Agent CLI + multi-agent orchestration + memory engine.
4
+
5
+ ## Features
6
+ - **Terminal Agent CLI (`brainrouter`)** — memory-native coding agent with ~70 slash commands, durable per-session transcripts, and LLM-driven compaction.
7
+ - **Multi-agent orchestration** — first-class `spawn_agent` with five built-in roles:
8
+ - **explorer** — read-only research
9
+ - **architect** — design tradeoffs
10
+ - **reviewer** — severity-ordered findings
11
+ - **worker** — write-access implementation
12
+ - **verifier** — test/shell validation
13
+ - **Web Chat (`/chat`)** — interactive in-browser agent with full memory engine access (recall, scenes, consolidation, contradictions).
14
+ - **HTTP Chat Completions endpoint** — MCP server exposes `/api/chat-completions` so any HTTP client can drive a BrainRouter agent.
15
+ - **Memory consolidation** — generates human-readable filesystem snapshots (`MEMORY.md`, `user.md`, `feedback.md`, `project.md`, `reference.md`).
16
+ - **Filtered & freshness-boosted recall** — `memory_recall` / `memory_search` accept type / scene / time / priority filters; new captures get a freshness bump.
17
+ - **Graph expansion & spreading activation** — 2-hop BFS over the knowledge graph; citation-driven reinforcement (LTP, +5% per cite, capped +30%); synaptic pruning of uncited memories.
18
+ - **Hookify Markdown rules** — drop a `.md` file with YAML frontmatter into `.brainrouter/hooks/` to install warn/block guardrails on tool calls without writing code.
19
+ - **Working-memory canvas** — large child-agent outputs auto-offload to a working-memory canvas via `memory_working_*` tools instead of polluting parent context.
20
+ - **Skill memetic potential** — repeatedly invoking a skill heats it up so its context gets pre-injected; half-life decay keeps cold skills out of the prompt.
@@ -0,0 +1,22 @@
1
+ # 0.3.1 — 2026-05-17
2
+
3
+ Reliability hardening — silent failures, races, and edge cases.
4
+
5
+ ## Fixes
6
+ - **🚨 Silent memory failure.** The CLI was looking for the wrong recall-response key, so every memory recall returned zero records and the citation / decay loop was effectively dead.
7
+ - **MCP child never saw LLM credentials** when spawned from a non-package directory. Symptoms: extraction failures piled up, cognitive table stayed empty.
8
+ - **`OPENAI_API_KEY` fallback bypassed by empty config string** (`??` nullish coalescing on an empty string).
9
+ - **Goal budget off-by-one.** Budget=10 fired 11 iterations.
10
+ - **Silent verifier child agents could bypass shell-approval prompts** — privilege-escalation path through `spawn_agent` closed. Silent children now refuse shell unless explicitly auto-approved.
11
+ - **No MCP timeout** — a hung MCP server used to hang the whole turn forever. Now races against `BRAINROUTER_MCP_TIMEOUT_MS` (60s default).
12
+ - **No auto-compaction** — long sessions silently blew the request-body cap. Now auto-compacts at 80k tokens (`BRAINROUTER_AUTO_COMPACT_TOKENS`).
13
+ - **Hallucinated tool names hard-failed.** `Read_File` / `read-file` / `read.file` now fuzzy-match against the real tool registry first.
14
+ - **JSON state corruption killed the REPL.** Bad `goal.json` or transcript files now quarantine to `<path>.corrupt-<ts>` and recover instead of bricking boot.
15
+ - **Sweeper interval misconfiguration could flood the LLM backend** — added a 30s code-level floor with a warning log and a reentrancy guard.
16
+
17
+ ## Features
18
+ - **LLM concurrency semaphore** — cap simultaneous LLM calls per process via `BRAINROUTER_LLM_MAX_CONCURRENT` (default 2 MCP / 4 CLI). Set to `1` on consumer hardware running LM Studio; raise to `16+` for cloud backends.
19
+ - **LM Studio "Model is unloaded" auto-recovery** — detects the specific 400 body and retries once after the JIT load completes.
20
+ - **HTTP MCP transport documented and verified** end-to-end. Switch via `~/.config/brainrouter/config.json` → `"activeServer": "local-http"`.
21
+ - **`/doctor` extraction health check** — reports `healthy | backlog | DEGRADED` with the last extractor error inline.
22
+ - **Stronger fan-out detection** — broader phrase matching ("test all", "review every", "audit the whole codebase") and clearer spawn-agent visual output.
@@ -0,0 +1,15 @@
1
+ # 0.3.2 — 2026-05-19
2
+
3
+ Observability + headless + UX polish.
4
+
5
+ - **OTEL trace nesting** for spawned child agents — fan-out trees now reconstruct correctly in observability tools.
6
+ - **Headless mode rejects slash commands** with a clear error and exit code 2 instead of silently routing them to the LLM.
7
+ - **GitHub PR info in statusline** (`/statusline mode,branch,pr`) with a 30s cache.
8
+ - **Dynamic terminal tab title** prefixed with `(N)` when continuation or child agents are pending — useful for background tabs.
9
+ - **`brainrouter agents [--json]`** — list child sessions from the command line without entering the REPL.
10
+ - **Paginated `/help`** with category groups; drill in with `/help <category>`.
11
+ - **Streaming `/diff`** for large edits, with `--staged` and `--all` flags.
12
+
13
+ ## Fixes
14
+ - Slash commands followed by tab or newline now match correctly.
15
+ - Prompt history no longer records consecutive duplicate user prompts.
@@ -0,0 +1,19 @@
1
+ # 0.3.3 — 2026-05-21
2
+
3
+ `/goal` state machine + structural refactors.
4
+
5
+ ## Features
6
+ - **`usage_limited` goal status** — resumable state distinct from `paused` (user-initiated) and `blocked` (agent gave up); triggered when iteration or token cap runs out.
7
+ - **Token budget on goals** — optional `maxTokens` cap. When reached, the goal transitions to `usage_limited`. Protects a fixed dollar budget without estimating turn counts.
8
+ - **Replace-confirmation prompt** — `/goal <new text>` won't silently overwrite an in-progress goal.
9
+ - **Wrap-up steering** on the final budget turn — the model is directed to consolidate and finalize instead of starting new investigations.
10
+ - **`/goal edit`** — unified update entrypoint for status, text, budget, and tokens.
11
+ - **`/goal tokens <N>`** — set or clear the per-goal token cap.
12
+
13
+ ## Improvements
14
+ - **REPL split** into seven category command files (memory, ui, workflow, orchestration, obs, guard, session). Slash commands behave identically — only the layout changed.
15
+ - **Source tree restructured** into responsibility folders under `brainrouter-cli/src/`.
16
+ - **Monorepo versions synchronized** to 0.3.3 across all seven packages (prior releases had drifted).
17
+
18
+ ## Fixes
19
+ - **MCP no longer pollutes the workspace tree.** Working memory, session state, and `/feedback` now live under `~/.brainrouter/` instead of in your project. Empty `<workspace>/.brainrouter/` shells from prior installs auto-clean.
@@ -0,0 +1,20 @@
1
+ # 0.3.4 — 2026-05-22
2
+
3
+ First public npm release. Four packages under `@kinqs/`:
4
+
5
+ | Package | What it is |
6
+ |---|---|
7
+ | `@kinqs/brainrouter-cli` | Installs the `brainrouter` CLI binary |
8
+ | `@kinqs/brainrouter-mcp-server` | Installs `brainrouter-mcp` (MCP server) |
9
+ | `@kinqs/brainrouter-sdk` | Typed client helpers |
10
+ | `@kinqs/brainrouter-types` | Shared TypeScript types |
11
+
12
+ ## Features
13
+ - **CLI offline mode** — MCP unreachable no longer hard-exits; `--strict-mcp` opts back into fail-fast. Banner shows `⚠️ OFFLINE MODE`.
14
+ - **Inspection-tool previews** — `list_dir`, `grep_search`, `glob_files` render results inline even when small models forget to echo them.
15
+ - **`bash` / `shell` / `sh` aliases** for `run_command` (Claude Code parity). Gated on `run_command` being available, so read-only mode can't sneak shell access.
16
+
17
+ ## Improvements
18
+ - **CLI env separation** — `~/.config/brainrouter/config.json` is the canonical chat-LLM credential store; `.env` is restricted to runtime knobs (sandbox, timeouts, web search).
19
+ - **Dashboard migration** to `brainrouter-dashboard/` (Next.js 15, same page set).
20
+ - **SETUP.md** — maintainer runbook covering first-time setup, daily run, upgrade, publish, troubleshooting, nuclear-reset paths.
@@ -0,0 +1,9 @@
1
+ # 0.3.5 — 2026-05-22
2
+
3
+ Global-install UX fix.
4
+
5
+ - **`brainrouter-mcp init`** — scaffolds `~/.config/brainrouter/server.env` from the bundled template (chmod 0600). Won't overwrite an existing file.
6
+ - **Env-loader priority chain** — `$BRAINROUTER_ENV_FILE` → `~/.config/brainrouter/server.env` → `./.env`. Server prints which file it loaded at startup.
7
+ - **Published READMEs rewritten** for global-install users (the actual npm flow ending with `brainrouter` on `$PATH`); SETUP.md split into "install from npm" vs "clone and build" paths.
8
+
9
+ Backward compatible — existing monorepo dev (`brainrouter/.env`) still works in the third priority slot.
@@ -0,0 +1,9 @@
1
+ # 0.3.6 — 2026-05-25
2
+
3
+ Smarter recall, friendlier CLI, more reliable agent loop.
4
+
5
+ - **Multi-workflow concurrency.** `/workflow switch <slug>` flips between `/feature-dev` / `/spec` / `/review` workflows in the same workspace; `/workflows` lists them with artifact markers. Goals stay session-scoped (workflows are pure storage + navigation).
6
+ - **New session knobs.** `/effort low|medium|high` (forwarded as `reasoning_effort` to gpt-5 / o-series / gpt-oss / deepseek-r/v / qwen3 / magistral), `/mode planning|fast` + `/review-policy request|proceed` (replace `/yolo` + `autoApproveShell`), `/grill-me <task>` (2–5 clarifying questions before any edit), `ask_user_choice` (mid-turn arrow-key picker).
7
+ - **Context budget — 70% lighter system prompt + gated recall.** Static prompt cut from ~4,750 → ~1,400 tokens; briefing now fires only on turn 1, post-compaction, or messages carrying ≥2 entity-shaped tokens. Goal text deduplicated to a single per-turn anchor.
8
+ - **MCP identity + offline UX + multi-MCP foundation.** BrainRouter MCP auto-detected (config / name / URL / stdio / tool signature); when offline, the system prompt swaps to a `⚠️ OFFLINE` block and banner/statusline gain a distinct `brain` indicator. New `/mcp list` / `/mcp reconnect` / `/mcp tools` dispatcher.
9
+ - **REPL stdin no longer freezes** after spinner-based slash commands (`ora`'s `discardStdin: true` was tearing down readline's keypress listener).
@@ -0,0 +1,20 @@
1
+ # 0.3.7 — 2026-05-26
2
+
3
+ Terminal UI redesign, in-terminal configuration, full Ink chat REPL, and multi-agent registry foundations.
4
+
5
+ - **Full Ink chat REPL.** Every surface — banner, composer, scrollback, tool events, slash palette, footer — now renders through a single Ink tree. The old readline turn loop is removed. Inline slash palette with fuzzy ranking and keyboard navigation; `/config` / `/login` / `/init` render as overlays inside the chat tree, eliminating raw-mode conflicts.
6
+ - **First-run wizard.** `Welcome → Theme → Provider → API key → Model → MCP → AGENT.md → Done` auto-triggers on first launch when no config is found. Re-enterable via `/init`; `/init agentmd` preserves the legacy AGENT.md-only scaffold mode.
7
+ - **`/config` settings panel + multi-profile MCP manager.** Bare `/config` opens an arrow-key settings home; `/config <key>` prints current value, `/config <key> <value>` sets it. The MCP row is a full profile manager — list, add, edit, probe, and remove profiles without restarting the CLI.
8
+ - **`/login` slash command.** In-REPL MCP profile editor: transport picker → URL/key fields → reachability probe → save and hot-connect to the running pool.
9
+ - **`/model` picker.** Fetches the live model list from the active endpoint's `/v1/models` and lets you swap without leaving the REPL.
10
+ - **Identity-based MCP tool prefix.** Servers with `identity: "brainrouter"` expose tools as `mcp__brainrouter__<tool>` regardless of their JSON config key, so skills targeting the canonical prefix survive profile renames.
11
+ - **Multi-MCP pool.** CLI connects to all configured servers concurrently on boot; tools are merged into one inventory with `mcp__<serverId>__<tool>` prefixing. `/mcp connect|disconnect|reconnect` commands; one server failing does not cascade.
12
+ - **Data-driven agent registry.** Five built-in agents (`explorer`, `architect`, `reviewer`, `worker`, `verifier`) are JSON files under `brainrouter-cli/agents/`. Three-tier merge: built-in → user-global (`~/.config/brainrouter/agents/`) → workspace (`.brainrouter/agents/`), with workspace taking precedence. `spawn_agent` gains an `agentId` param for registry lookup; `/agents defs` lists all known definitions.
13
+ - **Spawn tier hierarchy + depth caps.** Each agent definition carries a `tier` (`reasoning` | `worker`). `chat` may spawn anything; `reasoning` agents may only spawn `worker` children; `worker` agents cannot delegate. Depth capped at 3 (overridable via `BRAINROUTER_MAX_SPAWN_DEPTH`).
14
+ - **CLI/server env separation.** CLI reads credentials only from `~/.config/brainrouter/config.json`; package `.env` files are no longer read. MCP child stderr is piped so server logs don't bleed into the Ink UI.
15
+
16
+ ## Fixes
17
+ - `/config provider <id>` now prompts for the new provider's API key instead of reusing the old one.
18
+ - `/login` can update LLM credentials after initial MCP profile setup.
19
+ - HTTP MCP setup collects the BrainRouter API key for both local and remote HTTP transports.
20
+ - Wizard Skip clears stale `activeServer` instead of silently reconnecting to an old profile.
@@ -0,0 +1,30 @@
1
+ # 0.3.8 — 2026-05-26
2
+
3
+ CLI delegation reliability, parallel reads, native Anthropic adapter, and a tranche of quick wins carried from 0.3.7.
4
+
5
+ - **Runtime child-drain guardrail.** `Agent.runTurn` now tracks child agents spawned during the current turn and refuses to accept a no-tool prose answer ("I am waiting…") while children are still pending or running. Auto-calls `wait_agents` with a bounded timeout (`BRAINROUTER_CHILD_DRAIN_TIMEOUT_MS`, default 30 s); on timeout returns an explicit "children still running" envelope with id/role/status/summary plus a `/continue` hint instead of vague silence.
6
+ - **`task_agent` / `delegate_agent` tool split.** New foreground `task_agent` wrapper blocks until the child completes or the bounded timeout fires (returns completed output or a timeout envelope). New background `delegate_agent` wrapper returns a running child id plus a "continue working" hint — non-blocking. `spawn_agent({ wait: true })` remains backward-compatible. System prompt policy now steers: direct answer → direct tool → `task_agent` → `delegate_agent`.
7
+ - **Child progress visibility in Ink.** Child tool start/end events propagate from `tools.ts` through new `onChildToolStart` / `onChildToolEnd` orchestration callbacks. Ink scrollback renders paired rows per child tool call with child id, role, tool, duration, success/error, and short summary. Parent wait state shows a live "running children" status row; `/agents` and `/agents --watch` use the same data shape.
8
+ - **Safe parallel execution for read-only tools.** When the model emits multiple tool calls in one response, independent read-only tools (`read_file`, `list_dir`, `grep_search`, `glob_files`, `fetch_url`, `web_search`, MCP memory reads) run concurrently via `Promise.allSettled`; write/shell/orchestration tools stay strictly serial in their original order to preserve causality. Tool-result messages append to chatHistory in original call order so the model's next turn sees a deterministic trace. Unknown tool names fail safe to serial. New `toolSafety.ts` is the single source of truth for the parallel-safe list.
9
+ - **Cron-style `/schedule`.** Recurring jobs via standard 5-field cron expressions (`/schedule cron "*/15 * * * *" /ci-status`); accepts `*`, lists, ranges, steps. One-shot `/schedule in 5m /foo` and `/schedule at 14:30 /foo` remain unchanged. New `scheduleStore.ts` persists `{id, cron, command, owner, lastRun, nextRun, enabled}` under `.brainrouter/schedules.json`; in-process `scheduleTicker.ts` wakes every 30 s, scans due jobs, dispatches them through the same path as one-shots. Catch-up after laptop sleep fires each missed window at most once. `/schedule list|remove|enable|disable` for management.
10
+ - **`/release-notes` in-CLI.** New slash command renders the changelog for the current installed version directly in the Ink REPL. `/release-notes <version>` for past versions; `/release-notes list` shows every bundled version. Build copies `brainrouter-changelog/*.md` into the published `brainrouter-cli/changelog/` so the notes ship with the npm package.
11
+ - **Strict tool-call recovery.** New `toolCallRecovery.ts` (adapted from deer-flow's pattern) hardens the agent loop against malformed LLM tool calls: dedupes duplicate tool_call ids in one response (last wins, warning logged); on `JSON.parse` failure attaches a synthetic error tool_result instead of aborting the turn; synthesises orphan-result envelopes for any tool_call that never executed so OpenAI's strict pairing stays well-formed; unknown tool names return a "did you mean: <closest>" hint via the existing `normalizeToolName` helper.
12
+ - **Per-vendor MCP install snippets.** New `/mcp install <vendor>` prints the paste-ready JSON block and config file path for Claude Desktop, Cursor, Windsurf, VS Code Continue, and Zed, with the active brainrouter profile's URL/API key already substituted. `/mcp install list` enumerates supported vendors with OS-resolved paths. New `brainrouter-docs/mcp-install.md` mirrors the in-CLI output for the web.
13
+ - **Native Anthropic `/v1/messages` adapter.** New `anthropicAdapter.ts` talks Anthropic's native shape directly instead of routing through the OpenAI-compat shim when the active profile is Anthropic. Tool calls round-trip via `tool_use` / `tool_result` content blocks. System prompt extracted to the top-level `system` field. Opt-in prompt caching (`BRAINROUTER_ANTHROPIC_CACHE=1` adds `cache_control: { type: 'ephemeral' }` on system + last assistant). Extended thinking on Claude 4-series Sonnet/Opus when `/effort high` is active. Streaming intentionally out of scope. OpenAI path byte-identical for non-Anthropic providers.
14
+ - **Hooks JSON authoring doc.** New `brainrouter-docs/hooks.md` covers the `.brainrouter/hooks.json` and `.brainrouter/hookify/*.json` schemas with three worked examples (block `rm -rf`, post-turn `npm test` warning, commit-message ticket-prefix flag), debugging tips, and synchronous-loop limits.
15
+ - **Ink question overlays.** `ask_user_choice` now renders through the active Ink chat overlay instead of the legacy raw stdout picker, so option rows stay visible while the chat screen repaints. Multi-select prompts show checkboxes; the free-form `Other` fallback is preserved. `askYesNo` confirmations use a visible in-chat yes/no picker while the Ink REPL is active.
16
+
17
+ ## Fixes
18
+
19
+ - **Briefing now finds prefixed memory tools.** `🧠 Briefing: 0 records from (none)` no longer appears when the brain MCP is connected and exposes `mcp_brainrouter_memory_recall`. Root cause: `toolNames.has('memory_recall')` in `briefing.ts` and the `/mcp` doctor checked bare names against `listTools()` output, but the pool emits prefixed names. New `hasMcpTool` helper in `runtime/mcpUtils.ts` matches both bare and `mcp_<server>_<tool>` shapes; briefing, `/mcp` doctor, `isBrainOnline`, and `stripMcpPrefix` all collapsed to single-underscore lookups.
20
+ - **Single-underscore tool naming standardised.** `mcp_<server>_<tool>` is the canonical form everywhere; double-underscore `mcp__<server>__<tool>` is deprecated and normalised at the pool boundary in `mcpPool.ts` so downstream code can assume one shape. CI grep guard ensures no `mcp__` references reappear outside the pool's normaliser.
21
+ - **R1 guardrail recognises `task_agent` / `delegate_agent`.** Discovered during R2 review: `trackChildObservation` only matched `spawn_agent` / `spawn_agents`, so `delegate_agent` returns silently bypassed the child-drain guardrail. Extended to all four tool names; `task_agent` marks the child as already-waited (avoids double-drain), `delegate_agent` remains unwaited so the guardrail can force a wait before the parent answers.
22
+ - **`task_agent` / `delegate_agent` access-mode gating.** Added to the read-only allowed-tool set alongside `spawn_agent`; without this, `read`-mode agents got "tool not permitted" errors on every call.
23
+ - **`handleDelegateAgent` propagates errors verbatim.** When `handleSpawn` returns a non-object payload (no parseable id), the wrapper now passes it through instead of wrapping in `{raw, nextAction}` — preserves both the failure message and the child id the R1 guardrail needs.
24
+ - **`handleWait` timeout no longer leaks setTimeout handles.** Cleared on every resolution path.
25
+ - **`parseInt` NaN guard for `BRAINROUTER_MAX_SPAWN_DEPTH`.** Garbled env values now fall back to the default (3) instead of disabling the depth cap entirely.
26
+ - **JWT base64url tampering detection.** `verifyJwt` in `brainrouter/src/api/auth/crypto.ts` now compares signatures in base64url string space; previous raw-byte comparison missed single-character changes to the final character's padding bits.
27
+
28
+ ## Deferred to 0.4.x
29
+
30
+ - **`@mentions` tab completion.** Branch staged (`feature/0.3.8-11-at-mentions-tab-completion`) but PR not opened in cycle; carried forward.
@@ -0,0 +1,41 @@
1
+ # BrainRouter Changelog Index
2
+
3
+ Per-version release notes live here. The root
4
+ [`CHANGELOG.md`](../CHANGELOG.md) stays short and only inlines the
5
+ current in-flight release plus the latest shipped release.
6
+
7
+ Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ·
8
+ Versioning: [SemVer](https://semver.org/spec/v2.0.0.html).
9
+
10
+ ---
11
+
12
+ ## Versions
13
+
14
+ | Version | Date | State | Highlights |
15
+ |---|---:|---|---|
16
+ | **[0.3.8](0.3.8.md)** | 2026-05-26 | Shipped | CLI delegation reliability, parallel-safe reads, cron `/schedule`, `/release-notes`, hooks docs, strict tool-call recovery, per-vendor MCP install snippets, native Anthropic adapter, briefing prefix fix, Ink question overlays |
17
+ | **[0.3.7](0.3.7.md)** | 2026-05-26 | Shipped | Ink chat REPL, wizard, `/config`, `/login`, CLI/server env separation |
18
+ | **[0.3.6](0.3.6.md)** | 2026-05-25 | Shipped | Context budget, MCP identity/offline UX, multi-MCP foundation, multi-workflow |
19
+ | [0.3.5](0.3.5.md) | 2026-05-22 | Shipped | Global-install UX fix |
20
+ | [0.3.4](0.3.4.md) | 2026-05-22 | Shipped | First public npm release |
21
+ | [0.3.3](0.3.3.md) | 2026-05-21 | Shipped | `/goal` state machine and token budget |
22
+ | [0.3.2](0.3.2.md) | 2026-05-19 | Shipped | Observability, headless behavior, statusline polish |
23
+ | [0.3.1](0.3.1.md) | 2026-05-17 | Shipped | Reliability hardening |
24
+ | [0.3.0](0.3.0.md) | 2026-05-16 | Shipped | Terminal Agent CLI, multi-agent orchestration, memory engine |
25
+ | [0.2.0](0.2.0.md) | 2026-05-15 | Shipped | Admin console, Memories Hub, contradiction UI |
26
+
27
+ ---
28
+
29
+ ## Writing Rules
30
+
31
+ 1. Add user-visible changes to the in-flight version file in this
32
+ folder.
33
+ 2. Keep root [`CHANGELOG.md`](../CHANGELOG.md) as a concise summary,
34
+ not a duplicate of the full release file.
35
+ 3. When a version ships, replace `Unreleased` with the release date in
36
+ both places.
37
+ 4. Future planned work belongs in [`ROADMAP.md`](../ROADMAP.md), not in
38
+ changelog files.
39
+
40
+ The [`changelog-generator` skill](../skills/lifecycle/changelog-generator/SKILL.md)
41
+ can help assemble release notes from commits and task files.
@@ -1,4 +1,4 @@
1
- import type { McpClientWrapper } from '../runtime/mcpClient.js';
1
+ import type { McpClientPool as McpClientWrapper } from '../runtime/mcpPool.js';
2
2
  import type { LLMConfig } from '../config/config.js';
3
3
  import type { AccessMode } from '../orchestration/roles.js';
4
4
  import { type RecalledRecord } from '../memory/briefing.js';
@@ -33,6 +33,28 @@ export interface RunTurnCallbacks {
33
33
  preview?: string;
34
34
  error?: string;
35
35
  }) => void;
36
+ /**
37
+ * Optional: paired live child tool events surfaced from spawn_agent
38
+ * children up to the parent REPL. Lets the UI render explicit
39
+ * "child began Read(...)" / "child finished — 1.2s" rows in scrollback
40
+ * so long child runs no longer look like the parent has paused
41
+ * (roadmap §3 child progress visibility).
42
+ */
43
+ onChildToolStart?: (event: {
44
+ childId: string;
45
+ role: string;
46
+ tool: string;
47
+ args: Record<string, any>;
48
+ }) => void;
49
+ onChildToolEnd?: (event: {
50
+ childId: string;
51
+ role: string;
52
+ tool: string;
53
+ ok: boolean;
54
+ summary: string;
55
+ preview?: string;
56
+ durationMs: number;
57
+ }) => void;
36
58
  /**
37
59
  * Optional: invoked when the agent's automatic memory pipeline runs —
38
60
  * pre-turn briefing, post-turn capture, citation marking. Surfacing these
@@ -104,6 +126,10 @@ export interface AgentOptions {
104
126
  */
105
127
  parentTraceId?: string;
106
128
  parentSpanId?: string;
129
+ /** Agent tier — propagated from the definition so hierarchy checks work in grandchildren. */
130
+ tier?: 'chat' | 'reasoning' | 'worker';
131
+ /** Nesting depth in the spawn chain; 0 = direct child of the chat root (default). */
132
+ agentDepth?: number;
107
133
  }
108
134
  export declare const LOCAL_TOOLS: ({
109
135
  name: string;
@@ -744,11 +770,18 @@ export declare class Agent {
744
770
  readonly agentId: string;
745
771
  /** agent_id of the parent (set by spawn_agent for children). */
746
772
  private parentAgentId?;
773
+ /** Agent tier — forwarded to OrchestrationContext so grandchildren can inherit hierarchy checks. */
774
+ readonly tier?: 'chat' | 'reasoning' | 'worker';
775
+ /** Spawn-chain depth (0 = direct chat-root child). Forwarded to hierarchy checks. */
776
+ readonly agentDepth: number;
747
777
  constructor(mcpClient: McpClientWrapper, llmConfig: LLMConfig, options: AgentOptions);
748
778
  /** Expose for orchestration so spawn_agent can record the parent linkage. */
749
779
  getAgentId(): string;
750
780
  /** Internal — used by spawn_agent to record which parent dispatched us. */
751
781
  setParentAgentId(id: string | undefined): void;
782
+ private isModelVisibleMcpTool;
783
+ private rawMcpToolName;
784
+ private serverIdFromMcpToolName;
752
785
  private allowedToolsForAccess;
753
786
  runTurn(prompt: string, callbacks: RunTurnCallbacks): Promise<string>;
754
787
  /** Rough token estimate (1 token ≈ 4 characters of English / code). */