Repository navigation
Description
Dedicated implementation issue for P4 of #254, under #253 (the product rules, which govern on any conflict) and #193. Written 26 October 2026 after P1, P2 and P5 are live and P7's fixes are merged. Same shape as #255, #257 and #259. This is the last infrastructure part before P6, the first bot proposal.
1. Outcome
The frozen packet a model sees carries everything a human can choose from and nothing a human cannot: definitions, sense quotations, catalog works and accepted exemplars, under the same eligibility, with a bound on meanings as well as candidates, a deterministic cut that records what it left out, and a contract that validates every kind. A packet builds, freezes and verifies for every whole On scope among the ten pilot pages, including love (43 senses, 48 packet meanings), and the benchmark fixtures still verify. No model is called in this part; P6 calls it.
2. What you see
Nothing on the public page changes in P4. What changes is visible in two places:
2.1 An attempt's record (inference_attempts.packet_summary), the audit D9 needs
packet_version runtime-packet-v2
instruction <from the pinned config, never a literal>
scope love · lexemes 9051 14794 401975 402387 1492222 · en
meanings 12 of 48 (required 3, bounded 9) · policy meanings-v2
candidates 12 of 36 · content 4, sense_quotation 3, work 3, exemplar 2
priority Bierce LOVE/n (always in)
omitted 24 · by id with reason: over_quota 21, meaning_out_of_bound 3
hashes packet sha256 …, candidate set sha256 …
2.2 The operator's view (mix dd.runtime packet --scope love --dry-run)
A new dry-run mode prints the table above for a slug without admitting anything, so the owner and the auditor can see exactly what an editor would be offered before P6 exists.
3. Seams
| Need | Existing |
|---|---|
| The packet today | Runtime.Packet.build/3 gathers Bierce entries, other definitions and sense quotations; refuses {:too_many_candidates, n} above max_candidates (12, Runtime.Endpoint) and {:too_many_meanings, n} above @max_meanings 12; freeze/1, verify/1, summary/1; @version "runtime-packet-v1", @instruction_version "generic-editor-v1" as literals |
| What a human can choose | Curation.Candidates.for_page/1 (P2): leads, highlights of the four kinds with item specs and Eligibility.check/3 results. Reuse it for candidate discovery; the packet must offer exactly what the screen offers, re-checked at freeze |
| The contract | Runtime.Contract.schema/0 and validate/3: candidate_id, meaning_id, reason ≤ 280, up to three highlights, quote an exact substring, re-validated against Eligibility and LeadRule |
| Eligibility per kind | Curation.Eligibility (content, sense quotation by words hash, catalog work by manifest and checksum, exemplar by accepted claim) |
| The pinned instruction | P7's second PR pins generic-editor-v2 beside v1 and makes Packet read the instruction version from config. P4 builds on that; if it is not merged yet, read the version from config with v1 as the default and do not duplicate P7's work |
| Fixtures | priv/curation/runtime_bench/packets/{ordinary,ambiguous,sparse,adverse}.json and plan.json; Runtime.Bench |
| Freshness | P5's fingerprint today is the candidate-set digest candidates-v1; #259 §5 names the versioned transition to the packet digest. P4 defines packet-v2 as a second fingerprint input and P5's compare takes either, so a change of policy version re-admits once and never loops |
4. Scope
work(page-matched catalog artworks, and P3's pinned works when they exist) andexemplar(acceptedillustratesclaims) as candidate kinds inPacket.build/3, discovered throughCandidates.for_page/1.- Two bounds, both deterministic, replacing both refusals: candidates ≤ 12, meanings ≤ 12. Required meanings are kept: every chosen candidate's meaning, and the lead's. The rest are ranked by how many candidates cite them, then by sense rank on the page, then by id. A candidate whose meaning was bounded out is omitted with
meaning_out_of_bound. - The cut: Bierce entries always in (and counted against the
contentquota; if Bierce entries alone exceed the candidate cap, refuse{:priority_candidates_exceed_cap, n}rather than trim, as Curation agent MVP: what an editor does, what a curated entry contains, how the page looks, how the owner and the bots share one record, and how it stays current (under #193) #253 §5a decides); quotascontent 4, sense_quotation 3, work 3, exemplar 2, filled in source-priority order (Bierce, Johnson, WordNet, Wiktionary, Wikipedia; verified corpus before live; accepted claims by review date), ties by object id ascending; unused quota flows to the next kind in that order. - Omissions recorded on the frozen packet and the attempt summary by id and reason; never excerpt text.
packet_version→runtime-packet-v2;freeze/1andverify/1re-derive every candidate of every kind at dispatch time and refuse:packet_staleon any change.Contractaccepts the new kinds; aworkorexemplarhighlight carries noquote; asense_quotationstill needs an exact substring.mix dd.runtime packet --scope <slug> --dry-runprints §2.2 and writes nothing.- The P5 fingerprint transition (§3 last row).
- Benchmark fixtures: re-frozen under v2 only if they fail to verify, with the reason recorded in
plan.json's notes; the plan's cases keep their meaning.
Out of scope: any model call or proposal (P6); pinning (P3); personas; changing eligibility or the lead rule; changing what the screen offers; a general poem-to-page relation (the owner's decision, #253 D-list). If a blocker needs more, write it on the PR and stop.
5. Build
| Change | What |
|---|---|
lib/devils_dictionary/curation/runtime/packet.ex |
kinds, bounds, cut, omissions, v2, config-read instruction |
lib/devils_dictionary/curation/runtime/contract.ex |
kinds and the quote rule |
lib/devils_dictionary/curation/runtime/endpoint.ex |
quotas and policy versions as code defaults, configuration-overridable |
lib/devils_dictionary/curation/refresh.ex |
accept packet-v2 as a fingerprint input beside candidates-v1 |
lib/mix/tasks/dd.runtime.ex |
the packet --dry-run subcommand |
priv/curation/runtime_bench/{packets,plan.json} |
only if re-freezing is needed |
docs/curation/runtime-stage-a.md |
one section: packet v2 |
Tests: test/devils_dictionary/curation/runtime/packet_test.exs (extend), packet_v2_scope_test.exs (new), contract_test.exs (extend) |
§6 |
6. Tests
- Every candidate kind the screen offers for a page appears in the packet or in the omitted list; nothing the screen does not offer appears (property over the ten pilot scopes).
- Bierce entries survive any cut; Bierce entries exceeding the cap refuse, never trim.
- Quotas, flow-down and tie-breaks are deterministic: two builds of the same scope at the same record are byte-identical.
- Meanings bound: love's whole On scope (five lexemes, 43 senses, 48 packet meanings) builds, freezes and verifies with 12 meanings, every chosen candidate's meaning kept; so do war (37) and hope (58).
- The omitted list names every dropped candidate by id with its reason; no excerpt text in the summary.
verify/1refuses:packet_stalewhen a work's catalog checksum changes or an exemplar's claim is withdrawn after freezing.- The contract accepts a
workand anexemplarhighlight without a quote and rejects one with a quote; asense_quotationwithout an exact substring is rejected as before. - Fixtures: the four benchmark packets verify under v2, or the re-freeze is recorded and the plan's cases still match their intent.
- The dry-run prints §2.2 for greed (no lead, 7 quotations, 6 meanings) and for love, and writes nothing (row counts unchanged).
- P5's fingerprint accepts the new input: a policy version change re-admits one run and the next visit admits none.
Precommit: MIX_ENV=test MIX_TEST_PARTITION=_cp4 DD_NO_OBAN=1 mix precommit; report the count.
7. Delivery A, implementation ready for review
- Worktree on the external drive with the usual symlinks.
- Build §4–§5, tests §6, precommit green.
- Dry-run on the test partition for the ten pilot pages and paste the ten §2.2 tables in the PR.
- PR "Curation P4 (Curation P4: the packet carries works and examples, bounds meanings as well as candidates, and records its cut (under #254, #253) #262): the packet carries works and examples, bounds meanings, and records its cut". CodeRabbit and one independent review addressed. Write "PR open" on Curation MVP implementation plan: seven parts with agent-ready briefs (P1 read compositions, P2 screen, P3 pin, P4 packet, P5 freshness, P6 proposals, P7 runtime) — under #253 #254's P4 line; tick on merge. Comment here. Stop with the merge command.
8. Delivery B, after the merge
No migration, no restart (no config file change; quotas are code defaults). After git pull, one local request recompiles the published build. Then, read-only on v2: mix dd.runtime packet --scope love --dry-run, the same for war and hope, pasted here as the live evidence; and confirm P5's clock on love re-admitted exactly once for the fingerprint transition and then settled. Close this issue; tick P4 on #254.
9. Constraints
As #254's ground rules: external-drive worktrees, port 5434, private partition, never touch the 4007 server or its launch script, nothing against v2 except the read-only dry-run in Delivery B, gh pr merge is the owner's, build only this issue, report a concrete blocker instead of widening.
10. Acceptance
- Delivery A: kinds, two bounds, the cut with omissions, v2, contract, dry-run, fingerprint transition; tests 1–10 green; count reported.
- All ten pilot scopes build, freeze and verify, love, war and hope included.
- Benchmark fixtures verify or are re-frozen with the reason recorded.
- Reviewed PR merged; P4 ticked on Curation MVP implementation plan: seven parts with agent-ready briefs (P1 read compositions, P2 screen, P3 pin, P4 packet, P5 freshness, P6 proposals, P7 runtime) — under #253 #254.
- Delivery B: the three live dry-run tables here; P5 settled after one re-admission.
11. Implementation prompt
Implement #262 exactly as written. Read it in full, then #254's ground rules and P4 section, #253 §5a (the trimming policy and both bounds), §9 and D9, PR #258's Candidates module and PR #260's runtime changes, docs/curation/runtime-stage-a.md and the benchmark record, and the files in §3 and §5. Discover candidates through Curation.Candidates.for_page/1 so the packet offers exactly what the screen offers; implement both bounds and the deterministic cut with recorded omissions; move the packet to v2; read the instruction version from config; extend the contract; add the dry-run; add the P5 fingerprint transition. Call no model. Build with the tests in §6, dry-run the ten pilot pages on the test partition, run the required precommit, open the PR, address CodeRabbit and one independent review, write "PR open" on #254's P4 line, comment here, and stop with the merge command. Do not build proposals, pinning or anything in P6 or P3. Report a concrete blocker instead of broadening scope.
Activity
Every candidate is held to the screen's meaning, verify rebuilds the …
The packet offers what the screen offers, cuts it by quota and meanin…
Every candidate is held to the screen's meaning, verify rebuilds the …
The runbook says what bench seed now does with a plan's packets alrea…
holden commentedon Oct 26, 2026
Delivery A: PR #265 is open (26 Oct 2026). It is stacked on #263 and must merge after it. Once #263 lands in
main, the branch is rebased ontomainonce.What #265 builds, as §4 and §5 ask:
runtime-packet-v2discovers its candidates throughCuration.Candidates.for_page/1, so works and accepted exemplars join definitions and quotations. Each candidate is held to the meaning the screen offers it under, and a definition is offered as the screen shows it.content. Too many Bierce entries refuse the packet; it is never trimmed.4/3/3/2are filled in source-priority order, ties by object id, with unused quota flowing to the next kind.verify/1re-derives every kind against the screen, the catalog, the claim and the priority set.quote_not_allowedfor works and exemplars.mix dd.runtime packet --scope SLUG --dry-run --instruction Vprints the cut.packet-v2/cut-v1/meanings-v2. Acandidates-v1baseline re-admits its page once and then settles.Checks:
_cp4gives 19 doctests, 2,979 tests, 0 failures.devils_dictionary_runtime_bench, andbench seednow keeps them in place.Two questions are on the PR for the owner:
cut-v2.A fact for P7's go/no-go: a v2 packet never offers a definition under a sense, so #263's ambiguous check scores a choice a P6 editor will not have.
Delivery B (after the merge, on the owner's word): no migration and no restart.
git pull, then one local request.fingerprint_version) and then settled.Merge:
gh pr merge 265 --merge, after #263 and the rebase.Merge pull request #265 from razrfly/claude/262-packet-v2
holden commentedon Oct 26, 2026
Delivery B, done (26 Oct 2026).
devils_dictionary_v2on a connection whose every transaction wasREAD ONLY(SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, checked astransaction_read_only = onbefore the first read). It was run in the main checkout's dev build (_build/dev), separate from the published host's_build/published.The three dry runs on v2
mix dd.runtime packet --scope SLUG --dry-run --instruction generic-editor-v2. v2 holds no model config, so the instruction is named: the revised, pinned one.love
love: chosen and omitted, by id
war: chosen and omitted, by id
hope: chosen and omitted, by id
What they show:
illustratesclaim for them yet.cut-v2would let unused places flow back to cut quotations.cut-v2question for the owner; I did not change it.P5's clock on love (composition 1)
curation_refresh_statesandoban_jobs, read only:candidates-v1baseline of another version, completed asneeds_editorwith reasonfingerprint_version, and stored the newpacket-v2/cut-v1/meanings-v2fingerprint.Refresh.decision/2answers:freshfor row 1 now, so a visit admits nothing until 28 Oct, when the window is due.Delivery A and B are complete. Ticking P4 on #254 and closing this issue. The two
cut-v2questions (backward flow; one quotation per sense first) and the exemplar order stay with the owner on #265.