Skip to content

Conversation

@imarshallwidjaja
Copy link
Contributor

@imarshallwidjaja imarshallwidjaja commented Jan 11, 2026

Summary

Add workdir parameter to sisyphus_task tool to constrain spawned agents to specific directories. Enables orchestrators to delegate work to git worktrees or project subdirectories with strict boundary enforcement. This allows users to orchestrate in parallel with worktrees being enforced without files being created or edited outside of the tree and having to be fixed after-the-fact.

Changes

  • Added workdir parameter to SisyphusTaskArgs interface and tool schema (optional string)
  • Validation logic: Requires absolute paths, validates path exists and is a directory, returns clear error messages
  • System content injection: Extended buildSystemContent() to include <Workdir_Context> block in system content for sync/background tasks
  • Resume support: Created buildPromptWithWorkdir() helper to prepend workdir context to resume prompts
  • Documentation: Updated SISYPHUS_TASK_DESCRIPTION and tool schema with workdir usage and requirements
  • Tests: Added 29 tests covering validation (absolute path, existence, directory check), injection (sync/background/resume), and integration with skills/categories

Note: the workdir supports Windows-absolute paths when the plugin runs on Windows (and intentionally rejects Windows-style paths on non-Windows where they can’t resolve), so this isn’t an issue in practice I believe.

Testing

bun run typecheck
bun test src/tools/sisyphus-task/tools.test.ts

All 29 tests pass.

Manual Validation

Prompt for agent:

Test the workdir functionality comprehensively:

1. Create a test directory at /tmp/test-workdir-validation and add a few files to it.

2. Spawn a sync task using sisyphus_task with:
   - category="general", run_in_background=false, skills=[]
   - workdir="/tmp/test-workdir-validation"
   - prompt asking the agent to create a new file called "test-created.txt" in the current directory
   
   Verify: File is created in /tmp/test-workdir-validation/test-created.txt, not in the orchestrator's directory.
   Check: Spawned agent's system content contains <Workdir_Context> with the correct path.

3. Spawn a background task with workdir="/tmp/test-workdir-validation" and a prompt to list all files.
   After completion, use background_output() to retrieve results.
   
   Verify: Output shows files from the workdir, not orchestrator's directory.

4. Test validation errors:
   - Try workdir="./relative/path" → should error (absolute path required)
   - Try workdir="/nonexistent/path" → should error (path doesn't exist)
   - Create a file at /tmp/testfile.txt, try workdir="/tmp/testfile.txt" → should error (must be directory)

5. Test workdir with skills and categories:
   - Use category="visual-engineering", skills=["frontend-ui-ux"], workdir="/tmp/test-workdir-validation"
   - Verify system content includes skill content, category prompt, and workdir context properly formatted

Expected results:

  • Sync tasks operate within specified workdir
  • Background tasks respect workdir constraint
  • Validation errors are clear and informative
  • Workdir context properly integrates with skills and categories
  • All file operations occur within workdir boundaries
  • View subagent and see its is properly identifying the workdir

Related Issues


Summary by cubic

Adds an optional workdir parameter to sisyphus_task to confine spawned agents to a specific directory. This enforces project/worktree boundaries for sync, background, and resume flows, preventing file changes outside the target.

  • New Features
    • Added workdir to SisyphusTaskArgs and tool schema (optional string).
    • Validates absolute path, existence, and directory type with clear errors.
    • Injects a <Workdir_Context> block into system content (sync/background) and prepends it to resume prompts.
    • Works alongside skills and category prompts without duplication.
    • Updated tool description and constants; added 29 tests for validation, injection, and integration.

Written for commit 8d1efb7. Summary will update on new commits.

Add optional `workdir` parameter that injects strict directory constraints
into spawned agents' system content. Validates absolute paths, existence,
and directory type. Enables orchestrators to delegate work to specific
git worktrees or project subdirectories.

- Validation: absolute path, exists, is directory
- Injection: system content (sync/background) or prompt prepend (resume)
- Documentation: updated tool description and schema
- Tests: validation, injection, and combination scenarios
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant