subagent tool: remember dir per session name so continue/status don't need to repeat it

This commit is contained in:
damocles 2026-09-11 21:49:44 +02:00
commit aa27334d76
2 changed files with 92 additions and 16 deletions

View file

@ -40,10 +40,12 @@ struct StartArgs {
/// Working directory for the subagent's session — e.g. a git worktree
/// you've already prepared for it, so a parallel batch of subagents
/// never race on the same working tree. Must exist. Omit to inherit
/// this daemon's own working directory (today's default). Claude
/// derives its per-project session storage from this path, so
/// `continue`/`status` against this name must pass this exact same
/// `dir` again to find the session — see those tools' own docs.
/// this daemon's own working directory (today's default). The daemon
/// remembers whichever `dir` you give here against `name`, so a later
/// `continue`/`status` for the same name doesn't need to repeat it —
/// only pass it there again if you want to point at a *different*
/// directory. Forgotten on a daemon restart, same as everything else
/// this daemon tracks in memory.
#[serde(default)]
dir: Option<String>,
}
@ -62,10 +64,9 @@ struct ContinueArgs {
/// default — this does not have to match whatever model `start` used.
#[serde(default)]
model: Option<String>,
/// The same `dir` given at `start`, if any — sessions are stored keyed
/// by directory, so a different (or omitted) `dir` here looks in the
/// wrong place and reports no session found under `name` even though
/// one exists.
/// Omit to reuse whatever `dir` `start` (or a prior `continue`) used for
/// this name — the daemon remembers it. Only pass this to point the
/// session at a *different* directory than last time.
#[serde(default)]
dir: Option<String>,
}
@ -74,8 +75,11 @@ struct ContinueArgs {
struct StatusArgs {
/// The subagent name to check.
name: String,
/// The same `dir` given at `start`, if any — see `continue`'s `dir` doc
/// for why this has to match.
/// Omit to use whatever `dir` was last remembered for this name (see
/// `start`'s `dir` doc) — you only need this if nothing's running or
/// reserved for `name` right now (the common "is it running" case never
/// even looks at it) *and* you want to check a different directory's
/// session than the one last remembered.
#[serde(default)]
dir: Option<String>,
}