Skip to content

Allow Grok plan.md writes when home is the workspace#11

Merged
phuryn merged 1 commit into
phuryn:mainfrom
shugav:fix/allow-plan-file-in-home-workspace
May 30, 2026
Merged

Allow Grok plan.md writes when home is the workspace#11
phuryn merged 1 commit into
phuryn:mainfrom
shugav:fix/allow-plan-file-in-home-workspace

Conversation

@shugav

@shugav shugav commented May 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #10.

Summary

Plan mode should allow and snoop Grok's own .grok/sessions/.../plan.md writes, but v1.2.2 can still block them when the VS Code workspace root is the user's home directory. In that layout, the plan file is both:

  • recognized as Grok's plan file, and
  • inside the workspace containment root

This updates the write gate so plan-file writes are exempted before workspace containment is applied, but only when the path is under the resolved Grok home (~/.grok). That keeps normal workspace writes blocked and avoids treating an arbitrary project-local .grok/sessions/.../plan.md as Grok's own session file.

Verification

  • Added a regression test covering both POSIX home workspace and Windows home workspace layouts.
  • Added a guard test that a project-local .grok/sessions/.../plan.md remains blocked when it is not under the resolved Grok home.
  • Verified the home-workspace regression test fails before the source fix.
  • npm test -- --run test/plan-gate.test.ts test/acp-integration.test.ts (49 tests)
  • npm run compile
  • git diff --check
  • npm test (223 tests)
  • npm run package

Local confirmation

After installing the patched VSIX locally, the exact observed path now evaluates correctly:

isPlanFileWrite('/home/shugav/.grok/sessions/%2Fhome%2Fshugav/019e7608-.../plan.md') === true
isInsideWorkspace(..., '/home/shugav') === true
shouldBlockWrite(..., {
  active: true,
  workspaceRoot: '/home/shugav',
  grokHome: '/home/shugav/.grok'
}) === false

Notes

This preserves the existing Plan mode design: normal workspace writes remain blocked while planning, but Grok's CLI-owned plan file remains allowed and snooped even when the user opens their home directory as the workspace.

@shugav shugav force-pushed the fix/allow-plan-file-in-home-workspace branch from 9a67cfb to 368246c Compare May 30, 2026 00:12
@phuryn phuryn merged commit c4f655a into phuryn:main May 30, 2026
1 check passed
@phuryn

phuryn commented May 30, 2026

Copy link
Copy Markdown
Owner

Thanks for this!

phuryn added a commit that referenced this pull request May 30, 2026
PR #11 landed the fix on top of the already-tagged v1.2.2, so the
home-as-workspace plan.md exemption sat on main as unreleased work with
no version of its own and no changelog trail. Per the repo's
contributor-credit convention, give it a 1.2.3 section thanking @shugav,
bump package.json to match, and refresh the CLAUDE.md test-count floor
(221 -> 223) for the two regression tests the PR added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Plan mode blocks Grok plan.md when home directory is the workspace

2 participants