Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ These are tested by name (`rule_R…` in `test/`). A change that weakens one is
jurisdictions.
8. "Model text" only when the page's own banner says the code is adopted without amendments.
9. Page text is untrusted. Claude gets refs, never addresses, and no section text by default. The
screenshot fallback is off by default and lets Claude point at numbered marks, nothing more.
screenshot fallback lets Claude point at numbered marks, nothing more. It is on by default (the
owner's decision, 1 December 2026, `docs/adr/0011-chosen-for-the-user.md`), is a setting the user
can turn off, and the screens say that it sends screenshots of code text.
10. Every page load is paced, below everything else. The hard limits are in `src/shared/validation.ts`.
11. App code loads only codes, chapters and code lists (`permittedAutomated`), and, to sign in with a
saved password, the site's own home or sign-in page (`permittedSignIn`). Tool arguments and
Expand Down Expand Up @@ -103,8 +105,18 @@ original plan and any signed-in notes stay out of the repository (see `.gitignor
`folderName` (`src/shared/file-names.ts`), which never give a device name.
- **Validate at the boundary.** Everything arriving from the screens or from Claude's tool arguments
is parsed with zod before use.
- **Models are discovered from the user's key.** Do not hard-code a model id in `src`. First
preferences for a fresh install are in `assets/models.default.json`.
- **Models are discovered from the user's key.** Do not hard-code a model id in `src`. The models
the app chooses, and how hard Claude thinks for each kind of work, are in
`assets/models.default.json`. An empty `Settings.model` means automatic: read the model through
`resolveModel` (`Workspace.modelFor`), never straight from settings, and never write a model ID
into the user's settings. Send an effort only through `effortFor`. Every model the app may choose
by itself needs a price in `assets/pricing.json`, or the spending limit cannot see it.
- **The user chooses nothing in Settings.** Every setting has a value that works, and all but the
API key and the spending limit render only under **Show advanced settings** (`src/ui/advanced.ts`).
A new setting goes in the advanced part with a default that needs no thought, and is never removed
to hide it. Stored preferences hold every value, so a changed default needs a migration to reach an
existing install (`0010_chosen_for_the_user.sql` is the pattern). Do not speed up the pacing
defaults to make the app "more powerful": rule 10.
- **An Electron test script that throws while loading would hang on a dialog.** Always run them
through `test/run-electron.cjs`.
- **The synthetic site is the only site the tests touch.** Nothing in CI reaches the network.
Expand All @@ -118,10 +130,17 @@ original plan and any signed-in notes stay out of the repository (see `.gitignor
every screen inside one (`src/ui/App.tsx`).
- **A Claude call made for a queued pull names the pull** (`RunSpec.jobId`, or `jobId` on a run the
caller records itself). Without it, its cost is missing from the pull, the plan and the queue's
Claude cost panel. Keep every such call within fixed token budgets that `pullCeiling` in
`src/shared/claude-cost.ts` prices (`QUEUE_SEARCH_TOKENS` via `Limits.tokens`, `VISUAL_LIMITS`), with
the input budget checked against each request before it is sent, or the queue's "at most" figure
stops being true. Requests and plans have no token limit; only the queue's own calls do.
Claude cost panel.
- **No call to Claude has a token budget, and every call checks the month's spending limit first.**
The owner removed the token budgets on 1 December 2026; do not add one back. What stops a run that
goes in circles is its steps and its working time. What bounds the money is
`Settings.spendLimitUsd`, a kill switch: a new place that calls Claude reads the spend state
(`Workspace.spend`, passed as `spend` to the runtime and to `lookForSection`) before each request
and sends nothing while it is reached, or the limit stops being true. That includes a request sent
again after a failure: save what the failed attempt cost, then check. Never reset or skip it for a
kind of work. The month's spending is `claude_months`, which `runs.save` adds to as a run's usage
grows; record a Claude call's usage through `runs.save` and it is counted. That table is not
content: `clearContent` must keep it.
- **Saved site passwords:** page programs in `src/sites/upcodes/sign-in.ts` take field names only;
`test/security.test.ts` checks it. Focus a field with `evaluate(…, { afterLoad: true })`: `typeInto`
refuses a page that is still loading. Sign-in uses `ctx.driver.openSignIn` and `ctx.driver.pace` so
Expand Down
Loading
Loading