instar 1.2.11 → 1.2.13
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/setup-wizard/codex-driver.d.ts +35 -0
- package/dist/commands/setup-wizard/codex-driver.d.ts.map +1 -0
- package/dist/commands/setup-wizard/codex-driver.js +355 -0
- package/dist/commands/setup-wizard/codex-driver.js.map +1 -0
- package/dist/commands/setup-wizard/model-constants.d.ts +13 -0
- package/dist/commands/setup-wizard/model-constants.d.ts.map +1 -0
- package/dist/commands/setup-wizard/model-constants.js +13 -0
- package/dist/commands/setup-wizard/model-constants.js.map +1 -0
- package/dist/commands/setup-wizard/state-machine.d.ts +104 -0
- package/dist/commands/setup-wizard/state-machine.d.ts.map +1 -0
- package/dist/commands/setup-wizard/state-machine.js +247 -0
- package/dist/commands/setup-wizard/state-machine.js.map +1 -0
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +28 -26
- package/dist/commands/setup.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +28 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +17 -17
- package/upgrades/1.2.12.md +82 -0
- package/upgrades/1.2.13.md +42 -0
- package/upgrades/side-effects/feat-hybrid-wizard.md +122 -0
- package/upgrades/side-effects/inject-current-time-into-hooks.md +63 -0
|
@@ -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-21T21:36:06.272Z",
|
|
5
|
+
"instarVersion": "1.2.13",
|
|
6
6
|
"entryCount": 191,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"domain": "identity",
|
|
12
12
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
13
13
|
"installedPath": ".instar/hooks/instar/session-start.sh",
|
|
14
|
-
"contentHash": "
|
|
14
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
15
15
|
"since": "2025-01-01"
|
|
16
16
|
},
|
|
17
17
|
"hook:dangerous-command-guard": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"domain": "safety",
|
|
21
21
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
22
22
|
"installedPath": ".instar/hooks/instar/dangerous-command-guard.sh",
|
|
23
|
-
"contentHash": "
|
|
23
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
24
24
|
"since": "2025-01-01"
|
|
25
25
|
},
|
|
26
26
|
"hook:grounding-before-messaging": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"domain": "safety",
|
|
30
30
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
31
31
|
"installedPath": ".instar/hooks/instar/grounding-before-messaging.sh",
|
|
32
|
-
"contentHash": "
|
|
32
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
33
33
|
"since": "2025-01-01"
|
|
34
34
|
},
|
|
35
35
|
"hook:compaction-recovery": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"domain": "identity",
|
|
39
39
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
40
40
|
"installedPath": ".instar/hooks/instar/compaction-recovery.sh",
|
|
41
|
-
"contentHash": "
|
|
41
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
42
42
|
"since": "2025-01-01"
|
|
43
43
|
},
|
|
44
44
|
"hook:external-operation-gate": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"domain": "safety",
|
|
48
48
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
49
49
|
"installedPath": ".instar/hooks/instar/external-operation-gate.js",
|
|
50
|
-
"contentHash": "
|
|
50
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
51
51
|
"since": "2025-01-01"
|
|
52
52
|
},
|
|
53
53
|
"hook:deferral-detector": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"domain": "safety",
|
|
57
57
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
58
58
|
"installedPath": ".instar/hooks/instar/deferral-detector.js",
|
|
59
|
-
"contentHash": "
|
|
59
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
60
60
|
"since": "2025-01-01"
|
|
61
61
|
},
|
|
62
62
|
"hook:post-action-reflection": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"domain": "evolution",
|
|
66
66
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
67
67
|
"installedPath": ".instar/hooks/instar/post-action-reflection.js",
|
|
68
|
-
"contentHash": "
|
|
68
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
69
69
|
"since": "2025-01-01"
|
|
70
70
|
},
|
|
71
71
|
"hook:external-communication-guard": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"domain": "safety",
|
|
75
75
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
76
76
|
"installedPath": ".instar/hooks/instar/external-communication-guard.js",
|
|
77
|
-
"contentHash": "
|
|
77
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
78
78
|
"since": "2025-01-01"
|
|
79
79
|
},
|
|
80
80
|
"hook:scope-coherence-collector": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"domain": "coherence",
|
|
84
84
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
85
85
|
"installedPath": ".instar/hooks/instar/scope-coherence-collector.js",
|
|
86
|
-
"contentHash": "
|
|
86
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
87
87
|
"since": "2025-01-01"
|
|
88
88
|
},
|
|
89
89
|
"hook:scope-coherence-checkpoint": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"domain": "coherence",
|
|
93
93
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
94
94
|
"installedPath": ".instar/hooks/instar/scope-coherence-checkpoint.js",
|
|
95
|
-
"contentHash": "
|
|
95
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
96
96
|
"since": "2025-01-01"
|
|
97
97
|
},
|
|
98
98
|
"hook:free-text-guard": {
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"domain": "safety",
|
|
102
102
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
103
103
|
"installedPath": ".instar/hooks/instar/free-text-guard.sh",
|
|
104
|
-
"contentHash": "
|
|
104
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
105
105
|
"since": "2025-01-01"
|
|
106
106
|
},
|
|
107
107
|
"hook:claim-intercept": {
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"domain": "coherence",
|
|
111
111
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
112
112
|
"installedPath": ".instar/hooks/instar/claim-intercept.js",
|
|
113
|
-
"contentHash": "
|
|
113
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
114
114
|
"since": "2025-01-01"
|
|
115
115
|
},
|
|
116
116
|
"hook:claim-intercept-response": {
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"domain": "coherence",
|
|
120
120
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
121
121
|
"installedPath": ".instar/hooks/instar/claim-intercept-response.js",
|
|
122
|
-
"contentHash": "
|
|
122
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
123
123
|
"since": "2025-01-01"
|
|
124
124
|
},
|
|
125
125
|
"hook:auto-approve-permissions": {
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"domain": "safety",
|
|
129
129
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
130
130
|
"installedPath": ".instar/hooks/instar/auto-approve-permissions.js",
|
|
131
|
-
"contentHash": "
|
|
131
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
132
132
|
"since": "2025-01-01"
|
|
133
133
|
},
|
|
134
134
|
"job:health-check": {
|
|
@@ -1472,7 +1472,7 @@
|
|
|
1472
1472
|
"type": "subsystem",
|
|
1473
1473
|
"domain": "updates",
|
|
1474
1474
|
"sourcePath": "src/core/PostUpdateMigrator.ts",
|
|
1475
|
-
"contentHash": "
|
|
1475
|
+
"contentHash": "c05e308a956d13c08a2aecdbec64591b4a94ef3c083e4b4ce95202b03ebce284",
|
|
1476
1476
|
"since": "2025-01-01"
|
|
1477
1477
|
},
|
|
1478
1478
|
"subsystem:scheduler": {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Upgrade Guide — v1.2.12 (hybrid wizard for Codex runtime)
|
|
2
|
+
|
|
3
|
+
<!-- bump: patch -->
|
|
4
|
+
<!-- patch = bug fixes, refactors, test additions, doc updates -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
**New: hybrid setup wizard for Codex-runtime installs.**
|
|
9
|
+
|
|
10
|
+
`npx instar` → pick Codex CLI at the runtime prompt → now reaches
|
|
11
|
+
an actual conversational walkthrough. Before this release, Codex
|
|
12
|
+
ignored the wizard skill's behavioral contract and executed the
|
|
13
|
+
entire setup non-interactively, leaving the user with a generic
|
|
14
|
+
agent identity they never got to shape.
|
|
15
|
+
|
|
16
|
+
The fix is a two-layer architecture under
|
|
17
|
+
`src/commands/setup-wizard/`:
|
|
18
|
+
|
|
19
|
+
1. **State machine** owns the conversation flow. Each state has a
|
|
20
|
+
structural prompt printed verbatim by instar, a deterministic
|
|
21
|
+
transition function, and (for action states) a side effect call
|
|
22
|
+
to existing CLI commands. Order is fixed in TypeScript code; no
|
|
23
|
+
LLM can drift it.
|
|
24
|
+
|
|
25
|
+
2. **Codex driver** drives the state machine turn-by-turn. For each
|
|
26
|
+
conversational state, the driver runs `codex exec -s read-only
|
|
27
|
+
-m gpt-5.3-codex --ephemeral` with a tightly-constrained prompt
|
|
28
|
+
asking Codex to generate ONE warm 2-3 sentence intro paragraph.
|
|
29
|
+
The structural prompt is printed by instar; readline reads the
|
|
30
|
+
answer. Codex cannot use tools, cannot reword the question,
|
|
31
|
+
cannot decide to execute the setup itself.
|
|
32
|
+
|
|
33
|
+
3. **Telegram setup phase** hands off to Codex as a full agentic
|
|
34
|
+
session (sandbox bypass + Playwright access) — driving the
|
|
35
|
+
browser is execution, which is Codex's strength.
|
|
36
|
+
|
|
37
|
+
Claude-runtime users see no change. The Claude path keeps the
|
|
38
|
+
existing `/setup-wizard` slash-command spawn.
|
|
39
|
+
|
|
40
|
+
Settings the user picks during the wizard (agent name, focus,
|
|
41
|
+
autonomy level, messaging channel) can all be changed later just
|
|
42
|
+
by chatting the agent. The farewell text and the autonomy step's
|
|
43
|
+
narrative both surface this affordance.
|
|
44
|
+
|
|
45
|
+
Spec: `specs/dev-infrastructure/hybrid-wizard.md`.
|
|
46
|
+
ELI16: `specs/dev-infrastructure/hybrid-wizard.eli16.md`.
|
|
47
|
+
Side-effects review: `upgrades/side-effects/feat-hybrid-wizard.md`.
|
|
48
|
+
|
|
49
|
+
## What to Tell Your User
|
|
50
|
+
|
|
51
|
+
The setup wizard now walks you through identity, autonomy, and
|
|
52
|
+
messaging conversationally, regardless of which runtime you picked.
|
|
53
|
+
On Codex, the wizard runs as a state machine in instar itself with
|
|
54
|
+
Codex generating the warm narrative for each step; on Claude it
|
|
55
|
+
runs the same way it always has. Anything you set up can be
|
|
56
|
+
changed later just by chatting your agent — no need to re-run setup.
|
|
57
|
+
|
|
58
|
+
## Summary of New Capabilities
|
|
59
|
+
|
|
60
|
+
- New module: `src/commands/setup-wizard/` (state machine + Codex
|
|
61
|
+
driver + model constants).
|
|
62
|
+
- New CLI behavior: `npx instar` → pick Codex CLI → conversational
|
|
63
|
+
wizard with per-step narrative from Codex.
|
|
64
|
+
- Existing CLI surface unchanged.
|
|
65
|
+
|
|
66
|
+
## Evidence
|
|
67
|
+
|
|
68
|
+
Reproduction prior to fix: ran v1.2.11 install via bareword `npx
|
|
69
|
+
instar` → picked Codex. Codex received the wizard skill prompt and
|
|
70
|
+
executed the entire setup non-interactively. Full log captured at
|
|
71
|
+
`setup-logs.md` in the test project — 2940 lines, zero
|
|
72
|
+
conversational walkthrough.
|
|
73
|
+
|
|
74
|
+
After fix:
|
|
75
|
+
- 12 new state-machine unit tests cover the choice resolver, graph
|
|
76
|
+
integrity, identity-answer threading, messaging branching, and
|
|
77
|
+
the post-server completion chain.
|
|
78
|
+
- 5 updated canary tests cover the dispatch contract: setup.ts
|
|
79
|
+
imports `runCodexWizard` for codex-cli, no codex exec argv with
|
|
80
|
+
the wizard skill prompt remains in setup.ts, the driver's codex
|
|
81
|
+
exec spawns still pin `-m WIZARD_CODEX_MODEL`.
|
|
82
|
+
- End-to-end re-test on the Codex install path pending on publish.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT (current-time injection in agent hooks)
|
|
2
|
+
|
|
3
|
+
<!-- bump: patch -->
|
|
4
|
+
<!-- patch = behavior fix that closes a recurring failure mode, no new surface -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
**Fix: every instar agent now sees the current wall-clock time at session start AND on every user prompt.**
|
|
9
|
+
|
|
10
|
+
Claude Code's harness injects `currentDate: YYYY-MM-DD` into the agent's system prompt — but NOT the current time of day. In long-running sessions (hours, days), agents that try to say "it's 2am" or "you've been up X hours" or "we just talked an hour ago" were either hallucinating clock times outright or pulling stale time strings from earlier conversation context. Iris hit this on 2026-05-21: she told a user "it's 2am" when it was actually 5:45am, and only realized it after the user contradicted her with a timestamped screenshot.
|
|
11
|
+
|
|
12
|
+
The fix is structural, not behavioral. Two existing hooks every instar agent already runs now emit a `--- CURRENT TIME ---` block backed by a live `date(1)` call:
|
|
13
|
+
|
|
14
|
+
- **`session-start.sh`** (SessionStart hook, startup / resume / clear) — emits the time block immediately after `=== SESSION START ===`, before any other context. Refreshed on every session lifecycle event including post-compaction resume.
|
|
15
|
+
- **`telegram-topic-context.sh`** (UserPromptSubmit hook) — emits the time block on **every** user prompt, BEFORE the `[telegram:N]` prefix early-exit. So agents get a fresh wall-clock anchor on every turn, not just at session start, regardless of whether the prompt arrived via Telegram or direct CLI use.
|
|
16
|
+
|
|
17
|
+
Format: `2026-05-21 14:15:29 -0500 (CDT)` — ISO date + 24h time + signed offset + tz abbreviation. Same line every time. Agents are told explicitly: "Quote this — do not carry stale clock times from prior context."
|
|
18
|
+
|
|
19
|
+
The hook content lives inline in `src/core/PostUpdateMigrator.ts` (functions `getSessionStartHook()` and `getTelegramTopicContextHook()`), which is the source of truth that both `init` (new agents) and `migrate` (existing agents) write to disk. Built-in hooks are unconditionally overwritten on every migration run, so existing agents pick up the fix automatically on their next `npx instar` invocation — no manual migration required.
|
|
20
|
+
|
|
21
|
+
## What to Tell Your User
|
|
22
|
+
|
|
23
|
+
If your agent has ever made a clock-time claim that turned out to be wrong (saying it's the middle of the night when it isn't, miscalculating "how long ago" something happened, mismatching AM/PM), that failure mode is closed after this release. Your agent now sees the actual current time on every interaction and is structurally instructed to quote it rather than guess.
|
|
24
|
+
|
|
25
|
+
No action needed from you. The next time your agent updates, the fix lands.
|
|
26
|
+
|
|
27
|
+
## Summary of New Capabilities
|
|
28
|
+
|
|
29
|
+
| Capability | How to Use |
|
|
30
|
+
|-----------|-----------|
|
|
31
|
+
| Wall-clock time injected at session start | Automatic — `--- CURRENT TIME ---` block at the top of session-start output |
|
|
32
|
+
| Wall-clock time refreshed on every user prompt | Automatic — same block emitted ahead of telegram-topic-context every UserPromptSubmit |
|
|
33
|
+
|
|
34
|
+
## Evidence
|
|
35
|
+
|
|
36
|
+
- New test: `tests/unit/PostUpdateMigrator-time-injection.test.ts` — 13 cases. Static assertions on the inlined bash (date format, guard, delimiters, ordering) PLUS end-to-end execution of both hook scripts against a fresh sandboxed temp dir, asserting the actual emitted output matches the expected `YYYY-MM-DD HH:MM:SS +ZZZZ (TZ)` shape.
|
|
37
|
+
- Existing tests still pass: `tests/unit/PostUpdateMigrator-sharedState.test.ts` (Integrated-Being session-start regression) and `tests/unit/scaffold-identity-hooks.test.ts` (scaffold integrity) verified green against the patched migrator.
|
|
38
|
+
- Side-effects review: `upgrades/side-effects/inject-current-time-into-hooks.md`.
|
|
39
|
+
|
|
40
|
+
## Original Incident
|
|
41
|
+
|
|
42
|
+
Iris session, Business Plan topic, 2026-05-21 ~5:45am CDT. Agent said "It's 2am. The laptop can wait. Goodnight." User's actual local time was 5:45am Central. Memory note `feedback_clock_time_must_call_date.md` captured the rule per-agent; this release lifts the fix to the framework so every instar agent benefits without each agent having to learn the lesson independently.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Side-effects review — Hybrid wizard
|
|
2
|
+
|
|
3
|
+
Per L6. Seven dimensions.
|
|
4
|
+
|
|
5
|
+
## 1. Over-block / under-block
|
|
6
|
+
|
|
7
|
+
Before: UNDER for Codex-runtime users. The bareword runtime prompt
|
|
8
|
+
let users pick Codex, which then spawned Codex with the wizard skill.
|
|
9
|
+
Codex ignored the skill's conversational contract and executed setup
|
|
10
|
+
non-interactively. Generic agent identity, no walkthrough.
|
|
11
|
+
|
|
12
|
+
After: precisely targeted. instar's state machine owns the
|
|
13
|
+
conversation flow; Codex is restricted per-turn to narrative-only
|
|
14
|
+
generation. Claude users see zero change (they keep the existing
|
|
15
|
+
SKILL.md-driven spawn). API-key Codex users keep the same auth
|
|
16
|
+
posture they had before. The agentic Telegram phase still uses
|
|
17
|
+
Codex with full sandbox bypass — that's the right tool for browser
|
|
18
|
+
automation.
|
|
19
|
+
|
|
20
|
+
## 2. Level-of-abstraction fit
|
|
21
|
+
|
|
22
|
+
A new directory `src/commands/setup-wizard/` holds three files:
|
|
23
|
+
- `state-machine.ts` — pure data + transition functions, no I/O.
|
|
24
|
+
- `codex-driver.ts` — I/O (codex spawn, readline, CLI subcommands).
|
|
25
|
+
- `model-constants.ts` — single constant import target.
|
|
26
|
+
|
|
27
|
+
setup.ts adds one dispatch branch (~12 LOC). It dynamically imports
|
|
28
|
+
the codex driver only when the user picks Codex, keeping the
|
|
29
|
+
setup.ts module load lightweight.
|
|
30
|
+
|
|
31
|
+
The state machine is intentionally a flat record of states; no
|
|
32
|
+
class hierarchy, no event emitters. Drivers consume it via simple
|
|
33
|
+
lookups. Adding a state is one edit.
|
|
34
|
+
|
|
35
|
+
## 3. Signal vs Authority compliance
|
|
36
|
+
|
|
37
|
+
- The user's runtime choice from the bareword prompt remains an
|
|
38
|
+
operator-intent SIGNAL flowing into `enabledFrameworks` and the
|
|
39
|
+
wizard dispatch.
|
|
40
|
+
- The state graph's transition functions are deterministic AUTHORITIES
|
|
41
|
+
for "what state comes next" given a user answer. Codex never sees
|
|
42
|
+
the transition function and cannot influence routing.
|
|
43
|
+
- `WIZARD_CODEX_MODEL` is the AUTHORITY for which Codex model the
|
|
44
|
+
narrative spawns use, drawn from the existing empirically-probed
|
|
45
|
+
availability table at `src/providers/adapters/openai-codex/models.ts`.
|
|
46
|
+
- The agentic Telegram phase respects the existing AUTHORITY for
|
|
47
|
+
Telegram bot creation (BotFather / OpenAI Codex's tool access /
|
|
48
|
+
Playwright MCP).
|
|
49
|
+
|
|
50
|
+
## 4. Interactions with adjacent systems
|
|
51
|
+
|
|
52
|
+
- **v1.2.1 runtime prompt** (`promptForFramework`): unchanged. Still
|
|
53
|
+
reads `1`/`2`/`codex` and returns the chosen runtime.
|
|
54
|
+
- **`checkFrameworkPrerequisite`**: unchanged. Still validates the
|
|
55
|
+
chosen runtime's binary is detected.
|
|
56
|
+
- **`ensureSecretBackend`** (Phase 2.5): unchanged in v1.2.12. Still
|
|
57
|
+
spawns the chosen framework with `/secret-setup` for the secret
|
|
58
|
+
backend choice. A future PR can route secret-setup through the
|
|
59
|
+
state machine too, but for v1.2.12 we keep that scope bounded.
|
|
60
|
+
- **Existing wizard SKILL.md**: unchanged. Still owned by the Claude
|
|
61
|
+
path; the Codex path uses it ONLY as a reference target for the
|
|
62
|
+
Telegram-agentic phase prompt.
|
|
63
|
+
- **CLI subcommands the wizard calls** (`init`, `user add`, `server
|
|
64
|
+
start`, `autostart install`): unchanged. The driver calls them via
|
|
65
|
+
`execFileSync('npx', ['instar', ...])` the same way the existing
|
|
66
|
+
SKILL.md tells Claude to call them.
|
|
67
|
+
- **PR #299's canary**: updated. Previously asserted every `codex exec`
|
|
68
|
+
in setup.ts carries `-m WIZARD_CODEX_MODEL`. v1.2.12 asserts setup.ts
|
|
69
|
+
no longer has codex exec spawns (they moved into codex-driver.ts),
|
|
70
|
+
setup.ts dispatches via `runCodexWizard`, and the driver's codex
|
|
71
|
+
exec spawns still carry `-m WIZARD_CODEX_MODEL`.
|
|
72
|
+
|
|
73
|
+
## 5. Rollback cost
|
|
74
|
+
|
|
75
|
+
Low. Three new files in a new directory plus one ~12-LOC dispatch
|
|
76
|
+
branch in setup.ts. The old `codex exec` argv shape in setup.ts is
|
|
77
|
+
removed; reverting reintroduces it. Claude path untouched.
|
|
78
|
+
|
|
79
|
+
`git revert` restores the v1.2.11 broken-on-Codex behavior. No state
|
|
80
|
+
migration; no agent-installed-files changes; no `PostUpdateMigrator`
|
|
81
|
+
work needed.
|
|
82
|
+
|
|
83
|
+
## 6. Backwards compatibility / drift surface
|
|
84
|
+
|
|
85
|
+
Fully backwards-compatible.
|
|
86
|
+
|
|
87
|
+
- Claude-runtime users: zero change.
|
|
88
|
+
- Codex-runtime users: now get a working conversational wizard
|
|
89
|
+
driven by instar with Codex-generated narrative. Previously got
|
|
90
|
+
broken non-interactive setup.
|
|
91
|
+
- API-key Codex users: auth posture unchanged. `CODEX_MODEL` env
|
|
92
|
+
still overrides the wizard's `-m` flag if they prefer a different
|
|
93
|
+
model.
|
|
94
|
+
- No config schema change. No agent file template change. No hook
|
|
95
|
+
change.
|
|
96
|
+
|
|
97
|
+
Drift surface: the state graph and per-turn narrative prompts. Both
|
|
98
|
+
are flat data structures, so drift is visible in PR diffs. The
|
|
99
|
+
canary covers the dispatch shape; manual review covers narrative
|
|
100
|
+
prompt quality.
|
|
101
|
+
|
|
102
|
+
## 7. Authorization / Trust posture
|
|
103
|
+
|
|
104
|
+
No new authority. The per-turn narrative codex spawns use `-s
|
|
105
|
+
read-only` (a strictly lower-privilege sandbox than the
|
|
106
|
+
`--dangerously-bypass-approvals-and-sandbox` the existing wizard
|
|
107
|
+
spawn uses). The Telegram-agentic phase keeps the existing sandbox-
|
|
108
|
+
bypass posture so it can drive Playwright. The action states call
|
|
109
|
+
`execFileSync('npx', ...)` for `init`, `user add`, `server start`,
|
|
110
|
+
`autostart install` — the same CLI surface the existing wizard
|
|
111
|
+
calls.
|
|
112
|
+
|
|
113
|
+
No new auth, no new gate, no new privilege.
|
|
114
|
+
|
|
115
|
+
## Outcome
|
|
116
|
+
|
|
117
|
+
Ship. Closes the broken-on-Codex install experience that the v1.2.11
|
|
118
|
+
instar-codey log surfaced. Per-framework specialization preserves
|
|
119
|
+
each runtime's strengths (Claude's reliable skill-following, Codex's
|
|
120
|
+
strong execution mode for agentic phases). Structure-as-guarantee
|
|
121
|
+
prevents the regression class. Canary in CI guards the dispatch
|
|
122
|
+
contract.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Side-Effects Review — inject current time into agent hooks
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `inject-current-time-into-hooks`
|
|
4
|
+
**Date:** `2026-05-21`
|
|
5
|
+
**Author:** `echo`
|
|
6
|
+
**Second-pass reviewer:** `not required` (Layer 1 hook-template content change, signal-only, no gate authority — Phase 5 trigger inventory below)
|
|
7
|
+
|
|
8
|
+
## Summary of the change
|
|
9
|
+
|
|
10
|
+
`PostUpdateMigrator.getSessionStartHook()` and `getTelegramTopicContextHook()` (the inlined bash templates that get unconditionally overwritten onto every agent's disk on update) now each emit a `--- CURRENT TIME ---` block backed by a fresh `date(1)` invocation. The block contains an ISO-formatted wall-clock timestamp with signed offset and timezone abbreviation, plus a one-line instruction to the agent: "Quote this — do not carry stale clock times from prior context."
|
|
11
|
+
|
|
12
|
+
**Files touched:**
|
|
13
|
+
- `src/core/PostUpdateMigrator.ts` — 14 lines added to `getSessionStartHook()` (after the `=== SESSION START ===` echo, before the TOPIC CONTEXT block); 14 lines added to `getTelegramTopicContextHook()` (immediately before the [telegram:N] early-exit, so the block fires on every UserPromptSubmit regardless of prefix).
|
|
14
|
+
- `tests/unit/PostUpdateMigrator-time-injection.test.ts` — new file, 13 test cases. Static assertions on the inlined bash (date format string, non-empty guard, delimiter strings, relative ordering within each hook) PLUS end-to-end `execFileSync` of each hook script against a fresh temp dir, asserting the actual emitted output matches the expected `YYYY-MM-DD HH:MM:SS +ZZZZ (TZ)` shape on a non-telegram prompt, a telegram-prefixed prompt, and a session-start invocation.
|
|
15
|
+
- `upgrades/NEXT.md` — new vNEXT entry, classified `patch` (behavior fix, no new surface).
|
|
16
|
+
|
|
17
|
+
## Decision-point inventory
|
|
18
|
+
|
|
19
|
+
- **Where the time block lands in session-start output** — *modify*. Placed AFTER `=== SESSION START ===` and BEFORE the TOPIC CONTEXT block. Rationale: the wall-clock is generic orientation, not topic-specific — it belongs at the top of the orientation frame, ahead of the per-conversation context. Asserted by test `places the time block BEFORE the TOPIC CONTEXT block`.
|
|
20
|
+
- **Where the time block lands in UserPromptSubmit** — *modify*. Placed BEFORE the `[telegram:N]` early-exit. Rationale: the script's filename suggests telegram-only, but UserPromptSubmit fires on every prompt — emitting the time block before the early-exit makes the fix universal (Telegram and direct-CLI sessions both get it). Asserted by test `emits the time block BEFORE the [telegram:N] early-exit`.
|
|
21
|
+
- **Output guard against a broken `date(1)`** — *new*. Wrap the emission in `if [ -n "$NOW" ]; then ... fi` so a hypothetical environment where `date(1)` returns empty (extremely unlikely on macOS/Linux) doesn't produce a `--- CURRENT TIME ---` header with no value. Asserted by test `wraps the emission in a non-empty guard`.
|
|
22
|
+
- **Date format choice** — *new*. `'%Y-%m-%d %H:%M:%S %z (%Z)'`. Portable across BSD date (macOS) and GNU date (Linux); produces both machine-parseable (`%z`) and human-readable (`%Z`) timezone forms. Verified by the end-to-end test which `execFileSync`s the hook and regex-matches the emitted body.
|
|
23
|
+
- **Delimiter style** — *match existing*. `--- CURRENT TIME ---` / `--- END CURRENT TIME ---` mirrors the dashed delimiters already used in session-start for other blocks (`--- CONVERSATION CONTEXT ---`, `--- INTEGRATED-BEING ---`, `--- PROJECT CONTEXT ---`). No new visual convention introduced.
|
|
24
|
+
|
|
25
|
+
## Level-of-abstraction fit
|
|
26
|
+
|
|
27
|
+
This is a Layer 1 (hook content) change. It belongs at the migrator level — both because the migrator is the source of truth for hook content (init and update both write from `getSessionStartHook()` / `getTelegramTopicContextHook()`) and because the failure mode (stale clock in long agent sessions) is a cross-cutting infrastructure gap, not a per-agent or per-feature concern. Solving it per-agent (e.g. Iris's memory file `feedback_clock_time_must_call_date.md`) closed the gap for one agent. Lifting it to the framework means every instar agent gets the same anchor without each one having to learn the lesson independently — which matches the **Structure > Willpower** principle stated in CLAUDE.md.
|
|
28
|
+
|
|
29
|
+
## Signal-vs-authority compliance
|
|
30
|
+
|
|
31
|
+
The hook injection emits text. It does not gate, block, modify, or veto any agent action. It is pure signal — the agent reads the wall-clock and is told to quote it. Authority over whether to use the time, what time to claim, or whether to call `date` again later remains entirely with the agent. No new blocking authority introduced.
|
|
32
|
+
|
|
33
|
+
## Interactions
|
|
34
|
+
|
|
35
|
+
- **Compaction recovery** (`compaction-recovery.sh`): On `compact` event, `session-start.sh` `exec`s away to `compaction-recovery.sh` BEFORE the time block is reached. So the time block does not run during compact-recovery. Compaction-recovery's own injection pipeline is separate and is not regressed by this change. The block DOES run on resume, which fires after compaction completes. No double-emission.
|
|
36
|
+
- **Telegram early-exit**: Adding output BEFORE the `[telegram:N]` early-exit means the hook now produces output on every UserPromptSubmit, including non-telegram prompts. This is intentional — direct-CLI sessions need the time anchor too. Effect on Claude Code: an additional ~3-line block in the agent's prompt buffer per turn. Token cost negligible (~30 tokens).
|
|
37
|
+
- **Integrated-Being v2 session-bind**: The session-bind block in `session-start.sh` lives AFTER the time block but runs independently. Time injection produces output via stdout; session-bind makes HTTP calls and writes a token file. No shared variables, no ordering dependency.
|
|
38
|
+
- **Existing PostUpdateMigrator-sharedState test**: Asserts the integrated-being injection survives in `getSessionStartHook()`. The new time block sits BEFORE the integrated-being block; the existing assertion (`expect(hook).toContain('/shared-state/render?limit=50')`) continues to pass — verified in test run.
|
|
39
|
+
|
|
40
|
+
## Over/under-block check
|
|
41
|
+
|
|
42
|
+
- **Under-block**: Could the fix miss any cases where an agent says a clock time?
|
|
43
|
+
- **Mid-session tool-result handoffs**: If an agent receives a Claude Code tool result and immediately replies with a time claim, the most recent time anchor is the previous UserPromptSubmit. Up to 5 minutes stale in fast back-and-forths, less for slow ones. Acceptable — within a single turn, ±a-few-minutes is fine. Worst-case would be a multi-hour autonomous-mode tool loop without user prompts, in which case the agent could go stale. Mitigated separately by autonomous-mode's existing periodic re-orientation; not in scope here.
|
|
44
|
+
- **Subagent invocations**: Sub-agents started via the `Agent` tool inherit the parent's prompt context, not the live hook output. So a subagent's time anchor is the parent's at-spawn time. Acceptable — subagents are short-lived and rarely make wall-clock claims; their job is task execution.
|
|
45
|
+
- **Over-block**: Could the fix cause an unintended block, refusal, or behavior change elsewhere?
|
|
46
|
+
- **Hook timeout (5s budget for UserPromptSubmit)**: Adding a `date` call adds <1ms. No timeout risk.
|
|
47
|
+
- **Token bloat in long sessions**: ~30 tokens per turn × thousands of turns = a few hundred-K tokens over a long session. Compared to the existing telegram-topic-context block (~500 tokens / turn for recent history), this is a rounding error.
|
|
48
|
+
- **Test pollution**: The end-to-end test uses `mkdtempSync` + per-test env var override, no persistent state. No effect on parallel test runs.
|
|
49
|
+
|
|
50
|
+
## Rollback cost
|
|
51
|
+
|
|
52
|
+
Two-line `git revert` of the migrator edit, plus deleting the new test file. Hooks are unconditionally overwritten on next migration run, so a revert propagates to all deployed agents on their next `npx instar`. No data migration, no persistent state, no fan-out — zero rollback friction.
|
|
53
|
+
|
|
54
|
+
## Phase 5 trigger check
|
|
55
|
+
|
|
56
|
+
Was a second-pass reviewer required? No.
|
|
57
|
+
|
|
58
|
+
- **Not a gate change**: No new authority, no blocking, no veto, no permission alteration. Signal-only.
|
|
59
|
+
- **Not a security-sensitive surface**: No new file reads outside the hook's existing scope (it only adds a `date` call); no new network calls; no new credential or token handling.
|
|
60
|
+
- **No new persistent state**: Output flows to stdout, consumed by Claude Code's prompt injector. No disk writes, no SQLite, no JSONL.
|
|
61
|
+
- **No cross-agent or cross-machine effect**: Per-agent hook content. No threadline message, no shared state, no remote operation.
|
|
62
|
+
|
|
63
|
+
The change crosses **none** of the second-pass triggers from the side-effects review standard. A single-pass review by the author with this written record is sufficient.
|