Skip to content

Fix workspace-aware tool execution for Cursor agents#22

Merged
Nomadcxx merged 2 commits intoNomadcxx:mainfrom
hawkff:upstream/issue-11-workspace-tool-context
Feb 12, 2026
Merged

Fix workspace-aware tool execution for Cursor agents#22
Nomadcxx merged 2 commits intoNomadcxx:mainfrom
hawkff:upstream/issue-11-workspace-tool-context

Conversation

@hawkff
Copy link
Copy Markdown
Contributor

@hawkff hawkff commented Feb 11, 2026

Fixes #11

What

  • Make plugin tool-hook execution context-aware by normalizing local tool args against session workspace (context.worktree / context.directory).
  • Resolve relative path-like arguments to absolute workspace paths before executing handlers.
  • Default bash/shell cwd to session workspace when cwd is omitted.
  • Default grep/glob/ls path to session workspace when path is omitted.
  • Add regression tests for:
    • relative write path resolution via tool context
    • bash default cwd from tool context

Why

Some Cursor agent runs infer the wrong working root and fail to write in the actual opened project when tool calls use relative paths or omit cwd/path defaults.

Grounding tool execution in session context keeps file/shell operations aligned with the active project/worktree.

Validation

  • bun test tests/unit/plugin-tools-hook.test.ts
  • bun run test:ci:unit
  • bun run test:ci:integration
  • bun run build

hawkff and others added 2 commits February 11, 2026 17:37
- normalize tool-hook args against session worktree/directory\n- resolve relative path-like args to absolute workspace paths\n- default bash/shell cwd and grep/glob/ls path to session workspace when omitted\n- add regression tests for write path resolution and bash cwd defaults
@Nomadcxx Nomadcxx merged commit 6a25eb8 into Nomadcxx:main Feb 12, 2026
2 checks passed
@Nomadcxx
Copy link
Copy Markdown
Owner

Cheers Max. PR #22 confirmed still relevant after the recent provider-boundary/schema changes, looks like it improves plugin tool-hook execution context (workspace-aware path/cwd normalization) in src/plugin.ts.

Review status:

  • Clean merge against current main only touched:

    • src/plugin.ts
    • tests/unit/plugin-tools-hook.test.ts
  • Merged to main (commit 6a25eb8).

  • Post-merge checks passed:

    • bun test tests/unit/plugin-tools-hook.test.ts
    • bun run build

@hawkff hawkff deleted the upstream/issue-11-workspace-tool-context branch February 12, 2026 11:42
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.

Cursor agents don't have write access?

2 participants