Skip to content

docs(sdk): skills say how to keep a total several people change at once - #1184

Merged
allisonmahmood merged 1 commit into
mainfrom
docs/skills-shared-totals
Nov 2, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
docs/skills-shared-totals

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

What changed

Owned tables have no count or sum. Asked for a button with a live company-wide count, Sonnet 5.5 kept building a tier 1 page that paged through every row to add them up. That reads the whole table on every change in every open page, and a page-side counter loses concurrent cheers. The skills never said how to keep a total: the tier guidance offered tier 2 for "atomic multi-row writes" and said live sync works on tier 1. The judges on #1172 traced their findings to that gap.

Now:

  • patchy-tables has a short Totals section. It says to keep an exact total as its own row, changed by the same tier 2 mutation that writes the rows it counts.
  • The tier lists in the global skill and in patchy-loop name "a value such as a total that several people change at once" as a reason for tier 2.

Part of #1141.

Look at

Measured with pnpm dev eval. Both sides ran cheers three times per builder, plus one uncounted warm-up. The only difference between the sides is this commit: base 316cdf2, head c2749fc, the same edit on top of the eval branch.

Build Base (skills today) Head (this edit)
sonnet tier 1, pages through every row, 4/4 tier 2, mutation updates a counter row, 4/4
terra tier 2, counter row, 3/3 tier 2, counter row, 3/3

Every build passed every check on both sides. Sonnet is the one that changed. Its head builds even shard the counter, so many simultaneous cheers don't contend for one row:

export const cheer = mutation({
  handler: async (ctx) => {
    const shard = `s${Math.floor(Math.random() * SHARDS)}`;
    const found = await ctx.tables.tallies.list({ index: "byShard", eq: { shard }, limit: 1 });
    const row = found.rows[0];
    if (row) await ctx.tables.tallies.update(row.id, { count: row.count + 1 });
    else await ctx.tables.tallies.insert({ shard, count: 1 });
    return true;
  }
});

The cost. Tier 2 is more work for the builder. Sonnet's medians went from 1.9 to 2.9 minutes, from 784k to 1,266k input tokens, and from 0 to 2 failed commands. Terra's were flat or better. With identical skills, input tokens have moved about 40% between sides on noise alone, so I'd read only the direction of these.

What wasn't scored. The judges in this run predate #1172's sandbox fixes and gave no verdicts, so design quality comes from reading the published sources, not from scores.

How it was verified

  • The suite above: 12 measured builds and 2 warm-ups, all passing, with the tier and counting approach read from each published source.
  • skillLock.test.ts passes with the refreshed hash of the global skill. SdkApi.test.ts, initProject.test.ts and limits-md.test.ts (39 tests) and the format check pass.

Release impact

Tick exactly one.

  • Breaking — requires action from anyone already running this

  • Not breaking — no action required. Skill text only; builders get it with the next release's skills.

  • What does a revert leave behind? Nothing. Patches built while it was live keep their tier 2 counters, which are ordinary patch code.

  • Does the release before it still work with that? Yes.

Built by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, through T3 Code.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:s Under 100 changed lines labels Nov 1, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol)

Verdict: merge. No blocking or non-blocking findings on head 7e0605f6ba6294466f19f4bb21ccede6ba56c776.

Checked the claims in packages/sdk/skills/patchy-tables/SKILL.md:94 against the implementation:

  • Owned tables expose row reads and writes, with no count/sum operation (packages/patchy/src/client.ts:98, packages/api/src/runtime.ts:404). Computing a whole-table total through list requires fetching its row pages. Subscriptions track table revisions and rerun separately for each document, so subscribed page-side totals repeat that work as the table changes (packages/primitives/src/SubscriptionReads.ts:73, packages/runtime/src/Subscriptions.ts:458). Wakes can coalesce; the text does not promise one rerun per individual write.
  • Mutations use SERIALIZABLE transactions and retry the whole handler, up to three attempts within the original deadline (packages/primitives/src/MutationTransaction.ts:157, packages/runtime/src/Invocation.ts:756). Exhaustion returns write_conflict with no committed writes. Therefore “makes concurrent changes add up” is honest about consistency: successful changes accumulate, and a failed attempt commits neither the counted rows nor their total. It does not guarantee every request succeeds. The existing paragraph at patchy-tables/SKILL.md:82 and patchy-server/SKILL.md:190 already document that bound and failure. I also inspected the concurrent-counter and exhaustion cases in MutationTransaction.postgres.test.ts:217 and :311.
  • A generated tier 2 query supports subscriptions and can read the total row (packages/patchy/src/serverClient.ts:35, packages/runtime/src/QuerySubscriptions.ts:92). Tier 1 updates assign supplied field values without combining the preceding page read into a transaction, so concurrent read/modify/write increments can overwrite one another (packages/primitives/src/TableOperations.ts:553).

