/evolve-lite:save-trajectoryfrom evolve-lite
Saves the current Claude Code conversation as a JSON trajectory file in OpenAI chat completion format, including tool calls and thinking blocks, for analysis or fine-tuning.
Ships in evolve-lite. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
This skill saves the current session's conversation history as a JSON file in OpenAI chat completion format. The trajectory is saved to .evolve/trajectories/ in the project root. This enables trajectory analysis, fine-tuning data collection, and session review.
Review all messages in the current conversation from start to finish. For each message, identify its type:
Convert each message to the appropriate format:
User text message:
{"role": "user", "content": "the user's message text"}
Assistant text response (no thinking):
{"role": "assistant", "content": "the assistant's response text"}
Assistant text response (with thinking):
{"role": "assistant", "content": "the assistant's response text", "thinking": "the thinking/reasoning text"}
Assistant tool call (no visible text):
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "tool_call_id_here",
"type": "function",
"function": {
"name": "ToolName",
"arguments": "{\"param\": \"value\"}"
}
}
]
}
Assistant tool call with text:
{
"role": "assistant",
"content": "text before/after the tool call",
"tool_calls": [
{
"id": "tool_call_id_here",
"type": "function",
"function": {
"name": "ToolName",
"arguments": "{\"param\": \"value\"}"
}
}
]
}
Tool result:
{"role": "tool", "tool_call_id": "tool_call_id_here", "content": "the tool output text"}
json.dumps() on the arguments object.call_001, call_002, etc.tool_calls array, followed by separate tool result messages for each.content and thinking fields.Strip <system-reminder>...</system-reminder> tags and their contents from all message content. Use a non-greedy multiline match (e.g., re.sub(r'<system-reminder>[\s\S]*?</system-reminder>', '', text).strip()). If after stripping, a message has empty content and no tool calls, omit it.
Wrap the messages array in a trajectory envelope:
{
"model": "<model-id-from-session>",
"timestamp": "2025-01-15T10:30:00Z",
"session_id": "<session-id-from-session>",
"messages": [...]
}
session_id passed into the skill, the session id surfaced in the session context, or a runtime-provided environment variable (CLAUDE_CODE_SESSION_ID, CODEX_THREAD_ID, or CODEX_SESSION_ID). The helper uses these variables in that order when the JSON omits the id. Include it verbatim so offline provenance can match this trajectory to recall audit events for the same session. Omit the field only if no session id is truly available in this environment.Write the trajectory JSON to a temporary file using the Write tool, then pass the file path to the helper script:
.evolve/tmp/trajectory_input.json using the Write tool (create the directory if needed)tmp=.evolve/tmp/trajectory_input.json; mkdir -p .evolve/tmp; python3 "${CLAUDE_PLUGIN_ROOT}/skills/evolve-lite/save-trajectory/scripts/save_trajectory.py" "$tmp" --delete-input
Important: Do NOT use inline Python scripts, heredocs, or stdin piping to pass the trajectory JSON. Always use the Write tool to create a temp file first. This avoids escaping issues with backslashes, quotes, and newlines in conversation content.
The script will:
.evolve/trajectories/ directory if neededtrajectory_YYYY-MM-DDTHH-MM-SS.json)After saving, you should see output like:
Trajectory saved: /path/to/project/.evolve/trajectories/trajectory_2025-01-15T10-30-00.json
Messages: 12
role: "user" or role: "assistant" as appropriate — do not skip them, since they preserve the conversation flow..evolve/trajectories/ and can be version-controlled or gitignored as preferred.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub agenttoolkit/altk-evolve --plugin evolve-lite12 skills in this plugin
/adapt-memoryMirror a just-saved native memory into the shared evolve store so it becomes shareable and auditable/doctorDiagnose evolve health on Claude — verify the CLAUDE.md @import is actually loading the thin EVOLVE.md into sessions/provenanceAnalyze saved trajectories and recall audit events offline to record whether recalled guidelines influenced completed sessions./publishPublish a private entity (guideline, feedback, project or reference) to a configured write-scope repo./retentionApply data-retention rules to the local evolve store — flag or delete stale and unused memories and expired sessions (dry-run by default)/saveCaptures the current session's successful workflow and saves it as a reusable skill with SKILL.md and helper scriptsOther plugins' skills for the same job