Skip to content

Save pipeline silently no-ops when CLAUDE_CONFIG_DIR is set #166

Closed

Description

@samoilovartem

Summary

The plugin resolves Claude Code's session directory as $HOME/.claude/projects/<slug>/. But Claude Code relocates that entire tree — projects/ included — when CLAUDE_CONFIG_DIR is set, which people use to run a separate account per project. The plugin never reads that variable, so it looks in a directory with no current transcripts and the whole save pipeline no-ops. Silently.

This is the same failure shape already documented for the Windows slug mismatch in scripts/resolve-paths.sh:

The plugin's ls $SESSION_DIR/*.jsonl then returns nothing and the entire save pipeline silently no-ops.

Impact

In my case: 5 days, ~2000 PostToolUse hook invocations, zero saves. No now.md, no today-*.md, logs/autonomous/ empty, tmp/ empty. Nothing in the logs suggests a problem — the hook writes its env line and exits 0 every time.

The concrete path: post-tool-hook.sh computes DELTA = CURRENT_LINES - LAST_LINE from whatever stale .jsonl happens to be newest in the wrong directory. Mine had 16 lines and delta_lines_trigger is 50, so save-session.sh was never forked.

There is a worse variant: if the wrong directory holds an old transcript with more than delta_lines_trigger lines, the pipeline will happily summarize that stale session into memory instead of the real one.

Affected sites (v0.8.6)

  • scripts/post-tool-hook.sh:45
  • scripts/save-session.sh:100
  • scripts/session-start-hook.sh:73
  • pipeline/extract.py:48

Reproduce

  1. export CLAUDE_CONFIG_DIR=~/.claude-alt (e.g. via direnv) and start Claude Code in that project
  2. Work long enough to pass thresholds.delta_lines_trigger
  3. .remember/logs/autonomous/ stays empty and no now.md is ever written

Suggested fix

Follow the variable the same way Claude Code itself does:

# the three shell sites
"${CLAUDE_CONFIG_DIR:-$HOME/.claude}/projects/..."
# pipeline/extract.py::_session_dir
config_dir = os.environ.get("CLAUDE_CONFIG_DIR") or (home + "/.claude")
return config_dir + "/projects/" + slug

The hooks already receive CLAUDE_CONFIG_DIR in their environment, so nothing else needs plumbing.

Note on the test suite

Applying that patch locally makes 5 existing tests fail:

tests/test_extract.py::test_session_dir_replaces_slashes
tests/test_extract.py::test_find_session_windows_backslash_path
tests/test_extract.py::test_find_session_windows_colon_path
tests/test_extract.py::test_extract_session_windows_path_end_to_end
tests/test_post_tool_cooldown.py::test_fork_fires_when_no_cooldown_marker

They patch HOME to a temp dir but never clear CLAUDE_CONFIG_DIR, so the corrected code correctly follows the real variable straight out of the test sandbox. Running the same suite with env -u CLAUDE_CONFIG_DIR gives 555 passed, 41 skipped. So a proper fix should also delete/monkeypatch the variable in those fixtures.

Environment

  • claude-remember v0.8.6 (installed from the official Anthropic marketplace)
  • macOS, Python 3.12
  • CLAUDE_CONFIG_DIR exported via direnv

After applying the patch above locally, save-session.sh fires immediately and [extract] finds the real session on the first hook invocation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions