instar 1.3.204 → 1.3.205

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.
@@ -77,7 +77,7 @@ export function buildInstarCodexHookGroups(projectDir) {
77
77
  // tool_input.cmd (Claude uses tool_input.command); the scripts accept both field
78
78
  // names AND both tool names (Bash | exec_command).
79
79
  PreToolUse: [
80
- { matcher: '.*', hooks: [sh('dangerous-command-guard.sh'), node('external-operation-gate.js'), sh('grounding-before-messaging.sh'), node('deferral-detector.js')] },
80
+ { matcher: '.*', hooks: [sh('dangerous-command-guard.sh'), node('external-operation-gate.js'), sh('grounding-before-messaging.sh'), node('deferral-detector.js'), node('self-stop-guard.js')] },
81
81
  ],
82
82
  // Codex-only checkpoint. Routes to the same gate; the trust system
83
83
  // auto-decides (allow/deny) with NO human prompt so autonomy is preserved.
@@ -1 +1 @@
1
- {"version":3,"file":"installCodexHooks.js","sourceRoot":"","sources":["../../src/core/installCodexHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,oFAAoF;AACpF,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAC/D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,yDAAyD,CAAC;AAgBtG,2FAA2F;AAC3F,MAAM,UAAU,0BAA0B,CACxC,UAAkB;IAElB,MAAM,IAAI,GAAG,CAAC,MAAc,EAAoB,EAAE,CAAC,CAAC;QAClD,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,uBAAuB,EAAE,MAAM,CAAC,EAAE;QACzE,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IACH,MAAM,EAAE,GAAG,CAAC,MAAc,EAAoB,EAAE,CAAC,CAAC;QAChD,IA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AM,CAAA;KAAE,CAAC,CAAC;CAC1F;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,CAmB5F"}
1
+ {"version":3,"file":"instarSettingsHooks.d.ts","sourceRoot":"","sources":["../../src/core/instarSettingsHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,aAAa,CAAC,uBAAuB,CA+B/E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAAa,CAAC,uBAAuB,CAO9E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,EAAE,aAAa,CAAC,MAAM,CACW,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGjE;AAED,uEAAuE;AACvE,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1F;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,CAmB5F"}
@@ -50,6 +50,11 @@ export const INSTAR_BASH_PRETOOLUSE_HOOKS = [
50
50
  command: `node ${PD}/.instar/hooks/instar/deferral-detector.js`,
51
51
  timeout: 5000,
52
52
  },
53
+ {
54
+ type: 'command',
55
+ command: `node ${PD}/.instar/hooks/instar/self-stop-guard.js`,
56
+ timeout: 5000,
57
+ },
53
58
  {
54
59
  type: 'command',
55
60
  command: `node ${PD}/.instar/hooks/instar/external-communication-guard.js`,
@@ -1 +1 @@
1
- {"version":3,"file":"instarSettingsHooks.js","sourceRoot":"","sources":["../../src/core/instarSettingsHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AASH,MAAM,EAAE,GAAG,uBAAuB,CAAC;AAEnC;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA2C;IAClF;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,gEAAgE;QACnF,QAAQ,EAAE,IAAI;KACf;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,mEAAmE;QACtF,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,4CAA4C;QAC/D,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,uDAAuD;QAC1E,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,iDAAiD;QACpE,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAA2C;IACjF;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,kDAAkD;QACrE,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAC3C,4BAA4B,CAAC,GAAG,CAAC,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AC,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"instarSettingsHooks.js","sourceRoot":"","sources":["../../src/core/instarSettingsHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AASH,MAAM,EAAE,GAAG,uBAAuB,CAAC;AAEnC;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA2C;IAClF;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,gEAAgE;QACnF,QAAQ,EAAE,IAAI;KACf;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,mEAAmE;QACtF,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,4CAA4C;QAC/D,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,0CAA0C;QAC7D,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,uDAAuD;QAC1E,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,iDAAiD;QACpE,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAA2C;IACjF;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,EAAE,kDAAkD;QACrE,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAC3C,4BAA4B,CAAC,GAAG,CAAC,CAAC,C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E,GAAG,SAAS,EAAE,CAAC,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.3.204",
3
+ "version": "1.3.205",
4
4
  "description": "Coherence infrastructure for self-evolving AI agents — on the Claude Code or Codex subscription you already have.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -56,6 +56,7 @@ function scanHooks() {
56
56
  { file: 'compaction-recovery.sh', domain: 'identity' },
57
57
  { file: 'external-operation-gate.js', domain: 'safety' },
58
58
  { file: 'deferral-detector.js', domain: 'safety' },
59
+ { file: 'self-stop-guard.js', domain: 'coherence' },
59
60
  { file: 'post-action-reflection.js', domain: 'evolution' },
60
61
  { file: 'external-communication-guard.js', domain: 'safety' },
61
62
  { file: 'scope-coherence-collector.js', domain: 'coherence' },
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "$schema": "./builtin-manifest.schema.json",
3
3
  "schemaVersion": 1,
4
- "generatedAt": "2026-06-02T19:08:26.817Z",
5
- "instarVersion": "1.3.204",
6
- "entryCount": 194,
4
+ "generatedAt": "2026-06-02T20:04:00.495Z",
5
+ "instarVersion": "1.3.205",
6
+ "entryCount": 195,
7
7
  "entries": {
8
8
  "hook:session-start": {
9
9
  "id": "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": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
14
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
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": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
23
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
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": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
32
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
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": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
41
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
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": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
50
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
51
51
  "since": "2025-01-01"
52
52
  },
53
53
  "hook:deferral-detector": {
@@ -56,7 +56,16 @@
56
56
  "domain": "safety",
57
57
  "sourcePath": "src/core/PostUpdateMigrator.ts",
58
58
  "installedPath": ".instar/hooks/instar/deferral-detector.js",
59
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
59
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
60
+ "since": "2025-01-01"
61
+ },
62
+ "hook:self-stop-guard": {
63
+ "id": "hook:self-stop-guard",
64
+ "type": "hook",
65
+ "domain": "coherence",
66
+ "sourcePath": "src/core/PostUpdateMigrator.ts",
67
+ "installedPath": ".instar/hooks/instar/self-stop-guard.js",
68
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
60
69
  "since": "2025-01-01"
61
70
  },
62
71
  "hook:post-action-reflection": {
@@ -65,7 +74,7 @@
65
74
  "domain": "evolution",
66
75
  "sourcePath": "src/core/PostUpdateMigrator.ts",
67
76
  "installedPath": ".instar/hooks/instar/post-action-reflection.js",
68
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
77
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
69
78
  "since": "2025-01-01"
70
79
  },
71
80
  "hook:external-communication-guard": {
@@ -74,7 +83,7 @@
74
83
  "domain": "safety",
75
84
  "sourcePath": "src/core/PostUpdateMigrator.ts",
76
85
  "installedPath": ".instar/hooks/instar/external-communication-guard.js",
77
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
86
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
78
87
  "since": "2025-01-01"
79
88
  },
80
89
  "hook:scope-coherence-collector": {
@@ -83,7 +92,7 @@
83
92
  "domain": "coherence",
84
93
  "sourcePath": "src/core/PostUpdateMigrator.ts",
85
94
  "installedPath": ".instar/hooks/instar/scope-coherence-collector.js",
86
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
95
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
87
96
  "since": "2025-01-01"
88
97
  },
89
98
  "hook:scope-coherence-checkpoint": {
@@ -92,7 +101,7 @@
92
101
  "domain": "coherence",
93
102
  "sourcePath": "src/core/PostUpdateMigrator.ts",
94
103
  "installedPath": ".instar/hooks/instar/scope-coherence-checkpoint.js",
95
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
104
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
96
105
  "since": "2025-01-01"
97
106
  },
98
107
  "hook:free-text-guard": {
@@ -101,7 +110,7 @@
101
110
  "domain": "safety",
102
111
  "sourcePath": "src/core/PostUpdateMigrator.ts",
103
112
  "installedPath": ".instar/hooks/instar/free-text-guard.sh",
104
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
113
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
105
114
  "since": "2025-01-01"
106
115
  },
107
116
  "hook:claim-intercept": {
@@ -110,7 +119,7 @@
110
119
  "domain": "coherence",
111
120
  "sourcePath": "src/core/PostUpdateMigrator.ts",
112
121
  "installedPath": ".instar/hooks/instar/claim-intercept.js",
113
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
122
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
114
123
  "since": "2025-01-01"
115
124
  },
116
125
  "hook:claim-intercept-response": {
@@ -119,7 +128,7 @@
119
128
  "domain": "coherence",
120
129
  "sourcePath": "src/core/PostUpdateMigrator.ts",
121
130
  "installedPath": ".instar/hooks/instar/claim-intercept-response.js",
122
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
131
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
123
132
  "since": "2025-01-01"
124
133
  },
125
134
  "hook:stop-gate-router": {
@@ -128,7 +137,7 @@
128
137
  "domain": "safety",
129
138
  "sourcePath": "src/core/PostUpdateMigrator.ts",
130
139
  "installedPath": ".instar/hooks/instar/stop-gate-router.js",
131
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
140
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
132
141
  "since": "2025-01-01"
133
142
  },
134
143
  "hook:auto-approve-permissions": {
@@ -137,7 +146,7 @@
137
146
  "domain": "safety",
138
147
  "sourcePath": "src/core/PostUpdateMigrator.ts",
139
148
  "installedPath": ".instar/hooks/instar/auto-approve-permissions.js",
140
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
149
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
141
150
  "since": "2025-01-01"
142
151
  },
143
152
  "job:health-check": {
@@ -1497,7 +1506,7 @@
1497
1506
  "type": "subsystem",
1498
1507
  "domain": "updates",
1499
1508
  "sourcePath": "src/core/PostUpdateMigrator.ts",
1500
- "contentHash": "920b1492c5e80f1b63e8f7f685635fda2b722fa11de39ee774ad51aa86dbfdb5",
1509
+ "contentHash": "90bfb6c540825ac2bf3393e22c4b7ae324159407acaac58b2c464762ef69901a",
1501
1510
  "since": "2025-01-01"
1502
1511
  },
1503
1512
  "subsystem:scheduler": {
@@ -0,0 +1,53 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What Changed
7
+
8
+ A new signal-only PreToolUse hook, `self-stop-guard.js`, joins the behavioral-guard
9
+ family (alongside `deferral-detector.js`). It scans **outbound user messages** for
10
+ context/length stop-excuses — "maxed out context", "session too long / long-running
11
+ session", "let's start a fresh session", "good stopping point", "close this out and
12
+ restart" — and, when matched, injects a self-reminder that those are never valid stop
13
+ reasons (compaction infrastructure handles context; the only legitimate stops are a
14
+ question only the user can answer, missing info, a genuine error, or real completion).
15
+
16
+ It is **signal-only**: it never blocks a message and is never destructive. An
17
+ allow-list suppresses it on genuine completion (the `ALL_TASKS_COMPLETE` promise,
18
+ "all tests passing", etc.) and when the user themselves asked to stop. It runs for
19
+ both Claude (`Bash`) and Codex (`exec_command`) agents and reaches existing agents on
20
+ their next update via `INSTAR_BASH_PRETOOLUSE_HOOKS` (init + migrate parity) — it is
21
+ also registered in the Codex PreToolUse chain and drift-verified in the builtin
22
+ manifest. This is the structural enforcement (Structure > Willpower) of the existing
23
+ "No context-death self-stops" principle already present in the CLAUDE.md template.
24
+
25
+ ## What to Tell Your User
26
+
27
+ - **A guard against quitting early**: "I added a small safety check on myself — if I
28
+ ever start to tell you I'm stopping just because I've been running a while or my
29
+ memory is filling up, it now catches me and reminds me that's not a real reason to
30
+ quit. My memory gets refreshed automatically, so I can keep going as long as the
31
+ work needs. It only nudges me — it never blocks anything, and it stays quiet when a
32
+ job is genuinely finished or when you've asked me to stop."
33
+
34
+ ## Summary of New Capabilities
35
+
36
+ | Capability | How to Use |
37
+ |-----------|-----------|
38
+ | Self-stop excuse guard | Automatic (PreToolUse hook on every agent, Claude + Codex) |
39
+
40
+ ## Evidence
41
+
42
+ Not a code-bug fix — this adds a new preventive behavioral guard, so no
43
+ reproduction-of-a-broken-code-path applies. Origin and verification:
44
+
45
+ - **Origin (the behavior it guards):** on 2026-06-02 an agent ended a multi-hour
46
+ autonomous run early, telling the user "this session's almost done, let's start
47
+ fresh" while citing "maxed out context." The user flagged this as a recurring,
48
+ invalid excuse and asked for a structural check.
49
+ - **Verified behavior:** the shipped hook is spawned end-to-end by 16 unit tests that
50
+ feed it real outbound-message payloads. It emits the reminder for each excuse
51
+ phrasing (Claude `Bash` and Codex `exec_command`) and stays silent on the other
52
+ side of the boundary — normal messages, genuine completion, the completion promise,
53
+ user-requested stops, and non-communication shell commands.
@@ -0,0 +1,83 @@
1
+ # Side-Effects Review — self-stop-guard hook
2
+
3
+ **Version / slug:** `self-stop-guard`
4
+ **Date:** `2026-06-02`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `not required (Tier-1, signal-only additive hook; external cross-model capacity-blocked this session — codex absent, gemini 429)`
7
+
8
+ ## Summary of the change
9
+
10
+ Adds `self-stop-guard.js`, a signal-only PreToolUse hook (sibling of `deferral-detector.js`) that scans outbound user messages for context/length stop-excuses ("maxed out context", "session too long", "start a fresh session", "good stopping point") and, on a match, injects a self-reminder that those are never valid stop reasons. Files: new `.instar/hooks/instar/self-stop-guard.js` + its embedded twin `getSelfStopGuardHook()` in `src/core/PostUpdateMigrator.ts` (+ `getHookContent` case, `migrateHooks` write, `builtinHooks` layout array); registration in `src/core/instarSettingsHooks.ts` (`INSTAR_BASH_PRETOOLUSE_HOOKS` → both init and migrate), `src/commands/init.ts` (new-agent write), `src/core/installCodexHooks.ts` (Codex PreToolUse chain); manifest entry via `scripts/generate-builtin-manifest.cjs`.
11
+
12
+ ## Decision-point inventory
13
+
14
+ - `self-stop-guard: is this outbound message a context/length stop-excuse?` — **add** — a regex detector that, on match, injects `additionalContext`. Produces a SIGNAL; holds NO block/allow authority.
15
+
16
+ ---
17
+
18
+ ## 1. Over-block
19
+
20
+ **What legitimate inputs does this change reject that it shouldn't?** None — there is no block surface. The worst case is an over-FIRE (a harmless self-reminder injected when it shouldn't be). Concrete over-fire shapes: a message that legitimately contains a trigger phrase out of context — e.g. discussing this very feature ("I added a good-stopping-point detector"), or quoting the user. These inject a reminder into the agent's own turn; the message still sends unchanged and nothing is blocked. Mitigated by the completion/user-asked-to-stop allow-list, which suppresses the common legitimate cases.
21
+
22
+ ---
23
+
24
+ ## 2. Under-block
25
+
26
+ **What failure modes does this still miss?** (a) It only scans outbound communication commands (telegram-reply / send-*); a stop-excuse expressed in internal reasoning but never sent is not seen. (b) It does not cover the autonomous-stop-hook / session-end layer — that is a separate level (the user asked for checks "on multiple levels"; this is the pre-send level). (c) Novel phrasings outside the pattern set slip through (e.g. a creative euphemism for "I'm out of context"). These are acceptable: the hook reduces, not eliminates, the anti-pattern, and is one layer of several.
27
+
28
+ ---
29
+
30
+ ## 3. Level-of-abstraction fit
31
+
32
+ Correct layer. This is a low-level, cheap detector that produces a SIGNAL (an `additionalContext` injection into the agent's own context), exactly like its sibling `deferral-detector`. It does not attempt to be an authority — it never blocks. The "authority" that can actually hold/redirect a turn is the agent's own reasoning, which this feeds. It reuses the existing PreToolUse-Bash hook surface rather than inventing a new mechanism.
33
+
34
+ ---
35
+
36
+ ## 4. Signal vs authority compliance
37
+
38
+ **Required reference:** [docs/signal-vs-authority.md](../../docs/signal-vs-authority.md)
39
+
40
+ - [x] No — this change produces a signal consumed by an existing smart gate (the agent's own next-turn reasoning).
41
+
42
+ It writes `{ decision: 'approve', additionalContext: <reminder> }` — `approve` is unconditional; the hook can never block or delay a message. Brittle regex is acceptable precisely because it holds no authority: a false match costs one harmless reminder.
43
+
44
+ ---
45
+
46
+ ## 5. Interactions
47
+
48
+ - **Shadowing:** runs in the PreToolUse Bash matcher chain after `deferral-detector` and before `external-communication-guard`. All non-`dangerous-command-guard` hooks in the chain emit `approve`+`additionalContext` (never block), so it cannot shadow or be shadowed — each contributes additive context.
49
+ - **Double-fire:** a message containing both a defer-pattern and a stop-excuse triggers both `deferral-detector` and this hook; both inject context. That is additive and non-conflicting, not a harmful double-fire.
50
+ - **Races:** none — the hook is a stateless, pure stdin→stdout process. It writes no files and shares no state (logging was deliberately omitted to keep it ESM-host-safe and side-effect-free).
51
+ - **Feedback loops:** none — it injects context into the agent; the agent's resulting message is not re-fed to the hook in a loop (the injected reminder text is not itself a stop-excuse).
52
+
53
+ ---
54
+
55
+ ## 6. External surfaces
56
+
57
+ - Other agents on the machine: unaffected (per-session PreToolUse hook).
58
+ - Install base: ships to ALL agents on next update via `INSTAR_BASH_PRETOOLUSE_HOOKS` (init + migrate parity) and the Codex chain — intended.
59
+ - External systems: none — the hook never makes network calls and never touches Telegram/Slack/GitHub.
60
+ - Persistent state: none — writes nothing to disk.
61
+ - Timing/runtime: a sub-second `node` process per outbound command (5s timeout, same as deferral-detector). Negligible.
62
+
63
+ ---
64
+
65
+ ## 7. Rollback cost
66
+
67
+ Pure additive code change. Back-out = remove the `self-stop-guard.js` entry from `INSTAR_BASH_PRETOOLUSE_HOOKS` + the file writes + the manifest entry, ship as a patch. No persistent state, no data migration, no agent-state repair. Existing agents drop the hook on their next update (settings re-derive from the canonical list). No user-visible regression during the rollback window (the hook never blocked anything).
68
+
69
+ ---
70
+
71
+ ## Conclusion
72
+
73
+ The review produced no design changes — the hook was deliberately scoped signal-only and stateless from the start, mirroring the proven `deferral-detector` contract. The only residuals are harmless over-fires (mitigated by the allow-list) and the deliberate single-layer scope (pre-send only; the stop-hook layer is future work the user explicitly framed as "multiple levels"). Clear to ship as a Tier-1 additive guard.
74
+
75
+ ## Second-pass review (if required)
76
+
77
+ Not required for a Tier-1 signal-only additive hook. External cross-model review was unavailable this session (codex CLI not installed; Gemini CLI returned 429 "exhausted capacity"). A cross-model pass by Codey (codex) is queued after his current keystone build.
78
+
79
+ ## Evidence pointers
80
+
81
+ - 16 unit tests spawn the shipped hook end-to-end (`tests/unit/self-stop-guard.test.ts`) — both sides of the boundary, Claude `Bash` + Codex `exec_command`.
82
+ - Drift/parity green: `instar-settings-hooks`, `builtin-manifest`, `PostUpdateMigrator-pretooluse-parity`, `migration-parity-hooks`.
83
+ - Origin incident: 2026-06-02 early-close of a 12h autonomous run citing "maxed out context" (the behavior this guards).