Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
refactor: one Context and Memory vocabulary, no V1/V2 labels
trohitg39a0e58a5887
diff --git a/CLAUDE.md b/CLAUDE.mdindex 4f27fcaa..8432de98 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -754,7 +754,7 @@ Node groups (palette categories): agent, model, skill, tool, trigger, workflow,Workflows execute via Temporal for durability and horizontal scaling, gated by `TEMPORAL_ENABLED`. Three dispatch paths exist — legacy single `execute_node_activity` (fallback), per-type `node.{type}.v{version}` activities (F4.A, `TEMPORAL_PER_TYPE_DISPATCH=true`), and Agent-as-child-workflow (F4.B, `TEMPORAL_AGENT_WORKFLOW_ENABLED=true`) — with `rlm_agent`/`claude_code_agent` always bypassing AgentWorkflow. **Per-queue activity routing is production-default (Wave 16)**: a `TemporalWorkerPool` runs one activity-only worker per plugin-declared `cls.task_queue` (ai-heavy / browser / code-exec / rest-api / messaging / ...) with per-queue concurrency + rate limits + resource-based tuning for ai-heavy/browser; rollback via `TEMPORAL_WORKER_POOL_ENABLED=false`. Resilience knobs (Waves 17-18): `DEPLOYMENT_MODE` (local halves concurrency; sizes the sticky cache), one-shot retry on `agent.execute_llm_step` (LLM calls are not idempotent), observability interceptors (`activity_retry` WARN on re-dispatch), 30s periodic heartbeat during long activity bodies, cron `catchup_window=24h`, poller autoscaling. **Conditional edges are evaluated on this path too, as of the `machina-conditional-edges-v1` patch.** They previously were not: `MachinaWorkflow._find_ready_nodes` scheduled purely on dependency completion, so a condition set in the editor rendered an edge label and then did nothing once execution routed through Temporal — silently, with both branches running. The skip mirrors `WorkflowExecutor._evaluate_incoming_conditions` exactly rather than improving on it: **OR-any** across a node's conditional incoming edges, and **skipping is not transitive** (a skipped node counts as completed, matching `get_completed_nodes` including `SKIPPED`, so an unconditional downstream node still runs). `evaluate_condition` is imported from `services.execution.conditions` **directly, never via the package `__init__`**, which also pulls in the executor / cache / recovery sweeper / DLQ; the module itself is pure (`re` + comparisons, no IO, no clock, no randomness) so it is safe to evaluate inside a workflow. The `workflow.patched(...)` gate is mandatory — the skip changes which activities get scheduled, so an ungated change would break replay for in-flight workflows. Locked by `tests/temporal/test_conditional_edges.py`, whose patch-closed case asserts the pre-fix command sequence is still reproduced verbatim.-Execution routing falls back Temporal → sequential; the Temporal dev server + embedded worker are managed in-process under `server/services/temporal/` (pooch-downloaded CLI, single `temporal server start-dev` process, gRPC `TEMPORAL_FRONTEND_GRPC_PORT` + Web UI `TEMPORAL_UI_PORT`, SQLite at `~/.opencompany/temporal.db`). Full architecture, dispatch matrix, per-node + agent-loop lifecycle, the F4.B `agent.*` activities (unsuffixed since the V1/V2 fold; read the live set from `collect_agent_activities()` rather than a hardcoded count), heartbeat semantics, delegation input contract, the worker tuning recipe, and all `.env` tunables live in [docs-internal/TEMPORAL_ARCHITECTURE.md](./docs-internal/TEMPORAL_ARCHITECTURE.md).+Execution routing falls back Temporal → sequential; the Temporal dev server + embedded worker are managed in-process under `server/services/temporal/` (pooch-downloaded CLI, single `temporal server start-dev` process, gRPC `TEMPORAL_FRONTEND_GRPC_PORT` + Web UI `TEMPORAL_UI_PORT`, SQLite at `~/.opencompany/temporal.db`). Full architecture, dispatch matrix, per-node + agent-loop lifecycle, the F4.B `agent.*` activities (unsuffixed since the AgentWorkflow fold; read the live set from `collect_agent_activities()` rather than a hardcoded count), heartbeat semantics, delegation input contract, the worker tuning recipe, and all `.env` tunables live in [docs-internal/TEMPORAL_ARCHITECTURE.md](./docs-internal/TEMPORAL_ARCHITECTURE.md).**Months-long durability contract (July 2026).** Running and paused deployments survive backend restarts, are never auto-terminated, and keep executing for months. Load-bearing invariants: (1) `TEMPORAL_TERMINATE_RUNNING_ON_STARTUP` stays `false` (debug-only sweep; even enabled, any control row in the shared `WORKFLOW_CONTROL_ACTIVE_STATES` — including `resetting` — vetoes it). (2) New child workflow starts carry **no** `execution_timeout`/`run_timeout` — Temporal's timeout timers keep ticking through a cooperative pause, so lifetime caps silently terminated paused runs; liveness comes from activity heartbeats (30s beat / 2min timeout), never from workflow lifetime caps. Removing/adding start options or retry policies on recorded commands requires a `workflow.patched(...)` guard (see the `*-unbounded-*` / `*-history-bounded-can-*` markers). (3) Every long-lived workflow loop must continue-as-new under history pressure (`is_continue_as_new_suggested()` + a soft cap) — Temporal hard-terminates around ~51,200 history events; `WorkflowControlWorkflow` carries triggers/queued events/seen-ids/control state across rollovers, so controller handles are addressed **by workflow id only, never run_id-pinned**. (4) `dispatch.emit` skips controllers whose `ControlEventTypes` Search Attribute doesn't match the event (absent attribute = legacy match-all). (5) The Temporal lifecycle is owned by [services/temporal/lifecycle.py](./server/services/temporal/lifecycle.py) (`main.py` only schedules it): dev-server supervision + resident watchdog (`TEMPORAL_HEALTH_MONITOR_INTERVAL_SECONDS`), worker crash-restarts that REBUILD the single-use SDK `Worker` per attempt (manager + every pool queue worker), and the boot-time `reconcile_active_controls_on_boot` pass (converges crash-stranded `starting` rows, re-arms running/paused generations from the persisted graph snapshot). (6) **Recovery policies** (env-driven, defaults in `.env.template`; full semantics in [temporal-workflow-control.md → Recovery policies](./docs-internal/temporal-workflow-control.md)): `WORKFLOW_CONTROL_CRASH_RECOVERY=pause` — after a kill/crash (dirty-bit marker cleared only by graceful teardown) boot recovers running generations as **paused** so the user consciously resumes; `WORKFLOW_CONTROL_MISSING_CONTROLLER=pause` — a killed/vanished controller converges the generation to paused and **Resume rebuilds the controller** (`WorkflowIdConflictPolicy.USE_EXISTING`, re-arm from snapshot) instead of forcing a state-archiving Reset; `WORKFLOW_CONTROL_PAUSE_ON_FAILURE=true` — repeatedly-failing trigger-spawned runs pause their deployment via the `workflow_control.pause_on_failure.v1` activity (circuit breaker; trips only after `WORKFLOW_CONTROL_PAUSE_ON_FAILURE_THRESHOLD` (default 3) failures inside a rolling `_WINDOW_SECONDS` (default 600) so one node hiccup never pauses anything; Resume resets the streak; manual canvas runs never qualify). Temporal's native Pause/Unpause (server 1.28+) is deliberately NOT used — no Python SDK surface, and it halts workflow-task dispatch so a natively-paused controller couldn't process the resume Update. (7) **Workflow-scoped event delivery**: an envelope whose `workflow_id` is set by its producer's call site reaches only that workflow's consumers (`dispatch.emit` narrows both Visibility clauses by `EventWorkflowId`); chat is the first scoped producer — the decision lives in `routers/websocket.py`, the narrowing in core dispatch, and plugin `_events.py` factories only plumb the field (see [event_framework.md](./docs-internal/event_framework.md)). (8) **Canvas editability is the server-owned `can_edit` capability** emitted by `serialize_control` (paused = editable; starting/running/transitional = locked); the FE renders it via `lib/canvasLock.ts` + Dashboard's `guardCanvasEdit` and never re-derives the rule from state strings (see [temporal-workflow-control.md → Canvas editability](./docs-internal/temporal-workflow-control.md)). Locked by `tests/temporal/test_durability_hardening.py` + `test_worker_restart.py`.@@ -1671,7 +1671,7 @@ Config handles follow the pattern `input-<type>` where type is NOT 'main':- `input-task` - Task completion trigger nodes- `input-teammates` - Team member agent nodes- `input-main` - Main data flow (NOT a config handle)-- `input-memory` - **retired.** Kept only so immutable V1 graph snapshots replay; no agent declares it. `normalize_workflow_graph` rewrites legacy `simpleMemory -> input-memory` edges into a Context node plus an ordinary tool edge.+- `input-memory` - **retired.** Kept only so legacy graph snapshots recorded with it replay; no agent declares it. `normalize_workflow_graph` rewrites legacy `simpleMemory -> input-memory` edges into a Context node plus an ordinary tool edge.**Note**: Trigger nodes (e.g., `taskTrigger`) connecting via config handles are excluded from downstream inclusion in `_get_downstream_nodes()` to prevent them from blocking as event waiters.diff --git a/RFC-0002-AGENT-CONTEXT-AND-MEMORY.md b/RFC-0002-AGENT-CONTEXT-AND-MEMORY.mdindex b02cc7db..222ebb44 100644--- a/RFC-0002-AGENT-CONTEXT-AND-MEMORY.md+++ b/RFC-0002-AGENT-CONTEXT-AND-MEMORY.md@@ -1,4 +1,4 @@-# RFC-0002 — Agent Context V2 and Tool-Based Memory+# RFC-0002 — Agent Context and Tool-Based MemoryStatus: Partly superseded (August 2026)Graph version: 2@@ -47,8 +47,8 @@ shared.- Reuse `MessageWireV2`, including ordered blocks, raw malformed toolarguments, signed/thought blocks, and provider continuation state.-- Preserve existing Temporal V1 histories. Context V2 is selected only by a- new graph/generation and uses new workflow/activity type names.+- Preserve existing Temporal histories. The Context store is selected only by+ a new graph/generation and uses new workflow/activity type names.- Keep Gemini on `generate_content`; an Interactions migration is out ofscope.- Do not reintroduce LangChain compatibility.diff --git a/client/src/adapters/__tests__/nodeSpecToDescription.test.ts b/client/src/adapters/__tests__/nodeSpecToDescription.test.tsindex d4d6e89a..51307f62 100644--- a/client/src/adapters/__tests__/nodeSpecToDescription.test.ts+++ b/client/src/adapters/__tests__/nodeSpecToDescription.test.ts@@ -282,7 +282,7 @@ describe('nodeSpecToDescription contract', () => {expect(def.handles).not.toBe(handles);});- it('retains Context V2 capability and panel hints', () => {+ it('retains Context capability and panel hints', () => {const def = nodeSpecToDescription({type: 'contextNode',displayName: 'Context',diff --git a/client/src/components/SquareNode.tsx b/client/src/components/SquareNode.tsxindex 1f3a5955..c0cd6ec3 100644--- a/client/src/components/SquareNode.tsx+++ b/client/src/components/SquareNode.tsx@@ -120,7 +120,7 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectabif (spec?.handles?.length) return spec.handles;// Cold-cache / legacy fallback. Once a NodeSpec arrives its declared- // topology replaces this list wholesale, including Context V2 handles.+ // topology replaces this list wholesale, including Context handles.const fallback: NodeSpecHandle[] = [];if (!spec?.hideInputHandle) {fallback.push({diff --git a/client/src/components/parameterPanel/__tests__/InputSection.test.tsx b/client/src/components/parameterPanel/__tests__/InputSection.test.tsxindex 82db8eb7..38e44056 100644--- a/client/src/components/parameterPanel/__tests__/InputSection.test.tsx+++ b/client/src/components/parameterPanel/__tests__/InputSection.test.tsx@@ -197,7 +197,7 @@ describe('InputSection -- config handle filtering for agent nodes', () => {});});- it('SKIPS input-context edges on Context V2 agents', async () => {+ it('SKIPS input-context edges on Context agents', async () => {setWorkflow([{ id: 'ctx', type: 'context', data: { label: 'Context' }, position: { x: 0, y: 0 } },diff --git a/docs-internal/TEMPORAL_ARCHITECTURE.md b/docs-internal/TEMPORAL_ARCHITECTURE.mdindex 27e81778..74a1034c 100644--- a/docs-internal/TEMPORAL_ARCHITECTURE.md+++ b/docs-internal/TEMPORAL_ARCHITECTURE.md@@ -502,7 +502,7 @@ Certain nodes provide configuration rather than executing:CONFIG_HANDLES = {"input-context","input-tools",- "input-memory", # replay/import compatibility for V1 graph snapshots only+ "input-memory", # replay/import compatibility for legacy input-memory graphs only"input-model","input-skill","input-task",diff --git a/docs-internal/agent_architecture.md b/docs-internal/agent_architecture.mdindex c406b3c3..8a8f350f 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 V1 markdown model+> - [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> - [CLAUDE.md](../CLAUDE.md) - Project overview and full node inventory## Table of Contents@@ -53,7 +53,7 @@ collect_agent_connections() server/services/plugin/edge_walker.pyGroups by targetHandle into 5 buckets (returns a 5-tuplecontext_data, skill_data, tool_data, input_data, task_data —edge_walker.py:181-199; the first element is the Context descriptor,- or the legacy Memory descriptor on immutable V1 snapshots):+ or the legacy Memory descriptor on `input-memory` graphs):input-context -> context_datainput-skill -> skill_data[]input-tools -> tool_data[]@@ -67,8 +67,8 @@ AIService.execute_agent() / execute_chat_agent() server/services/ai.pyskills ride the Skill tool instead2. Build provider-neutral AgentToolSpecs from tool_data3. Call run_native_agent_loop(ChatUnifier, ...)- 4. Save the conversation (Context store; legacy V1 memory markdown- only for immutable V1 snapshots), return result+ 4. Save the conversation (Context store; legacy memory markdown+ only for `input-memory` graphs), return result|vrun_native_agent_loop() execution@@ -467,7 +467,7 @@ it; `normalize_workflow_graph` rewrites legacy `simpleMemory -> input-memory`edges into a Context node plus an ordinary tool edge. The legacy markdownmemory path (`memory_data`, `parse_memory_markdown`,`append_to_memory_markdown`, `trim_markdown_window`, the vector store) is-reached only for immutable V1 snapshots: `execute_agent` passes the tuple's+reached only for `input-memory` graphs: `execute_agent` passes the tuple'sfirst element as `context_data` to `_prepare_context` and sets `memory_data =None` whenever a Context runtime resolves (`ai.py:969-980`). Token trackingand compaction thresholds are in [memory_compaction.md](memory_compaction.md).diff --git a/docs-internal/agent_delegation.md b/docs-internal/agent_delegation.mdindex af09c19d..1a91cfe0 100644--- a/docs-internal/agent_delegation.md+++ b/docs-internal/agent_delegation.md@@ -277,7 +277,7 @@ result = await instance.execute(node_id, child_params, child_ctx)**File:** `server/nodes/agent/_inline.py`, `prepare_agent_call()` (called by every agent plugin's `@Operation`)-The spawned child's `execute()` runs `prepare_agent_call()`, which calls `collect_agent_connections()` (from `server/services/plugin/edge_walker.py`) with **its own node_id**. The function returns a **5-tuple** — `(context_data, skill_data, tool_data, input_data, task_data)` (`edge_walker.py:181-199`; the first element is the Context descriptor, or the legacy Memory descriptor on immutable V1 snapshots):+The spawned child's `execute()` runs `prepare_agent_call()`, which calls `collect_agent_connections()` (from `server/services/plugin/edge_walker.py`) with **its own node_id**. The function returns a **5-tuple** — `(context_data, skill_data, tool_data, input_data, task_data)` (`edge_walker.py:181-199`; the first element is the Context descriptor, or the legacy Memory descriptor on `input-memory` graphs):```pythoncontext_data, skill_data, tool_data, input_data, task_data = await collect_agent_connections(@@ -346,8 +346,8 @@ Parent and child agents have completely separate memory systems. On current(V2) graphs the child's conversation is its own RFC-0002 Context store row,keyed by `(workflow_id, generation, <child agent_node_id>)`, and `simpleMemory`is an explicit tool the child calls on its own `input-tools`; the table below-describes the legacy V1 markdown model, which survives only for immutable V1-snapshots:+describes the legacy markdown model, which survives only for graphs recorded+with an `input-memory` edge:| Aspect | Parent Agent | Child Agent ||--------|-------------|-------------|diff --git a/docs-internal/claude_code_agent.md b/docs-internal/claude_code_agent.mdindex d52736ab..d436b469 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-extensionstream-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 immutable V1 graphs — `services/cli_agent/service.py:354-358`)+legacy `simpleMemory.node_id` on `input-memory` graphs — `services/cli_agent/service.py:354-358`)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 on a stable`cwd=repo_root`. Connected tools and skills reach claude through an MCP bridge; the spawndiff --git a/docs-internal/claude_code_interactive_mode.md b/docs-internal/claude_code_interactive_mode.mdindex 848534d1..e86c95bf 100644--- a/docs-internal/claude_code_interactive_mode.md+++ b/docs-internal/claude_code_interactive_mode.md@@ -2,7 +2,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 immutable V1+> 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> own VSCode extension uses — stdio pipes, `--output-format stream-json> --input-format stream-json --verbose --ide`. Multi-turn happens bydiff --git a/docs-internal/cli_agent_framework.md b/docs-internal/cli_agent_framework.mdindex cac7bd09..188d8a8e 100644--- a/docs-internal/cli_agent_framework.md+++ b/docs-internal/cli_agent_framework.md@@ -426,10 +426,10 @@ intentionally NOT emitted in interactive mode — claude rejects it.```ClaudeCodeAgentNode.execute_op (__init__.py:291-330)├─ collect_agent_connections() → context_data (first tuple element)- │ ├─ V2 graphs: a Context descriptor (kind == "context") → context_v2,+ │ ├─ Context node wired: a Context descriptor (kind == "context") → context_descriptor,│ │ handed to AICliService as connected_context and bridged through│ │ SpecializedAgentContextBridge; memory_data stays None- │ └─ immutable V1 snapshots: the legacy Memory descriptor → memory_data+ │ └─ 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)@@ -441,7 +441,7 @@ ClaudeCodeAgentNode.execute_op (__init__.py:291-330)(service.py:343-358 — use_pool = claude AND one task AND(connected_memory OR a Context bridge)):├─ pool.acquire(session_key, spec, cwd=repo_root, env, ...)- │ session_key = context_bridge.pool_key on V2 graphs (the+ │ session_key = context_bridge.pool_key when a Context node is wired (the│ RFC-0002 conversation key, so a Reset's generation bump│ fences the warm subprocess), else the legacy│ connected_memory["node_id"]diff --git a/docs-internal/node-logic-flows/specialized_agents/vertex_managed_agent.md b/docs-internal/node-logic-flows/specialized_agents/vertex_managed_agent.mdindex ee889618..aef19a53 100644--- a/docs-internal/node-logic-flows/specialized_agents/vertex_managed_agent.md+++ b/docs-internal/node-logic-flows/specialized_agents/vertex_managed_agent.md@@ -23,8 +23,8 @@ glow exactly as they do for the local agent loop) and answered withusage (sandbox commands, `google_search`, `url_context`, `code_execution`,MCP tools) is surfaced live as dynamic [`vertexCloudTool`](./vertexCloudTool.md)canvas nodes via the workflow-ops protocol. Conversation continuity is the-Context store on V2 graphs (transcript rendered into the prompt); immutable-V1 generations keep the recorded Simple Memory chain-id bridge+Context store when a Context node is wired (transcript rendered into the+prompt); legacy `input-memory` graphs keep the recorded Simple Memory chain-id bridge(`vertex_interaction_id` / `vertex_environment_id`).## Inputs (handles)@@ -41,7 +41,7 @@ V1 generations keep the recorded Simple Memory chain-id bridge| `input-tools` (bottom 75%) | tools | no | Tool nodes -> Interactions `function` declarations (ToolNodes, agents for delegation, `usable_as_tool` ActionNodes; display-only types such as `vertexCloudTool` are skipped) || `output-main` (right), `output-top` (top) | main | - | Result payload below |-Legacy `input-memory` edges (immutable V1 generations) still surface as+Legacy `input-memory` edges still surface as`context_data` that is not a Context descriptor; the plugin treats that as`memory_data` and reads/writes chain ids on the `simpleMemory` node'sparameters.@@ -180,7 +180,7 @@ flowchart TD- **Skills and task input are silently ignored**: `collect_agent_connections` returns a 5-tuple and this plugin unpacks `context_data, _, tool_data, input_data, _` — `input-skill` and `input-task` edges are accepted by the handles but contribute nothing. `STD_AGENT_HINTS.hasSkills` is therefore cosmetic for this node.- **Provider fallback trap**: `_inject_api_keys` calls `detect_ai_provider(node_type, params)`, which reads `parameters.provider`; saved params that predate the Literal field fall back to `openai`, the injected key fails the `AIza`/`AQ.` prefix check, and the run raises the "need a project id or AIza key" `NodeUserError` even though a gemini key is stored.-- **Sandbox continuity differs by graph generation**: the skill doc promises 7-day sandbox/conversation persistence "when a simpleMemory node is connected"; on V2 graphs the standard handles carry no `input-memory` and Context-bound runs start a fresh remote interaction every firing, so only the stored transcript persists — installed packages / created files in the cloud sandbox do not.+- **Sandbox continuity differs by graph generation**: the skill doc promises 7-day sandbox/conversation persistence "when a simpleMemory node is connected"; the standard handles carry no `input-memory` and Context-bound runs start a fresh remote interaction every firing, so only the stored transcript persists — installed packages / created files in the cloud sandbox do not.- The `cost={"service": "vertex_agent", "action": "interact"}` on `@Operation` is inert metadata (nothing in `services/` reads `OperationSpec.cost`); the usage row is written manually with `cost: 0.0` — tokens are billed by Google and not priced here.- `max_turns` counts the initial turn: `max_turns=1` never answers a `requires_action`.- Undeclared cloud-side `function_call` names stop the loop with a warning rather than an error; the payload then reports `status: requires_action` and node status `warning`.diff --git a/docs-internal/rlm_service.md b/docs-internal/rlm_service.mdindex fbadfb75..5808a59b 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 V1 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](./memory_lifecycle.md) describes only the retired markdown memory path.## Overview@@ -208,11 +208,12 @@ preparation helpers, then delegates to the independent RLM service:context_data, skill_data, tool_data, input_data, task_data = await collect_agent_connections(node_id, ctx.raw, database, log_prefix="[RLM Agent]")-# The first element is a Context descriptor on V2 graphs (kind == "context"),-# or the legacy Memory descriptor on immutable V1 snapshots. The service-# receives them as separate kwargs: context_data=context_v2, memory_data=legacy.-context_v2 = context_data if (context_data or {}).get("kind") == "context" else None-memory_data = context_data if context_data and not context_v2 else None+# The first element is a Context descriptor (kind == "context") when a+# Context node is wired, or the legacy Memory descriptor on input-memory+# graphs. The service receives them as separate kwargs:+# context_data=context_descriptor, memory_data=legacy.+context_descriptor = context_data if (context_data or {}).get("kind") == "context" else None+memory_data = context_data if context_data and not context_descriptor else None# 2. Inject task context and strip tools for terminal task notificationsif task_data:diff --git a/docs-internal/tool_building_pipeline.md b/docs-internal/tool_building_pipeline.mdindex d21de0f5..ace70f8e 100644--- a/docs-internal/tool_building_pipeline.md+++ b/docs-internal/tool_building_pipeline.md@@ -45,7 +45,7 @@ Replaces the partial explanations previously scattered across```(`edge_walker.py:181-199` — the first element is the Context descriptor from-`input-context`, or the legacy Memory descriptor on immutable V1 snapshots.)+`input-context`, or the legacy Memory descriptor on `input-memory` graphs.)- **`tool_data`** is a list of dicts. Each entry: `{node_id, node_type, parameters, label}`. (The `connected_services` extra belonged to the retired `androidTool` gateway tool — see §7.)- **MasterSkill expansion** runs at discovery time: a single `masterSkill` connection with `skillsConfig` expands into N individual skill entries, one per enabled skill key.diff --git a/server/constants.py b/server/constants.pyindex 64f3e23e..c017e51d 100644--- a/server/constants.py+++ b/server/constants.py@@ -54,8 +54,8 @@ AI_AGENT_TYPES: FrozenSet[str] = frozenset(AI_MEMORY_TYPES: FrozenSet[str] = frozenset([- # V2 exposes this node through input-tools, while immutable V1- # generations still recognize their recorded input-memory topology.+ # Exposed through input-tools; legacy graphs recorded before the+ # Context node still carry their input-memory topology."simpleMemory",])@@ -95,7 +95,7 @@ AI_MODEL_TYPES: FrozenSet[str] = AI_AGENT_TYPES | AI_CHAT_MODEL_TYPES# They don't execute independently - they're used by their parent nodes.CONFIG_NODE_TYPES: FrozenSet[str] = (AI_CONTEXT_TYPES # Context nodes (connect to input-context)- | AI_MEMORY_TYPES # Legacy V1 memory / V2 Memory tool config nodes+ | AI_MEMORY_TYPES # Memory tool config nodes (legacy input-memory or input-tools)| AI_TOOL_TYPES # Tool nodes (connect to AI Agent's input-tools)| AI_CHAT_MODEL_TYPES # Model config nodes (connect to input-model)| SKILL_NODE_TYPES # Skill nodes (connect to Zeenie's input-skill)diff --git a/server/nodes/agent/claude_code_agent/__init__.py b/server/nodes/agent/claude_code_agent/__init__.pyindex 6b495445..30412b2b 100644--- a/server/nodes/agent/claude_code_agent/__init__.py+++ b/server/nodes/agent/claude_code_agent/__init__.py@@ -296,9 +296,9 @@ class ClaudeCodeAgentNode(ActionNode):)connected_skills = [s.get("skill_name") or s.get("label") for s in skill_data if s.get("skill_name") or s.get("label")]- # Immutable V1 Memory bridge: claude maintains its own session JSONL+ # Legacy input-memory bridge: claude maintains its own session JSONL# under `<CLAUDE_CONFIG_DIR>/projects/<cwd-encoded>/<UUID>.jsonl`.- # Context V2 resolution, explicit UUID resume, raw-event journalling,+ # Context resolution, explicit UUID resume, raw-event journalling,# and binding persistence live in AICliService.# The project_key is derived from cwd (`[^a-zA-Z0-9-] -> -`),# so memory continuity needs only a STABLE cwd across runs.@@ -318,8 +318,8 @@ class ClaudeCodeAgentNode(ActionNode):# ``_persist_memory`` when claude reports it as not found.from services.cli_agent.context_bridge import is_context- context_v2 = context_data if is_context(context_data) else None- memory_data = context_data if context_data and not context_v2 else None+ context_descriptor = context_data if is_context(context_data) else None+ memory_data = context_data if context_data and not context_descriptor else Noneresume_session_id = (memory_data or {}).get("last_session_id") or Noneif memory_data:logger.info(@@ -408,7 +408,7 @@ class ClaudeCodeAgentNode(ActionNode):connected_skill_descriptors=skill_data,connected_tools=tool_data,connected_memory=memory_data,- connected_context=context_v2,+ connected_context=context_descriptor,execution_id=ctx.execution_id,allowed_credentials=params.allowed_credentials,max_parallel=params.max_parallel,@@ -440,7 +440,7 @@ class ClaudeCodeAgentNode(ActionNode):task_models = [session_result_to_model(t).model_dump() for t in result.tasks]- if context_v2 is not None:+ if context_descriptor is not None:for task_model in task_models:task_model["session_id"] = None@@ -452,7 +452,7 @@ class ClaudeCodeAgentNode(ActionNode):legacy_response = result.tasks[0].responselegacy_session_id = (result.tasks[0].session_id- if context_v2 is None+ if context_descriptor is Noneelse None)legacy_cost = result.tasks[0].cost_usddiff --git a/server/nodes/agent/claude_code_agent/_pool.py b/server/nodes/agent/claude_code_agent/_pool.pyindex 4dbeaac4..55003437 100644--- a/server/nodes/agent/claude_code_agent/_pool.py+++ b/server/nodes/agent/claude_code_agent/_pool.py@@ -2,7 +2,7 @@Keeps one warm ``claude --output-format stream-json --input-formatstream-json --verbose --ide`` subprocess per Context thread+epoch (or per-``simpleMemory.node_id`` for immutable V1 generations) so successive turns+``simpleMemory.node_id`` for legacy ``input-memory`` graphs) so successive turnscan reuse the same process — same session UUID across turns, no respawn cost.Mirrors what Anthropic's officialVSCode extension does (verified from the on-disk extension source atdiff --git a/server/nodes/agent/rlm_agent/__init__.py b/server/nodes/agent/rlm_agent/__init__.pyindex 6a08b8b1..cf5cea2e 100644--- a/server/nodes/agent/rlm_agent/__init__.py+++ b/server/nodes/agent/rlm_agent/__init__.py@@ -64,12 +64,12 @@ class RLMAgentNode(ActionNode):database,log_prefix="[RLM Agent]",)- context_v2 = (+ context_descriptor = (context_dataif (context_data or {}).get("kind") == "context"else None)- memory_data = context_data if context_data and not context_v2 else None+ memory_data = context_data if context_data and not context_descriptor else None# 2. Inject task-completion context into the prompt.if task_data:@@ -101,7 +101,7 @@ class RLMAgentNode(ActionNode):node_id,payload,memory_data=memory_data,- context_data=context_v2,+ context_data=context_descriptor,skill_data=skill_data if skill_data else None,tool_data=tool_data if tool_data else None,broadcaster=get_status_broadcaster(),diff --git a/server/nodes/agent/vertex_managed_agent/__init__.py b/server/nodes/agent/vertex_managed_agent/__init__.pyindex 17eacdb3..ace7e8ff 100644--- a/server/nodes/agent/vertex_managed_agent/__init__.py+++ b/server/nodes/agent/vertex_managed_agent/__init__.py@@ -10,8 +10,8 @@ Interactions API and bridges the OpenCompany canvas into it:the local aiAgent loop), then answered via ``function_result`` inputson a chained follow-up create.- Conversation + sandbox continuity lives in the backend Context store as an- opaque interaction/environment provider binding. Immutable V1 generations- retain their recorded Simple Memory parameter bridge.+ opaque interaction/environment provider binding. Legacy ``input-memory``+ graphs retain their recorded Simple Memory parameter bridge.- Cloud-side tool usage (sandbox commands, google_search, ...) issurfaced LIVE as dynamic ``vertexCloudTool`` canvas nodes via theworkflow-ops protocol (agentBuilder pattern) — see ``_ops.py``: eachdiff --git a/server/services/ai.py b/server/services/ai.pyindex dbd63bed..ee551342 100644--- a/server/services/ai.py+++ b/server/services/ai.py@@ -976,7 +976,7 @@ class AIService:if context_runtime is not None:# Simple Memory is an explicit tool when a Context node is# connected; legacy automatic recall/persistence remains only- # for immutable V1 snapshots.+ # for graphs recorded with an input-memory edge.memory_data = None# Build initial messages for state. The SystemMessage isdiff --git a/server/services/cli_agent/context_bridge.py b/server/services/cli_agent/context_bridge.pyindex 50c91977..efa3e236 100644--- a/server/services/cli_agent/context_bridge.py+++ b/server/services/cli_agent/context_bridge.py@@ -7,7 +7,7 @@ the stored conversation for ``(workflow_id, generation, agent_node_id)`` atrun start, render it into the prompt, and save the exchange back per turn.The bridge is intentionally absent for legacy ``input-memory`` descriptors so-already-recorded V1 generations retain their original Simple Memory behavior.+graphs recorded with that edge retain their original Simple Memory behavior."""from __future__ import annotationsdiff --git a/server/services/cli_agent/session.py b/server/services/cli_agent/session.pyindex f9c04fb9..cf3fcafc 100644--- a/server/services/cli_agent/session.py+++ b/server/services/cli_agent/session.py@@ -143,7 +143,7 @@ class AICliSession(BaseProcessSupervisor):# incompatible with this — every spawn would land under a# brand-new project_key with no prior JSONL.self._memory_bound: bool = bool(memory_bound)- # Backend Context V2 raw-event sink. It receives each decoded+ # Backend Context raw-event sink. It receives each decoded# provider event before UI logging and before result presentation# truncates the assistant text to 4,000 characters.self._context_event_sink = context_event_sinkdiff --git a/server/services/deployment/handlers.py b/server/services/deployment/handlers.pyindex 3ed8b03b..390967f8 100644--- a/server/services/deployment/handlers.py+++ b/server/services/deployment/handlers.py@@ -1383,7 +1383,7 @@ async def _rearm_generation(control) -> None:"nodes": nodes,"edges": edges,"generation": control.generation,- # Snapshots created before Context V2 deliberately retain version 0,+ # Snapshots created before the Context topology deliberately retain version 0,# so a process restart cannot mutate their Temporal command sequence."graphVersion": int(snapshot.get("graphVersion")diff --git a/server/services/deployment/state.py b/server/services/deployment/state.pyindex fe3d4560..8ef79aa8 100644--- a/server/services/deployment/state.py+++ b/server/services/deployment/state.py@@ -16,9 +16,9 @@ class DeploymentState:edges: List[Dict]session_id: struser_id: str = "owner"- # Context V2 cutover metadata. Both must be present for- # MachinaWorkflow to select AgentWorkflowV2; legacy/uncontrolled- # deployments leave them at zero and retain AgentWorkflow V1.+ # Conversation scope. Both must be present for MachinaWorkflow to+ # stamp a Context generation on node activities; legacy/uncontrolled+ # deployments leave them at zero and run without a Context store.graph_version: int = 0generation: int = 0# Human-readable slug resolved from DB at deploy time. Used todiff --git a/server/services/execution/executor.py b/server/services/execution/executor.pyindex b7caa737..6d68bea4 100644--- a/server/services/execution/executor.py+++ b/server/services/execution/executor.py@@ -763,7 +763,7 @@ class WorkflowExecutor:if target in ai_agent_node_ids and source and target_handle:if target_handle in ("input-context",- "input-memory", # immutable V1 snapshot compatibility+ "input-memory", # legacy input-memory graph compatibility"input-tools","input-skill","input-teammates",diff --git a/server/services/execution/models.py b/server/services/execution/models.pyindex f3d0f8e7..df086ebe 100644--- a/server/services/execution/models.py+++ b/server/services/execution/models.py@@ -353,7 +353,7 @@ class ExecutionContext:if target in ai_agent_node_ids and source and target_handle:if target_handle in ("input-context",- "input-memory", # immutable V1 snapshot compatibility+ "input-memory", # legacy input-memory graph compatibility"input-tools","input-skill","input-teammates",diff --git a/server/services/plugin/edge_walker.py b/server/services/plugin/edge_walker.pyindex 21f39c85..acc90de2 100644--- a/server/services/plugin/edge_walker.py+++ b/server/services/plugin/edge_walker.py@@ -194,8 +194,8 @@ async def collect_agent_connections(needs from its connected nodes.Returns ``(context, skills, tools, input, task)``. The first item is an- Agent Context reference/policy descriptor for V2 graphs; immutable V1- snapshots may still yield their legacy Memory descriptor.+ Agent Context reference/policy descriptor; legacy ``input-memory``+ graphs may still yield their recorded Memory descriptor.docstring for behaviour notes."""nodes = context.get("nodes")@@ -253,7 +253,7 @@ async def collect_agent_connections(if built:context_data = builtelif target_handle == "input-memory":- # Immutable V1 workflow snapshots retain their recorded behavior.+ # Legacy input-memory graphs retain their recorded behavior.if source_node.get("type") == "simpleMemory":context_data = await _build_memory_entry(node_id,diff --git a/server/services/temporal/executor.py b/server/services/temporal/executor.pyindex 6faff253..047badf2 100644--- a/server/services/temporal/executor.py+++ b/server/services/temporal/executor.py@@ -94,8 +94,8 @@ class TemporalExecutor:workflow_slug: Human-readable slug used in the Temporal Web UIlisting prefix. Optional — falls back to ``"workflow"`` forone-off Runs without a saved DB row.- graph_version: Normalized graph version for Context V2- generation: Durable workflow-control generation for Context V2+ graph_version: Normalized graph version for the Context topology+ generation: Durable workflow-control generation for the Context storeuser_id: Authenticated server-owned user identityReturns:diff --git a/server/services/temporal/workflow.py b/server/services/temporal/workflow.pyindex 090835bd..1517eb5f 100644--- a/server/services/temporal/workflow.py+++ b/server/services/temporal/workflow.py@@ -43,7 +43,7 @@ CONDITIONAL_EDGES_PATCH = "machina-conditional-edges-v1"CONFIG_HANDLES = {"input-context","input-tools",- "input-memory", # replay/import compatibility for V1 graph snapshots+ "input-memory", # replay/import compatibility for legacy input-memory graphs"input-model","input-skill","input-task",@@ -557,7 +557,7 @@ class MachinaWorkflow:node_type,graph_version=graph_version,generation=generation,- context_v2_enabled=(+ context_enabled=(graph_version >= AGENT_CONTEXT_GRAPH_VERSIONand generation > 0),@@ -695,7 +695,7 @@ class MachinaWorkflow:*,graph_version: int = 0,generation: int = 0,- context_v2_enabled: bool = False,+ context_enabled: bool = False,routing_snapshot: Optional[Dict[str, Any]] = None,) -> Dict[str, Any]:"""Resolve dispatch kind for a node type.diff --git a/server/services/workflow_migrations.py b/server/services/workflow_migrations.pyindex 3cf0fa8d..8daf4f3f 100644--- a/server/services/workflow_migrations.py+++ b/server/services/workflow_migrations.py@@ -177,7 +177,7 @@ def normalize_workflow_graph(*,canonicalize_ids: bool = True,) -> WorkflowGraphNormalization:- """Normalize a graph to Context V2.+ """Normalize a graph to the Context topology.The transform is idempotent and preserves unknown edges for validation.It performs the following ordered stages:diff --git a/server/services/workflow_storage/handlers.py b/server/services/workflow_storage/handlers.pyindex cca3e781..bed78465 100644--- a/server/services/workflow_storage/handlers.py+++ b/server/services/workflow_storage/handlers.py@@ -42,7 +42,7 @@ async def _context_topology_errors(edges: list[Dict[str, Any]],parameters_by_id: Dict[str, Dict[str, Any]],) -> list[Dict[str, Any]]:- """Run the shared validator and retain only Context V2 invariants."""+ """Run the shared validator and retain only Context invariants."""from services.workflow_validator import validate_workflowdiff --git a/server/services/workflow_validator.py b/server/services/workflow_validator.pyindex f5dfde23..50d58cf8 100644--- a/server/services/workflow_validator.py+++ b/server/services/workflow_validator.py@@ -113,7 +113,7 @@ async def validate_workflow(})- # Context V2 topology. These checks are capability-driven: renderer+ # Context topology. These checks are capability-driven: renderer# component kinds and legacy AI_AGENT_TYPES are intentionally not used.valid_contexts_by_agent: Dict[str, List[str]] = {}agents_by_context: Dict[str, List[str]] = {}diff --git a/server/tests/nodes/test_specialized_context_bridges.py b/server/tests/nodes/test_specialized_context_bridges.pyindex 731328b2..fb2b6a5e 100644--- a/server/tests/nodes/test_specialized_context_bridges.py+++ b/server/tests/nodes/test_specialized_context_bridges.py@@ -1,4 +1,4 @@-"""Thin-node wiring tests for specialized Context V2 backends."""+"""Thin-node wiring tests for specialized Context backends."""from __future__ import annotationsdiff --git a/server/tests/temporal/test_agent_workflow_dispatch.py b/server/tests/temporal/test_agent_workflow_dispatch.pyindex 278efa3f..8b62eaaa 100644--- a/server/tests/temporal/test_agent_workflow_dispatch.py+++ b/server/tests/temporal/test_agent_workflow_dispatch.py@@ -20,31 +20,31 @@ def _settings(*, enabled: bool = True):)-def test_new_generation_routes_to_v2_but_missing_metadata_stays_v1():+def test_admitted_generation_routes_to_child_workflow_but_missing_metadata_stays_activity():from services.temporal.workflow import MachinaWorkflowinstance = MachinaWorkflow()with patch("core.config.Settings", side_effect=lambda: _settings()):- v2 = instance._resolve_dispatch(+ admitted = instance._resolve_dispatch("aiAgent",graph_version=2,generation=4,- context_v2_enabled=True,+ context_enabled=True,)missing_generation = instance._resolve_dispatch("aiAgent",graph_version=2,generation=0,- context_v2_enabled=True,+ context_enabled=True,)missing_version = instance._resolve_dispatch("aiAgent",graph_version=0,generation=4,- context_v2_enabled=True,+ context_enabled=True,)- assert v2 == {+ assert admitted == {"kind": "child_workflow","name": "AgentWorkflow",}diff --git a/server/tests/temporal/test_frozen_routing.py b/server/tests/temporal/test_frozen_routing.pyindex 0a265b46..dcc71db3 100644--- a/server/tests/temporal/test_frozen_routing.py+++ b/server/tests/temporal/test_frozen_routing.py@@ -140,14 +140,14 @@ def test_frozen_dispatch_never_reads_mutable_settings():}-def test_frozen_agent_dispatch_selects_context_v2_protocol():+def test_frozen_agent_dispatch_selects_context_protocol():from services.temporal.workflow import MachinaWorkflowdispatch = MachinaWorkflow()._resolve_dispatch("aiAgent",graph_version=2,generation=3,- context_v2_enabled=True,+ context_enabled=True,routing_snapshot={"version": 1,"agent_workflow_enabled": True,