create-egregore 0.21.0-runtime-mvp.27 → 0.21.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 (821) hide show
  1. package/assets/egregore-launcher.js +288 -148
  2. package/bin/cli.js +70 -1
  3. package/lib/api.js +2 -2
  4. package/lib/claude-runtime.js +25 -46
  5. package/lib/codex-runtime.js +6 -1
  6. package/lib/harness-add.js +159 -0
  7. package/lib/local.js +37 -95
  8. package/lib/pi-runtime.js +6 -1
  9. package/lib/prime-runtime.js +6 -1
  10. package/lib/runtime-git-excludes.js +95 -0
  11. package/lib/setup.js +89 -66
  12. package/lib/ui.js +91 -64
  13. package/package.json +6 -4
  14. package/runtime/claude/.claude/context/notification-consent.md +17 -2
  15. package/runtime/claude/.claude/context/retrieval-investigation.md +57 -0
  16. package/runtime/claude/.claude/context/telemetry.md +73 -3
  17. package/runtime/claude/.claude/hooks/memory-read-guard.sh +54 -13
  18. package/runtime/claude/.claude/hooks/retrieval-context.sh +4 -44
  19. package/runtime/claude/.claude/hooks/search-hint.sh +11 -0
  20. package/runtime/claude/.claude/rules/voice-bedrock.md +20 -0
  21. package/runtime/claude/.claude/settings.json +9 -0
  22. package/runtime/claude/.claude/skills/announce/SKILL.md +33 -12
  23. package/runtime/claude/.claude/skills/archive/SKILL.md +7 -6
  24. package/runtime/claude/.claude/skills/branch/SKILL.md +35 -28
  25. package/runtime/claude/.claude/skills/checkup/SKILL.md +8 -11
  26. package/runtime/claude/.claude/skills/commit/SKILL.md +11 -7
  27. package/runtime/claude/.claude/skills/contribute/SKILL.md +108 -62
  28. package/runtime/claude/.claude/skills/create-skill/SKILL.md +19 -8
  29. package/runtime/claude/.claude/skills/dashboard/SKILL.md +3 -3
  30. package/runtime/claude/.claude/skills/deep-reflect/REPORT.md +6 -6
  31. package/runtime/claude/.claude/skills/deep-reflect/ROLES.md +2 -2
  32. package/runtime/claude/.claude/skills/deep-reflect/SKILL.md +26 -15
  33. package/runtime/claude/.claude/skills/delete-user/SKILL.md +39 -44
  34. package/runtime/claude/.claude/skills/emissary/SKILL.md +36 -26
  35. package/runtime/claude/.claude/skills/env/SKILL.md +161 -0
  36. package/runtime/claude/.claude/skills/handoff/SKILL.md +16 -6
  37. package/runtime/claude/.claude/skills/harvest/AUDIT.md +4 -4
  38. package/runtime/claude/.claude/skills/harvest/PROCESS.md +7 -6
  39. package/runtime/claude/.claude/skills/harvest/SKILL.md +8 -6
  40. package/runtime/claude/.claude/skills/ingest/SKILL.md +25 -11
  41. package/runtime/claude/.claude/skills/ingest-corpus/SKILL.md +9 -7
  42. package/runtime/claude/.claude/skills/ingest-user-interview/SKILL.md +6 -3
  43. package/runtime/claude/.claude/skills/invite/SKILL.md +36 -5
  44. package/runtime/claude/.claude/skills/issue/SKILL.md +257 -11
  45. package/runtime/claude/.claude/skills/me/SKILL.md +2 -2
  46. package/runtime/claude/.claude/skills/meeting/SKILL.md +16 -4
  47. package/runtime/claude/.claude/skills/note/SKILL.md +6 -4
  48. package/runtime/claude/.claude/skills/notion-connect/SKILL.md +2 -2
  49. package/runtime/claude/.claude/skills/onboarding/SKILL.md +23 -5
  50. package/runtime/claude/.claude/skills/pr/SKILL.md +11 -17
  51. package/runtime/claude/.claude/skills/pull/SKILL.md +10 -33
  52. package/runtime/claude/.claude/skills/push/SKILL.md +6 -2
  53. package/runtime/claude/.claude/skills/reflect/SKILL.md +9 -7
  54. package/runtime/claude/.claude/skills/review-pr/SKILL.md +43 -16
  55. package/runtime/claude/.claude/skills/save/SKILL.md +48 -8
  56. package/runtime/claude/.claude/skills/slack-connect/SKILL.md +63 -16
  57. package/runtime/claude/.claude/skills/summon/SKILL.md +44 -44
  58. package/runtime/claude/.claude/skills/sync-repos/SKILL.md +37 -14
  59. package/runtime/claude/.claude/skills/teams-connect/SKILL.md +82 -28
  60. package/runtime/claude/.claude/skills/telegram-connect/SKILL.md +20 -3
  61. package/runtime/claude/.claude/skills/telemetry/SKILL.md +3 -1
  62. package/runtime/claude/.claude/skills/test/SKILL.md +3 -3
  63. package/runtime/claude/.claude/skills/tui-design/SKILL.md +4 -4
  64. package/runtime/claude/.claude/skills/tutorial/SKILL.md +6 -5
  65. package/runtime/claude/.claude/skills/update/SKILL.md +116 -68
  66. package/runtime/claude/.claude/skills/view/SKILL.md +19 -11
  67. package/runtime/claude/.claude/skills/visual-explain/SKILL.md +1 -1
  68. package/runtime/claude/.claude/skills/wrap/SKILL.md +11 -6
  69. package/runtime/claude/CLAUDE.md +61 -31
  70. package/runtime/claude/bin/activity-action.sh +1 -1
  71. package/runtime/claude/bin/activity-data.sh +1 -1
  72. package/runtime/claude/bin/agent.sh +132 -29
  73. package/runtime/claude/bin/api-call.sh +181 -0
  74. package/runtime/claude/bin/artifact-register.sh +62 -6
  75. package/runtime/claude/bin/artifact-writeback.sh +28 -3
  76. package/runtime/claude/bin/artifacts.sh +1 -1
  77. package/runtime/claude/bin/attendant.sh +1 -1
  78. package/runtime/claude/bin/base-branch.sh +62 -0
  79. package/runtime/claude/bin/codex-render-spec.mjs +45 -73
  80. package/runtime/claude/bin/codex-session-start.sh +30 -39
  81. package/runtime/claude/bin/codex-skill-render.mjs +15 -6
  82. package/runtime/claude/bin/codex-sync-skills.sh +85 -26
  83. package/runtime/claude/bin/config-get.sh +65 -0
  84. package/runtime/claude/bin/contribute-guard.sh +70 -0
  85. package/runtime/claude/bin/dashboard-data.sh +1 -1
  86. package/runtime/claude/bin/gh-run.sh +25 -0
  87. package/runtime/claude/bin/graph-op.sh +302 -5
  88. package/runtime/claude/bin/graph-projection.sh +1 -1
  89. package/runtime/claude/bin/graph-wal.sh +2 -2
  90. package/runtime/claude/bin/graph.sh +1 -1
  91. package/runtime/claude/bin/handoff-lifecycle.sh +2 -2
  92. package/runtime/claude/bin/handoff-preview.sh +7 -3
  93. package/runtime/claude/bin/handoff-run.sh +1 -1
  94. package/runtime/claude/bin/hosting-ops.sh +248 -0
  95. package/runtime/claude/bin/index-handoff.sh +3 -3
  96. package/runtime/claude/bin/ingest-item.sh +1 -1
  97. package/runtime/claude/bin/ingest.sh +3 -3
  98. package/runtime/claude/bin/invite.sh +1 -0
  99. package/runtime/claude/bin/issue.sh +1 -1
  100. package/runtime/claude/bin/knowledge.sh +1 -1
  101. package/runtime/claude/bin/lib/config.sh +4 -8
  102. package/runtime/claude/bin/lib/dashboard-artifact.sh +1 -1
  103. package/runtime/claude/bin/lib/framework-update.sh +41 -0
  104. package/runtime/claude/bin/lib/generated-trees.sh +27 -0
  105. package/runtime/claude/bin/lib/git-sync.sh +71 -20
  106. package/runtime/claude/bin/lib/greeting.sh +45 -72
  107. package/runtime/claude/bin/lib/health-footer.sh +115 -0
  108. package/runtime/claude/bin/lib/hosted-ref-id.sh +108 -0
  109. package/runtime/claude/bin/lib/identity.sh +1 -0
  110. package/runtime/claude/bin/lib/notices.sh +177 -0
  111. package/runtime/claude/bin/lib/repo-paths.sh +40 -0
  112. package/runtime/claude/bin/lib/runtime-owned.sh +52 -16
  113. package/runtime/claude/bin/lib/scratch.sh +26 -0
  114. package/runtime/claude/bin/lib/secret_entry.py +1013 -0
  115. package/runtime/claude/bin/notification.sh +1 -1
  116. package/runtime/claude/bin/notify.sh +134 -14
  117. package/runtime/claude/bin/observe-context.sh +3 -3
  118. package/runtime/claude/bin/onboarding.sh +1 -0
  119. package/runtime/claude/bin/person.sh +9 -4
  120. package/runtime/claude/bin/pi-render-spec.mjs +0 -1
  121. package/runtime/claude/bin/prime-render-spec.mjs +1 -2
  122. package/runtime/claude/bin/prose-check-tally.sh +102 -0
  123. package/runtime/claude/bin/prose-check.mjs +554 -0
  124. package/runtime/claude/bin/prose-rules/announcing-instead-of-doing.md +24 -0
  125. package/runtime/claude/bin/prose-rules/banned-vocabulary.md +40 -0
  126. package/runtime/claude/bin/prose-rules/coined-terms.md +20 -0
  127. package/runtime/claude/bin/prose-rules/exclamation.md +24 -0
  128. package/runtime/claude/bin/prose-rules/filler-intensifiers.md +24 -0
  129. package/runtime/claude/bin/prose-rules/harness-tool-names.md +36 -0
  130. package/runtime/claude/bin/prose-rules/hedging-stack.md +26 -0
  131. package/runtime/claude/bin/prose-rules/mannered-prose.md +24 -0
  132. package/runtime/claude/bin/prose-rules/not-x-but-y.md +23 -0
  133. package/runtime/claude/bin/prose-rules/one-name-per-thing.md +20 -0
  134. package/runtime/claude/bin/prose-rules/passive-enthusiasm.md +25 -0
  135. package/runtime/claude/bin/prose-rules/process-narration.md +30 -0
  136. package/runtime/claude/bin/prose-rules/rhetorical-opener.md +23 -0
  137. package/runtime/claude/bin/prose-rules/self-contained.md +20 -0
  138. package/runtime/claude/bin/prose-rules/self-praise.md +22 -0
  139. package/runtime/claude/bin/prose-rules/temporal-handwave.md +27 -0
  140. package/runtime/claude/bin/publish-artifact.sh +52 -4
  141. package/runtime/claude/bin/publish-references.sh +27 -8
  142. package/runtime/claude/bin/pull.sh +272 -0
  143. package/runtime/claude/bin/qa-gate.sh +205 -0
  144. package/runtime/claude/bin/qa-inventory.sh +341 -0
  145. package/runtime/claude/bin/quest.sh +1 -1
  146. package/runtime/claude/bin/question.sh +1 -1
  147. package/runtime/claude/bin/research-ingest.sh +1 -1
  148. package/runtime/claude/bin/runtime-identity.sh +3 -3
  149. package/runtime/claude/bin/runtime-upgrade.sh +5 -3
  150. package/runtime/claude/bin/scratch-sweep.sh +29 -0
  151. package/runtime/claude/bin/scroll.sh +1 -1
  152. package/runtime/claude/bin/search.sh +110 -64
  153. package/runtime/claude/bin/secret-entry.py +6 -0
  154. package/runtime/claude/bin/session-autosave.sh +1 -1
  155. package/runtime/claude/bin/session-log.sh +7 -2
  156. package/runtime/claude/bin/session-start.sh +5 -1
  157. package/runtime/claude/bin/settings.sh +1 -1
  158. package/runtime/claude/bin/telemetry.sh +65 -18
  159. package/runtime/claude/bin/test-baseline.sh +440 -0
  160. package/runtime/claude/bin/test-changes.sh +196 -145
  161. package/runtime/claude/bin/thread.sh +1 -1
  162. package/runtime/claude/bin/todo.sh +1 -1
  163. package/runtime/claude/bin/update-framework.sh +24 -0
  164. package/runtime/claude/bin/view-render.sh +26 -2
  165. package/runtime/claude/bin/worktree-create.sh +11 -0
  166. package/runtime/claude/bin/worktree.sh +1 -1
  167. package/runtime/claude/docs/credential-entry.md +286 -0
  168. package/runtime/claude/egregore_runtime/adapters/qmd.py +309 -50
  169. package/runtime/claude/egregore_runtime/adapters/qmd_cli.py +6 -3
  170. package/runtime/claude/egregore_runtime/adapters/qmd_scoped.mjs +202 -0
  171. package/runtime/claude/egregore_runtime/adapters/qmd_scoped.py +137 -0
  172. package/runtime/claude/egregore_runtime/adapters/qmd_worker.mjs +123 -0
  173. package/runtime/claude/egregore_runtime/artifacts.py +132 -19
  174. package/runtime/claude/egregore_runtime/contracts.py +43 -1
  175. package/runtime/claude/egregore_runtime/eligibility.py +137 -0
  176. package/runtime/claude/egregore_runtime/episode_binding.py +178 -0
  177. package/runtime/claude/egregore_runtime/excerpts.py +42 -0
  178. package/runtime/claude/egregore_runtime/github_issues.py +332 -0
  179. package/runtime/claude/egregore_runtime/graph.py +15 -6
  180. package/runtime/claude/egregore_runtime/harness_cli.py +626 -413
  181. package/runtime/claude/egregore_runtime/identity.py +160 -8
  182. package/runtime/claude/egregore_runtime/identity_transfer.py +288 -0
  183. package/runtime/claude/egregore_runtime/ingest_cli.py +4 -6
  184. package/runtime/claude/egregore_runtime/ingest_index_cli.py +4 -2
  185. package/runtime/claude/egregore_runtime/investigation.py +792 -0
  186. package/runtime/claude/egregore_runtime/investigation_contracts.py +104 -0
  187. package/runtime/claude/egregore_runtime/investigation_guidance.py +58 -0
  188. package/runtime/claude/egregore_runtime/issue_cli.py +97 -0
  189. package/runtime/claude/egregore_runtime/issue_duplicates.py +116 -0
  190. package/runtime/claude/egregore_runtime/issue_markers.py +50 -0
  191. package/runtime/claude/egregore_runtime/issue_readiness.py +231 -0
  192. package/runtime/claude/egregore_runtime/issue_reporting.py +224 -0
  193. package/runtime/claude/egregore_runtime/issue_triage.py +331 -0
  194. package/runtime/claude/egregore_runtime/issue_triage_service.py +124 -0
  195. package/runtime/claude/egregore_runtime/knowledge_cli.py +4 -3
  196. package/runtime/claude/egregore_runtime/notification_cli.py +66 -8
  197. package/runtime/claude/egregore_runtime/observe.py +41 -6
  198. package/runtime/claude/egregore_runtime/operation_cli.py +76 -0
  199. package/runtime/claude/egregore_runtime/operation_observations.py +208 -0
  200. package/runtime/claude/egregore_runtime/private_result.py +147 -0
  201. package/runtime/claude/egregore_runtime/questions.py +1 -0
  202. package/runtime/claude/egregore_runtime/research_ingest_cli.py +7 -5
  203. package/runtime/claude/egregore_runtime/runtime.py +61 -3
  204. package/runtime/claude/egregore_runtime/scratch.py +294 -0
  205. package/runtime/claude/egregore_runtime/scroll_cli.py +8 -8
  206. package/runtime/claude/egregore_runtime/scrolls.py +172 -28
  207. package/runtime/claude/egregore_runtime/sync.py +247 -21
  208. package/runtime/claude/egregore_runtime/sync_health.py +63 -0
  209. package/runtime/claude/egregore_runtime/telemetry.py +102 -10
  210. package/runtime/claude/egregore_runtime/thread_cli.py +4 -4
  211. package/runtime/claude/egregore_runtime/threads.py +5 -1
  212. package/runtime/claude/egregore_runtime/upgrade.py +771 -34
  213. package/runtime/claude/egregore_runtime/writeback.py +174 -12
  214. package/runtime/claude/egregore_runtime/writeback_cli.py +89 -17
  215. package/runtime/claude/manifest.json +66 -1
  216. package/runtime/codex/.claude/context/notification-consent.md +17 -2
  217. package/runtime/codex/.claude/context/retrieval-investigation.md +57 -0
  218. package/runtime/codex/.codex/config.toml +1 -2
  219. package/runtime/codex/.codex/skills/activity/SKILL.md +45 -35
  220. package/runtime/codex/.codex/skills/announce/SKILL.md +25 -40
  221. package/runtime/codex/.codex/skills/archive/SKILL.md +40 -21
  222. package/runtime/codex/.codex/skills/branch/SKILL.md +2 -2
  223. package/runtime/codex/.codex/skills/checkup/SKILL.md +40 -77
  224. package/runtime/codex/.codex/skills/commit/SKILL.md +2 -2
  225. package/runtime/codex/.codex/skills/contribute/SKILL.md +2 -2
  226. package/runtime/codex/.codex/skills/create-skill/SKILL.md +2 -2
  227. package/runtime/codex/.codex/skills/dark-mode/SKILL.md +2 -2
  228. package/runtime/codex/.codex/skills/dashboard/SKILL.md +40 -20
  229. package/runtime/codex/.codex/skills/deep-reflect/SKILL.md +45 -105
  230. package/runtime/codex/.codex/skills/delete-user/SKILL.md +2 -2
  231. package/runtime/codex/.codex/skills/emissary/SKILL.md +6 -2
  232. package/runtime/codex/.codex/skills/env/SKILL.md +29 -0
  233. package/runtime/codex/.codex/skills/handoff/SKILL.md +45 -126
  234. package/runtime/codex/.codex/skills/harvest/SKILL.md +45 -42
  235. package/runtime/codex/.codex/skills/ingest/SKILL.md +25 -47
  236. package/runtime/codex/.codex/skills/ingest-corpus/SKILL.md +2 -2
  237. package/runtime/codex/.codex/skills/ingest-notion/SKILL.md +2 -2
  238. package/runtime/codex/.codex/skills/ingest-user-interview/SKILL.md +40 -18
  239. package/runtime/codex/.codex/skills/invite/SKILL.md +21 -22
  240. package/runtime/codex/.codex/skills/issue/SKILL.md +45 -60
  241. package/runtime/codex/.codex/skills/me/SKILL.md +2 -2
  242. package/runtime/codex/.codex/skills/meeting/SKILL.md +40 -16
  243. package/runtime/codex/.codex/skills/note/SKILL.md +25 -30
  244. package/runtime/codex/.codex/skills/notion-connect/SKILL.md +2 -2
  245. package/runtime/codex/.codex/skills/onboarding/SKILL.md +45 -36
  246. package/runtime/codex/.codex/skills/pr/SKILL.md +2 -2
  247. package/runtime/codex/.codex/skills/pull/SKILL.md +2 -2
  248. package/runtime/codex/.codex/skills/push/SKILL.md +2 -2
  249. package/runtime/codex/.codex/skills/quest/SKILL.md +45 -37
  250. package/runtime/codex/.codex/skills/reflect/SKILL.md +40 -22
  251. package/runtime/codex/.codex/skills/review-pr/SKILL.md +6 -2
  252. package/runtime/codex/.codex/skills/save/SKILL.md +25 -120
  253. package/runtime/codex/.codex/skills/slack-connect/SKILL.md +2 -2
  254. package/runtime/codex/.codex/skills/summon/SKILL.md +6 -2
  255. package/runtime/codex/.codex/skills/sync-repos/SKILL.md +2 -2
  256. package/runtime/codex/.codex/skills/teams-connect/SKILL.md +2 -2
  257. package/runtime/codex/.codex/skills/telegram-connect/SKILL.md +2 -2
  258. package/runtime/codex/.codex/skills/telemetry/SKILL.md +2 -2
  259. package/runtime/codex/.codex/skills/test/SKILL.md +7 -3
  260. package/runtime/codex/.codex/skills/the-spiral/SKILL.md +25 -80
  261. package/runtime/codex/.codex/skills/tui-design/SKILL.md +6 -2
  262. package/runtime/codex/.codex/skills/tutorial/SKILL.md +45 -40
  263. package/runtime/codex/.codex/skills/update/SKILL.md +2 -2
  264. package/runtime/codex/.codex/skills/view/SKILL.md +40 -151
  265. package/runtime/codex/.codex/skills/visual-explain/SKILL.md +6 -2
  266. package/runtime/codex/.codex/skills/wrap/SKILL.md +45 -58
  267. package/runtime/codex/.codex/spec-manifest.json +14 -14
  268. package/runtime/codex/AGENTS.md +88 -91
  269. package/runtime/codex/bin/activity-action.sh +1 -1
  270. package/runtime/codex/bin/activity-data.sh +1 -1
  271. package/runtime/codex/bin/agent.sh +132 -29
  272. package/runtime/codex/bin/api-call.sh +181 -0
  273. package/runtime/codex/bin/artifact-register.sh +62 -6
  274. package/runtime/codex/bin/artifact-writeback.sh +28 -3
  275. package/runtime/codex/bin/artifacts.sh +1 -1
  276. package/runtime/codex/bin/attendant.sh +1 -1
  277. package/runtime/codex/bin/base-branch.sh +62 -0
  278. package/runtime/codex/bin/codex-render-spec.mjs +45 -73
  279. package/runtime/codex/bin/codex-session-start.sh +30 -39
  280. package/runtime/codex/bin/codex-skill-render.mjs +15 -6
  281. package/runtime/codex/bin/codex-sync-skills.sh +85 -26
  282. package/runtime/codex/bin/config-get.sh +65 -0
  283. package/runtime/codex/bin/contribute-guard.sh +70 -0
  284. package/runtime/codex/bin/dashboard-data.sh +1 -1
  285. package/runtime/codex/bin/gh-run.sh +25 -0
  286. package/runtime/codex/bin/graph-op.sh +302 -5
  287. package/runtime/codex/bin/graph-projection.sh +1 -1
  288. package/runtime/codex/bin/graph-wal.sh +2 -2
  289. package/runtime/codex/bin/graph.sh +1 -1
  290. package/runtime/codex/bin/handoff-lifecycle.sh +2 -2
  291. package/runtime/codex/bin/handoff-preview.sh +7 -3
  292. package/runtime/codex/bin/handoff-run.sh +1 -1
  293. package/runtime/codex/bin/hosting-ops.sh +248 -0
  294. package/runtime/codex/bin/index-handoff.sh +3 -3
  295. package/runtime/codex/bin/ingest-item.sh +1 -1
  296. package/runtime/codex/bin/ingest.sh +3 -3
  297. package/runtime/codex/bin/invite.sh +1 -0
  298. package/runtime/codex/bin/issue.sh +1 -1
  299. package/runtime/codex/bin/knowledge.sh +1 -1
  300. package/runtime/codex/bin/lib/config.sh +4 -8
  301. package/runtime/codex/bin/lib/dashboard-artifact.sh +1 -1
  302. package/runtime/codex/bin/lib/framework-update.sh +41 -0
  303. package/runtime/codex/bin/lib/generated-trees.sh +27 -0
  304. package/runtime/codex/bin/lib/git-sync.sh +71 -20
  305. package/runtime/codex/bin/lib/greeting.sh +45 -72
  306. package/runtime/codex/bin/lib/health-footer.sh +115 -0
  307. package/runtime/codex/bin/lib/hosted-ref-id.sh +108 -0
  308. package/runtime/codex/bin/lib/identity.sh +1 -0
  309. package/runtime/codex/bin/lib/notices.sh +177 -0
  310. package/runtime/codex/bin/lib/repo-paths.sh +40 -0
  311. package/runtime/codex/bin/lib/runtime-owned.sh +52 -16
  312. package/runtime/codex/bin/lib/scratch.sh +26 -0
  313. package/runtime/codex/bin/lib/secret_entry.py +1013 -0
  314. package/runtime/codex/bin/notification.sh +1 -1
  315. package/runtime/codex/bin/notify.sh +134 -14
  316. package/runtime/codex/bin/observe-context.sh +3 -3
  317. package/runtime/codex/bin/onboarding.sh +1 -0
  318. package/runtime/codex/bin/person.sh +9 -4
  319. package/runtime/codex/bin/pi-render-spec.mjs +0 -1
  320. package/runtime/codex/bin/prime-render-spec.mjs +1 -2
  321. package/runtime/codex/bin/prose-check-tally.sh +102 -0
  322. package/runtime/codex/bin/prose-check.mjs +554 -0
  323. package/runtime/codex/bin/prose-rules/announcing-instead-of-doing.md +24 -0
  324. package/runtime/codex/bin/prose-rules/banned-vocabulary.md +40 -0
  325. package/runtime/codex/bin/prose-rules/coined-terms.md +20 -0
  326. package/runtime/codex/bin/prose-rules/exclamation.md +24 -0
  327. package/runtime/codex/bin/prose-rules/filler-intensifiers.md +24 -0
  328. package/runtime/codex/bin/prose-rules/harness-tool-names.md +36 -0
  329. package/runtime/codex/bin/prose-rules/hedging-stack.md +26 -0
  330. package/runtime/codex/bin/prose-rules/mannered-prose.md +24 -0
  331. package/runtime/codex/bin/prose-rules/not-x-but-y.md +23 -0
  332. package/runtime/codex/bin/prose-rules/one-name-per-thing.md +20 -0
  333. package/runtime/codex/bin/prose-rules/passive-enthusiasm.md +25 -0
  334. package/runtime/codex/bin/prose-rules/process-narration.md +30 -0
  335. package/runtime/codex/bin/prose-rules/rhetorical-opener.md +23 -0
  336. package/runtime/codex/bin/prose-rules/self-contained.md +20 -0
  337. package/runtime/codex/bin/prose-rules/self-praise.md +22 -0
  338. package/runtime/codex/bin/prose-rules/temporal-handwave.md +27 -0
  339. package/runtime/codex/bin/publish-artifact.sh +52 -4
  340. package/runtime/codex/bin/publish-references.sh +27 -8
  341. package/runtime/codex/bin/pull.sh +272 -0
  342. package/runtime/codex/bin/qa-gate.sh +205 -0
  343. package/runtime/codex/bin/qa-inventory.sh +341 -0
  344. package/runtime/codex/bin/quest.sh +1 -1
  345. package/runtime/codex/bin/question.sh +1 -1
  346. package/runtime/codex/bin/research-ingest.sh +1 -1
  347. package/runtime/codex/bin/runtime-identity.sh +3 -3
  348. package/runtime/codex/bin/runtime-upgrade.sh +5 -3
  349. package/runtime/codex/bin/scratch-sweep.sh +29 -0
  350. package/runtime/codex/bin/scroll.sh +1 -1
  351. package/runtime/codex/bin/search.sh +110 -64
  352. package/runtime/codex/bin/secret-entry.py +6 -0
  353. package/runtime/codex/bin/session-autosave.sh +1 -1
  354. package/runtime/codex/bin/session-log.sh +7 -2
  355. package/runtime/codex/bin/settings.sh +1 -1
  356. package/runtime/codex/bin/telemetry.sh +65 -18
  357. package/runtime/codex/bin/test-baseline.sh +440 -0
  358. package/runtime/codex/bin/test-changes.sh +196 -145
  359. package/runtime/codex/bin/thread.sh +1 -1
  360. package/runtime/codex/bin/todo.sh +1 -1
  361. package/runtime/codex/bin/update-framework.sh +24 -0
  362. package/runtime/codex/bin/view-render.sh +26 -2
  363. package/runtime/codex/bin/worktree-create.sh +11 -0
  364. package/runtime/codex/bin/worktree.sh +1 -1
  365. package/runtime/codex/docs/credential-entry.md +286 -0
  366. package/runtime/codex/egregore_runtime/adapters/qmd.py +309 -50
  367. package/runtime/codex/egregore_runtime/adapters/qmd_cli.py +6 -3
  368. package/runtime/codex/egregore_runtime/adapters/qmd_scoped.mjs +202 -0
  369. package/runtime/codex/egregore_runtime/adapters/qmd_scoped.py +137 -0
  370. package/runtime/codex/egregore_runtime/adapters/qmd_worker.mjs +123 -0
  371. package/runtime/codex/egregore_runtime/artifacts.py +132 -19
  372. package/runtime/codex/egregore_runtime/contracts.py +43 -1
  373. package/runtime/codex/egregore_runtime/eligibility.py +137 -0
  374. package/runtime/codex/egregore_runtime/episode_binding.py +178 -0
  375. package/runtime/codex/egregore_runtime/excerpts.py +42 -0
  376. package/runtime/codex/egregore_runtime/github_issues.py +332 -0
  377. package/runtime/codex/egregore_runtime/graph.py +15 -6
  378. package/runtime/codex/egregore_runtime/harness_cli.py +626 -413
  379. package/runtime/codex/egregore_runtime/identity.py +160 -8
  380. package/runtime/codex/egregore_runtime/identity_transfer.py +288 -0
  381. package/runtime/codex/egregore_runtime/ingest_cli.py +4 -6
  382. package/runtime/codex/egregore_runtime/ingest_index_cli.py +4 -2
  383. package/runtime/codex/egregore_runtime/investigation.py +792 -0
  384. package/runtime/codex/egregore_runtime/investigation_contracts.py +104 -0
  385. package/runtime/codex/egregore_runtime/investigation_guidance.py +58 -0
  386. package/runtime/codex/egregore_runtime/issue_cli.py +97 -0
  387. package/runtime/codex/egregore_runtime/issue_duplicates.py +116 -0
  388. package/runtime/codex/egregore_runtime/issue_markers.py +50 -0
  389. package/runtime/codex/egregore_runtime/issue_readiness.py +231 -0
  390. package/runtime/codex/egregore_runtime/issue_reporting.py +224 -0
  391. package/runtime/codex/egregore_runtime/issue_triage.py +331 -0
  392. package/runtime/codex/egregore_runtime/issue_triage_service.py +124 -0
  393. package/runtime/codex/egregore_runtime/knowledge_cli.py +4 -3
  394. package/runtime/codex/egregore_runtime/notification_cli.py +66 -8
  395. package/runtime/codex/egregore_runtime/observe.py +41 -6
  396. package/runtime/codex/egregore_runtime/operation_cli.py +76 -0
  397. package/runtime/codex/egregore_runtime/operation_observations.py +208 -0
  398. package/runtime/codex/egregore_runtime/private_result.py +147 -0
  399. package/runtime/codex/egregore_runtime/questions.py +1 -0
  400. package/runtime/codex/egregore_runtime/research_ingest_cli.py +7 -5
  401. package/runtime/codex/egregore_runtime/runtime.py +61 -3
  402. package/runtime/codex/egregore_runtime/scratch.py +294 -0
  403. package/runtime/codex/egregore_runtime/scroll_cli.py +8 -8
  404. package/runtime/codex/egregore_runtime/scrolls.py +172 -28
  405. package/runtime/codex/egregore_runtime/sync.py +247 -21
  406. package/runtime/codex/egregore_runtime/sync_health.py +63 -0
  407. package/runtime/codex/egregore_runtime/telemetry.py +102 -10
  408. package/runtime/codex/egregore_runtime/thread_cli.py +4 -4
  409. package/runtime/codex/egregore_runtime/threads.py +5 -1
  410. package/runtime/codex/egregore_runtime/upgrade.py +771 -34
  411. package/runtime/codex/egregore_runtime/writeback.py +174 -12
  412. package/runtime/codex/egregore_runtime/writeback_cli.py +89 -17
  413. package/runtime/codex/manifest.json +65 -1
  414. package/runtime/pi/.claude/context/notification-consent.md +17 -2
  415. package/runtime/pi/.claude/context/retrieval-investigation.md +57 -0
  416. package/runtime/pi/.codex/config.toml +1 -2
  417. package/runtime/pi/.codex/skills/activity/SKILL.md +45 -35
  418. package/runtime/pi/.codex/skills/announce/SKILL.md +25 -40
  419. package/runtime/pi/.codex/skills/archive/SKILL.md +40 -21
  420. package/runtime/pi/.codex/skills/branch/SKILL.md +2 -2
  421. package/runtime/pi/.codex/skills/checkup/SKILL.md +40 -77
  422. package/runtime/pi/.codex/skills/commit/SKILL.md +2 -2
  423. package/runtime/pi/.codex/skills/contribute/SKILL.md +2 -2
  424. package/runtime/pi/.codex/skills/create-skill/SKILL.md +2 -2
  425. package/runtime/pi/.codex/skills/dark-mode/SKILL.md +2 -2
  426. package/runtime/pi/.codex/skills/dashboard/SKILL.md +40 -20
  427. package/runtime/pi/.codex/skills/deep-reflect/SKILL.md +45 -105
  428. package/runtime/pi/.codex/skills/delete-user/SKILL.md +2 -2
  429. package/runtime/pi/.codex/skills/emissary/SKILL.md +6 -2
  430. package/runtime/pi/.codex/skills/env/SKILL.md +29 -0
  431. package/runtime/pi/.codex/skills/handoff/SKILL.md +45 -126
  432. package/runtime/pi/.codex/skills/harvest/SKILL.md +45 -42
  433. package/runtime/pi/.codex/skills/ingest/SKILL.md +25 -47
  434. package/runtime/pi/.codex/skills/ingest-corpus/SKILL.md +2 -2
  435. package/runtime/pi/.codex/skills/ingest-notion/SKILL.md +2 -2
  436. package/runtime/pi/.codex/skills/ingest-user-interview/SKILL.md +40 -18
  437. package/runtime/pi/.codex/skills/invite/SKILL.md +21 -22
  438. package/runtime/pi/.codex/skills/issue/SKILL.md +45 -60
  439. package/runtime/pi/.codex/skills/me/SKILL.md +2 -2
  440. package/runtime/pi/.codex/skills/meeting/SKILL.md +40 -16
  441. package/runtime/pi/.codex/skills/note/SKILL.md +25 -30
  442. package/runtime/pi/.codex/skills/notion-connect/SKILL.md +2 -2
  443. package/runtime/pi/.codex/skills/onboarding/SKILL.md +45 -36
  444. package/runtime/pi/.codex/skills/pr/SKILL.md +2 -2
  445. package/runtime/pi/.codex/skills/pull/SKILL.md +2 -2
  446. package/runtime/pi/.codex/skills/push/SKILL.md +2 -2
  447. package/runtime/pi/.codex/skills/quest/SKILL.md +45 -37
  448. package/runtime/pi/.codex/skills/reflect/SKILL.md +40 -22
  449. package/runtime/pi/.codex/skills/review-pr/SKILL.md +6 -2
  450. package/runtime/pi/.codex/skills/save/SKILL.md +25 -120
  451. package/runtime/pi/.codex/skills/slack-connect/SKILL.md +2 -2
  452. package/runtime/pi/.codex/skills/summon/SKILL.md +6 -2
  453. package/runtime/pi/.codex/skills/sync-repos/SKILL.md +2 -2
  454. package/runtime/pi/.codex/skills/teams-connect/SKILL.md +2 -2
  455. package/runtime/pi/.codex/skills/telegram-connect/SKILL.md +2 -2
  456. package/runtime/pi/.codex/skills/telemetry/SKILL.md +2 -2
  457. package/runtime/pi/.codex/skills/test/SKILL.md +7 -3
  458. package/runtime/pi/.codex/skills/the-spiral/SKILL.md +25 -80
  459. package/runtime/pi/.codex/skills/tui-design/SKILL.md +6 -2
  460. package/runtime/pi/.codex/skills/tutorial/SKILL.md +45 -40
  461. package/runtime/pi/.codex/skills/update/SKILL.md +2 -2
  462. package/runtime/pi/.codex/skills/view/SKILL.md +40 -151
  463. package/runtime/pi/.codex/skills/visual-explain/SKILL.md +6 -2
  464. package/runtime/pi/.codex/skills/wrap/SKILL.md +45 -58
  465. package/runtime/pi/.codex/spec-manifest.json +14 -14
  466. package/runtime/pi/.pi/APPEND_SYSTEM.md +63 -34
  467. package/runtime/pi/.pi/extensions/egregore.ts +8 -7
  468. package/runtime/pi/.pi/spec-manifest.json +2 -2
  469. package/runtime/pi/AGENTS.md +88 -91
  470. package/runtime/pi/bin/activity-action.sh +1 -1
  471. package/runtime/pi/bin/activity-data.sh +1 -1
  472. package/runtime/pi/bin/agent.sh +132 -29
  473. package/runtime/pi/bin/api-call.sh +181 -0
  474. package/runtime/pi/bin/artifact-register.sh +62 -6
  475. package/runtime/pi/bin/artifact-writeback.sh +28 -3
  476. package/runtime/pi/bin/artifacts.sh +1 -1
  477. package/runtime/pi/bin/attendant.sh +1 -1
  478. package/runtime/pi/bin/base-branch.sh +62 -0
  479. package/runtime/pi/bin/codex-render-spec.mjs +45 -73
  480. package/runtime/pi/bin/codex-session-start.sh +30 -39
  481. package/runtime/pi/bin/codex-skill-render.mjs +15 -6
  482. package/runtime/pi/bin/codex-sync-skills.sh +85 -26
  483. package/runtime/pi/bin/config-get.sh +65 -0
  484. package/runtime/pi/bin/contribute-guard.sh +70 -0
  485. package/runtime/pi/bin/dashboard-data.sh +1 -1
  486. package/runtime/pi/bin/gh-run.sh +25 -0
  487. package/runtime/pi/bin/graph-op.sh +302 -5
  488. package/runtime/pi/bin/graph-projection.sh +1 -1
  489. package/runtime/pi/bin/graph-wal.sh +2 -2
  490. package/runtime/pi/bin/graph.sh +1 -1
  491. package/runtime/pi/bin/handoff-lifecycle.sh +2 -2
  492. package/runtime/pi/bin/handoff-preview.sh +7 -3
  493. package/runtime/pi/bin/handoff-run.sh +1 -1
  494. package/runtime/pi/bin/hosting-ops.sh +248 -0
  495. package/runtime/pi/bin/index-handoff.sh +3 -3
  496. package/runtime/pi/bin/ingest-item.sh +1 -1
  497. package/runtime/pi/bin/ingest.sh +3 -3
  498. package/runtime/pi/bin/invite.sh +1 -0
  499. package/runtime/pi/bin/issue.sh +1 -1
  500. package/runtime/pi/bin/knowledge.sh +1 -1
  501. package/runtime/pi/bin/lib/config.sh +4 -8
  502. package/runtime/pi/bin/lib/dashboard-artifact.sh +1 -1
  503. package/runtime/pi/bin/lib/framework-update.sh +41 -0
  504. package/runtime/pi/bin/lib/generated-trees.sh +27 -0
  505. package/runtime/pi/bin/lib/git-sync.sh +71 -20
  506. package/runtime/pi/bin/lib/greeting.sh +45 -72
  507. package/runtime/pi/bin/lib/health-footer.sh +115 -0
  508. package/runtime/pi/bin/lib/hosted-ref-id.sh +108 -0
  509. package/runtime/pi/bin/lib/identity.sh +1 -0
  510. package/runtime/pi/bin/lib/notices.sh +177 -0
  511. package/runtime/pi/bin/lib/repo-paths.sh +40 -0
  512. package/runtime/pi/bin/lib/runtime-owned.sh +52 -16
  513. package/runtime/pi/bin/lib/scratch.sh +26 -0
  514. package/runtime/pi/bin/lib/secret_entry.py +1013 -0
  515. package/runtime/pi/bin/notification.sh +1 -1
  516. package/runtime/pi/bin/notify.sh +134 -14
  517. package/runtime/pi/bin/observe-context.sh +3 -3
  518. package/runtime/pi/bin/onboarding.sh +1 -0
  519. package/runtime/pi/bin/person.sh +9 -4
  520. package/runtime/pi/bin/pi-observe-context.mjs +38 -2
  521. package/runtime/pi/bin/pi-product-workflows.mjs +5 -0
  522. package/runtime/pi/bin/pi-render-spec.mjs +0 -1
  523. package/runtime/pi/bin/prime-render-spec.mjs +1 -2
  524. package/runtime/pi/bin/prose-check-tally.sh +102 -0
  525. package/runtime/pi/bin/prose-check.mjs +554 -0
  526. package/runtime/pi/bin/prose-rules/announcing-instead-of-doing.md +24 -0
  527. package/runtime/pi/bin/prose-rules/banned-vocabulary.md +40 -0
  528. package/runtime/pi/bin/prose-rules/coined-terms.md +20 -0
  529. package/runtime/pi/bin/prose-rules/exclamation.md +24 -0
  530. package/runtime/pi/bin/prose-rules/filler-intensifiers.md +24 -0
  531. package/runtime/pi/bin/prose-rules/harness-tool-names.md +36 -0
  532. package/runtime/pi/bin/prose-rules/hedging-stack.md +26 -0
  533. package/runtime/pi/bin/prose-rules/mannered-prose.md +24 -0
  534. package/runtime/pi/bin/prose-rules/not-x-but-y.md +23 -0
  535. package/runtime/pi/bin/prose-rules/one-name-per-thing.md +20 -0
  536. package/runtime/pi/bin/prose-rules/passive-enthusiasm.md +25 -0
  537. package/runtime/pi/bin/prose-rules/process-narration.md +30 -0
  538. package/runtime/pi/bin/prose-rules/rhetorical-opener.md +23 -0
  539. package/runtime/pi/bin/prose-rules/self-contained.md +20 -0
  540. package/runtime/pi/bin/prose-rules/self-praise.md +22 -0
  541. package/runtime/pi/bin/prose-rules/temporal-handwave.md +27 -0
  542. package/runtime/pi/bin/publish-artifact.sh +52 -4
  543. package/runtime/pi/bin/publish-references.sh +27 -8
  544. package/runtime/pi/bin/pull.sh +272 -0
  545. package/runtime/pi/bin/qa-gate.sh +205 -0
  546. package/runtime/pi/bin/qa-inventory.sh +341 -0
  547. package/runtime/pi/bin/quest.sh +1 -1
  548. package/runtime/pi/bin/question.sh +1 -1
  549. package/runtime/pi/bin/research-ingest.sh +1 -1
  550. package/runtime/pi/bin/runtime-identity.sh +3 -3
  551. package/runtime/pi/bin/runtime-upgrade.sh +5 -3
  552. package/runtime/pi/bin/scratch-sweep.sh +29 -0
  553. package/runtime/pi/bin/scroll.sh +1 -1
  554. package/runtime/pi/bin/search.sh +110 -64
  555. package/runtime/pi/bin/secret-entry.py +6 -0
  556. package/runtime/pi/bin/session-autosave.sh +1 -1
  557. package/runtime/pi/bin/session-log.sh +7 -2
  558. package/runtime/pi/bin/settings.sh +1 -1
  559. package/runtime/pi/bin/telemetry.sh +65 -18
  560. package/runtime/pi/bin/test-baseline.sh +440 -0
  561. package/runtime/pi/bin/test-changes.sh +196 -145
  562. package/runtime/pi/bin/thread.sh +1 -1
  563. package/runtime/pi/bin/todo.sh +1 -1
  564. package/runtime/pi/bin/update-framework.sh +24 -0
  565. package/runtime/pi/bin/view-render.sh +26 -2
  566. package/runtime/pi/bin/worktree-create.sh +11 -0
  567. package/runtime/pi/bin/worktree.sh +1 -1
  568. package/runtime/pi/docs/credential-entry.md +286 -0
  569. package/runtime/pi/egregore_runtime/adapters/qmd.py +309 -50
  570. package/runtime/pi/egregore_runtime/adapters/qmd_cli.py +6 -3
  571. package/runtime/pi/egregore_runtime/adapters/qmd_scoped.mjs +202 -0
  572. package/runtime/pi/egregore_runtime/adapters/qmd_scoped.py +137 -0
  573. package/runtime/pi/egregore_runtime/adapters/qmd_worker.mjs +123 -0
  574. package/runtime/pi/egregore_runtime/artifacts.py +132 -19
  575. package/runtime/pi/egregore_runtime/contracts.py +43 -1
  576. package/runtime/pi/egregore_runtime/eligibility.py +137 -0
  577. package/runtime/pi/egregore_runtime/episode_binding.py +178 -0
  578. package/runtime/pi/egregore_runtime/excerpts.py +42 -0
  579. package/runtime/pi/egregore_runtime/github_issues.py +332 -0
  580. package/runtime/pi/egregore_runtime/graph.py +15 -6
  581. package/runtime/pi/egregore_runtime/harness_cli.py +626 -413
  582. package/runtime/pi/egregore_runtime/identity.py +160 -8
  583. package/runtime/pi/egregore_runtime/identity_transfer.py +288 -0
  584. package/runtime/pi/egregore_runtime/ingest_cli.py +4 -6
  585. package/runtime/pi/egregore_runtime/ingest_index_cli.py +4 -2
  586. package/runtime/pi/egregore_runtime/investigation.py +792 -0
  587. package/runtime/pi/egregore_runtime/investigation_contracts.py +104 -0
  588. package/runtime/pi/egregore_runtime/investigation_guidance.py +58 -0
  589. package/runtime/pi/egregore_runtime/issue_cli.py +97 -0
  590. package/runtime/pi/egregore_runtime/issue_duplicates.py +116 -0
  591. package/runtime/pi/egregore_runtime/issue_markers.py +50 -0
  592. package/runtime/pi/egregore_runtime/issue_readiness.py +231 -0
  593. package/runtime/pi/egregore_runtime/issue_reporting.py +224 -0
  594. package/runtime/pi/egregore_runtime/issue_triage.py +331 -0
  595. package/runtime/pi/egregore_runtime/issue_triage_service.py +124 -0
  596. package/runtime/pi/egregore_runtime/knowledge_cli.py +4 -3
  597. package/runtime/pi/egregore_runtime/notification_cli.py +66 -8
  598. package/runtime/pi/egregore_runtime/observe.py +41 -6
  599. package/runtime/pi/egregore_runtime/operation_cli.py +76 -0
  600. package/runtime/pi/egregore_runtime/operation_observations.py +208 -0
  601. package/runtime/pi/egregore_runtime/private_result.py +147 -0
  602. package/runtime/pi/egregore_runtime/questions.py +1 -0
  603. package/runtime/pi/egregore_runtime/research_ingest_cli.py +7 -5
  604. package/runtime/pi/egregore_runtime/runtime.py +61 -3
  605. package/runtime/pi/egregore_runtime/scratch.py +294 -0
  606. package/runtime/pi/egregore_runtime/scroll_cli.py +8 -8
  607. package/runtime/pi/egregore_runtime/scrolls.py +172 -28
  608. package/runtime/pi/egregore_runtime/sync.py +247 -21
  609. package/runtime/pi/egregore_runtime/sync_health.py +63 -0
  610. package/runtime/pi/egregore_runtime/telemetry.py +102 -10
  611. package/runtime/pi/egregore_runtime/thread_cli.py +4 -4
  612. package/runtime/pi/egregore_runtime/threads.py +5 -1
  613. package/runtime/pi/egregore_runtime/upgrade.py +771 -34
  614. package/runtime/pi/egregore_runtime/writeback.py +174 -12
  615. package/runtime/pi/egregore_runtime/writeback_cli.py +89 -17
  616. package/runtime/pi/manifest.json +65 -1
  617. package/runtime/prime/.claude/context/notification-consent.md +17 -2
  618. package/runtime/prime/.claude/context/retrieval-investigation.md +57 -0
  619. package/runtime/prime/.codex/config.toml +1 -2
  620. package/runtime/prime/.codex/skills/activity/SKILL.md +45 -35
  621. package/runtime/prime/.codex/skills/announce/SKILL.md +25 -40
  622. package/runtime/prime/.codex/skills/archive/SKILL.md +40 -21
  623. package/runtime/prime/.codex/skills/branch/SKILL.md +2 -2
  624. package/runtime/prime/.codex/skills/checkup/SKILL.md +40 -77
  625. package/runtime/prime/.codex/skills/commit/SKILL.md +2 -2
  626. package/runtime/prime/.codex/skills/contribute/SKILL.md +2 -2
  627. package/runtime/prime/.codex/skills/create-skill/SKILL.md +2 -2
  628. package/runtime/prime/.codex/skills/dark-mode/SKILL.md +2 -2
  629. package/runtime/prime/.codex/skills/dashboard/SKILL.md +40 -20
  630. package/runtime/prime/.codex/skills/deep-reflect/SKILL.md +45 -105
  631. package/runtime/prime/.codex/skills/delete-user/SKILL.md +2 -2
  632. package/runtime/prime/.codex/skills/emissary/SKILL.md +6 -2
  633. package/runtime/prime/.codex/skills/env/SKILL.md +29 -0
  634. package/runtime/prime/.codex/skills/handoff/SKILL.md +45 -126
  635. package/runtime/prime/.codex/skills/harvest/SKILL.md +45 -42
  636. package/runtime/prime/.codex/skills/ingest/SKILL.md +25 -47
  637. package/runtime/prime/.codex/skills/ingest-corpus/SKILL.md +2 -2
  638. package/runtime/prime/.codex/skills/ingest-notion/SKILL.md +2 -2
  639. package/runtime/prime/.codex/skills/ingest-user-interview/SKILL.md +40 -18
  640. package/runtime/prime/.codex/skills/invite/SKILL.md +21 -22
  641. package/runtime/prime/.codex/skills/issue/SKILL.md +45 -60
  642. package/runtime/prime/.codex/skills/me/SKILL.md +2 -2
  643. package/runtime/prime/.codex/skills/meeting/SKILL.md +40 -16
  644. package/runtime/prime/.codex/skills/note/SKILL.md +25 -30
  645. package/runtime/prime/.codex/skills/notion-connect/SKILL.md +2 -2
  646. package/runtime/prime/.codex/skills/onboarding/SKILL.md +45 -36
  647. package/runtime/prime/.codex/skills/pr/SKILL.md +2 -2
  648. package/runtime/prime/.codex/skills/pull/SKILL.md +2 -2
  649. package/runtime/prime/.codex/skills/push/SKILL.md +2 -2
  650. package/runtime/prime/.codex/skills/quest/SKILL.md +45 -37
  651. package/runtime/prime/.codex/skills/reflect/SKILL.md +40 -22
  652. package/runtime/prime/.codex/skills/review-pr/SKILL.md +6 -2
  653. package/runtime/prime/.codex/skills/save/SKILL.md +25 -120
  654. package/runtime/prime/.codex/skills/slack-connect/SKILL.md +2 -2
  655. package/runtime/prime/.codex/skills/summon/SKILL.md +6 -2
  656. package/runtime/prime/.codex/skills/sync-repos/SKILL.md +2 -2
  657. package/runtime/prime/.codex/skills/teams-connect/SKILL.md +2 -2
  658. package/runtime/prime/.codex/skills/telegram-connect/SKILL.md +2 -2
  659. package/runtime/prime/.codex/skills/telemetry/SKILL.md +2 -2
  660. package/runtime/prime/.codex/skills/test/SKILL.md +7 -3
  661. package/runtime/prime/.codex/skills/the-spiral/SKILL.md +25 -80
  662. package/runtime/prime/.codex/skills/tui-design/SKILL.md +6 -2
  663. package/runtime/prime/.codex/skills/tutorial/SKILL.md +45 -40
  664. package/runtime/prime/.codex/skills/update/SKILL.md +2 -2
  665. package/runtime/prime/.codex/skills/view/SKILL.md +40 -151
  666. package/runtime/prime/.codex/skills/visual-explain/SKILL.md +6 -2
  667. package/runtime/prime/.codex/skills/wrap/SKILL.md +45 -58
  668. package/runtime/prime/.codex/spec-manifest.json +14 -14
  669. package/runtime/prime/.prime/agent/APPEND_SYSTEM.md +64 -35
  670. package/runtime/prime/.prime/agent/extensions/egregore.ts +8 -7
  671. package/runtime/prime/.prime/agent/skills/egregore/SKILL.md +8 -1
  672. package/runtime/prime/.prime/agent/skills/egregore/src/egregore/__init__.py +24 -4
  673. package/runtime/prime/.prime/agent/spec-manifest.json +2 -2
  674. package/runtime/prime/AGENTS.md +88 -91
  675. package/runtime/prime/bin/activity-action.sh +1 -1
  676. package/runtime/prime/bin/activity-data.sh +1 -1
  677. package/runtime/prime/bin/agent.sh +132 -29
  678. package/runtime/prime/bin/api-call.sh +181 -0
  679. package/runtime/prime/bin/artifact-register.sh +62 -6
  680. package/runtime/prime/bin/artifact-writeback.sh +28 -3
  681. package/runtime/prime/bin/artifacts.sh +1 -1
  682. package/runtime/prime/bin/attendant.sh +1 -1
  683. package/runtime/prime/bin/base-branch.sh +62 -0
  684. package/runtime/prime/bin/codex-render-spec.mjs +45 -73
  685. package/runtime/prime/bin/codex-session-start.sh +30 -39
  686. package/runtime/prime/bin/codex-skill-render.mjs +15 -6
  687. package/runtime/prime/bin/codex-sync-skills.sh +85 -26
  688. package/runtime/prime/bin/config-get.sh +65 -0
  689. package/runtime/prime/bin/contribute-guard.sh +70 -0
  690. package/runtime/prime/bin/dashboard-data.sh +1 -1
  691. package/runtime/prime/bin/gh-run.sh +25 -0
  692. package/runtime/prime/bin/graph-op.sh +302 -5
  693. package/runtime/prime/bin/graph-projection.sh +1 -1
  694. package/runtime/prime/bin/graph-wal.sh +2 -2
  695. package/runtime/prime/bin/graph.sh +1 -1
  696. package/runtime/prime/bin/handoff-lifecycle.sh +2 -2
  697. package/runtime/prime/bin/handoff-preview.sh +7 -3
  698. package/runtime/prime/bin/handoff-run.sh +1 -1
  699. package/runtime/prime/bin/hosting-ops.sh +248 -0
  700. package/runtime/prime/bin/index-handoff.sh +3 -3
  701. package/runtime/prime/bin/ingest-item.sh +1 -1
  702. package/runtime/prime/bin/ingest.sh +3 -3
  703. package/runtime/prime/bin/invite.sh +1 -0
  704. package/runtime/prime/bin/issue.sh +1 -1
  705. package/runtime/prime/bin/knowledge.sh +1 -1
  706. package/runtime/prime/bin/lib/config.sh +4 -8
  707. package/runtime/prime/bin/lib/dashboard-artifact.sh +1 -1
  708. package/runtime/prime/bin/lib/framework-update.sh +41 -0
  709. package/runtime/prime/bin/lib/generated-trees.sh +27 -0
  710. package/runtime/prime/bin/lib/git-sync.sh +71 -20
  711. package/runtime/prime/bin/lib/greeting.sh +45 -72
  712. package/runtime/prime/bin/lib/health-footer.sh +115 -0
  713. package/runtime/prime/bin/lib/hosted-ref-id.sh +108 -0
  714. package/runtime/prime/bin/lib/identity.sh +1 -0
  715. package/runtime/prime/bin/lib/notices.sh +177 -0
  716. package/runtime/prime/bin/lib/repo-paths.sh +40 -0
  717. package/runtime/prime/bin/lib/runtime-owned.sh +52 -16
  718. package/runtime/prime/bin/lib/scratch.sh +26 -0
  719. package/runtime/prime/bin/lib/secret_entry.py +1013 -0
  720. package/runtime/prime/bin/notification.sh +1 -1
  721. package/runtime/prime/bin/notify.sh +134 -14
  722. package/runtime/prime/bin/observe-context.sh +3 -3
  723. package/runtime/prime/bin/onboarding.sh +1 -0
  724. package/runtime/prime/bin/person.sh +9 -4
  725. package/runtime/prime/bin/pi-observe-context.mjs +38 -2
  726. package/runtime/prime/bin/pi-product-workflows.mjs +5 -0
  727. package/runtime/prime/bin/pi-render-spec.mjs +0 -1
  728. package/runtime/prime/bin/prime-render-spec.mjs +1 -2
  729. package/runtime/prime/bin/prose-check-tally.sh +102 -0
  730. package/runtime/prime/bin/prose-check.mjs +554 -0
  731. package/runtime/prime/bin/prose-rules/announcing-instead-of-doing.md +24 -0
  732. package/runtime/prime/bin/prose-rules/banned-vocabulary.md +40 -0
  733. package/runtime/prime/bin/prose-rules/coined-terms.md +20 -0
  734. package/runtime/prime/bin/prose-rules/exclamation.md +24 -0
  735. package/runtime/prime/bin/prose-rules/filler-intensifiers.md +24 -0
  736. package/runtime/prime/bin/prose-rules/harness-tool-names.md +36 -0
  737. package/runtime/prime/bin/prose-rules/hedging-stack.md +26 -0
  738. package/runtime/prime/bin/prose-rules/mannered-prose.md +24 -0
  739. package/runtime/prime/bin/prose-rules/not-x-but-y.md +23 -0
  740. package/runtime/prime/bin/prose-rules/one-name-per-thing.md +20 -0
  741. package/runtime/prime/bin/prose-rules/passive-enthusiasm.md +25 -0
  742. package/runtime/prime/bin/prose-rules/process-narration.md +30 -0
  743. package/runtime/prime/bin/prose-rules/rhetorical-opener.md +23 -0
  744. package/runtime/prime/bin/prose-rules/self-contained.md +20 -0
  745. package/runtime/prime/bin/prose-rules/self-praise.md +22 -0
  746. package/runtime/prime/bin/prose-rules/temporal-handwave.md +27 -0
  747. package/runtime/prime/bin/publish-artifact.sh +52 -4
  748. package/runtime/prime/bin/publish-references.sh +27 -8
  749. package/runtime/prime/bin/pull.sh +272 -0
  750. package/runtime/prime/bin/qa-gate.sh +205 -0
  751. package/runtime/prime/bin/qa-inventory.sh +341 -0
  752. package/runtime/prime/bin/quest.sh +1 -1
  753. package/runtime/prime/bin/question.sh +1 -1
  754. package/runtime/prime/bin/research-ingest.sh +1 -1
  755. package/runtime/prime/bin/runtime-identity.sh +3 -3
  756. package/runtime/prime/bin/runtime-upgrade.sh +5 -3
  757. package/runtime/prime/bin/scratch-sweep.sh +29 -0
  758. package/runtime/prime/bin/scroll.sh +1 -1
  759. package/runtime/prime/bin/search.sh +110 -64
  760. package/runtime/prime/bin/secret-entry.py +6 -0
  761. package/runtime/prime/bin/session-autosave.sh +1 -1
  762. package/runtime/prime/bin/session-log.sh +7 -2
  763. package/runtime/prime/bin/settings.sh +1 -1
  764. package/runtime/prime/bin/telemetry.sh +65 -18
  765. package/runtime/prime/bin/test-baseline.sh +440 -0
  766. package/runtime/prime/bin/test-changes.sh +196 -145
  767. package/runtime/prime/bin/thread.sh +1 -1
  768. package/runtime/prime/bin/todo.sh +1 -1
  769. package/runtime/prime/bin/update-framework.sh +24 -0
  770. package/runtime/prime/bin/view-render.sh +26 -2
  771. package/runtime/prime/bin/worktree-create.sh +11 -0
  772. package/runtime/prime/bin/worktree.sh +1 -1
  773. package/runtime/prime/docs/credential-entry.md +286 -0
  774. package/runtime/prime/egregore_runtime/adapters/qmd.py +309 -50
  775. package/runtime/prime/egregore_runtime/adapters/qmd_cli.py +6 -3
  776. package/runtime/prime/egregore_runtime/adapters/qmd_scoped.mjs +202 -0
  777. package/runtime/prime/egregore_runtime/adapters/qmd_scoped.py +137 -0
  778. package/runtime/prime/egregore_runtime/adapters/qmd_worker.mjs +123 -0
  779. package/runtime/prime/egregore_runtime/artifacts.py +132 -19
  780. package/runtime/prime/egregore_runtime/contracts.py +43 -1
  781. package/runtime/prime/egregore_runtime/eligibility.py +137 -0
  782. package/runtime/prime/egregore_runtime/episode_binding.py +178 -0
  783. package/runtime/prime/egregore_runtime/excerpts.py +42 -0
  784. package/runtime/prime/egregore_runtime/github_issues.py +332 -0
  785. package/runtime/prime/egregore_runtime/graph.py +15 -6
  786. package/runtime/prime/egregore_runtime/harness_cli.py +626 -413
  787. package/runtime/prime/egregore_runtime/identity.py +160 -8
  788. package/runtime/prime/egregore_runtime/identity_transfer.py +288 -0
  789. package/runtime/prime/egregore_runtime/ingest_cli.py +4 -6
  790. package/runtime/prime/egregore_runtime/ingest_index_cli.py +4 -2
  791. package/runtime/prime/egregore_runtime/investigation.py +792 -0
  792. package/runtime/prime/egregore_runtime/investigation_contracts.py +104 -0
  793. package/runtime/prime/egregore_runtime/investigation_guidance.py +58 -0
  794. package/runtime/prime/egregore_runtime/issue_cli.py +97 -0
  795. package/runtime/prime/egregore_runtime/issue_duplicates.py +116 -0
  796. package/runtime/prime/egregore_runtime/issue_markers.py +50 -0
  797. package/runtime/prime/egregore_runtime/issue_readiness.py +231 -0
  798. package/runtime/prime/egregore_runtime/issue_reporting.py +224 -0
  799. package/runtime/prime/egregore_runtime/issue_triage.py +331 -0
  800. package/runtime/prime/egregore_runtime/issue_triage_service.py +124 -0
  801. package/runtime/prime/egregore_runtime/knowledge_cli.py +4 -3
  802. package/runtime/prime/egregore_runtime/notification_cli.py +66 -8
  803. package/runtime/prime/egregore_runtime/observe.py +41 -6
  804. package/runtime/prime/egregore_runtime/operation_cli.py +76 -0
  805. package/runtime/prime/egregore_runtime/operation_observations.py +208 -0
  806. package/runtime/prime/egregore_runtime/private_result.py +147 -0
  807. package/runtime/prime/egregore_runtime/questions.py +1 -0
  808. package/runtime/prime/egregore_runtime/research_ingest_cli.py +7 -5
  809. package/runtime/prime/egregore_runtime/runtime.py +61 -3
  810. package/runtime/prime/egregore_runtime/scratch.py +294 -0
  811. package/runtime/prime/egregore_runtime/scroll_cli.py +8 -8
  812. package/runtime/prime/egregore_runtime/scrolls.py +172 -28
  813. package/runtime/prime/egregore_runtime/sync.py +247 -21
  814. package/runtime/prime/egregore_runtime/sync_health.py +63 -0
  815. package/runtime/prime/egregore_runtime/telemetry.py +102 -10
  816. package/runtime/prime/egregore_runtime/thread_cli.py +4 -4
  817. package/runtime/prime/egregore_runtime/threads.py +5 -1
  818. package/runtime/prime/egregore_runtime/upgrade.py +771 -34
  819. package/runtime/prime/egregore_runtime/writeback.py +174 -12
  820. package/runtime/prime/egregore_runtime/writeback_cli.py +89 -17
  821. package/runtime/prime/manifest.json +65 -1
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // egregore-launcher-version: 0.21.0-runtime-mvp.27
2
+ // egregore-launcher-version: 0.21.0
3
3
  //
