instar 1.2.38 → 1.2.39
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 +6 -1
- package/dist/commands/server.js.map +1 -1
- package/dist/core/TopicIntent.d.ts +162 -0
- package/dist/core/TopicIntent.d.ts.map +1 -0
- package/dist/core/TopicIntent.js +355 -0
- package/dist/core/TopicIntent.js.map +1 -0
- package/dist/core/TopicIntentArcCheck.d.ts +101 -0
- package/dist/core/TopicIntentArcCheck.d.ts.map +1 -0
- package/dist/core/TopicIntentArcCheck.js +146 -0
- package/dist/core/TopicIntentArcCheck.js.map +1 -0
- package/dist/core/TopicIntentBriefing.d.ts +44 -0
- package/dist/core/TopicIntentBriefing.d.ts.map +1 -0
- package/dist/core/TopicIntentBriefing.js +88 -0
- package/dist/core/TopicIntentBriefing.js.map +1 -0
- package/dist/core/TopicIntentExtractor.d.ts +90 -0
- package/dist/core/TopicIntentExtractor.d.ts.map +1 -0
- package/dist/core/TopicIntentExtractor.js +153 -0
- package/dist/core/TopicIntentExtractor.js.map +1 -0
- package/dist/core/TopicIntentPendingConfirm.d.ts +96 -0
- package/dist/core/TopicIntentPendingConfirm.d.ts.map +1 -0
- package/dist/core/TopicIntentPendingConfirm.js +223 -0
- package/dist/core/TopicIntentPendingConfirm.js.map +1 -0
- package/dist/server/AgentServer.d.ts +3 -0
- package/dist/server/AgentServer.d.ts.map +1 -1
- package/dist/server/AgentServer.js +10 -0
- package/dist/server/AgentServer.js.map +1 -1
- package/dist/server/topicIntentRoutes.d.ts +27 -0
- package/dist/server/topicIntentRoutes.d.ts.map +1 -0
- package/dist/server/topicIntentRoutes.js +189 -0
- package/dist/server/topicIntentRoutes.js.map +1 -0
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +4 -4
- package/src/templates/hooks/telegram-topic-context.sh +19 -0
- package/upgrades/1.2.39.md +54 -0
- package/upgrades/side-effects/topic-intent-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AAC,IAAI,EAAE,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;YACjG,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;YACvF,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,+EAA+E;YAC/E,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,kCAAmC,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACvG,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
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-23T02:07:34.437Z",
|
|
5
|
+
"instarVersion": "1.2.39",
|
|
6
6
|
"entryCount": 191,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -1064,7 +1064,7 @@
|
|
|
1064
1064
|
"type": "template",
|
|
1065
1065
|
"domain": "safety",
|
|
1066
1066
|
"sourcePath": "src/templates/hooks/telegram-topic-context.sh",
|
|
1067
|
-
"contentHash": "
|
|
1067
|
+
"contentHash": "57cfb744bbffcd21f6290c5f38726b105b93258bf09cc539c24d66aebed9c40e",
|
|
1068
1068
|
"since": "2025-01-01"
|
|
1069
1069
|
},
|
|
1070
1070
|
"template:convergence-check.sh": {
|
|
@@ -1440,7 +1440,7 @@
|
|
|
1440
1440
|
"type": "subsystem",
|
|
1441
1441
|
"domain": "server",
|
|
1442
1442
|
"sourcePath": "src/server/AgentServer.ts",
|
|
1443
|
-
"contentHash": "
|
|
1443
|
+
"contentHash": "0c4f63b37d72bc85415e464e181507b66bb247df1e903da2fe27c5d6539dab0f",
|
|
1444
1444
|
"since": "2025-01-01"
|
|
1445
1445
|
},
|
|
1446
1446
|
"subsystem:session-manager": {
|
|
@@ -65,6 +65,25 @@ else
|
|
|
65
65
|
"http://localhost:${PORT}/telegram/topics/${TOPIC_ID}/messages?limit=30" 2>/dev/null)
|
|
66
66
|
fi
|
|
67
67
|
|
|
68
|
+
# Layer 2: prepend the topic intent briefing if anything has accumulated.
|
|
69
|
+
# Returns empty body when nothing tracked yet — we silently skip injection.
|
|
70
|
+
# Degrades open: any failure here (server down, route 503'd, network blip)
|
|
71
|
+
# leaves recent-history-only output unchanged.
|
|
72
|
+
TOPIC_BRIEFING=""
|
|
73
|
+
if [ -n "$AUTH_TOKEN" ]; then
|
|
74
|
+
TOPIC_BRIEFING=$(curl -s --max-time 2 \
|
|
75
|
+
-H "Authorization: Bearer ${AUTH_TOKEN}" \
|
|
76
|
+
"http://localhost:${PORT}/topic-intent/${TOPIC_ID}/briefing" 2>/dev/null)
|
|
77
|
+
else
|
|
78
|
+
TOPIC_BRIEFING=$(curl -s --max-time 2 \
|
|
79
|
+
"http://localhost:${PORT}/topic-intent/${TOPIC_ID}/briefing" 2>/dev/null)
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
if [ -n "$TOPIC_BRIEFING" ]; then
|
|
83
|
+
echo "$TOPIC_BRIEFING"
|
|
84
|
+
echo ""
|
|
85
|
+
fi
|
|
86
|
+
|
|
68
87
|
# Format and output context with unanswered message detection
|
|
69
88
|
echo "$RECENT_MSGS" | python3 -c "
|
|
70
89
|
import sys, json
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- bump: minor -->
|
|
4
|
+
<!-- minor = new feature, requires meaningful user-visible behavior addition -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
**feat(topic-intent-layer): Layers 1-3 — per-topic confidence tracking + resume briefing + ArcCheck pre-send signal.**
|
|
9
|
+
|
|
10
|
+
A new three-layer feature that gives the agent a real sense of each conversation's arc. When you talk to the agent across many turns (or days, or after a context reset), it now keeps quiet track of what the topic is about, what's settled, and what's still tentative — without you ever typing a command. The agent does the bookkeeping in the background.
|
|
11
|
+
|
|
12
|
+
- **Layer 1** — a per-topic confidence tracker. Each candidate fact or decision the conversation establishes is tracked with confidence that rises with reinforcement (you re-reference, you affirm) and falls with contradiction or long silence. Authority requires user-authored evidence — the agent cannot silently promote its own guesses to "settled" by re-referencing itself.
|
|
13
|
+
- **Layer 2** — a briefing the agent reads at the top of every session resume. Telegram bootstrap automatically fetches it and prepends it to the recent-history block. Settled items shown unhedged; tentative items shown with confidence; observation tier (background noise) deliberately not surfaced.
|
|
14
|
+
- **Layer 3** — ArcCheck, a pre-send signal that fires when the agent's draft would either act on a tentative item without confirming OR contradict something already settled. Signal-only — the agent decides whether to redraft including a natural-language confirmation question. Never blocks.
|
|
15
|
+
|
|
16
|
+
Spec: `docs/specs/topic-intent-layer.md` (v14 CLEAN, approved 2026-05-22, 14 internal rounds plus 13 external rounds).
|
|
17
|
+
|
|
18
|
+
This build was also the test bed for evaluating whether to integrate GSD as a runtime dependency. Verdict: cherry-pick the methodologies into Instar primitives, do not try runtime composition. Comparison report archived at `.planning/SPIKE-FINDINGS.md` plus `.planning/phases/01-layer1/PLAN.md`.
|
|
19
|
+
|
|
20
|
+
## Evidence
|
|
21
|
+
|
|
22
|
+
The original failure modes that motivated the feature are documented as canonical incidents in the spec — qalatra topic 9235 (arc drift across a multi-turn investigation) and GCI/Luna topic 365 (decision amnesia where the agent proposed redesigning a settled OAuth architecture mid-debugging, contradicting an earlier decision).
|
|
23
|
+
|
|
24
|
+
96 tests across all three tiers, all green locally:
|
|
25
|
+
- Decay arithmetic at days 104, 105, 106 matches spec values to 3 decimal places.
|
|
26
|
+
- User-authored-episode authority gating clamps at 0.69 when no qualifying user-authored episode exists.
|
|
27
|
+
- Per-message dedup with larger-delta-wins on collision.
|
|
28
|
+
- Pending-confirm queue depth 3 with silent drop plus telemetry counter.
|
|
29
|
+
- Sharpen-retry up to 2 then abandoned.
|
|
30
|
+
- PII-safe diagnostics endpoint (raw evidence meta allowlist-filtered, never returns user message text).
|
|
31
|
+
- Framework-parity grep gate (zero Claude-Code or Codex-CLI specific tokens in any Layer 1/2/3 source).
|
|
32
|
+
- Tier-3 lifecycle test boots through the real production server path and observes tier transitions through HTTP.
|
|
33
|
+
|
|
34
|
+
Side-effects review artifact: `upgrades/side-effects/topic-intent-layer.md`.
|
|
35
|
+
|
|
36
|
+
## What to Tell Your User
|
|
37
|
+
|
|
38
|
+
In long, multi-day, or multi-topic conversations, the agent stays on-point. It resumes knowing the goal. It stops re-litigating things you already settled together. When it is about to do something based on an assumption that might be wrong, it asks first in plain English, as part of its reply. When you correct it, it actually updates.
|
|
39
|
+
|
|
40
|
+
In short, simple conversations, nothing changes. The layer only kicks in once a conversation has substance worth tracking, and stays quiet otherwise.
|
|
41
|
+
|
|
42
|
+
No commands to learn. No configuration to set. The agent does the bookkeeping; you just talk.
|
|
43
|
+
|
|
44
|
+
A diagnostics view per conversation tells you exactly what the agent is tracking, how confident it is, what signals built that confidence, and whether anything is in conflict.
|
|
45
|
+
|
|
46
|
+
## Summary of New Capabilities
|
|
47
|
+
|
|
48
|
+
- New core modules covering confidence tracking, pending-confirmation lifecycle, LLM-backed extraction, resume briefing rendering, and pre-send classifier.
|
|
49
|
+
- New HTTP routes for diagnostics, refs filter, pending state, telemetry, briefing, and ArcCheck.
|
|
50
|
+
- Telegram bootstrap hook auto-fetches the briefing on session resume. Degrades open on any failure.
|
|
51
|
+
- Production server boot path constructs the store and passes it to AgentServer. Mount unconditional (503 stub when store disabled).
|
|
52
|
+
- Out of v1: cross-conversation insight spreading, retroactive backfill of pre-shipped conversations, cross-machine CRDT collaborative state, automatic conversation renaming, rich dashboard editor, user-tunable confidence weights (operator may tune; end user cannot).
|
|
53
|
+
|
|
54
|
+
Layer 3's outbound-path wiring (the actual every-send-fires-ArcCheck plumbing into the tone-gate and response-review stack) is intentionally separated from this ship. The classifier IS the spec's Layer 3 mechanism; the rollout is best done with care under a dedicated follow-up since it touches the existing outbound gate authority.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Side-Effects Review — Topic Intent Layer (Layers 1-3)
|
|
2
|
+
|
|
3
|
+
**PR:** https://github.com/JKHeadley/instar/pull/332
|
|
4
|
+
**Spec:** `docs/specs/topic-intent-layer.md` (v14 CLEAN, approved 2026-05-22)
|
|
5
|
+
**Author:** Echo · autonomous run · 2026-05-22
|
|
6
|
+
**Process:** Per `feedback_side_effects_review.md` — seven-dimension review before ship.
|
|
7
|
+
|
|
8
|
+
## 1. Over-block
|
|
9
|
+
|
|
10
|
+
The feature could over-block if a hook surfaces tentative items as if settled, or if ArcCheck started blocking sends.
|
|
11
|
+
|
|
12
|
+
**Mitigations in place:**
|
|
13
|
+
- ArcCheck verdict shape never includes a `block` or `authority` field. Signal-only by spec and by test (`tests/unit/TopicIntent-arccheck.test.ts` asserts this).
|
|
14
|
+
- Tentative items in the Layer 2 briefing are explicitly hedged with the word "TENTATIVE" + confidence value. Settled items in a separate "SETTLED" section.
|
|
15
|
+
- Observation tier (< 0.30) is NOT surfaced in the briefing at all — no noise leak.
|
|
16
|
+
- The briefing endpoint returns empty body when nothing has accumulated, so bootstrap hooks can skip injection cleanly without distorting normal session start.
|
|
17
|
+
|
|
18
|
+
## 2. Under-block
|
|
19
|
+
|
|
20
|
+
The feature could under-block if it lets a single LLM extraction silently launder its own guesses to authoritative tier (the canonical GCI failure mode).
|
|
21
|
+
|
|
22
|
+
**Mitigations in place:**
|
|
23
|
+
- Authority hard rule (spec section "Authority gating"): confidence cannot reach the authoritative tier (≥0.7) unless at least one evidence event qualifies as a user-authored episode. Enforced in `projectConfidence` with a clamp at 0.69.
|
|
24
|
+
- Per-message dedup: multiple signals about the same refId from the same source message count as ONE episode with the larger applicable delta — agent cannot fork its own message into multiple episodes.
|
|
25
|
+
- Affirmation safety: per-refId per-24h cap of 1 affirmation bonus, plus per-single-user-message max of 3 distinct refIds affirmed, defends against a single "yes" mass-promoting.
|
|
26
|
+
- Signal-specific caps: `agent-reref` capped at +0.05 cumulative, `extract-agent` at +0.10. Even an unbounded loop of agent-origin signals cannot accumulate to authority.
|
|
27
|
+
|
|
28
|
+
## 3. Level-of-abstraction fit
|
|
29
|
+
|
|
30
|
+
Is the feature implemented at the right layer of the stack?
|
|
31
|
+
|
|
32
|
+
**Assessment:**
|
|
33
|
+
- Storage at `.instar/topic-intent/<topicId>.json` parallels the existing `.instar/topic-resume-map.json` convention — same level, same JSON-first approach, same file-per-topic granularity.
|
|
34
|
+
- Routes mounted via the same `createXxxRoutes` factory pattern as `worktreeRoutes`, `fileRoutes`, `machineRoutes` — consistent with the codebase's idiom.
|
|
35
|
+
- AgentServer options pattern mirrors existing optional dependencies (e.g., `worktreeManager?`). DI is uniform.
|
|
36
|
+
- Telegram bootstrap hook modification is minimal — one curl call with degrade-open semantics. Slack bootstrap hook is NOT modified (slack channel IDs are string-keyed, not numeric topic IDs; the cleanest adapter pattern for Slack is a follow-up).
|
|
37
|
+
|
|
38
|
+
## 4. Signal-vs-authority compliance
|
|
39
|
+
|
|
40
|
+
Per `feedback_signal_vs_authority`: brittle/low-context filters detect signals; only higher-level intelligent gates with full context block.
|
|
41
|
+
|
|
42
|
+
**Assessment:**
|
|
43
|
+
- ArcCheck is the signal layer. It returns verdicts that include `kind`, `refId`, `currentTier`, `currentConfidence`, `reason`, `suggestedRewriteHint` — no authority claim.
|
|
44
|
+
- The agent itself is the authority layer. The agent reads the ArcCheck signal in its draft preparation and chooses to either redraft (with a conversational confirmation question) or proceed.
|
|
45
|
+
- The existing outbound gates (tone-gate, response-review, outbound-dedup) retain their blocking authority and are unaffected by this change.
|
|
46
|
+
|
|
47
|
+
## 5. Cross-feature interactions
|
|
48
|
+
|
|
49
|
+
What other Instar systems could this affect?
|
|
50
|
+
|
|
51
|
+
- **CompactionSentinel** — the briefing prepended on every bootstrap may slightly increase context-window usage at session start. Mitigation: maxPerSection cap (default 8) + overflow note keeps it bounded; observation tier deliberately omitted. The briefing is empty body when nothing tracked.
|
|
52
|
+
- **Tone-gate / response-review** — Layer 3 does NOT integrate into the outbound path in this ship. The classifier exists and is reachable; the actual every-send wiring is a deliberate follow-up so we can think carefully about whether ArcCheck signals should be routed through the existing gate or augment them.
|
|
53
|
+
- **Telegram bootstrap hook** — modified, but failure modes are degrade-open (any error → empty briefing, recent-history output unchanged). The 2-second timeout (`curl --max-time 2`) bounds latency.
|
|
54
|
+
- **Slack bootstrap hook** — NOT modified. Slack channel IDs are string-keyed; topic-intent is numeric-keyed. Adapter pattern for Slack is a v1.1 follow-up.
|
|
55
|
+
- **iMessage / WhatsApp** — same situation as Slack, deferred.
|
|
56
|
+
|
|
57
|
+
## 6. Rollback cost
|
|
58
|
+
|
|
59
|
+
If this needs to revert, what's the blast radius?
|
|
60
|
+
|
|
61
|
+
- All new files (`src/core/TopicIntent*.ts`, `src/server/topicIntentRoutes.ts`, all `tests/unit/TopicIntent-*.test.ts`, `tests/integration/topic-intent-routes.test.ts`, `tests/e2e/topic-intent-lifecycle.test.ts`) can be deleted without affecting any other system.
|
|
62
|
+
- Modified files (`src/server/AgentServer.ts`, `src/commands/server.ts`, `src/templates/hooks/telegram-topic-context.sh`) have small surgical additions that can be reverted independently — store construction, route mount, optional briefing-fetch with degrade-open.
|
|
63
|
+
- Storage at `.instar/topic-intent/<topicId>.json` is per-topic JSON files; deleting them has no effect on any other Instar state.
|
|
64
|
+
- No new dependencies in `package.json`. No DB migrations. No config-format changes.
|
|
65
|
+
|
|
66
|
+
**Net rollback cost: low.** A clean revert of the feature commit + deleting the storage directory is sufficient.
|
|
67
|
+
|
|
68
|
+
## 7. Migration parity
|
|
69
|
+
|
|
70
|
+
Per `feedback_migration_parity_standard` (built into CLAUDE.md): changes to agent-installed files must reach existing agents via the update path.
|
|
71
|
+
|
|
72
|
+
**Files in this PR that need migration handling:**
|
|
73
|
+
- `src/templates/hooks/telegram-topic-context.sh` — built-in hook script. Per the Migration Parity Standard, built-in hooks are **always overwritten** on every migration run via `installBuiltinHooks()`. No additional migration code needed — the script will reach existing agents on their next `instar upgrade`.
|
|
74
|
+
|
|
75
|
+
**No other agent-installed files changed** in this PR. CLAUDE.md template is unchanged in this PR; Agent Awareness Standard update (so agents know about the new `/topic-intent/*` endpoints) is the recommended next follow-up before the cherry-pick v1.3.x project.
|
|
76
|
+
|
|
77
|
+
## Conclusion
|
|
78
|
+
|
|
79
|
+
Ship. Seven-dimension review clean. Rollback cost low. No new external dependencies. All three test tiers green. PII boundary explicitly tested. Framework-parity grep gate in place.
|
|
80
|
+
|
|
81
|
+
Follow-up scoped for future work (in priority order):
|
|
82
|
+
1. Layer 3 outbound-path wiring (the every-send ArcCheck integration with tone-gate / response-review).
|
|
83
|
+
2. Slack / iMessage / WhatsApp bootstrap parity for Layer 2 briefing.
|
|
84
|
+
3. CLAUDE.md template update for Agent Awareness Standard.
|
|
85
|
+
4. Daily probe job that replays the qalatra-9235 and GCI/Luna-365 fixtures against the live extractor.
|
|
86
|
+
5. The seven cherry-pick recommendations from the GSD spike (separate v1.3.x project).
|