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.
- Recap
State - Turn
Recap - What happened in one recap window.
- Turn
State
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