Skip to content

bug(learn-hook): on_stop ignores EVOLVE_DIR when pointing learn skill at saved transcript #246

@visahak

Description

@visahak

Summary

platform-integrations/claude/plugins/evolve-lite/skills/learn/scripts/on_stop.py:23 hardcodes .evolve/trajectories/claude-transcript_<session-id>.jsonl as the path it tells
the learn skill to read. The sibling hook save-trajectory/scripts/on_stop.py writes the transcript to $EVOLVE_DIR/trajectories/ (or
$CLAUDE_PROJECT_ROOT/.evolve/trajectories/) using a proper resolution order. When either env var is set to a non-default location, the two paths disagree and the learn skill
can't find the saved transcript — it exits without extracting guidelines or influence records.

Repro

  1. Set EVOLVE_DIR=/tmp/my-evolve (or CLAUDE_PROJECT_ROOT=<some-dir>).
  2. Run any Claude Code session to completion so the Stop hook fires.
  3. save-trajectory writes to /tmp/my-evolve/trajectories/claude-transcript_<id>.jsonl.
  4. learn/on_stop.py tells the model the path is .evolve/trajectories/claude-transcript_<id>.jsonl.
  5. The learn skill reads a non-existent path and silently produces no guidelines.

Root cause

learn/scripts/on_stop.py:23 builds the path as a literal string instead of using the same resolution logic as save-trajectory/scripts/on_stop.py:41-52
(get_trajectories_dir()).

Suggested fix

Either:

  • Extract get_trajectories_dir() into a shared helper under the plugin's lib/ and import it from both hooks, or
  • Duplicate the resolution logic inside learn/on_stop.py (EVOLVE_DIRCLAUDE_PROJECT_ROOT/.evolve.evolve) and emit the resolved absolute path in the reason field.

Test plan

  • Unit test: with EVOLVE_DIR set, on_stop.py emits a reason whose path equals $EVOLVE_DIR/trajectories/claude-transcript_<id>.jsonl.
  • Unit test: with only CLAUDE_PROJECT_ROOT set, path resolves under that root.
  • Unit test: with neither set, falls back to .evolve/trajectories/....

Context

Flagged by Codex review on PR #245.

Metadata

Metadata

Assignees

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