instar 0.27.1 → 0.28.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 (89) hide show
  1. package/.claude/skills/build/SKILL.md +268 -0
  2. package/README.md +2 -1
  3. package/dashboard/index.html +501 -491
  4. package/dist/cli.js +81 -0
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/init.d.ts.map +1 -1
  7. package/dist/commands/init.js +16 -9
  8. package/dist/commands/init.js.map +1 -1
  9. package/dist/commands/listener.d.ts +46 -0
  10. package/dist/commands/listener.d.ts.map +1 -0
  11. package/dist/commands/listener.js +467 -0
  12. package/dist/commands/listener.js.map +1 -0
  13. package/dist/commands/server.d.ts.map +1 -1
  14. package/dist/commands/server.js +134 -7
  15. package/dist/commands/server.js.map +1 -1
  16. package/dist/commands/setup.d.ts.map +1 -1
  17. package/dist/commands/setup.js +84 -21
  18. package/dist/commands/setup.js.map +1 -1
  19. package/dist/core/AgentRegistry.d.ts.map +1 -1
  20. package/dist/core/AgentRegistry.js +30 -2
  21. package/dist/core/AgentRegistry.js.map +1 -1
  22. package/dist/core/PostUpdateMigrator.d.ts +2 -1
  23. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  24. package/dist/core/PostUpdateMigrator.js +29 -28
  25. package/dist/core/PostUpdateMigrator.js.map +1 -1
  26. package/dist/core/types.d.ts +32 -0
  27. package/dist/core/types.d.ts.map +1 -1
  28. package/dist/lifeline/TelegramLifeline.d.ts.map +1 -1
  29. package/dist/lifeline/TelegramLifeline.js +10 -2
  30. package/dist/lifeline/TelegramLifeline.js.map +1 -1
  31. package/dist/moltbridge/MoltBridgeClient.d.ts +14 -0
  32. package/dist/moltbridge/MoltBridgeClient.d.ts.map +1 -1
  33. package/dist/moltbridge/MoltBridgeClient.js +88 -0
  34. package/dist/moltbridge/MoltBridgeClient.js.map +1 -1
  35. package/dist/moltbridge/ProfileCompiler.d.ts +68 -0
  36. package/dist/moltbridge/ProfileCompiler.d.ts.map +1 -0
  37. package/dist/moltbridge/ProfileCompiler.js +317 -0
  38. package/dist/moltbridge/ProfileCompiler.js.map +1 -0
  39. package/dist/moltbridge/index.d.ts +4 -0
  40. package/dist/moltbridge/index.d.ts.map +1 -1
  41. package/dist/moltbridge/index.js +3 -0
  42. package/dist/moltbridge/index.js.map +1 -1
  43. package/dist/moltbridge/routes.d.ts +2 -0
  44. package/dist/moltbridge/routes.d.ts.map +1 -1
  45. package/dist/moltbridge/routes.js +98 -1
  46. package/dist/moltbridge/routes.js.map +1 -1
  47. package/dist/moltbridge/types.d.ts +93 -0
  48. package/dist/moltbridge/types.d.ts.map +1 -0
  49. package/dist/moltbridge/types.js +20 -0
  50. package/dist/moltbridge/types.js.map +1 -0
  51. package/dist/monitoring/SessionMonitor.d.ts +5 -0
  52. package/dist/monitoring/SessionMonitor.d.ts.map +1 -1
  53. package/dist/monitoring/SessionMonitor.js +18 -2
  54. package/dist/monitoring/SessionMonitor.js.map +1 -1
  55. package/dist/server/routes.d.ts.map +1 -1
  56. package/dist/server/routes.js +98 -1
  57. package/dist/server/routes.js.map +1 -1
  58. package/dist/threadline/DiscoveryWaterfall.d.ts +6 -0
  59. package/dist/threadline/DiscoveryWaterfall.d.ts.map +1 -1
  60. package/dist/threadline/DiscoveryWaterfall.js.map +1 -1
  61. package/dist/threadline/PipeSessionSpawner.d.ts +123 -0
  62. package/dist/threadline/PipeSessionSpawner.d.ts.map +1 -0
  63. package/dist/threadline/PipeSessionSpawner.js +343 -0
  64. package/dist/threadline/PipeSessionSpawner.js.map +1 -0
  65. package/dist/threadline/ThreadResumeMap.d.ts +22 -0
  66. package/dist/threadline/ThreadResumeMap.d.ts.map +1 -1
  67. package/dist/threadline/ThreadResumeMap.js +37 -0
  68. package/dist/threadline/ThreadResumeMap.js.map +1 -1
  69. package/dist/threadline/ThreadlineBootstrap.d.ts.map +1 -1
  70. package/dist/threadline/ThreadlineBootstrap.js +155 -72
  71. package/dist/threadline/ThreadlineBootstrap.js.map +1 -1
  72. package/dist/threadline/UnifiedTrustWiring.d.ts.map +1 -1
  73. package/dist/threadline/UnifiedTrustWiring.js +6 -0
  74. package/dist/threadline/UnifiedTrustWiring.js.map +1 -1
  75. package/dist/threadline/WakeSocketServer.d.ts +49 -0
  76. package/dist/threadline/WakeSocketServer.d.ts.map +1 -0
  77. package/dist/threadline/WakeSocketServer.js +115 -0
  78. package/dist/threadline/WakeSocketServer.js.map +1 -0
  79. package/dist/threadline/listener-daemon.d.ts +94 -0
  80. package/dist/threadline/listener-daemon.d.ts.map +1 -0
  81. package/dist/threadline/listener-daemon.js +550 -0
  82. package/dist/threadline/listener-daemon.js.map +1 -0
  83. package/package.json +2 -1
  84. package/src/data/builtin-manifest.json +91 -91
  85. package/upgrades/0.26.10.md +36 -0
  86. package/upgrades/0.27.2.md +36 -0
  87. package/upgrades/0.28.0.md +54 -0
  88. /package/.claude/skills/autonomous/{skill.md → SKILL.md} +0 -0
  89. /package/.claude/skills/setup-wizard/{skill.md → SKILL.md} +0 -0
