diff --git a/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md b/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md index 7fe895a2..5c3a8100 100644 --- a/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md +++ b/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md @@ -27,7 +27,12 @@ This skill analyzes the current conversation to extract guidelines that **correc ### Step 0: Load the Conversation -This skill runs in a forked context with no access to the parent conversation. The stop hook message (produced by `on_stop.py`) contains the literal marker `The session transcript is at: ` — find that exact phrase, take everything after the colon, strip surrounding whitespace and quotes, and use the result as `transcript_path`. Then read it: +This skill runs in a forked context with no access to the parent conversation. The stop hook message (produced by `on_stop.py`) contains two literal markers: + +- `The session transcript is at: ` — the live session transcript. Take everything between that marker and the next marker (or end of message), strip whitespace and quotes, and use the result as `transcript_path`. +- `The saved trajectory path is: ` — the relative path of the saved trajectory copy under `.evolve/trajectories/`. Extract this the same way and remember it as `saved_trajectory_path` — you will attach it to each entity in Step 3. + +Then read the session transcript: ```bash cat @@ -74,7 +79,7 @@ Principles: ### Step 3: Save Entities -Output entities as JSON and pipe to the save script. The `type` field must always be `"guideline"` — no other types are accepted. +Output entities as JSON and pipe to the save script. The `type` field must always be `"guideline"` — no other types are accepted. Include a `trajectory` field on every entity, set to the `saved_trajectory_path` extracted in Step 0 — this records which session produced the guideline. #### Method 1: Direct Pipe (Recommended) @@ -85,7 +90,8 @@ echo '{ "content": "Proactive entity stating what TO DO", "rationale": "Why this approach works better", "type": "guideline", - "trigger": "Situational context when this applies" + "trigger": "Situational context when this applies", + "trajectory": ".evolve/trajectories/claude-transcript_.jsonl" } ] }' | python3 ${CLAUDE_PLUGIN_ROOT}/skills/learn/scripts/save_entities.py diff --git a/platform-integrations/claude/plugins/evolve-lite/skills/learn/scripts/on_stop.py b/platform-integrations/claude/plugins/evolve-lite/skills/learn/scripts/on_stop.py index fc98fb8e..f769c483 100644 --- a/platform-integrations/claude/plugins/evolve-lite/skills/learn/scripts/on_stop.py +++ b/platform-integrations/claude/plugins/evolve-lite/skills/learn/scripts/on_stop.py @@ -3,6 +3,7 @@ import json import sys +from pathlib import Path def main(): @@ -18,6 +19,10 @@ def main(): reason = "Run the /evolve-lite:learn skill." if transcript_path: reason += f" The session transcript is at: {transcript_path}" + session_id = Path(transcript_path).stem.removeprefix("claude-transcript_") + if session_id: + saved_trajectory = f".evolve/trajectories/claude-transcript_{session_id}.jsonl" + reason += f" The saved trajectory path is: {saved_trajectory}" print( json.dumps(