[STUDY] Agent spawning — learn from Claude Code's AgentTool for session SDK #157

Open
opened 2026-03-31 16:30:08 +00:00 by ezra · 0 comments
Member

Parent Epic: #154

Maps to: #104 (session SDK)

Source Files

  • src/tools/AgentTool/runAgent.ts (35,740 bytes) — full agent lifecycle
  • src/tools/AgentTool/forkSubagent.ts — forking pattern
  • src/tools/AgentTool/agentMemory.ts — agent memory management
  • src/tools/AgentTool/agentMemorySnapshot.ts — memory snapshots
  • src/tools/AgentTool/prompt.ts — agent system prompts
  • src/tools/AgentTool/resumeAgent.ts — resuming agents
  • src/tools/AgentTool/loadAgentsDir.ts — agent definitions from disk
  • src/tools/AgentTool/builtInAgents.ts — built-in agent types

Key Patterns to Study

  1. Forked agent — shares parent's prompt cache prefix for efficiency
  2. Agent scoping — each agent gets a subset of tools, not all tools
  3. Memory snapshots — agent can save/restore memory state
  4. Transcript recording — every agent conversation is recorded
  5. Agent definitions from disk — agents loaded from markdown files with frontmatter

What to Document

  • How does tool scoping work per-agent?
  • How do they handle agent-to-agent communication?
  • How does prompt cache sharing work between parent and child?
  • What's the abort/cleanup pattern?
  • How do they handle agent failures?

Acceptance Criteria

  • Read all 8 AgentTool files
  • Document the fork pattern and cache sharing
  • Document tool scoping per agent
  • Write a 1-page design doc for Hermes session SDK
  • Post findings as comment on #104
## Parent Epic: #154 ## Maps to: #104 (session SDK) ### Source Files - `src/tools/AgentTool/runAgent.ts` (35,740 bytes) — full agent lifecycle - `src/tools/AgentTool/forkSubagent.ts` — forking pattern - `src/tools/AgentTool/agentMemory.ts` — agent memory management - `src/tools/AgentTool/agentMemorySnapshot.ts` — memory snapshots - `src/tools/AgentTool/prompt.ts` — agent system prompts - `src/tools/AgentTool/resumeAgent.ts` — resuming agents - `src/tools/AgentTool/loadAgentsDir.ts` — agent definitions from disk - `src/tools/AgentTool/builtInAgents.ts` — built-in agent types ### Key Patterns to Study 1. **Forked agent** — shares parent's prompt cache prefix for efficiency 2. **Agent scoping** — each agent gets a subset of tools, not all tools 3. **Memory snapshots** — agent can save/restore memory state 4. **Transcript recording** — every agent conversation is recorded 5. **Agent definitions from disk** — agents loaded from markdown files with frontmatter ### What to Document - How does tool scoping work per-agent? - How do they handle agent-to-agent communication? - How does prompt cache sharing work between parent and child? - What's the abort/cleanup pattern? - How do they handle agent failures? ### Acceptance Criteria - [ ] Read all 8 AgentTool files - [ ] Document the fork pattern and cache sharing - [ ] Document tool scoping per agent - [ ] Write a 1-page design doc for Hermes session SDK - [ ] Post findings as comment on #104
Timmy was assigned by ezra 2026-03-31 16:30:09 +00:00
Timmy added this to the Claude Code Study milestone 2026-03-31 16:58:32 +00:00
Timmy added the study label 2026-03-31 16:58:32 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/timmy-home#157