Skip to content

Instantly share code, notes, and snippets.

@isingh
isingh / claude-i
Created May 15, 2026 03:57
claude-i
#!/usr/bin/env python3
"""claude-i: like `claude -p`, but driven through an interactive Claude session.
Architecture:
- tmux session hosts an interactive `claude` (kill-session nukes the whole
process tree — pty alone can't do this reliably).
- A Stop hook (one-time install into ~/.claude/settings.json), gated on
$CLAUDE_I_SENTINEL, writes the hook payload and touches a sentinel.
- We wait on the sentinel, read the transcript path from the payload,
extract the last assistant message, then kill the tmux session.

Keybase proof

I hereby claim:

To claim this, I am signing this object:

{
"id": "2cd0443b-f2e0-4a12-9b54-e44ac3fc22f6",
"bidid": "GdtWn30solJIxIpp6U6yYWCAEW4",
"seatbid": [
{
"seat": "manage",
"bid": [
{
"id": "GdtWn30solJIxIpp6U6yYWCAEW4",
"impid": "1",
{
"id": "2cd0443b-f2e0-4a12-9b54-e44ac3fc22f6",
"bidid": "GdtWn30solJIxIpp6U6yYWCAEW4",
"seatbid": [
{
"seat": "manage",
"bid": [
{
"id": "GdtWn30solJIxIpp6U6yYWCAEW4",
"impid": "1",
{
"id": "2cd0443b-f2e0-4a12-9b54-e44ac3fc22f6",
"bidid": "GdtWn30solJIxIpp6U6yYWCAEW4",
"seatbid": [
{
"seat": "manage",
"bid": [
{
"id": "GdtWn30solJIxIpp6U6yYWCAEW4",
"impid": "1",
{
"id": "2cd0443b-f2e0-4a12-9b54-e44ac3fc22f6",
"bidid": "GdtWn30solJIxIpp6U6yYWCAEW4",
"seatbid": [
{
"seat": "manage",
"bid": [
{
"id": "GdtWn30solJIxIpp6U6yYWCAEW4",
"impid": "1",