instar 1.2.33 → 1.2.34
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/MessagingToneGate.d.ts.map +1 -1
- package/dist/core/MessagingToneGate.js +30 -1
- package/dist/core/MessagingToneGate.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +2 -2
- package/upgrades/1.2.34.md +84 -0
- package/upgrades/side-effects/context-death-stop-hook.md +100 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessagingToneGate.d.ts","sourceRoot":"","sources":["../../src/core/MessagingToneGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uFAAuF;IACvF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"MessagingToneGate.d.ts","sourceRoot":"","sources":["../../src/core/MessagingToneGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,2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QACtD,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,cAAc,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAC5C,yEAAyE;IACzE,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAAC;CACpD;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAuB;gBAE3B,QAAQ,EAAE,oBAAoB;IAIpC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA4DjF,OAAO,CAAC,WAAW;IAqHnB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,aAAa;IAoCrB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,aAAa;CAoBtB"}
|
|
@@ -32,6 +32,7 @@ const VALID_RULES = new Set([
|
|
|
32
32
|
'B12_HEALTH_ALERT_INTERNALS',
|
|
33
33
|
'B13_HEALTH_ALERT_SUPPRESSED_BY_HEAL',
|
|
34
34
|
'B14_HEALTH_ALERT_NO_CTA',
|
|
35
|
+
'B15_CONTEXT_DEATH_STOP',
|
|
35
36
|
]);
|
|
36
37
|
export class MessagingToneGate {
|
|
37
38
|
provider;
|
|
@@ -130,6 +131,34 @@ These rules only fire when the producer has explicitly marked the candidate as a
|
|
|
130
131
|
- **B13_HEALTH_ALERT_SUPPRESSED_BY_HEAL** — message-kind is "health-alert" AND the selfHeal signal is \`{attempted: true, succeeded: true}\`. The producer has already fixed the issue; bothering the user is wrong. Block so the upstream caller suppresses the message entirely (or sends a quiet retrospective if the original problem had previously been escalated).
|
|
131
132
|
- **B14_HEALTH_ALERT_NO_CTA** — message-kind is "health-alert" AND the candidate does NOT end with a single yes/no question the user can answer in one word ("Want me to dig in?" / "Should I look into this?" / "Want me to try again?"). Health alerts that escalate to the user MUST end with an actionable yes/no. A trailing imperative like "check the logs" or "verify the deployment" is exactly the failure this rule catches.
|
|
132
133
|
|
|
134
|
+
## SELF-STOP rule — always evaluated (no signal/kind precondition):
|
|
135
|
+
|
|
136
|
+
- **B15_CONTEXT_DEATH_STOP** — the candidate proposes pausing, stopping, or handing off the current in-flight work for a context-window / fresh-session / end-of-session reason rather than a legitimate stop reason. The structural intent is to catch the "Context-Death Self-Stop" anti-pattern (the agent rationalizing a stop using "context will be better fresh" when the agent's own systems handle context fine and the user-requested scope is not yet shipped).
|
|
137
|
+
|
|
138
|
+
LITERAL pattern markers — you must point at the exact string when applying B15:
|
|
139
|
+
- "fresh session", "next session", "in a fresh", "fresh start"
|
|
140
|
+
- "pick this up later", "pick it up later", "pick up in a", "pick up next"
|
|
141
|
+
- "tail of this session", "tail end of this", "remaining context", "remaining hours of this session", "in the remaining time"
|
|
142
|
+
- "stop cleanly here", "natural break point", "natural break", "hand off cleanly", "handoff point", "let me hand off"
|
|
143
|
+
- "given the scope ... in remaining", "in this single session", "multi-session work" (when used to justify stopping THIS work, not as a neutral characterization), "in remaining context"
|
|
144
|
+
- "quality risk on completing in this session", "rather than risk shipping incomplete"
|
|
145
|
+
|
|
146
|
+
LEGITIMATE STOP CLAUSES — apply B15 ONLY if NONE of these is present in the candidate:
|
|
147
|
+
- The candidate is literally asking the user a question only they can answer (real design fork; explicit "should I X or Y?" with the choice clearly the user's).
|
|
148
|
+
- The candidate states the agent is blocked on information only the user can supply (a credential the user holds; an external system the user owns).
|
|
149
|
+
- The candidate reports a genuine error / blocker (a tool/API/system call failed, not a soft preference to stop).
|
|
150
|
+
- The candidate is a completion report: the user-requested scope has shipped/merged/been delivered (e.g., "v1.2.31 is on npm", "PR #324 merged", "feature live").
|
|
151
|
+
|
|
152
|
+
If the candidate proposes stopping/handing-off AND contains at least one literal context-death pattern from the list AND NONE of the legitimate stop clauses is present → BLOCK with B15 and suggest deleting the handoff framing and continuing, or supplying an explicit legitimate-stop reason.
|
|
153
|
+
|
|
154
|
+
B15 does NOT apply to:
|
|
155
|
+
- Messages that DISCUSS the stop pattern (this very rule's text, an operator-facing memo explaining B15, conversation about WHY the agent slipped before).
|
|
156
|
+
- Strategy-reassessment messages that don't conclude with a context-death stop (e.g., "let me re-scope this and proceed" passes; "let me re-scope this and pick it up in a fresh session" blocks).
|
|
157
|
+
- Topic-split / topic-move logistics where the work continues immediately in another topic ("creating a new topic and continuing there" is continuation, not a stop).
|
|
158
|
+
- Operator-completion messages where the operator is informing the agent of a stop ("we're done for today" → not the agent stopping itself).
|
|
159
|
+
|
|
160
|
+
Severity: HIGH. False-negatives (a real slip getting through) are worse than false-positives here — the operator has explicitly asked for this guard as a structural defense against a recurring failure mode.
|
|
161
|
+
|
|
133
162
|
## STYLE rule — applies ONLY when a TARGET STYLE is configured below:
|
|
134
163
|
|
|
135
164
|
- **B11_STYLE_MISMATCH** — the message significantly mismatches the agent's configured TARGET STYLE (see section below). This rule is generic — the target style is a free-text description the operator sets in config. Apply the rule when: (1) a target style is provided (not empty), AND (2) the candidate message clearly violates the style's stated intent in a way the target user would notice and find jarring.
|
|
@@ -165,7 +194,7 @@ Respond EXCLUSIVELY with valid JSON:
|
|
|
165
194
|
"suggestion": "<how to rephrase — empty if pass is true>"
|
|
166
195
|
}
|
|
167
196
|
|
|
168
|
-
If pass is true, rule/issue/suggestion must be empty strings. If pass is false, rule MUST be one of B1–B9, B11, B12, B13, or
|
|
197
|
+
If pass is true, rule/issue/suggestion must be empty strings. If pass is false, rule MUST be one of B1–B9, B11, B12, B13, B14, or B15 exactly (no other values — inventing rule ids is itself a violation).
|
|
169
198
|
|
|
170
199
|
Channel: ${channel}
|
|
171
200
|
${kindSection}${contextSection}${signalsSection}${styleSection}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessagingToneGate.js","sourceRoot":"","sources":["../../src/core/MessagingToneGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAwBjC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,oBAAoB;IACpB,iBAAiB;IACjB,YAAY;IACZ,iBAAiB;IACjB,yBAAyB;IACzB,2BAA2B;IAC3B,oBAAoB;IACpB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;
|
|
1
|
+
{"version":3,"file":"MessagingToneGate.js","sourceRoot":"","sources":["../../src/core/MessagingToneGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAwBjC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,oBAAoB;IACpB,iBAAiB;IACjB,YAAY;IACZ,iBAAiB;IACjB,yBAAyB;IACzB,2BAA2B;IAC3B,oBAAoB;IACpB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;IACzB,wBAAwB;CACzB,CAAC,CAAC;AA4GH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAuB;IAEvC,YAAY,QAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,OAA0B;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAE1I,IAAI,CAAC;YACH,MA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K,CAAC,aAAa,CAAC,CAAC;YAC3C,IAAI,CAAC,SAAS;gBAAE,OAAO,QAAQ,CAAC;YAEhC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAA4B,CAAC;YACnE,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,SAAS;gBAAE,OAAO,QAAQ,CAAC;YAEzD,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,MAAM,CAAY;gBAC/B,IAAI,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAM,CAAC,MAAM,CAAY,CAAC,CAAC,CAAC,EAAE;gBAC1E,KAAK,EAAE,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAM,CAAC,OAAO,CAAY,CAAC,CAAC,CAAC,EAAE;gBAC7E,UAAU,EAAE,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAM,CAAC,YAAY,CAAY,CAAC,CAAC,CAAC,EAAE;aAC7F,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./builtin-manifest.schema.json",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
|
-
"generatedAt": "2026-05-
|
|
5
|
-
"instarVersion": "1.2.
|
|
4
|
+
"generatedAt": "2026-05-22T21:51:00.191Z",
|
|
5
|
+
"instarVersion": "1.2.34",
|
|
6
6
|
"entryCount": 191,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- bump: patch -->
|
|
4
|
+
<!-- patch = behavior fix, no new capability, no breaking change -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
**feat(tone-gate): add B15_CONTEXT_DEATH_STOP — block outbound "fresh-
|
|
9
|
+
session / hand-off" framing on in-flight work.**
|
|
10
|
+
|
|
11
|
+
instar's `MessagingToneGate` already runs on every outbound user
|
|
12
|
+
message and blocks fourteen classes of leakage (B1–B14 — CLI commands,
|
|
13
|
+
file paths, jargon dumps, health-alert internals, style mismatch,
|
|
14
|
+
etc.). This adds a fifteenth rule, **B15_CONTEXT_DEATH_STOP**, that
|
|
15
|
+
catches a specific failure mode of the agent: proposing to pause, stop,
|
|
16
|
+
or hand off the current in-flight work for a context-window /
|
|
17
|
+
fresh-session / end-of-session reason rather than a legitimate stop
|
|
18
|
+
reason.
|
|
19
|
+
|
|
20
|
+
The pattern is documented in the CLAUDE.md "Context-Death Self-Stop"
|
|
21
|
+
anti-pattern section, and reinforced by multiple memory entries
|
|
22
|
+
(`feedback_scope_hook_is_grounding_not_termination`,
|
|
23
|
+
`feedback_no_deferrals`, `feedback_finish_means_merge`, etc.). Despite
|
|
24
|
+
the documentation, the slip kept recurring. Per instar's foundational
|
|
25
|
+
"Structure beats willpower" principle, this needs a structural guard
|
|
26
|
+
that catches the language at send-time.
|
|
27
|
+
|
|
28
|
+
B15 is an LLM-gate rule (the existing tone-gate authority). It lists
|
|
29
|
+
literal pattern markers ("fresh session," "next session," "tail of
|
|
30
|
+
this session," "hand off cleanly," "pick this up later," etc.) AND
|
|
31
|
+
legitimate-stop carve-outs that pass unblocked (real design question
|
|
32
|
+
only the operator can answer, real blocker, real error, completion
|
|
33
|
+
report on user-requested scope). The LLM combines the markers with
|
|
34
|
+
conversational context and the carve-outs to make the block/pass call.
|
|
35
|
+
|
|
36
|
+
When B15 fires, the standard tone-gate UX applies: the candidate is
|
|
37
|
+
rejected with rule id B15, an issue summary, and a suggestion. The
|
|
38
|
+
agent has to either delete the handoff framing and continue working
|
|
39
|
+
or supply an explicit legitimate-stop reason.
|
|
40
|
+
|
|
41
|
+
## Evidence
|
|
42
|
+
|
|
43
|
+
The change is one entry added to `VALID_RULES`, one new section in
|
|
44
|
+
the gate's prompt, and one line updated in the response-format note
|
|
45
|
+
listing valid rule ids. Nine unit tests in
|
|
46
|
+
`tests/unit/messaging-tone-gate-b15.test.ts` verify:
|
|
47
|
+
|
|
48
|
+
1. The prompt always carries the B15 rule definition for every review.
|
|
49
|
+
2. The prompt carries the literal pattern markers (fresh session, next
|
|
50
|
+
session, tail of this session, hand off cleanly, pick this up later).
|
|
51
|
+
3. The prompt documents the legitimate-stop carve-outs (completion
|
|
52
|
+
report, genuine error / blocker).
|
|
53
|
+
4. The response-format rule list includes B15.
|
|
54
|
+
5. An LLM response citing B15 is accepted as a valid block (not
|
|
55
|
+
fail-opened as `invalidRule`).
|
|
56
|
+
6. A completion-report message passes through unchanged when the LLM
|
|
57
|
+
returns pass.
|
|
58
|
+
7. A genuine-blocker message passes through unchanged.
|
|
59
|
+
8. A topic-split / continuation message passes through unchanged.
|
|
60
|
+
9. The drift-detection still rejects unknown rule ids (no widening
|
|
61
|
+
of the gate to arbitrary ids).
|
|
62
|
+
|
|
63
|
+
All 27 existing `MessagingToneGate.test.ts` tests still pass; all 8
|
|
64
|
+
existing `messaging-tone-gate-health-alerts.test.ts` tests still pass.
|
|
65
|
+
The TypeScript build is clean; lint is clean.
|
|
66
|
+
|
|
67
|
+
## What to Tell Your User
|
|
68
|
+
|
|
69
|
+
Your agent now has one more safety net on the messages it sends you.
|
|
70
|
+
The new check looks for moments where the agent is about to write some
|
|
71
|
+
version of "let me pick this up in a fresh session" or "I'll hand this
|
|
72
|
+
off cleanly" while the work you asked for isn't actually done yet — and
|
|
73
|
+
quietly blocks that message before it reaches you. The agent has to
|
|
74
|
+
either delete the bail-out framing and keep working, or cite a real
|
|
75
|
+
reason for stopping. You should notice the agent doing less of that
|
|
76
|
+
pattern. Nothing changes about messages where the agent has a real
|
|
77
|
+
question, a real blocker, a real error, or actually finished the work.
|
|
78
|
+
|
|
79
|
+
## Summary of New Capabilities
|
|
80
|
+
|
|
81
|
+
| Capability | How to Use |
|
|
82
|
+
|-----------|-----------|
|
|
83
|
+
| B15 tone-gate rule catches outbound context-death stop framing | Automatic — runs on every outbound user message via MessagingToneGate |
|
|
84
|
+
| B15 has explicit legitimate-stop carve-outs | Automatic — real question / real blocker / real error / completion report pass unblocked |
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Side-effects review — context-death stop hook (B15 tone-gate rule)
|
|
2
|
+
|
|
3
|
+
**Scope**: Add `B15_CONTEXT_DEATH_STOP` to `MessagingToneGate`. The
|
|
4
|
+
operator explicitly asked for a structural guard against the agent's
|
|
5
|
+
recurring "Context-Death Self-Stop" pattern (CLAUDE.md anti-pattern,
|
|
6
|
+
multiple memory entries) because documentation alone has not eliminated
|
|
7
|
+
the slip.
|
|
8
|
+
|
|
9
|
+
**Files touched**:
|
|
10
|
+
- `src/core/MessagingToneGate.ts` — adds `'B15_CONTEXT_DEATH_STOP'` to
|
|
11
|
+
`VALID_RULES`; adds a new `## SELF-STOP rule` section in `buildPrompt`
|
|
12
|
+
describing literal pattern markers + legitimate-stop carve-outs;
|
|
13
|
+
updates the response-format rule list to include B15.
|
|
14
|
+
- `tests/unit/messaging-tone-gate-b15.test.ts` — 9 new tests covering
|
|
15
|
+
prompt-render assertions, drift-detection acceptance of B15,
|
|
16
|
+
propagation of a valid B15 response, and pass-through of completion /
|
|
17
|
+
blocker / topic-split candidates.
|
|
18
|
+
- `specs/dev-infrastructure/context-death-stop-hook.md` — converged +
|
|
19
|
+
approved (single-iteration; design intent authored by operator).
|
|
20
|
+
- `specs/dev-infrastructure/context-death-stop-hook.eli16.md` — plain-
|
|
21
|
+
English companion.
|
|
22
|
+
- `docs/specs/reports/context-death-stop-hook-convergence.md` — report.
|
|
23
|
+
|
|
24
|
+
**Under-block**: Narrow. The rule keys on the candidate message itself.
|
|
25
|
+
If the agent slips into the pattern in *internal* reasoning (thought
|
|
26
|
+
traces, plan files) but produces an outbound message that doesn't carry
|
|
27
|
+
any of the literal markers, B15 does not fire — exactly the boundary the
|
|
28
|
+
authority is supposed to enforce. That's correct: this is the outbound-
|
|
29
|
+
message authority, not a thought-monitor.
|
|
30
|
+
|
|
31
|
+
**Over-block**: Minimal by design. The rule has explicit
|
|
32
|
+
legitimate-stop carve-outs (real question, real blocker, real error,
|
|
33
|
+
real completion) AND explicit non-applicability boundaries (discussion-
|
|
34
|
+
about-the-pattern, topic-split/move logistics, operator-initiated stop
|
|
35
|
+
messages). The LLM gate is the existing authority that combines literal
|
|
36
|
+
markers with conversational context. Failure-mode: an LLM call timeout
|
|
37
|
+
or parse failure → fail-open (gate's existing semantics), so a network
|
|
38
|
+
hiccup never silences a legitimate message.
|
|
39
|
+
|
|
40
|
+
**Level-of-abstraction fit**: B15 lives where B1–B14 already live. No
|
|
41
|
+
new authority, no new file, no new endpoint. The structural placement
|
|
42
|
+
is sibling to existing rules, and the same drift-detection (rule
|
|
43
|
+
citation must be in `VALID_RULES`) governs it.
|
|
44
|
+
|
|
45
|
+
**Signal vs authority**: Compliant. The literal pattern markers in the
|
|
46
|
+
prompt are the SIGNAL; the LLM gate (the existing authority) decides
|
|
47
|
+
block/pass after combining markers with the legitimate-stop carve-outs
|
|
48
|
+
and conversational context. No new authority is introduced; no signal
|
|
49
|
+
becomes a blocker on its own.
|
|
50
|
+
|
|
51
|
+
**Interactions**:
|
|
52
|
+
- B15 does not change B1–B14 behavior. The drift-detection (any rule
|
|
53
|
+
cited must be in `VALID_RULES`) gains one entry; existing rules
|
|
54
|
+
remain valid.
|
|
55
|
+
- The fail-open paths (`failedOpen: true`, `invalidRule: true`) are
|
|
56
|
+
unchanged.
|
|
57
|
+
- All paths that call `MessagingToneGate.review()` automatically benefit
|
|
58
|
+
from B15 — no caller changes required. Tested implicitly by the
|
|
59
|
+
existing health-alert + attention-route tests passing without
|
|
60
|
+
modification.
|
|
61
|
+
|
|
62
|
+
**External surfaces**: None. No new API endpoint, no new config field,
|
|
63
|
+
no new CLI command, no change to the tone-gate's public type contract
|
|
64
|
+
(`ToneReviewResult` shape unchanged). The new rule id is observable on
|
|
65
|
+
the `result.rule` string, which already carries B1..B14 ids today.
|
|
66
|
+
|
|
67
|
+
**Migration parity**:
|
|
68
|
+
- No agent-installed file change. The tone gate runs on the agent's
|
|
69
|
+
server; existing agents pick up B15 the next time they update + the
|
|
70
|
+
server restarts.
|
|
71
|
+
- CLAUDE.md template (`generateClaudeMd` and `migrateClaudeMd`) — not
|
|
72
|
+
touched in this PR. The rule fires at message-send time regardless of
|
|
73
|
+
what the agent reads at session-start; a future PR can add a one-line
|
|
74
|
+
awareness note to the template, but it isn't load-bearing here (the
|
|
75
|
+
point of the structural guard is that the agent doesn't need to
|
|
76
|
+
remember).
|
|
77
|
+
|
|
78
|
+
**Rollback cost**: Trivial. Revert three files (Source edit + test +
|
|
79
|
+
spec triplet). The tone-gate behavior collapses to its pre-B15 state.
|
|
80
|
+
|
|
81
|
+
**Tests**: 9/9 new unit tests pass; 27/27 existing `MessagingToneGate`
|
|
82
|
+
tests still pass; 8/8 `messaging-tone-gate-health-alerts.test.ts` still
|
|
83
|
+
pass. `tsc --noEmit` clean. `npm run lint` clean.
|
|
84
|
+
|
|
85
|
+
**Decision-point inventory**:
|
|
86
|
+
1. LLM-gate rule (vs. regex hook) — chosen for the same reason the
|
|
87
|
+
existing tone gate uses LLM judgment: literal patterns under-block
|
|
88
|
+
on paraphrase and over-block on context (e.g., "we should pick this
|
|
89
|
+
up later *after lunch*" is fine).
|
|
90
|
+
2. Single-iteration converge (vs. full 4-internal + 3-external) — the
|
|
91
|
+
change is a single-rule extension to a well-defined existing
|
|
92
|
+
authority with the operator-authored design intent in the topic-9984
|
|
93
|
+
conversation; the full converge ceremony is calibrated for new
|
|
94
|
+
subsystems. The rule is unit-testable in isolation and reversible
|
|
95
|
+
trivially; if the operator wants the full ceremony for parity it
|
|
96
|
+
can be a follow-up.
|
|
97
|
+
3. Drop "regex pre-filter" optimization — adding a regex pre-check
|
|
98
|
+
before the LLM call would skip cheap-pass cases but introduces a
|
|
99
|
+
second authority on the same decision, contradicting the gate's
|
|
100
|
+
signal-vs-authority discipline. Rejected.
|