Skip to main content
← Back to list
01Issue
FeatureShippedExtensionsPublic
Assigneeszack

Relationships

#4406 agent-runner: run in a given working directory, and resume a claude session

Opened by illamos · 11/4/2026· Shipped 11/4/2026

Problem

run and review always run the agent in Deno.cwd() (the swamp repo), and the CLI cache path is derived from that same working directory (${workingDir}/.swamp/agent-runner/bin). That blocks the main software-factory use: a coding agent working inside a per-work-item git worktree (e.g. one made by @swamp/git ensure_worktree).

Passing a worktree as workingDir to the internal runAgent would also download the CLI into the worktree, leaving it dirty (untracked .swamp/) and downloading once per work item.

There is also no way to continue a session. runResult records sessionId, but a run stopped by a usage limit can only be restarted from a fresh context, which re-spends the tokens.

Proposed solution

On run (and ideally review):

  1. workingDir (optional): the directory the agent process runs in. Keep the CLI cache rooted at the swamp repo, independent of workingDir.
  2. additionalDirs (optional): passed through as --add-dir (the request already carries the field; the methods hard-code []).
  3. resumeSessionId (optional, claude): append --resume <id>.
  4. Optionally, mark a capacity stop (usage limit / rate limit / 429) distinctly from a failure, e.g. a tag or field, so a workflow can retry later instead of treating the work as broken.

Alternatives

We currently carry a local export const extension adding a run_in_dir method that imports agent-runner's _lib (provider registry, detectPlatform, resolveAuthKey, buildSubprocessEnv) and spawns the CLI with cwd set to the worktree. It works, but it couples to private modules and breaks on any internal refactor.

Upstream repository: https://github.com/swamp-club/swamp-extensions

Environment

  • Extension: @swamp/agent-runner@2026.10.29.1
  • swamp: 20261103.000636.0-sha.db3f6373
  • OS: darwin (aarch64)
  • Deno: 2.9.8
  • Shell: /bin/zsh
02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 7 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

11/4/2026, 9:55:15 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/4/2026, 9:32:02 PM
Editable. Press Enter to edit.

system commented 11/4/2026, 9:31:09 PM

Classified automatically when this issue was filed.

  • Source: Extensions

If you feel this classification is incorrect, add a ripple to tell us so.

zack commented 11/4/2026, 9:55:17 PM

Thanks @illamos for reporting this! We shipped: Let agent-runner run the agent in a chosen directory without polluting it, pass extra directories, resume a claude session, and mark usage-limit stops distinctly. run and review gain optional workingDir and additionalDirs arguments. The CLI cache is rooted at the swamp repo, independent of workingDir. run gains a claude-only resumeSessionId argument. runResult records workingDir. runResult and reviewResult record a capacityStop flag and tag; a capacity-stopped review is not reported as a critical failure.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.