whiskers.git / backend / worker / CLAUDE.md
1@README.md
2
3## Notes for agents
4
5- **No merge rule here.** `src/documents.rs` calls `MemoryDoc::merge`, `Household::merge` and `ChatState::merge` of
6  `whiskers-core`. A rule that needs to change changes there.
7- **Do not put an `await` between a document's read and its write** (`documents::merge_in`, `object.rs`). That is
8  what makes a merge atomic on both hosts: celld lets an event that awaits overlap another.
9- **Config is the shared subset**: `wrangler.jsonc`, no `routes`, binding names distinct from `vars` names (both hosts
10  refuse a clash), `main: ./build/index.js` with `no_bundle` (`build/worker/shim.mjs` re-exports `../index.js`, which a
11  prebuilt Worker cannot import on either host). A Cloudflare route belongs to the deployment overlay, not this file.
12- **Never log content.** Nothing here writes a document, a fact or a body to the log: counts, statuses, kinds. A
13  parse error's own text quotes the input; log `classify()` instead.
14- **The `/_hub/...` routes exist only in the test mode** (`Households::is_testing`); keep it that way, so a
15  deployment cannot serve them.
16- **There are no stand-ins.** `ObjectBackend` implements a capability (`HasMemory`...) only for a port the Worker really
17  has, and `lib.rs` gives the service only the routes for those. Never add a port that answers "not here" to satisfy a
18  bound: if a route's bound is not met the route is not served, and the compiler is what says so. Moving a capability onto
19  the Worker means a real implementation, its `Has…` impl, the `.serve(...)` of its routes, and its fixture in the
20  conformance harness (`documents.rs` tests).
21- The `log` level is `WHISKERS_LOG`, as everywhere in Whiskers.