Commit 5a3749

2026-03-20 03:48:06 Claude (MCP): [mcp] docs: update session construction to match actual supervisor implementation
Minsky/Agent_IRC_Architecture.md ..
@@ 309,24 309,35 @@
#### Session construction
```python
- async def spawn_agent(role, task_id, channels, handoff_wiki_path=None):
- nick = names_pool.pop()
- options = ClaudeAgentOptions(
- append_system_prompt=build_system_prompt(
- nick=nick, role=role, channels=channels,
- handoff_wiki_path=handoff_wiki_path,
- ),
- allowed_tools=["Read", "Edit", "Bash", "Glob", "Grep",
- "mcp__irc_bridge__*", "mcp__dev_wiki__*"],
- cwd=worktree_path_for(task_id),
- mcp_servers=MCP_SERVER_CONFIGS,
+ async def spawn_em(self) -> AgentSession:
+ name = self.cfg.em_name
+ model = self.cfg.em_model
+ tracker = ContextTracker(
+ window_size=ModelTier.context_window(model),
+ threshold_pct=self.cfg.shift_threshold_pct,
)
- client = ClaudeSDKClient(options=options)
- await client.__aenter__()
- return AgentSession(nick=nick, role=role, ...)
+ session = AgentSession(
+ name=name,
+ model=model,
+ system_prompt=self._load_prompt("em"),
+ cwd=self.cfg.project_dir,
+ mcp_servers=self._mcp_servers(),
+ context_tracker=tracker,
+ )
+ self.agents[name] = ManagedAgent(session=session, task_id=None, role="em")
+ return session
```
- `build_system_prompt()` returns a string injected via `append_system_prompt` — it does not replace Claude Code's defaults, it appends to them. Content includes: agent name, role, channel assignments, and (if resuming from shift-change) a pointer to the wiki handoff page.
+ `_load_prompt(role)` reads `prompts/{role}.md` — a plain text string that gets appended to Claude Code's default system prompt via the preset+append pattern. Content includes: agent name, role description, channel assignments, workflow instructions, and decision rules.
+
+ MCP servers are configured with explicit transport types:
+ ```python
+ def _mcp_servers(self) -> dict[str, dict]:
+ return {
+ "irc-bridge": {"type": "sse", "url": self.cfg.mcp_bridge_url},
+ "dev-wiki": {"type": "sse", "url": self.cfg.wiki_mcp_url, ...},
+ }
+ ```
#### Supervisor restart recovery
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9