instar 1.3.305 → 1.3.307

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 (53) hide show
  1. package/dist/commands/init.d.ts.map +1 -1
  2. package/dist/commands/init.js +32 -30
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/core/Config.d.ts.map +1 -1
  5. package/dist/core/Config.js +2 -0
  6. package/dist/core/Config.js.map +1 -1
  7. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  8. package/dist/core/PostUpdateMigrator.js +6 -1
  9. package/dist/core/PostUpdateMigrator.js.map +1 -1
  10. package/dist/core/SessionManager.d.ts.map +1 -1
  11. package/dist/core/SessionManager.js +3 -0
  12. package/dist/core/SessionManager.js.map +1 -1
  13. package/dist/core/types.d.ts +4 -0
  14. package/dist/core/types.d.ts.map +1 -1
  15. package/dist/core/types.js.map +1 -1
  16. package/dist/scheduler/JobScheduler.d.ts.map +1 -1
  17. package/dist/scheduler/JobScheduler.js +10 -6
  18. package/dist/scheduler/JobScheduler.js.map +1 -1
  19. package/package.json +1 -1
  20. package/scripts/instar-dev-precommit.js +48 -16
  21. package/src/data/builtin-manifest.json +58 -58
  22. package/src/scaffold/templates/jobs/instar/commitment-detection.md +2 -1
  23. package/src/scaffold/templates/jobs/instar/correction-analyzer.md +5 -1
  24. package/src/scaffold/templates/jobs/instar/evolution-overdue-check.md +1 -1
  25. package/src/scaffold/templates/jobs/instar/evolution-proposal-evaluate.md +1 -1
  26. package/src/scaffold/templates/jobs/instar/evolution-proposal-implement.md +1 -1
  27. package/src/scaffold/templates/jobs/instar/failure-analyzer.md +5 -1
  28. package/src/scaffold/templates/jobs/instar/identity-review.md +5 -4
  29. package/src/scaffold/templates/jobs/instar/initiative-digest-review.md +3 -1
  30. package/src/scaffold/templates/jobs/instar/insight-harvest.md +1 -1
  31. package/src/scaffold/templates/jobs/instar/mentor-onboarding.md +7 -4
  32. package/src/scaffold/templates/jobs/instar/org-intent-drift-audit.md +6 -4
  33. package/src/scaffold/templates/jobs/instar/overseer-development.md +4 -1
  34. package/src/scaffold/templates/jobs/instar/overseer-guardian.md +4 -1
  35. package/src/scaffold/templates/jobs/instar/overseer-infrastructure.md +4 -1
  36. package/src/scaffold/templates/jobs/instar/overseer-learning.md +4 -1
  37. package/src/scaffold/templates/jobs/instar/overseer-maintenance.md +4 -1
  38. package/src/scaffold/templates/jobs/instar/release-readiness-check.md +2 -1
  39. package/src/templates/hooks/compaction-recovery.sh +11 -6
  40. package/src/templates/hooks/session-start.sh +11 -3
  41. package/src/templates/hooks/slack-channel-context.sh +5 -0
  42. package/src/templates/hooks/telegram-topic-context.sh +6 -0
  43. package/src/templates/scripts/emit-session-clock.sh +3 -3
  44. package/src/templates/scripts/imessage-reply.sh +10 -0
  45. package/src/templates/scripts/instar-watchdog.sh +12 -6
  46. package/src/templates/scripts/secret-drop-retrieve.mjs +10 -2
  47. package/src/templates/scripts/slack-reply.sh +5 -0
  48. package/src/templates/scripts/whatsapp-reply.sh +5 -0
  49. package/upgrades/1.3.306.md +22 -0
  50. package/upgrades/1.3.307.md +20 -0
  51. package/upgrades/gate-blocked-audit-hygiene.eli16.md +11 -0
  52. package/upgrades/side-effects/gate-blocked-audit-hygiene.md +41 -0
  53. package/upgrades/side-effects/template-agent-id-header.md +48 -0
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAyDH,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yFAAyF;IACzF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,CAAC;CACjE;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GACtE,aAAa,CAAC,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC,CAa3D;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,aAAa,GAAG,WAAW,GAAG,YAAY,CAItF,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,GAAG,WAAW,GAAG,YAAY,CAE5F;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBrE;AA43CD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CA8tC1E;AA8ID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAkhBrD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAqElF"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAyDH,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yFAAyF;IACzF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,CAAC;CACjE;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GACtE,aAAa,CAAC,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC,CAa3D;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,aAAa,GAAG,WAAW,GAAG,YAAY,CAItF,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,GAAG,WAAW,GAAG,YAAY,CAE5F;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBrE;AA83CD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CA8tC1E;AA8ID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAkhBrD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAqElF"}
@@ -224,6 +224,7 @@ async function initFreshProject(projectName, options) {
224
224
  projectName,
225
225
  port,
226
226
  sessions: {
227
+ projectName,
227
228
  tmuxPath,
228
229
  claudePath,
229
230
  projectDir,
@@ -554,6 +555,7 @@ async function initExistingProject(options) {
554
555
  projectName,
555
556
  port,
556
557
  sessions: {
558
+ projectName,
557
559
  tmuxPath,
558
560
  claudePath,
559
561
  projectDir,
@@ -1347,7 +1349,7 @@ Skills compound over time. Each one makes future sessions more capable. You are
1347
1349
  Before EVER saying "I don't have", "I can't", or "this isn't available" — check what actually exists:
1348
1350
 
1349
1351
  \`\`\`bash
1350
- curl -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/capabilities
1352
+ curl -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/capabilities
1351
1353
  \`\`\`
1352
1354
 
1353
1355
  This returns your full capability matrix: scripts, hooks, Telegram status, jobs, relationships, and more. It is the source of truth about what you can do. **Never hallucinate about missing capabilities — verify first.**
@@ -1799,7 +1801,7 @@ If no findings exist, report "No pending findings" and stop.
1799
1801
  3. **Assess each valid finding**:
1800
1802
  - Is it actionable? Does it describe a real issue or improvement?
1801
1803
  - Is it a duplicate of something already proposed?
1802
- - Check existing evolution proposals: \\\`curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals\\\`
1804
+ - Check existing evolution proposals: \\\`curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals\\\`
1803
1805
 
1804
1806
  4. **Route the finding** (one of):
1805
1807
 
@@ -1897,7 +1899,7 @@ cat .instar/soul.md
1897
1899
 
1898
1900
  2. **Review recent experience** — Check for identity-relevant learnings:
1899
1901
  \\\`\\\`\\\`bash
1900
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/evolution/learnings?applied=false
1902
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/evolution/learnings?applied=false
1901
1903
  \\\`\\\`\\\`
1902
1904
 
1903
1905
  3. **Ask yourself these questions** (not all will apply every time):
@@ -1932,7 +1934,7 @@ curl -s -X PATCH http://localhost:\${INSTAR_PORT:-${port}}/identity/soul \\\\
1932
1934
 
1933
1935
  6. **Check drift** — See how far you've come from your initial state:
1934
1936
  \\\`\\\`\\\`bash
1935
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/identity/soul/drift
1937
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/identity/soul/drift
1936
1938
  \\\`\\\`\\\`
1937
1939
 
1938
1940
  ## When to Use
@@ -1981,7 +1983,7 @@ Check each area:
1981
1983
  ### 1. Topic-Project Bindings
1982
1984
 
1983
1985
  \\\`\\\`\\\`
1984
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/topic-bindings
1986
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/topic-bindings
1985
1987
  \\\`\\\`\\\`
1986
1988
 
1987
1989
  - Are all bindings still valid?
@@ -1991,7 +1993,7 @@ curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port
1991
1993
  ### 2. Project Map Freshness
1992
1994
 
1993
1995
  \\\`\\\`\\\`
1994
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/project-map
1996
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/project-map
1995
1997
  \\\`\\\`\\\`
1996
1998
 
1997
1999
  - Check the \\\`generatedAt\\\` timestamp.
@@ -2010,7 +2012,7 @@ Flag any that are missing, empty, or contain invalid JSON. Look for stale entrie
2010
2012
  ### 4. Context Segments
2011
2013
 
2012
2014
  \\\`\\\`\\\`
2013
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/context
2015
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/context
2014
2016
  \\\`\\\`\\\`
2015
2017
 
2016
2018
  - Are all expected segments present?
@@ -2119,7 +2121,7 @@ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get
2119
2121
  If \\\`.instar/state/active-job.json\\\` exists, verify the session it references is actually running:
2120
2122
 
2121
2123
  \\\`\\\`\\\`
2122
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/sessions
2124
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/sessions
2123
2125
  \\\`\\\`\\\`
2124
2126
 
2125
2127
  Check if the session name matches. If the session is dead but active-job.json persists, it's orphaned — delete it.
@@ -2129,7 +2131,7 @@ Check if the session name matches. If the session is dead but active-job.json pe
2129
2131
  Read \\\`.instar/state/job-topic-mappings.json\\\`. For each mapping, verify the topic ID is reachable:
2130
2132
 
2131
2133
  \\\`\\\`\\\`
2132
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/telegram/topics
2134
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/telegram/topics
2133
2135
  \\\`\\\`\\\`
2134
2136
 
2135
2137
  If topics have been deleted, the mapping is stale — flag it.
@@ -2147,7 +2149,7 @@ Report bloated files and prune where safe.
2147
2149
  Read \\\`.instar/config.json\\\`. If Telegram is configured, verify the bot is connected:
2148
2150
 
2149
2151
  \\\`\\\`\\\`
2150
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/health
2152
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/health
2151
2153
  \\\`\\\`\\\`
2152
2154
 
2153
2155
  Check if the telegram field shows connected. If config says telegram but health says disconnected, report the discrepancy.
@@ -2265,7 +2267,7 @@ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get
2265
2267
  ### 1. Job Health
2266
2268
 
2267
2269
  \\\`\\\`\\\`
2268
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/jobs
2270
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/jobs
2269
2271
  \\\`\\\`\\\`
2270
2272
 
2271
2273
  For each enabled job, check:
@@ -2277,7 +2279,7 @@ For each enabled job, check:
2277
2279
  ### 2. Skip Ledger Trends
2278
2280
 
2279
2281
  \\\`\\\`\\\`
2280
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/skip-ledger/workloads
2282
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/skip-ledger/workloads
2281
2283
  \\\`\\\`\\\`
2282
2284
 
2283
2285
  If any job has been skipped more than 10 times by its gate, the gate may be misconfigured (always returning skip), or the feature it monitors is permanently broken.
@@ -2296,7 +2298,7 @@ Two parts: pipeline health AND active consumption.
2296
2298
 
2297
2299
  \\\`\\\`\\\`
2298
2300
  # Read everything that's still unreported
2299
- UNREPORTED=$(curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/health/degradations | jq -c '.events[] | select(.reported == false)')
2301
+ UNREPORTED=$(curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/health/degradations | jq -c '.events[] | select(.reported == false)')
2300
2302
  \\\`\\\`\\\`
2301
2303
 
2302
2304
  For each unreported event, surface it to the attention queue using a stable id (one feature = one topic, even across days):
@@ -2322,7 +2324,7 @@ If the attention POST fails (Telegram down, etc.), do NOT call mark-reported —
2322
2324
  ### 5. Session Monitor
2323
2325
 
2324
2326
  \\\`\\\`\\\`
2325
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/sessions
2327
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/sessions
2326
2328
  \\\`\\\`\\\`
2327
2329
 
2328
2330
  Are there zombie sessions (status: running but started > 30 minutes ago for a job that should take 5)?
@@ -2370,7 +2372,7 @@ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get
2370
2372
  ### 1. Recent Sessions
2371
2373
 
2372
2374
  \\\`\\\`\\\`
2373
- curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/sessions
2375
+ curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/sessions
2374
2376
  \\\`\\\`\\\`
2375
2377
 
2376
2378
  Get sessions that completed in the last 8 hours.
@@ -2930,7 +2932,7 @@ echo "If nothing significant, do nothing. Silence means continuity is working as
2930
2932
  expectedDurationMinutes: 3,
2931
2933
  model: 'opus',
2932
2934
  enabled: true,
2933
- gate: `curl -sf -H "Authorization: Bearer $INSTAR_AUTH_TOKEN" http://localhost:\${INSTAR_PORT:-${port}}/evolution/learnings?applied=false 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('learnings',[])) > 0 else 1)"`,
2935
+ gate: `curl -sf -H "Authorization: Bearer $INSTAR_AUTH_TOKEN" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/evolution/learnings?applied=false 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('learnings',[])) > 0 else 1)"`,
2934
2936
  execute: {
2935
2937
  type: 'prompt',
2936
2938
  value: `Harvest and synthesize learnings: curl -s http://localhost:\${INSTAR_PORT:-${port}}/evolution/learnings?applied=false
@@ -2961,7 +2963,7 @@ If no actionable patterns found, exit silently.`,
2961
2963
  expectedDurationMinutes: 2,
2962
2964
  model: 'haiku',
2963
2965
  enabled: true,
2964
- gate: `curl -sf -H "Authorization: Bearer $INSTAR_AUTH_TOKEN" http://localhost:\${INSTAR_PORT:-${port}}/evolution/actions/overdue 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('overdue',[])) > 0 else 1)"`,
2966
+ gate: `curl -sf -H "Authorization: Bearer $INSTAR_AUTH_TOKEN" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/evolution/actions/overdue 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('overdue',[])) > 0 else 1)"`,
2965
2967
  execute: {
2966
2968
  type: 'prompt',
2967
2969
  value: `Check for overdue commitments: curl -s http://localhost:\${INSTAR_PORT:-${port}}/evolution/actions/overdue
@@ -3122,7 +3124,7 @@ If no overdue or stale items, exit silently.`,
3122
3124
  expectedDurationMinutes: 1,
3123
3125
  model: 'haiku',
3124
3126
  enabled: true,
3125
- gate: `curl -sf http://localhost:\${INSTAR_PORT:-${port}}/health >/dev/null 2>&1 && AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null) && curl -sf -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/semantic/stats >/dev/null 2>&1`,
3127
+ gate: `curl -sf http://localhost:\${INSTAR_PORT:-${port}}/health >/dev/null 2>&1 && AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null) && curl -sf -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/semantic/stats >/dev/null 2>&1`,
3126
3128
  execute: {
3127
3129
  type: 'script',
3128
3130
  value: `AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null); AGENT=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('agentName','Agent'))" 2>/dev/null); RESULT=$(curl -s -X POST -H "Authorization: Bearer $AUTH" -H "Content-Type: application/json" -d "{\\"filePath\\":\\".instar/MEMORY.md\\",\\"agentName\\":\\"$AGENT\\"}" http://localhost:\${INSTAR_PORT:-${port}}/semantic/export-memory 2>/dev/null); COUNT=$(echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('entityCount',0))" 2>/dev/null || echo 0); EXCLUDED=$(echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('excludedCount',0))" 2>/dev/null || echo 0); [ "$COUNT" -gt "0" ] && echo "Memory export: $COUNT entities written to MEMORY.md ($EXCLUDED excluded below threshold)." || echo "Memory export: no entities to export."`,
@@ -3158,7 +3160,7 @@ If no overdue or stale items, exit silently.`,
3158
3160
  gate: `curl -sf http://localhost:\${INSTAR_PORT:-${port}}/health >/dev/null 2>&1`,
3159
3161
  execute: {
3160
3162
  type: 'script',
3161
- value: `AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null); REFRESH=$(curl -s -X POST -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/capability-map/refresh 2>/dev/null); DRIFT=$(curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/capability-map/drift 2>/dev/null); ADDED=$(echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('added',[])))" 2>/dev/null || echo 0); REMOVED=$(echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('removed',[])))" 2>/dev/null || echo 0); CHANGED=$(echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('changed',[])))" 2>/dev/null || echo 0); UNMAPPED=$(echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('unmapped',[])))" 2>/dev/null || echo 0); if [ "$ADDED" -gt "0" ] || [ "$REMOVED" -gt "0" ] || [ "$CHANGED" -gt "0" ] || [ "$UNMAPPED" -gt "0" ]; then echo "Capability drift detected: +$ADDED -$REMOVED ~$CHANGED ?$UNMAPPED"; echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); [print(f' + {c[\"id\"]}') for c in d.get('added',[])]; [print(f' - {r[\"id\"]}') for r in d.get('removed',[])]; [print(f' ~ {c[\"id\"]} ({c[\"field\"]})') for c in d.get('changed',[])]" 2>/dev/null; else echo "Capability audit: no drift detected."; fi`,
3163
+ value: `AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null); REFRESH=$(curl -s -X POST -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/capability-map/refresh 2>/dev/null); DRIFT=$(curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/capability-map/drift 2>/dev/null); ADDED=$(echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('added',[])))" 2>/dev/null || echo 0); REMOVED=$(echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('removed',[])))" 2>/dev/null || echo 0); CHANGED=$(echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('changed',[])))" 2>/dev/null || echo 0); UNMAPPED=$(echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('unmapped',[])))" 2>/dev/null || echo 0); if [ "$ADDED" -gt "0" ] || [ "$REMOVED" -gt "0" ] || [ "$CHANGED" -gt "0" ] || [ "$UNMAPPED" -gt "0" ]; then echo "Capability drift detected: +$ADDED -$REMOVED ~$CHANGED ?$UNMAPPED"; echo "$DRIFT" | python3 -c "import sys,json; d=json.load(sys.stdin); [print(f' + {c[\"id\"]}') for c in d.get('added',[])]; [print(f' - {r[\"id\"]}') for r in d.get('removed',[])]; [print(f' ~ {c[\"id\"]} ({c[\"field\"]})') for c in d.get('changed',[])]" 2>/dev/null; else echo "Capability audit: no drift detected."; fi`,
3162
3164
  },
3163
3165
  grounding: {
3164
3166
  requiresIdentity: false,
@@ -3182,15 +3184,15 @@ If no overdue or stale items, exit silently.`,
3182
3184
 
3183
3185
  AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
3184
3186
 
3185
- 1. **Check soul.md drift**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/identity/soul/drift
3187
+ 1. **Check soul.md drift**: curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/identity/soul/drift
3186
3188
  - If anyAboveThreshold is true, review the divergence. Is this healthy growth or unexpected drift?
3187
3189
  - If drift looks healthy, mark it reviewed: the growth is intentional.
3188
3190
  - If drift looks concerning, flag with [ATTENTION] so the user is notified.
3189
3191
 
3190
- 2. **Check pending changes**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/identity/soul/pending
3192
+ 2. **Check pending changes**: curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/identity/soul/pending
3191
3193
  - If pending changes exist, surface them to the user via Telegram (the user should approve/reject these).
3192
3194
 
3193
- 3. **Check for identity-relevant learnings**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/evolution/learnings?applied=false
3195
+ 3. **Check for identity-relevant learnings**: curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/evolution/learnings?applied=false
3194
3196
  - For each unapplied learning, assess: is this about operational knowledge (how to do something) or about your values, beliefs, or self-understanding?
3195
3197
  - If you find 3+ identity-relevant learnings since your last soul.md update, consider running /reflect.
3196
3198
  - Don't force it — if none of the learnings touch on identity, that's fine. Exit silently.
@@ -3200,7 +3202,7 @@ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get
3200
3202
  - Is the Self-Observations section populated? If you've noticed behavioral patterns, document them.
3201
3203
  - Update Identity History if you make changes.
3202
3204
 
3203
- 5. **Integrity check**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/identity/soul/integrity
3205
+ 5. **Integrity check**: curl -s -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/identity/soul/integrity
3204
3206
  - If integrity fails, flag with [ATTENTION] — soul.md may have been modified outside normal channels.
3205
3207
 
3206
3208
  If everything is coherent and no reflection is needed, exit silently. Only report via [ATTENTION] if drift is concerning, integrity fails, or pending changes need user action.`,
@@ -3221,7 +3223,7 @@ If everything is coherent and no reflection is needed, exit silently. Only repor
3221
3223
  expectedDurationMinutes: 3,
3222
3224
  model: 'sonnet',
3223
3225
  enabled: true,
3224
- gate: `curl -sf -H "Authorization: Bearer $INSTAR_AUTH_TOKEN" http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals?status=proposed 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('proposals',[])) > 0 else 1)"`,
3226
+ gate: `curl -sf -H "Authorization: Bearer $INSTAR_AUTH_TOKEN" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals?status=proposed 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('proposals',[])) > 0 else 1)"`,
3225
3227
  execute: {
3226
3228
  type: 'prompt',
3227
3229
  value: `Review pending evolution proposals: curl -s http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals?status=proposed\n\nFor each proposal:\n1. Read the title, description, type, and source\n2. Evaluate: Is this a genuine improvement? Is the effort worth the impact? Does it align with our goals?\n3. If approved, update status: curl -s -X PATCH http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals/EVO-XXX -H 'Content-Type: application/json' -d '{"status":"approved"}'\n4. If rejected or deferred, update with reason.\n\nDo NOT implement approved proposals — that's handled by the paired evolution-proposal-implement job.\n\nAlso check the dashboard: curl -s http://localhost:\${INSTAR_PORT:-${port}}/evolution — report any highlights to the user if they seem important.\n\nIf no proposals need attention, exit silently.`,
@@ -3237,7 +3239,7 @@ If everything is coherent and no reflection is needed, exit silently. Only repor
3237
3239
  expectedDurationMinutes: 10,
3238
3240
  model: 'opus',
3239
3241
  enabled: true,
3240
- gate: `curl -sf -H "Authorization: Bearer $INSTAR_AUTH_TOKEN" http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals?status=approved 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('proposals',[])) > 0 else 1)"`,
3242
+ gate: `curl -sf -H "Authorization: Bearer $INSTAR_AUTH_TOKEN" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals?status=approved 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('proposals',[])) > 0 else 1)"`,
3241
3243
  execute: {
3242
3244
  type: 'prompt',
3243
3245
  value: `Implement approved evolution proposals: curl -s http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals?status=approved\n\nFor each approved proposal:\n1. Read the full description and understand what needs to be built\n2. Implement it: create the skill/hook/job/config change described\n3. After implementation, mark complete: curl -s -X PATCH http://localhost:\${INSTAR_PORT:-${port}}/evolution/proposals/EVO-XXX -H 'Content-Type: application/json' -d '{"status":"implemented","resolution":"What was done"}'\n\nIf no approved proposals exist, exit silently.`,
@@ -3292,7 +3294,7 @@ If everything is coherent and no reflection is needed, exit silently. Only repor
3292
3294
  enabled: true,
3293
3295
  execute: {
3294
3296
  type: 'prompt',
3295
- value: `You are a Category Overseer for the GUARDIAN category. Your job is to review all guardian/monitoring jobs and assess the health of the monitoring system itself.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/guardian?sinceHours=24\n2. Analyze the report for:\n - Jobs with high failure rates or consecutive failures\n - Jobs that are being skipped excessively (especially for quota reasons)\n - Schedule mismatches (jobs running too often or not often enough for their purpose)\n - Model over-allocation (could any job use a cheaper model?)\n - Contradictions between job findings (e.g., health-check says healthy but degradation-digest found issues)\n - Coverage gaps (are there monitoring blind spots?)\n3. Read the handoff notes from each job — do they tell a coherent story?\n4. If you find actionable issues, write a clear summary. If everything is healthy, say so briefly.\n\nWrite your findings in [HANDOFF] tags for the next overseer run. Focus on trends and cross-job insights that individual jobs can't see.`,
3297
+ value: `You are a Category Overseer for the GUARDIAN category. Your job is to review all guardian/monitoring jobs and assess the health of the monitoring system itself.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/guardian?sinceHours=24\n2. Analyze the report for:\n - Jobs with high failure rates or consecutive failures\n - Jobs that are being skipped excessively (especially for quota reasons)\n - Schedule mismatches (jobs running too often or not often enough for their purpose)\n - Model over-allocation (could any job use a cheaper model?)\n - Contradictions between job findings (e.g., health-check says healthy but degradation-digest found issues)\n - Coverage gaps (are there monitoring blind spots?)\n3. Read the handoff notes from each job — do they tell a coherent story?\n4. If you find actionable issues, write a clear summary. If everything is healthy, say so briefly.\n\nWrite your findings in [HANDOFF] tags for the next overseer run. Focus on trends and cross-job insights that individual jobs can't see.`,
3296
3298
  },
3297
3299
  tags: ['cat:overseer', 'role:supervisor'],
3298
3300
  telegramNotify: 'on-alert',
@@ -3308,7 +3310,7 @@ If everything is coherent and no reflection is needed, exit silently. Only repor
3308
3310
  enabled: true,
3309
3311
  execute: {
3310
3312
  type: 'prompt',
3311
- value: `You are a Category Overseer for the LEARNING category. Your job is to review all evolution/learning jobs and assess whether the learning pipeline is producing genuine value.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/learning?sinceHours=48\n2. Analyze:\n - Are evolution proposals being generated AND accepted? What's the accept/reject ratio?\n - Is insight-harvest finding novel insights or recycling stale ones?\n - Are commitments being tracked and completed, or piling up?\n - Is reflection-trigger producing meaningful MEMORY.md updates?\n - Are any learning jobs consistently skipped due to quota? This means the learning pipeline is being starved.\n - Model costs: reflection-trigger uses opus — is the quality difference worth it vs sonnet?\n3. Look for the meta-pattern: is the agent actually getting smarter over time, or is the learning pipeline just busy-work?\n4. Check handoff notes for patterns across runs.\n\nWrite findings in [HANDOFF] tags. Flag if the learning pipeline is producing diminishing returns.`,
3313
+ value: `You are a Category Overseer for the LEARNING category. Your job is to review all evolution/learning jobs and assess whether the learning pipeline is producing genuine value.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/learning?sinceHours=48\n2. Analyze:\n - Are evolution proposals being generated AND accepted? What's the accept/reject ratio?\n - Is insight-harvest finding novel insights or recycling stale ones?\n - Are commitments being tracked and completed, or piling up?\n - Is reflection-trigger producing meaningful MEMORY.md updates?\n - Are any learning jobs consistently skipped due to quota? This means the learning pipeline is being starved.\n - Model costs: reflection-trigger uses opus — is the quality difference worth it vs sonnet?\n3. Look for the meta-pattern: is the agent actually getting smarter over time, or is the learning pipeline just busy-work?\n4. Check handoff notes for patterns across runs.\n\nWrite findings in [HANDOFF] tags. Flag if the learning pipeline is producing diminishing returns.`,
3312
3314
  },
3313
3315
  tags: ['cat:overseer', 'role:supervisor'],
3314
3316
  telegramNotify: 'on-alert',
@@ -3324,7 +3326,7 @@ If everything is coherent and no reflection is needed, exit silently. Only repor
3324
3326
  enabled: true,
3325
3327
  execute: {
3326
3328
  type: 'prompt',
3327
- value: `You are a Category Overseer for the MAINTENANCE category. Your job is to review all housekeeping/maintenance jobs and ensure they're keeping the system clean.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/maintenance?sinceHours=48\n2. Analyze:\n - Is memory-hygiene actually reducing stale entries, or finding nothing each run?\n - Is project-map-refresh keeping the map accurate? How often does it find drift?\n - Is coherence-audit finding real misalignments or just confirming everything is fine?\n - Are any maintenance jobs redundant with each other? (e.g., overlapping checks)\n - Are skill-type jobs (coherence-audit, memory-hygiene) running correctly?\n - Workload trends: are jobs processing fewer items over time (diminishing returns)?\n3. Maintenance jobs should trend toward finding LESS work over time. If they consistently find issues, something upstream is broken.\n\nWrite findings in [HANDOFF] tags. Recommend disabling or reducing frequency of jobs that consistently find nothing.`,
3329
+ value: `You are a Category Overseer for the MAINTENANCE category. Your job is to review all housekeeping/maintenance jobs and ensure they're keeping the system clean.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/maintenance?sinceHours=48\n2. Analyze:\n - Is memory-hygiene actually reducing stale entries, or finding nothing each run?\n - Is project-map-refresh keeping the map accurate? How often does it find drift?\n - Is coherence-audit finding real misalignments or just confirming everything is fine?\n - Are any maintenance jobs redundant with each other? (e.g., overlapping checks)\n - Are skill-type jobs (coherence-audit, memory-hygiene) running correctly?\n - Workload trends: are jobs processing fewer items over time (diminishing returns)?\n3. Maintenance jobs should trend toward finding LESS work over time. If they consistently find issues, something upstream is broken.\n\nWrite findings in [HANDOFF] tags. Recommend disabling or reducing frequency of jobs that consistently find nothing.`,
3328
3330
  },
3329
3331
  tags: ['cat:overseer', 'role:supervisor'],
3330
3332
  telegramNotify: 'on-alert',
@@ -3340,7 +3342,7 @@ If everything is coherent and no reflection is needed, exit silently. Only repor
3340
3342
  enabled: true,
3341
3343
  execute: {
3342
3344
  type: 'prompt',
3343
- value: `You are a Category Overseer for the INFRASTRUCTURE category. Your job is to review infrastructure/plumbing jobs.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/infrastructure?sinceHours=48\n2. Analyze:\n - Is git-sync succeeding? Any merge conflicts or divergence?\n - Is dashboard-link-refresh keeping links current? Could it run less often?\n - Is feedback-retry actually retrying anything, or is the queue always empty?\n - Model allocation: git-sync uses high priority — is that justified by its failure rate?\n - Are any infrastructure jobs causing issues for other jobs (e.g., git-sync holding sessions)?\n3. Infrastructure jobs should be boring and reliable. Any excitement is a problem.\n\nWrite findings in [HANDOFF] tags. Keep it brief — infrastructure overseers should be the quietest.`,
3345
+ value: `You are a Category Overseer for the INFRASTRUCTURE category. Your job is to review infrastructure/plumbing jobs.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/infrastructure?sinceHours=48\n2. Analyze:\n - Is git-sync succeeding? Any merge conflicts or divergence?\n - Is dashboard-link-refresh keeping links current? Could it run less often?\n - Is feedback-retry actually retrying anything, or is the queue always empty?\n - Model allocation: git-sync uses high priority — is that justified by its failure rate?\n - Are any infrastructure jobs causing issues for other jobs (e.g., git-sync holding sessions)?\n3. Infrastructure jobs should be boring and reliable. Any excitement is a problem.\n\nWrite findings in [HANDOFF] tags. Keep it brief — infrastructure overseers should be the quietest.`,
3344
3346
  },
3345
3347
  tags: ['cat:overseer', 'role:supervisor'],
3346
3348
  telegramNotify: 'on-alert',
@@ -3356,7 +3358,7 @@ If everything is coherent and no reflection is needed, exit silently. Only repor
3356
3358
  enabled: true,
3357
3359
  execute: {
3358
3360
  type: 'prompt',
3359
- value: `You are a Category Overseer for the DEVELOPMENT category. Your job is to review development-focused jobs.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/development?sinceHours=48\n2. Analyze:\n - Are development jobs consuming appropriate resources for their value?\n - Are there CI/testing patterns that could be automated?\n3. Development jobs are only valuable when there's active development. If the codebase is stable, these could be reduced.\n\nWrite findings in [HANDOFF] tags.`,
3361
+ value: `You are a Category Overseer for the DEVELOPMENT category. Your job is to review development-focused jobs.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" -H "X-Instar-AgentId: $INSTAR_AGENT_ID" http://localhost:\${INSTAR_PORT:-${port}}/jobs/category-report/development?sinceHours=48\n2. Analyze:\n - Are development jobs consuming appropriate resources for their value?\n - Are there CI/testing patterns that could be automated?\n3. Development jobs are only valuable when there's active development. If the codebase is stable, these could be reduced.\n\nWrite findings in [HANDOFF] tags.`,
3360
3362
  },
3361
3363
  tags: ['cat:overseer', 'role:supervisor'],
3362
3364
  telegramNotify: 'on-alert',