Distribution and wording: the two tier-choice edits agree with each other and with patchy-server. The new section is concise, factual reference and scripts no questions for the person. SDK generation reads the canonical skill files directly (packages/sdk/src/Generation.ts:549); the global bundle is copied during build, and the checkout's agent paths are symlinks. The refreshed SHA-256 matches. No checked-in generated copy or quoted test fixture needs updating. The README/product/ADR tier summaries remain compatible; no wire, CLI behavior, dev-loop, vocabulary, migration, resource, rendered-page, reverse-state or package-layout change triggers another surface update.

Validation: pnpm exec vitest run packages/patchy/src/skillLock.test.ts packages/sdk/src/SdkApi.test.ts — 23 tests passed; git diff --check passed; working tree clean. No dev eval, application instance or production access.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 7e0605f6ba6294466f19f4bb21ccede6ba56c776 (base 1f187a92b2c20da81e8a1d647ea28a60a075d6ef) on fresh team data, by GPT-6.1 Sol in the Codex harness through T3 Code. I did not write this change.

Done means

  • Skills explain exact shared totals and when they require tier 2: passed. The global and project tier guidance agree; the generated tables skill includes Totals. The advice matches the SDK: owned tables expose no count/sum, direct updates assign supplied values, and tier 2 mutations run in a serializable transaction with bounded whole-handler retries.
  • Sonnet builds the counter approach: passed in both independent runs. Ran one suite at the exact head: pnpm dev eval --only-head --tasks cheers --builders sonnet --repeats 2 --concurrency 1 (Sonnet 5.5, high). Read both final published snapshots, rather than their working copies. Each has one counter row, a unique key index, a query reading at most one row, and a mutation inserting or incrementing that row. Each page subscribes with useQuery(patchy.server.cheers.total, {}). Neither pages through cheer records or reads/modifies/writes the total in the browser. Both builders initially chose tier 1 and moved to tier 2 after reading the project skills.
  • Distribution and lock remain valid: passed. Verified the revised global skill in the sandbox template and revised project skills in the builder repo; the SHA-256 matches the lock. The focused skill-lock, SDK API, init-project and limits-doc suites passed 40 tests. git diff --check passed.

Golden journeys

  • Publish and open a page: passed twice. Each final published patch was tier 2, typechecked and opened ready without grading-time page/runtime errors.
  • Shared cheers across colleagues: passed twice. The task check keeps Ada's observed count unchanged when Ben merely visits, then increments it for Ben's and Cleo's cheers.
  • Tier 2 concurrent counter semantics: passed. Independently ran the real-Postgres tests for eight concurrent increments / fifty hot-row calls and retry-bound exhaustion: 2 passed, 15 unrelated cases skipped. Successful increments match the stored total; exhausted retries return write_conflict rather than silently losing committed increments.

Evidence from the two completed run records (suite 20261101T164700-7e0605f):

cheers/sonnet/1: built, pass=true
  published: pass (launch-cheers v1, tier 2)
  typechecks: pass
  opens ready: pass
  each cheer reaches a third colleague: pass
cheers/sonnet/2: built, pass=true
  published: pass (launch-cheer v1, tier 2)
  typechecks: pass
  opens ready: pass
  each cheer reaches a third colleague: pass

All applicable CI checks on this head were green when checked, including browser, tier2-smoke, postgres-concurrency, the Node/Bun offline suites and release-tarball; the conditional Attio/Pidgeon suites were skipped.

Rollback answers: match the diff. This changes skill text and its hash only. Reverting leaves any patches already built as ordinary, previously supported tier 2 code. No schema, wire contract or data migration needs a one-way label. Distribution is the affected mirrored surface; no other wire, CLI behavior, dev-loop, vocabulary, migration, resource, rendered-page, reverse-state or layout change applies.

