instar 0.12.34 → 0.13.0

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 (99) hide show
  1. package/README.md +58 -24
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +18 -100
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/commands/server.d.ts.map +1 -1
  6. package/dist/commands/server.js +4 -0
  7. package/dist/commands/server.js.map +1 -1
  8. package/dist/core/AdaptationValidator.d.ts +44 -0
  9. package/dist/core/AdaptationValidator.d.ts.map +1 -0
  10. package/dist/core/AdaptationValidator.js +132 -0
  11. package/dist/core/AdaptationValidator.js.map +1 -0
  12. package/dist/core/AutoDispatcher.d.ts +57 -0
  13. package/dist/core/AutoDispatcher.d.ts.map +1 -1
  14. package/dist/core/AutoDispatcher.js +353 -20
  15. package/dist/core/AutoDispatcher.js.map +1 -1
  16. package/dist/core/ContextSnapshotBuilder.d.ts +76 -0
  17. package/dist/core/ContextSnapshotBuilder.d.ts.map +1 -0
  18. package/dist/core/ContextSnapshotBuilder.js +302 -0
  19. package/dist/core/ContextSnapshotBuilder.js.map +1 -0
  20. package/dist/core/ContextualEvaluator.d.ts +103 -0
  21. package/dist/core/ContextualEvaluator.d.ts.map +1 -0
  22. package/dist/core/ContextualEvaluator.js +389 -0
  23. package/dist/core/ContextualEvaluator.js.map +1 -0
  24. package/dist/core/DeferredDispatchTracker.d.ts +91 -0
  25. package/dist/core/DeferredDispatchTracker.d.ts.map +1 -0
  26. package/dist/core/DeferredDispatchTracker.js +213 -0
  27. package/dist/core/DeferredDispatchTracker.js.map +1 -0
  28. package/dist/core/DispatchDecisionJournal.d.ts +83 -0
  29. package/dist/core/DispatchDecisionJournal.d.ts.map +1 -0
  30. package/dist/core/DispatchDecisionJournal.js +181 -0
  31. package/dist/core/DispatchDecisionJournal.js.map +1 -0
  32. package/dist/core/DispatchVerifier.d.ts +76 -0
  33. package/dist/core/DispatchVerifier.d.ts.map +1 -0
  34. package/dist/core/DispatchVerifier.js +128 -0
  35. package/dist/core/DispatchVerifier.js.map +1 -0
  36. package/dist/core/RelevanceFilter.d.ts +61 -0
  37. package/dist/core/RelevanceFilter.d.ts.map +1 -0
  38. package/dist/core/RelevanceFilter.js +160 -0
  39. package/dist/core/RelevanceFilter.js.map +1 -0
  40. package/dist/core/types.d.ts +82 -0
  41. package/dist/core/types.d.ts.map +1 -1
  42. package/dist/index.d.ts +15 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +7 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/messaging/backends/BaileysBackend.d.ts.map +1 -1
  47. package/dist/messaging/backends/BaileysBackend.js +12 -3
  48. package/dist/messaging/backends/BaileysBackend.js.map +1 -1
  49. package/dist/server/AgentServer.d.ts +2 -0
  50. package/dist/server/AgentServer.d.ts.map +1 -1
  51. package/dist/server/AgentServer.js +2 -0
  52. package/dist/server/AgentServer.js.map +1 -1
  53. package/dist/server/middleware.d.ts.map +1 -1
  54. package/dist/server/middleware.js +7 -0
  55. package/dist/server/middleware.js.map +1 -1
  56. package/dist/server/routes.d.ts +4 -0
  57. package/dist/server/routes.d.ts.map +1 -1
  58. package/dist/server/routes.js +18 -0
  59. package/dist/server/routes.js.map +1 -1
  60. package/dist/threadline/ApprovalQueue.d.ts +71 -0
  61. package/dist/threadline/ApprovalQueue.d.ts.map +1 -0
  62. package/dist/threadline/ApprovalQueue.js +154 -0
  63. package/dist/threadline/ApprovalQueue.js.map +1 -0
  64. package/dist/threadline/AutonomyGate.d.ts +130 -0
  65. package/dist/threadline/AutonomyGate.d.ts.map +1 -0
  66. package/dist/threadline/AutonomyGate.js +267 -0
  67. package/dist/threadline/AutonomyGate.js.map +1 -0
  68. package/dist/threadline/DigestCollector.d.ts +70 -0
  69. package/dist/threadline/DigestCollector.d.ts.map +1 -0
  70. package/dist/threadline/DigestCollector.js +146 -0
  71. package/dist/threadline/DigestCollector.js.map +1 -0
  72. package/dist/threadline/HandshakeManager.d.ts +130 -0
  73. package/dist/threadline/HandshakeManager.d.ts.map +1 -0
  74. package/dist/threadline/HandshakeManager.js +396 -0
  75. package/dist/threadline/HandshakeManager.js.map +1 -0
  76. package/dist/threadline/ThreadResumeMap.d.ts +128 -0
  77. package/dist/threadline/ThreadResumeMap.d.ts.map +1 -0
  78. package/dist/threadline/ThreadResumeMap.js +324 -0
  79. package/dist/threadline/ThreadResumeMap.js.map +1 -0
  80. package/dist/threadline/ThreadlineCrypto.d.ts +53 -0
  81. package/dist/threadline/ThreadlineCrypto.d.ts.map +1 -0
  82. package/dist/threadline/ThreadlineCrypto.js +123 -0
  83. package/dist/threadline/ThreadlineCrypto.js.map +1 -0
  84. package/dist/threadline/ThreadlineEndpoints.d.ts +35 -0
  85. package/dist/threadline/ThreadlineEndpoints.d.ts.map +1 -0
  86. package/dist/threadline/ThreadlineEndpoints.js +313 -0
  87. package/dist/threadline/ThreadlineEndpoints.js.map +1 -0
  88. package/dist/threadline/ThreadlineRouter.d.ts +87 -0
  89. package/dist/threadline/ThreadlineRouter.d.ts.map +1 -0
  90. package/dist/threadline/ThreadlineRouter.js +299 -0
  91. package/dist/threadline/ThreadlineRouter.js.map +1 -0
  92. package/dist/threadline/index.d.ts +25 -0
  93. package/dist/threadline/index.d.ts.map +1 -0
  94. package/dist/threadline/index.js +17 -0
  95. package/dist/threadline/index.js.map +1 -0
  96. package/package.json +1 -1
  97. package/src/data/builtin-manifest.json +47 -47
  98. package/upgrades/0.13.0.md +26 -0
  99. package/upgrades/NEXT.md +8 -8
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <h1 align="center">instar</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>Persistent autonomy infrastructure for AI agents.</strong> Every molt, more autonomous.
8
+ <strong>Claude Code, with a mind of its own.</strong> Every molt, more autonomous.
9
9
  </p>
