# CLAUDE.md — BLIGHT: CUE ## Instructions for Claude - **Every commit**: Update the Changelog section below with a summary of what changed and bump the version number if appropriate. - **Every commit**: If the changes affect anything documented in README.md (trigger syntax, failure behavior, setup, project structure, AI provider info, etc.), update README.md in the same commit. --- ## Version **v1.2.0** --- ## Changelog ### v1.2.0 - Fixed loop re-processing: AI responses are sanitized by replacing `BLIGHT:` with `BLIGHT:` before being written to the document, preventing the service's own commits from triggering another processing cycle. - Branch awareness: branch is now extracted from `refs/heads/` in the push payload and passed to all Gitea read/write calls, so pushes to non-default branches are handled correctly. - Commit messages now include the file path (e.g. `BLIGHT: process triggers in notes/todo.md`). ### v1.1.0 - Added `BLIGHT::` (double colon) document-scope trigger syntax. Unlike `BLIGHT:` which replaces only the trigger line, `BLIGHT::` replaces the entire file content with the AI's rewritten document. - Multiple `BLIGHT::` triggers in one file are processed sequentially, each operating on the result of the previous. - Inline `BLIGHT:` triggers are always processed before `BLIGHT::` triggers. - Both trigger types are now case-insensitive (`blight:`, `BLIGHT:`, `Blight::`, etc. all match). - Failure comments updated to two-line format: ``` ``` - Added `complete_document()` to `AIProvider` ABC and `GeminiProvider`, with a dedicated system prompt instructing the model to return the full rewritten document. ### v1.0.0 — Initial release - Flask webhook server listening for Gitea push events. - HMAC-SHA256 signature verification on all incoming webhooks. - Scans changed `.md` files for `BLIGHT: ` trigger lines. - Sends full document + instruction to Google Gemini 2.5 Flash-Lite. - Replaces trigger line with AI response in-place and commits back to Gitea. - Retry logic: 3 attempts with exponential backoff (1s, 2s, 4s). - Processes webhooks in background threads to return 200 immediately. - Deduplicates file paths across multiple commits in a single push. - Self-updates on startup via `git pull --ff-only`. - Pluggable `AIProvider` ABC for swapping AI backends.