Skip to main content

Module recap

Module recap 

Source
Expand description

Turn and session recaps: when lean-ctx says something, and what.

Hosts identify a conversation by their own session id (Claude’s Stop and SessionStart payloads), which is not lean-ctx’s session id. Per host session, TurnState counts turns and remembers the numbers at the last recap; the numbers themselves come from the project snapshot. A recap only ever describes the window since the previous one — never the whole lean-ctx session as if it happened in the last few turns.

Structs§

Digest
Totals over every session snapshot updated in the last 7 days.
RecapState
TurnRecap
What happened in one recap window.
TurnState

Functions§

advance
Counts one finished turn and decides whether it ends a recap window.
digest_line
◆ lean-ctx · this week (12 sessions): −8.4M tokens · 3 secrets kept out of context
load_turn_state
on_session_start
The SessionStart entry point. Starts the host session’s turn count and, on a fresh start (not a resume or compaction), returns either the weekly digest (at most once per 7 days) or a one-time recap of the project’s last lean-ctx session.
on_turn_end
The Stop-hook entry point: counts the turn and returns the recap line when this turn closes a window worth mentioning.
session_line
◆ lean-ctx · last session (62% of tool input): −1.4M tokens · 3 secrets kept out of context
turn_line
◆ lean-ctx · last 10 turns: −312.0K tokens · 2 secrets kept out of context
turn_state_path
weekly_digest