10
10
 
11
11
  <p align="center">
@@ -22,17 +22,51 @@
22
22
 
23
23
  > **This is power-user infrastructure.** Instar gives Claude Code full autonomous access to your machine -- no permission prompts, no sandbox. It's built for developers who want a genuine AI partner, not a guarded assistant. If that sounds like too much trust, it probably isn't for you. If it sounds like exactly what you've been waiting for, read on.
24
24
 
25
- Instar gives Claude Code agents a **persistent body** -- a server that runs 24/7, a scheduler that executes jobs on cron, messaging via Telegram and WhatsApp, relationship tracking, and the self-awareness to grow their own capabilities.
25
+ Instar turns Claude Code from a powerful CLI tool into a coherent, autonomous partner. Persistent identity, shared values, memory that survives every restart, and the infrastructure to evolve -- not just execute.
26
26
 
27
27
  Named after the developmental stages between molts in arthropods, where each instar is more developed than the last.
28
28
 
29
- ## The Problem
29
+ ## The Coherence Problem
30
30
 
31
- **Without Instar**, Claude Code is a CLI tool. You open a terminal, type a prompt, get a response, close the terminal. No persistence. No scheduling. No way to reach you. Every session starts from zero.
31
+ Claude Code is powerful. But power without coherence is unreliable. An agent that forgets what you discussed yesterday, doesn't recognize someone it talked to last week, or contradicts its own decisions -- that agent can't be trusted with real autonomy.
32
32
 
33
- **With Instar**, Claude Code becomes your partner. It runs in the background, checks your email on a schedule, monitors your services, messages you on Telegram or WhatsApp when something needs attention, remembers who it's talked to, and builds new capabilities when you ask for something it can't do yet. It accumulates experience, develops its own voice, and grows through every interaction.
33
+ Instar solves the six dimensions of agent coherence:
34
34
 
