Skip to content

Fix residual .claude/PAI literals in executable code (#108)#117

Merged
virtualian merged 1 commit intomainfrom
108-two-root-separation-cleanup
Apr 14, 2026
Merged

Fix residual .claude/PAI literals in executable code (#108)#117
virtualian merged 1 commit intomainfrom
108-two-root-separation-cleanup

Conversation

@virtualian
Copy link
Copy Markdown
Owner

Summary

What changed

File Change
Releases/v4.0.3+/.claude/PAI/Tools/RebuildPAI.ts Introduce PAI_ROOT = process.env.PAI_DIR || ~/.pai; PAI_DIR now = PAI_ROOT/PAI
Releases/v4.0.3+/.claude/PAI/ACTIONS/lib/runner.v2.ts Resolve PAI_ROOT inside createLocalLLM(); dynamic import of Inference.ts uses it

Net diff: 4 insertions, 2 deletions.

Plan-vs-reality finding

Plans/2026-04-14-two-root-separation-followups.md listed 10 files for #108. 8 of those 10 were already clean on this branch — likely handled between commits #101 and #106. The remaining 2 are the ones fixed here. The OBSERVE-phase verification used:

grep -rn '~/.claude/PAI' Releases/v4.0.3+/.claude/PAI/

which returned zero hits before AND after these edits (the stale cases in the remaining 2 files used ${HOME}/.claude/PAI form without a literal ~, so they required a broader .claude/PAI grep to catch).

Out of scope — intentionally untouched

  • ~/.claude/settings.json reference at RebuildPAI.ts:21 — correct per two-root architecture; settings live in CLAUDE_CONFIG_DIR, not PAI_DIR.
  • The 102-line Algorithm-spec gap in Releases/v4.0.3+/.claude/PAI/Algorithm/v3.7.0.md — separate reconciliation problem per plan doc; explicitly not bundled.
  • 4 residual hits in Releases/v4.0.3+/.claude/skills/ — filed as issue Residual .claude/PAI literals in Releases/v4.0.3+/.claude/skills/ tree #116. Same bug class, outside plan's canonical-tree scope. Needs its own PR since fixing these likely requires parallel edits in Packs/ source-of-truth tree (sync direction to be determined).
  • Runtime (~/.claude/ and ~/.pai/) — no runtime touches per plan constraint.

Verification

  • grep -rn '\.claude/PAI' Releases/v4.0.3+/.claude/PAI/zero hits after the fix
  • bun build --target=bun Releases/v4.0.3+/.claude/PAI/Tools/RebuildPAI.ts → bundles cleanly in 6ms
  • bun build --target=bun Releases/v4.0.3+/.claude/PAI/ACTIONS/lib/runner.v2.ts → same pre-existing ajv module-resolution error as before (at types.v2.ts:164, unrelated to this PR's edit at line 32-34)
  • Settings.json reference at RebuildPAI.ts:21 unchanged
  • No changes to v3.7.0.md

Test plan

  • grep -rn '\\.claude/PAI' Releases/v4.0.3+/.claude/PAI/ returns zero hits
  • CI (if the symbol-guard added in Add CI symbol guard for critical hook files #105 includes a .claude/PAI check) passes; if no such guard exists, consider adding one in a followup
  • Manual sanity: run bun Releases/v4.0.3+/.claude/PAI/Tools/RebuildPAI.ts in an env where PAI_DIR=~/.pai is set and confirm it resolves Components/ under ~/.pai/PAI/Components/ (not ~/.claude/PAI/Components/)
  • runner.v2.ts smoke test: invoke an action that uses createLocalLLM() and confirm the Inference.ts import resolves

References

🤖 Generated with Claude Code

Two files under Releases/v4.0.3+/.claude/PAI/ still referenced the
pre-separation `.claude/PAI` path in executable code. Both now resolve
via `process.env.PAI_DIR || ~/.pai` matching the repo convention used
in Tools/algorithm.ts, Tools/FailureCapture.ts, and hooks/lib/paths.ts.

- RebuildPAI.ts:16 — introduce PAI_ROOT const; PAI_DIR now = PAI_ROOT/PAI
- runner.v2.ts:33 — resolve PAI_ROOT inside createLocalLLM()

Out of scope and intentionally untouched:
- `~/.claude/settings.json` reference in RebuildPAI.ts:21 (correct per
  two-root architecture — settings live in CLAUDE_CONFIG_DIR)
- The 102-line Algorithm-spec gap in v3.7.0.md (separate problem)
- 4 residual hits in `.claude/skills/` tree (filed as separate issue)

Per Plans/2026-04-14-two-root-separation-followups.md the plan listed
10 files but 8 were already clean on this branch between #101 and #106.

Refs #108

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@virtualian virtualian merged commit 118d975 into main Apr 14, 2026
@virtualian virtualian deleted the 108-two-root-separation-cleanup branch April 14, 2026 16:57
virtualian added a commit that referenced this pull request Apr 14, 2026
Captures three design documents that have been sitting untracked in the
working tree, making them visible in git for future sessions and making
pre-existing PR citations resolvable.

1. Plans/2026-04-14-two-root-separation-followups.md (238 lines)
   Authoritative planning doc for issues #108, #109, #110, and #115.
   Already cited by merged PRs #117, #118, #119 — committing here
   makes those citations resolve against a real file in git for the
   first time. Scopes "tonight's decision" (#108+#109 implement, #110
   and #115 defer for design) and documents the Path A/B alternatives
   for the feedback-memory-home decision that drove #118/#119.

2. Plans/2026-04-14-110-mirror-source-investigation.md (new)
   Post-#115-merge investigation answering the "where does the 178 MB
   ~/.claude/skills ↔ ~/.pai/skills mirror come from?" question left
   open by the followups doc. Path A confirmed: mirror is static; no
   installer writes to either tree; content was populated by an
   out-of-installer mechanism and has not been maintained since
   Apr 7 2026. Scopes three Option B implementation variants
   (copy-then-symlink, clone-to-PAI-root, Option-D-and-wait) with
   tradeoffs and recommends B-Plan-1 for minimum disruption.

3. Plans/eager-enchanting-snail.md (95 lines)
   Historical planning artifact from an earlier direction proposing
   ~/.claude/PAI/ → ~/data/PAI/ relocation with a new PAI_INSTALL_DIR
   env var. Superseded by #98/#101 which chose the two-root separation
   (CLAUDE_CONFIG_DIR + PAI_DIR = ~/.pai) instead. Preserved as
   historical context; not an active plan.

No code changes. No runtime impact. Pure documentation archive to
resolve working-tree drift between design docs and git state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
virtualian added a commit that referenced this pull request Apr 14, 2026
Captures three design documents that have been sitting untracked in the
working tree, making them visible in git for future sessions and making
pre-existing PR citations resolvable.

1. Plans/2026-04-14-two-root-separation-followups.md (238 lines)
   Authoritative planning doc for issues #108, #109, #110, and #115.
   Already cited by merged PRs #117, #118, #119 — committing here
   makes those citations resolve against a real file in git for the
   first time. Scopes "tonight's decision" (#108+#109 implement, #110
   and #115 defer for design) and documents the Path A/B alternatives
   for the feedback-memory-home decision that drove #118/#119.

2. Plans/2026-04-14-110-mirror-source-investigation.md (new)
   Post-#115-merge investigation answering the "where does the 178 MB
   ~/.claude/skills ↔ ~/.pai/skills mirror come from?" question left
   open by the followups doc. Path A confirmed: mirror is static; no
   installer writes to either tree; content was populated by an
   out-of-installer mechanism and has not been maintained since
   Apr 7 2026. Scopes three Option B implementation variants
   (copy-then-symlink, clone-to-PAI-root, Option-D-and-wait) with
   tradeoffs and recommends B-Plan-1 for minimum disruption.

3. Plans/eager-enchanting-snail.md (95 lines)
   Historical planning artifact from an earlier direction proposing
   ~/.claude/PAI/ → ~/data/PAI/ relocation with a new PAI_INSTALL_DIR
   env var. Superseded by #98/#101 which chose the two-root separation
   (CLAUDE_CONFIG_DIR + PAI_DIR = ~/.pai) instead. Preserved as
   historical context; not an active plan.

No code changes. No runtime impact. Pure documentation archive to
resolve working-tree drift between design docs and git state.

Co-authored-by: Claude Opus 4.6 (1M context) <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.

1 participant