Skip to content

Self-improving AI Employees for everyone

docs(agents): fix agent, context, and CLI-agent doc drift

trohitg5e94aff85c4b
diff --git a/RFC-0003-OPENAI-COMPATIBLE-PROVIDER-CONTRACT.md b/RFC-0003-OPENAI-COMPATIBLE-PROVIDER-CONTRACT.md
index 64855857..c4065da1 100644
--- a/RFC-0003-OPENAI-COMPATIBLE-PROVIDER-CONTRACT.md
+++ b/RFC-0003-OPENAI-COMPATIBLE-PROVIDER-CONTRACT.md
@@ -330,11 +330,9 @@ separately.
## 13. Compatibility audit of the nine compat providers
All nine `base_url` values in `llm_defaults.json` match their vendor docs and
-need no change. In particular **`deepseek` is path-less and correct**.
-
-The defect is in our documentation: `docs-internal/native_llm_sdk.md:235` states
-DeepSeek's base as `https://api.deepseek.com/v1`, which the vendor does not
-document. Phase 1 fixes the doc, not the config. Any future change that
+need no change; in particular `deepseek` is path-less and correct.
+`native_llm_sdk.md` already documents it as root-mounted with no `/v1`; the doc
+defect this section originally recorded has been fixed. Any future change that
"corrects" the JSON toward `/v1` is a regression.
## 14. References
diff --git a/docs-internal/agent_architecture.md b/docs-internal/agent_architecture.md
index 8a8f350f..8ab3fb22 100644
--- a/docs-internal/agent_architecture.md
+++ b/docs-internal/agent_architecture.md
@@ -5,7 +5,7 @@ Detailed architecture reference for how AI Agent (`aiAgent`) and Chat Agent (`ch
> **Related Documentation:**
> - [Node Creation Guide](./node_creation.md) - Canonical plugin recipe (covers tool nodes, dual-purpose nodes, specialized agents)
> - [Tool Building Pipeline](./tool_building_pipeline.md) - Canonical home for `_build_tool_from_node`, tool discovery, per-type Temporal dispatch
-> - [Agent Context Flow](./agent_context_flow.md) - Canonical home for conversation continuity (RFC-0002 Context store); [Memory Lifecycle](./memory_lifecycle.md) covers only the retired markdown model
+> - [Agent Context Flow](./agent_context_flow.md) - Canonical home for conversation continuity (RFC-0002 Context store). The retired markdown memory model is archived at [ARCHIVE/memory_lifecycle.md](./ARCHIVE/memory_lifecycle.md) and is not an SSOT for anything current.
> - [CLAUDE.md](../CLAUDE.md) - Project overview and full node inventory
## Table of Contents
@@ -182,9 +182,9 @@ next iteration.
### `max_iterations` precedence
-Resolved per-execution by `execute_agent` / `execute_chat_agent` (and `prepare_agent_payload` for F4.B), highest to lowest:
+Resolved per-execution, and the two runtimes differ. **Temporal** (`prepare_agent_payload`, `services/temporal/agent_activities.py`) applies all four tiers below. **In-process** (`execute_agent` / `execute_chat_agent` in `services/ai.py`) applies only tiers 2 and 4: it never reads `parameters.max_iterations` and never consults env `Settings`. Highest to lowest:
-1. **Per-agent-node** `parameters.max_iterations` — set by the user on the agent node itself.
+1. **Per-agent-node** `parameters.max_iterations` — set by the user on the agent node itself. Temporal path only; no agent plugin currently declares a `max_iterations` Params field, so this tier is reachable only from a hand-written graph.
2. **Per-user** `UserSettings.agent_recursion_limit` — Settings tab override (DB-backed).
3. **Env** `Settings.agent_recursion_limit` from `AGENT_RECURSION_LIMIT` (default 200).
4. **JSON** `llm_defaults.json:agent.recursion_limit` — last-resort fallback when Settings can't load.
@@ -654,7 +654,7 @@ Both agents resolve their prompt the same way (logic in `server/nodes/agent/_inl
- When `not parameters.get("prompt") and input_data`, the agent reads the output of the node wired to its `input-main` / `input-chat` handle (`input_data`, surfaced by `collect_agent_connections`).
- Extraction order: `input_data["message"]` → `input_data["text"]` → `input_data["content"]` → `str(input_data)` (whole-output fallback).
-**Task-context injection (Step 1)** runs before the prompt fallback: when an `input-task` edge supplies `task_data`, `format_task_context(task_data)` is prepended to the prompt and tools may be stripped (the agent is reacting to a completed delegation, not starting fresh).
+**Task-context injection (Step 1)** runs before the prompt fallback: when an `input-task` edge supplies `task_data`, `format_task_context(task_data)` is prepended to the prompt. Tools are deliberately **kept**: the injected guidance tells a lead to `list_tasks` / `accept_task` / `reassign_task`, which needs the Task Manager tool (`nodes/agent/_inline.py` module docstring). The only agent that strips tools on task completion is `rlm_agent` (`nodes/agent/rlm_agent/__init__.py`, status in `("completed", "error")`).
**Example workflow:**
```
diff --git a/docs-internal/agent_delegation.md b/docs-internal/agent_delegation.md
index 1a91cfe0..4c97d59e 100644
--- a/docs-internal/agent_delegation.md
+++ b/docs-internal/agent_delegation.md
@@ -93,7 +93,7 @@ for tool_info in tool_data:
For agent node types, the method:
-1. Resolves the tool name via `_resolve_default_tool_name_description(node_type)` — a closure inside `_build_tool_from_node()` that reads the plugin class's `tool_name` ClassVar (each agent plugin declares `tool_name = "delegate_to_<x>"`). There is no central `DEFAULT_TOOL_NAMES` dict; the name comes from the plugin class via `services.node_registry.get_node_class`. The delegation branch is gated by `_get_tool_schema()`'s `_AGENT_DELEGATION_TYPES` tuple (`services/ai.py:2510-2529`) — **18 agents**: the 15 standard delegatable agents (`aiAgent`, `chatAgent`, `android_agent`, `coding_agent`, `web_agent`, `task_agent`, `social_agent`, `travel_agent`, `tool_agent`, `productivity_agent`, `payments_agent`, `consumer_agent`, `autonomous_agent`, `orchestrator_agent`, `ai_employee`), the two bypass-loop agents `rlm_agent` and `claude_code_agent`, and the bridged cloud agent `vertex_managed_agent`. (`AI_AGENT_TYPES` in `server/constants.py:32-53` mirrors this same 18-entry set; `codex_agent` is not currently in it. The `tool_name = f"delegate_to_{cls.type}"` default is stamped by `BaseNode.__init_subclass__`, `services/plugin/base.py:257`, so only `aiAgent`, `chatAgent` and `vertex_managed_agent` declare it explicitly.)
+1. Resolves the tool name via `_resolve_default_tool_name_description(node_type)` — a closure inside `_build_tool_from_node()` that reads the plugin class's `tool_name` ClassVar (each agent plugin declares `tool_name = "delegate_to_<x>"`). There is no central `DEFAULT_TOOL_NAMES` dict; the name comes from the plugin class via `services.node_registry.get_node_class`. The delegation branch is gated by `_get_tool_schema()`'s `_AGENT_DELEGATION_TYPES` tuple (`services/ai.py:2509-2528`) — **18 agents**: the 15 standard delegatable agents (`aiAgent`, `chatAgent`, `android_agent`, `coding_agent`, `web_agent`, `task_agent`, `social_agent`, `travel_agent`, `tool_agent`, `productivity_agent`, `payments_agent`, `consumer_agent`, `autonomous_agent`, `orchestrator_agent`, `ai_employee`), the two bypass-loop agents `rlm_agent` and `claude_code_agent`, and the bridged cloud agent `vertex_managed_agent`. (`AI_AGENT_TYPES` in `server/constants.py:32-53` mirrors this same 18-entry set; `codex_agent` is not currently in it. The `tool_name = f"delegate_to_{cls.type}"` default is stamped by `BaseNode.__init_subclass__`, `services/plugin/base.py:257`, so only `aiAgent`, `chatAgent` and `vertex_managed_agent` declare it explicitly.)
2. Creates a `DelegateToAgentSchema` Pydantic model in `_get_tool_schema()` with two fields (`task` -> the child's mission directive / system message, `context` -> the child's input data / prompt):
```python
diff --git a/docs-internal/claude_code_agent.md b/docs-internal/claude_code_agent.md
index db7294f6..7f288e0f 100644
--- a/docs-internal/claude_code_agent.md
+++ b/docs-internal/claude_code_agent.md
@@ -4,7 +4,7 @@
long-lived **interactive** subprocess (stdio pipes, no PTY) over the VSCode-extension
stream-json protocol — not the `claude -p` headless path. A warm `ClaudeSessionPool`
(keyed by the RFC-0002 conversation key when a Context node is connected, or by the
-legacy `simpleMemory.node_id` on `input-memory` graphs — `services/cli_agent/service.py:354-358`)
+legacy `simpleMemory.node_id` on `input-memory` graphs — `services/cli_agent/service.py:359-363`)
preserves the session across turns;
memory continuity is claude-native via a host-minted `--session-id` on the first run and `--resume <last_session_id>` afterwards in a stable
per-workflow git worktree (`<workspace>/<node>/wt_session`, branched off the enclosing repo; the repo root is never the cwd). Connected tools and skills reach claude through an MCP bridge; the spawn
@@ -17,7 +17,7 @@ This page is a **router**. The detail lives in the documents below — start her
| Your question | Read |
|---|---|
-| How does the whole integration work end-to-end? (architecture, memory & context compaction, sub-agent creation, data structures) | [claude_code_agent_architecture.md](./claude_code_agent_architecture.md) |
+| How does the whole integration work end-to-end? (architecture, memory & context compaction, sub-agent creation, data structures) | [claude_code_agent_architecture.md](./ARCHIVE/claude_code_agent_architecture.md) |
| How does interactive mode work? (stdio pipes vs PTY, stream-json events, `system/init` / `assistant` / `result`, session continuity, the four `claude.session.*` CloudEvents) | [claude_code_interactive_mode.md](./claude_code_interactive_mode.md) |
| The generic multi-provider runtime (`AICliService.run_batch`, FastMCP bridge, the memory bridge `--session-id`/`--resume`, plugin-folder layout) | [cli_agent_framework.md](./cli_agent_framework.md) |
| Does our implementation match the official Claude Code spec? (six invariants + status) | [cli_agent_canonical_patterns_rfc.md](./cli_agent_canonical_patterns_rfc.md) |
@@ -40,10 +40,10 @@ All claude-specific code is self-contained here; the generic framework at
|---|---|
| `__init__.py` | `ClaudeCodeAgentNode(ActionNode)` (line 238 — it does not go through `SpecializedAgentBase` / the native loop) + `Params`/`Output`; self-registers via `factory.py` (`register_provider` / `register_session_pool` / `register_skill_materialiser`) + `register_ws_handlers`. |
| `_provider.py` | Builds the spawn argv (`--output-format stream-json --input-format stream-json --verbose --ide`, `--permission-mode dontAsk`, `--allowedTools`, `--resume`/`--session-id`). |
-| `_pool.py` | `ClaudeSessionPool` — warm subprocess keyed by `simpleMemory.node_id`; stdout reader, session-UUID capture, crash-recovery respawn. |
+| `_pool.py` | `ClaudeSessionPool` — warm subprocess keyed by the RFC-0002 conversation key `context_bridge.pool_key` (legacy fallback: `simpleMemory.node_id`); stdout reader, session-UUID capture, crash-recovery respawn. |
| `_skills.py` | `materialise_skills` — writes connected SKILL.md trees under `<workspace>/.claude/skills/`, diff-based on warm reuse. |
| `_oauth.py` | Isolated `CLAUDE_CONFIG_DIR` (`<DATA_DIR>/claude/`), browser-OAuth bridge, binary install. |
-| `_handlers.py` | WebSocket handlers `claude_code_login` (line 103) / `claude_code_logout` (line 140), exported through `WS_HANDLERS`. |
+| `_handlers.py` | WebSocket handlers `handle_claude_code_login` / `handle_claude_code_logout`, exported through `WS_HANDLERS`. |
## See also
diff --git a/docs-internal/claude_code_interactive_mode.md b/docs-internal/claude_code_interactive_mode.md
index e0618997..0453f799 100644
--- a/docs-internal/claude_code_interactive_mode.md
+++ b/docs-internal/claude_code_interactive_mode.md
@@ -3,7 +3,7 @@
> **TL;DR.** `ClaudeSessionPool` keeps a warm `claude` subprocess per
> session key (the RFC-0002 conversation key `context_bridge.pool_key` when
> a Context node is wired; the legacy `simpleMemory.node_id` on `input-memory`
-> graphs — `services/cli_agent/service.py:354-358`) and drives it with the same flags Anthropic's
+> graphs — `services/cli_agent/service.py:359-363`) and drives it with the same flags Anthropic's
> own VSCode extension uses — stdio pipes, `--output-format stream-json
> --input-format stream-json --verbose --ide`. Multi-turn happens by
> writing newline-delimited JSON to `proc.stdin` of the long-lived
@@ -131,7 +131,10 @@ allowlist gate.
## Session pool — warm-process reuse
[`ClaudeSessionPool`](../server/nodes/agent/claude_code_agent/_pool.py) is
-keyed by `simpleMemory.node_id`. Each entry is a
+keyed by the RFC-0002 conversation key `context_bridge.pool_key`
+(`(workflow_id, agent_node_id, generation)`), falling back to the legacy
+`simpleMemory.node_id` only on `input-memory` graphs
+(`services/cli_agent/service.py:359-363`). Each entry is a
`PooledClaudeSession` carrying the live `asyncio.subprocess.Process`,
the captured session UUID (filled in from the first event that has
one), the MCP bearer token embedded in the spawn argv, a per-session
diff --git a/docs-internal/cli_agent_canonical_patterns_rfc.md b/docs-internal/cli_agent_canonical_patterns_rfc.md
index 68fda6d1..9ad45f34 100644
--- a/docs-internal/cli_agent_canonical_patterns_rfc.md
+++ b/docs-internal/cli_agent_canonical_patterns_rfc.md
@@ -6,7 +6,7 @@
| Date | 2026-05-07 |
| Scope | `services/cli_agent` framework — Claude Code, Codex, Gemini-CLI agents spawned by OpenCompany |
| Companion code | [`server/services/cli_agent/`](../server/services/cli_agent/), [`server/nodes/agent/claude_code_agent/`](../server/nodes/agent/claude_code_agent/) |
-| Companion docs | [cli_agent_framework.md](./cli_agent_framework.md), [claude_code_agent_architecture.md](./claude_code_agent_architecture.md) |
+| Companion docs | [cli_agent_framework.md](./cli_agent_framework.md), [claude_code_agent_architecture.md](./ARCHIVE/claude_code_agent_architecture.md) |
## Abstract
@@ -425,7 +425,7 @@ reverted: the CLI resolves `--continue` only against interactive
sessions, so it never found the pool's non-interactive ones.) The entry
point is
[`claude_code_agent/__init__.py::execute_op`](../server/nodes/agent/claude_code_agent/__init__.py)
-(sets `continue_session = bool(memory_data)`) and the warm-subprocess
+(sets `resume_session_id` from `memory_data["last_session_id"]`) and the warm-subprocess
pool at [`claude_code_agent/_pool.py`](../server/nodes/agent/claude_code_agent/_pool.py).
Current canonical description:
[cli_agent_framework.md → Memory bridge](./cli_agent_framework.md#memory-bridge--simplememory--claude_code_agent).
@@ -501,7 +501,7 @@ documented project-instruction surface.
| **I-3** `list_changed` notification | **DONE (`b40011e`).** [`workflow_tools._schedule_list_changed_notify`](../server/services/cli_agent/workflow_tools.py) fires after each `add_tool` / `remove_tool` since FastMCP doesn't emit it automatically. | Optional: unit test asserting `session.send_tool_list_changed` is called. |
| **I-4** Tool-search deferral | **DONE.** `"alwaysLoad": true` set on the `opencompany` server entry in [`claude_code_agent/_provider.py::interactive_argv`](../server/nodes/agent/claude_code_agent/_provider.py). | None. |
| **I-5** Visible-tool filtering | **Gap.** All 7 built-in OpenCompany MCP tools (including `getCredential`, `broadcastLog`) are visible to the model. | Mark internal-only tools `_meta["anthropic/alwaysLoad"]: false` or filter via FastMCP middleware. **Defer** — not breaking today. |
-| **I-6** Native session continuity | **DONE.** [`session.py`](../server/services/cli_agent/session.py) keeps a stable cwd for memory-bound spawns; the warm-subprocess pool at [`claude_code_agent/_pool.py`](../server/nodes/agent/claude_code_agent/_pool.py) preserves the session across turns. [`claude_code_agent/__init__.py`](../server/nodes/agent/claude_code_agent/__init__.py) sets `continue_session = bool(memory_data)` → argv emits `--continue` (first cold spawn) with `--resume <UUID>` reserved for crash recovery. [`service.py:_persist_memory`](../server/services/cli_agent/service.py) appends turns to `memory_content`, saves `last_session_id` (display-only), broadcasts `node_parameters_updated`, and auto-clears stale UUIDs via `_clear_stale_session_id`. See §4.8. | Markdown `memory_content` remains the UI mirror, not the resume channel. |
+| **I-6** Native session continuity | **DONE.** [`session.py`](../server/services/cli_agent/session.py) keeps a stable cwd for memory-bound spawns; the warm-subprocess pool at [`claude_code_agent/_pool.py`](../server/nodes/agent/claude_code_agent/_pool.py) preserves the session across turns. [`claude_code_agent/__init__.py`](../server/nodes/agent/claude_code_agent/__init__.py) sets `resume_session_id = memory_data["last_session_id"]`; argv emits a host-minted `--session-id <uuid4>` on first cold spawn (`_pool.py`) and `--resume <UUID>` on later cold spawns and crash recovery. `--continue` is never emitted; the `continue_session` arm in `_provider.py` is unreachable from the plugin. [`service.py:_persist_memory`](../server/services/cli_agent/service.py) appends turns to `memory_content`, saves `last_session_id` (display-only), broadcasts `node_parameters_updated`, and auto-clears stale UUIDs via `_clear_stale_session_id`. See §4.8. | Markdown `memory_content` remains the UI mirror, not the resume channel. |
| **System-prompt directive** (Cursor / `CLAUDE.md` pattern) | **DONE (`b40011e`).** Second `--append-system-prompt` listing connected `mcp__opencompany__*` tools. | None. |
| `--allowedTools` strict MCP-only allowlist | **DONE (superseded R3).** Built-in escape hatches (`Read`/`Edit`/`Bash`/`Glob`/`Grep`/`Write`/`WebSearch`/`WebFetch`) are NOT in the default allowlist; `Skill` is added conditionally (only when a skill is wired). `default_allowed_tools: ""` in [`ai_cli_providers.json`](../server/config/ai_cli_providers.json); allowlist assembled in [`_provider.py::interactive_argv`](../server/nodes/agent/claude_code_agent/_provider.py). Gated by `--permission-mode dontAsk`. | None. |
| Composio-style server-side credentials | **Aligned.** `getCredential` allowlist + `auth_service.get_api_key`. | None. |
diff --git a/docs-internal/cli_agent_framework.md b/docs-internal/cli_agent_framework.md
index be16b235..80d3d4ed 100644
--- a/docs-internal/cli_agent_framework.md
+++ b/docs-internal/cli_agent_framework.md
@@ -377,7 +377,7 @@ the reference implementation). Four self-registration calls in
## Memory bridge — `simpleMemory` → `claude_code_agent`
-> See [memory_lifecycle.md](./memory_lifecycle.md) for the shared markdown surface (every agent uses the same `parse_memory_markdown` / `append_to_memory_markdown` / `trim_markdown_window` helpers to maintain `simpleMemory.memory_content`). This section documents what's UNIQUE to `claude_code_agent`: the markdown is the UI mirror, not the resume channel.
+> See [memory_lifecycle.md](./ARCHIVE/memory_lifecycle.md) for the shared markdown surface (every agent uses the same `parse_memory_markdown` / `append_to_memory_markdown` / `trim_markdown_window` helpers to maintain `simpleMemory.memory_content`). This section documents what's UNIQUE to `claude_code_agent`: the markdown is the UI mirror, not the resume channel.
Connecting a `simpleMemory` node to a `claude_code_agent` makes the
spawned `claude` subprocess resume its prior session natively across runs.
@@ -418,16 +418,18 @@ Argv emission lives in
[`nodes/agent/claude_code_agent/_provider.py:interactive_argv`](../server/nodes/agent/claude_code_agent/_provider.py).
The `ClaudeTaskSpec` carries `continue_session: bool` and
`resume_session_id: Optional[str]`. `claude_code_agent.execute_op` sets
-`continue_session = bool(memory_data)` for the cold-spawn case; the
+`resume_session_id` from the memory node's `last_session_id` and leaves
+`continue_session` at its `False` default (`claude_code_agent/__init__.py`); the
pool's crash-recovery path injects `resume_session_id =
session.current_session_uuid` into the spec before respawning.
-`--session-id <UUID5>` (the pre-cutover UUID-round-trip primitive) is
-intentionally NOT emitted in interactive mode — claude rejects it.
+The pre-cutover UUID5 derivation is gone; the `--session-id` emitted today is
+a fresh `uuid4` minted by `ClaudeSessionPool._spawn` on cold start (claude
+rejects a UUID already in use).
### Plumbing
```
-ClaudeCodeAgentNode.execute_op (__init__.py:291-330)
+ClaudeCodeAgentNode.execute_op (__init__.py:263-330)
├─ collect_agent_connections() → context_data (first tuple element)
│ ├─ Context node wired: a Context descriptor (kind == "context") → context_descriptor,
│ │ handed to AICliService as connected_context and bridged through
@@ -435,14 +437,15 @@ ClaudeCodeAgentNode.execute_op (__init__.py:291-330)
│ └─ legacy input-memory graphs: the recorded Memory descriptor → memory_data
│ {node_id, session_id, memory_content, window_size,
│ long_term_enabled, last_session_id (display-only)}
- ├─ continue_session = bool(memory_data)
+ ├─ resume_session_id = memory_data.get("last_session_id")
├─ ClaudeTaskSpec(..., continue_session=continue_session,
│ resume_session_id=None)
└─ AICliService.run_batch(..., connected_memory=memory_data,
broadcaster=...)
└─ For context/memory-wired single-task runs, route through ClaudeSessionPool
- (service.py:343-358 — use_pool = claude AND one task AND
- (connected_memory OR a Context bridge)):
+ (service.py:357-363 — use_pool = the provider registered a session pool;
+ bound_key = context_bridge.pool_key, else connected_memory["node_id"],
+ else None. Unbound batches still run pooled, one ephemeral session per task.)
├─ pool.acquire(session_key, spec, cwd=<workspace>/<node>/wt_session, env, ...)
│ session_key = context_bridge.pool_key when a Context node is wired (the
│ RFC-0002 conversation key, so a Reset's generation bump
diff --git a/docs-internal/memory_compaction.md b/docs-internal/memory_compaction.md
index c131fdff..bb8de302 100644
--- a/docs-internal/memory_compaction.md
+++ b/docs-internal/memory_compaction.md
@@ -1,6 +1,6 @@
# Memory Compaction, Session Token Tracking, and Cost Calculation
-> **Related docs:** [memory_lifecycle.md](./memory_lifecycle.md) for the markdown / vector-store / state-clear surface. This doc is the SSOT for the **service** (`CompactionService`, thresholds, shared native summarization, and pricing). `memory_lifecycle.md` is the SSOT for the **flow** (how the markdown moves through an agent turn).
+> **Related docs:** [memory_lifecycle.md](./ARCHIVE/memory_lifecycle.md) for the retired markdown / vector-store / state-clear surface (archived, not an SSOT). This doc is the SSOT for the **service** (`CompactionService`, thresholds, shared native summarization, and pricing). [agent_context_flow.md](./agent_context_flow.md) is the SSOT for the **flow** (how a conversation moves through an agent turn).
## Overview
diff --git a/docs-internal/native_llm_sdk.md b/docs-internal/native_llm_sdk.md
index 8ff85ef8..468d5177 100644
--- a/docs-internal/native_llm_sdk.md
+++ b/docs-internal/native_llm_sdk.md
@@ -236,7 +236,7 @@ Adding a new OpenAI-compatible provider requires a config entry:
"models_endpoint": "https://api.deepseek.com/models",
"base_url": "https://api.deepseek.com",
"max_output_tokens": { "_default": 8192 },
- "context_length": { "_default": 128000 },
+ "context_length": { "_default": 131072 },
"temperature_range": [0.0, 2.0]
}
```
diff --git a/docs-internal/rlm_service.md b/docs-internal/rlm_service.md
index 5808a59b..0f02196d 100644
--- a/docs-internal/rlm_service.md
+++ b/docs-internal/rlm_service.md
@@ -1,6 +1,6 @@
# RLM Service -- Recursive Language Model Agent Integration
-> **Related docs:** [agent_context_flow.md](./agent_context_flow.md) for conversation continuity — RLM is a specialized provider, so a connected Context node reaches it through `SpecializedAgentContextBridge` (`services/cli_agent/context_bridge.py`); [tool_building_pipeline.md](./tool_building_pipeline.md) for how connected tool nodes are bound to the REPL via `ToolBridgeAdapter`. [memory_lifecycle.md](./memory_lifecycle.md) describes only the retired markdown memory path.
+> **Related docs:** [agent_context_flow.md](./agent_context_flow.md) for conversation continuity — RLM is a specialized provider, so a connected Context node reaches it through `SpecializedAgentContextBridge` (`services/cli_agent/context_bridge.py`); [tool_building_pipeline.md](./tool_building_pipeline.md) for how connected tool nodes are bound to the REPL via `ToolBridgeAdapter`. [memory_lifecycle.md](./ARCHIVE/memory_lifecycle.md) describes only the retired markdown memory path.
## Overview
@@ -266,6 +266,7 @@ return await ai_service.rlm_service.execute(node_id, parameters, ...)
The LM writes Python code inside `\`\`\`repl` fenced blocks. These are extracted via regex and executed with `exec()` in a sandboxed namespace.
### Available Functions in REPL
+(provided by the upstream `rlm` package's REPL, not defined under `server/`)
- `llm_query(prompt)` -- Plain LM call (uses depth+1 backend)
- `rlm_query(prompt)` -- Recursive child RLM with its own REPL
- `FINAL(answer)` -- Signal completion with answer string
@@ -323,7 +324,7 @@ Wave 11 / Wave 12 D5 refactors removed the surfaces they named.
`tests/test_tool_registry.py`); the delegation identity comes from
`BaseNode.__init_subclass__`, which stamps `tool_name =
f"delegate_to_{cls.type}"` on every agent plugin (`services/plugin/base.py:257`).
-`rlm_agent` is listed in both `_AGENT_DELEGATION_TYPES` (`services/ai.py:2510`,
+`rlm_agent` is listed in both `_AGENT_DELEGATION_TYPES` (`services/ai.py:2509`,
the `DelegateToAgentSchema` gate) and `AI_AGENT_TYPES` (`server/constants.py:32`,
the `execute_tool` dispatch gate). It stays on the legacy fire-and-forget path
— excluded from `AGENT_WORKFLOW_TYPES` because its REPL state is externalised.
diff --git a/server/nodes/agent/_inline.py b/server/nodes/agent/_inline.py
index 5ed4d768..04bed21c 100644
--- a/server/nodes/agent/_inline.py
+++ b/server/nodes/agent/_inline.py
@@ -1,6 +1,6 @@
"""Shared pre-dispatch logic for every agent plugin.
-Every agent (ai_agent, chat_agent, 13 specialized agents, team leads)
+Every agent (ai_agent, chat_agent, the 13 SpecializedAgentBase plugins: 11 specialized plus the 2 team leads)
shares the same 3-step preamble before calling its specific AIService
method: