strukto-ai/mirage `Workspace.execute` working directory handling
Raw Developer Origin & Technical Request
GitHub Issue
May 7, 2026
## Summary
`Workspace.execute(command, options)` currently accepts `sessionId`, `agentId`, `signal`, `stdin`, `provision`, `native`, and `noHistory`, but no per-call `cwd` override. To run a command in a different working directory than the session's current `cwd`, callers have to mutate `session.cwd`, run, and restore — which is racy if two `execute()` calls overlap on the same session.
It would be very useful to support a per-call `cwd` directly:
```ts
await ws.execute('ls', { sessionId: 'agent-1', cwd: '/data' });
```
## Why this matters
Agent harnesses and orchestrators routinely need to run a command in a specific directory without permanently changing the session's `cwd`. Today the only safe pattern requires either:
1. Snapshot `session.cwd` → mutate → run → restore in `finally`. Works for serial use but breaks under any concurrency on the same session.
2. Spin up a disposable Mirage session per call, set its `cwd`, and dispose it. Works but is heavyweight, and loses any session-scoped state the caller wanted to share (env, history, function definitions).
3. Shell-prefix with `cd && cmd`. Works but is a workaround, polluting the recorded command history with `cd` noise and forcing every caller to do POSIX-safe path quoting.
A first-class `cwd` option would eliminate all three workarounds and make the API match common expectations from Node's `child_process` and similar libraries.
## Proposed shape
```ts
export interface ExecuteOptions {
// ...exi...
Developer Debate & Comments
No active discussions extracted for this entry yet.
Adjacent Repository Pain Points
Other highly discussed features and pain points extracted from strukto-ai/mirage.
Engagement Signals
Cross-Market Term Frequency
Quantifies the cross-market adoption of foundational terms like native and signal by tracking occurrence frequency across active SaaS architectures and enterprise developer debates.
SaaS Metrics