[T2] feat: relay daemon skeleton — queue, dispatch, conversation history, ntfy, summarization #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
First-PR scope: daemon skeleton, queue + dispatch loop, single-CC-session integration, basic logging, ntfy notifications, conversation history with summarization. Get one full loop working end-to-end against a real Anthropic API call.
Architecture
Single-process Python daemon. Main loop polls:
queue/*.json— CC session output envelopes; oldest-first.state/jc_input.txt— JC override; treated as next chat-side turn (with optional@session-N:prefix for direct routing).For each picked-up turn:
state/conversation.jsonhistory.[NEEDS-JC]→ set status toneeds_jc, send ntfy notification, do NOT dispatch. Daemon waits onjc_input.txt.dispatch/<session_id>/input.txt(only when prior file is consumed/deleted by the session). CC sessions poll their owninput.txt.HISTORY_CHAR_CAP(default 400k chars), send a summarization turn, replace history with summary + last 10 turns verbatim.Trust model
state/jc_input.txt) is treated as authoritative. With prefix@session-N: …it dispatches directly without an API call. Without prefix it goes through the API as if JC were responding from chat.Files / structure
ntfy
Generates a random ~16-char topic on first run, writes back to
.env. Daemon printshttps://ntfy.sh/<topic>prominently on startup. Subscribe from phone/laptop. Notifies on:needs_jcflagged on a chat-side responseOut of scope (deferred to follow-up PRs)
needs_jctime)AI tier
Tier 2. Touches secrets (API key), sends data to a third-party API, runs as a long-lived process. Octopus security-auditor + database-architect (for state-file integrity) reviews before PR.
Done when
input.txt.[NEEDS-JC]token detection pauses dispatch and notifies via ntfy.HISTORY_CHAR_CAPand reduces the in-memory + on-disk size.state/jc_input.txtresumes fromneeds_jcor routes to a session via@session-N:prefix.