fix(config): sessions/transcripts honor $CLAWCODEX_CONFIG_DIR#707
Merged
Conversation
The sessions/ and transcripts/ stores were hardcoded to Path.home()/".clawcodex" in ~10 sites and ignored $CLAWCODEX_CONFIG_DIR, while config/memory/skills/auth/mcp all honor it. This made the override inconsistent and previously forced the # Environment prompt hint (PR #706) to anchor on Path.home() so it wouldn't misdirect the model under the override. Add get_sessions_dir()/get_transcripts_dir() to the canonical clawcodex_dirs resolver (= get_user_config_dir()/"sessions"|"transcripts") and route every session/transcript reader+writer through them: session_storage.SESSIONS_DIR (resolver-computed; kept as a patchable module attribute), agent/session.py save+load, cost_restore._sessions_dir, agent_server._sessions_dir (all /resume + list paths), the memdir "search past context" prompt line, and agent/transcript._transcripts_root (propagates to transcripts/workflows/ journals). The # Environment line flips back to get_user_config_dir(), correct in both configs. Default users are unaffected: get_user_config_dir() == ~/.clawcodex, so the resolved paths are byte-identical to the old hardcoded ones (no move). With the override set, the stores relocate under it — a clean switch with no legacy fallback, matching how config/memory/skills already behave. Out of scope (still home-anchored): server-sessions.json (Direct Connect index), uploads/, workflows/, plans/, worktrees (git-registered). Tests: new tests/utils/test_clawcodex_dirs.py (default/override/expansion); env-line test flipped to assert it follows the override; drift guard ties the line to the real SESSIONS_DIR + transcript sources. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
agentforce314
added a commit
that referenced
this pull request
Jul 13, 2026
…codex paths (#710) _prepare_subscription_request's clean() rewrote EVERY case-insensitive "clawcodex" in the system prompt to "Claude Code" — including filesystem paths. On Claude-subscription logins the model was told its memory lives at ~/.Claude Code/projects/<slug>/memory and its history at ~/.Claude Code/sessions — literal nonexistent locations it then searched verbatim. This is the real source of the "guessed wrong paths" #706/#707 addressed: those fixes emit correct paths, and this rewrite corrupted them after prompt assembly, at the provider layer. Constrain the rewrite to standalone brand mentions: matches inside path segments (~/.clawcodex, /etc/clawcodex), env vars ($CLAWCODEX_CONFIG_DIR), module/file names (clawcodex_dirs), and domains (clawcodex.app) survive verbatim. Prose disguise and the official-prefix block are unchanged. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
sessions/andtranscripts/were hardcoded toPath.home()/".clawcodex"in ~10 sites and ignored$CLAWCODEX_CONFIG_DIR, while config/memory/skills/auth/mcp all honor it. This inconsistency is what forced #706's# Environmentprompt hint to anchor onPath.home()(so it wouldn't authoritatively misdirect the model under the override). This is the real fix the Critic recommended in #706's review.What
get_sessions_dir()/get_transcripts_dir()to the canonicalsrc/utils/clawcodex_dirs.pyresolver (= get_user_config_dir()/"sessions"|"transcripts").services/session_storage.py::SESSIONS_DIR(resolver-computed; kept as a patchable module attribute — two tests monkeypatch it, internal fallbacks read it)agent/session.pysave()/load()services/cost_restore.py::_sessions_dir,server/agent_server.py::_sessions_dir(covers all/resume+list_sessionspaths)memdir/memdir.py— the "search past context" prompt line (a model-facing session-path surface)agent/transcript.py::_transcripts_root(propagates toget_agent_transcript_path,get_workflow_run_path,transcripts/workflows/journals)# Environmentline back toget_user_config_dir()— correct in both configs (reverses fix(prompt): name ~/.clawcodex in # Environment so the model finds session history #706'sPath.home()anchor + its test).Compatibility
get_user_config_dir() == ~/.clawcodex, so resolved paths are byte-identical to the old hardcoded ones./resumelooks under the new root; noted in CHANGELOG.Out of scope (still home-anchored)
server-sessions.json(Direct Connect index),uploads/,workflows/,plans/, worktrees (git-registered, can't move).server-sessions.jsonis a reasonable follow-up (also session state).Tests
tests/utils/test_clawcodex_dirs.py(default / override / same-root-as-config /~-expansion).test_follows_config_dir_override; drift guard ties the line to the realSESSIONS_DIR+ transcript sources.Reviewed via the Critic loop → APPROVE (verified completeness, reader/writer partitioning by store, no import cycle, dead-import safety).
🤖 Generated with Claude Code