Skip to content

feat: resolve workspace from CLAUDE_PROJECT_DIR (base-mcp + hooks)#1

Open
mh0pe wants to merge 1 commit into
ChristopherKahler:mainfrom
mh0pe:feat/workspace-project-dir
Open

feat: resolve workspace from CLAUDE_PROJECT_DIR (base-mcp + hooks)#1
mh0pe wants to merge 1 commit into
ChristopherKahler:mainfrom
mh0pe:feat/workspace-project-dir

Conversation

@mh0pe

@mh0pe mh0pe commented Jun 14, 2026

Copy link
Copy Markdown

What

base-mcp and the BASE hooks resolve their workspace root by walking up from __dirname / HOOK_DIR.parent.parent (apex-insights: 3 levels). This layers CLAUDE_PROJECT_DIR ahead of each existing default, across:

  • base-mcp WORKSPACE_PATH
  • hooks: active-hook, backlog-hook, base-pulse-check, operator, satellite-detection, psmm-injector, apex-insights

When CLAUDE_PROJECT_DIR is set it is used; otherwise the existing relative resolution is preserved exactly.

Why

Data-safety + relocatability: prevents reading/writing a .base store outside the user's project when the code is relocated. Claude Code sets CLAUDE_PROJECT_DIR.

Notes

  • Every no-env else-branch is byte-equivalent to the original (diff-verified) — no behavior change when the env is unset.
  • Adds import os where missing.

🤖 Generated with Claude Code

Prefer CLAUDE_PROJECT_DIR when set and non-blank; fall back to the
existing __dirname/HOOK_DIR relative resolution unchanged. Never throws
on missing env var. Affected: src/packages/base-mcp/index.js and all
six auto-register hooks (active, backlog, base-pulse-check, operator,
satellite-detection, psmm-injector) plus apex-insights.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mh0pe

mh0pe commented Jun 14, 2026

Copy link
Copy Markdown
Author

Related PRs — part of a coordinated cross-repo offer (CLAUDE_PROJECT_DIR workspace / data-root resolution (data-safety fix)) applied across the carl/base/paul/seed framework forks:

Reviewing them together is recommended; the same change pattern is mirrored per repo.

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