A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
docs(coding-agent): guide completed subagent cleanup (#548)
Seth Kartenec4a03bdb52c
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.mdindex f4f210e7a6..51d3f183e1 100644--- a/packages/coding-agent/CHANGELOG.md+++ b/packages/coding-agent/CHANGELOG.md@@ -2,6 +2,7 @@## [Unreleased]+- Changed subagent guidance to retain reusable children and delete completed direct children once they are no longer needed.- Changed top-level CLI help and documentation to expose autonomous mode, quality gates, and their limits.- Fixed compaction retaining runtime resources after an explicitly deleted subagent had a transient cleanup failure.- Fixed long-running thinking timers to display hours and days instead of unbounded minutes.diff --git a/packages/coding-agent/src/core/prompts/rlm.ts b/packages/coding-agent/src/core/prompts/rlm.tsindex abcd6bed8b..db4d259c5c 100644--- a/packages/coding-agent/src/core/prompts/rlm.ts+++ b/packages/coding-agent/src/core/prompts/rlm.ts@@ -123,6 +123,7 @@ export function buildSubagentGuidance(options: { includeRefineExamples?: boolean"Default to non-blocking subagents: create an `asyncio` task, keep the handle, continue independent work, and await only at the collection point where the result is needed.","The host automatically keeps a parent-scoped subagent registry across kernel restarts, state restore, and compaction. Recover it with `children = await rlm.list_subagents()` instead of maintaining a separate registry file or relying on lost `asyncio.Task` handles.","Successful subagent sessions remain in that registry after their initial `rlm()` call finishes, but only while the current parent session remains open. Failed or cancelled children are removed, and retained children close when their parent session closes.",+ "Retain a completed direct child when it may be reused; once it is definitively no longer needed, delete it with `await rlm.delete_subagent(child)`.","Choose a child name at spawn time with `rlm('task', name='api-reviewer')`, or let the host generate a readable, unique default `session_name`. If the `agent_observe` skill is installed and a registry entry has `active_session_id`, inspect it by name with `await agent_observe.get_agent(child.session_name)` or read bounded previews with `await agent_observe.recent_messages(child.session_name, limit=...)`.","Subagents inherit the parent model. Use `model=...` only when the user or an applicable skill requests another model; call `rlm.find_models()` for a bounded authenticated shortlist and pass one returned exact `selector`. The selected model remains attached to that child across later turns.","When an `RLMResult` has a `.warning`, tell the user which `.model` actually ran instead of the requested model.",diff --git a/packages/coding-agent/test/system-prompt.test.ts b/packages/coding-agent/test/system-prompt.test.tsindex 7f35a4e716..a0016c691f 100644--- a/packages/coding-agent/test/system-prompt.test.ts+++ b/packages/coding-agent/test/system-prompt.test.ts@@ -413,6 +413,9 @@ describe("buildSystemPrompt", () => {expect(prompt).toContain("Successful subagent sessions remain in that registry");expect(prompt).toContain("current parent session remains open");expect(prompt).toContain("retained children close when their parent session closes");+ expect(prompt).toContain(+ "Retain a completed direct child when it may be reused; once it is definitively no longer needed, delete it with `await rlm.delete_subagent(child)`.",+ );expect(prompt).toContain("agent_message.send");expect(prompt).toContain("agent_message.send(child.session_name");expect(prompt).toContain("readable, unique default `session_name`");