commit 50d957e14e923a14c6ab3ca13e1088eb45e4478f Author: ac Date: Sat May 2 15:13:57 2026 +0000 chore: seed repo with .gitignore, .env.example, README skeleton Initial commit. Establishes: - .gitignore: .env (secrets), .venv, __pycache__, runtime dirs (logs/, state/, queue/, dispatch/). Removes the duplicate .env entry and the .env.example exclusion that was preventing the example file from being tracked. - .env.example: ANTHROPIC_API_KEY/MODEL placeholders, NTFY_TOPIC (auto-generated on first run), STATUS_PORT, HISTORY_CHAR_CAP. - README: install + run quickstart. The daemon implementation lands on a feature branch. Co-Authored-By: Claude Opus 4.7 (1M context) diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..aac3a5d --- /dev/null +++ b/.env.example @@ -0,0 +1,16 @@ +# Anthropic API +ANTHROPIC_API_KEY=sk-ant-... +ANTHROPIC_MODEL=claude-opus-4-7 + +# ntfy.sh notification topic — leave empty on first run; the daemon will +# generate a random topic and write it back to this file. Subscribe to +# https://ntfy.sh/ on your phone/laptop to receive needs_jc and +# error notifications. +NTFY_TOPIC= + +# Status endpoint (Flask). Default 8765. +STATUS_PORT=8765 + +# Optional: override the conversation-history character cap before +# summarization kicks in. Default 400000. +HISTORY_CHAR_CAP=400000 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b11f674 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# Secrets and runtime state — never committed +.env +.venv/ +__pycache__/ +*.pyc +*.pyo +*.egg-info/ + +# Daemon runtime directories — created on first run, contents are +# session-specific and not meaningful to track. +logs/ +state/ +queue/ +dispatch/ + +# Editor / OS noise +.idea/ +.vscode/ +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..f31156c --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# risv3-relay + +Relay daemon between Claude Code instances and a Claude.ai chat-equivalent session via the Anthropic API. + +## What it does + +When CC produces output that would normally be pasted to a Claude.ai chat for review or a decision, the daemon does the relay automatically: + +1. CC drops a JSON envelope into `queue/`. +2. Daemon picks oldest-first, appends to a running conversation history, calls the Anthropic API. +3. If the response contains `[NEEDS-JC]` in its first 200 characters, the daemon pauses and notifies via [ntfy.sh](https://ntfy.sh). +4. Otherwise, the response is written to `dispatch//input.txt` for the originating CC session to consume. + +JC can override at any time by writing to `state/jc_input.txt`. + +## Install + +```sh +git clone git@localhost:AC/risv3-relay.git +cd risv3-relay +python3 -m venv .venv +.venv/bin/pip install -e '.[dev]' +cp .env.example .env +# edit .env — add ANTHROPIC_API_KEY +``` + +## Run + +```sh +.venv/bin/python -m relay run +``` + +The daemon prints the ntfy subscription URL on startup. Subscribe to it from your phone/laptop to receive `needs_jc` and error notifications. + +## Project layout + +- `relay/` — Python package +- `tests/` — pytest tests +- `queue/`, `dispatch/`, `state/`, `logs/` — runtime directories created on first run; gitignored +- `config.yaml` — registered CC sessions and per-session settings +- `.env` — secrets and per-host overrides; gitignored + +## Status + +First-PR scope: daemon skeleton, queue + dispatch loop, single-CC-session integration, basic logging, ntfy notifications, conversation history with summarization. See `docs/` and PR descriptions for follow-up scope (status web UI, multi-session, error recovery, cost tracking, systemd unit).