instar 1.3.71 → 1.3.73
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/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +13 -1
- package/dist/commands/server.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +20 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/UsherActedCorrelator.d.ts +96 -0
- package/dist/core/UsherActedCorrelator.d.ts.map +1 -0
- package/dist/core/UsherActedCorrelator.js +175 -0
- package/dist/core/UsherActedCorrelator.js.map +1 -0
- package/dist/core/UsherSignalStore.d.ts +26 -2
- package/dist/core/UsherSignalStore.d.ts.map +1 -1
- package/dist/core/UsherSignalStore.js +17 -2
- package/dist/core/UsherSignalStore.js.map +1 -1
- package/dist/messaging/AttentionTopicGuard.d.ts +88 -0
- package/dist/messaging/AttentionTopicGuard.d.ts.map +1 -0
- package/dist/messaging/AttentionTopicGuard.js +154 -0
- package/dist/messaging/AttentionTopicGuard.js.map +1 -0
- package/dist/messaging/TelegramAdapter.d.ts +39 -0
- package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
- package/dist/messaging/TelegramAdapter.js +142 -1
- package/dist/messaging/TelegramAdapter.js.map +1 -1
- package/dist/server/AgentServer.d.ts.map +1 -1
- package/dist/server/AgentServer.js +1 -0
- package/dist/server/AgentServer.js.map +1 -1
- package/dist/server/routes.d.ts +4 -0
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +12 -0
- package/dist/server/routes.js.map +1 -1
- package/dist/server/usherRoutes.d.ts.map +1 -1
- package/dist/server/usherRoutes.js +7 -1
- package/dist/server/usherRoutes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +63 -63
- package/upgrades/1.3.72.md +65 -0
- package/upgrades/1.3.73.md +73 -0
- package/upgrades/side-effects/attention-topic-flood-guard.md +74 -0
- package/upgrades/side-effects/usher-precision-loop.md +131 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Instar Upgrade Guide — NEXT
|
|
2
|
+
|
|
3
|
+
<!-- bump: patch -->
|
|
4
|
+
|
|
5
|
+
## What Changed
|
|
6
|
+
|
|
7
|
+
**The Usher's precision loop is now wired — `acted` can finally move off zero.**
|
|
8
|
+
|
|
9
|
+
The Usher (rung 4 of continuous-working-awareness) fires "re-surface" signals
|
|
10
|
+
when a faded context becomes relevant again, and exposes a precision read
|
|
11
|
+
(`acted / fired`) that is the hard precondition for ever letting it interrupt
|
|
12
|
+
mid-task (rung 5). But `UsherSignalStore.markActed` — the precision *numerator* —
|
|
13
|
+
had **no caller anywhere**. So `acted` stayed 0 on every topic and precision was
|
|
14
|
+
structurally pinned at 0: the gate could never be satisfied by data. The Usher's
|
|
15
|
+
accuracy half had shipped asleep — the exact "shipped but asleep" trap the rest
|
|
16
|
+
of this project exists to kill, hiding inside our own accuracy meter.
|
|
17
|
+
|
|
18
|
+
This closes the loop with two correlation paths, both reducing to "does some
|
|
19
|
+
probe text COVER a fired signal's proposition?":
|
|
20
|
+
|
|
21
|
+
1. **Auto-use (path a).** When the agent's genuine reply goes out on a topic and
|
|
22
|
+
it actually *uses* a re-surfaced context the Usher flagged, that signal is
|
|
23
|
+
marked acted (`via: 'use'`). Wired on the outbound `/telegram/reply` path.
|
|
24
|
+
2. **Miss-map (path b).** When the user has to *correct* the agent (a
|
|
25
|
+
HumanAsDetector signal) on a context a recent nudge had already flagged, that
|
|
26
|
+
nudge was a genuine catch the agent ignored — still a true positive. It's
|
|
27
|
+
marked acted (`via: 'miss'`). Wired right after the inbound human-detector
|
|
28
|
+
observe seam.
|
|
29
|
+
|
|
30
|
+
Matching is deliberately precision-over-recall (≥2 shared salient terms AND ≥50%
|
|
31
|
+
coverage, within a recency window): a falsely-*high* precision is the dangerous
|
|
32
|
+
direction since it gates interruption, so under-crediting a fast reply is
|
|
33
|
+
acceptable, inflating the gate is not. Everything is best-effort and never throws
|
|
34
|
+
into the message/delivery path.
|
|
35
|
+
|
|
36
|
+
`GET /usher/metrics` now also reports `acted_by_use` and `acted_by_miss` so the
|
|
37
|
+
precision numerator is visible split by which path confirmed usefulness.
|
|
38
|
+
|
|
39
|
+
## What to Tell Your User
|
|
40
|
+
|
|
41
|
+
The Usher now measures whether its mid-task reminders were actually useful — on
|
|
42
|
+
its own, two ways: when my next reply uses a reminder, and when you later have to
|
|
43
|
+
correct me on something a reminder had already flagged. That useful rate is the
|
|
44
|
+
number that has to look good before the Usher ever earns the right to interrupt me
|
|
45
|
+
(the final rung), so instead of sitting stuck at zero it can now gather real
|
|
46
|
+
numbers as we work. Nothing for you to set up — it just runs, and I can show you
|
|
47
|
+
the per-conversation numbers whenever you want them.
|
|
48
|
+
|
|
49
|
+
## Summary of New Capabilities
|
|
50
|
+
|
|
51
|
+
| Capability | How to Use |
|
|
52
|
+
|-----------|-----------|
|
|
53
|
+
| Usher precision numerator wired | Automatic — `markActed` is now called from the outbound-reply path (agent used the nudge) and the inbound human-detector seam (user corrected on it). |
|
|
54
|
+
| `acted_by_use` / `acted_by_miss` split | `GET /usher/metrics?topicId=N` returns the precision numerator broken down by which correlation path confirmed usefulness. |
|
|
55
|
+
| `UsherActedCorrelator` | Pure, exported coverage matcher (`salientTerms`, `contextCoveredBy`, `findCoveredSignalIds`, `markActedByCoverage`) + two thin wiring wrappers (`creditUsherOnOutbound`, `creditUsherOnMiss`). Unit-tested both-sides-of-the-boundary. |
|
|
56
|
+
|
|
57
|
+
## Evidence
|
|
58
|
+
|
|
59
|
+
- Unit: `tests/unit/UsherActedCorrelator.test.ts` — 20 cases covering salient-term
|
|
60
|
+
extraction, coverage thresholds (covers vs single-coincidental-word vs
|
|
61
|
+
low-coverage vs empty), recency-window filtering, the via-split + backward-compat
|
|
62
|
+
on `markActed`, and the two wrappers' guards.
|
|
63
|
+
- Integration: `tests/integration/usher-routes.test.ts` — `GET /usher/metrics`
|
|
64
|
+
exposes the `acted_by_use`/`acted_by_miss` split + precision; legacy topics
|
|
65
|
+
report the split as 0; source-guards prove `routes.ts` calls
|
|
66
|
+
`creditUsherOnOutbound` and `server.ts` calls `creditUsherOnMiss` after the
|
|
67
|
+
human-detector observe (anti-shipped-but-asleep).
|
|
68
|
+
- E2E: `tests/e2e/usher-precision-lifecycle.test.ts` — boots the real route tree
|
|
69
|
+
on a live HTTP server, proves the pre-fix state (precision pinned at 0 with a
|
|
70
|
+
fired-but-unacted nudge), then drives BOTH paths: a reply that uses the context
|
|
71
|
+
flips precision 0 → 1.0 (`acted_by_use`), an off-topic reply does not, and an
|
|
72
|
+
inbound correction credits a prior ignored nudge (`acted_by_miss`) — all visible
|
|
73
|
+
over real HTTP at `GET /usher/metrics`.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Side-Effects Review — Attention Topic-Flood Guard
|
|
2
|
+
|
|
3
|
+
**Spec:** `docs/specs/attention-topic-flood-guard.md` (converged, 4-reviewer panel)
|
|
4
|
+
**Change:** per-source + global forum-topic circuit breaker at
|
|
5
|
+
`TelegramAdapter.createAttentionItem` (the structural backstop). The redrive
|
|
6
|
+
offender fix shipped separately in PR #495 (merged); the redrive edits originally
|
|
7
|
+
bundled here were dropped to defer to it.
|
|
8
|
+
**Files:** `src/messaging/AttentionTopicGuard.ts` (new),
|
|
9
|
+
`src/messaging/TelegramAdapter.ts`, `src/core/PostUpdateMigrator.ts`, tests,
|
|
10
|
+
`tests/unit/feature-delivery-completeness.test.ts`, `upgrades/NEXT.md`.
|
|
11
|
+
|
|
12
|
+
## Phase 4 — the seven questions
|
|
13
|
+
|
|
14
|
+
1. **Over-block.** The guard never blocks an agent action or drops an item — it
|
|
15
|
+
only changes *delivery form* (own topic vs. one coalesced topic + a log line)
|
|
16
|
+
for **non-critical** items. The one legitimate behavior it changes: a
|
|
17
|
+
non-critical source raising >3 items / 10 min has the surplus coalesced. That
|
|
18
|
+
is the *intended* behavior (the operator asked for exactly this) and is tunable
|
|
19
|
+
per adapter. HIGH/URGENT are never affected. No agent capability is rejected.
|
|
20
|
+
|
|
21
|
+
2. **Under-block.** Before the global ceiling was added, a source varying its
|
|
22
|
+
`sourceContext` per item would have dodged the per-source budget — the review
|
|
23
|
+
caught this; the global cap + key eviction now bound it regardless of source
|
|
24
|
+
cardinality. Remaining under-block: a flood composed entirely of HIGH/URGENT
|
|
25
|
+
items is not coalesced (by design — critical items must always be visible). A
|
|
26
|
+
feature mis-marking routine noise as HIGH would still flood; that is a
|
|
27
|
+
mis-classification bug in that feature, not in the guard, and is the correct
|
|
28
|
+
place to fix it.
|
|
29
|
+
|
|
30
|
+
3. **Level-of-abstraction fit.** Correct layer: the breaker sits at the single
|
|
31
|
+
chokepoint (`createAttentionItem`) where every attention item becomes a topic,
|
|
32
|
+
so it covers all current and future callers. It is deliberately *below* the
|
|
33
|
+
tone-gate authority on the `/attention` route (a transport-mechanics
|
|
34
|
+
rate-counter, not a content-judgment filter). The per-feature redrive fix
|
|
35
|
+
(PR #495) is at the feature layer; the guard is the substrate backstop — two
|
|
36
|
+
layers, by intent.
|
|
37
|
+
|
|
38
|
+
4. **Signal vs authority.** Compliant. The guard holds no blocking authority over
|
|
39
|
+
agent behavior or information flow; it is a delivery *shaper* (the rate-counter
|
|
40
|
+
/ transport-dedup carve-out in `docs/signal-vs-authority.md`), the same class as
|
|
41
|
+
`SentinelNotifier`. It never withholds a critical notice and never drops an
|
|
42
|
+
item.
|
|
43
|
+
|
|
44
|
+
5. **Interactions.** Audited against `SentinelNotifier` (separate path → the
|
|
45
|
+
single reused system topic; no collision — it never flows through the guard) and
|
|
46
|
+
the `agent-attention-topic` (not registered in the attention maps, untouched).
|
|
47
|
+
Restart interaction (coalesced items vs. `loadAttentionItems` reverse-map
|
|
48
|
+
corruption) and concurrency (double-create race) were both found by review and
|
|
49
|
+
fixed. `updateAttentionStatus` no longer closes a shared topic when one
|
|
50
|
+
coalesced sibling resolves (coalesced items aren't in the per-item maps).
|
|
51
|
+
|
|
52
|
+
6. **External surfaces.** User-visible change: a flooding source now produces one
|
|
53
|
+
"🔁 …: notices coalesced (flood guard)" topic instead of a wall; the rest goes
|
|
54
|
+
to `state/attention-suppressed.jsonl`. Fleet-wide via dist update, default-ON,
|
|
55
|
+
no config. No new network calls; no new external dependency. The CLAUDE.md
|
|
56
|
+
awareness section is backfilled to existing agents (idempotent migrator).
|
|
57
|
+
|
|
58
|
+
7. **Rollback cost.** Cheap. Single config flag:
|
|
59
|
+
`messaging[].config.attentionTopicGuard.enabled = false` restores per-item-topic
|
|
60
|
+
behavior. No data migration, no agent-state repair (the guard holds only
|
|
61
|
+
in-memory counters). Worst case is a `src/` revert + patch release.
|
|
62
|
+
|
|
63
|
+
## Phase 5 — second-pass review (REQUIRED: touches a "guard" + outbound messaging)
|
|
64
|
+
|
|
65
|
+
An independent four-reviewer convergence panel (adversarial/security, integration,
|
|
66
|
+
architecture, scalability) audited the change against the diff. It raised 7
|
|
67
|
+
material concerns (global-cap dodge, `/ack`+shared-topic-close, case-sensitive
|
|
68
|
+
critical bypass, double-create race, hex plaintext to unverified address, NaN
|
|
69
|
+
config disable, unbounded audit log) plus framing notes. **6 of the 7 were fixed
|
|
70
|
+
in code this iteration; the 7th (hex plaintext) was a finding on the redrive edits
|
|
71
|
+
that are now deferred to the merged PR #495.** Full record:
|
|
72
|
+
`docs/specs/attention-topic-flood-guard.convergence.md`. **Concur with the review —
|
|
73
|
+
the design after this iteration addresses every raised concern; no blocking
|
|
74
|
+
authority on brittle logic remains.**
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Side-Effects Review — Usher precision numerator wiring (rung 4)
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `usher-precision-loop`
|
|
4
|
+
**Date:** `2026-05-28`
|
|
5
|
+
**Author:** `echo`
|
|
6
|
+
**Second-pass reviewer:** `not required` (signal-only observability change, no blocking surface)
|
|
7
|
+
**Spec:** `docs/specs/cwa-usher.md` (approved:true by justin; review-note explicitly names "the usher_acted precision definition that gates rung 5" as the in-scope follow-up this change implements)
|
|
8
|
+
|
|
9
|
+
## Summary of the change
|
|
10
|
+
|
|
11
|
+
The Usher fires re-surface signals (`UsherSignalStore.recordSignal`) and exposes a
|
|
12
|
+
precision read (`acted / fired`) that the spec designates as the hard precondition
|
|
13
|
+
for rung 5 (mid-task injection). But `UsherSignalStore.markActed` — the precision
|
|
14
|
+
*numerator* — had no caller anywhere, so `acted` was pinned at 0 on every topic
|
|
15
|
+
and precision could never move. This wires the numerator via two correlation paths
|
|
16
|
+
in a new pure helper `src/core/UsherActedCorrelator.ts`: (a) **auto-use** — when the
|
|
17
|
+
agent's outbound reply on a topic uses a re-surfaced context, mark that signal
|
|
18
|
+
`acted(via:'use')`, called from the `POST /telegram/reply` handler in
|
|
19
|
+
`src/server/routes.ts` after a genuine (non-proxy, non-system) reply sends; (b)
|
|
20
|
+
**miss-map** — when the user has to correct the agent (a `HumanAsDetector` signal)
|
|
21
|
+
on a context a recent nudge flagged, mark it `acted(via:'miss')`, called right after
|
|
22
|
+
the inbound `observeInboundMessage` seam in `src/commands/server.ts`. `markActed` now
|
|
23
|
+
also stamps `actedVia`/`actedAt`, and `GET /usher/metrics` reports
|
|
24
|
+
`acted_by_use`/`acted_by_miss`. Files: `UsherSignalStore.ts`, `UsherActedCorrelator.ts`
|
|
25
|
+
(new), `usherRoutes.ts`, `routes.ts` (+`RouteContext.usherSignalStore`),
|
|
26
|
+
`AgentServer.ts` (route ctx wiring), `server.ts` (path-b seam).
|
|
27
|
+
|
|
28
|
+
## Decision-point inventory
|
|
29
|
+
|
|
30
|
+
The only "decision" this change makes is whether to increment an observability
|
|
31
|
+
counter (`acted`). It gates nothing — no message is blocked, delayed, or altered.
|
|
32
|
+
|
|
33
|
+
- `UsherActedCorrelator.contextCoveredBy` — **add** — pure text-coverage match deciding whether a probe references a fired signal's proposition. Output feeds `markActed` only; no authority over delivery.
|
|
34
|
+
- `routes.ts POST /telegram/reply` (path a) — **pass-through** — the existing send decision is untouched; crediting runs *after* the reply has already gone out.
|
|
35
|
+
- `server.ts` inbound human-detector seam (path b) — **pass-through** — crediting runs after `observeInboundMessage`, which itself is signal-only.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 1. Over-block
|
|
40
|
+
|
|
41
|
+
**What legitimate inputs does this change reject that it shouldn't?**
|
|
42
|
+
|
|
43
|
+
No block/allow surface — over-block not applicable. `markActed` only increments a
|
|
44
|
+
metric; it cannot reject, delay, or modify any inbound or outbound message. Both
|
|
45
|
+
call sites run strictly *after* the message has been processed/sent, and both are
|
|
46
|
+
wrapped best-effort (never throw into the message path).
|
|
47
|
+
|
|
48
|
+
## 2. Under-block
|
|
49
|
+
|
|
50
|
+
**What failure modes does this still miss?**
|
|
51
|
+
|
|
52
|
+
By design (precision-over-recall — a falsely-HIGH precision is the dangerous
|
|
53
|
+
direction since precision gates rung 5), the correlator deliberately UNDER-credits:
|
|
54
|
+
|
|
55
|
+
- **Path (a) timing race:** the Usher's signal is recorded by an async, LLM-backed
|
|
56
|
+
fire-and-forget loop (~8–10s). A very fast agent reply can land before the signal
|
|
57
|
+
is persisted, so that use goes uncredited. Acceptable: the full reply (after the
|
|
58
|
+
agent's work) usually lands well after the signal persists, and under-crediting
|
|
59
|
+
never inflates the gate.
|
|
60
|
+
- **Short contexts:** a context with fewer than 2 salient terms can never reach the
|
|
61
|
+
`MIN_SHARED=2` threshold, so single-word propositions are never auto-credited.
|
|
62
|
+
- **Recency window:** uses/corrections outside `USE_WINDOW_MS` (6h) / `MISS_WINDOW_MS`
|
|
63
|
+
(24h) are not credited.
|
|
64
|
+
|
|
65
|
+
These are recall gaps, not correctness bugs — the precision number will be a *floor*
|
|
66
|
+
on true usefulness, which is the conservative posture the rung-5 gate wants.
|
|
67
|
+
|
|
68
|
+
## 3. Level-of-abstraction fit
|
|
69
|
+
|
|
70
|
+
**Is this at the right layer?**
|
|
71
|
+
|
|
72
|
+
Yes. `markActed` already existed on `UsherSignalStore` (the spec's numerator); this
|
|
73
|
+
change only supplies its missing callers. The matching logic lives in a pure,
|
|
74
|
+
unit-tested helper (`UsherActedCorrelator`) rather than inline at the call sites,
|
|
75
|
+
and the two call sites are the two existing seams where the relevant text is already
|
|
76
|
+
in hand (outbound reply text; inbound correction text + its `HumanAsDetector`
|
|
77
|
+
verdict). No higher layer owns "was this nudge used" — this is the layer that has
|
|
78
|
+
both the fired signals and the probe text. No smarter gate exists that should own
|
|
79
|
+
it instead.
|
|
80
|
+
|
|
81
|
+
## 4. Signal vs authority compliance
|
|
82
|
+
|
|
83
|
+
**Does this hold blocking authority with brittle logic, or produce a signal?**
|
|
84
|
+
|
|
85
|
+
Compliant (`docs/signal-vs-authority.md`). The coverage matcher is intentionally
|
|
86
|
+
brittle (keyword overlap, no LLM) — and that is acceptable *precisely because it has
|
|
87
|
+
zero authority*. It produces a signal (the precision numerator) and nothing else. It
|
|
88
|
+
never blocks, never gates delivery, and feeds only the operator-facing
|
|
89
|
+
`GET /usher/metrics`. A brittle detector with no blocking power is the correct
|
|
90
|
+
pattern; the anti-pattern (brittle check WITH blocking authority) is not present.
|
|
91
|
+
|
|
92
|
+
## 5. Interactions
|
|
93
|
+
|
|
94
|
+
**Does it shadow another check, get shadowed, double-fire, or race?**
|
|
95
|
+
|
|
96
|
+
- **Idempotency:** `markActed` guards `if (sig.acted) return false`, so paths (a) and
|
|
97
|
+
(b) marking the same signal, or repeated calls, increment `acted` at most once per
|
|
98
|
+
signal. The split counters (`acted_by_use`/`acted_by_miss`) only increment on the
|
|
99
|
+
successful (first) mark.
|
|
100
|
+
- **Ordering on the inbound seam:** path (b) runs in the human-detector callback,
|
|
101
|
+
which is chained *before* the Usher loop callback on the same `onMessageLogged`.
|
|
102
|
+
It correlates the correction against signals fired on PRIOR turns (already
|
|
103
|
+
persisted) — it does not race the current turn's not-yet-fired signal.
|
|
104
|
+
- **No shadowing:** the outbound tone-gate / dedup / ArcCheck path is unchanged;
|
|
105
|
+
crediting runs after the gate passed and the send succeeded, so it cannot affect
|
|
106
|
+
any block/allow outcome.
|
|
107
|
+
|
|
108
|
+
## 6. External surfaces
|
|
109
|
+
|
|
110
|
+
**Does it change anything visible to other agents, users, or systems?**
|
|
111
|
+
|
|
112
|
+
- `GET /usher/metrics` gains two additive fields (`acted_by_use`, `acted_by_miss`)
|
|
113
|
+
and `acted`/`precision` now actually move. This endpoint is operator-only
|
|
114
|
+
(`INTERNAL_PREFIXES`), not surfaced to end users or other agents.
|
|
115
|
+
- The per-topic `usher/<topicId>.json` store files gain optional `actedVia`/`actedAt`
|
|
116
|
+
on signals — additive; `load()` already tolerates unknown/missing fields and old
|
|
117
|
+
readers ignore them.
|
|
118
|
+
- No change to any message content, no new outbound traffic, nothing visible to
|
|
119
|
+
peer agents. Behavior depends on conversation/topic state but is fully best-effort.
|
|
120
|
+
|
|
121
|
+
## 7. Rollback cost
|
|
122
|
+
|
|
123
|
+
**If this turns out wrong in production, what's the back-out?**
|
|
124
|
+
|
|
125
|
+
Cheap and clean: revert the commit (a normal patch release). No data migration — the
|
|
126
|
+
new optional fields are tolerated by existing `load()` and ignored by older binaries;
|
|
127
|
+
a topic file written by the new code is readable by the old code and vice-versa.
|
|
128
|
+
Worst case after revert: `precision` returns to its prior pinned-at-0 state (the bug
|
|
129
|
+
this fixes). No agent-state repair, no hot-data fix. Because the change is
|
|
130
|
+
observability-only, a wrong precision number cannot itself cause an outage — at most
|
|
131
|
+
it would mislead the rung-5 decision, which is human-gated and not part of this change.
|