instar 1.3.153 → 1.3.155

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.
Files changed (32) hide show
  1. package/.claude/skills/autonomous/scripts/setup-autonomous.sh +10 -0
  2. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  3. package/dist/config/ConfigDefaults.js +4 -0
  4. package/dist/config/ConfigDefaults.js.map +1 -1
  5. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  6. package/dist/core/PostUpdateMigrator.js +22 -1
  7. package/dist/core/PostUpdateMigrator.js.map +1 -1
  8. package/dist/core/PreferencesManager.d.ts +19 -0
  9. package/dist/core/PreferencesManager.d.ts.map +1 -1
  10. package/dist/core/PreferencesManager.js +26 -8
  11. package/dist/core/PreferencesManager.js.map +1 -1
  12. package/dist/core/types.d.ts +10 -0
  13. package/dist/core/types.d.ts.map +1 -1
  14. package/dist/core/types.js.map +1 -1
  15. package/dist/monitoring/SelfViolationDetector.d.ts +61 -0
  16. package/dist/monitoring/SelfViolationDetector.d.ts.map +1 -0
  17. package/dist/monitoring/SelfViolationDetector.js +153 -0
  18. package/dist/monitoring/SelfViolationDetector.js.map +1 -0
  19. package/dist/scaffold/templates.d.ts.map +1 -1
  20. package/dist/scaffold/templates.js +1 -0
  21. package/dist/scaffold/templates.js.map +1 -1
  22. package/dist/server/routes.d.ts.map +1 -1
  23. package/dist/server/routes.js +89 -1
  24. package/dist/server/routes.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/data/builtin-manifest.json +62 -62
  27. package/src/scaffold/templates.ts +1 -0
  28. package/upgrades/1.3.142.md +32 -9
  29. package/upgrades/{1.3.153.md → 1.3.154.md} +40 -0
  30. package/upgrades/1.3.155.md +26 -0
  31. package/upgrades/side-effects/codex-autonomy-native-goal-autowire.md +43 -0
  32. package/upgrades/side-effects/correction-self-violation-signal.md +133 -0
@@ -35,6 +35,11 @@ checks the publish gate enforces, and a malformed fragment fails the push loudly
35
35
 
36
36
  ## What to Tell Your User
37
37
 
38
+ If you run a Codex-based agent, it can now run in autonomous mode and keep itself going across
39
+ many turns until the goal is met — the same way a Claude agent does. Before, a Codex agent in
40
+ autonomous mode would quietly stop after a single turn. Nothing to configure; it applies on the
41
+ next update, and Claude agents are unaffected.
42
+
38
43
  Behind the scenes, the way I prepare release notes got a lot more robust. Each
39
44
  change now writes its own small note in its own file, instead of every change
40
45
  fighting over one shared notes file. That means when several updates are being
@@ -44,8 +49,43 @@ I talk to you — this is purely a smoother release pipeline on my side.
44
49
 
45
50
  ## Summary of New Capabilities
46
51
 
52
+ - `setup-autonomous.sh` now enables native /goal delegation for Codex agents (detected via config
53
+ `enabledFrameworks` containing `codex-cli`), not just Claude Code >= 2.1.139. Codex autonomous
54
+ mode auto-delegates to native /goal; the stop-hook's existing `goal_mode:native` branch defers.
55
+ - `PostUpdateMigrator` marker bump (`native-goal/set` → `IS_CODEX_AGENT`) re-deploys the fixed
56
+ setup script to existing agents.
57
+
47
58
  | Capability | How to Use |
48
59
  |-----------|-----------|
49
60
  | Per-PR release-note fragments | Write `upgrades/next/<slug>.md` (one file per change) |
50
61
  | Fragment assembler | `node scripts/assemble-next-md.mjs` (runs automatically in publish) |
51
62
  | Legacy NEXT.md | Still supported — folded in for backward compatibility |
