# Clairfolio — a clearer financial perspective A local Python **3.11+** application for calm, sourced financial information and education. It prioritizes capital safety and long-term understanding, not trade ideas. No broker integration, credentials, exact balances or model API is needed. **Clairfolio** is the public-facing product name. The CLI command, Python package, environment-variable names and local storage paths remain `finance0`-based for compatibility; no local application migration is required. The public Cloudflare Worker is named `clairfolio`. The original [`AGENTS.md`](AGENTS.md) Reddit workflow is preserved in `vosfinances_hot.py`; its documentation is in [docs/legacy-mvp.md](docs/legacy-mvp.md). The new multi-source commands implement the core PRD workflow plus selected P1 features. See [implementation status and limits](docs/implementation.md). For a visual introduction, open [the illustrated project overview](docs/project-overview.html) in a browser. It includes an architecture diagram, interactive scoring explanation and a clearly fictional sample briefing. The page is self-contained and makes no external requests. **Live overview:** https://clairfolio.apps-ecf.workers.dev ### Public website deployment The overview is hosted as a static-assets-only Cloudflare Worker. This does not host the Python application or expose portfolio inputs, reports or local state. With the `cf` CLI authenticated, run from the repository root: ```bash make site-build # stage only allowlisted public files in .site/ make site-preview # local preview at http://127.0.0.1:8080 make site-deploy # rebuild and publish with cf deploy .site ``` Never deploy the repository root. See [deployment boundaries and verification](docs/cloudflare-deployment.md). No automatic Git-based deployment, custom domain or scheduler is configured. ## Quick start Run from this project directory on Linux/macOS (the scheduled-run lock uses POSIX `flock`). Use Python 3.11 or newer: ```bash python3 -m venv .venv source .venv/bin/activate python -m pip install -e '.[dev]' python -m playwright install chromium # only needed if Reddit is enabled finance0 run ``` If your distribution lacks `venv`/`ensurepip`, install its `python3-venv` package. Playwright may also need [system libraries](https://playwright.dev/python/docs/intro). Installing `requirements.txt` instead works with `python -m finance0 run`. ### Try it without network access ```bash finance0 run --offline tests/fixtures/run.json \ --as-of 2026-10-18T12:00:00+00:00 finance0 check-alerts --offline tests/fixtures/run.json \ --as-of 2026-10-18T12:00:00+00:00 finance0 digest --offline tests/fixtures/run.json \ --as-of 2026-10-18T12:00:00+00:00 ``` These are explicitly **synthetic test items**, not actual financial news or rates. They use separate state (`state/fixtures.sqlite`) and outputs (`output/fixtures/`). Fixture mode creates no HTTP client, cannot send notifications, and cannot share a live database. `--as-of` is forbidden for live runs. ## Commands and artifacts ```bash finance0 run # daily briefing; source frequencies are enforced finance0 check-alerts # same safety gates, smaller feed sample, dry-run delivery finance0 digest # last week's local archive only; zero fetches/notifications finance0 calendar --year 2027 # .ics for verified, explicitly configured dates only finance0 portfolio validate # validate config/portfolio.yaml without displaying it finance0 portfolio import-csv config/portfolio.csv # validated local CSV -> YAML ``` Reports use the PRD's ten-section order, English prose, dated links, a source scorecard, explicit uncertainty and the verbatim disclaimer. French product names and acronyms are preserved. An incomplete source set is not a reason to invent five resources: fewer qualifying items are explained. Each live collection writes `output/YYYY-MM-DD/`: - `briefing.md`: executive summary, alerts, top items, impacts, education, readings, community opinion, noise, caveats and sources. - `data.json`: versioned structured items, sourced claims, scores, events, source statuses, educational entries and a `briefing_sha256` integrity binding. **No raw profile.** - Optional `llm_summary.md` and `llm_summary.meta.json`: model summary and its run ID, input-data hash and summary hash, written by `summarize`. - `events.log`: append-only JSON Lines, including suppressed/deduplicated decisions. - `sources_scorecard.json`: cumulative operational history and top-selection counts. - `playbooks.md`: the alert-linked educational checklists. - `hot.json`: the public Reddit snapshot, when the browser adapter ran successfully enough to return a snapshot. The latest collection on a date replaces that date's report/data atomically; SQLite retains each run's structured payload. The event log is never truncated. `digest` writes `digest.md` and `digest_data.json` without replacing the daily briefing/data. Calendar export defaults to `output/calendar.ics`. Defaults can be overridden with `--config-dir`, `--state`, `--output-root` and `--profile` or `--portfolio` (mutually exclusive). Run from the repository root or provide an absolute `--config-dir`. Outputs/state and default profile/portfolio files are git-ignored. Operational stdout is a structured JSON run summary, without holdings, fetched text or notification command output. Exit `0` means artifacts were produced, **not** that all sources worked or every claim was verified. Local configuration/persistence errors return `1`; individual source failures are reported in Caveats and do not abort a valid run. ## Configuration ### Trusted sources: `config/sources.yaml` Both interpretations of “top five” are implemented: a registry ranked by configured reliability, and the five highest-scoring eligible items in each report. The scorecard includes every registry source, not just successful ones. The registry includes the PRD's official, institutional/press and community seed candidates. On **2026-10-18**, direct robots + feed checks found: | Source | Result / default | | --- | --- | | BCE / ECB | Public RSS reachable, robots permitted; enabled | | AMF | Public RSS reachable, robots permitted; enabled | | Le Monde Économie | Publisher RSS reachable, robots permitted; enabled for feed excerpts only | | Banque de France | HTTP 403 during verification; disabled, no workaround tried | | INSEE | HTTP 500 during verification; disabled pending a verified endpoint | | Other seed candidates, including Reddit | Not verified for this integration; disabled pending access/terms/feed review | Since that historical check, the registry also enables **ECB Statistics, Moneyvox and World Gold Council**, for six enabled feeds in total. This describes the current configuration, not a new live reachability or licensing verification. Runtime access checks still apply to every enabled feed. A disabled candidate's homepage is **not a functioning feed**. Replace it with a permitted publisher endpoint, review its terms/licensing, set `permission` and `enabled`, and retain an honest note about verification. `public-feed` is a scoped configuration decision to use publisher-provided feed material, not a claim of blanket republication rights. The app does not fetch press articles, enclosures or paywalled full text. Runtime robots checks are still mandatory. Each source specifies ID, URL, type, language, method, frequency, reliability, independence group, notes and optional primary metrics. Available adapters: - RSS/Atom: shared by ECB, AMF and press feeds; no source-specific URL guessing. - Public JSON API: opt-in `{ "items": [{ "title", "url", "published_at", "text"? }] }` contract. No authenticated API or unverified Légifrance endpoint is assumed. - Reddit: existing Playwright scraper with a robots/rate guard on every page; prompt/noise titles are excluded from discussion-reading priority. Source dates are now extracted where present. Discussion samples remain **community opinion**. Access denials/captchas/429 are never retried or worked around. Source access cooldowns persist across runs; connection errors/5xx get at most one bounded backoff retry. Robots failures fail closed. Redirect destinations require explicit host permission and their own robots check. Proxy environment variables are not used. The app uses public feeds only, never a logged-in browser session. ### Noise policy: `config/filters.yaml` Editable accent-insensitive regexes quarantine retail leverage/derivatives, meme assets, hot tips, hype, crypto momentum, price targets, direct trade calls and instruction-like content. Crypto material qualifies only with a regulatory, tax or safety focus. Regulator warnings can discuss scams without being treated as promotions. Filtered items appear only in the audit appendix; unsafe instruction or recommendation text is withheld even there. Votes cannot override a safety gate. ### Percentage portfolio: personalized reviews, alerts and executive summary ```bash cp config/portfolio.example.yaml config/portfolio.yaml chmod 600 config/portfolio.yaml # Edit the copied file locally; the example is synthetic, not a suggested allocation. finance0 portfolio validate --file config/portfolio.yaml finance0 run # automatically discovers config/portfolio.yaml finance0 check-alerts # same portfolio, unchanged safety/confidence gates finance0 digest # reinterprets archive items using the supplied portfolio ``` Each row contains a `wrapper`, an `asset_class`, and a numeric `percent` of the **whole portfolio**. Split mixed wrappers into rows; all rows must sum to exactly 100. No balances, account IDs, account-provider fields or credentials are accepted. You may optionally add **individual ETFs, stocks and bonds** under each position's `holdings` list. Each instrument has a public `name`, a `kind`, and a `percent_of_position`; each supplied breakdown must independently total 100. For example, half of a position representing a fifth of the whole portfolio is a tenth of the whole portfolio—child weights are not added on top of parent weights. Optional public tickers/ISINs and declared region, sector, bond-type and duration tags stay local. Matching can use explicit tags or a literal qualified identifier in a market headline; there is no ticker resolver, price lookup or fund look-through. See the [minimal example](config/portfolio.example.yaml), [detailed ETF/stock/bond example](config/portfolio.detailed.example.yaml) and [portfolio guide](docs/portfolio.md) for the schema, tag lists and privacy boundaries. Both examples are synthetic format data, not allocation recommendations. Older files without `holdings` remain valid. The percentages weight item relevance and executive-summary priorities. Selected reviews, impacts and local alerts gain a **Local portfolio lens** and a check to consider. Matching a wrapper and asset class never counts an allocation twice; cash in a CTO is not treated as equities, and a Livret A announcement is not assumed to cover LEP. The report uses overlap bands rather than printing allocations. These are topical relevance estimates, not predicted losses or product recommendations. A percentage portfolio's severity-2 watch needs at least the configured `portfolio_watch_min_percent` overlap (default 10). Major events remain eligible without a direct match; confidence, source quality, freshness, cooldown, quiet hours and speculation gates are never weakened. External notifications remain generic: portfolio lenses and allocations are **not** sent to notification helpers. Use `--portfolio /private/path/portfolio.yaml` for another file. An explicit `--profile` selects the legacy profile instead of automatic portfolio discovery; the two inputs are never merged. Missing or invalid explicitly selected portfolios fail before network access rather than silently reverting to a generic report. Raw positions and percentages are not copied into JSON, SQLite or logs. Local reports contain derived notes; scores, ordering and alert eligibility also depend on the input, so keep generated outputs private. No portfolio file is created unless you explicitly copy a template or import CSV; no personal financial details need to be shared with the assistant. ### Import a percentage CSV ```bash cp -n config/portfolio.example.csv config/portfolio.csv chmod 600 config/portfolio.csv # Edit locally; example instruments and weights are synthetic, not recommendations. python csv_to_portfolio.py config/portfolio.csv --output config/portfolio.yaml # Equivalent: finance0 portfolio import-csv config/portfolio.csv ``` Required columns are `wrapper,asset_class,percent`. For detailed positions, add `name,kind,percent_of_position` and optionally the existing instrument metadata columns. One row describes one holding; repeat its parent `percent` unchanged. Parent weights are counted once, and each supplied child breakdown totals 100. Coarse positions can leave all holding cells blank. No amounts or broker/account columns are imported. See the [CSV format guide](docs/csv-import.md) and [synthetic CSV template](config/portfolio.example.csv). Comma, semicolon and tab delimiters, UTF-8 BOM, quoted cells, decimal commas and percent suffixes are supported. Conversion validates before writing private YAML; existing output needs explicit `--force`. It never fetches, logs holdings, or writes a database. Settings default to `low` / 10 years unless provided with `--risk-tolerance` / `--horizon-years`; an existing YAML file is not merged. ### Optional local profile (legacy) Copy `config/profile.example.yaml` to `config/profile.yaml` if desired. The example is empty. Only wrapper/asset buckets (`none`, `small`, `medium`, `large`) or coarse percentages, low/medium risk tolerance, and a horizon are accepted. Unknown fields and exact balance/account/credential fields are rejected. No personal details are requested. The profile is never sent to sources, models or notification helpers, never logged, and never persisted in SQLite or `data.json`; only derived relevance scores and alert eligibility use it. Keep this local file private (`chmod 600`). ### Alerts: `config/alerts.yaml` Defaults are **no external notifications**, confidence at least medium, a delivery cooldown, a freshness gate and Europe/Paris quiet hours. Official/institutional releases can qualify directly; press triggers require high configured reliability and matching evidence from distinct source groups. Community text never alerts. Triggers cover regulated-rate and monetary-policy announcements, enacted tax changes/budget milestones, counterparty actions, regulator scam warnings, explicitly measured broad-index drawdowns, sovereign spreads, inflation thresholds and energy shocks. Numerical thresholds only operate on scoped, period-matched, primary-verified observations; forecasts do not become observed shocks. Coverage is limited by enabled sources and available excerpts, not a real-time market monitor. Severity starts at review-soon for qualifying major events; a budget milestone can remain watch-only. A held area can make a watch eligible, but never bypasses confidence, freshness, source-quality, noise, cooldown or quiet-hours gates. Every alert follows the fixed “What happened / Why it may matter / What to check / What not to do / Links” template, includes the disclaimer, and links a playbook. Dry-runs do not consume notification deduplication or cooldown. Successful delivery is deduplicated; a delivery whose outcome is uncertain is **not automatically retried**, because it may already have reached the user. Audit it before manually resetting state. No delivery channel has been configured or activated for you. For a host push channel or email integration, configure a **local trusted helper**: ```yaml notification: channel: command command: ["/absolute/path/to/my-local-notify-helper"] ``` Then explicitly use `finance0 check-alerts --notify`. The helper receives the public alert JSON on stdin, with `shell=False`, bounded runtime and no profile. It can integrate with your host/email system outside finance0. No email credentials are requested/stored here; source content can never choose the command or argv. ### Education and calendar `config/knowledge.yaml` contains directly reviewed, dated official educational material, not current market figures. Old dates are retained and called out. Readings are marked **surfaced**, not actually read, after successful report output; previously surfaced links are not repeated. Extend the catalog with dated, checked sources to grow the glossary and keep new readings available. Publication precision is preserved: a date-only page does not acquire an invented timestamp. `config/playbooks.yaml` holds non-prescriptive checklists. `config/calendar.yaml` is intentionally empty until current official notices are reviewed. Add verified, dated entries (or sourced recurring review reminders) before export; no ECB meeting schedule or legal deadline is guessed. See [implementation notes](docs/implementation.md). ## Scheduling No scheduled task is installed automatically. For example, after editing paths: ```cron # Daily collection, no push by default 0 8 * * * cd /absolute/path/finance0 && .venv/bin/finance0 run # Optional LLM summary via Pi RPC (no tools; sends only public item fields, never the portfolio) 5 8 * * * cd /absolute/path/finance0 && FINANCE0_PI_MODEL= .venv/bin/finance0 summarize # Weekly archive-only digest 0 9 * * 0 cd /absolute/path/finance0 && .venv/bin/finance0 digest ``` A single-writer lock prevents overlapping invocations from collecting or sending duplicate alerts. Source fetch frequencies remain in force for on-demand runs. Changing notification cadence/channels requires explicit local configuration. ### Telegram Optional send-only delivery publishes `output//llm_summary.md` only when `llm_summary.meta.json` matches the current collection run, input-data hash and summary hash. Missing, stale, modified or legacy summaries fall back to the current `briefing.md`, which must match `data.json`'s `briefing_sha256`. Report, data and summary reads/writes coordinate through a per-folder artifact lock. Older output without a run ID/report hash must be regenerated; do not manually bless old reports by adding metadata. Create a bot with **@BotFather** and `/newbot`. Message your bot, then call the official Telegram Bot API `getUpdates` method locally using its token to find `message.chat.id` (for a group, add the bot and message it there; for a channel, grant posting permission and use its chat id). Keep the token and API URL out of logs, screenshots and shell history. Set `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` in the scheduled environment only; there are no credential flags or configuration files in finance0. For example, source a private file **outside this repository** that exports both variables: ```cron 0 8 * * * cd /absolute/path/finance0 && . /private/path/finance0.env && make daily PI_MODEL= ``` Replace the separate daily collection/summary cron entries with this line rather than scheduling both. Pi must already be logged in for the optional summary. `make daily` keeps summary or Telegram failures from failing a successful collection. Without Telegram configuration, publishing is skipped with an error message. ```bash finance0 publish-telegram --dry-run # count parts and preview 200 characters; no token needed finance0 publish-telegram --date 2026-10-24 # explicit delivery; defaults to today UTC ``` Delivery is plain text, split into ordered messages. Synthetic runs and digests are refused. Only the above report files and daily metadata are read; no profile or `config/portfolio*` is read or attached. The publisher also reads summary provenance and its dedicated delivery ledger. **Publish public content only**: local briefings can contain derived portfolio lenses, and generated summaries are not independently verified, so review the selected file before sharing. A group or channel exposes its briefing to all members. A dry-run prints a small excerpt locally but creates no delivery reservation and makes no network request. It previews content; it does not predict the ledger's skip/review decision. #### Repeatable delivery and uncertain sends Publication uses a dedicated `state/telegram.sqlite` ledger (override with `--state`, but keep the same path across scheduled runs). It stores hashed chat identity, run ID, rendered-content hash, report day, status, attempt count and last-update time—never the token, raw chat ID or message text. A process lock covers the entire send; a durable `pending` reservation precedes any request. - Already-delivered content is skipped, even if a new collection has a new run ID. - By default, at most one successful publication is allowed per report day and destination. This also prevents a second `make daily` from resending slightly different model prose or timestamp-only report changes. - To deliberately share a changed same-day report, review it and use `publish-telegram --date YYYY-MM-DD --allow-update`. Identical delivered content is still skipped; an uncertain send cannot be bypassed with this flag. - Any failed/interrupted send becomes `uncertain` (a crashed `pending` reservation is recovered as uncertain next time). Further publication to that destination stops until explicit review. Some message parts may already have arrived. - After checking Telegram, resolve the publication ID shown in the error: ```bash # Use delivered only when the complete publication arrived. finance0 telegram-resolve --publication-id PUBLICATION_ID --resolution delivered # Otherwise explicitly permit another attempt; this may duplicate earlier parts. finance0 telegram-resolve --publication-id PUBLICATION_ID --resolution retry ``` Resolution sends nothing. `retry` clears the review gate; rerun publication separately after reviewing the selected content. Pass the same `--state` path to both commands if customized. A later run may select changed content rather than resume the original parts. There is no automatic partial-message resume or exactly-once guarantee from the Telegram API. Keep the ledger: deleting it or changing its path loses deduplication/review history. Pre-ledger manual sends cannot be discovered automatically. An explicitly selected old daily folder can still be published; provenance checks bind it to its run, not to today's date. ## Verification ```bash python -m unittest discover -s tests -v ruff check finance0 tests/test_finance0.py tests/test_portfolio.py tests/test_portfolio_csv.py csv_to_portfolio.py python -m compileall -q finance0 vosfinances vosfinances_hot.py csv_to_portfolio.py ``` Tests use synthetic feeds, items and intercepted browser pages, never live sites. They cover all PRD acceptance categories: blocked-source degradation, top-five selection, noise/injection exclusion, numerical provenance/conflicts, horizons, alert thresholds/template/dedupe/cooldown, privacy, seen history and output lint. The existing browser selector tests remain available when Chromium is installed. ## Important limits The baseline uses deterministic English topic analysis rather than an LLM. It is not full-article translation, semantic fact-checking or editorial judgment. Numeric verification deliberately refuses ambiguous context, mixed series, missing periods, forecasts and unsupported units. Missing evidence is visible, not filled with model memory. With a headline-only feed, the analysis is correspondingly limited. The enabled feeds do **not** currently provide complete French regulated-rate, insurance-flow/yield, tax-law or market-stress coverage. Disabled/failed sources and unsupported details are listed in Caveats. Fees can be flagged as a theme, but a cross-product fee comparison needs additional primary product data. No autonomous LLM mode, live market-data subscription, P2 portfolio tools or P3 dashboard/Q&A has been implemented. Silence or a quiet report is not an assurance that nothing happened. finance0 is an information and education tool, not financial, legal or tax advice. Verify information with official sources and consider consulting a licensed professional before making decisions.