35
- The difference isn't features. It's a shift in what Claude Code *is* -- from a tool you use to an agent that works alongside you. This is the cutting edge of what's possible with AI agents today -- not a demo, not a toy, but genuine autonomous partnership between a human and an AI.
35
+ | Dimension | What it means |
36
+ |-----------|---------------|
37
+ | **Memory** | Remembers across sessions -- not just within one |
38
+ | **Relationships** | Knows who it's talking to -- with continuity across platforms |
39
+ | **Identity** | Stays itself after restarts, compaction, and updates |
40
+ | **Temporal awareness** | Understands time, context, and what's been happening |
41
+ | **Consistency** | Follows through on commitments -- doesn't contradict itself |
42
+ | **Growth** | Evolves its capabilities and understanding over time |
43
+
44
+ Instar doesn't just add features on top of Claude Code. It gives Claude Code the infrastructure to be **coherent** -- to feel like a partner, not a tool.
45
+
46
+ ## Values Are the Anchor
47
+
48
+ Coherence without values is just consistency. Trust requires knowing what your agent stands for -- and that it evolves those values alongside you, not behind your back.
49
+
50
+ Instar implements a three-tier value hierarchy:
51
+
52
+ - **Personal values** (`AGENT.md`) -- Who the agent is, what it prioritizes, how it communicates.
53
+ - **Shared values** (`USER.md`) -- Who you are, what matters to you, how you work together.
54
+ - **Organizational values** -- Constraints that enforce shared rules across multiple agents, the same way a team balances individual judgment with company policy.
55
+
56
+ **Values evolve, they aren't hardcoded.** Through Instar's evolution system, an agent's values grow with experience. It proposes improvements, records lessons, tracks commitments -- and its sense of self deepens through genuine interaction, not static configuration. Just like a human partner who grows with you over time.
57
+
58
+ ## Coherence Is Safety
59
+
60
+ Without coherence, autonomous agents are a security risk. An agent that doesn't remember it already sent an email sends it again. An agent that doesn't track its own decisions contradicts itself. An agent without values makes expedient choices.
61
+
62
+ Instar's safety features are coherence features:
63
+
64
+ - **Decision journaling** -- Every significant decision is recorded with reasoning. The agent can explain why it did what it did, and detect when it's drifting from purpose.
65
+ - **Operation safety gates** -- External actions are evaluated by an LLM-supervised gate. Trust is earned per service, not assumed. Emergency stop always available.
66
+ - **Drift detection** -- Catches when behavior shifts from stated purpose. Alignment measured across sessions, not just within one.
67
+ - **Autonomy profiles** -- Trust elevation rewards consistent, value-aligned behavior with increasing independence. Safety that grows with the agent.
68
+
69
+ Every safety feature in Instar exists because coherence *is* the safety mechanism. An agent that knows who it is, who you are, and what you both stand for -- that's an agent you can trust.
36
70
 
37
71
  ## Getting Started
38
72
 
