Principle:AMAP ML SkillClaw Session Summarization
| Knowledge Sources | |
|---|---|
| Domains | Session_Processing, LLM_Summarization |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
A dual-layer session summarization technique that produces both a lossless programmatic trajectory and an LLM-generated analysis, reducing raw session data from megabytes to tens of kilobytes.
Description
Session summarization addresses the problem of condencing large raw session recordings (full conversation logs with tool calls, results, and reasoning) into compact representations suitable for LLM evolution prompts. The dual-layer approach preserves maximum information: the trajectory is a programmatic, lossless step-by-step text trace built without LLM (no information loss, deterministic), while the summary is an LLM-generated analysis that identifies patterns, problems, and skill relevance. Both are used by downstream evolution stages. Metadata extraction adds `_skills_referenced`, `_avg_prm`, and `_has_tool_errors` fields.
Usage
Use this principle when designing systems that need:
- Compact session representations for LLM prompts
- Lossless trajectory recording alongside LLM analysis
- Metadata extraction from conversation sessions
- Parallel processing of multiple sessions
Theoretical Basis
The dual-layer design ensures both fidelity and insight:
- Trajectory (lossless): Programmatic extraction of all turns, tool calls, and results into a structured text format. Zero information loss, fully deterministic.
- Summary (LLM analysis): The trajectory is fed to an LLM which produces a concise analysis. This is lossy but captures patterns the trajectory alone cannot express.
- Metadata: `_skills_referenced` (set of skill names from injected_skills and read_skills), `_avg_prm` (mean PRM score), `_has_tool_errors` (boolean).
# Abstract algorithm (NOT real implementation)
async def summarize_session(llm, session):
extract_metadata(session) # skills, prm, errors
trajectory = build_trajectory(session) # lossless, programmatic
summary = await llm.analyze(trajectory) # LLM-generated
session._trajectory = trajectory
session._summary = summary