How neokn/session-lens works
session-lens is a Claude Code mod that opens a live terminal pane for session usage, cost, context, agents, and activity. The /session-lens command enters through the registration layer; refresh and transcript-reading code gather session data, digest modules derive figures, and view templates render the pane. README capabilities also include event, effort, history, and design-token/component pages. The graph combines excerpted relationships, SOURCE INDEX references, and documented behavior; some README-described subsystems have only directory-level paths because their implementation was not sampled.
Main entry points: register.tsx Command registration · transcript.ts Transcript reader · record.ts Record digest · session.ts Session digest
Components 23
Session collection
- Transcript reader
hooks/record/transcript.ts - Child discovery
hooks/record/children.ts
Session analysis
- Record digest
hooks/digest/record.ts - Session digest
hooks/digest/session.ts - Turn analysis
hooks/digest/turns.ts - Cost analysis
hooks/digest/cost.ts - Context analysis
hooks/digest/context.ts - Compaction analysis
hooks/digest/autocompact.ts - Timeline and events
hooks/digest - Effort and forecast
hooks/digest
Pane orchestration
- Command registration
hooks/register.tsx - Live refresh
hooks/refresh.ts - Pane state
hooks/state.ts
Terminal presentation
- Session pane
hooks/views/templates - Context display
hooks/views/organisms/ContextGrid.tsx - Cost tables
hooks/views/organisms/CostTable.tsx - Turn waterfall
hooks/views/organisms/Waterfall.tsx - Design tokens
hooks/views/palette.ts - Terminal layout
hooks/views/layout.ts - Theme selection
hooks/theme.ts
Other components
- Claude Code user
- /session-lens
- Session report plugin
Connections 26
- Claude Code user → /session-lens: runs
- /session-lens → Command registration: opens pane
- Command registration → Live refresh: starts refresh
hooks/register.tsx - Live refresh → Transcript reader: reads transcript
hooks/refresh.ts - Transcript reader → Child discovery: discovers children
hooks/record/transcript.ts - Transcript reader → Record digest: digests rows
hooks/record/transcript.ts - Transcript reader → Session digest: builds session
hooks/record/transcript.ts - Session digest → Record digest: uses record digest
hooks/digest/session.ts - Session digest → Turn analysis: uses turn analysis
hooks/digest/session.ts - Turn analysis → Record digest: scans records
hooks/digest/turns.ts - Turn analysis → Cost analysis: prices requests
hooks/digest/turns.ts - Record digest → Cost analysis: uses pricing
hooks/digest/record.ts - Live refresh → Pane state: updates state
hooks/refresh.ts - Command registration → Context analysis: loads digest
hooks/register.tsx - Command registration → Cost analysis: loads digest
hooks/register.tsx - Command registration → Compaction analysis: loads digest
hooks/register.tsx - Command registration → Timeline and events: loads activity data
hooks/register.tsx - Command registration → Effort and forecast: loads effort data
hooks/register.tsx - Command registration → Session pane: renders pane
hooks/register.tsx - Command registration → Context display: renders context
hooks/register.tsx - Command registration → Cost tables: renders cost
hooks/register.tsx - Command registration → Turn waterfall: renders turns
hooks/register.tsx - Command registration → Design tokens: uses palette
hooks/register.tsx - Command registration → Terminal layout: uses layout
hooks/register.tsx - Command registration → Theme selection: selects theme
hooks/register.tsx - Claude Code user → Session report plugin: opens report