* feat(ai-budget): keep a fifth of each day's free pool for people on their first week
Pacing keeps the day from being spent before lunch, but not by evening:
there is no clawback, so whoever signs up at 21:00 can meet a pool the
vendors have already refused — a first answer that never comes, which is
the moment a person decides Loki is broken.
lib/ai-budget/newcomer-reserve.ts: returning accounts together stop at 80%
of the day's capacity; an account under seven days old may draw on the
rest, still under its own fair share. getDayUsage now also returns the
day's total (same query as the active count). The gate reads the
account's age only once the total reaches the held part, and fails open
if it cannot; a paid plan with allowance left is not held back. The
refusal says what the held part is for, when the day starts over, and the
ways past it; the budget screen reads the same rule, so it never shows
"12 left" to someone the gate will refuse.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CG9dupSVqoXCCqKfBCfd9B
* fix(billing): payments stay off until switched on, whatever pay URLs are set
Live after #1293: every paid plan's button on /pricing read "Pay in
Bitcoin" and went to an OrangeCat product page that answers 404. The
three ORANGECAT_PAY_URL_* were set on the box before the passes existed;
while the tiers had no price that was invisible, and setting the prices
turned the dead links on — skipping the reservation flow they were meant
to fall back to, and showing "Buy" in Settings → Billing too.
orangeCatPayUrl now also requires LOKI_PAYMENTS_OPEN=1. Opening payments
is a decision (the company registered, the passes live), so it is a
switch, not an inference from a URL. Until then every paid plan's button
reserves, as designed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CG9dupSVqoXCCqKfBCfd9B
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat(plans): CHF 15 / 40 / 90 with a monthly AI allowance, reservable until payments open
The founder set the prices on 2026-10-17. Payments stay off until Loki's
company is registered, so everything up to the moment of paying works and
nothing is charged:
- config/plans.ts: Personal 15, Pro 40, Team 90 a month; each states its
monthly allowance. The billing note says payments are not open and that a
plan can be reserved with nothing charged.
- lib/plan.ts: PLAN_LIMITS.aiAnswersMonthly (1,000 / 3,000 / 8,000 at
8,000 tokens an answer — about $0.002 each on a paid open model, a
fraction of the price).
- lib/ai-budget/plan-allowance.ts + gate: past the daily free share, a paid
plan's month still admits the turn. Read only after the share refused, so
a free turn never pays for it; a failed read leaves the refusal standing;
a lapsed or past-due plan has none.
- /pricing: four priced cards. A paid plan's button opens /pricing/<plan>,
which reserves it (plan_reservations, one row per person, grants
nothing) — and reads "Pay in Bitcoin" the day its OrangeCat pass exists.
- The out-of-answers refusal and the budget screen offer the plans beside
the person's own key; Settings shows a plan's allowance left this month.
- Settings → Billing links each plan's reserve page; System → Revenue shows
who is waiting on which plan, and counts only plans a settled pass pays
for (a hand grant is "granted", not revenue).
- docs/architecture/models-and-money.md follows the decision.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CG9dupSVqoXCCqKfBCfd9B
* test(ai-budget-gate): answer the plan read without a database
The gate now asks a paid plan's allowance after the share refuses. The
existing gate tests did not inject it, so where CI has a real Postgres the
default read opened a pool that kept the process alive and the runner
timed the file out. Every call now passes `planAllowance`, as the file
already does for the ledger and the capacity.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CG9dupSVqoXCCqKfBCfd9B
---------
Co-authored-by: Claude <noreply@anthropic.com>