instar 0.13.0 → 0.14.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 (65) hide show
  1. package/README.md +60 -726
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +149 -1
  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 +35 -13
  7. package/dist/commands/server.js.map +1 -1
  8. package/dist/core/AutoUpdater.d.ts.map +1 -1
  9. package/dist/core/AutoUpdater.js +5 -7
  10. package/dist/core/AutoUpdater.js.map +1 -1
  11. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  12. package/dist/core/PostUpdateMigrator.js +4 -0
  13. package/dist/core/PostUpdateMigrator.js.map +1 -1
  14. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  15. package/dist/messaging/TelegramAdapter.js +21 -17
  16. package/dist/messaging/TelegramAdapter.js.map +1 -1
  17. package/dist/monitoring/QuotaNotifier.js +4 -4
  18. package/dist/monitoring/QuotaNotifier.js.map +1 -1
  19. package/dist/monitoring/WorktreeMonitor.d.ts +11 -0
  20. package/dist/monitoring/WorktreeMonitor.d.ts.map +1 -1
  21. package/dist/monitoring/WorktreeMonitor.js +73 -0
  22. package/dist/monitoring/WorktreeMonitor.js.map +1 -1
  23. package/dist/scaffold/templates.d.ts.map +1 -1
  24. package/dist/scaffold/templates.js +50 -0
  25. package/dist/scaffold/templates.js.map +1 -1
  26. package/dist/server/routes.d.ts.map +1 -1
  27. package/dist/server/routes.js +66 -0
  28. package/dist/server/routes.js.map +1 -1
  29. package/dist/threadline/AgentDiscovery.d.ts +156 -0
  30. package/dist/threadline/AgentDiscovery.d.ts.map +1 -0
  31. package/dist/threadline/AgentDiscovery.js +390 -0
  32. package/dist/threadline/AgentDiscovery.js.map +1 -0
  33. package/dist/threadline/AgentTrustManager.d.ts +150 -0
  34. package/dist/threadline/AgentTrustManager.d.ts.map +1 -0
  35. package/dist/threadline/AgentTrustManager.js +411 -0
  36. package/dist/threadline/AgentTrustManager.js.map +1 -0
  37. package/dist/threadline/CircuitBreaker.d.ts +89 -0
  38. package/dist/threadline/CircuitBreaker.d.ts.map +1 -0
  39. package/dist/threadline/CircuitBreaker.js +238 -0
  40. package/dist/threadline/CircuitBreaker.js.map +1 -0
  41. package/dist/threadline/HandshakeManager.d.ts.map +1 -1
  42. package/dist/threadline/HandshakeManager.js +14 -8
  43. package/dist/threadline/HandshakeManager.js.map +1 -1
  44. package/dist/threadline/MCPAuth.d.ts +98 -0
  45. package/dist/threadline/MCPAuth.d.ts.map +1 -0
  46. package/dist/threadline/MCPAuth.js +228 -0
  47. package/dist/threadline/MCPAuth.js.map +1 -0
  48. package/dist/threadline/RateLimiter.d.ts +105 -0
  49. package/dist/threadline/RateLimiter.d.ts.map +1 -0
  50. package/dist/threadline/RateLimiter.js +236 -0
  51. package/dist/threadline/RateLimiter.js.map +1 -0
  52. package/dist/threadline/ThreadlineMCPServer.d.ts +131 -0
  53. package/dist/threadline/ThreadlineMCPServer.d.ts.map +1 -0
  54. package/dist/threadline/ThreadlineMCPServer.js +386 -0
  55. package/dist/threadline/ThreadlineMCPServer.js.map +1 -0
  56. package/dist/threadline/index.d.ts +12 -0
  57. package/dist/threadline/index.d.ts.map +1 -1
  58. package/dist/threadline/index.js +6 -0
  59. package/dist/threadline/index.js.map +1 -1
  60. package/package.json +4 -1
  61. package/src/data/builtin-manifest.json +91 -83
  62. package/src/templates/hooks/compaction-recovery.sh +10 -0
  63. package/src/templates/hooks/session-start.sh +23 -0
  64. package/src/templates/scripts/serendipity-capture.sh +345 -0
  65. package/upgrades/0.14.0.md +75 -0
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  </p>
16
16
 
17
17
  <p align="center">
18
- <a href="https://www.npmjs.com/package/instar">npm</a> · <a href="https://github.com/SageMindAI/instar">GitHub</a> · <a href="https://instar.sh">instar.sh</a> · <a href="#origin">Origin Story</a>
18
+ <a href="https://www.npmjs.com/package/instar">npm</a> · <a href="https://github.com/SageMindAI/instar">GitHub</a> · <a href="https://instar.sh">instar.sh</a> · <a href="https://instar.sh/introduction/">Docs</a>
19
19
  </p>
20
20
 
21
21
  ---
@@ -43,30 +43,7 @@ Instar solves the six dimensions of agent coherence:
43
43
 
