# Data placement

Source and artifact bytes go to R2. Convex holds records, read and written in pages, never per file. The approved bounded sealed-secret record exception is described below.

This page lists every byte store and every Convex table: what it holds, and whether it grows with repository size (one row or object per file or physical object), with activity (per save, landing, run or event) or stays fixed (per project, account or setting). The guard in `tests/hot-storage-invariant.test.mjs` enforces the byte rule; its allowlist is reproduced below. Each row of the Convex tables list is its own file, [`data-placement.d/tables/<table>.md`](data-placement.d/tables/), named after the first table it lists; a new table adds a new file there.

## Byte stores

| Store | Holds | Grows with | Written by |
| --- | --- | --- | --- |
| R2 `v1/p/<project>/o/<sha256>` | Project objects: file contents, State manifests, Work metadata, recipe leaves, source-job outputs, cursors (`r2source:`), checkpoint roots, exchange-cache artifacts. Content-addressed, create-only, checksum-bound PUT. | Repo size | Presigned PUTs from the CLI and hosted workers; `storeSourceBytes`, import upload, `storeProjectArtifact` inside Convex actions. |
| R2 `v1/p/<project>/…` archives and packs | Backup and proposal archives, original-archive receipts, source packs, check logs. | Activity | Presigned PUTs; `archiveTarget`, `projectSourcePacks`. |
| R2 `v1/p/<project>/o/<sha256>` history chunks | Imported Git history: the Git host's pack bytes unchanged (same commit ids), split into content-addressed chunks of at most 32 MiB; pinned by `projectHistoryPacks`. Chunks a fetch created but never recorded (over the limit, failed or stale) are deleted at once, with one scheduled retry if a delete fails. | History size, up to the project's history limit (default 1 GiB) | `projectHistoryImport` (import run, read catch-up, first [Git serving](git-serving.md) request of a mirrored project). |
| R2 `v1/p/<project>/o/<sha256>` history tree indexes | [Git serving](git-serving.md) Lane refs: one object per imported or catch-up history pack holding only its trees (whole or as deltas; 1.65 MB for this repository's 25 MB pack), pinned by `projectHistoryPacks.trees`. Removed with the project's history. | Trees of stored history | `gitServeTrees.indexPacks` (scheduled once when a pack is recorded). |
| R2 `v1/p/<project>/o/<sha256>` Lane Git packs and alias object | [Git serving](git-serving.md) Lane refs: one pack per fetched Lane head (its built commit plus the trees and blobs the parent commit lacks) and its side-band framed copy for protocol v2 on the Worker path, pinned by `projectGitLaneCommits`, and one JSON map of source SHA-256 to Git blob ids for the last built head and base, pinned by `projectHistory.laneAliases`. A replaced pack or alias object, and packs of closed Lanes, are deleted when the next build records. | Changed bytes of fetched Lanes; aliases about two States of ids | `gitServeLane` (first Git fetch of a Lane head). |
| R2 `v1/p/<project>/o/<sha256>` Forge main packs, object sets and tree listings | [Git serving](git-serving.md) on a project without a GitHub mirror: Forge-built commits for main's landings, whole objects only (each pack holds what no earlier pack has), pinned by `projectHistoryPacks` rows with source `forge`; per pack row an object set (sorted ids of its trees and the ids they name); per Forge row its tip tree listing. Merged Forge packs and their sets and listings are deleted when the merge records. | Changed bytes of main's landings, counted in the history limit; object sets about 20 bytes per object | `gitServeMain` (first Git ref listing after landings). |
| R2 `v1/i/…`, `v1/d/…` (`r2blob:` refs) | Indexed import artifacts and binary derivatives, through `artifactBlobs`. | Repo size per import | `blobStore(ctx).store(..., { r2Namespace })`. |
| Convex file storage | Legacy copies only (written before R2 was the only path), until Issue 40dad5e0 moves and deletes them. | Nothing new | Nothing. No code calls `storage.store` or `generateUploadUrl`. |
| Convex documents | Records below. Large values are paged; byte bodies are pins (`digest`, `size`, `r2Key`), not bytes. | See tables | Mutations. |

**Placement rule** (`r2Config()` in `convex/r2.ts`): every deployment writes R2, self-host included, for every project. There is no opt-in, flag or Convex byte mode. If the `R2_*` settings are missing, writes fail with `R2_NOT_CONFIGURED`. A self-hosted instance can point `R2_ENDPOINT` at any S3-compatible bucket. Rows written earlier in Convex storage stay readable from it until backfilled.

### Account identity-link audit

`authLinkEvents` holds small, secret-free identity-grant receipts: user/session,
method, operation/request digest, identity id and timestamp. The grant and audit
commit in one transaction; the `(userId, operationId)` index reconciles retries.
No provider profile, code, OAuth token or source bytes belong here. This is
account metadata, independent of projects and landings: zero bytes written per
landing, recorded in the landing storage ratchet. Normal auth component records
remain in their component. Source and artifact bodies remain in R2.

## Guard allowlist

Every entry has an owner reason and expires on 2027-01-31; an expired entry fails the guard. Kinds: **write** (`storage.store`, `generateUploadUrl`), **read** (`storage.get`, `storage.getUrl`, `storage.getMetadata`), **handle** (a `ctx.storage` value passed on), **field** (`v.id('_storage')`), **native-url** (`nativeLegacyUrl` references outside the shared read seam).

| File | Kinds | Why |
| --- | --- | --- |
| `convex/legacyStorageRead.ts` | read | Shared legacy read seam. On a Convex miss, a tombstone pins the R2 copy. Byte reads verify size and SHA-256. URL reads sign a five-minute GET for the exact copy key. |
| `convex/blobStore.ts` | handle | Deletes existing legacy copies. Every upload goes to R2. |
| `convex/projectWorkIndexRetry.ts` | handle, native-url | Wraps the native Convex reader for Work index retries. |
| `convex/storageMeter.ts` | handle | Wraps native Convex reads for egress diagnostics. |
| `convex/projectR2Backfill.ts` | field, native-url | Backfill reads the native source of each legacy copy it moves. |
| `convex/r2BackfillFields.ts` | field | Backfill names each legacy Convex copy it moves. |
| `convex/projectBackups.ts`, `convex/projectBackupActions.ts`, `convex/projectProposals.ts`, `convex/projectProposalActions.ts`, `convex/projectExchange.ts`, `convex/projectLifecycle.ts`, `convex/projectObjectFields.ts`, `convex/projectHostedActionsPlan.ts`, `convex/projectHostedFinishDriver.ts`, `convex/projectSourceStepFields.ts`, `convex/projectWorkIndexFields.ts`, `convex/schema.ts` | field | Legacy `storageId` columns, readable until cleanup. |
| `convex/projectBootstrapStore.ts`, `convex/projectGithubImportBatch.ts`, `convex/projectGithubImportObjects.ts` | field | Legacy `storageId` receipts beside the R2 key; nothing new writes them. |

The approved dev cleanup also uses legacy `_storage` pins in
`convex/legacyStorageCleanupFields.ts`, `convex/projectLegacyStorageCleanup.ts` and
`convex/projectLegacyStorageRepair.ts` (field allowlist, expires 2027-01-31). It deletes
only verified frozen-manifest files; the repair records a backfill time and moves no bytes.

## Invitation metadata

`projectInvites` remains the single invitation store: target as typed, optional
handle-account binding, inviter, role, expiry, state, answer receipt and projected
mail status. The schema also accepts team-scoped rows, which share the indexed
recipient page. Older inbox callers still receive only project invitations. Email targets acquire no account binding until acceptance. Rows are
retained as metadata; no source, email body, token or attachment bytes enter them.
The staged team writer uses one row per request and the same store for relative
revocation generations. Direct team adds with an operation ID keep a digest-only
receipt in that store so retries can reconcile when the writer switch changes. Once a team has issued invitations, the team row holds a
generation counter and removing a member keeps that account's last removal
generation. The team deletion job purges these rows in the existing bounded
cleanup. No landing or access check reads team invitations.
`projectAccessOperations` keeps retry receipts, its compatible mail projection,
and one small invitation-generation counter per project that has a removed or
lowered member. That counter omits `operationId`; request writers require a
string operation id, so they cannot collide with it. Invitations record their creation generation; the existing
`projectActorNames` membership-provenance row records that recipient's removal
generation. These metadata fields replace a history scan or per-invitation
revocation writes; they contain no address-to-account lookup.
`invitationBlocks` is a recipient-owned account preference, indexed by recipient
and inviter and by address digest for delivery suppression. It is independent of
any project and deliberately survives a project purge; the project purge
inventory therefore has no project-owned row to remove. The recipient-only
handlers and negative tests guard its owner boundary. No automatic retention or
cleanup is introduced. Existing `deviceAttempts` rows hold fixed-size invitation
rate counters, reset in place, with no timer. The landing storage ratchet records
zero invitation/block bytes per landing. Runtime mail and invitation operations
are separately bounded in [access](access.md#scale).

## Convex tables

| Tables | Hold | Grows with |
| --- | --- | --- |
| `abuseReports` | Abuse reports in the operator review queue: target, reported account, reason (at most 1,000 characters), an excerpt of what was reported (at most 1,000 characters) and review state. One row per report; at most 10 or 30 a day per reporting account. Never returned by a public function. | Activity, bounded by the report limit; removed with a purged project |
| `accountProjectOrder` | Account > Projects order (Item 3d5d8839): one row per person and project they own or are a member of (role, activity hour). Written on project creation and grant add/remove in the same transaction. A landing that opens a new hour bucket for its project schedules `touch`: one run per 100 rows still at an older hour, continuing only while such rows remain (at most 24 hours per project per day; acceptance adds no read). Removal deletes up to 500 rows in its own transaction and the rest in bounded scheduled cleanup (100 per run); until that finishes, the read's removal and role checks keep the project out of every list. Restore and the one-time backfill rebuild rows in bounded runs (at most 900 index ranges each, progress carried between runs). An ordering hint, never access: the read re-checks the role. Purged with the project. | Fixed per membership (~120 B and three index entries); per project-hour with landings: calls ceil(people/100) touch mutations ($2/M) plus row I/O of each row read and rewritten once, ~124 B each way ($0.20/GB). 151 people: 2 calls ($0.000004) + 152 rows read and 151 rewritten, ~37.5 KB ($0.0000075) = ~$0.0000115 per project-hour. Per 1,000 landings divide by landings per project-hour L: worst case L = 1 gives $0.0115 (0.68% of $1.688); 2 people $0.0021, 21 people $0.0030, 1,001 people $0.072 |
| `forgeAccounts`, `accountHandles`, `accountItems`, `accountOperations`, `handleOperations`, `cliCredentials`, `deviceCodes`, `deviceAttempts`, `agentGrants`, `agentEvents`, `agentUserSettings`, `agentGuidanceOperations`, `agentGuidanceMaintainerOperations`, `teams`, `savedViews`, `interestChanges`, `clientErrors` | Accounts, credentials, agent grants, teams and settings. | Fixed |
| `gitWorkerUsage` | Large-pack Worker use per UTC day: packs and bytes per project and for all projects ('*'), checked before a redirect and counted before bytes flow; rows older than 7 days are deleted when their scope is next written. Discussion attachment downloads use the same rows under `attachments:<project>` and `attachments:*` scopes (bytes reserved before R2 is read, refunded on a failed read; `packs` counts downloads). | Git fetches served through the [large-pack Worker](git-serving.md#large-packs); discussion attachment downloads |
| `githubBindingInstallations`, `githubBindingOperations`, `githubBindingRemovals`, `githubBindingWebhookReceipts`, `githubDeliveries` | GitHub App installations and webhook receipts. | Activity |
| `githubRepositoryVisibility` | Last GitHub visibility read per runner repository (private projects only), overwritten in place and reused for 5 minutes. | Fixed, one row per runner repository |
| `githubRunnerGrants` | One row per Forge owner and runner repository proven by configure-runner. | Fixed |
| `hostedProjects`, `projectSlugs`, `projectContributors`, `projectInvites`, `projectReaders`, `projectReaderOperations`, `projectAccessOperations`, `projectActorNames`, `projectPolicyChanges`, `projectInterests`, `projectBriefingSources`, `projectSourceAuthorityTransitions`, `projectSourceCutovers` | Project identity, access, policy, authority, one optional paused-mirror direction boolean, and one physical-seed job/State pointer (no source bytes). `projectActorNames` stores former-member provenance and invitation revocation metadata. Its schema accepts no provider display names. `hostedProjects.by_owner_and_removal` (replaced `by_owner`, same index count) keeps a person's active projects and removed ones (`trash`, `deleting`, `deleted`) in separate ranges; it costs +5 key bytes per project, fixed, and 0 per landing. | Fixed |
| `imports`, `importArtifacts`, `importReaders`, `importRemovalOperations`, `teamImports`, `sourceZones`, `zoneChanges`, `zoneReaders`, `derivedArtifacts`, `artifactBlobs` | Indexed public imports, Zones, derivatives and `r2blob:` metadata. | Repo size, per import |
| `invitationBlocks` | Recipient-owned invitation block preferences; no project ids or content bytes. | Explicit recipient preferences |
| `legacyStorageCleanupPages` | Retry receipts for approved maintenance pages; no file bodies. | Maintenance pages |
| `legacyStorageCleanupWindows` | One metadata fence per approved dev cleanup window; closing it invalidates older deletion transactions. No source or file bytes. | Approved maintenance windows |
| `legacyStorageTombstones` | One legacy storage ID and its verified R2 copy pin, plus the retirement operation ID and optional media type. Indexed by storage ID. No file bytes. | Legacy read-through after a Convex file miss |
| `personDays` | A person's contributions (Item 6a251b23): one row per person (account id) per active UTC day with that day's counts per project (landings and those by agent runs, Lanes started, reviews, Items closed, planning comments, first and last action, up to 40 agent runs with their Lane and landing counts and declared model, comments per run, a mark when planning work was not all counted; `src/person-days.ts`), about 106 B per project-day plus about 42 B per run. Written only by each project's day close (one read and one write per person active on each day it files, plus one range of the Work change rows since the previous closed day and one command read per planning edit or comment; nothing per landing, nothing for an idle project). The profile reads at most 366 visible days (scanning at most three pages of rows) once per view and drops removed projects and every project the viewer may not open. No titles, source, paths or device names. | Grows per active person-day |
| `planningReactions` | One row per person, comment and reaction kind (eight kinds); a toggle, not history. Reads return counts only, never who reacted. | Planning activity, at most 8 per person per comment |
| `projectBackups`, `projectProposals`, `projectUploadCleanup`, `projectRecoveryConnections` | Backup and proposal archive rows (R2 key, legacy `storageId`) and upload cleanup. | Activity |
| `projectBoardClaims` | Automatic file claims: one row per Lane and unsaved path written ("touching PATH"), at most 30 live per Lane, 14 days; hidden once the Lane saves the path or closes. | Activity, bounded by retention |
| `projectBoardMessages`, `projectBoardInboxes`, `projectBoardSenders`, `projectBoardProjects`, `boardAccounts`, `boardSwitches`, `boardAudit`, `boardEvidence` | Agent board notes (at most 240 characters, 14 days, 5,000 per project), per-target inbox and rate-window counters, account day totals, operator switches and audit, and body-free evidence rows. | Activity, bounded by retention |
| `projectCoordinationClaims`, `projectCoordinationEvents`, `projectCoordinationReceipts`, `projectCoordinationSessions` | Live coordination (advisory). | Activity |
| `projectDeleteRequests` | Bulk permanent-delete requests (Item 7456856f): one account-owned row per request, at most 100 frozen project entries (id string, slug, revision, newest landing id, stored bytes) and their per-project outcome. Written on prepare, on the owner's decision and once per project when its purge ends; read through one subscription. Kept as the account's deletion receipt; project ids are plain strings so a project purge does not treat it as project-owned. Zero bytes per landing. | Fixed per request |
| `projectFailures` | Failure log (Item 2c420916): one row of about 300 bytes per failed operation or failed landing (kind, code, scrubbed message, time to fail), written only when it fails; read by `nforge metrics ROOT --failures`; 30-day expiry. The landing-storage guard permits zero bytes per healthy landing. | Failures |
| `projectFeedEvents` | Compact Lane wake-up records. Project and Lane indexes order historical reads by event time and live reads by database commit time. New rows carry the optional commit position. A new event prunes up to two older-than-14-day rows in the same project. Project purge includes the feed. | Activity, inline retention |
| `projectFinishReadRows`, `projectHostedLandingRequests`, `projectHostedLandingAttempts`, `projectHostedLandingBatches`, `projectHostedLandingQueues`, `projectHostedLandingQueueStatus`, `projectHostedLandingDesired`, `projectHostedLandingAliases`, `projectHostedLandingCheckWakes`, `projectHostedLandingObservations`, `projectHostedFinishes`, `projectHostedStallAlerts`, `projectLandingSpeed`, `projectHostedApprovals` | Landing queue, finish records and compact Plan authority/Work-pointer/generation headers; the existing `projectLiveLineSummary` row also holds seven UTC landing-count buckets (under 512 additional bytes per project), maintained in its existing main write and read by public pages instead of full receipts, and the Flow view's rolling day (24 hour buckets, 48 land-to-main samples and main's verdict, under 1.5 KB, also read by the project lists and public pages that read this row) stepped in its existing exit write; an accepted landing's private runner accounting can retain a small fallback contribution after a closed Stats day adjustment fails, cleared in the existing accounting write when another correction succeeds; `projectHostedApprovals` holds one approval request per Lane; `projectLandingSpeed` holds one project's last 7 days of landing timings for the regression alert. | Activity |
| `projectGitMainCommits` | [Git serving](git-serving.md) on a project without a GitHub mirror: one small row per Forge-built main commit (State, commit id, tree id, landing sequence), written with its Forge pack, so a Lane based on any landed State builds on that commit with one indexed read. No bytes. | Landings on unmirrored projects that Git requests reached |
| `projectGithubImports`, `projectGithubImportInventory` | GitHub import jobs and their paged inventory (keys and positions per page). Optional migration metadata is four nullable origin counts and an unavailable reason on the existing job (63 JSON bytes for the 1k/2k complete synthetic totals), never account identities or per-Issue rows. Inventory rows are deleted once the import is published. | Repo size, during an import |
| `projectGithubMirrorStops` | At most one row per project naming the mirror job that stopped terminally; deleted on resume. | Projects |
| `projectHistory`, `projectHistoryPacks` | Imported Git history: one status row per project (repository, import commit and State, stored bytes, owner limit, cached trailer of one joined pack set) and one row per Git pack (tip commit, R2 chunk pins, pack checksum, object set; Forge packs also their tip State, tree, tree listing and last landing), never one per commit. | Imports, history reads and Git ref listings after main's mirror moved |
| `projectHostedChannels`, `projectHostedOperations`, `projectHostedLifecycleEvents`, `projectHostedLifecycleGuards`, `projectHostedLifecyclePlans`, `projectHostedLifecyclePointers`, `projectHostedMainAudits`, `projectHostedMainAuditEvents`, `projectHostedTrust` | Channels, operation receipts, Lane lifecycle and main audits. | Activity |
| `projectHostedCheckRuns`, `projectHostedCheckShards`, `projectHostedCheckCallbacks`, `projectHostedCheckWorkers`, `projectHostedCheckSettings`, `projectHostedCheckSettingVersions`, `projectHostedTestTimings`, `projectHostedActionsExports`, `projectHostedActionsResults`, `projectCheckRequests`, `projectCheckRunners` | Check runs, shards, results and settings. | Activity |
| `projectHostedComposes`, `projectHostedComposePages`, `projectHostedComposeSelections`, `projectHostedAcceptances`, `projectHostedAcceptanceEvents`, `projectHostedAcceptancePages`, `projectHostedAcceptancePlans`, `projectHostedAcceptanceSnapshots` | Candidates, acceptance and their pages. The health report facts (Item 2c420916) add 35 JSON bytes to one existing acceptance document in both storage fixtures, with no new index or extra publication read or write. | Activity |
| `projectHostedConflictNotices` | Exact conflicts at save (flip 4): one row per Lane and other side (a Lane or main) with file paths, line ranges and the other Lane's goal (at most 160 characters); closed rows stay as the lead-time record. No file bytes. | Activity |
| `projectHostedFrictionHints` | Bounded duplicate-candidate replay receipts when inline hints would exceed a friction row. Written atomically with capture and removed on project deletion. | Overflow captures |
| `projectHostedOutputStreams`, `projectHostedOutputChunks`, `projectHostedOutputHeads`, `projectHostedOutputSummaries`, `projectCheckLogCleanups`, `projectCheckLogCleanupPages`, `projectCheckLogRetentions`, `projectCheckLogSourcePins` | Check output in bounded text chunks and its cleanup. | Activity |
| `projectHostedOverlapLanes`, `projectHostedOverlapMain`, `projectHostedOverlapMainLog` | Saved-path projections behind peers, behind-main and the trial merge; the log keeps the newest 64 landings' paths. | Activity |
| `projectHostedParks` | One row per open parked Lane (Item e1633718): the Lane id and the account whose Needs me lists it (the named holder's, or the starter's when no one is named). Written only when that account changes, deleted when the park is cleared or the Lane closes and with the project; unparked Lanes have no row, so it adds no index entry per landing. The park itself (holder, reason, time) is on the Lane record and its presence row. | Activity |
| `projectHostedPresence` | One slim row per open Lane (Issue, goal, up to 10 saved paths, handle-mapped actor, last activity) for presence; deleted when the Lane closes. | Activity |
| `projectHostedRecords`, `projectHostedRecordHeads`, `projectHostedRecordBodies`, `projectHostedDisplayRecords`, `projectHostedSnapshots`, `projectHostedSnapshotHeads`, `projectHostedSnapshotPages`, `projectHostedDecisions`, `projectHostedDecisionMaintainers`, `projectHostedFriction` | Work records (Intents, Lanes, decisions), snapshots and display copies. | Activity |
| `projectHostedStackDependents` | One row per open Lane stacked on a parent Lane (parent Lane, pinned parent head, the parent's newest saved head and a conflicted automatic restack head, marks of the parent events already announced); written only by stacked Lane records, deleted when the Lane closes or unstacks and with the project. | Activity |
| `projectHostedStates`, `projectHostedSaves`, `projectHostedSavePages`, `projectHostedSyncs`, `projectHostedSeeds`, `projectHostedSeedPages` | Saved States and their paged inputs/outputs. | Activity (pages, not files) |
| `projectInitiativeWorkMembers` | Issue 2040b35e. Project-owned metadata with one summary per initialized Initiative, one marker per distinct receipt, and one row per distinct Candidate path. The summary pins its Work record partition for freshness. A scheduled fold writes one receipt, one summary update, and new path rows. Rebuilds replace obsolete membership in bounded pages. Independent landings write zero rows. Removed with the project. | Grows with distinct Initiative receipts and paths |
| `projectIntentLandingNotes` | Landing receipts on Items (Issue 3a733ee8): one row per Item-started or unmarked legacy Intent per landing or revert receipt. Completion ticks add later Lanes to that row. Verified seven-day capsules move the original note to R2, leaving its indexed identity, Lane attribution and capsule reference in the row. Item discussion and owner planning export read both forms. Pre-existing capsules without notes leave those note bodies live. Removed with the project. | Full bodies for recent and unpacked legacy notes, compact references for packed notes |
| `projectItemRetention` | One compact deadline and one attempt record per scheduled Deleted Item. A daily indexed range reads due attempts across projects. The Deleted list joins deadlines one page at a time, independent of retries. Restore clears both rows and completed purges retain only the ID, version and completion time for exact replay. Project purge clears the records. | Scheduled Deleted Items and completed purges |
| `projectLandingReads` | History read state (Items 9e748e41, c613e6bc): one row per account and project, a read-through landing sequence plus at most 500 one-by-one reads above it; written only when a person marks something read, never by a landing (zero bytes per landing). The same row holds Needs me's FYI state (`fyi`: the Clear all time and landing sequence, plus at most 200 dismissed row versions), written only on Dismiss, Clear all or Undo. Removed with the project. | Fixed per account and project |
| `projectLaneSnapshots` | Unsaved-work snapshots of a Lane checkout (policy `autoSnapshot`, Issue 7ac4e32f): one slim row per snapshot or undo/redo/restore move (head, tree digest, page and pack pins, counts; no file bytes) plus one Lane row with its expiry job. Bytes live in R2 under `v1/p/<project>/s/<lane>/`, one pack object per snapshot (its pages and new files); at most 64 MiB per snapshot and 512 MiB per Lane; the whole Lane expires 14 days after its latest snapshot and `x snapshots {"purge":true}` deletes it for real. | Activity, bounded by retention |
| `projectLiveLineLanes` | Source-free stage/hold/overlap marks (plus a short check key while checked and a main-red flag), deleted on close or landing. | Activity |
| `projectMetricFacts` | A save-head fact retains the Lane/head key, canonical creation time, save ID and body timestamp. Write-once metrics aliases retain a lookup key, source time and business ID or compose pin. Shifted runs also record a creation-time key and a day witness. Internal bootstrap checkpoints and completed root markers use a separate key prefix. The current source record retains the payload and provenance. | Activity |
| `projectObjectCatalog` | Sorted immutable object descriptors from imports or explicit compaction, 256 per row (digest, size, recipe or packed byte range; physical packs retain protected source pins), instead of one `projectObjects` row per object; `findObject` reads it. | Repo size / 256 |
| `projectObjectReceipts` | Original upload-id, nonce, size and digest pins after immutable descriptors move into catalog pages; current project access still gates replay. Bounded migration cursor receipts use the same table. See [storage compaction](operations/storage-compaction.md). | Compacted descriptor count |
| `projectObjects` | One row per physical object: digest, size, placement (`r2Key`, `location`, legacy `storageId`), recipe pin. No bytes. | Repo size |
| `projectPlanningRecords` | Planning roots, versions, comments and search fragments; thirteen custom B-tree indexes plus search, confined to planning rows. | Planning activity |
| `projectPublic` | One row per public project for signed-out discovery (Item 8947a779): listed flag, star count, the owner's Lane-title opt-in, the fork's upstream pointer and a weekly activity summary written at most once per 10 minutes by the public read; no source, plan text or people. Deleted with the project. | Discovery |
| `projectPublications`, `projectPublicationAttempts`, `projectPublicationPages`, `projectGithubBindings`, `projectGithubMirrors`, `projectGithubMirrorJobs` | Publication and GitHub mirror state. | Activity |
| `projectReadBudgets`, `projectStorageUsage`, `accountStorageUsage` | Abuse-limit counters (`convex/abuseLimits.ts`): signed-out read calls per public project in the current window, and reserved stored objects and bytes per project (sharded) and per owning account (added in roll-ups); fixed rows per scope, reset or updated in place. | Activity, bounded by shard count |
| `projectReleaseSignatures` | Owner Ed25519 signatures over released States with their release number (64 bytes each, at most 4 per State); verified by the CLI updater. | Releases |
| `projectSavePurges` | One receipt per owner save purge (Item 9d3c407d): the save, the purged paths and blobs (at most 100), who and when, and the R2 keys or pack ranges still to clear. A retry reads it by operation id; one `marked` row at a time per project serializes purges. Written only by an owner purge, never per save. Project purge clears the records. | Owner purges of leaked saves |
| `projectSelfMetricReceipts`, `projectSelfMetricBills` | Self-metric receipts and recorded bills. | Activity |
| `projectSlugs` | Project addresses (Item eb631a53): one row per (owner, slug) naming the project that holds it. A project keeps its current address and its most recent old ones, at most 10 (`PROJECT_ALIASES`, convex/projectAliases.ts); every claim (create, rename, restore) releases aliases past the true newest 10 from the oldest end, 100 per run, continuing in scheduled runs, and the one-time `projectAliases:trimAll` migration (25 projects per run by cursor, at most 51 index ranges and 2,500 deletes per run, idempotent) caps histories written before. A released address answers Project not found and is free again. Slugs are at most 100 characters. A removed project's address may be taken by a live one. Purged with the project (by_project). | Fixed per project, capped: at most 10 rows at 100-character slugs, ~312 B document + ~282 B of keys in its two indexes (by_owner_and_slug ~210 B, by_project ~72 B) each, so at most ~6 KB and 20 custom index entries per project; 0 per landing |
| `projectSourcePacks` | Latest source pack per project (R2 key and pins). | Fixed |
| `projectSourceSteps`, `projectSourceTasks`, `projectSourceBatches`, `projectSourcePools` | Source-job steps, fan-out tasks and worker pools, including one bounded physical seed per project; cursors, membership pages and pack tails are `r2source:` pins. | Activity |
| `projectStars` | One row per person per starred project (account and project id only). Deleted with the project. | Discovery |
| `projectStatsDays` | Stats (Items a61d3c91, 2cf30e0a): one row per project per closed UTC day with landings: counts, sorted seconds and the own-history replay (`src/stats-estimate.ts`), about 2 KB of summary at 100 landings a day. The optional `runnerContributions` column retains the landing keys and replay flags needed to adjust cancellation usage after close. At 1,000 landings, the fixture measures 67,024 serialized bytes for this column (~67 B/landing, plus 19 B per explicit resubmission flag). A one-day Stats query reads the whole row: 85,519 B with the column vs. 18,495 B without in that fixture, with the same four metered reads and the same reply. At $0.20/GB, the extra read is roughly $0.013 per 1,000 one-day reads. These are fixture bytes and a cost estimate. The first landing of a later day schedules the day close; a cancelled-run report can adjust the row afterward. Removed with the project. | Grows per active day |
| `projectStatsMonths` | Stats All time (Item a61d3c91): one row per project per closed UTC month: the totals of its measured days, each sorted distribution kept as at most 400 quantiles (`src/stats-period.ts#statsMonth`), a few KB at 100 landings a day and at most about 30 KB. Written once a month, by `projectStats:rollMonth`, which the first close of a later month (or a re-close) schedules; never written by an idle project. All time reads these rows plus the open month's day rows, never every day. Removed with the project. | Grows per active month |
| `projectTeams` | One row per project and linked team with that team's role, `read` or `write` (Item b6588425, docs/access.md#teams). A separate row, not a field on the project or team, so a team is reusable across projects and later ownable by an organization. Written only by the owner person (`projectTeamAccess.set`), with the project's `teamLinks` count and `teamRevision` in the same transaction; at most 50 per project. Read by `teamGrant` only when `teamLinks` is set and the direct grants miss, so owners, direct members and projects without teams read none. Deleted when the team is purged, the project is trashed (with the direct grants) or the project is purged. | Fixed per link (~120 B); no per-landing or idle cost |
| `projectWorkDataRecords` | Source projections, `viewFiles`, non-planning `:payload` parts and `_workStore*` comparison rows; six custom B-tree indexes. | Source/Work projection size |
| `projectWorkGenerations`, `projectWorkHeads`, `projectWorkEvents`, `projectWorkDetailMigrations`, `projectReturnPages`, `projectReturnSupersessions` | Work projection generations, heads/events, migration and return pages; canonical history remains separately retained. | Activity |
| `projectWorkRecords` | General Work projections, including activity/status readers; eight custom B-tree indexes. | Activity |
| `secretObjects`, `secretVersions`, `secretGrants`, `secretEvents`, `secretDeletions` | Encrypted Secret Objects and grants. | Fixed |
| `teamMembers` | One row per team and member. Carries the member's handle (Item a841a76d) so Account > People and teams reads handles with its rows, never one account per person: set when the row is written, patched when the person's handle changes or their account is created (100 rows inline, the rest in scheduled runs of 100), filled once for older rows by `teamHandles.backfill`. The page's read is person-only and page-level: at most 61 operations per page of 20 teams in the query body, plus the usual browser sign-in reads (metered with realistic ids for full teams: 67.1 KB read, 27.6 KB returned; caps 70 KB and 32 KB), no writes, no subscription. | Fixed per membership (~150 B with handle); a handle change rewrites one row per team the person is in; no per-landing cost |
| `users` | One Convex Auth-to-Forge account mapping per account; numeric GitHub identity, verified email only, optional owner-bound encrypted GitHub App credential. No source bytes or session history. Component sessions/passkeys remain in their own components. The landing-storage guard permits zero bytes per landing for this table (Item de67c77d). | Fixed per account |

Canonical Candidate file readers negotiate `candidate-source-files`. Their
source-only R2 listing pins the exact base
and head and contains changed paths, modes and blob identities, with no people
or Work payloads. Candidates composed before listings existed still open through
the two exact State manifests; CLI provenance retains its canonical history
reader. All compose producers (public, finish, batch, GitHub inbound and culprit)
write the listing unconditionally, with no environment setting.
Small, stepped and fixed workers build one
listing from their already verified manifests; publication pins its digest/size
as server metadata on the immutable Candidate, with no new landing RPC. Old
indexed readers of a Candidate carrying that pointer return `CLI_UPGRADE_REQUIRED`.
Compatible canonical Candidate header reads keep their original shape.

The unconditional-listing fixture budgets (Issue `91df7eda`) account for one
R2 object and its descriptor: the dogfood recompose retains 109 B more Candidate
metadata and 424 B more `projectObjects` JSON. Existing R2 counters add 1 B each
to the source step, landing request, finish-read header and speed row, and 7 B to immediate landing
observations; no new Convex call or per-file row is needed. The 29k/58k ancestry
fixture accounts for two descriptor reads and one descriptor write per listing
inside its existing source calls; its history-growth and memory bounds remain.
The batch fallback guard keeps its controller write bound and separately allows
at most one descriptor mark per distinct new listing pin in existing calls.
The six-landing mix
adds exactly four PUTs and four GET/HEADs; the inbound fixture adds one of each
and 631 uploaded bytes. These are synthetic deltas, not billed usage. The cost
ledger retains a Class B warning for a pre-existing 0.83 request difference
between its old budget and the current baseline, separately from the approved
0.67 listing requests per landing.

Legacy projection writers remain unchanged. Existing `projectWorkDataRecords`
rows are unchanged; no migration or deletion runs implicitly. See the [replacement and migration plan](research/placement-review.md#s4-per-file-projections-leave-convex).
Those writers stay in Convex by design: the [S4 remaining-writers verdict](research/placement-review.md#s4-remaining-writers)
sizes each one and proposes a single change, onboarding without per-file rows.

The policy-history index on project and the previous mirror's enabled flag selects
one recorded direction for pre-Pause disabled mirrors. It adds one index entry per
policy-change row; no new table, source bytes, landing write or idle function.
Explicit Resume selects current main and its acceptance metadata, then reuses the
existing mirror job queue. One selected latest job under the existing receipt
index is compared with the current repository (case-insensitively), so a completed
publish to an old repository cannot suppress catch-up to a new one. No mirror-job
index entry or key bytes are added. The paused window becomes one catch-up
commit, not one job per paused landing. Its first seed reads the mapping's receipt
and at most 21 acceptance rows by sequence to list the first 20 subjects and a
remainder count, then pins that message. Adjacent publishes add zero history
reads; replays read the pinned seed instead of rebuilding its message.

## Planning search

Before filing an Issue or friction, search for an existing planning item and
comment on it instead of creating a duplicate. One `planning {"search":"relevant words","limit":10}`
is enough; `status:"all"` also finds closed work. Page `nextCursor` only to browse, never
for a duplicate check: each search is billed at the whole index size. Search is read-only,
ranked by Convex full-text relevance, and filters status/kind/initiative inside the
search index. Omitted status includes proposed/open/in-progress; an explicit status
is exact. Cursors bind the search, filters, page size and generation. `query` reports
the actual normalized terms and any terms omitted by the provider’s 16-term bound.
List/search summaries include `initiativeId` (null when unassigned), `bodyLength` and
`hasDoneWhen`. Unprepared legacy payload headers report null for unknown body
metadata; preparation fills it without per-item list reads. A detail read requires a complete UUID; validation names `id` and its shape.

New Issues and friction captures return `likelyDuplicates`, a bounded five-result
search of active Issues before creation. This is advisory: it adds no confirmation
or denial. Original-operation retries retain the original candidates. Partial or
unavailable index coverage is named. Search does not reconcile Intent status.

Search materialization normally adds one derived `planningSearch` row per current item in
the planning partition of the Work index, atomically maintained by planning writes and rebuilds.
Search previews bound title/body to 400 characters and report lengths/truncation;
full source remains unchanged. Rows are measured with Convex's physical-size helper.
Oversized text uses 16k-character, whole-word fragments plus a compact current root;
search returns each item at its best matching fragment, rejecting retired versions.
Fragment pages can contain fewer items or no items; follow nextCursor to completion.
Legacy generations report `partial-needs-preparation`. After deployment, the owner
can explicitly run `projectHostedPlanningPrepare:page` with projectId, owner, exact
generationId, a fresh operationId per page and cursor:null initially, then the
returned nextCursor until isDone. Replay the same page/operation after an unknown
reply. Each page prepares at most 20 items/4 MB of search-row output, plus metadata on
legacy payload headers; source and history remain
unchanged. An item can span output pages; cursors pin its version. Each operation
hydrates at most one payload-bearing item (up to 100 existing payload parts). Larger
legacy payloads report WORK_INDEX_REBUILD_REQUIRED and use the existing paged index
rebuild; they are never silently excluded from complete coverage. Reads never start a preparation or rebuild.

A search page makes one external Convex query after capability discovery (a cold
client adds one discovery query). A fresh managed CLI also reads release metadata
once before dispatch: three steady-current queries for a cold CLI search in total.
MCP pays release/discovery at startup, then one query per warm search. Startup bytes
and update work are separate and unmeasured here. Search has no per-result external
calls, writes, R2 requests or idle calls. Ordinary rows use one indexed search.
For each distinct oversized item/version encountered on a page, fragment validation
adds at most one compact root read and one indexed top-fragment read. Thus up to 100
roots and 100 bounded fragments can additionally be read, with at most 101 search
engine queries inside the same external call; each query incurs the provider's
query-GB charge. Ordinary 1k/10k fixtures incur no such additional reads. It reads at most 100 matching search rows, with a 512,000-byte read target
(the provider can include the final row beyond the target), plus current access and
generation metadata. `matchedRecordBytes` counts serialized returned DB rows, not
billed DB I/O. At 1,000 and 10,000 items the page budget is the same; total retained
search text/index storage grows with item bytes. Convex also charges search query-GB
against the entire search-index size, including retained generations and other
projects; equality filters do not reduce that charge. See [Convex costs](https://docs.convex.dev/search/text-search#costs).
`search_planning` sits on `projectPlanningRecords`. Its seven
ordinary planning indexes and full-text index cover planning rows and search fragments.
The core table has no planning/search indexes. Reads select their physical domain directly,
without a layout query, mirror or legacy fallback. The historical dogfood reading was 7.47 MB billed per
search before isolation; post-migration query-GB must be measured independently.
For 1 KiB search documents, 50 returned rows are approximately 50 KiB plus fixed
metadata at either scale; nominal indexed text is about 1 MiB/10 MiB respectively
(actual index overhead and provider billing must be measured after deployment).
Synthetic 500-character-body fixtures read 53 documents per 50-result page: about
74.8 KB serialized DB read bytes at 1,000 items and 75.0 KB at 10,000. These include
50 matches and three access/generation/head records; they are fixture measurements,
not provider billing or production latency.
Peak result memory is O(page bytes), and wall time is indexed lookup plus one page;
live latency and billed usage are unverified until the lead deploys and measures.
Issue creation keeps its existing workspace-query + command-action calls; duplicate
lookup runs inside the workspace query. A pre-search server adds one rejected
argument probe before the ordinary workspace query and explicitly reports duplicate
coverage as unavailable; its ordinary filing remains available. Friction keeps one capture mutation. Both
read up to five candidate rows plus fragment validation when needed; planning writes add one derived row per ordinary item or bounded fragments for oversized text, and
friction retains the bounded candidate page with its original record. If adding hints
would exceed the existing physical row limit, the same mutation writes one bounded
indexed receipt separately; replay adds one receipt-row lookup in that case (and
when probing a legacy record). Normal filings retain one row/write. The receipt
follows existing project deletion; neither source inputs nor filing capability are
reduced. For 364 items,
membership/Done-when triage takes four 100-item list commands (12 backend queries plus four fresh managed CLI release reads: 16 total),
with no per-Initiative scans or per-Issue detail calls. Full bodies still require
detail reads. The reported earlier 340-item triage used four list commands, six
Initiative scans and 181 detail reads; those were command counts, not measured
Convex call totals.

Vector search is deferred: lexical recall must be measured on historical duplicate
groups first; this implementation uses no embedding provider or embedding spend.

## Measuring it

The [legacy storage audit](operations/legacy-storage-cleanup.md#read-only-audit-and-disposition-planner) pages every table and `_storage` without deploying code, reports physical bytes separately from document JSON sizes, and prepares a dry-run-only disposition plan. R2 LIST size matches do not replace full-digest purge verification.

Hosted self-metrics include **bytes by location**: every Convex file-storage write on the deployment in the window, read from the `_storage` system table newest first (`projectBytePlacement:convexWritten`, pages of 64; one call when nothing was written). It must read 0 bytes; any byte adds a warning to the headline. An older deployment without the query reports the metric as unknown, never 0.

`nforge maintenance r2-backfill ROOT --dry-run` reports, per project, the legacy rows still only in Convex storage (count, bytes, estimated move cost) and the Convex copies already moved to R2 that cleanup could delete. It reads indexed rows in pages of 100 and moves nothing. The move and the delete are separate, owner-approved steps ([R2 backfill](operations/r2-backfill.md)).


Hosted State topological levels (`stateGeneration`) are optional scalar metadata
on the State's existing `projectObjects` row, or a sparse indexed scalar in its
existing `projectObjectCatalog` page. Trusted workers derive them from verified
parents during ordinary output/import publication. They add no R2 object or
change to a State manifest/hash. Worker-published States also record their exact
parent digests (`stateParents`, at most 16 short strings) on the same row; older rows
and catalog entries have none and are read as before. The explicit dev generation pass verifies source
bytes and patches those same metadata records in bounded pages. Ancestry proof
cuts and operation-local level maps remain in the existing R2 progress cursor,
not a growing Convex State or job record.

## Work projection index domains

Derived rows are split without changing logical collection names, record keys,
positions or values. `projectPlanningRecords` holds `planning*` roots/versions/comments and
`planningSearch:payload` search fragments. Other `:payload` chunks, `source*`, `viewFiles`
and `_workStore*` comparison rows live in `projectWorkDataRecords`. Other collections stay
in `projectWorkRecords`. All remain disposable projections of retained canonical Work/source.
No collection is dropped: generic record pages, selected lookups and source-return snapshots
are readers even when no specialised screen names that collection.

### Compact Plan metadata

`_workStorePlan` leaves share `projectWorkDataRecords` with the current record partition. Each contains at most
128 rows and 11 KB of encoded payload, with earlier splits by bytes; a decoded payload is bounded at 256 KB.
The existing parent/position index routes writes through non-overlapping ranges. Sparse creation positions share
leaves instead of paying for empty fixed windows. Normal same-status upkeep reads and flushes one leaf; a split
writes two, and status/Initiative moves can touch two ranges. Bulk work caches leaves within the transaction.
Settled pages store only positions, so unused titles cannot trigger overflow. Item bodies, comments, original
versions and exact detail/agent reads keep their existing placement. No table, index or retention rule is added.

Coverage remains `planRowsVersion: 1`; earlier and current row payloads are readable without a public DTO change.
An old layout or an oversized leaf requests a coalesced replacement repair. Its first phase deletes this
partition's Plan pages (32 documents/1 MB per step), then re-applies exact search roots (100/1 MB per step).
The one `planRowsPreparation` control object in the generation is below 512 JSON bytes on the fixture and
contains only ids/progress, never source text. It disappears on success. A blocked pass stops; a relevant source
edit queues a fresh pass, including one restart when an edit arrived during the preceding pass. Each scheduled
step is fenced, bounded and retry-safe. There is no query-triggered backfill, polling or idle scheduling.
Project purge discovers the nested task reference from the schema; generation removal makes obsolete callbacks
no-ops. These disposable bytes retire with their existing generation/project lifetime.

Ordinary operation RPC counts and browser reply/egress are unchanged. Exceptional replacement adds one internal
mutation per clear/root page; legacy alias coverage can require two additional document reads once when
requesting repair, with no per-Item lookup; a 324-root fixture takes five steps with existing pages, or six with 40 planted
stale pages. During preparation or genuinely oversized metadata, exact legacy reads remain available. Source
writes are neither denied nor truncated, and repair needs no mandatory operator step. A step retains a bounded
source page and touched-leaf cache; isolated runtime peak memory and billed execution remain separate checks.

The [Plan budgets](../tests/fixtures/plan-read-budget.json) stay at 40,000 normalized read/stored JSON bytes for
324 roots and 80,000 for 648, covering dense and sparse positions, aliases and varied bodies. Current fixture
reads are about 32 KB (62 KB doubled), with legacy body-bearing reads about 660 KB (1.32 MB doubled). The
128-row occupancy tests include 400-character titles and 20 relations: byte splits keep each measured edit below
16 KB per side and the entire view below 40 KB. Every stored/returned row is checked against the PlanRow key
allow-list. Observed 16 KB payload retirement reads one document (16,269 normalized bytes), versus two/32,538
before classification caching; the header case falls from 792 to 396 bytes. Provider billed caching is unmeasured.

At $0.20/decimal GB of DB I/O, the paired one-write/one-open-tab fixture models about -$0.12 per 1,000 planning
writes after upkeep, applied to the $1.688095 reference only as a fixture overlay. Its varied bodies change the
legacy denominator, so this is not a measured billed or historical improvement over the earlier fixture. Fixed
storage/index and exceptional preparation work remain separate; no CPU or egress saving is claimed.

Plan reuses transactional `projectFinishReadRows` variants: one authority/Work-pointer row per active Work project and one schema/status/coverage header per generation. Empty projects and removal tombstones retain no Plan project header. Headers share the existing project purge and generation deletion paths. Controller history and unused Work metadata remain exact in their source rows and are absent from these reads. Only project authority/Work-pointer changes add a narrow header lookup; journal/controller-only patches add none, and byte-identical headers are not rewritten. Generation upkeep touches only its selected fields. RPC counts and idle costs stay unchanged. The Plan fixture budgets 4 KB for one project header and up to two generation headers; the landing ledger records the separate fixed project row (300/302 fixture bytes), nine fixed index entries (676/694 key bytes) and the measured three-entry index-write guard increase. These cannot merge into the finite observer header without making that observer depend on the Work pointer. The ordinary page update guard allows 16 KB per read/write side for unique title references, with two reads/two writes in the steady-state fixture; a split or move can touch another leaf. Optional oversized headers retain exact source reads instead of denying a project or generation write.

### Planning progress counter

One `_workStorePlanCounts` row (key `counts`, about 520 bytes) per record partition in `projectWorkDataRecords` holds
Issue and Initiative counts by status and the Issues closed on the current UTC day (Item 3fa3187d). The common Work
writer collects each search root's kind/status move and, only when a count moved, reads and patches the row once per
transaction; a title or body edit costs nothing. Fresh partitions insert the row complete at creation. Older ones are
counted by `projectPlanCounts:backfill`, 200 roots per transaction, with its cursor in the row itself: it is
idempotent, safe to re-run and rebuildable with `restart`. While it runs, a move is counted only behind the cursor.
Needs me and Plan read the row with one point read; without a complete row they read one capped page and mark every
figure as a lower bound. Version 2 rows also keep `g`: counted Issues by what decides
their public visibility besides their status (`h` for an Issue hidden itself, else its Initiative and parent ids), so
a visitor's Plan counts read the row plus the Initiatives and parents it names (at most 100, then their Initiatives)
instead of up to 1,000 Items. An Issue with none of the three is in no group, so a plain plan's row keeps its size.
`g` holds at most 100 entries of about 50 to 90 bytes (a plan with 35 Initiatives: about 2 KB more per counter read
and write); later groups go to one overflow tally `x` that a visitor never counts, so the figure is then a lower
bound. Hiding, showing or moving an Issue between Initiatives or parents also moves the row (one read, one write
in the same transaction). A version 1 row is rebuilt from the start by the backfill (run
`projectPlanCounts:backfillAll` once after deploy): until then visitors read the capped page, and while the rebuild
runs members do too. After a rollback to code that does not move `g`, rebuild every row with
`backfill {restart:true}` before rolling forward, and the same rebuild empties a large `x`. A not-exact visitor figure
shows that the plan has more than 100 groups or lookups, some possibly hidden; it names no Item.
It shares the partition's purge, snapshot exclusion and retirement; no table, index or
retention rule is added.

Initiative Work reads one project-owned summary and at most 201 active Lane heads,
plus one Intent head and one Item root per distinct selected Intent and Item. It
checks applied lifecycle changes for the selected Initiative's unpinned Lanes. The
view uses one Convex query and makes zero idle calls. Its history and file membership
rows stay in Convex as indexed metadata. Source bytes stay in R2.

Acceptance completion schedules one fold per receipt with Item links. The fold
resolves their current Initiative roots, stores one receipt marker and the distinct
paths from its retained Candidate, then updates the summary. A fold transaction
handles at most 500 paths and schedules the next page only if needed. A failed
fold runs independently of the completed acceptance and can be repaired by a
rebuild. An Issue move, archive, deletion or restore rebuilds affected Initiatives
from retained notes and older Lane stamps. That scan also repairs missing reverse
Intent links where the Item's recorded chain proves the link. Replacing the selected
Work partition schedules reconciliation of the existing summaries. They remain
project-owned and carry the partition against which their counts were computed.

To backfill or rebuild one Initiative on the selected deployment, run
`npx convex run projectInitiativeWorkRebuild:backfill '{"projectId":"PROJECT_ID","initiativeId":"INITIATIVE_UUID"}'`.
The command returns the scheduled rebuild ID. Rebuilds advance in bounded
mutations and replace stale totals when their scan completes.

### Candidate and projection retirement follow-up

The Candidate page reads its file list once on opening; per-file provenance is
read when a file is expanded. The local browser harness that timed the old
Candidate page over HTTP (4k/29k fixtures) was removed with the old app shell;
no time assertion is used as a build gate.

The remaining projection cutover is separate from Candidate listing publication.
Revision-free Work mutations still require selected payload attributes in their
transaction, and canonical `hostedRecordBody` still reads Convex bodies. A
canonical copy therefore does not yet replace those reads with R2. Imported
Intent fields named `payload`, `payloadKey` and `payloadParts` are source data
after hydration and must survive in the canonical record's `journal`; they must
never be mistaken for disposable header metadata. Notes and lifecycle retain
their existing separate records.

No existing rows are removed here. An R2 projection migration is not planned
([verdict](research/placement-review.md#s4-remaining-writers)); if one is taken up, this is its contract:

1. Pin project id, physical record generation, checkpoint digest and source/Work
   revision. Inventory each collection with a durable operation id and cursor;
   retrying the same page reconciles the original outcome. Never substitute a
   current generation or newer canonical version for the pinned one.
2. Commit or transfer at most 100 rows and 500 KiB per page. Count whole rows
   and report provider read bytes separately, including any final-row overshoot.
   Stage an oversized row's exact bytes in R2 with a bounded manifest descriptor
   rather than truncating it or increasing the page target.
   Preserve collection/key/parent/position, actor/status/planning metadata, all
   unknown attributes, current mutable overlays and historical provenance.
3. Before switching any reader, verify replacement digest and byte length,
   source membership and State-parent coverage, server-side identity mapping,
   selected-command behavior, generic pages and retained snapshot reads.
   Independent source/target comparisons must continue detecting failed dual
   writes; hashing both sides with a lossy codec is insufficient.
4. Exercise portable export/restore against the pinned source and Work, including
   attributes whose names collide with transport fields. Publish readers first,
   then capture the existing default-off server setting for retry-stable writers;
   use the existing contract feature/`CLI_UPGRADE_REQUIRED` boundary for old clients.
   Calls and database I/O for imports/rebuilds may not increase.
5. Keep existing projection rows and canonical source/Work/audit history. Any
   later projection cleanup needs its own authorized operation, exact verified
   row identities and a resumable receipt; the normal writer never launches it.
   Do not drop the data table while any generation, patch writer, generic reader,
   comparison or retained snapshot still depends on it.

The index reader map (repository-relative paths):

| Index | Collections / reader |
| --- | --- |
| `by_generation_and_collection_and_activityAt` | `lanes`, `runs`; `convex/coordinationCounts.ts:95` |
| `by_generation_and_actor` | Any collection with imported `actor` metadata; `convex/projectActorNames.ts:67`; retained on all three tables |
| `by_generation_and_collection_and_key` | Every collection; `convex/projectWorkRecordTables.ts:40` selected lookup; planning id resolution in `convex/projectHostedPlanning.ts` |
| `by_generation_and_collection_and_position` | Every collection, including source/payload/comparison pages; `convex/projectWorkIndex.ts:170`, `convex/projectWorkIndexBuildStore.ts:50`, `convex/projectWorkStoreDigests.ts:161` |
| `by_generation_and_collection_and_parent_and_position` | Payload chunks, `viewFiles`, `laneViews`, `viewAcceptances`, `runs`, `notes`, planning history and other parent-selected collections; `convex/hostedRecordValue.ts:27`, `convex/projectWorkIndex.ts:175` |
| `by_generation_and_collection_and_status_and_position` | `intents`, `landingEntries`, `landingBatches`; `convex/projectWork.ts:395`, `convex/projectWorkIndexBuildStore.ts:202`, `convex/projectSourceAuthorityDrain.ts:24` |
| `by_project` | Every collection; dynamic permanent purge, `convex/projectPurgeRows.ts:26` and `convex/projectPurgeInventory.ts` |
| `by_generation` | Every collection; generation retirement in `convex/projectWorkIndexStore.ts:344` and explicit `convex/projectWorkRecordMigration.ts:103` |
| Seven `by_planning_*` indexes | `planningSearch` roots only; all filter combinations in `convex/projectPlanningList.ts:31`–75 |
| `search_planning` | `planningSearch` roots/fragments only; `convex/projectHostedPlanningSearch.ts:90` |

All three domains retain the common key/position/parent/project/generation indexes and
actor visibility. Activity/status indexes belong only to the general Work domain.
The data domain therefore has six custom B-tree indexes; the planning domain has thirteen
plus search. Counting a document, two built-ins and one full-copy-equivalent search sensitivity
gives 9 copies/data write, 17/planning write and 11/general Work write, against 19
before splitting. The seven planning-filter indexes and full-text index no longer cover
general Work rows.
These are an index-count/storage sensitivity, not a claim that Convex copies an entire
payload into every index.

The frozen 154,496-row dogfood shape and bounded oldest/tail samples model 0.309 GB logical:
136,243 data rows / 0.287 GB, 46 planning rows / 0.000078 GB, and 18,207 other rows / 0.022 GB.
The full-copy sensitivity is 5.88 GB before and 2.83 GB after all legacy indexes are removed,
a modelled 3.05 GB reduction. Frozen counts omit later writes; the deployment-wide mixed
sample model was 8.41 GB versus the owner's 10.84 GB dashboard. Neither model is measured
reclaimed disk. `tests/work-index-cost.test.mjs` ratchets table index counts and a landing-shaped
projection byte model; the landing storage guard separately tracks retained document bytes.

The completed dev copy plus bounded aggregate audit reconstructs about 0.418 GB of retained
logical documents: 39.5 MB general Work, 16.4 MB planning and 361.9 MB data. At the same
copy-count sensitivity this is about 7.94 GB before and 3.97 GB after. These current native-byte
measurements include writes absent from the frozen generation counts above. They remain a
storage model; the dashboard figure measures provider storage. A further split of the small
core activity/status groups saves at most about 0.08 GB; isolating planning history from its
search roots saves about 0.11 GB. Neither warrants another live rewrite in this bounded slice.

`projectWorkRecordMigration:run` explicitly drives at most 100 transactional pages per call;
resume its phase/cursor and original operation id. Each copy page reads at most 100 rows with
a 512 KB target (plus the provider's final-row overshoot) and upserts exact derived bytes.
The temporary dual-read/write rollout path is removed once every retained dev partition
selects the split tables. Ordinary inserts
route to one table, and reads use that domain with no layout lookup or extra RPC.
At the one-time cutover, a fresh public generation preserves the record partition and Work
revision. Outstanding list/search cursors receive `WORK_STALE` instructing callers to restart
the list/search; fresh cursors retain their existing shape and pagination behaviour.
Copy receipts in existing `projectReturnPages` retain old row ids and sizes, so cleanup deletes
those exact duplicates without an application-level second payload scan. The provider still
bills the deleted document bytes as reads. Every page has a durable operation
receipt, including replay after subsequent pages. The original canonical source, Work history,
planning versions, landing receipts and audit remain untouched. Retirement and project purge
cover all three tables. There is no scheduler, idle call or recurring migration scan.

The deployment-wide mixed-sample envelope predicts roughly 1.4 GB for old-row reads,
new-row writes, duplicate deletions and compact receipts, below the approved 1.5 GB migration
budget, including measured fixed page overhead. The completed dev migration billed
0.840 GB read and 0.530 GB write (1.369 GB total); the aggregate domain verification added
0.056 GB reads, for 1.425 GB together. It found no moved collection left in the core table.
Ordinary write I/O per landing and the post-cleanup dashboard are measured separately.

## Where the bytes and I/O go (2026-11-10)

The owner's placement yardstick is that Convex serves three jobs: CI and landing
orchestration, the realtime agent message board, and the web app (with a future
iOS app). Immutable, content-addressed, large, or historical data read only on
demand belongs in R2 behind a pointer. This is the rule for future placement;
the candidates below remain review work, not approved migrations or deletions.
Convex queries/mutations cannot fetch R2 bodies themselves; moving a body must
preserve transactional readers or use an action without adding per-item calls.

### Dashboard storage and the sample model

Convex database storage includes documents **and indexes**. For design sensitivity,
count each index as approximately one extra copy of its rows. This is a model of
amplification, not a vendor formula asserting that every index stores the whole
payload. The inventory model counts one document, two built-ins, custom B-tree
indexes and one extra copy-equivalent for a search index. Search bytes may behave
differently. Provider document/index breakdown remains unmeasured.

All dashboard numbers below are **measured, owner dashboard, 10 November, before
cleanup**: 21.47 GB total, versus about 8.7 GB on the previous day. The roughly
2.4-fold rise across many tables coincided with a plan change; a measurement
change is a hypothesis, not established growth attribution. The dashboard exposes
five named tables and a 6.12 GB remainder, not individual sizes for that remainder.
Those reported components sum to 21.52 GB, 0.05 GB above the reported total;
the source does not reconcile that discrepancy, so it is not allocated to a table.
The other columns are **modelled** from bounded chronological JSON samples and
full table counts, not full-table byte sums or random samples. GB is decimal.

| Table | Dashboard GB (measured) | Rows counted | Sample mean / p95 JSON B | Logical / indexed GB (modelled) | Contents and preservation |
| --- | ---: | ---: | ---: | ---: | --- |
| `projectWorkRecords` (before split) | 10.84 | 200,262 | 2,210 / 4,186 | 0.443 / 8.409 | Work/source/planning projections: rebuildable; canonical source, planning history and audit kept forever. |
| `projectHostedCheckRuns` | 2.01 | 2,200 | 27,081 / 86,119 | 0.060 / 0.655 | Verdict, proof and source/configuration pins kept; execution detail is operational exhaust under the approved window. |
| `projectHostedCheckCallbacks` | 0.89 | 24,186 | 2,471 / 1,703 | 0.060 / 0.299 | Callback inbox payload is exhaust; digest retry receipts and reuse aliases remain. |
| `projectObjects` | 0.84 | 119,617 | 526 / 613 | 0.063 / 0.629 | R2 descriptors, not source bytes. Reachable Git/State bindings remain; immutable descriptor copies can use catalog pages. |
| `projectSourceTasks` | 0.82 | 30,402 | 5,696 / 12,934 | 0.173 / 0.866 | Fan-out inputs/progress/results: operational after whole-job completion; retained job outcome/source live elsewhere. |
| All other tables | 6.12 | — | — | Not individually dashboard-reconciled | Includes the candidate classes below; not an unexplained second byte store. |
| **Total** | **21.47** | — | — | No exact physical total model | Dashboard after cleanup remains a lead measurement. |

The Work sample contains 645 rows. Its current deployment-wide count differs
from the frozen dogfood generation's 154,496 rows, of which 103,355 are `viewFiles`.
Their sampled sizes are 1.94–2.97 KB, with contributors the largest nested field;
legacy payload pages reach roughly 10–36 KB. Dividing indexed dashboard storage
by a frozen generation count does not establish 70 KB logical Work rows. Work,
check-run and callback models do not fully explain their dashboard figures.

### Split indexes and catalog placement

The [Work projection index domains](#work-projection-index-domains) give the
reader map and completed migration. **Modelled copy-equivalents per write** fell
from 19 to core 11 / planning 17 / data 9; these are not measured billed write
bytes. The frozen dogfood model is 5.88 → 2.83 GB. Reconstruction from measured
native document bytes is 7.94 → 3.97 GB under the same copy assumption; physical
reclamation still needs the dashboard. Routing now reads one physical domain,
without layout lookups, fallback mirrors, extra RPCs or idle scans.

Immutable descriptors now share existing 256-entry `projectObjectCatalog` pages.
Mutable State parents/generation/protection, pending uploads and small new outputs
stay rows; random insertion into dense pages would increase read/write I/O.
`projectObjectReceipts` keeps original upload-id, nonce and size retry/cleanup
pins with three indexes instead of the descriptor table's seven. **Measured dev
migration:** 38,003 descriptors across nine projects, every digest/size verified;
18,427,473 serialized bytes removed versus 11,604,506 receipt bytes plus
3,367,626 catalog bytes (including pre-existing pages). The conservative net
logical reduction is at least 3,455,341 B, not a dashboard saving. See
[compaction](operations/storage-compaction.md) and
[maintenance costs](operations/cost-to-serve.md#maintenance-cost-and-unmeasured-work).

### Open placement candidates

This inventory of the remaining large classes is **modelled**, from the same
pre-cleanup samples. Indexed sizes assume approximate full copies; potential
savings are ceilings/ranges before pointer/R2 costs and overlap with expiry.
They must not be summed as a measured saving. Keeping history forever permits
moving exact bytes behind verified pointers, not deleting them.
The [placement review](research/placement-review.md) gives a verdict for every table and R2
use and proposes the slices; none is approved yet.

| Table | Rows / sample mean B | Logical / indexed GB model | What remains to assess |
| --- | ---: | ---: | --- |
| `projectHostedRecordBodies` | 109,335 / 1,279 | 0.140 / 0.839 | Immutable journal/Work bodies, including planning/audit, must stay forever; exact R2 body plus compact hot pointer is a candidate (~0.70 GB ceiling). |
| `projectHostedActionsResults` | 20,490 / 2,151 | 0.044 / 0.176 | Report detail is operational; lossless row compaction landed. R2 detail placement (~0.15 GB original ceiling) is implemented behind default-off `FORGE_CHECK_REPORTS_R2=1`: one server-only report object per new run, a bounded summary in the run header ([S3 report transport](research/placement-review.md#s3-report-transport)). |
| `projectHostedLandingObservations` | 44,941 / 2,293 | 0.103 / 0.412 | Versioned observation copies include committed recovery/audit history; assess deltas/references (~0.35 GB ceiling), not blanket expiry. |
| `projectHostedRecords` | 109,335 / 487 | 0.053 / 0.426 | Immutable versions/audit stay; deduplicate inline body copies only with equal read-call cost (~0.06 GB ceiling). |
| `projectHostedOperations` | 18,368 / 1,860 | 0.034 / 0.171 | Retry outcomes/receipts stay; bulk transport body pointers are an option (~0.14 GB ceiling), with no proven extra-R2-read win. |
| `projectHostedSaves` | 3,054 / 3,066 | 0.009 / 0.047 | Save/State receipts stay; completed protocol copies are a candidate (0.03–0.16 GB range), not an agreed cut. |
| `projectHostedOverlapLanes` | 1,338 / 9,371 | 0.013 / 0.075 | Current saved-path projection is rebuildable; intern/compress paths (0.03–0.12 GB range), preserving current pins. |
| `projectHostedLandingAttempts` | 4,081 / 4,176 | 0.017 / 0.102 | Causal attempt evidence stays; intern repeated Candidate/policy snapshots (~0.07 GB ceiling). |
| `projectHostedRecordHeads` | 20,071 / 750 | 0.015 / 0.136 | Rebuildable but transaction-critical CAS/current heads; keep pending read-cost parity, zero committed saving. |
| `projectFinishReadRows` | 10,180 / 1,227 | 0.012 / 0.150 | Transactional metric/public projections are rebuildable; narrow nested copies without changing readers (~0.08 GB ceiling). |
| `projectHostedLandingRequests` | 1,479 / 7,713 | 0.011 / 0.308 | Admission/selection/receipt/audit preserved; assess compact hot envelope plus immutable R2 body (~0.20 GB ceiling). |

Other review options are a State-bound R2 descriptor manifest (trusted incremental
baseline plus changed pins, never a fresh full descriptor scan per State), Work
payload/actor interning, and a different overall stack. None is built or selected
by this inventory. All audited indexes have readers, including generic pages and
snapshots; no unread collection was established. Further core/planning-history
splits model only about 0.08 / 0.11 GB and were not pursued in this slice.

Evidence: storage Issue [8c4f126b](https://nanthai-forge-dev.nanthai-forge.workers.dev/?project=mh7aafndrxmj8c2q0931zbjk2n8h4ffs&projectTab=planning&planningItem=8c4f126b-0c04-492e-a66a-aabc6acd4981) (inventory comment `b69f2f14`, catalog
completion `a67d6495`, catch-up `257c5a66`, final split evidence), and cost Issue
[298f9675](https://nanthai-forge-dev.nanthai-forge.workers.dev/?project=mh7aafndrxmj8c2q0931zbjk2n8h4ffs&projectTab=planning&planningItem=298f9675-b8ad-49d6-96c3-07d94e5f9ebd). The [placement review](phase6-plan.md#p6-close-order-owner-2026-11-10)
decides the next implementation slices.

## Advisory retention

Client errors expire strictly after 30 days from creation, in pages of at most
eight rows in existing scheduled check-expiry transactions. There is no new cron,
idle call or diagnostics-only continuation; a backlog drains on later maintenance.
The receipt includes deleted row and logical byte totals and reconciles retries.
At two check-expiry phases per landing, the added budget per 1,000 landings is
zero function calls, at most 2,000 indexed page reads and 16,000 deletes; at the
observed one error/week it is approximately one delete/week. Billed I/O and wall
time remain unmeasured; memory is bounded to eight documents (8 MiB schema ceiling).
No R2 bytes are involved in diagnostic deletion.

Owner-selected coordination detail retention is 14 days hot then R2 archival by
S2 (27d4c1fd), with nothing deleted. Messages, handoffs, acknowledgements and agent
lifecycle audit stay indefinitely; agent access diagnostics have no window until
volume warrants one. See [decisions](decisions.md#advisory-windows).


CI supervisors negotiating `results.packed` retain one combined result/log object
per shard in R2's run/fence/execution inbox namespace. Output chunk metadata keeps
the original logical log pin and a verified physical envelope pin; the same
current-access download and output cleanup paths resolve that physical key.
Required supervisors discover other required slots with one finite HEAD pass and
elect a collector through a create-only marker. One completion notification collects
bounded metadata pages before optional pack/proof jobs finish; signed workflow
completion remains recovery. Packed mode removes LISTs and duplicate log PUTs. The legacy batch path remains for
older supervisors. See [the CI request guard](operations/github-actions-checks.md#ci-byte-guard-and-serving-estimate).

## Terminal landing capsules

S1 (`bea7868d`) packs every landing that settles once the writer is deployed.
Landings that settled earlier have no wake; a one-time backfill (`b149b16b`,
`convex/projectLandingCapsuleBackfill.ts`) packs them on an explicit operator call
per project. `dryRun` reads only (resumable with its `cursor`) and reports landings,
rows, bytes, calls and whether the project index is built. `run` builds an unbuilt
capsule index before it schedules any pack, then pages 64 requests without reading
cold bodies, classifies them with the packer's shared rules and schedules the same
verified packer 2 s apart (`staggerMs` 0.5–60 s). One control row holds the cursor,
a generation and the one pending chained call (`pages`): an overlapping call is
refused, `restart` cancels the pending call. There is no cron or idle work, and the
module is deleted once dev and bench are done. After the approved seven-day
terminal grace, one complete private gzip object
holds canonical observations, attempts, landing-owned finish projections,
acceptance events/pages/plans/snapshots, compose pages, Item landing notes and expired
callback digest receipts. Relocated per-landing expiry receipts travel in that object too. A
verified pointer precedes bounded removal of duplicate Convex copies. Reuse
aliases, canonical acceptance receipts/compose selections, exact transaction
ledgers and shared metric/control projections remain in Convex. Compact per-note
references retain the original creation order and point to verified capsule bytes.
A fixed bootstrap
cursor/revision is charged per project, separately from landing history.

Capsule objects use the private project `landing-capsules` namespace, outside the
client-readable object namespace. Server actions alone open them, verify complete
raw bytes/table hashes and return currently authorized, identity-mapped logical
history. Recovery uses that path and retains the full raw server object; its
fixture drill also restores hosted source. Logical history is preserved
indefinitely. Live dev packing, cold reads and retained bytes are recorded on
Item b149b16b; billed storage savings are not yet a dashboard reading.

Landing request phase state lives in the indexed `projectHostedLandingRequests` ticket. Resolution-message inheritance follows existing compose, operation and submission indexes when a child attempt conflicted; older ordinary recomposes also read their landing attempt. New finish recomposes reserve the owning submission UUID in the existing operation-ID map, so cached precompose adoption preserves exact note choices. Their source job reuses the already unique Candidate UUID, replacing the redundant job-operation reservation (two fewer serialized bytes per operation). Healthy landing calls, writes and indexes stay unchanged; source bytes stay in R2.
Its immutable request and larger batch selection live in separate rows of the unindexed
`projectHostedLandingBodies` table, reached only by the ticket's private pointers. Existing
index readers receive the same logical row. The finite observer hydrates only the request,
so it never reads a batch selection merely to display status. Phase changes reuse both
bodies; ordinary parent deletion and permanent project purge remove them atomically.
Legacy inline tickets remain readable and separate their cold fields on their next state write.

Resubmissions carry scalar CI usage on the existing ticket. Its optional server-only
`supersededCheck` checkpoint (one run ID and usage scalars, about 60–90 serialized bytes) also rides
the desired row until admission, when its existing write clears that copy. The request keeps it
until the existing check-binding write consumes it. If no run ever binds, it remains with that
request until the request is removed by existing cleanup or project deletion; there is no new
expiry or retention rule. It prevents exact-run reuse from being counted twice, adds no lookup or
new table, and changes no source-byte or history placement.

## Work journal segment readers

Journal history uses S1's digest/size/table verification and server transport.
The journal packer follows the S1 pattern (Item b149b16b): one body runs as a V8
action (`projectJournalRun:pack`) and continues in Node (`projectJournalRunNode:pack`)
only for a page whose captured text exceeds 1 MiB. New segments use the portable
fflate codec with a zero mtime; objects written by the earlier Node zlib writer
are standard gzip and decode unchanged. `projectJournalSegments` holds one compact
range index per segment, separate from hot finish projections so its range indexes
do not multiply every landing row's storage. Current heads and versions remain
transaction-readable. `projectJournalReceipts` keeps compact deduplication facts
for archived coordination detail; full commands stay in R2. Immutable version
hashes, Lane source pins and metric facts
let transactional retries and metrics reconcile without an R2 read. Full history
bytes remain server-only and use current access checks after each GET.

Version pages use stable revision positions; coordination uses creation-time/id
positions with scoped indexes. Browser and CLI clients hydrate cold pages and
retain live subscriptions; changing viewer permissions hides old hydrated data
before reauthorization. Recovery merges original rows with live rows and capsules
under a relocation fence. Existing rows larger than a page use ordered, hash-verified transport fragments;
every physical segment still uses S1’s codec. Original row bytes reassemble before
projection or export, preserving the record capability and bounded page transport.
The separate writer is installed behind the default-off server setting
`FORGE_JOURNAL_SEGMENTS=1`; the setting is not enabled by a deployment. Existing
readers continue to resolve retained objects when the setting is off.

Terminal source operations and primary Work commands become eligible after seven
days and coordination detail after fourteen. Their writes do not each schedule a
pack: each project keeps one pending live drain, recorded in one
`projectJournalReceipts` pointer row and aligned to the hour after the earliest
known eligibility. A later wake is already covered and writes nothing; an earlier
one cancels and replaces the pending drain. A drain reaches every non-Lane family
by its ready index or cursor and reschedules only for eligibility it finds, so a
project with nothing due has nothing scheduled. Only a still-pending drain is
cancelled, and a started drain's hour is never reused. A drain that fails after its
retries leaves its later rows hot, not lost: the next waking write after its hour,
or an operator run, schedules a fresh drain that finds them. Closed Lanes still schedule their
own save-page drain, one per Lane completion. No cron or periodic poll is added. One internal operator invocation of `projectJournalRun:pack` with
`{projectId, operationId, existing:true}` also walks settled existing rows. Its
per-project cursors and page receipts resume interrupted work; another invocation
with the same operation id reconciles published pages. A failed in-flight capture
can be resumed after its ten-minute internal claim lease. This is an operator
maintenance entry point, not a new user action or confirmation.

Each page uses one capture and one publication mutation, at most 100 original
rows, and at most 500 KiB of capture transport. Capture budgets include related
head/body reads; an individual existing provider row can exceed the transport
page and is re-read and framed without truncation. Publication revalidates source
hashes, head identity and body sharing after the verified PUT/GET. Original rows
stay until the final verified fragment. One R2 PUT writes each physical segment;
no separate packer or object store is introduced. Compact version/header facts,
complete ninety-day terminal retry results and Work command replay facts remain
in Convex. Shared current bodies, current heads, prepared lifecycle versions,
messages, handoffs and acknowledgements stay live. The archive removes relocated
Convex copies, not logical history; recovery export and restore provide the
original rows. Turning the setting off stops new relocation.

Eight fixed record/operation/existing-history cursor kinds are accounted as
project metadata, separately from coordination and expired-operation ownership
receipts. Lane-scoped save controls are removed after their finite drain. The
fixture ratchets charge segment indexes and all remaining receipt result bytes;
small-row metadata overhead is charged whole. Known eligibility points use one
deduplicated scheduling fact per scope/date; expired facts left by a paused job
clear in bounded metadata-only pages. Late archived operation-ledger updates
advance the recovery fence, including while new relocation is disabled.

Terminal operation transport and its mutable recovery ledger have separate
ownership during export. A live compact receipt supplies the current recovery
ledger; after receipt expiry a compact ownership digest selects the last archived
physical row. Older immutable objects remain retained, while export emits each
physical operation once. Restored operation histories can contain an operation
UUID reused after its original receipt expired; the transactional loader selects
the newest physical receipt for that project/actor/UUID.

Cold journal queries use the existing structured `CLI_UPGRADE_REQUIRED` envelope
with an opaque viewer/source commitment. Updated clients recognize that
continuation and hydrate through the private history action automatically; older
clients get an explicit upgrade instead of an incomplete successful page. The
existing contract-feature negotiation advertises `journal-segments-v1`. Live
reads retain their original query count and no extra capability call is added.

Record journals also accept compact original version receipts: immutable identity,
content hash and transaction pins remain query-readable, while the full original
header and body live in a range segment. Lane receipts carry only source and
metric facts. This keeps metric paging exact even when an old Lane version becomes
superseded long after other projects' history was archived; metrics do not depend
on a bounded guess about overlapping segment time ranges. These are receipt
bytes in the storage ledger, separate from the one index per physical segment. A
compact header can point to its exact private segment index by content pin, so
one segment can contain versions of several resources. Header indexes still
provide exact point and history paging; no per-resource duplicate archive index
is required.

Work projection replay uses the same verified compact command facts as ordinary
retries and remains query-readable when the full original provenance is archived.

Journal page actions retain the original page identity and pending claim across
write-conflict retries. At most four scheduled resumptions use exponential
250–2,000 ms backoff plus less than 250 ms jitter; an exhausted conflict remains
visible as a failed job, and the original cursor stays resumable. Other failures
remain explicit. A successful page resets the retry count for its successor.

One small project pointer in the existing receipt table names the pending claim
across every phase and Lane scope. Captures read its existing point index before
writing eligibility markers or control state, so concurrent wakes defer until the
current claim expires. Publication checks the same ownership before applying rows.
The deferred request has one finite scheduled continuation; there is no polling,
periodic job or idle wake. Older controls remain readable and republish the project
pointer when their own frontier is captured again. Claims use the existing ten-minute
expiry. The shared control writer clears the pointer on stale selection, fragment
handoff and completion; no second cleanup path, table or index is added.

Empty journal selections commit their cursor, replay result, eligibility wakes and
phase continuation in the capture mutation itself. They acquire no capture lease,
create no pending-project pointer and call neither publication nor R2. A replay of
the control's last page returns before loading the project or selecting source rows.
This also applies to already scheduled wakes with the original arguments. Empty
metadata-cleanup pages still advance, and an empty Lane frontier removes its control.
Supersession writes add no scheduling reads; a waking write adds one point read of
the project pointer. There is no new timer, periodic wake or change to the
seven/fourteen-day eligibility rules.

Healthy nonempty pages keep one action and at most two mutations. Point reads of the claim
replace redundant control-row lookups; its capture/publication adds two small
metadata writes per page. The project pointer exists only while a page is pending,
so retained JSON and stored-index ceilings stay unchanged. No segment payload or
source bytes move into Convex. A single injected capture conflict adds one action
and one mutation; an injected publication conflict adds one action, two mutations
and one reconciliatory R2 GET, with the same segments and no duplicate PUT. Tests
retain the original storage ceilings and verify a finite drain after concurrent
wakes in distinct phases, including an actual indexed OCC race. Retention and
logical history are unchanged. Provider billing and live byte-placement deltas
remain separate rollout evidence.

## Sealed secret records

`sealedSecretSets` and `sealedSecretHistory` are an approved exception to the R2
byte-body rule (Issue `41a0df87`). They hold client-signed public metadata, key
wraps and padded ciphertext; no private key, value encoding or unkeyed value hash
belongs in either row. One set and one history row per project/set kind are
replaced together in one compare-and-swap mutation. This atomic publication is
why these bounded records stay in Convex. Existing Secret Objects are separate
and remain until their approved retirement.

The server enforces a complete set-row ceiling of 512 KiB and a complete history
ceiling of 128 KiB, including metadata allowance. It appends each write's own
transition, keeps at most 64 that fit the history ceiling and 50 retry events,
pruning in the same mutation. Genesis remains in the history row. Removal markers
and join requests are optional fields of the set row, absent when empty; reads
return them only when present. The landing storage ledger charges zero bytes for both
new tables: owner secret commands are outside the landing path. Standalone
record-size and request tests account for configured sets separately.

No application subscribes to these tables. CLI reads are one-shot. A cached
`run` asks with its verified head hash and receives only an unchanged response
when current; the server still reads the bounded current row, and checks current
membership. Changed or missing caches receive the sealed record in that same
call; history is included only when the roster differs or genesis is needed.
There is no idle query, polling or timer. The cap and absence of subscriptions
meet the large-per-write rule even when a configured set exceeds 100 KB. A future
web adapter must read a names-only projection, never these records.

The synthetic 20/200-name fixture uses 128-byte values and measures complete
Convex-value sizes, rather than JSON/base64 sizes. Set rows are 18,270/166,290 B;
history rows are 1,047 B. Initial write requests are 18,945/166,965 B; complete
read replies are 18,880/166,900 B. A verified cache hit returns 20 B. This is
logical fixture accounting, not provider-billed I/O; the server reads the whole
bounded set document even for the small response. A steady-state history may
include up to 50 events and 64 transitions within its unchanged 128 KiB cap.
Later writes send only the payload and the transition they introduce, never
genesis or the ring.

At 100 recipients and 200 names (synthetic fixture), a write that adds 99 members
sends a 237,438 B payload and a 50,159 B transition. The set row is 237,669 B and
the history row 51,315 B. The mutation reads four documents (167,843 B) and replaces
two. Its payload checks took about 9 ms (median of five) in a local V8 context with
no Buffer or Node built-ins. A full public check of the same roster, run twice as a
roster walk does, plus one head signature took about 333 ms there. That check is
not on the write path yet. These are local observations, not Convex-billed time.

For an existing pinned owner device, `secret set` and `rm` use one read and one
CAS mutation: normally seven document reads (credential/project/set on the read,
then credential/project/set/history on the write), and two document replacements.
A changed roster adds the history read. `list` and `run` each use one read:
three documents normally, four when history is needed. A cache hit sends only the
20-byte response; a miss returns the current sealed body in the same call.
Setup uses the same two function calls and inserts two rows. CAS contention adds
a re-read and retry; an unknown outcome replays the retained ciphertext operation.
`secret resolve` uses one current verified read and local journal IO only; it makes
no server mutation. The opaque genesis bytes are deterministic across decoding
and re-encoding; the server preserves the first genesis and refuses replacement.
Offline `run` may use the verified cache only after a transport failure, never
after an authentication or verification refusal. Idle is zero calls and zero I/O.

One shared-process fixture run reported RSS about 158/99 MiB and record assembly
86/7,784 ms for 20/200 names. These observations include the backend harness and
shared-machine/GC effects; they are not isolated helper memory or wall-time
assertions, and establish no performance gain. Payload and decrypted buffers grow
with the bounded set plus one current value, not with source or history size;
pin/cache memory is bounded by the record caps. These commands add zero secret
reads/writes per
landing and model $0 per 1,000 landings. Real secret-command billed usage remains
unmeasured; no new all-in serving-cost claim follows from these figures.
