opencode-self-improvement 0.30.0 → 0.30.2

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 (105) hide show
  1. package/README.md +2 -4
  2. package/package.json +3 -2
  3. package/src/capture/available.ts +30 -31
  4. package/src/capture/candidates.ts +2 -2
  5. package/src/capture/checked.ts +3 -3
  6. package/src/capture/guided-rules.ts +1 -1
  7. package/src/capture/lag.ts +2 -2
  8. package/src/capture/policy.ts +7 -7
  9. package/src/capture/prompt.ts +4 -4
  10. package/src/capture/runtime.ts +86 -90
  11. package/src/capture/session-model.ts +2 -2
  12. package/src/capture/transcript.ts +5 -5
  13. package/src/capture/triggers.ts +7 -7
  14. package/src/consolidate/propose.ts +4 -4
  15. package/src/consolidate/render.ts +2 -2
  16. package/src/core/cmp-ts.ts +1 -1
  17. package/src/core/config/budgets.ts +1 -1
  18. package/src/core/config/paths.ts +1 -1
  19. package/src/core/guidance.ts +1 -1
  20. package/src/core/hooks.ts +4 -4
  21. package/src/core/host.ts +1 -1
  22. package/src/core/logfmt/format.ts +1 -1
  23. package/src/core/logfmt/publish.ts +1 -1
  24. package/src/core/logfmt/read.ts +1 -1
  25. package/src/core/lru.ts +1 -1
  26. package/src/core/state.ts +4 -4
  27. package/src/core/tags.ts +9 -10
  28. package/src/core/time.ts +1 -1
  29. package/src/core/tokenize.ts +1 -1
  30. package/src/events.ts +8 -8
  31. package/src/evidence/record.ts +10 -11
  32. package/src/gate/gate.ts +25 -25
  33. package/src/gate/value-conflict.ts +7 -8
  34. package/src/hits/ledger.ts +4 -4
  35. package/src/identity/host-events.ts +3 -3
  36. package/src/identity/repokey.ts +7 -7
  37. package/src/identity/session-context.ts +7 -7
  38. package/src/index.ts +6 -6
  39. package/src/init/detect.ts +3 -3
  40. package/src/init/format.ts +6 -6
  41. package/src/init/retag.ts +7 -7
  42. package/src/init/run.ts +18 -18
  43. package/src/init/stamp.ts +17 -17
  44. package/src/inject/anchor.ts +1 -1
  45. package/src/inject/budget.ts +1 -1
  46. package/src/inject/digest.ts +5 -5
  47. package/src/inject/epochs.ts +15 -15
  48. package/src/inject/format.ts +2 -2
  49. package/src/inject/pull.ts +3 -3
  50. package/src/inject/version.ts +1 -1
  51. package/src/portable/decay.ts +1 -1
  52. package/src/portable/export.ts +7 -7
  53. package/src/portable/import.ts +5 -5
  54. package/src/recall/conflicts.ts +1 -1
  55. package/src/recall/dedupe.ts +31 -55
  56. package/src/recall/gate.ts +19 -40
  57. package/src/recall/relevant.ts +11 -11
  58. package/src/recall/score.ts +14 -23
  59. package/src/recall/shared-terms.ts +1 -1
  60. package/src/status/format.ts +1 -1
  61. package/src/status/metrics.ts +5 -5
  62. package/src/status/payload.ts +4 -4
  63. package/src/status/report.ts +5 -5
  64. package/src/status/store-summary.ts +1 -1
  65. package/src/status/write.ts +3 -4
  66. package/src/store/blocklist.ts +1 -1
  67. package/src/store/files/append.ts +8 -8
  68. package/src/store/files/deletions.ts +3 -3
  69. package/src/store/files/load.ts +5 -5
  70. package/src/store/files/prune.ts +8 -8
  71. package/src/store/files/snapshots.ts +1 -1
  72. package/src/store/files/supersede.ts +11 -12
  73. package/src/store/files/target.ts +1 -1
  74. package/src/store/lock.ts +12 -12
  75. package/src/store/model/memory.ts +4 -4
  76. package/src/store/model/predicates.ts +2 -2
  77. package/src/store/model/provenance.ts +1 -1
  78. package/src/store/model/visibility.ts +4 -4
  79. package/src/store/prune.ts +1 -1
  80. package/src/store/quarantine/quarantine.ts +2 -2
  81. package/src/store/quarantine/release.ts +2 -2
  82. package/src/store/secrets.ts +1 -1
  83. package/src/store/tombstones/rejection.ts +1 -1
  84. package/src/store/tombstones/tombstone.ts +5 -5
  85. package/src/store/undo.ts +12 -12
  86. package/src/tools/consolidate.ts +1 -1
  87. package/src/tools/decay.ts +2 -2
  88. package/src/tools/deps.ts +1 -1
  89. package/src/tools/evidence.ts +4 -4
  90. package/src/tools/export.ts +1 -1
  91. package/src/tools/forget.ts +2 -2
  92. package/src/tools/import.ts +3 -3
  93. package/src/tools/init.ts +1 -1
  94. package/src/tools/list.ts +1 -1
  95. package/src/tools/merge-review.ts +11 -11
  96. package/src/tools/recall.ts +5 -5
  97. package/src/tools/registry.ts +2 -2
  98. package/src/tools/remember.ts +4 -4
  99. package/src/tools/schema.ts +4 -4
  100. package/src/tools/status-tool.ts +5 -5
  101. package/src/tools/undo.ts +4 -4
  102. package/src/tools/update.ts +18 -19
  103. package/src/viewer/mutate.ts +13 -13
  104. package/src/viewer/rejections.ts +1 -1
  105. package/src/viewer/server.ts +47 -49