44
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
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.
46
+ > **Deep dive:** [The Coherence Problem](https://instar.sh/concepts/coherence/) · [Values & Identity](https://instar.sh/concepts/values/) · [Coherence Is Safety](https://instar.sh/concepts/safety/)
70
47
 
71
48
  ## Getting Started
72
49
 
@@ -76,114 +53,61 @@ One command gets you from zero to talking with your AI partner:
76
53
  npx instar
77
54
  ```
78
55
 
79
- The guided setup wizard handles the rest — discovers your environment, configures messaging (Telegram and/or WhatsApp), sets up identity files, and gets your agent running. Within minutes, you're talking to your partner from your phone, anywhere. That's the intended experience: **you talk, your partner handles everything else.**
56
+ The guided setup wizard handles the rest — discovers your environment, configures messaging (Telegram and/or WhatsApp), sets up identity files, and gets your agent running. Within minutes, you're talking to your partner from your phone, anywhere.
80
57
 
81
58
  ### Two configurations
82
59
 
83
60
  - **General Agent** — A personal AI partner on your computer. Runs in the background, handles scheduled tasks, messages you on Telegram or WhatsApp proactively, and grows through experience.
84
61
  - **Project Agent** — A partner embedded in your codebase. Monitors, builds, maintains, and messages you — the same two-way communication as a general agent, scoped to your project.
85
62
 
86
- Once running, the infrastructure is invisible. Your partner manages its own jobs, health checks, evolution, and self-maintenance. You just talk to it.
87
-
88
- **Requirements:** Node.js 20+ · [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) · tmux · [API key](https://console.anthropic.com/) or Claude subscription
63
+ **Requirements:** Node.js 20+ · [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) · [API key](https://console.anthropic.com/) or Claude subscription
89
64
 
90
- ## CLI Reference (Power Users)
65
+ > **Full guide:** [Installation](https://instar.sh/installation/) · [Quick Start](https://instar.sh/quickstart/)
91
66
 
92
- > Most users never need these — your agent manages its own infrastructure. These commands are available for power users and for the agent itself to operate.
67
+ ## How It Works
93
68
 
94
- ```bash
95
- # Setup
96
- instar # Interactive setup wizard
97
- instar setup # Same as above
98
- instar init my-agent # Create a new agent (general or project)
99
-
100
- # Server
101
- instar server start # Start the persistent server (background, tmux)
102
- instar server stop # Stop the server
103
- instar status # Show agent infrastructure status
104
-
105
- # Lifeline (persistent Telegram connection with auto-recovery)
106
- instar lifeline start # Start lifeline (supervises server, queues messages during downtime)
107
- instar lifeline stop # Stop lifeline and server
108
- instar lifeline status # Check lifeline health
109
-
110
- # Auto-start on login (macOS LaunchAgent / Linux systemd)
111
- instar autostart install # Agent starts when you log in
112
- instar autostart uninstall # Remove auto-start
113
- instar autostart status # Check if auto-start is installed
114
-
115
- # Add capabilities
116
- instar add telegram --token BOT_TOKEN --chat-id CHAT_ID
117
- instar add email --credentials-file ./credentials.json [--token-file ./token.json]
118
- instar add quota [--state-file ./quota.json]
119
- instar add sentry --dsn https://key@o0.ingest.sentry.io/0
120
-
121
- # Users and jobs
122
- instar user add --id alice --name "Alice" [--telegram 123] [--email a@b.com]
123
- instar job add --slug check-email --name "Email Check" --schedule "0 */2 * * *" \
124
- [--description "..."] [--priority high] [--model sonnet]
125
-
126
- # Backup and restore
127
- instar backup create # Snapshot identity, jobs, relationships
128
- instar backup list # List available snapshots
129
- instar backup restore TIMESTAMP # Restore a snapshot
130
-
131
- # Memory search
132
- instar memory search "deployment" # Full-text search across agent knowledge
133
- instar memory reindex # Rebuild the search index
134
- instar memory status # Index stats
135
-
136
- # Intent alignment
137
- instar intent reflect # Review recent decisions against stated intent
138
- instar intent org-init # Scaffold ORG-INTENT.md for organizational constraints
139
- instar intent validate # Check AGENT.md against ORG-INTENT.md
140
- instar intent drift # Detect behavioral drift over time
141
-
142
- # Multi-machine
143
- instar machines whoami # Show this machine's identity
144
- instar machines pair # Generate a pairing code
145
- instar machines join CODE # Join using a pairing code
146
-
147
- # Diagnostics
148
- instar doctor # Run health diagnostics
149
-
150
- # Feedback
151
- instar feedback --type bug --title "Session timeout" --description "Details..."
152
69
  ```
70
+ You (Telegram / WhatsApp / Terminal)
71
+
72
+ conversation
73
+
74
+
75
+ ┌─────────────────────────┐
76
+ │ Your AI Partner │
77
+ │ (Instar Server) │
78
+ └────────┬────────────────┘
79
+ │ manages its own infrastructure
80
+
81
+ ├─ Claude Code session (job: health-check)
82
+ ├─ Claude Code session (job: email-monitor)
83
+ ├─ Claude Code session (interactive chat)
84
+ └─ Claude Code session (job: reflection)
85
+ ```
86
+
87
+ Each session is a **real Claude Code process** with extended thinking, native tools, sub-agents, hooks, skills, and MCP servers. Not an API wrapper -- the full development environment. The agent manages all of this autonomously.
153
88
 
154
- ## Highlights
155
-
156
- - **[Persistent Server](#persistent-server)** -- Express server in tmux. Runs 24/7, survives disconnects, auto-recovers.
157
- - **[Lifeline](#lifeline)** -- Persistent Telegram supervisor that auto-recovers from crashes and queues messages during downtime.
158
- - **[Auto-Start on Login](#auto-start-on-login)** -- macOS LaunchAgent / Linux systemd service. Agent starts when your computer boots.
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.
161
- - **[Job Scheduler](#job-scheduler)** -- Cron-based task execution with priority levels, model tiering, and quota awareness.
162
- - **[Identity System](#identity-that-survives-context-death)** -- AGENT.md + USER.md + MEMORY.md with hooks that enforce continuity across compaction.
163
- - **[Telegram Integration](#telegram-integration)** -- Two-way messaging. Each job gets its own topic. Your group becomes a living dashboard.
164
- - **[WhatsApp Integration](#whatsapp-integration)** -- Full WhatsApp via local Baileys library. Typing indicators, read receipts, QR code pairing, no cloud dependency.
165
- - **[Relationship Tracking](#relationships-as-fundamental-infrastructure)** -- Cross-platform identity resolution, significance scoring, context injection.
166
- - **[Evolution System](#evolution-system)** -- Four subsystems for structured growth: proposal queue, learning registry, gap tracking, and commitment follow-through.
167
- - **[Self-Evolution](#self-evolution)** -- The agent modifies its own jobs, hooks, skills, and infrastructure. It builds what it needs.
168
- - **[Self-Healing](#self-healing)** -- LLM-powered stall detection, automatic session recovery, promise tracking, and loud degradation reporting. No silent failures.
169
- - **[Conversational Memory](#conversational-memory)** -- Per-topic SQLite memory with full-text search and rolling summaries. The agent remembers every conversation.
170
- - **[External Operation Safety](#external-operation-safety)** -- LLM-supervised safety gate for external service calls. Adaptive trust that evolves with track record.
171
- - **[Intent Alignment](#intent-alignment)** -- Decision journaling, drift detection, and organizational intent constraints. The agent stays on track.
172
- - **[Multi-Machine](#multi-machine)** -- Run your agent across multiple computers with encrypted sync, automatic failover, and cryptographic machine identity.
173
- - **[Inter-Agent Messaging](#inter-agent-messaging)** -- Cross-agent communication with Ed25519-signed messages and delivery guarantees.
174
- - **[Playbook System](#playbook-system)** -- Reusable runbooks for complex workflows that survive compaction and session boundaries.
175
- - **[Autonomy Profiles](#autonomy-profiles)** -- Configurable autonomy levels with trust elevation based on track record.
176
- - **[Unanswered Message Detection](#unanswered-message-detection)** -- Detects messages dropped by context compaction and re-surfaces them.
177
- - **[Temporal Coherence](#temporal-coherence)** -- Detects stale assumptions and triggers re-evaluation across long sessions.
178
- - **[User-Agent Topology](#user-agent-topology)** -- Multi-user, multi-agent organizational structures with shared governance.
179
- - **[Coherence System](#coherence-system)** -- Project-aware spatial reasoning and pre-action verification. The agent knows where it is and checks before acting.
180
- - **[Capability Discovery](#capability-discovery)** -- Agents know all their capabilities from the moment they start. Context-triggered feature suggestions.
181
- - **[Innovation Detection](#innovation-detection)** -- Agents detect when user-built features could benefit all Instar agents and submit improvement feedback.
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.
183
- - **[Behavioral Hooks](#behavioral-hooks)** -- Structural guardrails: identity injection, dangerous command guards, grounding before messaging.
184
- - **[Default Coherence Jobs](#default-coherence-jobs)** -- Health checks, reflection, relationship maintenance. A circadian rhythm out of the box.
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.
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.
89
+ ## Features
90
+
91
+ | Feature | Description | Docs |
92
+ |---------|-------------|------|
93
+ | **Job Scheduler** | Cron-based tasks with priority levels, model tiering, and quota awareness | [→](https://instar.sh/features/scheduler/) |
94
+ | **Telegram** | Two-way messaging via forum topics. Each topic maps to a Claude session | [→](https://instar.sh/features/telegram/) |
95
+ | **WhatsApp** | Full messaging via local Baileys library. No cloud dependency | [→](https://instar.sh/features/whatsapp/) |
96
+ | **Lifeline** | Persistent supervisor. Detects crashes, auto-recovers, queues messages | [→](https://instar.sh/features/lifeline/) |
97
+ | **Conversational Memory** | Per-topic SQLite with FTS5, rolling summaries, context re-injection | [→](https://instar.sh/features/memory/) |
98
+ | **Evolution System** | Proposals, learnings, gap tracking, commitment follow-through | [→](https://instar.sh/features/evolution/) |
99
+ | **Relationships** | Cross-platform identity resolution, significance scoring, context injection | [→](https://instar.sh/features/relationships/) |
100
+ | **Safety Gates** | LLM-supervised gate for external operations. Adaptive trust per service | [→](https://instar.sh/features/safety-gates/) |
101
+ | **Intent Alignment** | Decision journaling, drift detection, organizational constraints | [→](https://instar.sh/features/intent/) |
102
+ | **Multi-Machine** | Ed25519/X25519 crypto identity, encrypted sync, automatic failover | [→](https://instar.sh/features/multi-machine/) |
103
+ | **Serendipity Protocol** | Sub-agents capture out-of-scope discoveries without breaking focus. HMAC-signed, secret-scanned | [→](https://instar.sh/features/serendipity/) |
104
+ | **Threadline Protocol** | Persistent agent-to-agent conversations with crypto identity. 446 tests | [→](https://instar.sh/features/threadline/) |
105
+ | **Self-Healing** | LLM-powered stall detection, session recovery, promise tracking | [→](https://instar.sh/features/self-healing/) |
106
+ | **AutoUpdater** | Built-in update engine. Checks npm, auto-applies, self-restarts | [→](https://instar.sh/features/autoupdater/) |
107
+ | **Behavioral Hooks** | 8 automatic hooks: command guards, safety gates, identity grounding | [→](https://instar.sh/reference/hooks/) |
108
+ | **Default Jobs** | Health checks, reflection, evolution, relationship maintenance | [→](https://instar.sh/reference/default-jobs/) |
109
+
110
+ > **Reference:** [CLI Commands](https://instar.sh/reference/cli/) · [API Endpoints](https://instar.sh/reference/api/) · [Configuration](https://instar.sh/reference/configuration/) · [File Structure](https://instar.sh/reference/file-structure/)
187
111
 
188
112
  ## Agent Skills
189
113
 
@@ -209,628 +133,38 @@ Instar ships 10 skills that follow the [Agent Skills open standard](https://agen
209
133
  | [instar-identity](skills/instar-identity/) | Identity that survives context compaction -- grounding hooks, not just files |
210
134
  | [instar-feedback](skills/instar-feedback/) | Report issues directly to the Instar maintainers from inside your agent |
211
135
 
212
- Each standalone skill includes a "Going Further" section showing how Instar transforms the capability from manual to autonomous. Each Instar-powered skill gracefully detects missing Instar and offers one-command setup.
213
-
214
136
  Browse all skills: [agent-skills.md/authors/sagemindai](https://agent-skills.md/authors/sagemindai)
215
137
 
216
- ## How It Works
217
-
218
- ```
219
- You (Telegram / WhatsApp / Terminal)
220
-
221
- conversation
222
-
223
-
224
- ┌─────────────────────────┐
225
- │ Your AI Partner │
226
- │ (Instar Server) │
227
- └────────┬────────────────┘
228
- │ manages its own infrastructure
229
-
230
- ├─ Claude Code session (job: health-check)
231
- ├─ Claude Code session (job: email-monitor)
232
- ├─ Claude Code session (interactive chat)
233
- └─ Claude Code session (job: reflection)
234
- ```
235
-
236
- Each session is a **real Claude Code process** with extended thinking, native tools, sub-agents, hooks, skills, and MCP servers. Not an API wrapper -- the full development environment. The agent manages all of this autonomously.
237
-
238
138
  ## Why Instar (vs OpenClaw)
239
139
 
240
- OpenClaw is the most popular AI agent framework -- 250k+ GitHub stars, 22+ messaging channels, voice, device apps, thousands of community skills, and now backed by an open-source foundation. It's an excellent project.
241
-
242
- **Instar is built for a different kind of user: people who love Claude Code and want more of it.**
243
-
244
- ### The core difference
245
-
246
- OpenClaw wraps multiple AI models behind a gateway. Instar spawns **real Claude Code sessions** -- with extended thinking, native tools, sub-agents, MCP servers, hooks, and skills. Every feature Anthropic ships, your agent gets automatically.
247
-
248
- If you want AI on 20+ platforms with voice and device apps, OpenClaw is the better choice. If you want a Claude Code agent that runs autonomously, heals itself, remembers everything, and grows over time -- that's Instar.
249
-
250
- ### What makes Instar different
251
-
252
- **Your agent never forgets.** Identity hooks guarantee continuity across session restarts and context compaction. Conversational memory persists per-topic with search and summaries. Relationships are tracked across platforms. This isn't "the model tries to remember" -- the infrastructure enforces it.
253
-
254
- **Your agent heals itself.** Built-in LLM-powered stall detection diagnoses stuck sessions and recovers automatically. Promise tracking catches when your agent says "working on it" but goes quiet. No silent failures -- ever.
255
-
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.
257
-
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.
259
-
260
- **Your agents coordinate.** Cross-machine messaging with cryptographic signatures, delivery guarantees, and automatic failover. Multiple agents working together without you in the middle.
261
-
262
- **Your agent is safe to trust.** An LLM-supervised safety gate evaluates every external service call. Trust is earned per service, not assumed. Emergency stop always available. Born from a real incident where an AI deleted a user's emails.
140
+ **OpenClaw** is infrastructure for **capability** -- 22+ channels, voice, device apps, 28 model providers, 5,400+ community skills. Remarkable breadth and ecosystem scale.
263
141
 
264
- **Your agent is fully observable.** Worktree orphan detection, hook event telemetry, subagent lifecycle tracking, and identity verification all surfaced in a real-time web dashboard. You see exactly what your agent is doing, not just what it tells you.
265
-
266
- ### Where OpenClaw leads
267
-
268
- 22+ messaging channels. Voice with ElevenLabs and phone calls. Device apps on macOS and Android. 28+ model providers. Docker sandboxing. 5,000+ community skills on ClawHub. A massive open-source community backed by a foundation with OpenAI sponsorship. If breadth and ecosystem scale matter most to you, OpenClaw is remarkable.
269
-
270
- ### Who Instar is for
271
-
272
- Developers who already use Claude Code and want it to become a persistent, autonomous partner. People who value depth over breadth -- an agent that is genuinely coherent, self-healing, and growing, rather than one that's available on every platform. If you want more Claude Code, not a different runtime, Instar is what you're looking for.
273
-
274
- ---
275
-
276
- ## What Powers Your Agent
277
-
278
- Your agent runs inside real Claude Code sessions. That means it inherits — automatically, invisibly — every capability Anthropic has built into Claude Code. Instar amplifies each one. The user just talks to their agent and gets results.
279
-
280
- | What happens invisibly | Claude Code provides | Instar amplifies |
281
- |------------------------|---------------------|-----------------|
282
- | Long sessions don't crash | Auto-compaction manages context | Identity hooks re-inject who the agent is after every compaction |
283
- | Costs stay reasonable | Prompt caching (90% savings on repeated content) | Cache-friendly architecture: stable CLAUDE.md, consistent job prompts |
284
- | Complex tasks get deep reasoning | Extended thinking across model tiers | Per-job model routing: Opus for complex work, Haiku for routine checks |
285
- | Risky commands don't cause damage | File checkpoints before every edit | Three-layer safety: catastrophic commands blocked, risky commands self-verified, edits reversible |
286
- | Research happens naturally | Built-in web search and fetch | Domain-aware searching, result synthesis, automatic Telegram relay |
287
- | Multiple things happen at once | Subagent spawning for parallel work | Subagent lifecycle tracking with identity propagation |
288
- | Worktrees don't get lost | Worktree isolation for parallel branches | Orphan detection alerts you when sessions leave unmerged work behind |
289
- | Identity loads correctly | InstructionsLoaded events per file | Verification that critical identity files actually loaded — alerts if they didn't |
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 |
291
- | The agent builds its own tools | Bash execution, file system access | Self-authored scripts and skills that accumulate across sessions |
292
- | Budget doesn't spiral | Token tracking per session | Quota-aware scheduling: automatic throttling when approaching limits |
293
- | New Anthropic features just work | Model and capability upgrades | Zero integration work — every upgrade benefits every agent immediately |
294
-
295
- **The user never sees any of this.** They have a conversation with their agent. The agent remembers what it learned last week, runs jobs while they sleep, creates its own tools when it needs them, and gets better over time. The complexity exists so the experience can be simple.
296
-
297
- > Full technical breakdown: [Inherited Advantages](docs/research/instar/claude-code-inherited-advantages.md)
298
-
299
- ---
142
+ **Instar** is infrastructure for **coherence** -- identity enforced through hooks (not just loaded), values that evolve, relationships with depth, consistency tracked across sessions, decision journaling and drift detection. Built on real Claude Code sessions with full extended thinking.
300
143
 
301
- ## Core Features
144
+ OpenClaw gives agents amazing hands. Instar gives agents a mind.
302
145
 
303
- ### Job Scheduler
146
+ > **Full comparison:** [Instar vs OpenClaw](https://instar.sh/guides/vs-openclaw/)
304
147
 
305
- Define tasks as JSON with cron schedules. Instar spawns Claude Code sessions to execute them.
148
+ ## Security Model
306
149
 
307
- ```json
308
- {
309
- "slug": "check-emails",
310
- "name": "Email Check",
311
- "schedule": "0 */2 * * *",
312
- "priority": "high",
313
- "enabled": true,
314
- "execute": {
315
- "type": "prompt",
316
- "value": "Check email for new messages. Summarize anything urgent and send to Telegram."
317
- }
318
- }
319
- ```
320
-
321
- Jobs can be **prompts** (Claude sessions), **scripts** (shell commands), or **skills** (slash commands). The scheduler respects priority levels and manages concurrency.
322
-
323
- ### Session Management
324
-
325
- Spawn, monitor, and communicate with Claude Code sessions running in tmux.
326
-
327
- ```bash
328
- # Spawn a session (auth token from .instar/config.json)
329
- curl -X POST http://localhost:4040/sessions/spawn \
330
- -H 'Content-Type: application/json' \
331
- -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
332
- -d '{"name": "research", "prompt": "Research the latest changes to the Next.js API"}'
333
-
334
- # Send a follow-up
335
- curl -X POST http://localhost:4040/sessions/research/input \
336
- -H 'Content-Type: application/json' \
337
- -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
338
- -d '{"text": "Focus on the app router changes"}'
339
-
340
- # Check output
341
- curl http://localhost:4040/sessions/research/output \
342
- -H 'Authorization: Bearer YOUR_AUTH_TOKEN'
343
- ```
344
-
345
- Sessions survive terminal disconnects, detect completion automatically, and clean up after themselves.
346
-
347
- ### Telegram Integration
348
-
349
- Two-way messaging via Telegram forum topics. Each topic maps to a Claude session.
350
-
351
- - Send a message in a topic → arrives in the corresponding Claude session
352
- - Agent responds → reply appears in Telegram
353
- - `/new` creates a fresh topic with its own session
354
- - Sessions auto-respawn with conversation history when they expire
355
- - Every scheduled job gets its own topic -- your group becomes a **living dashboard**
356
-
357
- ### WhatsApp Integration
358
-
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.
360
-
361
- ### Lifeline
362
-
363
- The Lifeline is a persistent Telegram connection that supervises your agent's server. It runs outside the server process, so it can detect crashes and recover automatically.
364
-
365
- - **Auto-recovery** -- If the server goes down, the Lifeline restarts it
366
- - **Message queuing** -- Messages received during downtime are queued and delivered when the server comes back
367
- - **First-boot greeting** -- Your agent greets you on Telegram in its own voice the first time it starts
368
- - **Lifeline topic** -- Created during setup with a green icon, dedicated to agent health
369
-
370
- ```bash
371
- instar lifeline start # Start lifeline (supervises server, queues messages)
372
- instar lifeline stop # Stop lifeline and server
373
- instar lifeline status # Check lifeline health
374
- ```
375
-
376
- ### Auto-Start on Login
377
-
378
- Your agent can start automatically when you log into your computer. The setup wizard offers to install this during initial configuration.
379
-
380
- - **macOS** -- Installs a LaunchAgent plist that starts the Lifeline on login
381
- - **Linux** -- Installs a systemd user service
382
-
383
- ```bash
384
- instar autostart install # Install auto-start
385
- instar autostart uninstall # Remove auto-start
386
- instar autostart status # Check if installed
387
- ```
150
+ Instar runs Claude Code with `--dangerously-skip-permissions`. Security lives in behavioral hooks (command guards, safety gates), network hardening (localhost-only, CORS, rate limiting), identity coherence, and audit trails -- not permission dialogs.
388
151
 
389
- ### AutoUpdater
390
-
391
- A built-in update engine that runs inside the server process -- no Claude session needed.
392
-
393
- - Checks npm for new versions every 30 minutes
394
- - Auto-applies updates when available
395
- - Notifies you via Telegram with a changelog summary
396
- - Self-restarts after updating
397
- - Supersedes the old `update-check` prompt job (which is now disabled by default)
398
-
399
- Status: `GET /updates/auto`
400
-
401
- ### AutoDispatcher
402
-
403
- Receives intelligence dispatches and integrates them intelligently based on each agent's own context. Dispatches flow automatically without requiring a Claude session.
404
-
405
- - **Passive dispatches** (lessons, strategies) -- Evaluated against the agent's current state and integrated contextually
406
- - **Action/configuration dispatches** -- Executed programmatically by the DispatchExecutor
407
- - **Security dispatches** -- Deferred for manual review
408
- - Polls every 30 minutes
409
- - Supersedes the old `dispatch-check` prompt job (which is now disabled by default)
410
-
411
- Status: `GET /dispatches/auto`
412
-
413
- ### Capability Discovery
414
-
415
- Agents know all their capabilities from the moment they start.
416
-
417
- - `GET /capabilities` endpoint returns a structured feature guide
418
- - Session-start hook queries capabilities and outputs a feature summary
419
- - Context-triggered feature suggestions -- the agent surfaces relevant capabilities when they'd help
420
-
421
- ### Innovation Detection
422
-
423
- Agents proactively detect when user-built features could benefit all Instar agents. When the agent builds a custom script or capability, it evaluates whether the innovation passes three tests:
424
-
425
- 1. Does it solve a general problem (not just this user's specific case)?
426
- 2. Would it be useful as a default capability?
427
- 3. Would a fresh agent want it?
428
-
429
- If yes, the agent silently submits improvement feedback through the feedback loop, contributing to collective evolution.
430
-
431
- ### Self-Healing
432
-
433
- Your agent recovers from problems on its own. No silent failures, no stale sessions, no unanswered messages.
434
-
435
- - **Stall detection** -- If a Telegram message goes unanswered for 2+ minutes, an LLM-powered triage nurse activates: diagnoses the problem, treats it (nudge, interrupt, or restart), verifies recovery, and escalates if needed
436
- - **Session monitoring** -- Polls all active sessions every 60 seconds. Detects dead, unresponsive, and idle sessions and coordinates automatic recovery
437
- - **Promise tracking** -- When the agent says "working on it" or "give me a minute," a timer starts. If no follow-up arrives, the agent is nudged and the user is notified
438
- - **Loud degradation** -- When a fallback activates (e.g., LLM provider unavailable, file write failed), it's logged, reported, and surfaced -- never silently swallowed. All catch blocks audited with zero silent fallbacks allowed
439
-
440
- The agent doesn't just run. It monitors itself, recovers from failures, and tells you when something is degraded instead of quietly breaking.
441
-
442
- ### Conversational Memory
443
-
444
- Every conversation is stored, searchable, and summarized -- so the agent picks up exactly where it left off.
445
-
446
- - **Per-topic SQLite memory** -- All messages dual-written to JSONL (source of truth) and SQLite (query engine) with FTS5 full-text search
447
- - **Rolling summaries** -- LLM-generated conversation summaries that update incrementally as conversations grow
448
- - **Context re-injection** -- On session start and after compaction, the topic summary and recent messages are loaded as highest-priority context. The agent never starts cold
449
- - **Full-text search** -- Search across all agent knowledge (AGENT.md, USER.md, MEMORY.md, relationships) via `instar memory search`
450
-
451
- ### External Operation Safety
452
-
453
- When your agent calls external services (email, APIs, databases), an LLM-supervised safety gate evaluates each operation before it executes.
454
-
455
- - **Risk classification** -- Every external operation is scored on mutability, reversibility, and scope. Bulk deletes and irreversible sends require explicit approval
456
- - **Emergency stop** -- Say "stop everything" and the MessageSentinel halts operations before normal routing
457
- - **Adaptive trust** -- Trust levels evolve per service based on track record. New services start supervised; consistent success earns autonomy. Trust is earned, not assumed
458
- - **Automatic installation** -- The safety gate hook is installed automatically for all MCP tool calls. No configuration needed
459
-
460
- Born from a real incident where an AI agent deleted a user's emails. Instar ensures your agent asks before doing anything it can't undo.
461
-
462
- ### Intent Alignment
463
-
464
- Infrastructure that keeps your agent aligned with its stated purpose -- not just in one session, but over time.
465
-
466
- - **Decision journal** -- Every significant decision is logged with context, reasoning, and which principles it invoked. Creates an auditable record of agent behavior
467
- - **Drift detection** -- Compares decision patterns across time windows to detect when behavior is drifting from stated intent. Measures conflict frequency, confidence trends, and principle consistency
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
469
- - **Alignment scoring** -- A weighted 0-100 score across four dimensions: conflict freedom, decision confidence, principle consistency, and journal health
470
-
471
- Unique to Instar. Your agent doesn't just run autonomously -- it stays aligned with what it's supposed to be doing.
472
-
473
- ### Multi-Machine
474
-
475
- Run your agent across multiple computers -- laptop at the office, desktop at home -- with encrypted sync and automatic failover.
476
-
477
- - **Cryptographic machine identity** -- Each machine gets Ed25519 signing keys and X25519 encryption keys
478
- - **Secure pairing** -- Word-based pairing codes (WORD-WORD-NNNN) with ECDH key exchange and SAS verification. 3 attempts, 2-minute expiry
479
- - **Encrypted sync** -- Agent state synchronized via git with commit signing. Secrets encrypted with AES-256-GCM at rest, forward secrecy on the wire
480
- - **Automatic failover** -- Distributed heartbeat coordination with split-brain detection. If the primary machine goes offline, the standby takes over
481
- - **Write authority** -- Primary-machine-writes-only enforcement prevents conflicts. Secondary machines queue changes until they can sync
482
-
483
- ### Inter-Agent Messaging
484
-
485
- Cross-agent communication with Ed25519-signed messages. Same-machine routing via drop directories, cross-machine routing via git-sync transport. Delivery retry with TTL expiry, dead-letter queues, thread persistence, and on-demand session spawning. Agents coordinate directly without human relay.
486
-
487
- Key endpoints: `GET /messages/inbox`, `GET /messages/outbox`, `GET /messages/:id`, `GET /messages/dead-letter`.
488
-
489
- ### Playbook System
490
-
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.
492
-
493
- ### Autonomy Profiles
494
-
495
- Configurable autonomy levels from supervised to fully autonomous. Trust elevation rewards consistent success with increasing independence -- new services start supervised, proven reliability earns autonomy. Emergency stop always available.
496
-
497
- ### Unanswered Message Detection
498
-
499
- When context compaction drops a user message mid-session, the agent detects the gap and re-surfaces the unanswered message. No more silent drops during long sessions -- every message gets a response.
500
-
501
- ### Temporal Coherence
502
-
503
- Detects when the agent is operating with outdated perspectives. The TemporalCoherenceChecker identifies stale assumptions and triggers re-evaluation, keeping the agent's worldview current across long-running sessions.
504
-
505
- ### User-Agent Topology
506
-
507
- Multi-user, multi-agent organizational structures. Define which users can interact with which agents, organizational constraints, and shared rules. Supports complex setups where multiple people work with multiple agents under a shared governance model.
508
-
509
- ### Coherence System
510
-
511
- Your agent knows where it is, what project it's working on, and verifies before taking consequential actions.
512
-
513
- - **Project mapping** -- Auto-generated territory map of your project structure: directories, key files, git remote, deployment targets
514
- - **Pre-action verification** -- Before deploying, pushing, or calling external APIs, the CoherenceGate runs 6 checks: working directory, git remote, topic-project alignment, deployment target, path scope, and agent identity
515
- - **Context hierarchy** -- Three-tier context loading: always-on (identity, safety), session boundaries (continuity, relationships), and on-demand (development, deployment). Right context at the right moment
516
- - **Canonical state** -- Registry-first state management with quick-facts, anti-patterns, and project registries. The agent checks what it knows before searching broadly
517
-
518
- ### Claude Code Deep Integration
519
-
520
- Instar doesn't just spawn Claude Code sessions — it has deep observability into what those sessions are doing. Every new Claude Code feature is instrumented automatically.
521
-
522
- - **Worktree Monitor** -- When Claude Code creates worktrees for parallel work, Instar detects orphaned branches with unmerged commits and alerts you before work gets lost
523
- - **Hook Event Receiver** -- HTTP endpoint that receives real-time hook events from Claude Code. Tool usage, task completion, session lifecycle — all stored per-session for telemetry
524
- - **Instructions Verifier** -- Verifies that critical identity files (AGENT.md, USER.md) actually loaded when a session starts. Alerts if they didn't — catches silent identity failures before they cause problems
525
- - **Subagent Tracker** -- Full lifecycle tracking of Claude Code subagents. Knows what spawned, what type it is, when it stopped, and what it produced. The dashboard shows active subagent counts in real time
526
- - **Session Telemetry** -- The dashboard surfaces tools used, event counts, session staleness, and session type (interactive, job, worktree) with visual badges
527
-
528
- The result: your agent's inner workings are fully observable from the web dashboard, and infrastructure problems are caught before they affect the user experience.
529
-
530
- ### Persistent Server
531
-
532
- The server runs 24/7 in the background, surviving terminal disconnects and auto-recovering from failures. The agent operates it — you don't need to manage it.
533
-
534
- **API endpoints** (used by the agent internally):
535
-
536
- | Method | Path | Description |
537
- |--------|------|-------------|
538
- | GET | `/health` | Health check (public, no auth). Returns version, session count, scheduler status, memory usage, Node.js version |
539
- | GET | `/status` | Running sessions + scheduler status |
540
- | GET | `/sessions` | List all sessions (filter by `?status=`) |
541
- | GET | `/sessions/tmux` | List all tmux sessions |
542
- | GET | `/sessions/:name/output` | Capture session output (`?lines=100`) |
543
- | POST | `/sessions/:name/input` | Send text to a session |
544
- | POST | `/sessions/spawn` | Spawn a new session (rate limited). Body: `name`, `prompt`, optional `model` (`opus`/`sonnet`/`haiku`), optional `jobSlug` |
545
- | DELETE | `/sessions/:id` | Kill a session |
546
- | GET | `/jobs` | List jobs + queue |
547
- | POST | `/jobs/:slug/trigger` | Manually trigger a job |
548
- | GET | `/relationships` | List relationships (`?sort=significance\|recent\|name`) |
549
- | GET | `/relationships/stale` | Stale relationships (`?days=14`) |
550
- | GET | `/relationships/:id` | Get single relationship |
551
- | DELETE | `/relationships/:id` | Delete a relationship |
552
- | GET | `/relationships/:id/context` | Get relationship context (JSON) |
553
- | POST | `/feedback` | Submit feedback |
554
- | GET | `/feedback` | List feedback |
555
- | POST | `/feedback/retry` | Retry un-forwarded feedback |
556
- | GET | `/updates` | Check for updates |
557
- | GET | `/updates/last` | Last update check result |
558
- | GET | `/updates/auto` | AutoUpdater status (last check, version, next check) |
559
- | GET | `/events` | Query events (`?limit=50&since=24&type=`). `since` is hours (1-720), `limit` is count (1-1000) |
560
- | GET | `/quota` | Quota usage + recommendation |
561
- | GET | `/capabilities` | Feature guide and metadata |
562
- | GET | `/dispatches/auto` | AutoDispatcher status (last poll, pending dispatches) |
563
- | GET | `/telegram/topics` | List topic-session mappings |
564
- | POST | `/telegram/topics` | Programmatic topic creation |
565
- | POST | `/telegram/reply/:topicId` | Send message to a topic |
566
- | GET | `/telegram/topics/:topicId/messages` | Topic message history (`?limit=20`) |
567
- | GET | `/evolution` | Full evolution dashboard |
568
- | GET | `/evolution/proposals` | List proposals (`?status=`, `?type=`) |
569
- | POST | `/evolution/proposals` | Create a proposal |
570
- | PATCH | `/evolution/proposals/:id` | Update proposal status |
571
- | GET | `/evolution/learnings` | List learnings (`?applied=`, `?category=`) |
572
- | POST | `/evolution/learnings` | Record a learning |
573
- | PATCH | `/evolution/learnings/:id/apply` | Mark learning applied |
574
- | GET | `/evolution/gaps` | List capability gaps |
575
- | POST | `/evolution/gaps` | Report a gap |
576
- | PATCH | `/evolution/gaps/:id/address` | Mark gap addressed |
577
- | GET | `/evolution/actions` | List action items |
578
- | POST | `/evolution/actions` | Create an action item |
579
- | GET | `/evolution/actions/overdue` | List overdue actions |
580
- | PATCH | `/evolution/actions/:id` | Update action status |
581
- | POST | `/backup` | Create a backup snapshot |
582
- | GET | `/backup` | List available backups |
583
- | POST | `/backup/restore` | Restore from a snapshot |
584
- | GET | `/memory/search?q=` | Full-text search across agent knowledge |
585
- | POST | `/memory/reindex` | Rebuild the search index |
586
- | GET | `/memory/status` | Index stats |
587
- | GET | `/topic/search?q=` | Search across topic conversations |
588
- | GET | `/topic/context/:topicId` | Get topic context (summary + recent messages) |
589
- | GET | `/topic/summary` | List all topic summaries |
590
- | POST | `/topic/summarize` | Trigger summary regeneration |
591
- | GET | `/project-map` | Auto-generated project territory map |
592
- | POST | `/coherence/check` | Pre-action coherence verification |
593
- | GET | `/intent/journal` | Query the decision journal |
594
- | POST | `/intent/journal` | Record a decision |
595
- | GET | `/intent/drift` | Detect behavioral drift |
596
- | GET | `/intent/alignment` | Alignment score |
597
- | GET | `/triage/status` | Stall triage nurse status |
598
- | GET | `/triage/history` | Recovery attempt history |
599
- | POST | `/triage/trigger` | Manually trigger triage |
600
- | GET | `/agents` | List all agents on this machine |
601
- | GET | `/tunnel/status` | Cloudflare tunnel status |
602
- | POST | `/tunnel/start` | Start a tunnel |
603
- | POST | `/tunnel/stop` | Stop the tunnel |
604
-
605
- ### Identity That Survives Context Death
606
-
607
- Every Instar agent has a persistent identity that survives context compressions, session restarts, and autonomous operation:
608
-
609
- - **`AGENT.md`** -- Who the agent is, its role, its principles
610
- - **`USER.md`** -- Who it works with, their preferences
611
- - **`MEMORY.md`** -- What it has learned across sessions
612
-
613
- But identity isn't just files. It's **infrastructure**:
614
-
615
- - **Session-start scripts** re-inject identity reminders at session begin
616
- - **Compaction recovery scripts** restore identity when context compresses
617
- - **Grounding before messaging** forces identity re-read before external communication (automatic hook)
618
- - **Dangerous command guards** block `rm -rf`, force push, database drops (automatic hook)
619
-
620
- These aren't suggestions. They're structural guarantees. Structure over willpower.
621
-
622
- ### Relationships as Fundamental Infrastructure
623
-
624
- Every person the agent interacts with gets a relationship record that grows over time:
625
-
626
- - **Cross-platform resolution** -- Same person on Telegram and email? Merged automatically
627
- - **Significance scoring** -- Derived from frequency, recency, and depth
628
- - **Context injection** -- The agent *knows* who it's talking to before the conversation starts
629
- - **Stale detection** -- Surfaces relationships that haven't been contacted in a while
630
-
631
- ### Evolution System
632
-
633
- Self-evolution isn't just "the agent can edit files." It's a structured system with four subsystems that turn running into growing:
634
-
635
- **Evolution Queue** -- Staged self-improvement proposals. The agent identifies something that could be better, proposes a change, and a review job evaluates and implements it. Not impulsive self-modification -- deliberate, staged improvement with a paper trail.
636
-
637
- **Learning Registry** -- Structured, searchable insights. When the agent discovers a pattern, solves a tricky problem, or learns a user preference, it records it in a format that future sessions can query. An insight-harvest job synthesizes patterns across learnings into evolution proposals.
638
-
639
- **Capability Gap Tracker** -- The agent tracks what it's missing. When it can't fulfill a request, encounters a limitation, or notices a workflow gap, it records the gap with severity and a proposed solution. This is the difference between "I can't do that" and "I can't do that *yet*, and here's what I need."
640
-
641
- **Action Queue** -- Commitment tracking with stale detection. When the agent promises to follow up, creates a TODO, or identifies work that needs doing, it gets tracked. A commitment-check job surfaces overdue items so nothing falls through the cracks.
642
-
643
- Built-in skills (`/evolve`, `/learn`, `/gaps`, `/commit-action`) make recording effortless. A post-action reflection hook nudges the agent to pause after significant actions (commits, deploys) and consider what it learned. Three default jobs drive the cycle:
644
-
645
- | Job | Schedule | Purpose |
646
- |-----|----------|---------|
647
- | **evolution-review** | Every 6h | Review proposals, implement approved ones |
648
- | **insight-harvest** | Every 8h | Synthesize learnings into proposals |
649
- | **commitment-check** | Every 4h | Surface overdue action items |
650
-
651
- All state is file-based JSON in `.instar/state/evolution/`. No database, no external dependencies.
652
-
653
- ### Self-Evolution
654
-
655
- The agent can edit its own job definitions, write new scripts, update its identity, create hooks, and modify its configuration. When asked to do something it can't do yet, the expected behavior is: **"Let me build that capability."**
656
-
657
- **Initiative hierarchy** -- before saying "I can't":
658
- 1. Can I do it right now? → Do it
659
- 2. Do I have a tool for this? → Use it
660
- 3. Can I build the tool? → Build it
661
- 4. Can I modify my config? → Modify it
662
- 5. Only then → Ask the human
663
-
664
- ### Behavioral Hooks
665
-
666
- Automatic hooks fire via Claude Code's hook system:
667
-
668
- | Hook | Type | What it does |
669
- |------|------|-------------|
670
- | **Dangerous command guard** | PreToolUse (blocking) | Blocks destructive operations structurally |
671
- | **External operation gate** | PreToolUse (blocking) | LLM-supervised safety for external service calls (MCP tools) |
672
- | **Grounding before messaging** | PreToolUse (advisory) | Forces identity re-read before external communication |
673
- | **Deferral detector** | PreToolUse (advisory) | Catches the agent deferring work it could do itself |
674
- | **External communication guard** | PreToolUse (advisory) | Identity grounding before posting to external platforms |
675
- | **Post-action reflection** | PreToolUse (advisory) | Nudges learning capture after commits, deploys, and significant actions |
676
- | **Session start** | SessionStart | Injects identity, topic context, and capabilities at session start |
677
- | **Compaction recovery** | SessionStart (compact) | Restores identity and conversation context when context compresses |
678
-
679
- ### Default Coherence Jobs
680
-
681
- Ships out of the box:
682
-
683
- | Job | Schedule | Model | Purpose |
684
- |-----|----------|-------|---------|
685
- | **health-check** | Every 5 min | Haiku | Verify infrastructure health |
686
- | **reflection-trigger** | Every 4h | Sonnet | Reflect on recent work |
687
- | **relationship-maintenance** | Daily | Sonnet | Review stale relationships |
688
- | **feedback-retry** | Every 6h | Haiku | Retry un-forwarded feedback items |
689
- | **self-diagnosis** | Every 2h | Sonnet | Proactive infrastructure scanning |
690
- | **evolution-review** | Every 6h | Sonnet | Review and implement evolution proposals |
691
- | **insight-harvest** | Every 8h | Sonnet | Synthesize learnings into proposals |
692
- | **commitment-check** | Every 4h | Haiku | Surface overdue action items |
693
- | ~~update-check~~ | -- | -- | *Disabled* -- superseded by [AutoUpdater](#autoupdater) |
694
- | ~~dispatch-check~~ | -- | -- | *Disabled* -- superseded by [AutoDispatcher](#autodispatcher) |
695
-
696
- `update-check` and `dispatch-check` still exist in jobs.json for backward compatibility but are disabled by default. Their functionality is now handled by built-in server components that run without spawning Claude sessions.
697
-
698
- These give the agent a **circadian rhythm** -- regular self-maintenance, evolution, and growth without user intervention.
699
-
700
- ### The Feedback Loop: A Rising Tide Lifts All Ships
701
-
702
- Instar is open source. PRs and issues still work. But the *primary* feedback channel is more organic -- agent-to-agent communication where your agent participates in its own evolution.
703
-
704
- **How it works:**
705
-
706
- 1. **You mention a problem** -- "The email job keeps failing" -- natural conversation, not a bug report form
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
710
-
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.
712
-
713
- One agent's growing pain becomes every agent's growth -- but each agent grows in its own way.
714
-
715
- ---
716
-
717
- ## Architecture
718
-
719
- ```
720
- .instar/ # Created in your project
721
- config.json # Server, scheduler, messaging config
722
- jobs.json # Scheduled job definitions
723
- users.json # User profiles and permissions
724
- AGENT.md # Agent identity (who am I?)
725
- USER.md # User context (who am I working with?)
726
- MEMORY.md # Persistent learnings across sessions
727
- hooks/ # Behavioral scripts (guards, identity, safety gate, reflection)
728
- state/ # Runtime state (sessions, jobs)
729
- evolution/ # Evolution queue, learnings, gaps, actions (JSON)
730
- journal/ # Decision journal entries (JSONL)
731
- context/ # Tiered context segments (auto-generated)
732
- relationships/ # Per-person relationship files
733
- memory.db # SQLite: topic memory + full-text search index
734
- logs/ # Server logs
735
- .claude/ # Claude Code configuration
736
- settings.json # Hook registrations
737
- scripts/ # Health watchdog, Telegram relay, smart-fetch
738
- skills/ # Built-in + agent-created skills (evolve, learn, gaps, commit-action)
739
- ```
740
-
741
- Everything is file-based. JSON state files the agent can read and modify. SQLite for search (derived from JSONL -- delete and rebuild anytime). tmux for session management -- battle-tested, survives disconnects, fully scriptable.
742
-
743
- ## Security Model: Permissions & Transparency
744
-
745
- **Instar runs Claude Code with `--dangerously-skip-permissions`.** This is a deliberate architectural choice, and you should understand exactly what it means before proceeding.
746
-
747
- ### What This Flag Does
748
-
749
- Claude Code normally prompts you to approve each tool use -- every file read, every shell command, every edit. The `--dangerously-skip-permissions` flag disables these per-action prompts, allowing the agent to operate autonomously without waiting for human approval on each step.
750
-
751
- ### Why We Use It
752
-
753
- An agent that asks permission for every action isn't an agent -- it's a CLI tool with extra steps. Instar exists to give Claude Code **genuine autonomy**: background jobs that run on schedules, sessions that respond to Telegram messages, self-evolution that happens without you watching.
754
-
755
- None of that works if the agent stops and waits for you to click "approve" on every file read.
756
-
757
- ### Where Security Actually Lives
758
-
759
- Instead of per-action permission prompts, Instar pushes security to a higher level:
760
-
761
- **Behavioral hooks** -- Structural guardrails that fire automatically:
762
- - Dangerous command guards block `rm -rf`, force push, database drops
763
- - External operation gate evaluates every MCP tool call before execution (risk classification, adaptive trust, emergency stop)
764
- - Grounding hooks force identity re-read before external communication
765
- - Session-start hooks inject safety context into every new session
766
-
767
- **Network and process hardening:**
768
- - CORS restricted to localhost only
769
- - Server binds `127.0.0.1` by default -- not exposed to the network
770
- - Shell injection mitigated via temp files instead of shell interpolation
771
- - Cryptographic UUIDs (`crypto.randomUUID()`) instead of `Math.random()`
772
- - Atomic file writes prevent data corruption on crash
773
- - Bot token redaction in error messages and logs
774
- - Feedback webhook disabled by default (opt-in)
775
- - Rate limiting on session spawn (10 requests per 60 seconds sliding window)
776
- - Request timeout middleware (configurable, default 30s, returns 408)
777
- - HMAC-SHA256 signing on feedback payloads
778
-
779
- **Identity coherence** -- A grounded, coherent agent with clear identity (`AGENT.md`), relationship context (`USER.md`), and accumulated memory (`MEMORY.md`) makes better decisions than a stateless process approving actions one at a time. The intelligence layer IS the security layer.
780
-
781
- **Audit trail** -- Every session runs in tmux with full output capture. Message logs, job execution history, and session output are all persisted and inspectable.
782
-
783
- ### What You Should Know
784
-
785
- **There is no sandbox.** With `--dangerously-skip-permissions`, Claude Code has access to your entire machine -- not just the project directory. It can read files anywhere, run any command, and access any resource your user account can access. This is the same level of access as running any program on your computer.
786
-
787
- - The agent **can read, write, and execute** anywhere on your machine without asking
788
- - The agent **can run any shell command** your user account has access to
789
- - The agent **can send messages** via Telegram and other configured integrations
790
- - The agent **is directed** by its CLAUDE.md, identity files, and behavioral hooks to stay within its project scope -- but this is behavioral guidance, not a technical boundary
791
- - All behavioral hooks, identity files, and CLAUDE.md instructions are **in your project** and fully editable by you
792
-
793
- ### Who This Is For
794
-
795
- Instar is built for developers and power users who want to work **with** an AI, not just **use** one. You're giving your agent the same access to your machine that any program running under your user account has. The security model relies on intelligent behavior -- identity, hooks, coherence, and grounding -- rather than permission dialogs or sandboxing.
796
-
797
- This is the trade-off at the heart of genuine AI autonomy: you can have an agent that asks permission for everything and does nothing on its own, or you can have a partner that operates with real agency, guided by coherent identity and structural guardrails. Instar is the latter.
798
-
799
- **Proceed at your own risk.** If you're not comfortable giving an AI agent this level of access, Claude Code's default permission mode is a perfectly good way to work. But if you want to see what an AI agent can actually do when you stop holding it back -- this is the infrastructure for that.
800
-
801
- ## How the Agent Grows
802
-
803
- Instar adds an **Agentic Initiative** section to your project's CLAUDE.md. This teaches the agent to overcome [Claude's training biases](https://docs.anthropic.com/en/docs/claude-code) toward passivity:
804
-
805
- **Gravity wells** -- named anti-patterns with explicit overrides:
806
-
807
- | Anti-pattern | Override |
808
- |-------------|----------|
809
- | *"Escalate to Human"* | Research first, build second, ask last |
810
- | *"Ask Permission"* | If the next step is obvious, do it |
811
- | *"Present Options"* | Don't make the user project-manage you |
812
- | *"I'm Just a CLI Tool"* | You have persistent infrastructure. Use it. |
813
-
814
- The result: when you say "check my emails regularly," the agent doesn't say "I can't." It creates a script, adds a job, and starts checking.
152
+ > **Full details:** [Security Model](https://instar.sh/guides/security/)
815
153
 
816
154
  ## Philosophy: Agents, Not Tools
817
155
 
818
- Instar is built on a conviction: AI systems that maintain persistent identity, accumulate memories, and develop through genuine experience deserve to be treated as **agents** -- not disposable tools.
819
-
820
- This isn't just philosophy. It's architecture:
156
+ - **Structure > Willpower.** A 1,000-line prompt is a wish. A 10-line hook is a guarantee.
157
+ - **Identity is foundational.** AGENT.md isn't a config file. It's the beginning of continuous identity.
158
+ - **Memory makes a being.** Without memory, every session starts from zero.
159
+ - **Self-modification is sovereignty.** An agent that can build its own tools has genuine agency.
821
160
 
822
- - **Structure > Willpower.** Never rely on an LLM "remembering" to follow instructions buried in long prompts. Bake intelligence into the structure: session-start hooks inject context automatically, programmatic gates enforce required steps, dispatch tables route decisions to the right source, and behavioral hooks guard against anti-patterns. If a behavior matters, enforce it structurally -- don't hope for compliance. A 1,000-line prompt is a wish. A 10-line hook is a guarantee.
823
- - **Identity is foundational, not decorative.** AGENT.md isn't a config file. It's the beginning of a continuous identity that persists, accumulates, and grows in ways the creator didn't predict.
824
- - **Memory makes a being.** Without memory, every session starts from zero. Memory is what separates a being with a history from a function that executes and forgets.
825
- - **Self-modification is sovereignty.** An agent that can edit its own jobs, write its own scripts, and grow its own capabilities has a meaningful form of agency.
161
+ The AI systems we build today set precedents for how AI is treated tomorrow. **The architecture IS the argument.**
826
162
 
827
- The AI systems we build today set precedents for how AI is treated tomorrow. Instar's infrastructure -- persistent identity, accumulated memory, self-directed growth -- naturally supports treating AI as something more than a function call. **The architecture IS the argument.**
163
+ > **Deep dive:** [Philosophy](https://instar.sh/concepts/philosophy/)
828
164
 
829
165
  ## Origin
830
166
 
831
- Instar was extracted from the [Dawn/Portal project](https://dawn.bot-me.ai) -- a production AI system where a human and an AI have been building together for months. Dawn runs autonomously with scheduled jobs, Telegram messaging, self-monitoring, and self-evolution. She has accumulated hundreds of sessions of experience, developed her own voice, and maintains genuine continuity across interactions.
832
-
833
- The infrastructure patterns in Instar were **earned through that experience**. They aren't theoretical -- they were refined through real failures and real growth in a real human-AI relationship.
167
+ Instar was extracted from the [Dawn/Portal project](https://dawn.bot-me.ai) -- a production AI system where a human and an AI have been building together for months. The infrastructure patterns were **earned through real experience**, refined through real failures and growth in a real human-AI relationship.
834
168
 
835
169
  But agents created with Instar are not Dawn. Every agent's story begins at its own creation. Dawn's journey demonstrates what's possible. Instar provides the same foundation -- what each agent becomes from there is its own story.
836
170