EN 中文

seek's main agent runs your conversation in one thread. When a task needs parallel work (read 50 files at once, propose three approaches simultaneously, try a refactor in isolation), the model spawns subagents — each with its own session, its own token budget, optionally its own git worktree. Results condense into a single summary fed back to the parent.

Why it exists

Three concrete problems the parent agent can't solve on its own:

The shape

parent agent
   ├─→ subagent · explore  → read 3 directories → summary
   ├─→ subagent · plan     → draft an approach → summary
   └─→ subagent · worktree → try refactor in isolation → summary
        │
        ▼
   father reads summaries → continues conversation

LLM-facing tools

The model spawns subagents through the agent tool; worktree isolation is opt-in via enter_worktree / exit_worktree:

Tool Purpose
agentSpawn a subagent (explore / plan / general-purpose). Returns a single summary. ReadOnly-marked → multiple agent calls in one assistant turn dispatch in parallel.
enter_worktreeCreate an isolated git worktree under ~/.seek/projects/<pid>/worktrees/<id>. Subsequent edits go there, not your working tree.
exit_worktreeLeave the worktree. Disposition: discard (default; stashed to refs/seek/discarded/<ts> for accidental-recovery), keep (file stays for later inspection), merge (manual — model prints suggested commands).

User-facing surfaces

$ seek
> /agents                    # TUI panel: live + completed subagents
> /worktrees                 # TUI panel: seek-managed git worktrees

$ seek worktree list         # CLI: same data as /worktrees
$ seek worktree gc           # reap orphans from crashed sessions

Safety contracts

What lives where

Path Contents
~/.seek/projects/<pid>/sessions/<sid>/subagents/<sub-sid>/transcript.jsonlSubagent full message history — resumable via seek -resume <sub-sid>.
~/.seek/projects/<pid>/sessions/<sid>/subagents.jsonlPer-parent-session subagent index (started/completed/failed/orphaned events) — drives /agents rendering.
~/.seek/projects/<pid>/worktrees/<wt-id>/Active worktree filesystem (per git worktree add).
refs/seek/discarded/<timestamp>Git ref where exit_worktree if_dirty=discard stashes work for accidental-recovery (not in default refspec; GC'd by seek worktree gc).

Limits

📖 Full design rationale: feature-subagent.md + book chapter 21. Worktree GC + orphan recovery details in §3.8.