From 7b34218c5ec6011c2c1add5860a28f01a9fb285f Mon Sep 17 00:00:00 2001 From: Vinod Muthusamy Date: Tue, 28 Apr 2026 15:38:39 -0500 Subject: [PATCH 1/3] fix(learn): read session transcript in forked execution context The learn skill runs with `context: fork`, which creates an isolated subagent with no access to the parent conversation. Pass the transcript_path from the stop hook input through to the skill invocation, and add Step 0 to SKILL.md instructing the forked agent to read the transcript file for analysis. --- .../plugins/evolve-lite/skills/learn/SKILL.md | 14 +++++++++++++- .../evolve-lite/skills/learn/scripts/on_stop.py | 7 ++++++- 2 files changed, 19 insertions(+), 2 deletions(-) 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 b4fa456d..d3172979 100644 --- a/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md +++ b/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md @@ -25,9 +25,21 @@ This skill analyzes the current conversation to extract guidelines that **correc ## Workflow +### Step 0: Load the Conversation + +This skill runs in a forked context with no access to the parent conversation. The stop hook message includes the path to the session transcript file (JSONL format). **You must read this file to analyze the conversation.** + +```bash +cat +``` + +Each line is a JSON object. Focus on lines where `"type": "assistant"` or `"type": "human"` to reconstruct the conversation flow. Look for tool calls, errors in tool results, and user corrections. + +If no transcript path was provided, check for the most recent file in `.evolve/trajectories/`. If no transcript is available at all, output zero entities. + ### Step 1: Analyze the Conversation -Review the conversation and identify: +Review the conversation (loaded from the transcript) and identify: - **Wasted steps**: Where did the agent go down a path that turned out to be unnecessary? What would have been the direct route? - **Errors hit**: What errors occurred? What knowledge would have prevented them? 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 3abfec67..fc98fb8e 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 @@ -14,11 +14,16 @@ def main(): if input_data.get("stop_hook_active") is True: return + transcript_path = input_data.get("transcript_path", "") + reason = "Run the /evolve-lite:learn skill." + if transcript_path: + reason += f" The session transcript is at: {transcript_path}" + print( json.dumps( { "decision": "block", - "reason": "Run the /evolve-lite:learn skill to extract guidelines from this conversation.", + "reason": reason, "suppressOutput": True, "systemMessage": "Running the evolve-lite learn skill...", } From f94dcdfd2877fe3f4548e181078e15212a6b0c49 Mon Sep 17 00:00:00 2001 From: Vinod Muthusamy Date: Wed, 29 Apr 2026 08:39:08 -0500 Subject: [PATCH 2/3] fix(learn): disambiguate fallback file format in SKILL.md Addresses CodeRabbit review finding: the fallback guidance that points to .evolve/trajectories/ was ambiguous about format. Explicitly name both file types the directory may contain (trajectory_*.json as a single JSON object, claude-transcript_*.jsonl as raw JSONL) and how to parse each. --- .../claude/plugins/evolve-lite/skills/learn/SKILL.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 d3172979..df4a6189 100644 --- a/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md +++ b/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md @@ -33,9 +33,14 @@ This skill runs in a forked context with no access to the parent conversation. T cat ``` -Each line is a JSON object. Focus on lines where `"type": "assistant"` or `"type": "human"` to reconstruct the conversation flow. Look for tool calls, errors in tool results, and user corrections. +The transcript is JSONL: each line is a separate JSON object. Focus on lines where `"type": "assistant"` or `"type": "human"` to reconstruct the conversation flow. Look for tool calls, errors in tool results, and user corrections. -If no transcript path was provided, check for the most recent file in `.evolve/trajectories/`. If no transcript is available at all, output zero entities. +If no transcript path was provided, fall back to `.evolve/trajectories/`, which may contain either format: + +- **`trajectory_*.json`** — a single JSON object with `messages: [{role, content}, …]`. Prefer the most recent one; parse with `json.load`. +- **`claude-transcript_*.jsonl`** — raw Claude JSONL (same format as the primary `transcript_path`). Parse line-by-line. + +If no transcript is available at all, output zero entities. ### Step 1: Analyze the Conversation From e2bf5c0ca8cade0fb058c0e4f1cd19454abbc0c6 Mon Sep 17 00:00:00 2001 From: Vinod Muthusamy Date: Wed, 29 Apr 2026 08:51:06 -0500 Subject: [PATCH 3/3] fix(learn): document how to extract transcript_path from stop hook message Addresses CodeRabbit review finding: SKILL.md referenced as a placeholder but didn't tell the forked agent how to obtain the actual value. Point to the literal marker "The session transcript is at: " produced by on_stop.py and describe how to extract and strip the path. --- .../claude/plugins/evolve-lite/skills/learn/SKILL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 df4a6189..7fe895a2 100644 --- a/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md +++ b/platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md @@ -27,12 +27,14 @@ 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 includes the path to the session transcript file (JSONL format). **You must read this file to analyze 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: ```bash cat ``` +**You must read this file to analyze the conversation** — the forked context has no other access to it. + The transcript is JSONL: each line is a separate JSON object. Focus on lines where `"type": "assistant"` or `"type": "human"` to reconstruct the conversation flow. Look for tool calls, errors in tool results, and user corrections. If no transcript path was provided, fall back to `.evolve/trajectories/`, which may contain either format: