instar 1.3.357 → 1.3.359
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/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +22 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/types.d.ts +16 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +6 -0
- package/dist/scaffold/templates.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +95 -0
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +63 -63
- package/src/scaffold/templates.ts +6 -0
- package/upgrades/1.3.358.md +44 -0
- package/upgrades/1.3.359.md +42 -0
- package/upgrades/side-effects/operator-binding-awareness.md +60 -0
- package/upgrades/side-effects/principal-coherence-observe.md +82 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Side-effects review — Operator Binding agent-awareness CLAUDE.md section
|
|
2
|
+
|
|
3
|
+
## What this change does
|
|
4
|
+
Adds the Agent Awareness Standard surface for the now-feature-complete Operator
|
|
5
|
+
Binding (Know Your Principal) loop (shipped across #904/#906/#908/#909/#910). It is
|
|
6
|
+
PURE DOCUMENTATION — a new CLAUDE.md capability section, no logic/behavior/data
|
|
7
|
+
change. Wired into all three required awareness surfaces so the parity gate stays
|
|
8
|
+
green:
|
|
9
|
+
|
|
10
|
+
- `src/scaffold/templates.ts` (`generateClaudeMd`): the `**Operator Binding (Know
|
|
11
|
+
Your Principal)**` section for NEW agents, inserted before the Commitments section.
|
|
12
|
+
- `src/core/PostUpdateMigrator.ts` (`migrateClaudeMd`): the SAME section for EXISTING
|
|
13
|
+
agents, appended only when absent (content-sniffed on `**Operator Binding (Know
|
|
14
|
+
Your Principal)**`), idempotent, with a `result.upgraded.push`.
|
|
15
|
+
- `src/core/PostUpdateMigrator.ts` (`migrateFrameworkShadowCapabilities` markers[]):
|
|
16
|
+
the `**Operator Binding (Know Your Principal)**` marker so Codex/Gemini agents
|
|
17
|
+
learn it too (no improvised weaker workaround).
|
|
18
|
+
- `tests/unit/feature-delivery-completeness.test.ts`: the `featureSections` entry
|
|
19
|
+
(the `**`-wrapped form, matching the migrator guard + markers like Session Boot
|
|
20
|
+
Self-Knowledge) so the three-surface parity is enforced going forward.
|
|
21
|
+
|
|
22
|
+
## Blast radius
|
|
23
|
+
- **Additive, idempotent, no behavior change.** The migrator branch only appends
|
|
24
|
+
when the heading is absent; re-running migration is harmless. No config key, no
|
|
25
|
+
route, no class, no dependency.
|
|
26
|
+
- **Migration parity satisfied by construction** — this change exists BECAUSE of the
|
|
27
|
+
Migration Parity Standard: new agents (templates.ts) + existing agents (migrator)
|
|
28
|
+
+ shadow frameworks (markers) all get the section. The parity gate
|
|
29
|
+
(feature-delivery-completeness) fails CI if any surface is missing — it passed
|
|
30
|
+
(77/77) after the `**`-wrapped featureSections fix (the auto-detect captures the
|
|
31
|
+
migrator's content-sniff string verbatim, so the tracked entry must match it
|
|
32
|
+
exactly — same precedent as `**Session Boot Self-Knowledge**`).
|
|
33
|
+
|
|
34
|
+
## Content accuracy (verified against the merged feature)
|
|
35
|
+
- `/topic-operator`, `/topic-operator/:topicId`, `/topic-operator/session-context`
|
|
36
|
+
routes exist (merged #906). POST refuses a blank/unverifiable uid with 400 (#904
|
|
37
|
+
establishOperator). Auto-bind from authenticated sender on inbound (#909). The
|
|
38
|
+
observe-only guard writes `state/principal-coherence.jsonl` behind
|
|
39
|
+
`monitoring.principalCoherence.enabled`, signal-only (#910). The CLAUDE.md text
|
|
40
|
+
describes exactly these — no aspirational claims.
|
|
41
|
+
|
|
42
|
+
## Framework generality
|
|
43
|
+
The documented capability is framework-agnostic (HTTP routes + an identity
|
|
44
|
+
disposition), which is why it carries a shadow marker. Codex/Gemini agents get the
|
|
45
|
+
same awareness; nothing here is Claude-specific.
|
|
46
|
+
|
|
47
|
+
## Migration parity
|
|
48
|
+
This IS the migration-parity work. Covered: templates.ts (new), migrateClaudeMd
|
|
49
|
+
(existing), markers[] (shadow). No `.claude/settings.json`/hook/config changes.
|
|
50
|
+
|
|
51
|
+
## Tests
|
|
52
|
+
- `tests/unit/feature-delivery-completeness.test.ts` — the three-surface parity gate,
|
|
53
|
+
77/77 (the section is tracked in featureSections and present in templates.ts, the
|
|
54
|
+
migrator, and markers[]). Clean `tsc --noEmit`; lint clean; docs-coverage `--check`
|
|
55
|
+
passes (no new route); repo-invariants hold.
|
|
56
|
+
|
|
57
|
+
## Rollback
|
|
58
|
+
Revert the templates.ts section, the migrator section + marker, and the
|
|
59
|
+
featureSections entry. The on-disk CLAUDE.md of already-migrated agents is inert
|
|
60
|
+
extra documentation; no data to unwind.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Side-effects review — Principal-Coherence Signal, observe-only (Know Your Principal, increment 3)
|
|
2
|
+
|
|
3
|
+
## What this change does
|
|
4
|
+
The READ side of the operator binding — the first runtime consumer of
|
|
5
|
+
`PrincipalGuard.evaluatePrincipalCoherence` (shipped pure + unwired in #902).
|
|
6
|
+
On the outbound delivery seam (`checkOutboundMessage` in routes.ts), every
|
|
7
|
+
finalized agent message is checked against the topic's VERIFIED operator. When
|
|
8
|
+
the message credits an operator-ROLE decision (approval / mandate / credential /
|
|
9
|
+
lock / acting-for) to a principal who is NOT the bound operator — the "Caroline"
|
|
10
|
+
identity-bleed failure, caught in the agent's OWN output — a structured line is
|
|
11
|
+
appended to `state/principal-coherence.jsonl`.
|
|
12
|
+
|
|
13
|
+
- `src/core/types.ts`: one new optional config block,
|
|
14
|
+
`monitoring.principalCoherence?: { enabled: boolean }`. Documented, off by
|
|
15
|
+
default by absence.
|
|
16
|
+
- `src/server/routes.ts`: one new observe function `observePrincipalCoherence`,
|
|
17
|
+
modeled byte-for-byte on the existing `observeSelfViolation`, plus one
|
|
18
|
+
fire-and-forget `void observePrincipalCoherence(...)` call placed next to the
|
|
19
|
+
existing `void observeSelfViolation(...)` at the top of `checkOutboundMessage`
|
|
20
|
+
(before the gate-availability early-return, so it runs regardless of whether a
|
|
21
|
+
tone gate is configured).
|
|
22
|
+
|
|
23
|
+
## The load-bearing security property
|
|
24
|
+
The operator the check resolves against comes ONLY from
|
|
25
|
+
`TopicOperatorStore.asVerifiedOperator(topicId)` — the authenticated-sender
|
|
26
|
+
binding (#904/#906/#2d), never a name read from content. A name in the agent's
|
|
27
|
+
prose can therefore never become the "known good" principal; it can only ever be
|
|
28
|
+
the thing being CHECKED. This is the whole point of the standard: an unverified
|
|
29
|
+
identity is a guess, not a fact.
|
|
30
|
+
|
|
31
|
+
## SIGNAL-ONLY contract (identical to observeSelfViolation)
|
|
32
|
+
- **Returns void; fire-and-forget.** It has NO path to block, delay, rewrite, or
|
|
33
|
+
influence the outbound message or the tone-gate verdict. The verdict field in
|
|
34
|
+
the audit line (block for mandate/credential, warn otherwise) is RECORDED for
|
|
35
|
+
later analysis and NEVER enforced — proven by an e2e assertion that a
|
|
36
|
+
credential misattribution still returns 200, not 422.
|
|
37
|
+
- **Fail-open.** Every operation is guarded; the outer body is try/catch and each
|
|
38
|
+
fs op is independently guarded. Any throw is swallowed and the message sends.
|
|
39
|
+
- **Dark by default.** Inert unless `monitoring.principalCoherence.enabled === true`
|
|
40
|
+
AND `ctx.topicOperatorStore` is non-null AND the topic id is numeric. Absent
|
|
41
|
+
config (every existing + new agent today) = fully inert, zero cost.
|
|
42
|
+
- **Observe-first rationale.** The PrincipalGuard regex can false-positive on
|
|
43
|
+
prose that merely names a capitalized person. Observe mode exists precisely to
|
|
44
|
+
measure that FP rate on real outbound BEFORE any warn/block surface is built.
|
|
45
|
+
|
|
46
|
+
## Blast radius
|
|
47
|
+
- **Additive.** No route added, no class added, no dependency added. One config
|
|
48
|
+
key, one function, one fire-and-forget call.
|
|
49
|
+
- **Hot path, but cold by default.** The call sits on the outbound delivery path,
|
|
50
|
+
but when the flag is off it returns on the first `if` before touching the store
|
|
51
|
+
or importing PrincipalGuard (dynamic import, so the cold path never even loads
|
|
52
|
+
the module).
|
|
53
|
+
- **Audit write.** On a finding it appends to `state/principal-coherence.jsonl`,
|
|
54
|
+
mkdir-ing `state/` defensively first (the TopicOperatorStore only creates that
|
|
55
|
+
dir on its first write, which may not have happened yet). Append-only; bounded
|
|
56
|
+
per message by the number of distinct attributions found.
|
|
57
|
+
|
|
58
|
+
## Migration parity
|
|
59
|
+
None required. This is server-side route behavior + a config TYPE only. The
|
|
60
|
+
config flag follows the exact convention of its sibling observe flag
|
|
61
|
+
`monitoring.correctionLearning` — read with `=== true`, so absent → off. Behavior
|
|
62
|
+
is therefore IDENTICAL for new and existing agents with no migrateConfig write
|
|
63
|
+
(adding one would only cosmetically materialize a false flag). The
|
|
64
|
+
`correctionLearning` flag has no migrateConfig/generateDefaultConfig entry for
|
|
65
|
+
the same reason; this mirrors it.
|
|
66
|
+
|
|
67
|
+
## Tests (all three tiers)
|
|
68
|
+
- Tier 1 (unit): `tests/unit/principal-coherence-operator-seam.test.ts` (5) —
|
|
69
|
+
locks the store→guard contract the wiring depends on, both sides of the
|
|
70
|
+
boundary (bound operator resolves → no finding; outsider → finding; unbound →
|
|
71
|
+
finding; credential/mandate → block verdict; benign prose → nothing).
|
|
72
|
+
- Tier 2 (integration): `tests/integration/principal-coherence-signal.test.ts`
|
|
73
|
+
(5) — over the wire: flag on + bound operator + misattribution logs; bound
|
|
74
|
+
operator attribution logs nothing; unbound logs operatorBound:false; flag off
|
|
75
|
+
logs nothing; a block-verdict finding never 422s.
|
|
76
|
+
- Tier 3 (e2e): `tests/e2e/principal-coherence-lifecycle.test.ts` (4) — production
|
|
77
|
+
AgentServer boot; feature-is-alive write lands; signal-only (credential → 200,
|
|
78
|
+
not 422); bound-operator no-op; flag-off dark.
|
|
79
|
+
|
|
80
|
+
## Rollback
|
|
81
|
+
Revert the one observe function + its one call site + the config type, and delete
|
|
82
|
+
the three test files. The jsonl on disk is inert. No data migration to unwind.
|