63
+
64
+ ## Evidence
65
+
66
+ - Root cause traced by reading setup-autonomous.sh: the native /goal hand-off existed but was
67
+ gated on `claude --version >= 2.1.139` (empty for a codex agent → codex fell to the dark
68
+ Phase-1 no-op). Proven live in round 2 that codex /goal sustains 1→2→3 across turns.
69
+ - Unit: `tests/unit/autonomous-codex-native-goal-detection.test.ts` — both sides of the
70
+ decision boundary (codex enables, Claude/absent skips, multi-framework enables, missing config
71
+ best-effort skips).
72
+ - Unit: `tests/unit/PostUpdateMigrator-autonomousStopHook.test.ts` — a prior native-/goal setup
73
+ is re-deployed by the marker bump; all existing cases stay green (8 tests).
74
+ - `tsc --noEmit` + `npm run lint` clean.
75
+ - Spec: `docs/specs/codex-autonomy-native-goal-autowire.md` (+ `.eli16.md`).
76
+ - Side-effects: `upgrades/side-effects/codex-autonomy-native-goal-autowire.md`.
77
+ - Final proof is the live drive: Codey running the real /autonomous skill and sustaining multi-turn.
78
+
79
+ ## What Changed — Codex agents now run autonomous mode on their own (Claude parity)
80
+
81
+ When you put an agent in autonomous mode, it should keep working across many turns until the job
82
+ is done. Claude agents already did this (via the stop hook). Codex agents did NOT — they would
83
+ quietly stop after one turn. Codex actually has its own way to sustain a multi-turn run (its
84
+ built-in /goal loop), and instar already handed the goal off to it automatically — but only
85
+ behind a check for "Claude command-line version 2.1.139+", which is empty for a Codex agent. So
86
+ Codex agents fell through that Claude-shaped gate and never got the hand-off.
87
+
88
+ This adds a small framework-aware fallback: if the Claude check doesn't apply, instar detects a
89
+ Codex agent (from its own config) and hands the goal to Codex's native /goal loop. Now a Codex
90
+ agent in autonomous mode sustains multi-turn work automatically, the same as a Claude agent. The
91
+ Claude path is unchanged, and the sensitive stop hook is untouched.
@@ -0,0 +1,26 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: minor -->
5
+
6
+ ## What Changed
7
+
8
+ **A stored preference that gets violated now becomes a learning signal (dark).** This extends the Correction & Preference Learning Sentinel. A learned preference — for example, "don't defer work to a fresh session" or "never ask the user to edit files" — can now carry an optional self-violation pattern. When the agent emits an outbound message that contradicts such a preference, that is recorded as a self-violation in the correction ledger, which reinforces the preference's recurrence so it surfaces more prominently the next session.
9
+
10
+ It is signal-only: the detector observes the finalized outbound message and records — it can never block, delay, or rewrite a message. It is fail-open (any detector error silently no-ops and delivery is unaffected) and dark (gated behind both the master correction-learning flag and a new self-violation sub-flag). A preference without a self-violation pattern is never checked, so existing preference files are fully backward compatible.
11
+
12
+ ## What to Tell Your User
13
+
14
+ The correction-learning system can now notice when the agent's own outgoing message contradicts a preference it has already learned about how you like to work, and quietly use that as a signal to remember the preference more strongly next time. It only ever observes and records — it never blocks, delays, or changes a message — and it stays off until explicitly turned on.
15
+
16
+ ## Summary of New Capabilities
17
+
18
+ - New `src/monitoring/SelfViolationDetector.ts` — pure, deterministic `detectSelfViolation`; precision-biased (a lone weak keyword never fires), never throws.
19
+ - `PreferencesManager` preference records gain an optional `violationPattern` (regex or keyword grammar); fully backward compatible.
20
+ - Observe-only outbound hook in `checkOutboundMessage` records self-violations to the `CorrectionLedger`; structurally independent of the tone-gate verdict and of the message itself.
21
+ - New `monitoring.correctionLearning.selfViolationSignal` config flag (default false).
22
+
23
+ ## Evidence
24
+
25
+ - `SelfViolationDetector` unit (17), self-violation wiring-integrity (5, asserts the outbound message passes through byte-for-byte unchanged and the detector fail-opens), integration (5), and E2E lifecycle (3) — all passed.
26
+ - `npm run build` / `npm run lint` / `docs-coverage` clean.
@@ -0,0 +1,43 @@
1
+ # Side-effects — Codex autonomous native /goal auto-wire
2
+
3
+ ## 1. What files/state does this touch at runtime?
4
+ `.claude/skills/autonomous/scripts/setup-autonomous.sh` (skill content). At autonomous-mode
5
+ activation on a CODEX agent, it now additionally POSTs `/autonomous/native-goal/set` (which the
6
+ script already did for Claude>=2.1.139) — injecting `/goal <completion_condition>` into the
7
+ session and marking the job `goal_mode:native` in `<topic>.local.md`. No new files, no config
8
+ keys, no schema. The PostUpdateMigrator re-deploys the script to existing agents (marker bump).
9
+
10
+ ## 2. Does it change any functional behavior?
11
+ - **Claude agents:** none. The Claude version gate is untouched; the codex check only runs when
12
+ the Claude gate already failed.
13
+ - **Codex agents:** a codex autonomous job now auto-delegates to native `/goal` (previously it
14
+ fell through to the dark Phase-1 codexLoopDriver no-op and silently never sustained multi-turn).
15
+ The stop-hook's existing `goal_mode:native` branch then defers to native `/goal`.
16
+
17
+ ## 3. What happens on failure / weird config?
18
+ Best-effort: the detection one-liner is `... 2>/dev/null || echo "0"`, so a missing/malformed
19
+ config.json or absent python → `0` → not-codex → exactly the prior behavior (no regression). A
20
+ codex agent whose native `/goal` POST fails → the script prints "Native /goal: unavailable" and
21
+ instar's own completion evaluator drives (the existing fallback).
22
+
23
+ ## 4. Migration parity — do existing agents get it?
24
+ Yes. `migrateAutonomousStopHookTopicKeyed` marker bumped `native-goal/set` → `IS_CODEX_AGENT`,
25
+ so prior native-/goal installs are re-deployed; customized scripts (no stock fingerprint) are
26
+ left untouched; already-updated agents skip (idempotent). New agents get it via installAutonomousSkill.
27
+
28
+ ## 5. Could it spam / flood / burn resources?
29
+ No. It adds at most one extra `python3` config read + (for codex) one `native-goal/set` POST,
30
+ once, at autonomous-mode activation — the same POST the script already made for Claude.
31
+
32
+ ## 6. Rollback / off-switch?
33
+ Revert the PR. The marker would revert too; a reverted-version agent retains `native-goal/set`
34
+ (still functional for Claude). No residual state, no flag.
35
+
36
+ ## 7. Concurrency / ordering?
37
+ None new. Runs inline in the single setup-autonomous.sh activation flow, after the Claude gate.
38
+
39
+ ## Blast radius
40
+ Small + additive, codex-only. One ~5-line fallback in setup-autonomous.sh + one migration marker
41
+ bump in PostUpdateMigrator. No change to the sensitive stop-hook (the goal_mode:native defer
42
+ already existed), no change to the Claude path. Mirrors the #604/#609 codex framework-additive
43
+ pattern. The codexLoopDriver:true config footgun is a separate low-pri follow-up (#40 notes).
@@ -0,0 +1,133 @@
1
+ # Side-Effects Review — Correction & Preference Learning: Self-Violation Signal
2
+
3
+ **Version / slug:** `correction-self-violation-signal`
4
+ **Date:** `2026-05-31`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `not required — observe-only + dark by default; the detector holds no blocking authority and cannot alter/delay/block any outbound message`
7
+
8
+ ## Summary of the change
9
+
10
+ Extends the shipped Correction & Preference Learning Sentinel so a stored-but-violated
11
+ preference becomes a learning signal instead of evaporating. A learned preference can
12
+ carry an OPTIONAL `violationPattern` (regex or keyword set). When the agent sends an
13
+ outbound message that contradicts that pattern, the contradiction is recorded as a
14
+ self-violation in the `CorrectionLedger` (a recurrence-reinforcing `user-preference`
15
+ occurrence keyed on the violated lesson), so the preference's salience grows for the
16
+ next session-start injection.
17
+
18
+ Files: new `src/monitoring/SelfViolationDetector.ts` (pure `detectSelfViolation`);
19
+ `src/core/PreferencesManager.ts` (+optional `violationPattern` on `PreferenceEntry`
20
+ and `RecordPreferencePayload`, persisted/round-tripped, upsert-preserving); the
21
+ outbound seam in `src/server/routes.ts` (a new OBSERVE-ONLY `observeSelfViolation`
22
+ fire-and-forget branch inside `checkOutboundMessage`, structurally independent of the
23
+ tone-gate verdict); config `monitoring.correctionLearning.selfViolationSignal`
24
+ (types.ts + ConfigDefaults.ts); Agent-Awareness (templates.ts) + Migration-Parity
25
+ backfill (PostUpdateMigrator migrateClaudeMd).
26
+
27
+ ## Decision-point inventory
28
+
29
+ - `detectSelfViolation(text, prefs)` (new) — add — pure, deterministic, returns the
30
+ list of violated preferences. No authority; precision-biased (lone weak match never
31
+ fires); never throws.
32
+ - `observeSelfViolation` seam branch (new) — add — records a matched violation to the
33
+ ledger + an audit line. Fire-and-forget VOID; cannot influence delivery.
34
+ - `PreferenceEntry.violationPattern` (new optional field) — add — absent ≡ never
35
+ checked (back-compat).
36
+ - Tone-gate / `checkOutboundMessage` block-decision — UNCHANGED — the observe branch
37
+ runs before the gate-availability early-return and never feeds the gate or the
38
+ return value.
39
+
40
+ ---
41
+
42
+ ## 1. Over-block
43
+
44
+ Not applicable. The feature has NO block/allow surface. The observe branch runs as a
45
+ fire-and-forget `void observeSelfViolation(...).catch(...)` that is structurally
46
+ incapable of returning a block verdict, throwing into the delivery frame, or mutating
47
+ the message. The wiring-integrity + E2E tests assert the message is delivered
48
+ byte-for-byte unchanged whether or not a violation is detected.
49
+
50
+ ## 2. Under-block
51
+
52
+ There is nothing to under-block — the feature never blocks. The "miss" direction
53
+ (a real self-violation going unrecorded) is the deliberately-chosen safe direction:
54
+ precision over recall. A lone/weak keyword never fires, an unparseable pattern is a
55
+ no-check, and a preference without a `violationPattern` is skipped. A false
56
+ self-violation that nags is the bad direction, so the matcher is conservative. A
57
+ missed recording costs only a slightly weaker recurrence signal next session.
58
+
59
+ ## 3. Level-of-abstraction fit
60
+
61
+ Correct. The detector is a pure, exhaustively-tested function (mirrors the
62
+ deterministic `scrubSecrets` / Layer-0 classifier discipline of the same sentinel).
63
+ The recording reuses the shipped `CorrectionLedger.record()` dedupe-upsert and its
64
+ `toApiView()` raw-text-stripping discipline; the occurrence is a `user-preference`
65
+ record at the code-determined `LEARNING_DETERMINISTIC_THRESHOLD` so it feeds the
66
+ existing 3-pronged recurrence gate exactly like any other distilled correction. No
67
+ new persistence layer, no new gate, no new authority.
68
+
69
+ ## 4. Signal vs authority compliance
70
+
71
+ **Required reference:** [docs/signal-vs-authority.md](../../docs/signal-vs-authority.md)
72
+
73
+ - [x] Yes — this change produces a SIGNAL (a ledger occurrence + an audit line) and
74
+ holds ZERO authority over any message. The user's explicit hard rule ("we've been
75
+ bitten by guards that block messages having too much power") is honored structurally:
76
+ the observe call is a separate VOID branch that runs regardless of the
77
+ `MessagingToneGate`'s verdict and never influences it. The single authority for
78
+ outbound delivery remains the `MessagingToneGate` (rules B1–B17), entirely unchanged.
79
+
80
+ ## 5. Interactions
81
+
82
+ - **Shadowing:** none. The observe branch is additive at the top of
83
+ `checkOutboundMessage`; it does not read or alter the signals, the gate result, or
84
+ the 422 path. With the tone gate null, the observe branch still runs (it precedes
85
+ the gate-availability early-return) and the message still passes through.
86
+ - **Double-fire:** the ledger dedupe-upserts on `kind:normalizedLearningHash`, so
87
+ repeated self-violations of the same preference collapse to ONE record with an
88
+ incrementing `occurrenceCount` (asserted by the integration test) — never a pile.
89
+ - **Races:** the observe call is fire-and-forget and lazy-imports its modules; the
90
+ ledger is the shipped WAL SQLite store (single-writer-safe, fail-open on any error).
91
+ Two concurrent sends recording the same preference are both safely upserted.
92
+ - **Feedback loops:** none. The detector reads `.instar/preferences.json` (written by
93
+ `recordPreference`) and writes the ledger; it never writes preferences, so it cannot
94
+ amplify its own pattern. The CorrectionAnalyzer that consumes the ledger is
95
+ off-hot-path (weekly cron) and only ROUTES via the existing by-construction
96
+ authority-bounded driver.
97
+
98
+ ## 6. External surfaces
99
+
100
+ - **Other agents / install base:** pure additive source + a default-OFF config
101
+ sub-flag (auto-applied via ConfigDefaults; code reads `cl?.selfViolationSignal !==
102
+ true` so an agent whose config lacks the field behaves identically — OFF). The
103
+ optional `violationPattern` is fully back-compatible: shipped `.instar/preferences.json`
104
+ files have no such field and are simply never self-violation-checked (unit-tested
105
+ with a legacy-shaped file). Agent-Awareness + Migration-Parity are handled
106
+ (templates.ts bullet for new agents; idempotent content-sniffed migrateClaudeMd
107
+ backfill for existing agents).
108
+ - **External systems:** none. The detector is local + deterministic; no LLM call, no
109
+ network. (Distinct from the capture/distill loop, which is a separate, already-shipped
110
+ surface.)
111
+ - **Persistent state:** existing `correction-ledger.db` only (one extra occurrence
112
+ row per matched violation, bounded by the shipped per-key occurrence cap). Plus a
113
+ best-effort `[self-violation]` stderr audit line. No new files.
114
+ - **Timing:** none. No timers; the observe call is one bounded synchronous detect plus
115
+ one ledger write, off the delivery path.
116
+
117
+ ## 7. Rollback cost
118
+
119
+ Pure additive code + a default-off config sub-flag. Revert the commits → the detector,
120
+ the seam branch, the schema field, the config flag, and the awareness text disappear;
121
+ nothing else changes. Any ledger occurrences already recorded are inert and indexed
122
+ exactly like every other correction record (no schema change to the ledger). No
123
+ migration, no state repair, no user-visible behavior change (it never acted on a
124
+ message).
125
+
126
+ ## Conclusion
127
+
128
+ This review confirmed the change is observe-only: a tested, precision-biased,
129
+ never-throwing decision function plus a fire-and-forget recording branch that is
130
+ structurally incapable of blocking, delaying, or altering any outbound message. It
131
+ ships dark behind both `correctionLearning.enabled` and the new `selfViolationSignal`
132
+ sub-flag, is fully back-compatible with existing preference files, and reuses the
133
+ shipped ledger's privacy + dedupe discipline. Clear to ship.