4
4
  // egregore — launch and browse Egregore instances from your terminal.
5
5
  // Installed by create-egregore. Reads ~/.egregore/instances.json.
@@ -35,7 +35,7 @@ const crypto = require("node:crypto");
35
35
  const { spawnSync, spawn } = require("node:child_process");
36
36
  const readline = require("node:readline");
37
37
 
38
- const VERSION = "0.21.0-runtime-mvp.27";
38
+ const VERSION = "0.21.0";
39
39
  const REGISTRY = path.join(os.homedir(), ".egregore", "instances.json");
40
40
  const DEFAULT_FILE = path.join(os.homedir(), ".egregore", "default");
41
41
  const UPDATE_CACHE_FILE = path.join(os.homedir(), ".egregore", "update-check.json");
@@ -753,72 +753,121 @@ async function renderCodexStartupCard(egregoreDir) {
753
753
  return false;
754
754
  }
755
755
 
756
- function codexSupportMessage(egregoreDir) {
757
- return [
758
- "Codex harness support is missing from this Egregore checkout.",
759
- ` path: ${egregoreDir}`,
760
- "",
761
- "This checkout needs a newer Egregore core with:",
762
- " bin/codex-session-start.sh",
763
- " bin/codex-install-skills.sh",
764
- " .codex/config.toml",
765
- " .codex/skills/",
766
- " .codex/hooks.json",
767
- " .codex/hooks/",
768
- "",
769
- "Restore this instance using its installed runtime version, then rerun egregore.",
770
- "A global CLI refresh does not repair instance files.",
771
- "Egregore workflows appear as slash commands. In Codex, invoke them with the matching $skill token or ask in natural language.",
772
- ].join("\n");
756
+ const CORE_SUPPORT_PATHS = {
757
+ codex: [
758
+ "AGENTS.md",
759
+ "bin/codex-session-start.sh",
760
+ "bin/codex-install-skills.sh",
761
+ ".codex/config.toml",
762
+ ".codex/skills",
763
+ ".codex/hooks.json",
764
+ ".codex/hooks",
765
+ ],
766
+ pi: [
767
+ "bin/pi-session-start.sh",
768
+ ".pi/APPEND_SYSTEM.md",
769
+ ".pi/settings.json",
770
+ ".pi/extensions/egregore.ts",
771
+ ".codex/skills",
772
+ ],
773
+ prime: [
774
+ "bin/prime-session-start.sh",
775
+ ".prime/agent/APPEND_SYSTEM.md",
776
+ ".prime/agent/settings.json",
777
+ ".prime/agent/extensions/egregore.ts",
778
+ ".codex/skills",
779
+ ],
780
+ };
781
+
782
+ function missingCorePaths(runtime, egregoreDir) {
783
+ return (CORE_SUPPORT_PATHS[runtime] || []).filter(
784
+ (rel) => !fs.existsSync(path.join(egregoreDir, ...rel.split("/"))),
785
+ );
773
786
  }
774
787
 
775
788
  function hasCodexCoreSupport(egregoreDir) {
776
- return (
777
- fs.existsSync(path.join(egregoreDir, "bin", "codex-session-start.sh")) &&
778
- fs.existsSync(path.join(egregoreDir, "bin", "codex-install-skills.sh")) &&
779
- fs.existsSync(path.join(egregoreDir, ".codex", "config.toml")) &&
780
- fs.existsSync(path.join(egregoreDir, ".codex", "skills")) &&
781
- fs.existsSync(path.join(egregoreDir, ".codex", "hooks.json")) &&
782
- fs.existsSync(path.join(egregoreDir, ".codex", "hooks"))
783
- );
789
+ return missingCorePaths("codex", egregoreDir).length === 0;
784
790
  }
785
791
 
786
792
  function hasPiCoreSupport(egregoreDir) {
787
- return (
788
- fs.existsSync(path.join(egregoreDir, "bin", "pi-session-start.sh")) &&
789
- fs.existsSync(path.join(egregoreDir, ".pi", "APPEND_SYSTEM.md")) &&
790
- fs.existsSync(path.join(egregoreDir, ".pi", "settings.json")) &&
791
- fs.existsSync(path.join(egregoreDir, ".pi", "extensions", "egregore.ts")) &&
792
- fs.existsSync(path.join(egregoreDir, ".codex", "skills"))
793
- );
793
+ return missingCorePaths("pi", egregoreDir).length === 0;
794
794
  }
795
795
 
796
- function piSupportMessage(egregoreDir) {
797
- return [
798
- "Pi meta-harness support is missing from this Egregore checkout.",
796
+ function hasPrimeCoreSupport(egregoreDir) {
797
+ return missingCorePaths("prime", egregoreDir).length === 0;
798
+ }
799
+
800
+ // The repair command is pinned to this launcher's own release. `@latest`
801
+ // once pulled another release channel's files into an instance; the
802
+ // launcher and the files it installs must always be the same version.
803
+ function harnessAddCommand(runtime) {
804
+ return `npx -y ${PUBLIC_NPX_PACKAGE}@${VERSION} --add-harness ${runtimeShort(runtime)}`;
805
+ }
806
+
807
+ function harnessSupportMessage(runtime, egregoreDir) {
808
+ const label = runtimeLabel(runtime);
809
+ const missing = missingCorePaths(runtime, egregoreDir);
810
+ const lines = [
811
+ `${label} support is missing from this Egregore checkout.`,
799
812
  ` path: ${egregoreDir}`,
813
+ ];
814
+ if (missing.length > 0) {
815
+ lines.push("", "Missing:");
816
+ for (const rel of missing) lines.push(` ${rel}`);
817
+ }
818
+ lines.push(
800
819
  "",
801
- "Restore this instance using its installed runtime version, then rerun egregore.",
802
- ].join("\n");
820
+ `Add ${label} support to this instance (missing files only, nothing overwritten):`,
821
+ ` cd ${egregoreDir}`,
822
+ ` ${harnessAddCommand(runtime)}`,
823
+ "Then rerun egregore.",
824
+ );
825
+ if (runtime === "codex") {
826
+ lines.push("Egregore workflows appear as slash commands. In Codex, invoke them with the matching $skill token or ask in natural language.");
827
+ }
828
+ return lines.join("\n");
803
829
  }
804
830
 
805
- function hasPrimeCoreSupport(egregoreDir) {
806
- return (
807
- fs.existsSync(path.join(egregoreDir, "bin", "prime-session-start.sh")) &&
808
- fs.existsSync(path.join(egregoreDir, ".prime", "agent", "APPEND_SYSTEM.md")) &&
809
- fs.existsSync(path.join(egregoreDir, ".prime", "agent", "settings.json")) &&
810
- fs.existsSync(path.join(egregoreDir, ".prime", "agent", "extensions", "egregore.ts")) &&
811
- fs.existsSync(path.join(egregoreDir, ".codex", "skills"))
812
- );
831
+ function codexSupportMessage(egregoreDir) {
832
+ return harnessSupportMessage("codex", egregoreDir);
833
+ }
834
+
835
+ function piSupportMessage(egregoreDir) {
836
+ return harnessSupportMessage("pi", egregoreDir);
813
837
  }
814
838
 
815
839
  function primeSupportMessage(egregoreDir) {
816
- return [
817
- "Prime Agent runtime support is missing from this Egregore checkout.",
818
- ` path: ${egregoreDir}`,
840
+ return harnessSupportMessage("prime", egregoreDir);
841
+ }
842
+
843
+ // A launch that fails the support check offers to add exactly that harness
844
+ // to exactly this instance, using this launcher's own release. Without a
845
+ // terminal to ask, print the command and stop; never install unattended.
846
+ async function ensureHarnessSupport(inst, runtime) {
847
+ if (missingCorePaths(runtime, inst.path).length === 0) return;
848
+ const message = harnessSupportMessage(runtime, inst.path);
849
+ if (!canPrompt()) die(message);
850
+ const label = runtimeLabel(runtime);
851
+ const name = inst.name || inst.slug || path.basename(inst.path);
852
+ process.stdout.write([
819
853
  "",
820
- "Restore this instance using its installed runtime version, then rerun egregore.",
821
- ].join("\n");
854
+ ` ${BOLD}${label} support is missing from ${name}.${RESET}`,
855
+ ` ${DIM}Missing: ${missingCorePaths(runtime, inst.path).join(", ")}${RESET}`,
856
+ ` ${DIM}Egregore can add it now. Only missing files are written; nothing is overwritten:${RESET}`,
857
+ ` ${harnessAddCommand(runtime)}`,
858
+ "",
859
+ ].join("\n"));
860
+ const yes = await confirmLine(`Add ${label} support to ${name} now?`);
861
+ if (!yes) die(message);
862
+ const result = spawnSync(
863
+ "npx",
864
+ ["-y", `${PUBLIC_NPX_PACKAGE}@${VERSION}`, "--add-harness", runtimeShort(runtime)],
865
+ { cwd: inst.path, stdio: "inherit", env: process.env, timeout: 3 * 60 * 1000 },
866
+ );
867
+ if (result.error || result.status !== 0 || missingCorePaths(runtime, inst.path).length > 0) {
868
+ die(`${label} support could not be added automatically.\n\n${harnessSupportMessage(runtime, inst.path)}`);
869
+ }
870
+ process.stdout.write(` ${GREEN}✓${RESET} ${label} support added to ${name}\n\n`);
822
871
  }
823
872
 
824
873
  // Minimal y/N line prompt for pre-launch decisions (the TUI select machinery
@@ -873,7 +922,7 @@ function primeAuthHint() {
873
922
 
874
923
  function installCodexSkills(egregoreDir) {
875
924
  const script = path.join(egregoreDir, "bin", "codex-install-skills.sh");
876
- if (!fs.existsSync(script)) return false;
925
+ if (!fs.existsSync(script)) return { ok: false, stderr: `missing ${script}` };
877
926
  try {
878
927
  const result = spawnSync("bash", [script], {
879
928
  cwd: egregoreDir,
@@ -881,9 +930,9 @@ function installCodexSkills(egregoreDir) {
881
930
  encoding: "utf-8",
882
931
  maxBuffer: 1024 * 1024,
883
932
  });
884
- return result.status === 0;
885
- } catch {
886
- return false;
933
+ return { ok: result.status === 0, stderr: (result.stderr || "").trim() };
934
+ } catch (err) {
935
+ return { ok: false, stderr: String(err && err.message ? err.message : err) };
887
936
  }
888
937
  }
889
938
 
@@ -966,29 +1015,31 @@ async function launch(inst, runtimeOverride) {
966
1015
  }
967
1016
  }
968
1017
  if (runtime === "codex") {
969
- // Launching never changes an instance's runtime or release channel.
970
- if (!hasCodexCoreSupport(inst.path)) die(codexSupportMessage(inst.path));
971
- const skillsInstalled = installCodexSkills(inst.path);
1018
+ // Launching never changes an instance's runtime or release channel. A
1019
+ // missing harness is added only with the user's consent, one harness
1020
+ // into this one instance, at this launcher's own version.
1021
+ await ensureHarnessSupport(inst, runtime);
1022
+ const skills = installCodexSkills(inst.path);
1023
+ if (!skills.ok) {
1024
+ die(`Codex skill setup failed in ${inst.path} (bin/codex-install-skills.sh):\n${skills.stderr || " (no error output)"}`);
1025
+ }
972
1026
  const cardRendered = await renderCodexStartupCard(inst.path);
973
- if (!skillsInstalled || !cardRendered) {
974
- die(codexSupportMessage(inst.path));
1027
+ if (!cardRendered) {
1028
+ die(`Codex startup card failed in ${inst.path} (bin/codex-session-start.sh exited non-zero; its output is above).`);
975
1029
  }
976
1030
  } else if (runtime === "pi") {
977
- if (!hasPiCoreSupport(inst.path)) {
978
- die(piSupportMessage(inst.path));
979
- }
1031
+ await ensureHarnessSupport(inst, runtime);
980
1032
  }
981
1033
  let launchArgs = null;
982
1034
  if (runtime === "prime") {
1035
+ await ensureHarnessSupport(inst, runtime);
983
1036
  // Cover the gap between choosing the harness and Prime's first paint:
984
- // the loader runs through the launcher-side pre-flight (core-support
985
- // check + the trust-flag probe, which shells out to the binary), then a
986
- // single handoff line explains the remaining in-harness startup.
1037
+ // the loader runs through the launcher-side pre-flight (the trust-flag
1038
+ // probe, which shells out to the binary), then a single handoff line
1039
+ // explains the remaining in-harness startup.
987
1040
  const stopLoader = startSpinner("Starting Prime Agent");
988
- const coreOk = hasPrimeCoreSupport(inst.path);
989
- launchArgs = coreOk ? runtimeLaunchArgs(runtime, inst.path) : null;
1041
+ launchArgs = runtimeLaunchArgs(runtime, inst.path);
990
1042
  stopLoader();
991
- if (!coreOk) die(primeSupportMessage(inst.path));
992
1043
  primeAuthHint();
993
1044
  process.stdout.write(` ${CYAN}◆${RESET} ${BOLD}Prime Agent starting${RESET}${DIM} — the Egregore greeting loads inside in a few seconds${RESET}\n`);
994
1045
  }
@@ -1304,7 +1355,10 @@ function compareReleaseVersions(a, b) {
1304
1355
  }
1305
1356
 
1306
1357
  function cliUpdateState(latest) {
1307
- if (!parseReleaseVersion(latest)) return null;
1358
+ // The global refresh follows latest; prerelease testing is selected explicitly.
1359
+ const parsed = parseReleaseVersion(latest);
1360
+ if (!RUNTIME_STABLE_VERSION_RE.test(latest || "") || !parsed
1361
+ || !parsed.parts.every(Number.isSafeInteger)) return null;
1308
1362
  return {
1309
1363
  current: VERSION,
1310
1364
  latest,
@@ -1395,7 +1449,7 @@ function cmdCliUpdate(latest) {
1395
1449
  );
1396
1450
  if (result.status !== 0) {
1397
1451
  console.log(`\r${ANSI.clearLine} [1/2] ${YELLOW}!${RESET} Install failed`);
1398
- const detail = String(result.stderr || result.stdout || "").trim().split("\n").filter(Boolean).pop();
1452
+ const detail = adapterErrorText(result.stderr || result.stdout || "").trim().split("\n").filter(Boolean).pop();
1399
1453
  if (detail) console.error(` ${DIM}${detail}${RESET}`);
1400
1454
  console.error(` Retry: npx -y ${PUBLIC_NPX_PACKAGE}@${latest} --refresh-launcher\n`);
1401
1455
  process.exitCode = 1;
@@ -1567,10 +1621,39 @@ function persistConnectState(inst, fields) {
1567
1621
  writeJsonFileAtomic(file, state);
1568
1622
  }
1569
1623
 
1624
+ // Older installed adapters and API versions may still use storage terminology.
1625
+ // Normalize only diagnostic display text; protocol fields and payloads stay intact.
1626
+ function adapterErrorText(detail) {
1627
+ return String(detail)
1628
+ // Describe a retired technical reference as a whole. Replacing one word
1629
+ // inside a path/module or shell invocation would invent a runnable command.
1630
+ .replace(/(^|\s)(?:(?:\/[^\s"'`]+)*\/)?(?:bash|sh|zsh)\s+(?:"([^"\n]+)"|'([^'\n]+)'|([^\s;"'`]+))/g,
1631
+ (command, prefix, quoted, singleQuoted, bare) => {
1632
+ const script = quoted || singleQuoted || bare;
1633
+ if (!/(?:graph|neo4j)/i.test(script)) return command;
1634
+ return prefix + (/sync-graph\.sh$/i.test(script) ? "the memory sync operation" : "the hosted storage operation");
1635
+ })
1636
+ .replace(/[^\s"'`()\[\]{},;:]+/g, (token) => {
1637
+ if (!/(?:graph|neo4j)/i.test(token)) return token;
1638
+ if (/[/\\]/.test(token)) {
1639
+ if (/[/\\]bin[/\\][^/\\]+\.sh$/i.test(token) || /^bin[/\\][^/\\]+\.sh$/i.test(token)) {
1640
+ return /sync-graph\.sh$/i.test(token) ? "the memory sync adapter" : "the hosted storage adapter";
1641
+ }
1642
+ return "the hosted storage path";
1643
+ }
1644
+ if (/^[a-z_][\w-]*(?:\.[a-z_][\w-]*)+\.?$/i.test(token)) return "the hosted storage component";
1645
+ return token;
1646
+ })
1647
+ .replace(/\bknowledge graph\b/gi, "shared memory")
1648
+ .replace(/\bgraph database\b/gi, "hosted storage")
1649
+ .replace(/\bneo4j\b/gi, "hosted storage")
1650
+ .replace(/\bgraph\b/gi, "storage");
1651
+ }
1652
+
1570
1653
  function connectError(result, fallback) {
1571
1654
  if (!result) return fallback;
1572
1655
  const data = result.data || {};
1573
- return data.detail || data.message || (typeof data === "string" ? data : fallback);
1656
+ return adapterErrorText(data.detail || data.message || (typeof data === "string" ? data : fallback));
1574
1657
  }
1575
1658
 
1576
1659
  function sleep(ms) {
@@ -1596,7 +1679,7 @@ function backfillSummaryLines(summary) {
1596
1679
 
1597
1680
  if (sessions !== null && artifacts !== null && quests !== null) {
1598
1681
  if (sessions + artifacts + quests === 0) {
1599
- lines.push("Graph already contained all sessions, artifacts, and quests");
1682
+ lines.push("Hosted memory is already up to date for sessions, artifacts, and quests");
1600
1683
  } else {
1601
1684
  lines.push(`Added ${[
1602
1685
  backfillCountLabel(sessions, "session", "sessions"),
@@ -1614,6 +1697,23 @@ function backfillSummaryLines(summary) {
1614
1697
  return lines;
1615
1698
  }
1616
1699
 
1700
+ function connectedOrganizationId(config, response) {
1701
+ const current = String(config.org_id || "");
1702
+ const returned = String(response?.org_id || "");
1703
+ if (!/^(?:org_[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/.test(returned) ||
1704
+ (current && !current.startsWith("legacy-org:") && returned !== current)) {
1705
+ die("Connected did not confirm this Egregore's existing identity. Local configuration is unchanged; update the hosted service before retrying.");
1706
+ }
1707
+ return returned || current;
1708
+ }
1709
+
1710
+ function hostedMemorySyncEnabled(config) {
1711
+ const override = process.env.EGREGORE_GRAPH_PROJECTION;
1712
+ if (["1", "true", "enabled"].includes(override)) return true;
1713
+ if (["0", "false", "disabled"].includes(override)) return false;
1714
+ return config.features?.graph_projection === true;
1715
+ }
1716
+
1617
1717
  async function cmdConnect(args) {
1618
1718
  const fresh = args.includes("--fresh");
1619
1719
  const positional = args.filter((a) => !String(a).startsWith("--"));
@@ -1631,6 +1731,8 @@ async function cmdConnect(args) {
1631
1731
  die(`GITHUB_TOKEN is missing for ${inst.slug}.\n Add it to ${path.join(inst.path, ".env")} and retry.`);
1632
1732
  }
1633
1733
  const activation = state.connected_activation || {};
1734
+ let expectedOrgId = cfg.org_id && !String(cfg.org_id).startsWith("legacy-org:")
1735
+ ? cfg.org_id : activation.org_id || "";
1634
1736
  if (cfg.mode === "connected" && activation.status === "connected") {
1635
1737
  if (activation.intent_id) {
1636
1738
  const repaired = await connectedApiRequest(
@@ -1644,8 +1746,10 @@ async function cmdConnect(args) {
1644
1746
  `Connected is active, but its shared configuration could not be published: ${connectError(repaired, `HTTP ${repaired.status}`)}`,
1645
1747
  );
1646
1748
  }
1749
+ const orgId = connectedOrganizationId(cfg, repaired.data);
1647
1750
  writeJsonFileAtomic(path.join(inst.path, "egregore.json"), {
1648
1751
  ...cfg,
1752
+ ...(orgId ? { org_id: orgId } : {}),
1649
1753
  mode: "connected",
1650
1754
  api_url: repaired.data.api_url,
1651
1755
  });
@@ -1701,16 +1805,18 @@ async function cmdConnect(args) {
1701
1805
  // Local installs may have skipped platform registration (DO_NOT_TRACK
1702
1806
  // gates it as telemetry). Connect requires it functionally, and choosing
1703
1807
  // Connect is the consent — register on demand. Idempotent for members of
1704
- // already-registered orgs; a 409 (registered by someone else) falls
1705
- // through to the billing-actor check on intent creation.
1808
+ // already-registered orgs. Identity conflicts must stop before checkout.
1706
1809
  const registration = await connectedApiRequest(githubToken, "POST", "/api/org/register", {
1707
1810
  org_name: cfg.org_name || inst.slug,
1708
1811
  github_org: cfg.github_org || "",
1709
1812
  slug: cfg.slug || inst.slug,
1813
+ ...(cfg.org_id && !String(cfg.org_id).startsWith("legacy-org:") ? { org_id: cfg.org_id } : {}),
1814
+ repo_name: cfg.repo_name || "egregore",
1710
1815
  });
1711
- if (registration.status !== 200 && registration.status !== 409) {
1816
+ if (registration.status !== 200) {
1712
1817
  die(`could not register this Egregore with the platform: ${connectError(registration, `HTTP ${registration.status}`)}`);
1713
1818
  }
1819
+ expectedOrgId = connectedOrganizationId(cfg, registration.data);
1714
1820
  console.log(` [1/5] ${DIM}Creating connection intent…${RESET}`);
1715
1821
  const checkout = await connectedApiRequest(
1716
1822
  githubToken,
@@ -1724,6 +1830,7 @@ async function cmdConnect(args) {
1724
1830
  mode: cfg.mode || "local",
1725
1831
  repo_name: cfg.repo_name || "",
1726
1832
  managed_repo_count: Array.isArray(cfg.repos) ? cfg.repos.length : 0,
1833
+ hosted_memory_sync: hostedMemorySyncEnabled(cfg),
1727
1834
  fresh,
1728
1835
  },
1729
1836
  },
@@ -1736,6 +1843,7 @@ async function cmdConnect(args) {
1736
1843
  connectUrl = checkout.data.connect_url;
1737
1844
  persistConnectState(inst, {
1738
1845
  intent_id: intentId,
1846
+ org_id: expectedOrgId,
1739
1847
  connect_ticket: checkout.data.connect_ticket,
1740
1848
  connect_ticket_expires_at: checkout.data.connect_ticket_expires_at,
1741
1849
  connect_url: connectUrl,
@@ -1743,6 +1851,17 @@ async function cmdConnect(args) {
1743
1851
  });
1744
1852
  console.log(` [1/5] ${GREEN}✓${RESET} Connection intent`);
1745
1853
  } else {
1854
+ if (!expectedOrgId) {
1855
+ const registration = await connectedApiRequest(githubToken, "POST", "/api/org/register", {
1856
+ org_name: cfg.org_name || inst.slug, github_org: cfg.github_org || "",
1857
+ slug: cfg.slug || inst.slug, repo_name: cfg.repo_name || "egregore",
1858
+ });
1859
+ if (registration.status !== 200) {
1860
+ die(`could not confirm this Egregore's identity: ${connectError(registration, `HTTP ${registration.status}`)}`);
1861
+ }
1862
+ expectedOrgId = connectedOrganizationId(cfg, registration.data);
1863
+ persistConnectState(inst, { org_id: expectedOrgId });
1864
+ }
1746
1865
  console.log(` [1/5] ${GREEN}✓${RESET} Resuming connection intent`);
1747
1866
  }
1748
1867
 
@@ -1802,8 +1921,11 @@ async function cmdConnect(args) {
1802
1921
  const configFile = path.join(inst.path, "egregore.json");
1803
1922
  const envFile = path.join(inst.path, ".env");
1804
1923
  const currentConfig = readJsonFile(configFile);
1924
+ const orgId = connectedOrganizationId({ ...currentConfig, org_id: expectedOrgId || currentConfig.org_id }, claim.data);
1925
+ const syncEnabled = hostedMemorySyncEnabled(currentConfig);
1805
1926
  writeJsonFileAtomic(configFile, {
1806
1927
  ...currentConfig,
1928
+ ...(orgId ? { org_id: orgId } : {}),
1807
1929
  mode: "connected",
1808
1930
  api_url: claim.data.api_url,
1809
1931
  });
@@ -1814,19 +1936,22 @@ async function cmdConnect(args) {
1814
1936
  status: "backfilling",
1815
1937
  activation_protocol: claim.data.activation_protocol,
1816
1938
  });
1817
- console.log(` [4/5] ${GREEN}✓${RESET} Connected credential and graph node`);
1939
+ console.log(` [4/5] ${GREEN}✓${RESET} Hosted access and organization ready`);
1818
1940
 
1819
1941
  let backfillSummary = { replayed: true };
1820
1942
  if (fresh) {
1821
1943
  // Fresh install — no existing memory to project; skip the replay entirely.
1822
- console.log(` [5/5] ${GREEN}✓${RESET} Fresh instance — nothing to project yet`);
1944
+ console.log(` [5/5] ${GREEN}✓${RESET} Fresh instance — no existing memory to sync`);
1823
1945
  backfillSummary = { fresh: true, replayed: false };
1946
+ } else if (!syncEnabled) {
1947
+ backfillSummary = { replayed: false, reason: "local_memory" };
1948
+ console.log(` [5/5] ${GREEN}✓${RESET} Memory and retrieval remain local`);
1824
1949
  } else {
1825
1950
  const syncScript = path.join(inst.path, "bin", "sync-graph.sh");
1826
1951
  if (!fs.existsSync(syncScript)) {
1827
- die("bin/sync-graph.sh is missing. Update the installed Egregore version, then run egregore connect again.");
1952
+ die("The memory sync adapter is missing. Update the installed Egregore version, then run egregore connect again.");
1828
1953
  }
1829
- console.log(` [5/5] ${CYAN}◦${RESET} Projecting existing memory into the graph…`);
1954
+ console.log(` [5/5] ${CYAN}◦${RESET} Syncing existing memory with hosted services…`);
1830
1955
  console.log(` ${DIM}Scanning sessions, artifacts, quests, and ingest history${RESET}`);
1831
1956
  const sync = spawnSync("bash", [syncScript], {
1832
1957
  cwd: inst.path,
@@ -1835,8 +1960,8 @@ async function cmdConnect(args) {
1835
1960
  timeout: 10 * 60 * 1000,
1836
1961
  });
1837
1962
  if (sync.status !== 0) {
1838
- const detail = (sync.stderr || sync.stdout || "graph replay failed").trim();
1839
- die(`Connected is configured, but graph replay did not finish.\n ${detail}\n Run egregore connect ${inst.slug} to retry; existing data is unchanged.`);
1963
+ const detail = adapterErrorText(sync.stderr || sync.stdout || "memory sync failed").trim();
1964
+ die(`Connected is configured, but memory sync did not finish.\n ${detail}\n Run egregore connect ${inst.slug} to retry; existing data is unchanged.`);
1840
1965
  }
1841
1966
  try { backfillSummary = JSON.parse((sync.stdout || "").trim()); } catch {}
1842
1967
  }
@@ -1853,15 +1978,15 @@ async function cmdConnect(args) {
1853
1978
  await sleep(250 * (attempt + 1));
1854
1979
  }
1855
1980
  if (complete.status !== 200) {
1856
- die(`graph replay finished, but activation could not be finalized: ${connectError(complete, `HTTP ${complete.status}`)}`);
1981
+ die(`Hosted access is configured, but activation could not be finalized: ${connectError(complete, `HTTP ${complete.status}`)}`);
1857
1982
  }
1858
1983
  persistConnectState(inst, {
1859
1984
  status: "connected",
1860
1985
  connected_at: new Date().toISOString(),
1861
1986
  backfill_summary: backfillSummary,
1862
1987
  });
1863
- if (!fresh) {
1864
- console.log(` [5/5] ${GREEN}✓${RESET} Existing memory projected into the graph`);
1988
+ if (!fresh && syncEnabled) {
1989
+ console.log(` [5/5] ${GREEN}✓${RESET} Existing memory synced with hosted services`);
1865
1990
  for (const line of backfillSummaryLines(backfillSummary)) {
1866
1991
  console.log(` ${DIM}${line}${RESET}`);
1867
1992
  }
@@ -2295,43 +2420,23 @@ function settingsDump(inst) {
2295
2420
  // explicit verbs — one source of truth, no JS reimplementation.
2296
2421
 
2297
2422
  const RUNTIME_MVP_VERSION_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-runtime-mvp\.(0|[1-9]\d*)$/;
2298
- const RUNTIME_MVP_REGISTRY_URL = process.env.EGREGORE_RUNTIME_MVP_REGISTRY_URL
2299
- || "https://registry.npmjs.org/create-egregore/runtime-mvp";
2423
+ const RUNTIME_STABLE_VERSION_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
2300
2424
 
2301
- function upgradeScriptPath(inst) {
2302
- return path.join(inst.path, "bin", "runtime-upgrade.sh");
2425
+ function isRuntimeCandidate(version) {
2426
+ return typeof version === "string"
2427
+ && (RUNTIME_MVP_VERSION_RE.test(version) || RUNTIME_STABLE_VERSION_RE.test(version))
2428
+ && parseReleaseVersion(version).parts.every(Number.isSafeInteger)
2429
+ && compareReleaseVersions(version, "0.21.0-runtime-mvp.0") >= 0;
2303
2430
  }
2304
2431
 
2305
- // After the Runtime cutover, a Connected instance's hosted link no longer
2306
- // serves retrieval — saying "hosted graph active" would misstate what the
2307
- // connection is for. Mirror the shell gate (bin/search.sh): stable org
2308
- // identity composed with the main installation path keys the activation
2309
- // record; only a real record flips the wording.
2310
- function upgradedGraphRetrievalOff(instPath) {
2311
- try {
2312
- const cfg = JSON.parse(fs.readFileSync(path.join(instPath, "egregore.json"), "utf-8"));
2313
- const orgId = String(cfg.org_id || "").trim();
2314
- if (!orgId) return false;
2315
- let main = instPath;
2316
- const gitFile = path.join(instPath, ".git");
2317
- if (fs.existsSync(gitFile) && fs.statSync(gitFile).isFile()) {
2318
- const m = /^gitdir: (.*)$/m.exec(fs.readFileSync(gitFile, "utf-8"));
2319
- if (m && m[1].includes("/.git/worktrees/")) main = m[1].split("/.git/worktrees/")[0];
2320
- }
2321
- main = fs.realpathSync(main);
2322
- const key = crypto.createHash("sha256").update(`${orgId}|${main}`).digest("hex").slice(0, 16);
2323
- const base = process.env.EGREGORE_UPGRADE_ROOT || path.join(os.homedir(), ".egregore", "runtime", "upgrade");
2324
- const record = JSON.parse(fs.readFileSync(path.join(base, key, "active.json"), "utf-8"));
2325
- return record.retrieval === "runtime-qmd";
2326
- } catch {
2327
- return false;
2328
- }
2432
+ function upgradeScriptPath(inst) {
2433
+ return path.join(inst.path, "bin", "runtime-upgrade.sh");
2329
2434
  }
2330
2435
 
2331
- function connectedModeSuffix(instPath) {
2332
- return upgradedGraphRetrievalOff(instPath)
2333
- ? "· hosted services · graph retrieval off"
2334
- : "· hosted graph active";
2436
+ // Connected describes the hosted service relationship. Retrieval health is
2437
+ // shown separately in Runtime settings, including on fresh installations.
2438
+ function connectedModeSuffix() {
2439
+ return "· hosted services";
2335
2440
  }
2336
2441
 
2337
2442
  // An instance that predates the bridge (0.20.1 and earlier) is still
@@ -2357,8 +2462,23 @@ function packagedUpgradeScript() {
2357
2462
 
2358
2463
  function resolveUpgradeBridge(inst) {
2359
2464
  const own = upgradeScriptPath(inst);
2360
- if (fs.existsSync(own)) return { script: own, env: {} };
2361
2465
  const packaged = packagedUpgradeScript();
2466
+ if (fs.existsSync(own)) {
2467
+ // Older MVP engines reject stable versions. Probe without identity setup
2468
+ // or state writes; use the launcher's engine for the entire transaction
2469
+ // when the installed engine predates this protocol advertisement.
2470
+ if (!packaged || !fs.existsSync(packaged)) return { script: own, env: { EGREGORE_INSTANCE_ROOT: inst.path } };
2471
+ try {
2472
+ const probe = spawnSync("bash", upgradeBridgeArgs({ script: own }, ["capabilities"]), {
2473
+ cwd: inst.path, encoding: "utf-8", timeout: 2000,
2474
+ env: { ...process.env, EGREGORE_INSTANCE_ROOT: inst.path },
2475
+ });
2476
+ const capability = probe.status === 0 ? JSON.parse(probe.stdout) : null;
2477
+ if (capability?.upgrade_protocol === 1 && capability.stable_candidates === true) {
2478
+ return { script: own, env: { EGREGORE_INSTANCE_ROOT: inst.path } };
2479
+ }
2480
+ } catch { /* Missing/legacy capability response uses the packaged engine. */ }
2481
+ }
2362
2482
  if (packaged && fs.existsSync(packaged)) {
2363
2483
  return { script: packaged, env: { EGREGORE_INSTANCE_ROOT: inst.path } };
2364
2484
  }
@@ -2449,8 +2569,8 @@ function formatPrivacyLines(snapshot) {
2449
2569
  lines.push(`Personal read roots: ${personalRoots.length ? personalRoots.join(", ") : "none"}`);
2450
2570
  lines.push(
2451
2571
  snapshot.graph_retrieval === "not-used-by-this-runtime"
2452
- ? "Graph retrieval: not used by this Runtime"
2453
- : "Graph retrieval: legacy configuration",
2572
+ ? "Search: local to this Egregore"
2573
+ : "Search: check Runtime status",
2454
2574
  );
2455
2575
  return lines;
2456
2576
  }
@@ -2569,14 +2689,20 @@ function retrievalHealthAsync(inst, cb) {
2569
2689
  } catch { cb(null); }
2570
2690
  }
2571
2691
 
2572
- // Exact candidate resolution: the runtime-mvp dist-tag only, validated
2573
- // against the prerelease scheme — never latest, never a retired scheme.
2574
- // EGREGORE_RUNTIME_MVP_CANDIDATE is the offline/test seam.
2575
- async function fetchRuntimeMvpCandidate() {
2576
- const seeded = process.env.EGREGORE_RUNTIME_MVP_CANDIDATE;
2577
- if (seeded !== undefined) return RUNTIME_MVP_VERSION_RE.test(seeded) ? seeded : null;
2692
+ // Stable is the default even for an existing MVP installation. Testing the
2693
+ // prerelease channel requires an explicit selection; dist-tags never reach init.
2694
+ async function fetchRuntimeCandidate() {
2695
+ const channel = process.env.EGREGORE_RUNTIME_CHANNEL || "stable";
2696
+ if (!["stable", "runtime-mvp"].includes(channel)) return null;
2697
+ const mvp = channel === "runtime-mvp";
2698
+ const accepts = (version) => isRuntimeCandidate(version)
2699
+ && (mvp ? RUNTIME_MVP_VERSION_RE : RUNTIME_STABLE_VERSION_RE).test(version);
2700
+ const seeded = process.env[mvp ? "EGREGORE_RUNTIME_MVP_CANDIDATE" : "EGREGORE_RUNTIME_STABLE_CANDIDATE"];
2701
+ if (seeded !== undefined) return accepts(seeded) ? seeded : null;
2702
+ const registryUrl = process.env[mvp ? "EGREGORE_RUNTIME_MVP_REGISTRY_URL" : "EGREGORE_RUNTIME_STABLE_REGISTRY_URL"]
2703
+ || `https://registry.npmjs.org/create-egregore/${mvp ? "runtime-mvp" : "latest"}`;
2578
2704
  try {
2579
- const url = new URL(RUNTIME_MVP_REGISTRY_URL);
2705
+ const url = new URL(registryUrl);
2580
2706
  const result = await requestJson({
2581
2707
  hostname: url.hostname,
2582
2708
  port: url.port || undefined,
@@ -2588,7 +2714,7 @@ async function fetchRuntimeMvpCandidate() {
2588
2714
  headers: { Accept: "application/json" },
2589
2715
  });
2590
2716
  const version = result.status === 200 && result.data && result.data.version;
2591
- return version && RUNTIME_MVP_VERSION_RE.test(version) ? version : null;
2717
+ return accepts(version) ? version : null;
2592
2718
  } catch {
2593
2719
  return null;
2594
2720
  }
@@ -2599,6 +2725,7 @@ async function fetchRuntimeMvpCandidate() {
2599
2725
  // staged must not dead-end into a CLI instruction referencing a tarball the
2600
2726
  // user does not have — the registry has it, digest-verified.
2601
2727
  function fetchCandidateTarball(version, cb) {
2728
+ if (!isRuntimeCandidate(version)) return cb(new Error("an exact supported Runtime version is required"));
2602
2729
  const metaUrl = new URL(`https://registry.npmjs.org/${PUBLIC_NPX_PACKAGE}/${version}`);
2603
2730
  requestJson({
2604
2731
  hostname: metaUrl.hostname,
@@ -2609,7 +2736,12 @@ function fetchCandidateTarball(version, cb) {
2609
2736
  headers: { Accept: "application/json" },
2610
2737
  }).then((meta) => {
2611
2738
  const dist = meta && meta.status === 200 && meta.data && meta.data.dist;
2612
- if (!dist || !dist.tarball) return cb(new Error(`candidate ${version} not found on the registry`));
2739
+ if (!dist || !dist.tarball || meta.data.name !== PUBLIC_NPX_PACKAGE || meta.data.version !== version) {
2740
+ return cb(new Error(`candidate ${version} not found on the registry`));
2741
+ }
2742
+ if (typeof dist.integrity !== "string" || !/^sha512-[A-Za-z0-9+/]{86}==$/.test(dist.integrity)) {
2743
+ return cb(new Error("candidate sha512 integrity is missing or invalid — refusing to stage"));
2744
+ }
2613
2745
  const dest = path.join(os.tmpdir(), `egregore-candidate-${version}.tgz`);
2614
2746
  const fetchTarball = (url, redirects) => {
2615
2747
  https.get(url, { headers: { "User-Agent": "egregore-launcher" } }, (res) => {
@@ -2660,7 +2792,7 @@ const UPGRADE_STATUS_LABEL = {
2660
2792
  // transaction state, not the condition the user needs to see.
2661
2793
  function runtimeUpdateAvailable(st, candidate) {
2662
2794
  return st?.status === "active"
2663
- && RUNTIME_MVP_VERSION_RE.test(candidate || "")
2795
+ && isRuntimeCandidate(candidate)
2664
2796
  && compareReleaseVersions(candidate, st.active_version) > 0;
2665
2797
  }
2666
2798
 
@@ -2716,14 +2848,14 @@ function formatUpgradeLines(inst, st, { candidate = "", retrieval = null } = {})
2716
2848
  // A recorded failure only needs attention while the transaction is stuck
2717
2849
  // on it; once a later prepare succeeds the line would contradict "ready".
2718
2850
  if (d.failure && d.failure.message && (["failed", "interrupted", "unavailable"].includes(d.status))) {
2719
- lines.push(`Attention: ${d.failure.message}`);
2851
+ lines.push(`Attention: ${adapterErrorText(d.failure.message)}`);
2720
2852
  }
2721
2853
  if (d.rollback_version && d.status !== "none") lines.push(`Rollback target: ${d.rollback_version}`);
2722
2854
  const ts = d.team_sync;
2723
2855
  if (ts && ts.label) lines.push(`Team memory: ${ts.label}`);
2724
2856
  if (d.status === "active") {
2725
2857
  lines.push("Organizational retrieval: Runtime/QMD");
2726
- lines.push("Graph retrieval: not used by this Runtime version");
2858
+ lines.push("Search: local to this Egregore");
2727
2859
  } else if (d.status !== "none") {
2728
2860
  lines.push("Previous Runtime remains active until activation.");
2729
2861
  }
@@ -2752,10 +2884,10 @@ function formatUpgradeLines(inst, st, { candidate = "", retrieval = null } = {})
2752
2884
  parts.push(`${upgradeElapsed(d)} elapsed`);
2753
2885
  detail = ` — ${parts.join(" · ")}`;
2754
2886
  } else if (stage.state === "done" && stage.detail) {
2755
- detail = ` — ${stage.detail}`;
2887
+ detail = ` — ${adapterErrorText(stage.detail)}`;
2756
2888
  }
2757
2889
  } else if (stage.state === "failed" && stage.detail) {
2758
- detail = ` — ${stage.detail}`;
2890
+ detail = ` — ${adapterErrorText(stage.detail)}`;
2759
2891
  }
2760
2892
  lines.push(` ${glyph} ${stage.label}${detail}`);
2761
2893
  }
@@ -2775,7 +2907,7 @@ const UPGRADE_CHANGES = [
2775
2907
  "Runtime version",
2776
2908
  "Organizational retrieval moves to Runtime/QMD",
2777
2909
  "Keyword and meaning search become owned by this Egregore",
2778
- "Graph retrieval stops after activation (kept only for rollback)",
2910
+ "Previous search is replaced after activation (kept for rollback)",
2779
2911
  "Cross-session continuity uses the new Runtime",
2780
2912
  "Readiness and synchronization become visible here in Settings",
2781
2913
  ];
@@ -2802,22 +2934,28 @@ async function cmdSettingsRuntime(inst, args) {
2802
2934
  if (action === "init") {
2803
2935
  const version = (args[1] || "").trim();
2804
2936
  const tarball = (args[2] || "").trim();
2805
- if (!RUNTIME_MVP_VERSION_RE.test(version)) {
2806
- process.stderr.write("Runtime update needs an exact candidate like 0.21.0-runtime-mvp.1.\n");
2937
+ if (!isRuntimeCandidate(version)) {
2938
+ process.stderr.write("Runtime update needs an exact version like 0.21.0 or 0.21.0-runtime-mvp.1.\n");
2807
2939
  process.exitCode = 1; return;
2808
2940
  }
2809
2941
  if (!tarball || !fs.existsSync(tarball)) {
2810
2942
  process.stderr.write("Runtime update installs actual packaged bytes: egregore settings <slug> runtime init <version> <candidate.tgz>\n");
2811
2943
  process.exitCode = 1; return;
2812
2944
  }
2945
+ const current = upgradeStatus(inst);
2946
+ if (!current || current.status === "unavailable" || (current.active_version && (!parseReleaseVersion(current.active_version)
2947
+ || compareReleaseVersions(version, current.active_version) <= 0))) {
2948
+ process.stderr.write("Runtime update requires a version newer than the verified active version; use rollback for recovery.\n");
2949
+ process.exitCode = 1; return;
2950
+ }
2813
2951
  const r = runUpgrade(inst, ["init", "--candidate", version, "--tarball", path.resolve(tarball)]);
2814
- if (r.status !== 0) { process.stderr.write(r.stderr || "could not stage the candidate\n"); process.exitCode = r.status; return; }
2952
+ if (r.status !== 0) { process.stderr.write(adapterErrorText(r.stderr || "could not stage the candidate\n")); process.exitCode = r.status; return; }
2815
2953
  emit(upgradeStatus(inst) || null);
2816
2954
  return;
2817
2955
  }
2818
2956
  if (["prepare", "activate", "cancel", "rollback"].includes(action)) {
2819
2957
  const r = runUpgrade(inst, [action]);
2820
- if (r.status !== 0) { process.stderr.write(r.stderr || `${action} failed\n`); process.exitCode = r.status; return; }
2958
+ if (r.status !== 0) { process.stderr.write(adapterErrorText(r.stderr || `${action} failed\n`)); process.exitCode = r.status; return; }
2821
2959
  const st = upgradeStatus(inst);
2822
2960
  emit(st);
2823
2961
  if (action === "activate" && st && st.status === "active") {
@@ -3925,17 +4063,17 @@ async function browser(args = {}) {
3925
4063
  const r = runUpgrade(inst, ["prepare"]);
3926
4064
  state.upgradeNotice = r.status === 0
3927
4065
  ? `${DIM}Preparing in the background — safe to leave this screen.${RESET}`
3928
- : `${YELLOW}${(r.stderr || "prepare failed").trim().split("\n")[0]}${RESET}`;
4066
+ : `${YELLOW}${adapterErrorText(r.stderr || "prepare failed").trim().split("\n")[0]}${RESET}`;
3929
4067
  } else if (mode === "confirm-activate") {
3930
4068
  const r = runUpgrade(inst, ["activate"]);
3931
4069
  state.upgradeNotice = r.status === 0
3932
4070
  ? `${GREEN}Update complete. Start a session to work on the new Runtime.${RESET}`
3933
- : `${YELLOW}${(r.stderr || "activation refused — a gate has not passed").trim().split("\n")[0]}${RESET}`;
4071
+ : `${YELLOW}${adapterErrorText(r.stderr || "activation refused — a gate has not passed").trim().split("\n")[0]}${RESET}`;
3934
4072
  } else if (mode === "confirm-rollback") {
3935
4073
  const r = runUpgrade(inst, ["rollback"]);
3936
4074
  state.upgradeNotice = r.status === 0
3937
4075
  ? `${DIM}Rolled back. The previous Runtime is active again.${RESET}`
3938
- : `${YELLOW}${(r.stderr || "rollback failed").trim().split("\n")[0]}${RESET}`;
4076
+ : `${YELLOW}${adapterErrorText(r.stderr || "rollback failed").trim().split("\n")[0]}${RESET}`;
3939
4077
  } else if (mode === "confirm-cancel") {
3940
4078
  runUpgrade(inst, ["cancel"]);
3941
4079
  state.upgradeNotice = `${DIM}Preparation cancelled. The current Runtime was never touched.${RESET}`;
@@ -3958,8 +4096,10 @@ async function browser(args = {}) {
3958
4096
  && state.upgradeData.candidate_version;
3959
4097
  if (!staged) {
3960
4098
  const candidate = state.upgradeCandidate;
3961
- if (!candidate) {
3962
- state.upgradeNotice = `${DIM}No published candidate found. Stage one manually: egregore settings ${state.upgradeInst.slug} runtime init --candidate <version> --tarball <candidate.tgz>${RESET}`;
4099
+ if (!candidate || (state.upgradeData?.active_version
4100
+ && (!parseReleaseVersion(state.upgradeData.active_version)
4101
+ || compareReleaseVersions(candidate, state.upgradeData.active_version) <= 0))) {
4102
+ state.upgradeNotice = `${DIM}No published candidate found. Stage one manually: egregore settings ${state.upgradeInst.slug} runtime init <version> <candidate.tgz>${RESET}`;
3963
4103
  render(); return;
3964
4104
  }
3965
4105
  if (state.upgradeFetching) { render(); return; }
@@ -3976,7 +4116,7 @@ async function browser(args = {}) {
3976
4116
  }
3977
4117
  const r = runUpgrade(inst, ["init", "--candidate", candidate, "--tarball", tgz]);
3978
4118
  if (r === null || r.status !== 0) {
3979
- const detail = ((r && (r.stderr || r.stdout)) || "staging failed").trim().split("\n")[0];
4119
+ const detail = adapterErrorText((r && (r.stderr || r.stdout)) || "staging failed").trim().split("\n")[0];
3980
4120
  state.upgradeNotice = `${YELLOW}${detail}${RESET}`;
3981
4121
  render(); return;
3982
4122
  }
@@ -4276,7 +4416,7 @@ async function browser(args = {}) {
4276
4416
  });
4277
4417
  refreshUpgrade();
4278
4418
  if (!state.upgradeCandidate) {
4279
- fetchRuntimeMvpCandidate().then((v) => {
4419
+ fetchRuntimeCandidate().then((v) => {
4280
4420
  state.upgradeCandidate = v || "";
4281
4421
  if (state.upgradeInst) render();
4282
4422
  });
@@ -4570,7 +4710,7 @@ async function browser(args = {}) {
4570
4710
  if (state.settingsInst === pick && !state.upgradeInst) render();
4571
4711
  });
4572
4712
  if (!state.upgradeCandidate) {
4573
- fetchRuntimeMvpCandidate().then((v) => {
4713
+ fetchRuntimeCandidate().then((v) => {
4574
4714
  state.upgradeCandidate = v || "";
4575
4715
  if (state.settingsInst === pick && !state.upgradeInst) render();
4576
4716
  });