Skip to content

0.10.0: session receipt on Stop hook - #12

Merged
davidcrowe merged 2 commits into
mainfrom
feat/session-receipt
Aug 13, 2026
Merged

0.10.0: session receipt on Stop hook#12
davidcrowe merged 2 commits into
mainfrom
feat/session-receipt

Conversation

@davidcrowe

Copy link
Copy Markdown
Collaborator

Retention play 2 (gatewaystack-connect#606, analysis 2026-08-13). At session end the hook prints one line:

[ACP] Session receipt: 214 tool calls governed · 3 shadow notices — review this session: https://cloud.agenticcontrolplane.com/sessions/<session_id>

  • New Stop hook entry in hooks.json; handleStop in govern.mjs
  • Counters are purely local: PostToolUse bumps a per-session JSON under ~/.acp/session-stats/ only on a real server verdict (a call the gateway never saw is never claimed as governed); Stop reads, prints, clears, and prunes week-old leftovers from crashed sessions
  • No network on the Stop path; silent for tool-free sessions; stop_hook_active guard prevents double receipts; hostile session ids sanitized before filesystem use
  • govern.mjs stays self-contained per repo convention; canonical logic mirrored in lib/receipt.mjs with contract tests (44/44 suite green, both handlers smoke-tested)

🤖 Generated with Claude Code

… session

Churned users' sessions were 100% silent allows (retention analysis
2026-08-13): the hook governed a thousand calls and appeared to do
nothing. The receipt is one systemMessage at session end — calls
governed, anything flagged, shadow notices shown — deep-linked to the
session's timeline in the console. Purely local counters (PostToolUse
bumps ~/.acp/session-stats/, Stop reads + clears), no network on the
Stop path, silent for tool-free sessions, stale files pruned.

Counted only on a real server verdict: a call the gateway never saw is
never claimed as governed.

Refs gatewaystack-connect#606
@davidcrowe
davidcrowe merged commit 3d8ae86 into main Aug 13, 2026
2 checks passed
@davidcrowe
davidcrowe deleted the feat/session-receipt branch August 26, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant