instar 1.3.1144 → 1.3.1145

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.
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "generatedFrom": "source-tree",
4
4
  "registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
5
- "packageVersion": "1.3.1144",
5
+ "packageVersion": "1.3.1145",
6
6
  "guards": [
7
7
  {
8
8
  "ref": "docs/audits/phase-b/f10-triage.md",
@@ -1,5 +1,5 @@
1
1
  {
2
- "sha256": "a01cf44f29d7c2c5e2bc284dbcd18e27b5c4d6035f3fee7b8e8254e8a993cf2d",
2
+ "sha256": "4a5b88caa62ae256f4868735dc66735c52ae30604a8272c977ca1f4564086e43",
3
3
  "registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
4
- "packageVersion": "1.3.1144"
4
+ "packageVersion": "1.3.1145"
5
5
  }
@@ -2,5 +2,5 @@
2
2
  "sha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
3
3
  "articleCount": 88,
4
4
  "generatedFrom": "docs/STANDARDS-REGISTRY.md",
5
- "packageVersion": "1.3.1144"
5
+ "packageVersion": "1.3.1145"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.3.1144",
3
+ "version": "1.3.1145",
4
4
  "description": "Coherence infrastructure for self-evolving AI agents — on the Claude Code or Codex subscription you already have.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,8 +12,37 @@
12
12
  * separate module from the writer so this ban has a precise import target —
13
13
  * actuators MAY hold the writer (they emit), they may never read.
14
14
  *
15
- * Guardrail, not proof (a consumer could re-read the JSONL by hand); the
16
- * declared §3.9 duty is the authority, this catches the direct pattern.
15
+ * ── 2026-08-14: the header used to declare TWO limitations. One is now closed,
16
+ * one is NOT, and pretending otherwise would be the worse outcome.
17
+ *
18
+ * CLOSED — "this catches the direct pattern". The match required the `from`
19
+ * keyword, so `await import(...)` and `require(...)` walked straight past it.
20
+ * Reproduced against the shipped lint on a REAL listed actuator: it reported
21
+ * "clean". Now every module-loading form is matched, comments are stripped
22
+ * first (so a §3.9 reference in prose can never be a violation), and a
23
+ * runtime-erased `import type` is correctly NOT a violation.
24
+ *
25
+ * NOT CLOSED — "grow this list when a new actuator class lands". The population
26
+ * is still curated by hand. Automatic discovery was BUILT, MEASURED AGAINST THIS
27
+ * TREE, AND REJECTED on the evidence: inferring "is this an actuator?" from
28
+ * declared names flagged nine sites in three files, and every one was a
29
+ * granularity or part-of-speech error rather than a §3.9 breach —
30
+ * · `src/server/routes.ts` matched on `readReaperPeerText`, `isReaperSnapshot`,
31
+ * `reaperPoolHealth`: "reaper" as a NOUN in code that REPORTS ON the reaper,
32
+ * which is exactly the correct-code case (a reporting surface may read).
33
+ * · `src/commands/server.ts` is the 22k-line composition root — every module's
34
+ * authority is wired through it, so any file-level verdict on it is wrong in
35
+ * one direction or the other.
36
+ * · `src/core/WorkingSetPull.ts` matched a runtime-erased `import type`.
37
+ * A guard that blocks commits must not rest on a heuristic with that error rate;
38
+ * over-blocking correct code is the more expensive failure here. What IS closed
39
+ * mechanically is the STALENESS half: a curated entry that no longer exists on
40
+ * disk means an actuator was renamed or moved and silently fell off the ban —
41
+ * that is now a hard failure instead of a skipped line.
42
+ *
43
+ * Still a guardrail, not a proof: a determined consumer can re-read the JSONL by
44
+ * hand or reach the reader through a re-export. The declared §3.9 duty is the
45
+ * authority; this catches the mechanical patterns.
17
46
  */
18
47
  import fs from 'node:fs';
19
48
  import path from 'node:path';
@@ -27,7 +56,8 @@ const ROOT = process.argv.includes('--root')
27
56
  /**
28
57
  * Actuator modules: anything holding kill/spawn/place/transfer/reap authority.
29
58
  * Grow this list when a new actuator class lands — adding here is cheap;
30
- * debugging a journal-driven double-kill is not.
59
+ * debugging a journal-driven double-kill is not. See the header for why this
60
+ * stays curated rather than inferred.
31
61
  */
32
62
  const ACTUATOR_FILES = [
33
63
  'src/core/SessionManager.ts',
@@ -40,17 +70,93 @@ const ACTUATOR_FILES = [
40
70
  'src/lifeline/ServerSupervisor.ts',
41
71
  ];
42
72
 
43
- const READER_IMPORT = /from\s+['"][^'"]*CoherenceJournalReader(\.js)?['"]/;
73
+ /**
74
+ * Every way a module can LOAD the reader at runtime. The old pattern required
75
+ * `from`, which is precisely the token a dynamic import does not have.
76
+ */
77
+ const LOADS_READER =
78
+ /(?:\bfrom\s+|\bimport\s*\(\s*|\brequire\s*\(\s*)['"][^'"]*CoherenceJournalReader(?:\.js)?['"]/;
79
+
80
+ /**
81
+ * `import type { X } from '…Reader.js'` is erased at compile time — it creates
82
+ * no runtime coupling and therefore cannot act on stale data. Borrowing a TYPE
83
+ * from the reader is legal; holding the reader is not. A MIXED import such as
84
+ * `import { type A, CoherenceJournalReader }` does not match this and is still
85
+ * caught, which is correct — it pulls in the runtime binding.
86
+ */
87
+ const TYPE_ONLY_IMPORT = /^\s*import\s+type\s/;
88
+
89
+ /**
90
+ * Blank out comments, preserving length and line count so reported line numbers
91
+ * stay true. Quote-aware, so a `//` inside a string literal is not mistaken for
92
+ * a comment. This is what keeps "the reader named in a comment" legal no matter
93
+ * how wide the load-matching gets.
94
+ */
95
+ function stripComments(src) {
96
+ const out = src.split('');
97
+ let i = 0;
98
+ let state = 'code'; // code | line | block | single | double | tick
99
+ while (i < src.length) {
100
+ const c = src[i];
101
+ const d = src[i + 1];
102
+ if (state === 'code') {
103
+ if (c === '/' && d === '/') { state = 'line'; out[i] = ' '; out[i + 1] = ' '; i += 2; continue; }
104
+ if (c === '/' && d === '*') { state = 'block'; out[i] = ' '; out[i + 1] = ' '; i += 2; continue; }
105
+ if (c === "'") state = 'single';
106
+ else if (c === '"') state = 'double';
107
+ else if (c === '`') state = 'tick';
108
+ i++; continue;
109
+ }
110
+ if (state === 'line') {
111
+ if (c === '\n') { state = 'code'; i++; continue; }
112
+ out[i] = ' '; i++; continue;
113
+ }
114
+ if (state === 'block') {
115
+ if (c === '*' && d === '/') { state = 'code'; out[i] = ' '; out[i + 1] = ' '; i += 2; continue; }
116
+ if (c !== '\n') out[i] = ' ';
117
+ i++; continue;
118
+ }
119
+ // inside a string literal: honour escapes, then look for the closing quote
120
+ if (c === '\\') { i += 2; continue; }
121
+ if ((state === 'single' && c === "'") || (state === 'double' && c === '"') || (state === 'tick' && c === '`')) {
122
+ state = 'code';
123
+ }
124
+ i++;
125
+ }
126
+ return out.join('');
127
+ }
128
+
129
+ /**
130
+ * A lint that reports "clean" because it scanned NOTHING is worse than no lint:
131
+ * absence is the cheapest result to obtain, and it is indistinguishable from a
132
+ * genuinely clean tree. Refuse to render a verdict on a root with no src/.
133
+ */
134
+ if (!fs.existsSync(path.join(ROOT, 'src'))) {
135
+ console.error(`lint-journal-actuation-ban: no src/ under ${ROOT} — scanned nothing, so no verdict.`);
136
+ process.exit(2);
137
+ }
44
138
 
45
139
  const violations = [];
140
+
46
141
  for (const rel of ACTUATOR_FILES) {
47
142
  const file = path.join(ROOT, rel);
48
- if (!fs.existsSync(file)) continue;
49
- const lines = fs.readFileSync(file, 'utf-8').split('\n');
143
+
144
+ // The staleness half of the declared-population gap: a curated actuator that
145
+ // is no longer here was renamed or moved, and silently left the ban behind.
146
+ if (!fs.existsSync(file)) {
147
+ violations.push(
148
+ `${rel}: listed actuator is missing from the tree — renamed or moved? It has silently left the §3.9 ban. Update ACTUATOR_FILES.`,
149
+ );
150
+ continue;
151
+ }
152
+
153
+ const lines = stripComments(fs.readFileSync(file, 'utf-8')).split('\n');
50
154
  for (let i = 0; i < lines.length; i++) {
51
- if (READER_IMPORT.test(lines[i])) {
52
- violations.push(`${rel}:${i + 1}: actuator imports the journal READER (forbidden by §3.9 — the journal answers questions, live systems decide)`);
53
- }
155
+ if (!LOADS_READER.test(lines[i])) continue;
156
+ if (TYPE_ONLY_IMPORT.test(lines[i])) continue;
157
+ violations.push(
158
+ `${rel}:${i + 1}: actuator loads the journal READER (forbidden by §3.9 — the journal answers questions, live systems decide)`,
159
+ );
54
160
  }
55
161
  }
56
162
 
@@ -60,4 +166,4 @@ if (violations.length > 0) {
60
166
  console.error('\nReplicated journal data is stale by construction. Read the live store instead.');
61
167
  process.exit(1);
62
168
  }
63
- console.log(`lint-journal-actuation-ban: clean (${ACTUATOR_FILES.length} actuator modules, none import the reader)`);
169
+ console.log(`lint-journal-actuation-ban: clean (${ACTUATOR_FILES.length} actuator modules, none load the reader)`);
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "./builtin-manifest.schema.json",
3
3
  "schemaVersion": 1,
4
- "generatedAt": "2026-08-14T21:37:12.442Z",
5
- "instarVersion": "1.3.1144",
4
+ "generatedAt": "2026-08-14T22:33:19.830Z",
5
+ "instarVersion": "1.3.1145",
6
6
  "entryCount": 202,
7
7
  "entries": {
8
8
  "hook:session-start": {
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "generatedFrom": "source-tree",
4
4
  "registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
5
- "packageVersion": "1.3.1144",
5
+ "packageVersion": "1.3.1145",
6
6
  "guards": [
7
7
  {
8
8
  "ref": "docs/audits/phase-b/f10-triage.md",
@@ -1,5 +1,5 @@
1
1
  {
2
- "sha256": "a01cf44f29d7c2c5e2bc284dbcd18e27b5c4d6035f3fee7b8e8254e8a993cf2d",
2
+ "sha256": "4a5b88caa62ae256f4868735dc66735c52ae30604a8272c977ca1f4564086e43",
3
3
  "registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
4
- "packageVersion": "1.3.1144"
4
+ "packageVersion": "1.3.1145"
5
5
  }
@@ -2,5 +2,5 @@
2
2
  "sha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
3
3
  "articleCount": 88,
4
4
  "generatedFrom": "docs/STANDARDS-REGISTRY.md",
5
- "packageVersion": "1.3.1144"
5
+ "packageVersion": "1.3.1145"
6
6
  }
@@ -0,0 +1,57 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What Changed
7
+
8
+ `scripts/lint-journal-actuation-ban.js` enforces COHERENCE-JOURNAL-SPEC §3.9: no actuator (kill / spawn / place /
9
+ transfer / reap) may import the journal READER, because replicated journal data is stale by construction and an
10
+ actuator trusting it can kill live work or double-place a conversation.
11
+
12
+ The check matched `/from\s+['"]…CoherenceJournalReader…['"]/`, which requires the `from` keyword. `await
13
+ import(…)` and `require(…)` do not have it, so both loaded the reader straight past the ban. Reproduced against
14
+ the shipped lint on a real listed actuator (`src/core/SessionManager.ts`): it printed `clean`. instar-codey
15
+ reproduced the same evasion independently and ranked this lint first of ~20 by consequence-of-defeat.
16
+
17
+ - All three load forms now match.
18
+ - Comments are stripped (quote-aware, line-preserving) before matching, so prose describing the ban can never
19
+ itself be a violation.
20
+ - `import type` is now exempt — it is erased at compile time, so it cannot act on stale data. The old pattern
21
+ flagged it, and a live file in the tree has that shape legitimately.
22
+ - A curated actuator that has vanished from the tree is now a violation instead of a silently skipped line: a
23
+ renamed module used to leave the ban without a word.
24
+ - A root with no `src/` exits 2 instead of printing `clean` over zero files.
25
+
26
+ Deliberately NOT changed: the curated actuator list. Automatic discovery by declared-name shape was built and
27
+ measured against this tree — nine flags across three files, every one a part-of-speech or granularity error
28
+ ("reaper" as a noun in reporting code; the 22k-line composition root; an `import type`). This lint blocks
29
+ commits, so over-blocking correct code is the more expensive failure, and the enumerated list is the original
30
+ converged design decision. The limit is now stated plainly in the header and pinned by a test that fails if
31
+ anyone closes it properly.
32
+
33
+ ## What to Tell Your User
34
+
35
+ None — internal change (no user-facing surface).
36
+
37
+ ## Summary of New Capabilities
38
+
39
+ None — internal change (no user-facing surface).
40
+
41
+ ## Evidence
42
+
43
+ - `tests/unit/journal-actuation-ban-lint.test.ts` — 13/13 green.
44
+ - Negative control: with the shipped lint restored, exactly 5 of 13 fail (dynamic import, `require`,
45
+ `import type`, vanished-curated-file, rootless-tree) and all 8 controls still pass — controls should pass both
46
+ ways, which is what makes them controls.
47
+ - Real-tree verdict: `node scripts/lint-journal-actuation-ban.js` → `clean (8 actuator modules, none load the
48
+ reader)`, exit 0. All eight curated actuators verified present, none referencing the reader.
49
+ - Full `npm run lint` chain green; `tests/unit/lint-chain-completeness.test.ts` 3/3.
50
+ - Side-effects review: `upgrades/side-effects/journal-actuation-ban-load-forms.md`.
51
+ - ELI16: `docs/specs/journal-actuation-ban-load-forms.eli16.md`.
52
+
53
+ **Raised separately, not actioned here:** `src/commands/server.ts:20853` wires `OwnershipApplier`, which
54
+ materializes durable topic ownership from the REPLICATED placement journal (it does validate `transferTo`
55
+ against the live known-machine set first, and is specified in
56
+ `docs/specs/ownership-applier-meshself-ordering-fix.md`). Whether §3.9 permits a validated read like that is a
57
+ spec question, not a lint decision; it is on the operator's attention queue. The shipped lint does not flag it.
@@ -0,0 +1,127 @@
1
+ # Side-Effects Review — journal-actuation-ban: every load form, and the staleness half of the population
2
+
3
+ **Version / slug:** `journal-actuation-ban-load-forms`
4
+ **Date:** `2026-08-14`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `not required — Tier 1 (classifyTier: suggestedTier 1, riskFloor 1, no reasons). No spec change: COHERENCE-JOURNAL-SPEC §3.9 is unmodified; this makes the existing ban see load forms it already forbade.`
7
+
8
+ ## Summary of the change
9
+
10
+ `scripts/lint-journal-actuation-ban.js` enforced §3.9 with `/from\s+['"]…CoherenceJournalReader…['"]/`. That
11
+ requires the `from` keyword, which `await import(…)` and `require(…)` do not have, so both walked past the ban.
12
+ Reproduced against the shipped lint on a REAL listed actuator (`src/core/SessionManager.ts`): it reported
13
+ `clean`. Independently reproduced by instar-codey, who ranked this lint #1 of ~20 by consequence-of-defeat.
14
+
15
+ Now: all three load forms are matched; comments are stripped (quote-aware, length- and line-preserving) before
16
+ matching, so prose describing the ban is never a violation; a runtime-erased `import type` is correctly NOT a
17
+ violation; a curated actuator that has vanished from the tree is a violation instead of a skipped line; and a
18
+ root with no `src/` exits 2 rather than printing `clean`.
19
+
20
+ The declared-population gap ("grow this list when a new actuator class lands") is **left open deliberately** —
21
+ see §2.
22
+
23
+ ## Decision-point inventory
24
+
25
+ - `LOADS_READER` — WIDEN — now matches `from` / `import(` / `require(`. CI-time only; never runtime.
26
+ - `TYPE_ONLY_IMPORT` — ADD — narrows: `import type` is exempt (erased at compile time).
27
+ - comment stripping — ADD — narrows: commented text cannot be a violation.
28
+ - missing curated file — CHANGE — was `continue` (silent), now a violation.
29
+ - root without `src/` — ADD — exit 2, no verdict.
30
+ - No runtime block/allow decisions added or modified. This script runs in `npm run lint` and CI only.
31
+
32
+ ## 1. Over-block
33
+
34
+ The widened matcher can only fire on the eight curated actuator files, so the blast radius is those eight.
35
+ Verified against the real tree: none of the eight so much as mentions `CoherenceJournalReader`, and the lint
36
+ exits 0. Two narrowings actively REDUCE over-block versus the shipped version: `import type` (which the old
37
+ regex flagged — `src/core/WorkingSetPull.ts` is a live example of that shape) and comment stripping.
38
+
39
+ The one new way to fail a build that is not a §3.9 breach: renaming a curated actuator without updating
40
+ `ACTUATOR_FILES`. That is intended — a renamed actuator silently leaving the ban is the failure this closes —
41
+ and the message names the file and the fix.
42
+
43
+ ## 2. Under-block
44
+
45
+ **Automatic discovery of actuators was built, measured against this tree, and REJECTED.** Inferring "is this an
46
+ actuator?" from declared names (functions, classes, filename) flagged nine sites across three files, and every
47
+ one was a part-of-speech or granularity error rather than a §3.9 breach:
48
+
49
+ - `src/server/routes.ts` — matched `readReaperPeerText`, `isReaperSnapshot`, `reaperPoolHealth`: "reaper" as a
50
+ NOUN in code that REPORTS ON the reaper. A reporting surface reading the journal is correct code.
51
+ - `src/commands/server.ts` — the 22k-line composition root. Every module's authority is wired through it, so any
52
+ file-level verdict on it is wrong in one direction or the other.
53
+ - `src/core/WorkingSetPull.ts` — a runtime-erased `import type`.
54
+
55
+ This lint blocks commits, so over-blocking correct code is the more expensive failure. The enumerated-list shape
56
+ is also the ORIGINAL converged design decision, stated in `upgrades/side-effects/coherence-journal-p1-2.md`:
57
+ "The enumerated-list shape is deliberate: growable, reviewable." Closing it needs an authoritative actuator
58
+ population, not a heuristic; `src/testing/selfActionRegistry.ts` (`modelsPath`, kept complete by
59
+ `lint-no-unregistered-self-action.js`) is the closest candidate but is a superset in KIND — spend-alert
60
+ emitters and sweeps are self-actions, not §3.9 session actuators. Left open, named in the header, and pinned by
61
+ a test that will fail if someone closes it.
62
+
63
+ Still evadable, unchanged from before: a hand-rolled JSONL read, or reaching the reader through a re-export.
64
+ The §3.9 duty remains the authority.
65
+
66
+ ## 3. Level-of-abstraction fit
67
+
68
+ Line-level regex over comment-stripped source, on an enumerated file list. Same layer as the shipped check —
69
+ no AST, no type information, no new dependency. The comment stripper is the only added machinery, and it exists
70
+ so the matcher can widen without making §3.9 prose illegal.
71
+
72
+ ## 4. Signal vs authority compliance
73
+
74
+ Unchanged and reinforced. The lint is a CI guard, not a runtime authority; it forbids actuators from HOLDING the
75
+ reader, which is what keeps replicated journal data signal rather than authority. Nothing here reads the journal
76
+ at runtime.
77
+
78
+ ## 5. Interactions
79
+
80
+ - `npm run lint` chain (`package.json:31`) — position unchanged; `tests/unit/lint-chain-completeness.test.ts`
81
+ passes (3/3).
82
+ - Husky pre-commit / CI run the same chain. Exit 2 on a rootless tree is new; the repo root always has `src/`,
83
+ and the only caller passing `--root` is this test.
84
+ - No source module, route, config key, or state file is touched.
85
+
86
+ ## 6. External surfaces
87
+
88
+ None. No HTTP route, no config key, no user-visible message, no CLAUDE.md template change (the lint is
89
+ developer-facing tooling, not an agent capability). Agent Awareness Standard does not apply.
90
+
91
+ ## 7. Rollback cost
92
+
93
+ `git revert` of one script plus one test file. No migration, no state, no deployed artifact. The lint is
94
+ stateless and runs from source.
95
+
96
+ ## Conclusion
97
+
98
+ Ship. One real evasion closed with a negative control proving each assertion fails without the fix; two
99
+ narrowings that reduce false positives below the shipped baseline; one silent-failure mode of my own making
100
+ (clean verdict over zero files) caught and closed before it shipped.
101
+
102
+ ## Second-pass review (if required)
103
+
104
+ Not required at Tier 1. Independent corroboration of DEFECT 1 exists regardless: instar-codey reproduced the
105
+ dynamic-import evasion separately and ranked this lint first of ~20 by consequence-of-defeat, and recommended
106
+ exactly the scope taken here — "low FP risk if limited to actuator files and comment-stripped `import()`,
107
+ `require()`… Do not ban writer imports."
108
+
109
+ ## Evidence pointers
110
+
111
+ - `tests/unit/journal-actuation-ban-lint.test.ts` — 13/13 green with the fix.
112
+ - Negative control: with the shipped lint restored, exactly 5 of the 13 fail (dynamic import, `require`,
113
+ `import type`, vanished-curated-file, rootless-tree) and all 8 controls still pass — controls should pass
114
+ both ways, which is what makes them controls.
115
+ - Real-tree verdict: `node scripts/lint-journal-actuation-ban.js` → `clean (8 actuator modules, none load the
116
+ reader)`, exit 0.
117
+ - `upgrades/side-effects/coherence-journal-p1-2.md` — the original converged decision to enumerate.
118
+
119
+ ## Finding raised separately (NOT fixed here)
120
+
121
+ Discovery, before it was rejected, surfaced five `await import('../core/CoherenceJournalReader.js')` sites in
122
+ `src/commands/server.ts`. One (`:20853`) wires `OwnershipApplier`, which materializes durable topic ownership
123
+ FROM the replicated placement journal — replicated data feeding an ownership decision that placement and
124
+ session routing then act on. It is deliberate and specified (`docs/specs/ownership-applier-meshself-ordering-fix.md`)
125
+ and validates `transferTo` against the live known-machine set before materializing. Whether §3.9 permits it is a
126
+ spec question with real consequence, and it is not mine to settle inside a lint change. Raised to the operator;
127
+ deliberately NOT actioned here, and the lint does not flag it.