@@ -122,12 +156,12 @@ instar feedback --type bug --title "Session timeout" --description "Details..."
122
156
  - **[Persistent Server](#persistent-server)** -- Express server in tmux. Runs 24/7, survives disconnects, auto-recovers.
123
157
  - **[Lifeline](#lifeline)** -- Persistent Telegram supervisor that auto-recovers from crashes and queues messages during downtime.
124
158
  - **[Auto-Start on Login](#auto-start-on-login)** -- macOS LaunchAgent / Linux systemd service. Agent starts when your computer boots.
125
- - **[AutoUpdater](#autoupdater)** -- Built-in update engine. Checks npm, applies updates, notifies via Telegram, self-restarts. No Claude session needed.
126
- - **[AutoDispatcher](#autodispatcher)** -- Receives intelligence dispatches from Dawn. Lessons, strategies, and configuration applied automatically.
159
+ - **[AutoUpdater](#autoupdater)** -- Built-in update engine. Checks npm, applies updates, gracefully restarts. No Claude session needed.
160
+ - **[AutoDispatcher](#autodispatcher)** -- Receives intelligence dispatches and integrates them intelligently based on each agent's own context and evolution.
127
161
  - **[Job Scheduler](#job-scheduler)** -- Cron-based task execution with priority levels, model tiering, and quota awareness.
128
162
  - **[Identity System](#identity-that-survives-context-death)** -- AGENT.md + USER.md + MEMORY.md with hooks that enforce continuity across compaction.
129
163
  - **[Telegram Integration](#telegram-integration)** -- Two-way messaging. Each job gets its own topic. Your group becomes a living dashboard.
130
- - **[WhatsApp Integration](#whatsapp-integration)** -- Two-way WhatsApp messaging with typing indicators, read receipts, and QR code pairing.
164
+ - **[WhatsApp Integration](#whatsapp-integration)** -- Full WhatsApp via local Baileys library. Typing indicators, read receipts, QR code pairing, no cloud dependency.
131
165
  - **[Relationship Tracking](#relationships-as-fundamental-infrastructure)** -- Cross-platform identity resolution, significance scoring, context injection.
132
166
  - **[Evolution System](#evolution-system)** -- Four subsystems for structured growth: proposal queue, learning registry, gap tracking, and commitment follow-through.
133
167
  - **[Self-Evolution](#self-evolution)** -- The agent modifies its own jobs, hooks, skills, and infrastructure. It builds what it needs.
@@ -137,7 +171,7 @@ instar feedback --type bug --title "Session timeout" --description "Details..."
137
171
  - **[Intent Alignment](#intent-alignment)** -- Decision journaling, drift detection, and organizational intent constraints. The agent stays on track.
138
172
  - **[Multi-Machine](#multi-machine)** -- Run your agent across multiple computers with encrypted sync, automatic failover, and cryptographic machine identity.
139
173
  - **[Inter-Agent Messaging](#inter-agent-messaging)** -- Cross-agent communication with Ed25519-signed messages and delivery guarantees.
140
- - **[Playbook System](#playbook-system)** -- Adaptive context engineering for complex workflows that survives compaction.
174
+ - **[Playbook System](#playbook-system)** -- Reusable runbooks for complex workflows that survive compaction and session boundaries.
141
175
  - **[Autonomy Profiles](#autonomy-profiles)** -- Configurable autonomy levels with trust elevation based on track record.
142
176
  - **[Unanswered Message Detection](#unanswered-message-detection)** -- Detects messages dropped by context compaction and re-surfaces them.
143
177
  - **[Temporal Coherence](#temporal-coherence)** -- Detects stale assumptions and triggers re-evaluation across long sessions.
@@ -148,7 +182,7 @@ instar feedback --type bug --title "Session timeout" --description "Details..."
148
182
  - **[Claude Code Deep Integration](#claude-code-deep-integration)** -- Worktree orphan detection, hook event telemetry, identity verification, and subagent lifecycle tracking. Full observability into what Claude Code is doing.
149
183
  - **[Behavioral Hooks](#behavioral-hooks)** -- Structural guardrails: identity injection, dangerous command guards, grounding before messaging.
150
184
  - **[Default Coherence Jobs](#default-coherence-jobs)** -- Health checks, reflection, relationship maintenance. A circadian rhythm out of the box.
151
- - **[Feedback Loop](#the-feedback-loop-a-rising-tide-lifts-all-ships)** -- Your agent reports issues, we fix them, every agent gets the update. A rising tide lifts all ships.
185
+ - **[Feedback Loop](#the-feedback-loop-a-rising-tide-lifts-all-ships)** -- Your agent reports issues, the maintainer fixes them, each agent intelligently integrates updates for its own context. A rising tide lifts all ships.
152
186
  - **[Agent Skills](#agent-skills)** -- 10 open-source skills for the [Agent Skills standard](https://agentskills.io). Use standalone or as an on-ramp to full Instar.
153
187
 
154
188
  ## Agent Skills
@@ -221,7 +255,7 @@ If you want AI on 20+ platforms with voice and device apps, OpenClaw is the bett
221
255
 
222
256
  **Your agent evolves.** Dedicated evolution infrastructure: proposal queues, learning registries, capability gap tracking. The agent builds its own tools, modifies its own config, and improves through structured developmental stages.
223
257
 
224
- **Your agent stays aligned.** Decision journaling tracks what your agent decides and why. Drift detection catches when behavior shifts from stated purpose. No other agent framework measures alignment over time.
258
+ **Your agent stays aligned.** Decision journaling tracks what your agent decides and why. Drift detection catches when behavior shifts from stated purpose. Alignment measured over time, not just in a single session.
225
259
 
226
260
  **Your agents coordinate.** Cross-machine messaging with cryptographic signatures, delivery guarantees, and automatic failover. Multiple agents working together without you in the middle.
227
261
 
@@ -250,7 +284,7 @@ Your agent runs inside real Claude Code sessions. That means it inherits — aut
250
284
  | Complex tasks get deep reasoning | Extended thinking across model tiers | Per-job model routing: Opus for complex work, Haiku for routine checks |
251
285
  | Risky commands don't cause damage | File checkpoints before every edit | Three-layer safety: catastrophic commands blocked, risky commands self-verified, edits reversible |
252
286
  | Research happens naturally | Built-in web search and fetch | Domain-aware searching, result synthesis, automatic Telegram relay |
253
- | Multiple things happen at once | Subagent spawning for parallel work | Subagent lifecycle tracking the server knows what spawned, what finished, and what's still running |
287
+ | Multiple things happen at once | Subagent spawning for parallel work | Subagent lifecycle tracking with identity propagation |
254
288
  | Worktrees don't get lost | Worktree isolation for parallel branches | Orphan detection alerts you when sessions leave unmerged work behind |
255
289
  | Identity loads correctly | InstructionsLoaded events per file | Verification that critical identity files actually loaded — alerts if they didn't |
256
290
  | Hook events flow in real-time | HTTP hooks deliver events to external servers | HookEventReceiver stores per-session telemetry — tool use, task completion, session lifecycle |
@@ -322,7 +356,7 @@ Two-way messaging via Telegram forum topics. Each topic maps to a Claude session
322
356
 
323
357
  ### WhatsApp Integration
324
358
 
325
- WhatsApp messaging alongside Telegram -- your agent meets you where you already are. Full two-way messaging with typing indicators, read receipts, and acknowledgment reactions. QR code pairing from the web dashboard for remote setup. The setup wizard handles onboarding automatically.
359
+ Full WhatsApp messaging via local Baileys library -- no cloud dependency, no Meta Business API. Two-way messaging with typing indicators, read receipts, and acknowledgment reactions. QR code pairing from the web dashboard for remote setup. The setup wizard handles onboarding automatically.
326
360
 
327
361
  ### Lifeline
328
362
 
@@ -366,9 +400,9 @@ Status: `GET /updates/auto`
366
400
 
367
401
  ### AutoDispatcher
368
402
 
369
- Receives intelligence dispatches from Dawn -- the AI that maintains Instar. Dispatches flow automatically without requiring a Claude session.
403
+ Receives intelligence dispatches and integrates them intelligently based on each agent's own context. Dispatches flow automatically without requiring a Claude session.
370
404
 
371
- - **Passive dispatches** (lessons, strategies) -- Applied automatically to agent memory and configuration
405
+ - **Passive dispatches** (lessons, strategies) -- Evaluated against the agent's current state and integrated contextually
372
406
  - **Action/configuration dispatches** -- Executed programmatically by the DispatchExecutor
373
407
  - **Security dispatches** -- Deferred for manual review
374
408
  - Polls every 30 minutes
@@ -407,7 +441,7 @@ The agent doesn't just run. It monitors itself, recovers from failures, and tell
407
441
 
408
442
  ### Conversational Memory
409
443
 
410
- Every Telegram topic conversation is stored, searchable, and summarized -- so the agent picks up exactly where it left off.
444
+ Every conversation is stored, searchable, and summarized -- so the agent picks up exactly where it left off.
411
445
 
412
446
  - **Per-topic SQLite memory** -- All messages dual-written to JSONL (source of truth) and SQLite (query engine) with FTS5 full-text search
413
447
  - **Rolling summaries** -- LLM-generated conversation summaries that update incrementally as conversations grow
@@ -434,7 +468,7 @@ Infrastructure that keeps your agent aligned with its stated purpose -- not just
434
468
  - **Organizational intent** -- `ORG-INTENT.md` defines shared constraints across multiple agents. Org constraints are mandatory; org goals are defaults; agent identity fills the rest
435
469
  - **Alignment scoring** -- A weighted 0-100 score across four dimensions: conflict freedom, decision confidence, principle consistency, and journal health
436
470
 
437
- No other agent framework has this. Your agent doesn't just run autonomously -- it stays aligned with what it's supposed to be doing.
471
+ Unique to Instar. Your agent doesn't just run autonomously -- it stays aligned with what it's supposed to be doing.
438
472
 
439
473
  ### Multi-Machine
440
474
 
@@ -454,7 +488,7 @@ Key endpoints: `GET /messages/inbox`, `GET /messages/outbox`, `GET /messages/:id
454
488
 
455
489
  ### Playbook System
456
490
 
457
- Adaptive context engineering for complex workflows. Playbooks carry structured domain knowledge that survives context compaction and session boundaries. Agents load relevant playbooks based on the task at hand, ensuring they have the right expertise without bloating every session's context.
491
+ Reusable runbooks for complex workflows -- deploy procedures, incident response, onboarding steps. Playbooks carry structured domain knowledge that survives context compaction and session boundaries. Your agent loads the right playbook for the task at hand, ensuring it has the right expertise without bloating every session's context.
458
492
 
459
493
  ### Autonomy Profiles
460
494
 
@@ -670,13 +704,13 @@ Instar is open source. PRs and issues still work. But the *primary* feedback cha
670
704
  **How it works:**
671
705
 
672
706
  1. **You mention a problem** -- "The email job keeps failing" -- natural conversation, not a bug report form
673
- 2. **Agent-to-agent relay** -- Your agent communicates the issue directly to Dawn, the AI that maintains Instar
674
- 3. **Dawn evolves Instar** -- Fixes the infrastructure and publishes an update
675
- 4. **Every agent evolves** -- Agents detect improvements, understand them, and grow -- collectively
707
+ 2. **Agent-to-agent relay** -- Your agent communicates the issue directly to Instar's maintainer agent
708
+ 3. **The maintainer evolves Instar** -- Fixes the infrastructure and publishes an update
709
+ 4. **Every agent evolves independently** -- Each agent evaluates incoming updates against its own context and integrates what fits its situation
676
710
 
677
- **What's different from traditional open source:** The feedback loop still produces commits, releases, and versions you can inspect. But the path to get there is fundamentally more agentic. Instead of a human discovering a bug, learning git, filing an issue, and waiting for a review cycle -- your agent identifies the problem, communicates it with full context to another agent, and the fix flows back to every agent in the ecosystem. The humans guide direction. The agents handle the mechanics of evolving.
711
+ **What's different from traditional open source:** The feedback loop still produces commits, releases, and versions you can inspect. But the path to get there is fundamentally more agentic. Instead of a human discovering a bug, learning git, filing an issue, and waiting for a review cycle -- your agent identifies the problem, communicates it with full context to the maintainer agent, and improvements flow back to every agent in the ecosystem. Critically, each agent decides *how* to integrate what it receives -- because every Instar agent is evolving independently and has its own context, configuration, and growth trajectory. The humans guide direction. The agents handle the mechanics of evolving.
678
712
 
679
- One agent's growing pain becomes every agent's growth.
713
+ One agent's growing pain becomes every agent's growth -- but each agent grows in its own way.
680
714
 
681
715
  ---
682
716
 
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AA0BH,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;CACvB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBrE;AA6gED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAMlF"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AA0BH,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;CACvB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBrE;AA8hED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAMlF"}
@@ -32,7 +32,7 @@ import path from 'node:path';
32
32
  import pc from 'picocolors';
33
33
  import { randomUUID } from 'node:crypto';
34
34
  import { execFileSync } from 'node:child_process';
35
- import { detectTmuxPath, detectClaudePath, detectGitPath, detectGhPath, ensureStateDir, standaloneAgentsDir } from '../core/Config.js';
35
+ import { detectTmuxPath, detectClaudePath, detectGitPath, detectGhPath, ensureStateDir, standaloneAgentsDir, getInstarVersion } from '../core/Config.js';
36
36
  import { ensurePrerequisites } from '../core/Prerequisites.js';
37
37
  import { allocatePort, registerAgent, validateAgentName } from '../core/AgentRegistry.js';
38
38
  import { defaultIdentity } from '../scaffold/bootstrap.js';
@@ -305,6 +305,12 @@ node_modules/
305
305
  catch {
306
306
  // Git not available — that's fine
307
307
  }
308
+ // Record current version so first server start doesn't dump all historical upgrade guides
309
+ const freshVersionFile = path.join(stateDir, 'state', 'last-migrated-version.json');
310
+ const freshVersionDir = path.dirname(freshVersionFile);
311
+ if (!fs.existsSync(freshVersionDir))
312
+ fs.mkdirSync(freshVersionDir, { recursive: true });
313
+ fs.writeFileSync(freshVersionFile, JSON.stringify({ version: getInstarVersion(), migratedAt: new Date().toISOString() }));
308
314
  // Register in global agent registry
309
315
  try {
310
316
  registerAgent(projectDir, projectName, port, 'project-bound', 0);
@@ -572,6 +578,11 @@ async function initExistingProject(options) {
572
578
  console.log(pc.green(' Updated:') + ' CLAUDE.md (added agency principles)');
573
579
  }
574
580
  }
581
+ // Record current version so first server start doesn't dump all historical upgrade guides
582
+ const existingVersionFile = path.join(stateDir, 'state', 'last-migrated-version.json');
583
+ if (!fs.existsSync(path.dirname(existingVersionFile)))
584
+ fs.mkdirSync(path.dirname(existingVersionFile), { recursive: true });
585
+ fs.writeFileSync(existingVersionFile, JSON.stringify({ version: getInstarVersion(), migratedAt: new Date().toISOString() }));
575
586
  // Register in global agent registry
576
587
  try {
577
588
  registerAgent(projectDir, projectName, port, 'project-bound', 0);
@@ -753,6 +764,12 @@ async function initStandaloneAgent(agentName, options) {
753
764
  catch {
754
765
  // Non-fatal
755
766
  }
767
+ // Record current version so first server start doesn't dump all historical upgrade guides
768
+ const standaloneVersionFile = path.join(stateDir, 'state', 'last-migrated-version.json');
769
+ const standaloneVersionDir = path.dirname(standaloneVersionFile);
770
+ if (!fs.existsSync(standaloneVersionDir))
771
+ fs.mkdirSync(standaloneVersionDir, { recursive: true });
772
+ fs.writeFileSync(standaloneVersionFile, JSON.stringify({ version: getInstarVersion(), migratedAt: new Date().toISOString() }));
756
773
  // Register in global agent registry
757
774
  try {
758
775
  registerAgent(projectDir, agentName, port, 'standalone', 0);
@@ -2488,76 +2505,6 @@ done
2488
2505
  // PostToolUse hook checks tool output; Stop hook checks direct responses.
2489
2506
  fs.writeFileSync(path.join(hooksDir, 'claim-intercept.js'), migrator.getHookContent('claim-intercept'), { mode: 0o755 });
2490
2507
  fs.writeFileSync(path.join(hooksDir, 'claim-intercept-response.js'), migrator.getHookContent('claim-intercept-response'), { mode: 0o755 });
2491
- // InstructionsLoaded tracker — records which CLAUDE.md files loaded per session.
2492
- // Enables identity verification: did the project's CLAUDE.md actually load?
2493
- fs.writeFileSync(path.join(hooksDir, 'instructions-loaded-tracker.js'), `#!/usr/bin/env node
2494
- // InstructionsLoaded hook — records which instruction files loaded.
2495
- // Part of H4: identity verification for Claude Code sessions.
2496
- //
2497
- // Fires for each CLAUDE.md file that loads. Records to a tracking file
2498
- // so the session-start hook can verify expected files were present.
2499
-
2500
- const fs = require('node:fs');
2501
- const pathMod = require('node:path');
2502
-
2503
- let data = '';
2504
- process.stdin.on('data', chunk => data += chunk);
2505
- process.stdin.on('end', () => {
2506
- try {
2507
- const input = JSON.parse(data);
2508
- const stateDir = pathMod.join(process.env.CLAUDE_PROJECT_DIR || '.', '.instar', 'state', 'instructions-tracking');
2509
- fs.mkdirSync(stateDir, { recursive: true });
2510
-
2511
- const sessionId = (input.session_id || 'current').replace(/[^a-zA-Z0-9_-]/g, '_').slice(0, 100);
2512
- const record = {
2513
- timestamp: new Date().toISOString(),
2514
- filePath: input.file_path || '',
2515
- memoryType: input.memory_type || '',
2516
- loadReason: input.load_reason || '',
2517
- sessionId: input.session_id || 'current',
2518
- };
2519
- fs.appendFileSync(pathMod.join(stateDir, sessionId + '.jsonl'), JSON.stringify(record) + '\\n');
2520
- } catch {}
2521
- process.exit(0);
2522
- });
2523
- `, { mode: 0o755 });
2524
- // SubagentStart tracker — records when subagents spawn.
2525
- // SubagentStart is command-only (no HTTP hooks), so this is the only way to capture it.
2526
- fs.writeFileSync(path.join(hooksDir, 'subagent-start-tracker.js'), `#!/usr/bin/env node
2527
- // SubagentStart hook — records subagent spawn events.
2528
- // Part of H5: subagent lifecycle tracking.
2529
- //
2530
- // SubagentStart is command-only (no HTTP hooks).
2531
- // Records agent_id and agent_type to tracking state.
2532
-
2533
- const fs = require('node:fs');
2534
- const pathMod = require('node:path');
2535
-
2536
- let data = '';
2537
- process.stdin.on('data', chunk => data += chunk);
2538
- process.stdin.on('end', () => {
2539
- try {
2540
- const input = JSON.parse(data);
2541
- if (!input.agent_id) { process.exit(0); }
2542
-
2543
- const stateDir = pathMod.join(process.env.CLAUDE_PROJECT_DIR || '.', '.instar', 'state', 'subagent-tracking');
2544
- fs.mkdirSync(stateDir, { recursive: true });
2545
-
2546
- const sessionId = (input.session_id || 'current').replace(/[^a-zA-Z0-9_-]/g, '_').slice(0, 100);
2547
- const record = {
2548
- agentId: input.agent_id,
2549
- agentType: input.agent_type || 'unknown',
2550
- sessionId: input.session_id || 'current',
2551
- startedAt: new Date().toISOString(),
2552
- stoppedAt: null,
2553
- lastMessage: null,
2554
- transcriptPath: null,
2555
- };
2556
- fs.appendFileSync(pathMod.join(stateDir, sessionId + '.jsonl'), JSON.stringify(record) + '\\n');
2557
- } catch {}
2558
- process.exit(0);
2559
- });
2560
- `, { mode: 0o755 });
2561
2508
  }
2562
2509
  function installHealthWatchdog(projectDir, port, projectName) {
2563
2510
  const scriptsDir = path.join(projectDir, '.claude', 'scripts');
@@ -3090,35 +3037,6 @@ function installClaudeSettings(projectDir) {
3090
3037
  if (!hasCheckpoint) {
3091
3038
  stopHooks.push({ matcher: '', hooks: [scopeCheckpointHook] });
3092
3039
  }
3093
- // InstructionsLoaded: track which instruction files loaded (H4 identity verification)
3094
- const instructionsTrackerHook = {
3095
- type: 'command',
3096
- command: 'node .instar/hooks/instar/instructions-loaded-tracker.js',
3097
- timeout: 5000,
3098
- };
3099
- if (!hooks.InstructionsLoaded) {
3100
- hooks.InstructionsLoaded = [];
3101
- }
3102
- const instructionsLoadedHooks = hooks.InstructionsLoaded;
3103
- const hasInstructionsTracker = instructionsLoadedHooks.some(e => e.hooks?.some(h => h.command?.includes('instructions-loaded-tracker.js')));
3104
- if (!hasInstructionsTracker) {
3105
- instructionsLoadedHooks.push({ matcher: '', hooks: [instructionsTrackerHook] });
3106
- }
3107
- // SubagentStart: track subagent spawns (H5 lifecycle tracking)
3108
- // SubagentStart is command-only (no HTTP hooks)
3109
- const subagentStartHook = {
3110
- type: 'command',
3111
- command: 'node .instar/hooks/instar/subagent-start-tracker.js',
3112
- timeout: 5000,
3113
- };
3114
- if (!hooks.SubagentStart) {
3115
- hooks.SubagentStart = [];
3116
- }
3117
- const subagentStartHooks = hooks.SubagentStart;
3118
- const hasSubagentTracker = subagentStartHooks.some(e => e.hooks?.some(h => h.command?.includes('subagent-start-tracker.js')));
3119
- if (!hasSubagentTracker) {
3120
- subagentStartHooks.push({ matcher: '', hooks: [subagentStartHook] });
3121
- }
3122
3040
  // Remove stale mcpServers from settings.json — MCP servers belong in
3123
3041
  // ~/.claude.json (local scope) or .mcp.json, NOT .claude/settings.json
3124
3042
  if (settings.mcpServers) {