Skip to content

fix: Allow agent terminal treq CLI to create external workspaces - #222

Merged
Ziinc merged 1 commit into
mainfrom
cursor/agent-terminal-treq-cli-prompt-9606
Aug 8, 2026
Merged

fix: Allow agent terminal treq CLI to create external workspaces#222
Ziinc merged 1 commit into
mainfrom
cursor/agent-terminal-treq-cli-prompt-9606

Conversation

@Ziinc

@Ziinc Ziinc commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Update the Agent Terminal system prompt so agents may run treq CLI commands even when those commands create or manage workspaces under .treq/workspaces/ (outside the current working directory).
  • Keep direct file edits scoped to the current working directory.
  • Extract treqAgentSystemPrompt into src/lib/agentCommand.ts with unit coverage, and document the exception in agent sessions docs.

Test plan

  • Unit tests for treqAgentSystemPrompt content
  • Manually start an agent session and confirm the injected system prompt includes the treq CLI exception
  • Confirm an agent can run treq add <branch> without refusing due to path restrictions
Open in Web Open in Cursor 

The agent system prompt previously forbade all writes outside the
working directory, which blocked legitimate `treq` commands that
create workspaces under `.treq/workspaces/`. Clarify that CLI
workspace management is allowed while direct file edits stay scoped
to the current directory.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Docs now match the prompt: workspace isolation for direct edits, with an explicit exception for treq CLI workspace creation under .treq/workspaces/.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude/Codex still get escaped \n via treqSystemPromptForShell so shell-quoted single-line args match prior behavior.

  • Cursor gets real newlines in the prompt prepend path (it has no system-prompt flag)
  • No change to agent selection / permission-mode wiring; only the injected prompt text moved

Comment thread src/lib/agentCommand.ts

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Extracted from AgentTerminalPanel.tsx so the prompt text is unit-testable and shared across agents.

  • The new sentence is the product change: treq add writes under .treq/workspaces/, outside the agent CWD, and agents were refusing those commands under the old blanket rule
  • Direct file-edit scoping stays; only the CLI exception is new

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@Ziinc Ziinc changed the title Allow agent terminal treq CLI to create external workspaces fix: Allow agent terminal treq CLI to create external workspaces Aug 8, 2026
@Ziinc
Ziinc marked this pull request as ready for review August 8, 2026 20:18
@Ziinc
Ziinc merged commit 9d66627 into main Aug 8, 2026
14 of 15 checks passed
@Ziinc
Ziinc deleted the cursor/agent-terminal-treq-cli-prompt-9606 branch August 8, 2026 20:18
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.

2 participants