package/README.md CHANGED
@@ -411,14 +411,12 @@ Raw sweep output is regenerable measurement data, and it was the largest tracked
411
411
 
412
412
  | Artifact | How to get it back |
413
413
  | --- | --- |
414
- | `bench/append-publication-198/` | The pinned recipe below. |
414
+ | `bench/append-publication-198/` and its runner | The git history: `git log -- bench/runners/append-cost-198.ts`. The runner measured two pinned checkouts of pre-#168 modules and no longer runs against a current tree. |
415
415
  | A mutation sweep log | `bun scripts/test-sweep.ts --log=<path>`. |
416
416
 
417
- Regenerating `bench/append-publication-198/`: the runner is `bench/runners/append-cost-198.ts`, invoked once per size, mode and platform as `bun bench/runners/append-cost-198.ts <absolute-source-checkout> <size-MiB> <baseline|candidate> <round>`. It loads `src/memory.ts`, `src/logfmt.ts` and `src/config.ts` from the source root it is given, so it must point at the two pinned checkouts of the #198 measurement — baseline `bf9f4d2` (0.15.0) and candidate `7c1dfc4` (the atomic-publication commit on that same base) — not at a current tree, where the #168 restructure moved those modules. Install locked dependencies in each checkout; use the current runner for both source roots; every invocation creates and cleans its own synthetic store and prints one JSON line. Sizes 0.1, 1, 10, 50 MiB; 3 rounds; baseline-then-candidate in rounds 1 and 3, reversed in round 2; 12 sequential appends per invocation, first 2 discarded as warmups, 30 samples pooled per mode/size/platform. Aggregation: sort `latencyMs` ascending, median = average of positions 15 and 16, p95 = nearest rank `ceil(0.95×30)` = position 29, max = position 30. Every invocation asserts the original byte prefix is unchanged and the parsed row count equals `seedRows + 12`. The full methodology — including the measurement limitations, which are part of the claim — is one command away: `git show c86379e^:bench/append-publication-198/methodology.json`.
418
-
419
417
  A script that needs a missing artifact names the file and the command that produces it instead of throwing a stack trace.
420
418
 
421
- The `#71` set is the deliberate exception: `bench/test-integrity-71.json`, `bench/test-integrity-71/before.jsonl`, `bench/test-integrity-71/after.jsonl` and `bench/test-integrity-71-verdicts.json` stay tracked. It looks regenerable and is not. `scripts/triage-71.ts` refuses to run unless the verdicts file carries exactly one verdict per CURRENT test file, and the test tree has grown since #71, so the documented rebuild fails on today's tree (`every current test file needs exactly one verdict`, measured on `main` at `f8f42fd`). Deleting the derived JSON would therefore destroy the only copy of a published number.
419
+ The `#71` set (`bench/test-integrity-71.json`, `bench/test-integrity-71/{before,after}.jsonl`, `bench/test-integrity-71-verdicts.json`, `bench/test-integrity-71-probes.json`) and its one-shot triage script are retired: the published numbers live in `bench/test-sweep-results.md`, and the raw files stay recoverable from history (`git log -- bench/test-integrity-71.json`).
422
420
 