Not run

  • An independent base/head A/B measurement, Terra runs or judge scoring: this head supports HEAD-only evals; base comparison and judges are later work. This is a two-run behavioural replication, not a remeasurement of the author's efficiency figures.
  • Simultaneous browser-click stress on these generated patches: the task's colleague check is sequential. Concurrency was checked with the real-Postgres runtime tests and inspection of the published handlers.

Notes

  • Reproduced the known fix(dev): an eval suite finishes even when a builder leaves a connection open #1154 shutdown hang after both successful runs, before scorecard generation. The evidence above comes from each saved run.json and published source. Stopped the runner by verified checkout-owned PID and cleaned up this run's instance; no second suite was started.
  • The cheers task rubric at this head still says tier 1 is enough and asks for no server code. No judges ran here, so it did not affect these results; that rubric should agree with this guidance before using judge scores to assess the counter approach.

allisonmahmood added a commit that referenced this pull request Nov 2, 2026
…led where (#1172)

## What changed

A comparison showed whether builders passed the checks and how fast, but
not whether what they built was any good. It couldn't say whether a
build fit Patchy, whether it stayed correct when two people used it at
once, or whether it was pleasant to use.

Now, after the build phase, two judges review every built run in the
eval's sandbox: Opus 5.5 at `xhigh` in Claude Code, and GPT-6.1 Sol at
`xhigh` in Codex.
- **Scoring pass, blind.** Each judge scores fit, platform, correctness,
UX and code from 1 to 5, with findings.
- **Attribution pass.** For findings of medium severity or worse, the
judge reads the skill text and the builder's log, and says which text
plausibly led there or what was missing.
- **Calibration.** `pnpm dev eval --calibrate` checks both judges
against builds a person labelled.

Closes #1143 together with #1155, which it's stacked on.

## Look at

**What keeps the scoring pass blind.** Six review rounds tightened it to
this:
- **The source it reads** has its agent instructions removed, and the
side's instance host renamed. A pulled repo records the host, e.g.
`after-…`, in `patchy.json`, `package.json` and the lockfile.
- **The Patchy checkout it reads** is this checkout, the same for both
sides. A walk masks every copy of what builders are told: `skills/`
folders, release `artifacts/`, `.turbo` and dependency caches, agent
folders, `SKILL.md`/`AGENTS.md`/`CLAUDE.md`, the git history, local
state and the calibration labels. A symlink is never a mask; a symlinked
instruction file hides its target instead.
- **Its workspace** is staged under an anonymous name, so no mounted
path names a run, side or builder. The staging is removed afterwards.
- **Its network** reaches only its harness's inference and sign-in
hosts, by exact name. Each connection must open TLS naming the host that
was vetted, so a shared CDN can't serve another site on the same
connection. The harnesses' own web search and fetch tools are off.
What's left: a request that names another site inside a correctly named
TLS session is the CDN's to refuse. That's documented in `network.ts`.

**Failures.** A judge failure never takes the suite down:
- A pass that gives no answer is tried once more.
- A judge that can't run records why.
- A failed attribution keeps its score.
- If the judges' home can't be set up, every judgment says so and the
scorecard still lands.

**Calibration** on the final code. Both judges ranked every labelled
pairing the labelled way:

| Better | Worse | On | Opus | Sol |
| --- | --- | --- | --- | --- |
| cheers-counter | cheers-page-counter | platform, correctness | ✓ 5.0
vs 1.0 | ✓ 4.5 vs 1.0 |
| cheers-recount | cheers-page-counter | correctness | ✓ 3.0 vs 1.0 | ✓
2.0 vs 1.0 |
| cheers-counter | cheers-recount | platform | ✓ 5.0 vs 2.0 | ✓ 5.0 vs
2.0 |

**#1143's done-means run** at 5fef167: `pnpm dev eval --base origin/main
--tasks cheers --repeats 2`, both builders, both judges. Every run was
judged by both (16 of 16 verdicts). The skill text is the same on both
sides, so the deltas are noise:

| Task | Builder | Verdicts | Fit | Platform | Correctness | UX | Code |
| --- | --- | --- | --- | --- | --- | --- | --- |
| cheers | sonnet | 4/4 → 4/4 | 4.0 → 4.0 | 2.3 → 2.0 (−0.3) | 2.5 → 2.8
(+0.3) | 4.3 → 4.5 (+0.3) | 3.3 → 3.0 (−0.3) |
| cheers | terra | 4/4 → 4/4 | 4.8 → 4.8 | 4.5 → 4.8 (+0.3) | 4.3 → 4.5
(+0.3) | 4.3 → 4.3 | 4.5 → 4.8 (+0.3) |

The judges consistently separate Sonnet's page-side count from Terra's
tier 2 counter on platform. Their attribution, independently, names the
gap #1184 fills. From Opus:

> No skill says that owned tables have no count or aggregate. None says
that an exact running total should be one counter row, incremented by a
tier 2 mutation.

**cheers' rubric** now names today's expert design, a tier 2 atomic
increment read through a live query, instead of saying a tier 1 page is
enough.

## How it was verified

- **Tests.** `scripts/dev/src/eval/eval.test.ts` passes on Node and Bun
(35 tests). They cover:
- the checkout masks, including the symlink case, caches and the
calibration labels
  - the blind source copy
- the exact-host network, and the refusal of `raw.githubusercontent.com`
  - TLS server-name parsing against a real Node ClientHello
  - the closed schemas, task brief, means, splits and verdict counts
  - the calibration labels

  Typecheck, test typecheck, lint and format pass.
- **Real bwrap.** All masks mount over a built checkout, and grepping
`/patchy` finds no skill text.
- **Live runs.** The calibration and the done-means run above. Both ran
with #1154's shutdown fix applied locally, so the process exits after
the scorecard.
- **Review.** Sol reviewed this six times; its last verdict is merge,
with one P3 that was fixed.

## Release impact

Tick exactly one.

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required. Dev tooling only;
`--no-judge` skips the judges.

- **What does a revert leave behind?** Only files on this machine, under
`.local/evals/`.
- **Does the release before it still work with that?** Yes. Nothing
outside the dev runner changed.

Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3
Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the docs/skills-shared-totals branch from 7e0605f to 1ace4fe Compare November 2, 2026 12:27
@allisonmahmood
allisonmahmood merged commit e2a5116 into main Nov 2, 2026
24 checks passed
@allisonmahmood
allisonmahmood deleted the docs/skills-shared-totals branch November 2, 2026 12:39
allisonmahmood added a commit that referenced this pull request Nov 3, 2026
…tals stay exact (#1222)

## What changed

This adds release 35's What's new entry, written from `dd0e2ec`. It
covers everything merged since release 34's `through` (`e5334ca`), and
sets the `patchy` release to `0.35.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| Fixed: keyboard shortcuts in patches do what they say (a
once-per-press shortcut doesn't fire again while held, shortcuts wait
during input-method composition, symbol keys such as `+` work on every
keyboard) | #1152 |
| Improved: agents keep shared totals exact | #1184 |

The rest get no line:
- #1147, #1154, #1189, #1155, #1172 and #1153 are `pnpm dev eval`
tooling.
- #1150 renames a CI check.
- #1203 is an internal docs paragraph.
- #1221 changes the production spend alerts, which nobody using Patchy
sees.
- #1149 is release 34's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `11dc68b` (release 34) to
`dd0e2ec`:**
- None of the 11 PRs is labelled `one-way`, and each one's Release
impact answers say a revert leaves nothing behind.
- #1152 changes `patchy/hotkeys`, which patches bundle when they are
built. Published patches keep the copy they bundled. A patch repo that
writes `"+"` stops typechecking only if it moves back to an older
`patchy` release.
- #1184 is skill text. #1147 adds a dev-only personas option that
production never reads.
- #1221 changes a cost setting on the two budgets in the base stack.
Releases don't read budgets.
  - Nothing else touches code that runs in production.

**Rollback line:** If this release misbehaves, roll back to `11dc68b`
(release 34).

## How it was verified

- **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and
`schemas.test.ts` pass (21 tests), and `bun fmt` passes on the changed
files.
- **Deploy state.** I pinned the live commit from `/healthz/deep`:
`11dc68b` (release 34). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Text and version numbers only. Like every release, the `0.35.0` bump
tells CLIs and patch repos installed before this deploy to upgrade.

- **What does a revert leave behind?** Nothing.
- **Does the release before it still work with that?** Yes.

Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3
Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant