Saw the thread about the June 15 credit change. A lot of people are upset about losing subsidized -p usage. I built something that might help: a heartbeat hook that keeps an interactive Claude Code session alive and autonomous — no -p flag needed. Interactive mode uses your regular subscription, not the new SDK credit. How it works: A stop hook fires after every Claude response The hook reads an inbox file for external events (Discord messages, webhooks, cron jobs) If events exist, they get injected as the next message If no events, an idle tick keeps the session alive The agent writes responses to an outbox file A relay sends outbox messages wherever you want (Discord, Slack, webhooks) Run as many as you need in parallel to handle whatever tasks you need. The session never times out. The agent processes events autonomously. No -p. What you get:
- No SDK credit limits (interactive mode = subscription) - Persistent context across the whole session - Autonomous behavior without human prompting - External event processing from any source - Adjustable tick rate (HEARTBEAT_INTERVAL env var) What you trade:
- No piping (can’t do echo | claude -p) - Parallelism is as many windows as you open (no true parallelism) - Context grows over time (compact periodically) It’s 50 lines of JavaScript. MIT licensed. GitHub: https://github.com/Siigari/claude-heartbeat Built this for my own companion AI project. The heartbeat hook is the foundation — I built a full personality system on top of it. Happy to answer questions. submitted by /u/Siigari
Originally posted by u/Siigari on r/ClaudeCode