423
421
  ## Troubleshooting
424
422
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-self-improvement",
3
- "version": "0.30.0",
3
+ "version": "0.30.2",
4
4
  "description": "Durable memory for opencode: remember facts, decisions, and commands across sessions, plus a one-command per-repo setup (/repo-init).",
5
5
  "main": "index.ts",
6
6
  "exports": {
@@ -70,7 +70,8 @@
70
70
  "memory-view": "bun run src/viewer/server.ts",
71
71
  "format": "biome format --write",
72
72
  "format:check": "biome format",
73
- "lint": "biome lint && bun run format:check"
73
+ "lint": "biome lint && bun run format:check",
74
+ "lint:comments": "bun scripts/comment-lint.ts"
74
75
  },
75
76
  "dependencies": {
76
77
  "@babel/parser": "7.29.9",
@@ -1,4 +1,4 @@
1
- // #389: capture spends its budget on facts the next session cannot obtain any
1
+ // capture spends its budget on facts the next session cannot obtain any
2
2
  // other way.
3
3
  //
4
4
  // Measured (FINDINGS 2026-11-10, base3 vs base4): reuse does not pay — six pairs,
@@ -9,22 +9,21 @@
9
9
  // generation a row that changes nothing is not free.
10
10
  //
11
11
  // Two availability questions are answerable by a CODE PATH, with no prompt and no
12
- // model call, which is what #389 criterion 1 demands:
12
+ // model call, which is what criterion 1 demands:
13
13
  //
14
14
  // 1. Is this text already in the working tree? A row that restates a tracked
15
15
  // file is readable there by the next session.
16
16
  // 2. Is this command already declared by the project's own gates? A row that
17
17
  // says "run `make deploy`" is answered by the Makefile.
18
18
  //
19
- // Both produce a TAG, not a refusal (#402). Four adversarial review rounds on
20
- // #397 each found the same defect — text that was merely short or partly matched
21
- // was read as already known — and each round patched one instance. Measured
22
- // against this repo's live store: the original rule refused 30 of 1166 real
23
- // captured rows and 29 of those were wrong (the note "OpenCode V2 (v2.0.26) does
24
- // NOT run LSP servers" was refused because it contained the string `bun test` and
25
- // this project declares a `test` script). The hardened rule refuses 0 of 1166. A
26
- // check nobody can trust enough to delete with, and nobody can make cheap enough
27
- // to skip, must not decide anything on its own.
19
+ // Both produce a TAG, not a refusal. A refusal rule was measured here
20
+ // first: it rejected 30 of 1,166 real captured rows and 29 of those were
21
+ // wrong (the note "OpenCode V2 (v2.0.26) does NOT run LSP servers" was
22
+ // refused because it contained the string `bun test` and
23
+ // this project declares a `test` script). A check nobody can trust enough to
24
+ // delete with, and nobody can make cheap enough to skip, must not decide
25
+ // anything on its own. Partial-match and short-fragment traps are pinned by
26
+ // tests; history: docs/adr/0008.
28
27
  //
29
28
  // So the verdict is now evidence attached to a row that is stored anyway:
30
29
  //
@@ -79,13 +78,13 @@ export type AvailabilityVerdict = {
79
78
  // verbs whose whole meaning is "this command gets run". A fragment made of
80
79
  // nothing but these is a MENTION, and a mention is what the manifest already
81
80
  // declares. Everything else is a claim, however short it is — `never` is five
82
- // characters and it is the entire fact (#397 round 4, WhollyMindless: the length
83
- // cutoff dropped `Never` and refused the prohibition).
81
+ // characters and it is the entire fact: a length
82
+ // cutoff drops `Never` and refuses the prohibition).
84
83
  //
85
84
  // This is a whitelist for FILLER, which is the only direction a word list can
86
85
  // safely go: a word left off it is read as a claim and the row is kept. The
87
86
  // RESTRICTION list this replaces whitelisted what counted as NEW, so every word
88
- // missing from it lost a fact — that is the defect round 3 reported.
87
+ // missing from it lost a fact.
89
88
  //
90
89
  // Temporal and conditional words (before, after, until, unless, when, if, only,
91
90
  // once) and every modal are deliberately absent: they state a condition, and a
@@ -169,7 +168,7 @@ const FILLER = new Set([
169
168
 
170
169
  // Assertion boundaries: the edges of the one sentence a match is judged inside.
171
170
  // The candidate is split on these, and the text in the tree is walked back to
172
- // them (#397 round 3). Code 0 is the joiner the scan puts between tracked
171
+ // them. Code 0 is the joiner the scan puts between tracked
173
172
  // files, so a clause can never match across two of them.
174
173
  function isBoundary(code: number): boolean {
175
174
  return (
@@ -184,7 +183,7 @@ function isBoundary(code: number): boolean {
184
183
 
185
184
  // Words that reverse an assertion. This is deliberately NOT the RESTRICTION
186
185
  // list it replaces. That list tried to decide whether a candidate says anything
187
- // NEW, and an open vocabulary can never do that (#397 round 3, WhollyMindless):
186
+ // NEW, and an open vocabulary can never do that:
188
187
  // any word left off the list reopens the class. This one answers one closed
189
188
  // question — does the sentence the tree states have the same POLARITY as the
190
189
  // clause matched inside it? `We do not use tabs` and `Use tabs` are not the
@@ -194,7 +193,7 @@ const NEGATION =
194
193
  /\b(no|not|nor|never|none|cannot|can'?t|don'?t|doesn'?t|didn'?t|won'?t|isn'?t|aren'?t|without|lacks?|lacking|absent|avoid\w*|prohibit\w*|forbid\w*|disallow\w*|refrain\w*|refuses?|instead of|rather than)\b/;
195
194
 
196
195
  /**
197
- * VETO 1 (#402): is this sentence reversed?
196
+ * VETO 1: is this sentence reversed?
198
197
  *
199
198
  * Two sources, unioned, because they answer different questions:
200
199
  *
@@ -237,7 +236,7 @@ function cueNegated(text: string): boolean {
237
236
  }
238
237
 
239
238
  /**
240
- * VETO 2 (#402): a figure the matched declaration does not carry.
239
+ * VETO 2: a figure the matched declaration does not carry.
241
240
  *
242
241
  * `core/tokenize.ts` states the rule and `store/tombstones/tombstone.ts`
243
242
  * measures it on this repo's own data: a correction scores HIGHER than an honest
@@ -455,9 +454,9 @@ function gateHit(spans: string[], gates: Gate[]): Gate | null {
455
454
  * The assertions in a normalised text: the fragments left after splitting on the
456
455
  * sentence boundaries, minus the ones that state nothing.
457
456
  *
458
- * "States nothing" is the FILLER test, not a length. #397 round 4
459
- * (WhollyMindless): the cutoff here was 16 characters, so `Never` was dropped
460
- * from `Never \`npm run deploy\`.` and an empty list was then read as proof that
457
+ * "States nothing" is the FILLER test, not a length: a 16-character
458
+ * cutoff dropped
459
+ * `Never` from `Never \`npm run deploy\`.` and an empty list was then read as proof that
461
460
  * the whole candidate was restatable. A short fragment is where a prohibition, a
462
461
  * window or a number lives; punctuation and "ship with" are what a fragment has
463
462
  * to be before it is ignored.
@@ -512,7 +511,7 @@ function sentenceSpan(
512
511
  }
513
512
 
514
513
  /**
515
- * VETO 1b (#403 review): does this prefix WARN AGAINST the claim that follows?
514
+ * VETO 1b: does this prefix WARN AGAINST the claim that follows?
516
515
  *
517
516
  * `Stop assuming the cache supports TTL expiration.` contains the affirmative
518
517
  * sentence `The cache supports TTL expiration.` as the object of `stop assuming`.
@@ -555,7 +554,7 @@ function warnsAgainst(prefix: string): boolean {
555
554
  * Where the tree states `clause` as its own words, in a sentence of the same
556
555
  * polarity. -1 means "not available".
557
556
  *
558
- * #397 round 3 (WhollyMindless): a bare `indexOf` matches INSIDE the opposite
557
+ * A bare `indexOf` matches INSIDE the opposite
559
558
  * assertion. With `We do not use tabs for indentation.` in the README, the
560
559
  * candidate `Use tabs for indentation.` was refused as available, so the store
561
560
  * would have held the reversal of the rule the gate had just read. A hit now
@@ -677,7 +676,7 @@ export function availabilityIndex(
677
676
 
678
677
  return {
679
678
  check(content: string): AvailabilityVerdict | null {
680
- // #397 review (WhollyMindless): matching PART of a candidate does not
679
+ // Matching PART of a candidate does not
681
680
  // establish the WHOLE fact is available. Both rules used to refuse on
682
681
  // one hit, which lost new facts riding a restated fragment — exactly
683
682
  // the rows this gate exists to preserve:
@@ -696,7 +695,7 @@ export function availabilityIndex(
696
695
  // store/secrets.ts matches `AKIA[A-Z0-9]{16}` case-sensitively, so a span
697
696
  // normalised before scrubbing keeps a fully recoverable access key: the
698
697
  // logged `akia1234567890abcdef` uppercases straight back to the secret
699
- // (#403 review). Redacting `avail.matched` later cannot recover what
698
+ //. Redacting `avail.matched` later cannot recover what
700
699
  // normalisation already destroyed, so this is the only place it can be
701
700
  // done. Verdict logic reads `needed`/`first`, never these.
702
701
  const safeWhole = norm(redactSecrets(content));
@@ -712,11 +711,11 @@ export function availabilityIndex(
712
711
  matched: safeFirst.slice(0, 120),
713
712
  };
714
713
  }
715
- // Declared gate. Round 3 (WhollyMindless) removed the LENGTH test: a short
716
- // residual used to count as a restatement, so "`npm run deploy` wipes the
717
- // staging database." was refused against a manifest that says only that
718
- // `deploy` runs rsync. Round 4 found the same defect still open, in two
719
- // places that both throw information away BEFORE deciding:
714
+ // Declared gate. A LENGTH test is never the question: a short
715
+ // residual is not a restatement, so "`npm run deploy` wipes the
716
+ // staging database." must not refuse against a manifest that says only
717
+ // that `deploy` runs rsync. Nor may information be thrown away BEFORE
718
+ // deciding:
720
719
  // - every command span was stripped after ONE declared gate was found,
721
720
  // so "Before `npm run deploy`, run `aws sso login --profile prod`."
722
721
  // refused with the undeclared AWS prerequisite erased from the row;
@@ -732,7 +731,7 @@ export function availabilityIndex(
732
731
  const spans = statedCommands(content);
733
732
  const gate = gateHit(spans, gates);
734
733
  if (gate) {
735
- // VETOES (#402). The manifest states that a command EXISTS. It does not
734
+ // VETOES. The manifest states that a command EXISTS. It does not
736
735
  // state that the command is safe, allowed, or finished, and it carries
737
736
  // no figure. So a sentence that forbids the command, or a number the
738
737
  // command does not carry, is a claim the declaration cannot answer.
@@ -1,4 +1,4 @@
1
- // candidates — split from src/capture.ts (#168 domain restructure). Declaration bodies are unchanged.
1
+ // candidates — split from src/capture.ts. Declaration bodies are unchanged.
2
2
  // Opt-in auto-capture parsing, prompt, and lag helpers. Host access and model
3
3
  // calls live in src/index.ts. Every candidate that leaves this module flows
4
4
  // through runWriteGate in index.ts: capture NEVER writes memories directly,
@@ -92,7 +92,7 @@ export function parseCandidates(raw: string, max: number): CaptureCandidate[] {
92
92
  o.status === "open" || o.status === "settled" ? o.status : undefined;
93
93
  // A bad kw list costs the row its keywords, never the row itself.
94
94
  const kw = cleanKeywords(o.kw);
95
- // Hint channel (#335): only a literal true counts; junk yields an
95
+ // Hint channel: only a literal true counts; junk yields an
96
96
  // untagged row, the same shape an agent-derived fact has.
97
97
  const guided = o.guided === true;
98
98
  // Contradiction surface (POC): ref/claim/klass ride guided rows only.
@@ -1,4 +1,4 @@
1
- // #393 AC 2: check an inferred claim against the working tree BEFORE storing it.
1
+ // AC 2: check an inferred claim against the working tree BEFORE storing it.
2
2
  //
3
3
  // The scope is deliberately narrow, and the measurement is why it is narrow.
4
4
  // R4's poison rows claimed a fallback VAT rate for a fixture whose config leaves
@@ -13,7 +13,7 @@
13
13
  // So this module answers three ways and only one of them refuses. "Undecidable"
14
14
  // keeps the row — that is the transport case — and the row then rides injection
15
15
  // labelled `[unverified]` (see store/model/provenance.ts), which is the part of
16
- // #393 the evidence actually supports.
16
+ // the evidence actually supports.
17
17
 
18
18
  import { findConstant, valuesAgree } from "../recall/conflicts.ts";
19
19
 
@@ -85,7 +85,7 @@ export function claimVerdictFromContent(
85
85
  );
86
86
  // Compare against every number near the symbol: a row may state the value
87
87
  // in two units and any one of them agreeing is enough to keep it.
88
- // The sign is part of the number (review #399): "-2150" extracted as
88
+ // The sign is part of the number (review): "-2150" extracted as
89
89
  // "2150" agreed with a tree declaring 2150 and shipped the row labelled
90
90
  // [code-checked] — an opposite-signed value positively vouched for by a
91
91
  // check. `valuesAgree` parses leading [+-] itself, so the extractor must
@@ -132,7 +132,7 @@ export function mergeGuidedCandidates(
132
132
  for (const quote of quotes) {
133
133
  const nums = numbers(quote);
134
134
  const topics = topicWords(quote);
135
- // Two boundaries the first version lacked (#364 review):
135
+ // Two boundaries this shape needs:
136
136
  // - ONE quote per candidate. Re-matching a candidate that already carries a
137
137
  // quote overwrote the first fact, so three user sentences all stating
138
138
  // 10.0 stored a single row.
@@ -1,9 +1,9 @@
1
- // lag — split from src/capture.ts (#168 domain restructure). Declaration bodies are unchanged.
1
+ // lag — split from src/capture.ts. Declaration bodies are unchanged.
2
2
 
3
3
  /**
4
4
  * Age of the newest message in a session context, in ms, or null when no
5
5
  * message carries a timestamp. Capture uses this to say how stale a transcript
6
- * was at the moment the model was asked for candidates (#44).
6
+ * was at the moment the model was asked for candidates.
7
7
  */
8
8
  export function lagSince(messages: unknown, now = Date.now()): number | null {
9
9
  let newest = 0;
@@ -1,4 +1,4 @@
1
- // Capture policy: WHEN a capture is worth paying for (#334).
1
+ // Capture policy: WHEN a capture is worth paying for.
2
2
  //
3
3
  // Today every turn end triggers a capture (throttled by a fixed cooldown), and
4
4
  // every capture re-mines the WHOLE transcript. Two costs follow. The first is
@@ -24,7 +24,7 @@ interface Cursor {
24
24
  turn: number;
25
25
  /**
26
26
  * Identity of the messages that capture consumed — the flattened prefix, not
27
- * its last message (#366 review, round 4). A count says how many messages were
27
+ * its last message. A count says how many messages were
28
28
  * consumed; it cannot say WHICH ones, and a host that replaces the transcript
29
29
  * and then lets it grow again hands back an array longer than the cursor that
30
30
  * shares nothing with it.
@@ -54,7 +54,7 @@ function fingerprintOf(text: string): string {
54
54
  * consumed. Undefined when there is nothing to fingerprint: not an array, a
55
55
  * count this array cannot supply, or messages that decode to no text at all.
56
56
  *
57
- * The WHOLE prefix, not its last message (round 4 [P2]): an ordinary assistant
57
+ * The WHOLE prefix, not its last message: an ordinary assistant
58
58
  * reply repeated at the boundary position makes a replaced transcript look
59
59
  * unchanged, and no hash collision is required for that.
60
60
  *
@@ -98,7 +98,7 @@ export function resetCaptureCursors(): void {
98
98
  }
99
99
 
100
100
  /**
101
- * Is this array still the transcript the cursor was counting (#366 review)?
101
+ * Is this array still the transcript the cursor was counting?
102
102
  *
103
103
  * Two shapes say it is not. SHORTER than the count: compaction replaced the
104
104
  * transcript, so `since` names an index that no longer exists — a normal event,
@@ -135,7 +135,7 @@ export function transcriptReplaced(
135
135
  export function deltaMessages(msgs: unknown, since: number): unknown {
136
136
  if (!Array.isArray(msgs) || since <= 0) return msgs;
137
137
  // A context that shrank past the cursor is a REPLACED transcript (compaction),
138
- // not a window that has been fully mined (#366 review). Mine what is there:
138
+ // not a window that has been fully mined. Mine what is there:
139
139
  // an empty window here was skipped by the thin-check WITHOUT advancing the
140
140
  // cursor, so every later turn was skipped as well until the array grew past
141
141
  // the stale count.
@@ -147,7 +147,7 @@ export function deltaMessages(msgs: unknown, since: number): unknown {
147
147
  * Did the USER state a rule or spec in the window? The signal gate reads the
148
148
  * tool ledger, so a session that only talks — "TAX_RATE must be 0.0825", no
149
149
  * edits, no gate commands — would skip the capture and lose the hint channel
150
- * (#339) for good when the session ends. A declarative marker in a user
150
+ * for good when the session ends. A declarative marker in a user
151
151
  * message is the cheap stand-in for "this window can hold a durable fact".
152
152
  *
153
153
  * Deliberately loose in the SAFE direction: a false positive costs one
@@ -164,7 +164,7 @@ export function guidedStatementInWindow(
164
164
  if (!Array.isArray(msgs)) return true;
165
165
  const window = msgs.slice(Math.max(0, sinceMsgs));
166
166
  if (window.length === 0) return false;
167
- // The SAME decode the transcript uses (#366 review): roles come from
167
+ // The SAME decode the transcript uses: roles come from
168
168
  // `info.role` / `role` / `type`, text from `parts[]` / `content[]` / `text` /
169
169
  // a string `content`. Reading one narrow shape here meant a genuine user rule
170
170
  // in any other accepted shape got a no-signal skip before generation — the
@@ -1,4 +1,4 @@
1
- // prompt — split from src/capture.ts (#168 domain restructure). Declaration bodies are unchanged.
1
+ // prompt — split from src/capture.ts. Declaration bodies are unchanged.
2
2
  // Opt-in auto-capture parsing, prompt, and lag helpers. Host access and model
3
3
  // calls live in src/index.ts. Every candidate that leaves this module flows
4
4
  // through runWriteGate in index.ts: capture NEVER writes memories directly,
@@ -13,7 +13,7 @@ export interface CaptureCandidate {
13
13
  scope: string;
14
14
  content: string;
15
15
  status?: "open" | "settled";
16
- /** Retrieval keywords (#40): indexed by the store, never rendered. */
16
+ /** Retrieval keywords: indexed by the store, never rendered. */
17
17
  kw?: string[];
18
18
  /** Literal true only when the user stated the fact, not agent inference. */
19
19
  guided?: boolean;
@@ -54,7 +54,7 @@ export const CAPTURE_KEYWORD_CHARS = 48;
54
54
  // array so parseCandidates can trust it; anything else parses to [].
55
55
  //
56
56
  // `userProse` keeps the session's brief OUT of the work block. Measured on the
57
- // fixture that reproduces #329: brief mixed into one undifferentiated block,
57
+ // fixture that reproduces a known failure: brief mixed into one undifferentiated block,
58
58
  // the model stores it back as a durable `preference`; work block alone, zero
59
59
  // framing rows — but also zero real preferences, because "we use bun here, not
60
60
  // npm" lives in the same prose. So the prose is kept, labelled for what it is.
@@ -78,7 +78,7 @@ export function buildCapturePrompt(
78
78
  "- scope: short area name (e.g. auth, api, build).",
79
79
  '- status: "open" for a live planning thread; otherwise "settled".',
80
80
  "- content: one self-contained fact, 20-600 characters, useful in a NEW session.",
81
- // #409 RESULTS §29-30: retrieval alignment is a WRITE-side property. The
81
+ // RESULTS §29-30: retrieval alignment is a WRITE-side property. The
82
82
  // same lesson scored zero (outside the recall window) as session diary and
83
83
  // ranked 1-7 for the terse symptom queries agents actually issue when it
84
84
  // opened with the observable trigger. The kw rule below is the bridge;