Skip to content

Commit 2774633

Browse files
vinodmutvisahak
andauthored
fix(learn): read session transcript in forked execution context (#230)
* 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. * 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. * fix(learn): document how to extract transcript_path from stop hook message Addresses CodeRabbit review finding: SKILL.md referenced <transcript_path> 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: <path>" produced by on_stop.py and describe how to extract and strip the path. --------- Co-authored-by: Vatche Isahagian <visahak@users.noreply.github.com>
1 parent afe8459 commit 2774633

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

platform-integrations/claude/plugins/evolve-lite/skills/learn/SKILL.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,28 @@ This skill analyzes the current conversation to extract guidelines that **correc
2525

2626
## Workflow
2727

28+
### Step 0: Load the Conversation
29+
30+
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: <path>` — find that exact phrase, take everything after the colon, strip surrounding whitespace and quotes, and use the result as `transcript_path`. Then read it:
31+
32+
```bash
33+
cat <transcript_path>
34+
```
35+
36+
**You must read this file to analyze the conversation** — the forked context has no other access to it.
37+
38+
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.
39+
40+
If no transcript path was provided, fall back to `.evolve/trajectories/`, which may contain either format:
41+
42+
- **`trajectory_*.json`** — a single JSON object with `messages: [{role, content}, …]`. Prefer the most recent one; parse with `json.load`.
43+
- **`claude-transcript_*.jsonl`** — raw Claude JSONL (same format as the primary `transcript_path`). Parse line-by-line.
44+
45+
If no transcript is available at all, output zero entities.
46+
2847
### Step 1: Analyze the Conversation
2948

30-
Review the conversation and identify:
49+
Review the conversation (loaded from the transcript) and identify:
3150

3251
- **Wasted steps**: Where did the agent go down a path that turned out to be unnecessary? What would have been the direct route?
3352
- **Errors hit**: What errors occurred? What knowledge would have prevented them?

platform-integrations/claude/plugins/evolve-lite/skills/learn/scripts/on_stop.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@ def main():
1414
if input_data.get("stop_hook_active") is True:
1515
return
1616

17+
transcript_path = input_data.get("transcript_path", "")
18+
reason = "Run the /evolve-lite:learn skill."
19+
if transcript_path:
20+
reason += f" The session transcript is at: {transcript_path}"
21+
1722
print(
1823
json.dumps(
1924
{
2025
"decision": "block",
21-
"reason": "Run the /evolve-lite:learn skill to extract guidelines from this conversation.",
26+
"reason": reason,
2227
"suppressOutput": True,
2328
"systemMessage": "Running the evolve-lite learn skill...",
2429
}

0 commit comments

Comments
 (0)