@xhulz/nina 0.53.2 → 0.53.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/package.json +1 -1
  2. package/releases/0.53.3/core/GAPS.md +125 -0
  3. package/releases/0.53.3/core/answered.json +68 -0
  4. package/releases/0.53.3/core/defaults/tree/.claude/agents/architect.md +1 -0
  5. package/releases/0.53.3/core/defaults/tree/.claude/agents/dba.md +3 -0
  6. package/releases/0.53.3/core/defaults/tree/.claude/agents/devops.md +1 -0
  7. package/releases/0.53.3/core/defaults/tree/.claude/agents/implementer.md +1 -0
  8. package/releases/0.53.3/core/defaults/tree/.claude/agents/integration-tester.md +3 -0
  9. package/releases/0.53.3/core/defaults/tree/.claude/agents/qa.md +7 -0
  10. package/releases/0.53.3/core/defaults/tree/.claude/agents/reviewer.md +3 -0
  11. package/releases/0.53.3/core/defaults/tree/.claude/agents/secops.md +3 -0
  12. package/releases/0.53.3/core/defaults/tree/.claude/agents/solidity-auditor.md +3 -0
  13. package/releases/0.53.3/core/defaults/tree/.claude/agents/solidity-dev.md +3 -0
  14. package/releases/0.53.3/core/tree/.claude/agents/architect.md +129 -0
  15. package/releases/0.53.3/core/tree/.claude/agents/dba.md +117 -0
  16. package/releases/0.53.3/core/tree/.claude/agents/devops.md +118 -0
  17. package/releases/0.53.3/core/tree/.claude/agents/implementer.md +163 -0
  18. package/releases/0.53.3/core/tree/.claude/agents/integration-tester.md +168 -0
  19. package/releases/0.53.3/core/tree/.claude/agents/planner.md +132 -0
  20. package/releases/0.53.3/core/tree/.claude/agents/qa.md +150 -0
  21. package/releases/0.53.3/core/tree/.claude/agents/reviewer.md +184 -0
  22. package/releases/0.53.3/core/tree/.claude/agents/secops.md +120 -0
  23. package/releases/0.53.3/core/tree/.claude/agents/solidity-auditor.md +126 -0
  24. package/releases/0.53.3/core/tree/.claude/agents/solidity-dev.md +123 -0
  25. package/releases/0.53.3/core/tree/.claude/agents-overview.md +64 -0
  26. package/releases/0.53.3/core/tree/.claude/frontend.md +10 -0
  27. package/releases/0.53.3/core/tree/.claude/graph.md +75 -0
  28. package/releases/0.53.3/core/tree/.claude/patterns.md +251 -0
  29. package/releases/0.53.3/core/tree/.claude/pills/README.md +150 -0
  30. package/releases/0.53.3/core/tree/.claude/pipeline.md +101 -0
  31. package/releases/0.53.3/core/tree/.claude/retrieval.md +103 -0
  32. package/releases/0.53.3/core/tree/.claude/router.md +202 -0
  33. package/releases/0.53.3/core/tree/.claude/templates/integration.md +46 -0
  34. package/releases/0.53.3/core/tree/CLAUDE.md +164 -0
  35. package/releases/0.53.3/core/tree/scripts/cost-watch.mjs +25 -0
  36. package/releases/0.53.3/core/tree/scripts/edit-guard.mjs +24 -0
  37. package/releases/0.53.3/core/tree/scripts/harness-check.mjs +71 -0
  38. package/releases/0.53.3/core/tree/scripts/loop-gate.mjs +19 -0
  39. package/releases/0.53.3/core/vocabulary.json +13 -0
  40. package/releases/0.53.3/surfaces/blockchain/tree/.claude/agents/architect.md +5 -0
  41. package/releases/0.53.3/surfaces/blockchain/tree/.claude/agents/devops.md +5 -0
  42. package/releases/0.53.3/surfaces/blockchain/tree/.claude/agents/reviewer.md +5 -0
  43. package/releases/0.53.3/surfaces/blockchain/tree/.claude/agents/solidity-auditor.md +18 -0
  44. package/releases/0.53.3/surfaces/blockchain/tree/.claude/agents/solidity-dev.md +16 -0
  45. package/releases/0.53.3/surfaces/blockchain/tree/.claude/agents-overview.md +6 -0
  46. package/releases/0.53.3/surfaces/blockchain/tree/.claude/graph.md +11 -0
  47. package/releases/0.53.3/surfaces/blockchain/tree/.claude/router.md +6 -0
  48. package/releases/0.53.3/surfaces/blockchain/tree/CLAUDE.md +12 -0
  49. package/releases/0.53.3/surfaces/d1/tree/.claude/agents/dba.md +15 -0
  50. package/releases/0.53.3/surfaces/d1/tree/.claude/agents/devops.md +2 -0
  51. package/releases/0.53.3/surfaces/d1/tree/.claude/agents/implementer.md +2 -0
  52. package/releases/0.53.3/surfaces/d1/tree/.claude/patterns.md +8 -0
  53. package/releases/0.53.3/surfaces/d1/tree/CLAUDE.md +2 -0
  54. package/releases/0.53.3/surfaces/db/tree/.claude/agents/architect.md +5 -0
  55. package/releases/0.53.3/surfaces/db/tree/.claude/agents/dba.md +54 -0
  56. package/releases/0.53.3/surfaces/db/tree/.claude/agents/devops.md +5 -0
  57. package/releases/0.53.3/surfaces/db/tree/.claude/agents/implementer.md +2 -0
  58. package/releases/0.53.3/surfaces/db/tree/.claude/agents/integration-tester.md +10 -0
  59. package/releases/0.53.3/surfaces/db/tree/.claude/agents/planner.md +2 -0
  60. package/releases/0.53.3/surfaces/db/tree/.claude/agents/reviewer.md +22 -0
  61. package/releases/0.53.3/surfaces/db/tree/.claude/agents/secops.md +2 -0
  62. package/releases/0.53.3/surfaces/db/tree/.claude/agents-overview.md +5 -0
  63. package/releases/0.53.3/surfaces/db/tree/.claude/graph.md +8 -0
  64. package/releases/0.53.3/surfaces/db/tree/.claude/patterns.md +22 -0
  65. package/releases/0.53.3/surfaces/db/tree/.claude/pipeline.md +13 -0
  66. package/releases/0.53.3/surfaces/db/tree/.claude/retrieval.md +5 -0
  67. package/releases/0.53.3/surfaces/db/tree/.claude/router.md +4 -0
  68. package/releases/0.53.3/surfaces/db/tree/CLAUDE.md +17 -0
  69. package/releases/0.53.3/surfaces/drizzle/tree/.claude/agents/dba.md +9 -0
  70. package/releases/0.53.3/surfaces/drizzle/tree/.claude/agents/devops.md +5 -0
  71. package/releases/0.53.3/surfaces/drizzle/tree/.claude/agents/implementer.md +2 -0
  72. package/releases/0.53.3/surfaces/drizzle/tree/.claude/patterns.md +7 -0
  73. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/agents/architect.md +14 -0
  74. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/agents/dba.md +2 -0
  75. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/agents/devops.md +29 -0
  76. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/agents/implementer.md +14 -0
  77. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/agents/integration-tester.md +11 -0
  78. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/agents/qa.md +3 -0
  79. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/agents/reviewer.md +8 -0
  80. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/agents/secops.md +8 -0
  81. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/patterns.md +17 -0
  82. package/releases/0.53.3/surfaces/edge-cf/tree/.claude/retrieval.md +8 -0
  83. package/releases/0.53.3/surfaces/edge-cf/tree/CLAUDE.md +27 -0
  84. package/releases/0.53.3/surfaces/frontend/tree/.claude/agents/architect.md +20 -0
  85. package/releases/0.53.3/surfaces/frontend/tree/.claude/agents/devops.md +28 -0
  86. package/releases/0.53.3/surfaces/frontend/tree/.claude/agents/implementer.md +25 -0
  87. package/releases/0.53.3/surfaces/frontend/tree/.claude/agents/qa.md +17 -0
  88. package/releases/0.53.3/surfaces/frontend/tree/.claude/agents/reviewer.md +56 -0
  89. package/releases/0.53.3/surfaces/frontend/tree/.claude/patterns.md +8 -0
  90. package/releases/0.53.3/surfaces/frontend/tree/.claude/retrieval.md +2 -0
  91. package/releases/0.53.3/surfaces/frontend/tree/.claude/router.md +14 -0
  92. package/releases/0.53.3/surfaces/frontend/tree/CLAUDE.md +5 -0
  93. package/releases/0.53.3/surfaces/integrations/tree/.claude/agents/architect.md +16 -0
  94. package/releases/0.53.3/surfaces/integrations/tree/.claude/agents/implementer.md +12 -0
  95. package/releases/0.53.3/surfaces/integrations/tree/.claude/agents/integration-tester.md +20 -0
  96. package/releases/0.53.3/surfaces/integrations/tree/.claude/agents/planner.md +2 -0
  97. package/releases/0.53.3/surfaces/integrations/tree/.claude/agents/reviewer.md +21 -0
  98. package/releases/0.53.3/surfaces/integrations/tree/.claude/agents/secops.md +2 -0
  99. package/releases/0.53.3/surfaces/integrations/tree/.claude/agents-overview.md +8 -0
  100. package/releases/0.53.3/surfaces/integrations/tree/.claude/graph.md +10 -0
  101. package/releases/0.53.3/surfaces/integrations/tree/.claude/patterns.md +38 -0
  102. package/releases/0.53.3/surfaces/integrations/tree/.claude/pipeline.md +16 -0
  103. package/releases/0.53.3/surfaces/integrations/tree/.claude/retrieval.md +16 -0
  104. package/releases/0.53.3/surfaces/integrations/tree/.claude/router.md +6 -0
  105. package/releases/0.53.3/surfaces/integrations/tree/CLAUDE.md +17 -0
  106. package/releases/0.53.3/surfaces/money/tree/.claude/agents/architect.md +12 -0
  107. package/releases/0.53.3/surfaces/money/tree/.claude/agents/dba.md +14 -0
  108. package/releases/0.53.3/surfaces/money/tree/.claude/agents/implementer.md +11 -0
  109. package/releases/0.53.3/surfaces/money/tree/.claude/agents/integration-tester.md +3 -0
  110. package/releases/0.53.3/surfaces/money/tree/.claude/agents/reviewer.md +23 -0
  111. package/releases/0.53.3/surfaces/money/tree/.claude/agents/secops.md +5 -0
  112. package/releases/0.53.3/surfaces/money/tree/.claude/agents/solidity-auditor.md +4 -0
  113. package/releases/0.53.3/surfaces/money/tree/.claude/agents/solidity-dev.md +4 -0
  114. package/releases/0.53.3/surfaces/money/tree/.claude/graph.md +2 -0
  115. package/releases/0.53.3/surfaces/money/tree/.claude/patterns.md +49 -0
  116. package/releases/0.53.3/surfaces/money/tree/.claude/pipeline.md +2 -0
  117. package/releases/0.53.3/surfaces/money/tree/.claude/retrieval.md +2 -0
  118. package/releases/0.53.3/surfaces/money/tree/CLAUDE.md +11 -0
  119. package/releases/0.53.3/surfaces/pii/tree/.claude/agents/dba.md +2 -0
  120. package/releases/0.53.3/surfaces/pii/tree/.claude/agents/devops.md +8 -0
  121. package/releases/0.53.3/surfaces/pii/tree/.claude/agents/reviewer.md +8 -0
  122. package/releases/0.53.3/surfaces/pii/tree/.claude/agents/secops.md +2 -0
  123. package/releases/0.53.3/surfaces/pii/tree/.claude/agents/solidity-auditor.md +5 -0
  124. package/releases/0.53.3/surfaces/pii/tree/CLAUDE.md +5 -0
  125. package/releases/0.53.3/surfaces/prisma/tree/.claude/agents/architect.md +2 -0
  126. package/releases/0.53.3/surfaces/prisma/tree/.claude/agents/dba.md +42 -0
  127. package/releases/0.53.3/surfaces/prisma/tree/.claude/agents/devops.md +11 -0
  128. package/releases/0.53.3/surfaces/prisma/tree/.claude/agents/implementer.md +2 -0
  129. package/releases/0.53.3/surfaces/prisma/tree/.claude/agents/integration-tester.md +2 -0
  130. package/releases/0.53.3/surfaces/prisma/tree/.claude/agents/reviewer.md +2 -0
  131. package/releases/0.53.3/surfaces/prisma/tree/.claude/patterns.md +15 -0
  132. package/releases/0.53.3/surfaces/prisma/tree/CLAUDE.md +5 -0
  133. package/src/commands/learn.mjs +25 -15
  134. package/src/dashboard.html +104 -19
  135. package/src/dashboard.mjs +5 -1
@@ -0,0 +1,49 @@
1
+ <!-- nina:slot money.1 -->
2
+
3
+ ---
4
+
5
+ ## Monetary values & percentages
6
+
7
+ - **Money is an integer of the currency's minor unit**, end to end — {{MINOR_UNIT}}, never a float, never a type that can hold a fraction of one. Source of precision: `{{MONEY_MODULE}}`.
8
+ - **Percentages are basis points** (`40% → 4000`, `100% → 10000`) so a distribution is exact without floating point.
9
+ - **Parsing, formatting and percentage arithmetic live in one module and nowhere else.** A second place that turns a string into money is a second rounding rule, and the two will disagree on a value somebody is owed.
10
+ - **Never** convert to a floating-point type before formatting, and never let a display format round a stored value.
11
+ - Monetary database columns are integer. JSON responses serialize them as **strings**, not numbers, so no client parses them into a float. The service owns the conversion.
12
+
13
+ <!-- nina:slot money.2 -->
14
+
15
+ ---
16
+
17
+ ## Distribution invariants (enforced by reviewer + unit tests)
18
+
19
+ The distribution engine lives in `{{CORE_PKG}}`. It is pure and total over integer {{MINOR_UNIT}}:
20
+
21
+ - A destination is either a percentage (basis points of the amount) or a fixed value.
22
+ - `total = Σ destinations`, computed in {{MINOR_UNIT}}.
23
+ - `total > amount` → **reject.** Never clamp, never distribute what is not there.
24
+ - `total < amount` → **allow**, surface the shortfall, and leave the remainder **parked**. Silence is the defect here: an unexplained remainder is indistinguishable from a bug.
25
+ - `total = amount` → OK.
26
+ - A retention is just another destination — the same arithmetic applies to it, with no special case.
27
+
28
+ <!-- nina:slot money.3 -->
29
+
30
+ ---
31
+
32
+ ## State machines & idempotency (enforced by reviewer)
33
+
34
+ - **Every money-moving entity is a state machine.** Its states and legal transitions are declared in `.claude/architecture.md`; the code follows the declaration, not the other way round. Illegal transitions throw; they are never silently coerced.
35
+ - **Every transition writes an audit row** (entity type, entity id, from, to, actor). No transition without a trail — the trail is what makes a money bug diagnosable after the money has moved.
36
+ - **Outbound transfers are idempotent.** Each carries a unique key, and dedupe happens before the side effect, at the serialization point.
37
+ - **One serialization point per balance.** Whatever computes and dispatches against a single balance never runs concurrently with itself. Two concurrent runs over one balance is how a double send happens even when every individual write is correct.
38
+
39
+ <!-- nina:slot money.4 -->
40
+ - **Money computation and dispatch go through the serialization point.** Routes, queue consumers and tools never run a distribution or a transfer synchronously in the request path.
41
+
42
+ <!-- nina:slot money.5 -->
43
+ - **The distribution engine lives in `{{CORE_PKG}}`.** Services call it as a pure function; they do not embed money logic inline.
44
+
45
+ <!-- nina:slot money.6 -->
46
+ - Idempotency on money-moving writes: the record carries an idempotency key, and the serialization point refuses the second attempt *before* the side effect.
47
+
48
+ <!-- nina:slot money.7 -->
49
+ - `{{CORE_PKG}}` is the most-tested package — pure functions over fixtures. Cover the distribution invariants exhaustively: over, under, exact, mixed percentage and fixed, and rounding.
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot money.1 -->
2
+ - **Money invariants respected** — a distribution never exceeds the amount; a shortfall is parked, not distributed; transfers idempotent; every transition audited.
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot money.1 -->
2
+ | New distribution / transfer logic | `.claude/architecture.md` § *Money*, `.claude/patterns.md` § *Distribution invariants*, `{{CORE_PKG}}/` | architect → implementer → reviewer → qa |
@@ -0,0 +1,11 @@
1
+ <!-- nina:slot money.1 -->
2
+ 3. **An outbound transfer is idempotent — it is NEVER sent twice.** Every transfer carries an idempotency key, and deduplication happens at a single serialization point **before** the side effect, never after it. A retry, a re-delivered queue message, a double-click and a replayed webhook must all collapse to one transfer. This is the highest-blast-radius invariant in the system: almost everything else can be corrected afterwards, and a duplicated transfer cannot.
3
+
4
+ <!-- nina:slot money.2 -->
5
+ 4. **Conservation — what comes in equals what goes out plus what is retained.** A distribution may NEVER exceed the amount it distributes → **block**. If it is **less**, **alert** and leave the remainder **parked** and visible — never silently distributed, never silently absorbed. All arithmetic is integer {{MINOR_UNIT}}; percentages are basis points. The LLM never computes a monetary value.
6
+
7
+ <!-- nina:slot money.3 -->
8
+ 5. **State-machine integrity.** Every money-moving entity has an explicit set of states and legal transitions, declared in `.claude/architecture.md` § *State machines* — not inferred from whatever code happens to exist. Only declared transitions are legal; an illegal one throws and is never silently coerced. **Every transition writes an audit row** (entity, id, from → to, actor, when). Skipping a state, inventing one, or landing a transition with no audit row is a hard reject.
9
+
10
+ <!-- nina:slot money.4 -->
11
+ - **money movement**: anything that creates, moves, settles or records a balance
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot pii.1 -->
2
+ - **Privacy.** No sensitive value in clear text where it must not be. The categories are declared in `.claude/architecture.md` § *Privacy* — they are not decided per query, and not decided by you. **Document bytes live only in the object store, referenced by key: the column holds the key, never the bytes.** Any column the architect's spec flagged for masking must be encrypted at rest. Reject a schema that widens what is stored in the clear.
@@ -0,0 +1,8 @@
1
+ <!-- nina:slot pii.1 -->
2
+
3
+ **Point it at an UNAUTHENTICATED route — a sign-in page is the right one.** Never sign in, and never
4
+ screenshot a signed-in page. Accounts on deployed environments hold real personal data, and a
5
+ screenshot or a console dump pulls it into agent transcripts and logs, where it persists and nobody
6
+ ever looks for it again. That is a privacy leak with no upside here: the sign-in page proves
7
+ everything this check is for. It renders from the same bundle, it exercises the same build-time env
8
+ inlining (a missing variable blanks it identically), and it needs no session.
@@ -0,0 +1,8 @@
1
+ <!-- nina:slot pii.1 -->
2
+ - Check for privacy regressions: **no sensitive value in a log, an error message — a library's own included — a URL or a test fixture**, per the categories in `.claude/architecture.md` § *Privacy*; document bytes only in the object store, never plaintext in the database; no leaked secret.
3
+
4
+ <!-- nina:slot pii.2 -->
5
+ - **privacy** — the privacy check above, in full: no sensitive value in a log, an error message, a
6
+ URL or a test fixture; document bytes only in the object store; no leaked secret. Where
7
+ **tenant-and-privacy** is dispatched, its reviewer owns this too and there is no separate one; where
8
+ it is not, this is a dimension of its own. Either way it is never nobody's.
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot pii.1 -->
2
+ - **Privacy (Hard Rule #8)** — the categories declared in `.claude/architecture.md` § *Privacy* must never appear in logs, in responses that do not need them, in error paths, or in the database in clear text. Check every endpoint that returns a person's record for fields it includes by accident: a `select` that quietly grew a column is the usual way this leaks. Check the error paths too — they are written last and reviewed least — and what the libraries on them print or carry in their own errors, bound values included.
@@ -0,0 +1,5 @@
1
+ <!-- nina:slot pii.1 -->
2
+ - **Nothing personal reaches the chain.** What is written on-chain is public, permanent, and beyond
3
+ deletion by anyone — including by you, and including after a subject asks. A hash of a personal
4
+ identifier is not a protection: it is a lookup table for whoever holds the input set. Reject a
5
+ personal datum stored in state, emitted in an event, or passed as calldata.
@@ -0,0 +1,5 @@
1
+ <!-- nina:slot pii.1 -->
2
+ 8. **Sensitive personal data is classified, and the classification is enforced.** What counts as sensitive here — identity documents, financial identifiers, anything a person would not expect to be readable by whoever can read a log — is declared in `.claude/architecture.md` § *Privacy*, along with the regime that governs it ({{PRIVACY_REGIME}}). Encrypted at rest. **No sensitive value in a log, an error message, a URL, an analytics event, or an agent transcript** — the places nobody thinks about are exactly the ones that persist. That includes what a library puts in its own errors and prints itself: a database client's error can carry the query and every bound value, and a framework can log a whole error past the logger it was given. A database error is mapped at the data layer to a typed error from a closed list before anything logs or returns it, and a test proves that a bound value it writes reaches no thrown error. Document bytes live only in the object store, referenced by key, never in the database in clear text.
3
+
4
+ <!-- nina:slot pii.2 -->
5
+ - **personal data**: where it is collected, stored, logged or sent
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-client-api` | a new or changed Prisma query |
@@ -0,0 +1,42 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-cli` | **before ANY `prisma` CLI command** — `validate`, `format`, `migrate dev`, `migrate diff`, `migrate deploy`. Flags differ between versions, and one of them (`migrate diff --shadow-database-url` against a live database) destroys the database it points at |
3
+ | `prisma-client-api` | auditing a new or changed query — filters, operators, `$transaction` semantics. Through a driver adapter, cite the adapter's installed source for what a transaction does: the skill describes the default engine, and an adapter can roll back less |
4
+
5
+ <!-- nina:slot prisma.2 -->
6
+ Neither skill covers a **caching or edge layer sitting on top of the client** — cache strategy,
7
+ edge-client behaviour and the rule about never caching a read that authorizes a write belong to that
8
+ layer's own integration doc, declared like any other integration. A skill does not replace it.
9
+
10
+ <!-- nina:slot prisma.3 -->
11
+ - **With Prisma, both offline.** Run `pnpm --filter {{DB_PKG_NAME}} exec prisma validate`; it must pass. Then run `prisma migrate diff` in its **offline, file-only form** and read the generated SQL, not just the Prisma delta. Its flags changed in Prisma 7, so read the installed major (`prisma --version`) before writing the command:
12
+
13
+ ```
14
+ # Prisma 6. Compare the PREVIOUS schema against the working one — pure file-to-file, no database.
15
+ git show HEAD:{{DB_PKG}}/prisma/schema.prisma > /tmp/schema-head.prisma
16
+ pnpm --filter {{DB_PKG_NAME}} exec prisma migrate diff \
17
+ --from-schema-datamodel /tmp/schema-head.prisma \
18
+ --to-schema-datamodel prisma/schema.prisma \
19
+ --script
20
+ ```
21
+
22
+ From Prisma 7 the two flags are `--from-schema` and `--to-schema`, and the schema engine starts from the
23
+ datasource in `prisma.config.ts` even for this diff: with none there, it prints nothing and exits 0. For
24
+ SQLite a placeholder the diff never opens is enough, a `file:` URL under a gitignored directory; for any
25
+ other provider, find out what the diff opens before you give it one. Never a real database's URL. A first schema has nothing at `HEAD`: diff it `--from-empty`. Compare the output against the
26
+ hand-written `migration.sql` to confirm the declarative parts match.
27
+
28
+ ⚠️ **Do NOT reach for `--from-migrations`.** It looks like the natural choice and it is a trap:
29
+ Prisma refuses it without a shadow database (`--shadow-database-url`, or from Prisma 7 a
30
+ `shadowDatabaseUrl` in `prisma.config.ts`), which pushes you toward supplying a database URL — the exact move that destroys databases (below). The file-to-file form above answers the
31
+ same question with no database involved.
32
+
33
+ ⛔ **NEVER point `--shadow-database-url`, `--from-url`, `--to-url`, `--from-schema-datasource` — or, from Prisma 7, a `shadowDatabaseUrl` or the config datasource behind `--from-config-datasource` — at a real database, most of all not the one `{{SECRETS_LOCAL}}` names.** Prisma **executes** the entire migration history against whatever database those flags name, which **DESTROYS ALL DATA** in it. A shadow database must be a disposable, empty database and nothing else. It does not announce itself: the command completes with a reassuring "empty migration" result and no error, having already destroyed everything in the database it was pointed at. If the offline form above cannot answer your question, **STOP and report that to the orchestrator** instead of reaching for a database URL.
34
+
35
+ <!-- nina:slot prisma.4 -->
36
+ - **Where reads are cached through Prisma Accelerate,** every `findUnique` / `findMany` on a hot read path names its `cacheStrategy` (`ttl` / `swr`), and one that feeds a correctness-critical write names none.
37
+
38
+ <!-- nina:slot prisma.5 -->
39
+ - **On an edge runtime,** new Prisma code paths use the edge client of the installed major: `@prisma/client/edge` up to Prisma 6; from 7, the client the `prisma-client` generator writes with the platform's `runtime` set, imported from where it is generated — `@prisma/client/edge` fails there with `MODULE_NOT_FOUND`.
40
+
41
+ <!-- nina:slot prisma.6 -->
42
+ - Run a Prisma command that writes to a real database — `prisma migrate dev`, `migrate deploy`, `migrate reset`, `migrate resolve`, `db push`, `db execute`, `$executeRaw*` — or **any `prisma migrate diff` variant carrying a database URL**, which silently wipes the database it points at.
@@ -0,0 +1,11 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ - **`prisma-cli`** — before `migrate deploy` or any other Prisma CLI command against a real database.
3
+
4
+ <!-- nina:slot prisma.2 -->
5
+ - **Prisma migrations go out with `prisma migrate deploy`**, and nothing else changes a shared database's schema.
6
+
7
+ <!-- nina:slot prisma.3 -->
8
+ - Run `prisma migrate diff --shadow-database-url <url>` against any live database. It **executes** the migration history against that database, destroying everything in it, and reports success. Use a disposable shadow database or don't run it.
9
+
10
+ <!-- nina:slot prisma.4 -->
11
+ - Run `prisma migrate reset` against a shared database, ever.
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-client-api` | a new or changed Prisma query |
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-cli` | a Prisma CLI command |
@@ -0,0 +1,2 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | `prisma-client-api` | a new or changed Prisma query |
@@ -0,0 +1,15 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ - **Database table/column names** (Prisma `@map` / `@@map`): `snake_case` in SQL, `camelCase` in TS.
3
+
4
+ <!-- nina:slot prisma.2 -->
5
+ - Where Prisma reads are cached through Accelerate, `cacheStrategy` lives in `{{DB_PKG}}`: services do not add, strip, or override cache policies.
6
+
7
+ <!-- nina:slot prisma.3 -->
8
+
9
+ ### Prisma
10
+
11
+ - Schema lives in `{{DB_PKG}}/prisma/schema.prisma`. Nowhere else.
12
+ - **Never write raw SQL** unless justified in a code comment with perf data.
13
+ - N+1 is solved with `include` / `select`, chosen deliberately.
14
+ - Where reads are cached through Accelerate, every `findUnique` / `findMany` on a hot path defines its `cacheStrategy`, and no direct connection string is embedded in code.
15
+ - Tests run a real Prisma client against a real database; the client is never mocked.
@@ -0,0 +1,5 @@
1
+ <!-- nina:slot prisma.1 -->
2
+ | Run any `prisma` CLI command (the database gate, devops, and the integration gate where there is one) | `prisma-cli` | flags differ between versions; `migrate diff --shadow-database-url` against a live DB wiped dev/staging once |
3
+
4
+ <!-- nina:slot prisma.2 -->
5
+ | Write or audit a Prisma query (architect, implementer, the database gate, reviewer) | `prisma-client-api` | filters, operators, `$transaction` semantics. a caching or edge layer on top of the client is **NOT covered** — its cache strategy belongs to that layer's own integration doc |
@@ -39,7 +39,7 @@ import { autoExport } from './export.mjs';
39
39
  import { beforeModel } from '../detectors.mjs';
40
40
 
41
41
  /** Loop-backs from one role, since its newest lesson, that make a lesson overdue. */
42
- const CAPTURE_AT = 3;
42
+ export const CAPTURE_AT = 3;
43
43
 
44
44
  /**
45
45
  * How far back a loop-back still counts. Older ones are history nobody remembers well enough to
@@ -115,7 +115,8 @@ const SENT_BACK_HOURS = 24;
115
115
  *
116
116
  * @param {object[]} records - Recorded dispatches.
117
117
  * @param {Map<string, Map<string, Map<string, number>>>|null} loops - The graph's capped loop-back edges.
118
- * @returns {Map<object, string>} Loop-back record → the stage it sent work back to, where one can be told.
118
+ * @returns {Map<object, {to: string, fix: object|null}>} Loop-back record → the stage it sent work back to, where
119
+ * one can be told, and the dispatch of that stage that took the work back, where one was found.
119
120
  */
120
121
  export function sentBackTo(records, loops) {
121
122
  const out = new Map();
@@ -133,7 +134,7 @@ export function sentBackTo(records, loops) {
133
134
  const within = (x) => Date.parse(x.ts) - Date.parse(back) <= SENT_BACK_HOURS * 3_600_000;
134
135
  const next = (bySession.get(r.session) ?? []).find((x) => String(x.ts) > back && within(x) && targets.has(x.role));
135
136
  const to = next?.role ?? (targets.size === 1 ? [...targets.keys()][0] : null);
136
- if (to) out.set(r, to);
137
+ if (to) out.set(r, { to, fix: next ?? null });
137
138
  }
138
139
  return out;
139
140
  }
@@ -155,7 +156,7 @@ export function overdue(records, known, now = new Date(), days = CAPTURE_DAYS, o
155
156
  // A loop-back is the lesson of the stage it sent work back to, where that is known (`sentBackTo`): charged
156
157
  // to the stage that gave the verdict, the reviewer owed the implementer's lessons, and only a pill naming
157
158
  // every checker in its applies_to ever settled the count.
158
- const ownerOf = (r) => owners.get(r) ?? r.role;
159
+ const ownerOf = (r) => owners.get(r)?.to ?? r.role;
159
160
  const roles = [...new Set(records.map(ownerOf).filter(Boolean))];
160
161
  const out = [];
161
162
  for (const role of roles) {
@@ -214,7 +215,7 @@ export function applied(records, known) {
214
215
  }
215
216
 
216
217
  /** How many days either side of a lesson's date its role is measured over: the same on both sides. */
217
- const VERIFY_DAYS = 14;
218
+ export const VERIFY_DAYS = 14;
218
219
 
219
220
  /** A day as `YYYY-MM-DD`, moved by some days. */
220
221
  const shift = (date, days) => new Date(Date.parse(`${date}T12:00:00Z`) + days * 86_400_000).toISOString().slice(0, 10);
@@ -248,18 +249,30 @@ function wilson(k, n) {
248
249
  * graph sends work back to. A change is called only where the two intervals do not overlap. Not proof — the
249
250
  * work changes too — but a number where one can be had, and the reason where it cannot.
250
251
  *
252
+ * A round is counted sent back once, however many loop-backs sent it: the checkers that run beside each other
253
+ * each reject the same work, and one project's architect had 14 loop-backs on a day it ran 7 rounds, which the
254
+ * share read as 100% sent back where 5 of the 7 were. Loop-backs that the same dispatch took back are one.
255
+ *
251
256
  * @param {object[]} records - Recorded dispatches.
252
257
  * @param {Awaited<ReturnType<typeof lessons>>} known - The project's pills.
253
- * @param {{owners?: Map<object, string>, targets?: Set<string>|null}} [graph] - Who each loop-back sent work
254
- * back to, and the stages the graph sends work back to at all.
258
+ * @param {{owners?: ReturnType<typeof sentBackTo>, targets?: Set<string>|null}} [graph] - Who each loop-back sent
259
+ * work back to, and the stages the graph sends work back to at all.
255
260
  * @returns {{rel: string, date: string, role: string, comparable: boolean, why?: string, on?: string|null,
256
- * was?: string, before?: {n: number, loops: number}, after?: {n: number, loops: number},
257
- * change?: 'lower'|'higher'|'unclear', control?: {before: {n: number, loops: number}, after: {n: number, loops: number}}}[]}
261
+ * was?: string, before?: Side, after?: Side, change?: 'lower'|'higher'|'unclear', control?: {before: Side, after: Side}}[]}
262
+ * A `Side` is `{n, loops, span}`: the stage's rounds, how many were sent back, and the first and last day a round
263
+ * of it was recorded on, since a project younger than the window has fewer days than fourteen to show.
258
264
  */
259
265
  export function verified(records, known, { owners = new Map(), targets = null } = {}) {
260
266
  const out = [];
261
- const ownerOf = (r) => owners.get(r) ?? r.role;
267
+ const ownerOf = (r) => owners.get(r)?.to ?? r.role;
262
268
  const sentBack = records.filter((r) => readable(r.verdict) && isLoopBack(r.verdict));
269
+ // The rounds these loop-backs sent back: those one dispatch took back are one. One no dispatch took back counts on
270
+ // its own, since nothing then says which work it rejected.
271
+ const sendings = (backs) => new Set(backs.map((r) => owners.get(r)?.fix ?? r)).size;
272
+ const sideOf = (these, backs) => {
273
+ const days = these.map((r) => day(r.ts)).sort();
274
+ return { n: these.length, loops: Math.min(these.length, sendings(backs)), span: [days[0] ?? null, days.at(-1) ?? null] };
275
+ };
263
276
  const ranOn = (r) => (r.usage_model ? `${r.usage_model}${r.effort ? ` · ${r.effort}` : ''}` : null);
264
277
  for (const lesson of known.filter((l) => l.date)) {
265
278
  const from = shift(lesson.date, -VERIFY_DAYS);
@@ -274,10 +287,7 @@ export function verified(records, known, { owners = new Map(), targets = null }
274
287
  }
275
288
  const rounds = records.filter((r) => r.role === role && readable(r.verdict));
276
289
  const backs = sentBack.filter((r) => ownerOf(r) === role);
277
- const side = (pick, mine) => {
278
- const n = mine.filter(pick).length;
279
- return { n, loops: Math.min(n, backs.filter(pick).length) };
280
- };
290
+ const side = (pick, mine) => sideOf(mine.filter(pick), backs.filter(pick));
281
291
  if (side(pre, rounds).n < VERIFY_MIN || side(post, rounds).n < VERIFY_MIN) {
282
292
  const [b, a] = [side(pre, rounds).n, side(post, rounds).n];
283
293
  out.push({ ...base, comparable: false, why: `too few rounds of ${role} either side (${b} before, ${a} after, in ${VERIFY_DAYS} days each)` });
@@ -302,7 +312,7 @@ export function verified(records, known, { owners = new Map(), targets = null }
302
312
  const others = [...(targets ?? new Set(sentBack.map(ownerOf)))].filter((x) => x !== role);
303
313
  const theirs = records.filter((r) => others.includes(r.role) && readable(r.verdict));
304
314
  const otherBacks = sentBack.filter((r) => others.includes(ownerOf(r)));
305
- const control = (pick) => ({ n: theirs.filter(pick).length, loops: Math.min(theirs.filter(pick).length, otherBacks.filter(pick).length) });
315
+ const control = (pick) => sideOf(theirs.filter(pick), otherBacks.filter(pick));
306
316
  out.push({ ...base, comparable: true, on, before, after, change, control: { before: control(pre), after: control(post) } });
307
317
  }
308
318
  }
@@ -61,7 +61,21 @@
61
61
  .stage { display: grid; grid-template-columns: 170px 1fr; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid #2a2838; }
62
62
  .empty { color: var(--faint); padding: 30px 0; text-align: center; }
63
63
  .note { margin: 4px 0; font-size: 13px; }
64
- @media (max-width: 640px) { .stage { grid-template-columns: 1fr; } nav { margin-left: 0; } }
64
+ .answer { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--faint); border-radius: 6px; padding: 12px 16px; margin: 0 0 14px; }
65
+ .answer[data-tone="ok"] { border-left-color: var(--green); } .answer[data-tone="bad"] { border-left-color: var(--red); } .answer[data-tone="warn"] { border-left-color: var(--amber); }
66
+ .answer .q { color: var(--faint); font-size: 12px; }
67
+ .answer .head { font: 600 18px var(--sans); margin: 2px 0 4px; }
68
+ .answer p { margin: 2px 0; color: var(--soft); font-size: 13px; }
69
+ .cmp { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin: 0 0 10px; }
70
+ .cmp .top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
71
+ .cmp .verdict { margin-left: auto; font: 600 13px var(--mono); }
72
+ .chip.wraps { white-space: normal; overflow-wrap: anywhere; }
73
+ .meter { display: grid; grid-template-columns: 48px minmax(60px, 1fr) 44px minmax(0, 230px); align-items: center; gap: 2px 10px; margin: 4px 0; font-size: 13px; }
74
+ .meter .pctv { text-align: right; }
75
+ @media (max-width: 640px) {
76
+ .stage { grid-template-columns: 1fr; } nav { margin-left: 0; }
77
+ .meter { grid-template-columns: 48px minmax(60px, 1fr) 44px; } .meter .detail { grid-column: 2 / -1; }
78
+ }
65
79
  </style>
66
80
  </head>
67
81
  <body>
@@ -210,34 +224,105 @@ const RENDER = {
210
224
 
211
225
  learning(d) {
212
226
  if (!d) return el('p', { class: 'empty' }, 'No profile here to read the learning cycle of.');
213
- const measured = d.checks.filter((c) => c.before);
227
+ const name = (rel) => rel.replace(/^\.claude\/pills\//, '').replace(/^retired\//, '').replace(/\.md$/, '');
228
+ const graduated = (rel) => rel.startsWith('.claude/pills/retired/');
229
+ const dayOf = (iso) => new Date(`${iso}T12:00:00`).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
230
+ const daysIn = ([a, b]) => Math.round((Date.parse(`${b}T12:00:00Z`) - Date.parse(`${a}T12:00:00Z`)) / 86_400_000) + 1;
231
+ const lessonChip = (rel) => el('span', { class: 'chip wraps', title: rel }, name(rel), graduated(rel) ? el('span', { class: 'faint' }, ' · graduated') : null);
232
+ // Lessons written the same day for the same stage are read over the same rounds, so they are one comparison, not
233
+ // a row each repeating its numbers.
234
+ const groups = [];
235
+ for (const c of d.checks.filter((x) => x.before)) {
236
+ const same = groups.find((g) => g.role === c.role && g.date === c.date && g.on === c.on);
237
+ if (same) same.lessons.push(c.rel);
238
+ else groups.push({ ...c, lessons: [c.rel] });
239
+ }
240
+ const rank = { higher: 0, lower: 1, unclear: 2 };
241
+ groups.sort((a, b) => rank[a.change] - rank[b.change] || b.date.localeCompare(a.date) || a.role.localeCompare(b.role));
214
242
  const unmeasured = d.checks.filter((c) => !c.before);
243
+ const [less, more, unclear] = ['lower', 'higher', 'unclear'].map((k) => groups.filter((g) => g.change === k).length);
244
+ const lessonsRead = new Set(groups.flatMap((g) => g.lessons)).size;
245
+ const history = d.span ? daysIn(d.span) : 0;
246
+ const shortest = Math.min(...groups.flatMap((g) => [g.before, g.after]).map((side) => (side.span[0] ? daysIn(side.span) : 0)));
247
+ // The share is of work sent back, so up is worse. A move the rounds are too few to tell from chance still says
248
+ // which way it went: "could be chance" alone read, beside 33% → 67%, as if the larger number were the better one.
249
+ const share = (side) => (side.n ? Math.round((100 * side.loops) / side.n) : 0);
250
+ const verdict = (g) =>
251
+ g.change === 'lower' ? ['ok', '▼ better: sent back less']
252
+ : g.change === 'higher' ? ['bad', '▲ worse: sent back more']
253
+ : share(g.after) > share(g.before) ? ['faint', '▲ sent back more, but could be chance']
254
+ : share(g.after) < share(g.before) ? ['faint', '▼ sent back less, but could be chance']
255
+ : ['faint', '≈ no change'];
256
+
257
+ const answer = !groups.length
258
+ ? { tone: 'faint', head: 'Not measurable yet', body: unmeasured.length ? `None of the ${unmeasured.length} lesson-and-stage pairs has enough rounds of its stage on both sides of its date — the reasons are at the bottom.` : 'No lesson has been written yet.' }
259
+ : less && more
260
+ ? { tone: 'warn', head: 'Mixed', body: `${less} comparison(s) sent back less since their lessons, ${more} sent back more, ${unclear} with no clear change.` }
261
+ : more
262
+ ? { tone: 'bad', head: 'Sent back more since', body: `In ${more} of ${groups.length} comparison(s) the stage had more of its work sent back after its lessons than before; ${unclear ? `the other ${unclear} show no clear change` : 'none shows less'}.` }
263
+ : less
264
+ ? { tone: 'ok', head: 'Sent back less since', body: `In ${less} of ${groups.length} comparison(s) the stage had less of its work sent back after its lessons than before${unclear ? `; the other ${unclear} show no clear change` : ''}.` }
265
+ : { tone: 'faint', head: 'No clear change yet', body: `None of the ${groups.length} comparison(s) moved by more than chance moves a share at that many rounds.` };
266
+
267
+ const meter = (label, side) => el('div', { class: 'meter' },
268
+ el('span', { class: 'faint' }, label),
269
+ bar([[side.n ? side.loops / side.n : 0, 'var(--amber)']]),
270
+ el('span', { class: 'mono pctv' }, pct(side.loops, side.n)),
271
+ el('span', { class: 'faint detail' }, `${side.loops} of ${side.n} rounds · ${side.span[0] ? `${dayOf(side.span[0])}${side.span[1] !== side.span[0] ? ` – ${dayOf(side.span[1])}` : ''}` : 'no day'}`),
272
+ );
273
+ const comparison = (g) => el('div', { class: 'cmp' },
274
+ el('div', { class: 'top' },
275
+ el('span', { class: 'role' }, g.role),
276
+ el('span', { class: 'soft' }, `${g.lessons.length} lesson${g.lessons.length > 1 ? 's' : ''} written ${dayOf(g.date)}`),
277
+ g.on ? el('span', { class: 'faint mono' }, g.on) : null,
278
+ el('span', { class: `verdict ${verdict(g)[0]}` }, verdict(g)[1]),
279
+ ),
280
+ el('div', { class: 'faint', style: 'font-size:12px;margin:0 0 2px' }, `share of the ${g.role}'s rounds sent back to it · lower is better`),
281
+ meter('before', g.before),
282
+ meter('after', g.after),
283
+ el('div', { class: 'faint', style: 'margin:6px 0 8px' }, `for reference, the other stages over the same days: ${pct(g.control.before.loops, g.control.before.n)} → ${pct(g.control.after.loops, g.control.after.n)}`),
284
+ el('div', { class: 'chips' }, g.lessons.map(lessonChip)),
285
+ );
286
+ // What could not be measured, by its reason: the same reason, word for word, is one line.
287
+ const reasons = new Map();
288
+ for (const c of unmeasured) reasons.set(c.why, [...(reasons.get(c.why) ?? []), c.rel]);
289
+
215
290
  return el('div', {},
216
291
  el('h2', {}, 'Learning'),
217
292
  el('p', { class: 'sub' }, said('Whether the pipeline learns from its own runs, link by link, as `nina learn` reads it.')),
293
+ el('div', { class: 'answer', 'data-tone': answer.tone },
294
+ el('div', { class: 'q' }, 'Did the lessons help?'),
295
+ el('div', { class: 'head' }, answer.head),
296
+ el('p', {}, answer.body),
297
+ groups.length && history < 2 * d.window + 1
298
+ ? el('p', {}, `This project has ${history} day(s) of history, so a lesson is compared over fewer than the ${d.window} days either side the measure asks for: read it as an early sign.`)
299
+ : groups.length && shortest < d.window
300
+ ? el('p', {}, `The shortest comparison has rounds on ${shortest} day(s) of one side, of the ${d.window} the measure reads: read it as an early sign.`)
301
+ : null,
302
+ ),
218
303
  el('div', { class: 'cards' },
219
- card('observe', d.rounds ? `${d.runs} runs` : '—', d.rounds ? `${d.rounds} rounds, ${d.span[0]} → ${d.span[1]}` : 'nothing recorded'),
220
- card('capture', d.late.length ? `${d.late.length} owed` : '✓', d.late.length ? 'stages sent back with nothing written down' : `no stage sent back 3+ times without a lesson in ${d.days} days`),
221
- card('apply', d.use.measured ? pct(d.use.read, d.use.measured) : '—', d.use.measured ? `of ${d.use.measured} runs read a lesson` : 'not measured yet'),
222
- card('graduate', `${d.open.length} open`, `${d.ready.length} at 3+ · ${d.madeHere} made a rule here`),
304
+ card('observe · what ran', d.rounds ? `${d.runs} runs` : '—', d.rounds ? `${d.rounds} rounds, ${d.span[0]} → ${d.span[1]}` : 'nothing recorded'),
305
+ card('capture · written down?', d.late.length ? `${d.late.length} owed` : '✓', d.late.length ? 'stages sent back with nothing written down' : `no stage sent back ${d.at}+ times without a lesson in ${d.days} days`),
306
+ card('apply · read?', d.use.measured ? pct(d.use.read, d.use.measured) : '—', d.use.measured ? `of ${d.use.measured} runs read a lesson` : 'not measured yet'),
307
+ card('verify · helped?', !groups.length ? '—' : less && more ? 'mixed' : more ? '▲ more' : less ? '▼ less' : '≈ unclear', groups.length ? `${groups.length} comparison(s) of ${lessonsRead} lesson(s): ${less} sent back less, ${more} more` : 'nothing measurable yet'),
308
+ card('graduate · made rules?', `${d.open.length} open`, `${d.ready.length} at ${d.at}+ · ${d.madeHere} made a rule here${d.relapses.length ? ` · ${d.relapses.length} watched` : ''}`),
223
309
  card('loops', d.gated ? (d.activity ? String(d.activity.rounds) : '—') : 'no gate', d.activity ? `rounds on capped edges · ${d.activity.held} sent to you` : d.gated ? 'no ledger yet' : 'caps are instructions'),
224
310
  ),
225
311
  d.late.length ? [el('h3', {}, 'capture · sent back with nothing written down'), d.late.map((o) => el('div', { class: 'note' }, el('span', { class: 'role' }, o.role), ` ${o.count} loop-back(s) ${o.since ? `since its newest lesson (${o.since})` : 'and no lesson at all'}`, el('ul', { class: 'list soft' }, o.recent.map((r) => el('li', {}, `${when(r.ts)} · ${r.desc ?? '(no description)'}`)))))] : null,
312
+ el('h3', {}, 'verify · is each stage sent back less since its lessons?'),
313
+ el('p', { class: 'note soft', style: 'margin-bottom:12px' }, `For each lesson, the share of its stage's rounds that a later stage sent back, in the ${d.window} days before it was written and the ${d.window} after — lower is better. A change is called only when it is larger than chance moves a share at that many rounds. The other stages, over the same days, say whether everything moved at once: then it was the work that changed, not the lesson.`),
314
+ groups.length ? groups.map(comparison) : el('p', { class: 'note faint' }, 'No lesson could be measured yet.'),
226
315
  d.owed.length ? [el('h3', {}, 'to graduate · here or in the harness'), d.owed.map((o) => el('p', { class: 'note' }, el('span', { class: 'mono' }, o.rel), o.declined ? el('span', { class: 'soft' }, ` — declined by the harness${o.declined.in ? ` in ${o.declined.in}` : ''}: ${o.declined.why}`) : el('span', { class: 'soft' }, ` — recurred ${o.occurrences} times`)))] : null,
227
316
  d.open.length ? [el('h3', {}, 'requests open in the harness'), table(['since', 'pill', 'proposed for'], d.open.map((r) => [el('span', { class: 'mono soft' }, r.date), el('span', { class: 'mono' }, r.pill), r.target]))] : null,
228
- d.relapses.length ? [el('h3', {}, 'came back after graduating'), d.relapses.map((r) => el('p', { class: `note ${r.due ? 'bad' : 'soft'}` }, `${r.due ? '✗' : '·'} ${r.rel} came back ${r.recurred} time(s) after ${r.target === 'project' ? `it became a rule here in ${r.rule_in}` : `its rule shipped in ${r.answered_in || 'a release'}`}${r.due ? ' — the rule did not hold' : ' — watched'}`))] : null,
229
- el('h3', {}, 'verify · is each lesson sent back less since?'),
230
- measured.length
231
- ? table(['lesson', 'stage', 'before → after', 'n', 'change', 'other stages'], measured.map((c) => [
232
- el('span', { class: 'mono' }, c.rel.replace(/^\.claude\/pills\//, '')),
233
- el('span', { class: 'role' }, c.role),
234
- `${pct(c.before.loops, c.before.n)} → ${pct(c.after.loops, c.after.n)}`,
235
- `${c.before.n} → ${c.after.n}`,
236
- el('span', { class: c.change === 'lower' ? 'ok' : c.change === 'higher' ? 'bad' : 'faint' }, { lower: 'sent back less', higher: 'sent back more', unclear: 'no clear change' }[c.change]),
237
- el('span', { class: 'soft' }, `${pct(c.control.before.loops, c.control.before.n)} → ${pct(c.control.after.loops, c.control.after.n)}`),
238
- ]), [3])
239
- : el('p', { class: 'note faint' }, 'No lesson could be measured yet.'),
240
- unmeasured.length ? el('p', { class: 'note faint' }, `${unmeasured.length} more could not be measured.`) : null,
317
+ d.relapses.length ? [el('h3', {}, 'graduated, then seen again'),
318
+ d.relapses.map((r) => el('p', { class: 'note' },
319
+ el('span', { class: r.due ? 'bad' : 'faint' }, r.due ? '✗ ' : '· '),
320
+ el('span', { class: 'mono', title: r.rel }, name(r.rel)),
321
+ el('span', { class: 'soft' }, ` — seen ${r.recurred} time(s) since its rule ${r.target === 'project' ? `was made here in ${r.rule_in}` : `shipped in ${r.answered_in || 'a release'}`}`),
322
+ r.due ? el('span', { class: 'bad' }, ': the rule did not hold') : el('span', { class: 'faint' }, `; watched, it reopens at ${d.at}`)))] : null,
323
+ unmeasured.length ? el('details', { style: 'margin-top:24px' },
324
+ el('summary', { class: 'soft', style: 'cursor:pointer' }, `${unmeasured.length} lesson-and-stage pair(s) could not be measured, and why`),
325
+ [...reasons].map(([why, rels]) => el('div', { class: 'note', style: 'margin:10px 0' }, el('div', { class: 'soft' }, why), el('div', { class: 'chips', style: 'margin-top:4px' }, rels.map(lessonChip))))) : null,
241
326
  );
242
327
  },
243
328
 
package/src/dashboard.mjs CHANGED
@@ -21,7 +21,7 @@ import { layerRootFor } from './commands/compose.mjs';
21
21
  import { taskList } from './commands/runs.mjs';
22
22
  import { pipelineData } from './commands/pipeline.mjs';
23
23
  import { pillsData } from './commands/pills.mjs';
24
- import { learningData } from './commands/learn.mjs';
24
+ import { CAPTURE_AT, VERIFY_DAYS, learningData } from './commands/learn.mjs';
25
25
  import { statsData } from './commands/stats.mjs';
26
26
 
27
27
  /** The page: one self-contained file, nothing fetched from anywhere else. */
@@ -72,6 +72,10 @@ export function dashboardTabs(target, ctx) {
72
72
  const d = await learningData(target, layers.dir, profile, { records: roundsOf(target) });
73
73
  return {
74
74
  days: d.days,
75
+ // How many times makes an event: a stage sent back, a lesson recurring, a rule that came back. And the days
76
+ // either side of a lesson that verify reads, which a project younger than them cannot fill.
77
+ at: CAPTURE_AT,
78
+ window: VERIFY_DAYS,
75
79
  runs: d.runs,
76
80
  rounds: d.rounds,
77
81
  span: d.span,