# Clairfolio — next handoff Clairfolio is now the public-facing brand. The CLI/package, environment variables, state paths and runtime disclaimers retain their `finance0` identifiers for local compatibility. The public Cloudflare Worker is `clairfolio`, serving https://clairfolio.apps-ecf.workers.dev. The previous Worker was retired after verifying the replacement, without an old-URL redirect. See `cloudflare-deployment.md` for the static overview deployment; it does not expose the financial application or state. ## Current implementation The core guide, optional Pi summary and Telegram publisher are implemented. - `6c5a385`: initial Telegram publisher; pushed to `origin/main`. - `d980498`: agent/handoff refresh, architecture/source documentation cleanup and repository-wide lint fixes; committed locally. - The subsequent delivery-safety feature accompanies this handoff. See `git log` and `git status` for its commit and current push state; no push was performed during this implementation request. No dependencies were added. No live collection, Telegram message, scheduling installation, credential inspection or source enabling was performed. ## Delivery-safety feature ### Repeatable publication `finance0/telegram_state.py` maintains a dedicated `state/telegram.sqlite` ledger. A nonblocking POSIX process lock is held throughout publication; SQLite FULL synchronous commits make the reservation visible before the first network call. The ledger contains hashes of destination and content, run ID, report day, publication ID, status, attempt count and last-update time. It does not store bot tokens, raw chat IDs or message text. Preserve its path and contents across runs. - Delivered identical content is skipped across run IDs. - Default: one successful publication per destination/report day. A second `make daily` cannot resend timestamp-only changes or regenerated model prose. - `--allow-update` explicitly permits changed same-day content. It cannot bypass identical-content deduplication or unresolved uncertain delivery. - An exception or abandoned pending reservation becomes uncertain. Any further send to that destination stops until explicit review. - `telegram-resolve --publication-id ID --resolution delivered|retry` records an operator decision without sending anything. Mark delivered only if the full publication arrived. Retry may duplicate previously delivered parts and uses the then-current report snapshot; there is no automatic partial resume. This is conservative duplicate prevention, not an exactly-once guarantee. The ledger cannot discover pre-feature/manual sends, and deleting/changing it loses history. Skips and successful sends return a publication ID; uncertain-send errors identify the reservation requiring review. ### Snapshot and summary freshness - `finance0/app.py` records `briefing_sha256` in daily data. - `finance0/io.py` provides a per-folder artifact lock used for coherent report/data writes, summary writes and publisher reads. - `finance0/llm.py` writes `llm_summary.meta.json` with run ID, exact input-data hash and summary hash. If collection changes during generation, it refuses to install the new summary. - `finance0/telegram.py` prefers a summary only if all provenance checks match. Otherwise it uses the current hash-bound deterministic report. Thus a failed summary after recollection cannot reuse the previous collection's summary. - Legacy output without identity/integrity metadata must be regenerated, not manually blessed. Explicitly selecting an old daily folder is still allowed: provenance establishes run consistency, not current market freshness. Report files may contain derived portfolio lenses. Review before sharing; summary output is not independent verification. Never transmit raw portfolio inputs or credentials. Credentials remain environment-only. ## Verification Final offline verification: - `make test`: **133 tests passed**, no skips. - `make lint`: passed repository-wide. - `.venv/bin/python -m compileall -q finance0 vosfinances vosfinances_hot.py csv_to_portfolio.py`: passed. - `git diff --check`: passed. - `make -n daily`: checked command chaining without execution. - Help for `publish-telegram` and `telegram-resolve`: checked. Tests cover repeated daily workflows with changed run IDs/model prose, persistent content/day deduplication, explicit updates, concurrent threads/processes, durable pre-send reservations, partial delivery, abandoned pending reservations, ledger failure after a successful send, manual resolution, private state and summary provenance/fallback. Telegram transports are mocked; browser pages are intercepted. No real delivery or fresh source reachability was verified. The original 9 Ruff findings are fixed. An initial cleanup test attempt timed out because Playwright supplied a second positional callback argument; callback binding was corrected and all subsequent full suites passed. ## Recommended next work 1. **Review and push local commits when authorized.** Check `git status`, tests, current history and the intended remote before pushing. 2. **User-authorized operational validation.** Regenerate a live daily output, review selected content, preview with `publish-telegram --dry-run`, then perform an explicitly authorized test delivery using privately configured environment credentials. Verify duplicate skipping and sanitized operational errors. Do not blindly retry a partial send. Dry-run previews content but does not consult or modify delivery state, so it does not predict a skip/review decision. 3. **Primary-source coverage.** Prioritize regulated savings rates, inflation and tax changes. Review actual permitted endpoints, terms and access before enabling candidates. The registry's six enabled feeds are configuration, not proof of today's availability. Never bypass blocks. 4. **Scheduling, only if requested.** No scheduler is installed by the app. `make daily` can collect live data, invoke a model and send real messages; it is not a harmless smoke test. Persist the delivery ledger between executions. ## Remaining boundaries - Six enabled feeds: ECB, ECB Statistics, AMF, Le Monde Économie, Moneyvox and World Gold Council. Official regulated-rate, insurance and tax coverage remains incomplete; a quiet report does not prove no relevant event occurred. - The saved root `hot.json` records blocked Reddit access and no threads. No workaround was attempted. Legacy Reddit instructions remain in `AGENTS.md`. - Core interpretation is deterministic. Optional Pi summaries use public item fields without tools or raw portfolio context; no semantic fact-checker exists. - Telegram publishing is separate from alert-helper delivery. Do not confuse their ledgers, locks or review semantics. - No allocation recommendations, balance/guarantee calculator, journal, dashboard or Q&A. The guide provides information and education, not financial advice.