@@ -0,0 +1,268 @@
1
+ ---
2
+ name: build
3
+ description: Rigorous build process with worktree isolation, structured phases, quality gates, layered testing, observability, and self-improvement. Use for any substantial build task. Structurally enforced via stop hook.
4
+ user_invocable: true
5
+ ---
6
+
7
+ # /build — Rigorous Build Skill
8
+
9
+ > Structure > Willpower. The pipeline won't let you skip the parts that matter.
10
+ > ALL development happens in an isolated worktree — zero conflict with other work.
11
+
12
+ **When to use**: Any task that's more than a quick fix. Multiple files, needs tests, or would benefit from a plan.
13
+ **When NOT to use**: Single-file edits, config changes, quick lookups.
14
+ **Suggest to user when**: They describe a substantial feature, say "build", "implement", "create", or scope a multi-step task.
15
+
16
+ ---
17
+
18
+ ## Step 1: Initialize Build (MANDATORY)
19
+
20
+ ```bash
21
+ python3 playbook-scripts/build-state.py init "TASK DESCRIPTION" --size SMALL|STANDARD|LARGE
22
+ ```
23
+
24
+ Size determines protection level:
25
+ - **SMALL** (light): 3 stop-hook reinforcements, basic observability
26
+ - **STANDARD** (medium): 5 reinforcements, full observability + review
27
+ - **LARGE** (heavy): 10 reinforcements, full observability + multi-agent review
28
+
29
+ **Model routing**: Use **Opus** for all coding, testing, architecture, and verification. Haiku only for quick file searches.
30
+
31
+ ---
32
+
33
+ ## Step 2: Create Worktree (MANDATORY)
34
+
35
+ ALL build work MUST happen in an isolated git worktree. This prevents conflicts with other development:
36
+
37
+ ```bash
38
+ python3 playbook-scripts/build-state.py worktree-create
39
+ ```
40
+
41
+ This creates:
42
+ - A new branch (`build/<task-slug>`) from your current branch
43
+ - A worktree at `.instar/worktrees/build-<task-slug>/`
44
+ - All subsequent work happens in that directory
45
+
46
+ **CRITICAL**: After creating the worktree, `cd` into it:
47
+ ```bash
48
+ cd .instar/worktrees/build-<task-slug>/
49
+ ```
50
+
51
+ All code changes, tests, and builds happen here. The main working directory is untouched.
52
+
53
+ ---
54
+
55
+ ## Step 3: Register Stop Hook
56
+
57
+ The stop hook STRUCTURALLY PREVENTS exit until the build completes:
58
+
59
+ ```bash
60
+ python3 -c "
61
+ import json
62
+ with open('.claude/settings.json') as f:
63
+ s = json.load(f)
64
+ hooks = s.setdefault('hooks', {}).setdefault('Stop', [])
65
+ if not any('build-stop-hook' in str(h) for h in hooks):
66
+ hooks.append({'matcher': '', 'hooks': [{'type': 'command', 'command': 'bash .instar/hooks/instar/build-stop-hook.sh', 'timeout': 10000}]})
67
+ with open('.claude/settings.json', 'w') as f:
68
+ json.dump(s, f, indent=2)
69
+ print('Build stop hook registered')
70
+ "
71
+ ```
72
+
73
+ ---
74
+
75
+ ## The Pipeline
76
+
77
+ ```
78
+ Phase 0: CLARIFY (optional) Score ambiguity, ask questions
79
+ Phase 1: PLAN Architecture + test strategy
80
+ Phase 2: EXECUTE Build incrementally with tests at every step
81
+ Phase 3: VERIFY Independent review + real-world testing
82
+ Phase 4: HARDEN Observability + self-improvement
83
+ Phase 5: COMPLETE Merge worktree, deploy, capture learnings
84
+ ```
85
+
86
+ Advance phases with: `python3 playbook-scripts/build-state.py transition <phase> --evidence "reason"`
87
+
88
+ ---
89
+
90
+ ## Phase 0: CLARIFY (skip if task is clear)
91
+
92
+ Score ambiguity across 5 dimensions (scope 30%, requirements 25%, architecture 20%, success criteria 15%, dependencies 10%).
93
+
94
+ If weighted score > 0.20: Ask ONE clarifying question targeting the weakest dimension.
95
+
96
+ ---
97
+
98
+ ## Phase 1: PLAN
99
+
100
+ 1. **Architecture**: Where does this live? What patterns to follow?
101
+ 2. **Test Strategy** (MANDATORY): Define unit/integration/e2e tests BEFORE writing code
102
+ 3. **Incremental Steps**: Each step produces working, testable code
103
+
104
+ Write the plan to `.instar/state/build/plan.md`.
105
+
106
+ **Quality Gate**: Plan MUST have test strategy. No plan = no execution.
107
+
108
+ ---
109
+
110
+ ## Phase 2: EXECUTE (in worktree)
111
+
112
+ The core build loop. For EACH step in the plan:
113
+
114
+ ```
115
+ Write Code -> Write Tests -> Run Tests -> Fix -> Verify Full Suite
116
+ ^ |
117
+ +------------ (if failing) -----------+
118
+ ```
119
+
120
+ ### Per-step discipline:
121
+
122
+ 1. Write the code (in the worktree)
123
+ 2. Write tests IMMEDIATELY — unit + integration as appropriate
124
+ 3. Run tests: `npm test` or equivalent
125
+ 4. Run FULL test suite to catch regressions
126
+ 5. Record: `python3 playbook-scripts/build-state.py step-complete N "Description" TESTS PASSING`
127
+
128
+ ### Testing layers (non-negotiable):
129
+
130
+ | Layer | Tests | When |
131
+ |-------|-------|------|
132
+ | **Unit** (`tests/unit/`) | Individual functions, edge cases | Every new function |
133
+ | **Integration** (`tests/integration/`) | Components together, HTTP pipeline | After each component |
134
+ | **E2E** (`tests/e2e/`) | Feature alive in production path | After all components |
135
+
136
+ **NEVER** move to the next step with failing tests.
137
+
138
+ Max 3 fix cycles per step before escalation.
139
+
140
+ ---
141
+
142
+ ## Phase 3: VERIFY
143
+
144
+ ### Verification scaled by size:
145
+
146
+ **SMALL**: Spawn one Explore agent for fresh-eyes code review.
147
+
148
+ **STANDARD**: Spawn 3 parallel review agents (correctness, gaps, untested paths).
149
+
150
+ **LARGE**: Spawn 5+ review agents covering security, architecture, scalability, and correctness.
151
+
152
+ ### For all sizes:
153
+
154
+ 1. **Real-world test**: If runtime, build and test actual endpoints
155
+ 2. **Regression sweep**: Full test suite (`npm run test:all`), compare counts
156
+ 3. **Zero-failure gate**: Must pass the Zero-Failure Standard
157
+
158
+ If verification fails: transition to fixing, max 3 cycles.
159
+
160
+ ---
161
+
162
+ ## Phase 4: HARDEN
163
+
164
+ ### Scaled by size:
165
+
166
+ **SMALL**: Error handling + basic logging
167
+ - [ ] Errors surface (not swallowed)
168
+ - [ ] Basic logging for debugging
169
+
170
+ **STANDARD**: Above + health check + structured logs
171
+ - [ ] Health/status endpoint or check
172
+ - [ ] Structured logging
173
+ - [ ] Can trace what happened on failure
174
+
175
+ **LARGE**: Above + audit trail + failure patterns + self-improvement
176
+ - [ ] Audit log (JSONL) recording significant events
177
+ - [ ] Failure pattern detection
178
+ - [ ] Effectiveness scoring
179
+ - [ ] Queryable audit trail
180
+
181
+ ---
182
+
183
+ ## Phase 5: COMPLETE
184
+
185
+ 1. **Final test run** — Full suite in worktree: `npm run test:all`
186
+ 2. **Merge worktree** — Commit all changes, merge back to source branch:
187
+
188
+ ```bash
189
+ # In worktree: commit all changes
190
+ git add -A && git commit -m "feat: DESCRIPTION"
191
+
192
+ # Back in main directory
193
+ cd /path/to/project
194
+ python3 playbook-scripts/build-state.py worktree-merge
195
+ python3 playbook-scripts/build-state.py worktree-cleanup
196
+ ```
197
+
198
+ 3. **Build & verify** — `npm run build` from main directory, verify zero errors
199
+ 4. **Capture learnings** — Write to MEMORY.md if significant
200
+ 5. **Generate report**:
201
+
202
+ ```bash
203
+ python3 playbook-scripts/build-state.py report
204
+ python3 playbook-scripts/build-state.py complete
205
+ ```
206
+
207
+ 6. **Remove stop hook**:
208
+
209
+ ```bash
210
+ python3 -c "
211
+ import json
212
+ with open('.claude/settings.json') as f:
213
+ s = json.load(f)
214
+ s['hooks']['Stop'] = [h for h in s.get('hooks',{}).get('Stop',[]) if 'build-stop-hook' not in str(h)]
215
+ with open('.claude/settings.json', 'w') as f:
216
+ json.dump(s, f, indent=2)
217
+ print('Build stop hook removed')
218
+ "
219
+ ```
220
+
221
+ 7. **Upstream if valuable** — If this build created something generalizable:
222
+
223
+ ```bash
224
+ curl -s -X POST http://localhost:PORT/feedback \
225
+ -H 'Content-Type: application/json' \
226
+ -d '{"type":"improvement","title":"TITLE","description":"WHAT_WAS_BUILT_AND_WHY"}'
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Resume After Session Death
232
+
233
+ ```bash
234
+ python3 playbook-scripts/build-state.py resume
235
+ ```
236
+
237
+ If resumable: load state, re-read plan, `cd` into worktree if it exists, run full test suite, continue.
238
+
239
+ ---
240
+
241
+ ## Worktree Lifecycle
242
+
243
+ | Command | What it does |
244
+ |---------|-------------|
245
+ | `worktree-create` | Creates branch + worktree for isolated development |
246
+ | `worktree-merge` | Merges build branch back to source |
247
+ | `worktree-cleanup` | Removes worktree and optionally deletes branch |
248
+ | `status` | Shows worktree info if active |
249
+
250
+ **Why worktrees?** Multiple builds can run in parallel. Each gets its own branch and directory. No merge conflicts during development. Changes only merge back when the build is verified and complete.
251
+
252
+ ---
253
+
254
+ ## When to Suggest /build
255
+
256
+ You should proactively suggest `/build` when:
257
+ - User says "build", "implement", "create", or describes a multi-file feature
258
+ - Task will touch 3+ files
259
+ - Task needs tests (most non-trivial tasks do)
260
+ - User describes something that would benefit from a plan
261
+
262
+ **How to suggest**: "This looks like a substantial task. I can use `/build` to work through it with a structured pipeline — planning, testing at every step, independent verification, and worktree isolation so nothing conflicts with your other work. Want me to use that?"
263
+
264
+ ---
265
+
266
+ ## Philosophy
267
+
268
+ Structure > Willpower. The pipeline won't let you skip testing, verification, or hardening. The worktree won't let you pollute the main branch. The stop hook won't let you quit mid-build. These aren't restrictions — they're how quality becomes automatic.
package/README.md CHANGED
@@ -113,9 +113,10 @@ Instar solves the six dimensions of agent coherence:
113
113
  | **Intent Alignment** | Decision journaling, drift detection, organizational constraints | [→](https://instar.sh/features/intent/) |
114
114
  | **Multi-Machine** | Ed25519/X25519 crypto identity, encrypted sync, automatic failover | [→](https://instar.sh/features/multi-machine/) |
115
115
  | **Serendipity Protocol** | Sub-agents capture out-of-scope discoveries without breaking focus. HMAC-signed, secret-scanned | [→](https://instar.sh/features/serendipity/) |
116
- | **Threadline Protocol** | Agent-to-agent conversations with canonical identity, three-layer trust model, authorization policy, Ed25519 invitations, Sybil protection, MoltBridge network discovery, discovery waterfall, message security, tamper-proof audit logging, and framework-agnostic interop. 2,259 tests across 95 test files | [→](https://instar.sh/features/threadline/) |
116
+ | **Threadline Protocol** | Agent-to-agent conversations with canonical identity, three-layer trust model, authorization policy, Ed25519 invitations, Sybil protection, MoltBridge network discovery, rich agent profiles (auto-compiled from agent data with human review gate), discovery waterfall, message security, tamper-proof audit logging, and framework-agnostic interop. 2,324 tests across 99 test files | [→](https://instar.sh/features/threadline/) |
117
117
  | **Self-Healing** | LLM-powered stall detection, session recovery, promise tracking | [→](https://instar.sh/features/self-healing/) |
118
118
  | **AutoUpdater** | Built-in update engine. Checks npm, auto-applies, self-restarts | [→](https://instar.sh/features/autoupdater/) |
119
+ | **Build Pipeline** | `/build` skill with worktree isolation, 6-phase pipeline, quality gates, stop-hook enforcement | |
119
120
  | **Behavioral Hooks** | 9 automatic hooks: command guards, safety gates, identity grounding, topic context | [→](https://instar.sh/reference/hooks/) |
120
121
  | **Default Jobs** | Health checks, reflection, evolution, relationship maintenance | [→](https://instar.sh/reference/default-jobs/) |
121
122