opencode-self-improvement 0.30.1 → 0.30.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.
- package/package.json +3 -2
- package/src/capture/available.ts +30 -31
- package/src/capture/candidates.ts +2 -2
- package/src/capture/checked.ts +3 -3
- package/src/capture/guided-rules.ts +1 -1
- package/src/capture/lag.ts +2 -2
- package/src/capture/policy.ts +7 -7
- package/src/capture/prompt.ts +4 -4
- package/src/capture/runtime.ts +86 -90
- package/src/capture/session-model.ts +2 -2
- package/src/capture/transcript.ts +5 -5
- package/src/capture/triggers.ts +7 -7
- package/src/consolidate/propose.ts +4 -4
- package/src/consolidate/render.ts +2 -2
- package/src/core/cmp-ts.ts +1 -1
- package/src/core/config/budgets.ts +1 -1
- package/src/core/config/paths.ts +1 -1
- package/src/core/guidance.ts +1 -1
- package/src/core/hooks.ts +4 -4
- package/src/core/host.ts +1 -1
- package/src/core/logfmt/format.ts +1 -1
- package/src/core/logfmt/publish.ts +1 -1
- package/src/core/logfmt/read.ts +1 -1
- package/src/core/lru.ts +1 -1
- package/src/core/state.ts +4 -4
- package/src/core/tags.ts +9 -10
- package/src/core/time.ts +1 -1
- package/src/core/tokenize.ts +1 -1
- package/src/events.ts +8 -8
- package/src/evidence/record.ts +10 -11
- package/src/gate/gate.ts +25 -25
- package/src/gate/value-conflict.ts +7 -8
- package/src/hits/ledger.ts +4 -4
- package/src/identity/host-events.ts +3 -3
- package/src/identity/repokey.ts +7 -7
- package/src/identity/session-context.ts +7 -7
- package/src/index.ts +6 -6
- package/src/init/detect.ts +3 -3
- package/src/init/format.ts +6 -6
- package/src/init/retag.ts +7 -7
- package/src/init/run.ts +18 -18
- package/src/init/stamp.ts +17 -17
- package/src/inject/anchor.ts +1 -1
- package/src/inject/budget.ts +1 -1
- package/src/inject/digest.ts +5 -5
- package/src/inject/epochs.ts +15 -15
- package/src/inject/format.ts +2 -2
- package/src/inject/pull.ts +3 -3
- package/src/inject/version.ts +1 -1
- package/src/portable/decay.ts +1 -1
- package/src/portable/export.ts +7 -7
- package/src/portable/import.ts +5 -5
- package/src/recall/conflicts.ts +1 -1
- package/src/recall/dedupe.ts +31 -55
- package/src/recall/gate.ts +19 -40
- package/src/recall/relevant.ts +11 -11
- package/src/recall/score.ts +14 -23
- package/src/recall/shared-terms.ts +1 -1
- package/src/status/format.ts +1 -1
- package/src/status/metrics.ts +5 -5
- package/src/status/payload.ts +4 -4
- package/src/status/report.ts +5 -5
- package/src/status/store-summary.ts +1 -1
- package/src/status/write.ts +3 -4
- package/src/store/blocklist.ts +1 -1
- package/src/store/files/append.ts +8 -8
- package/src/store/files/deletions.ts +3 -3
- package/src/store/files/load.ts +5 -5
- package/src/store/files/prune.ts +8 -8
- package/src/store/files/snapshots.ts +1 -1
- package/src/store/files/supersede.ts +11 -12
- package/src/store/files/target.ts +1 -1
- package/src/store/lock.ts +12 -12
- package/src/store/model/memory.ts +4 -4
- package/src/store/model/predicates.ts +2 -2
- package/src/store/model/provenance.ts +1 -1
- package/src/store/model/visibility.ts +4 -4
- package/src/store/prune.ts +1 -1
- package/src/store/quarantine/quarantine.ts +2 -2
- package/src/store/quarantine/release.ts +2 -2
- package/src/store/secrets.ts +1 -1
- package/src/store/tombstones/rejection.ts +1 -1
- package/src/store/tombstones/tombstone.ts +5 -5
- package/src/store/undo.ts +12 -12
- package/src/tools/consolidate.ts +1 -1
- package/src/tools/decay.ts +2 -2
- package/src/tools/deps.ts +1 -1
- package/src/tools/evidence.ts +4 -4
- package/src/tools/export.ts +1 -1
- package/src/tools/forget.ts +2 -2
- package/src/tools/import.ts +3 -3
- package/src/tools/init.ts +1 -1
- package/src/tools/list.ts +1 -1
- package/src/tools/merge-review.ts +11 -11
- package/src/tools/recall.ts +5 -5
- package/src/tools/registry.ts +2 -2
- package/src/tools/remember.ts +4 -4
- package/src/tools/schema.ts +4 -4
- package/src/tools/status-tool.ts +5 -5
- package/src/tools/undo.ts +4 -4
- package/src/tools/update.ts +18 -19
- package/src/viewer/mutate.ts +13 -13
- package/src/viewer/rejections.ts +1 -1
- package/src/viewer/server.ts +47 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-self-improvement",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.3",
|
|
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",
|
package/src/capture/available.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
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
|
|
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
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
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
|
|
83
|
-
// cutoff
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
459
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
-
//
|
|
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
|
-
|
|
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.
|
|
716
|
-
// residual
|
|
717
|
-
// staging database."
|
|
718
|
-
// `deploy` runs rsync.
|
|
719
|
-
//
|
|
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
|
|
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
|
|
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
|
|
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.
|
package/src/capture/checked.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
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
|
-
//
|
|
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
|
|
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
|
|
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.
|
package/src/capture/lag.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// lag — split from src/capture.ts
|
|
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
|
|
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;
|
package/src/capture/policy.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Capture policy: WHEN a capture is worth paying for
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
package/src/capture/prompt.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// prompt — split from src/capture.ts
|
|
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
|
|
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
|
|
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
|
-
//
|
|
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;
|