Skip to content

docs: add CLAUDE.md, and mark the repo split as done - #5

Open
scobb wants to merge 1 commit into
mainfrom
docs/claude-md
Open

scobb wants to merge 1 commit into
mainfrom
docs/claude-md

Conversation

@scobb

@scobb scobb commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Claude Code loads CLAUDE.md automatically, and this repo had none — so every session started with none of this context. AGENTS.md's own Future: Repo Split note already called for one.

Every item is traceable to something that actually went wrong, not general advice. Generic guidance ("write tests", "follow conventions") was deliberately left out: this file loads every session, so anything not repo-specific and non-obvious just crowds out the parts that matter.

Section The incident it prevents
Verification bar A QA matrix was skipped on a change that "felt diagnostic"
— prove the guard fails Page-load guards passed on first run and proved nothing until the code was broken deliberately
Positional batchRes[n] Removing one statement silently reassigns every later index
— non-uniform test data A first integrity test was useless because every seeded row was US/Chrome/desktop
public.ts has two templates A click handler went into the embed widget; the button rendered and did nothing
Rows, not queries The three COGS docs are wrong by ~5 orders of magnitude
— MIN(fn(col)) Defeats the index: 48.5ms → 0.0ms on identical data
— don't trade D1 reads for KV writes KV writes are the tightest budget
Green PR ≠ shipped Four merges went undeployed behind passing checks
CI skips migrations Still-live landmine
Non-prod writes to prod Happened twice in one day

Changes

  • CLAUDE.md (80 lines) — verification bar, the analytics-batch hazards, D1 cost model, deploy gotchas, and the PUBLIC_BASE_URL trap
  • AGENTS.md — one line added to the existing Local Dev / Wrangler Dev Gotchas for PUBLIC_BASE_URL, pointing at CLAUDE.md rather than duplicating it
  • AGENTS.md — Future: Repo Split rewritten as Repo Split — done

On the repo-split note

It described a split that has already happened. It claimed Beam "currently lives in ralph-bootstrap/beam/ as a subdirectory", but the remote is scobb/beam, the repo root is standalone, and CI deployed from here successfully today.

Rewritten to say what is actually true, and to record the one genuine loose end: the pre-split ralph/beam branch still exists on the remote (last commit 2026-05-25, 6eb0f4b), superseded by main. Left for a human to confirm and delete rather than assumed safe. The original plan also called for prd.json and progress.txt; neither was carried over and neither has been missed.

Style note

Failures are stated as facts with their consequences ("Four merges once went undeployed this way") rather than as rules. A future session that understands why generalises correctly to situations this file doesn't anticipate; one following a checklist won't.

Test plan

  • Docs only — no source or test changes
  • npm run typecheck passes
  • npm run test — 116 tests, 112 pass, 0 fail, unchanged

🤖 Generated with Claude Code

Claude Code loads CLAUDE.md automatically and this repo had none, so every
session started without any of the context below. AGENTS.md's own "Future: Repo
Split" note already anticipated one.

Every item in it is traceable to something that actually went wrong, not
general advice:

  - Verification bar. A route returning 200 is not evidence a feature works,
    and a test that passed on first run has proven nothing — break the code,
    watch it go red, restore it. Blast radius is set by the code you touch,
    not by your intent; a "diagnostic" change to a hot path earns the same QA.

  - The analytics batch. Results are read positionally (batchRes[11],
    batchRes[15]), so adding or removing a statement silently reassigns every
    later index and country names start appearing under "Browsers". Uniform
    seed data hides this — each dimension needs a distinct signature and
    distinct visitor counts, since panels sort by visitors and ties reorder.

  - routes/public.ts renders two different pages (public dashboard and the
    /embed/:siteId widget) as separate templates in one file. A script added to
    the wrong one fails silently: the page renders, the button does nothing.

  - D1 bills rows scanned, not queries. COGS-REPORT.md, docs/cogs-analysis.md
    and cost-ceiling.md all count queries and are wrong by orders of magnitude.
    Also: MIN(fn(col)) defeats the index, D1 caps at 10 GB per database, and KV
    writes are the tightest budget — never trade a D1 read for a KV write.

  - A green PR is not evidence anything shipped. Typecheck & Test can pass while
    the deploy job fails underneath; four merges once went undeployed that way.
    CI also runs `wrangler deploy` only, so it never applies D1 migrations.

  - PUBLIC_BASE_URL is unset everywhere, so `wrangler dev` and the smoke suite
    write real pageviews into production analytics. The smoke suite starts its
    own server on 8787, so running a dev server on another port does not
    protect you. Cross-referenced from AGENTS.md's dev gotchas.

The repo-split section is rewritten as done: the extraction into scobb/beam has
happened, CI deploys from here, and CLAUDE.md now exists. The one remaining
loose end is the pre-split ralph/beam branch (last commit 2026-05-25, 6eb0f4b),
which is superseded by main.

Docs only — no source or test changes. typecheck and the 116-test suite pass
unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant