mirror-mind 0.0.1 → 0.33.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 (474) hide show
  1. package/.claude/hooks/log-assistant-reply.sh +85 -0
  2. package/.claude/hooks/log-session-end.sh +85 -0
  3. package/.claude/hooks/log-user-prompt.sh +85 -0
  4. package/.claude/hooks/mirror-inject.sh +85 -0
  5. package/.claude/hooks/session-start.sh +85 -0
  6. package/.gemini/hooks/log-assistant.sh +85 -0
  7. package/.gemini/hooks/log-user.sh +85 -0
  8. package/.gemini/hooks/session-end.sh +85 -0
  9. package/.gemini/hooks/session-start.sh +85 -0
  10. package/.pi/extensions/mirror-logger.ts +646 -0
  11. package/.pi/skills/mm-backup/SKILL.md +21 -0
  12. package/.pi/skills/mm-build/SKILL.md +1206 -0
  13. package/.pi/skills/mm-consolidate/SKILL.md +112 -0
  14. package/.pi/skills/mm-consult/SKILL.md +70 -0
  15. package/.pi/skills/mm-conversations/SKILL.md +16 -0
  16. package/.pi/skills/mm-discard/SKILL.md +39 -0
  17. package/.pi/skills/mm-explore/SKILL.md +255 -0
  18. package/.pi/skills/mm-help/SKILL.md +74 -0
  19. package/.pi/skills/mm-identity/SKILL.md +96 -0
  20. package/.pi/skills/mm-journal/SKILL.md +16 -0
  21. package/.pi/skills/mm-journey/SKILL.md +23 -0
  22. package/.pi/skills/mm-journeys/SKILL.md +15 -0
  23. package/.pi/skills/mm-memories/SKILL.md +17 -0
  24. package/.pi/skills/mm-mirror/SKILL.md +98 -0
  25. package/.pi/skills/mm-mute/SKILL.md +18 -0
  26. package/.pi/skills/mm-new/SKILL.md +18 -0
  27. package/.pi/skills/mm-recall/SKILL.md +17 -0
  28. package/.pi/skills/mm-release-notes/SKILL.md +52 -0
  29. package/.pi/skills/mm-seed/SKILL.md +19 -0
  30. package/.pi/skills/mm-shadow/SKILL.md +117 -0
  31. package/.pi/skills/mm-soul/SKILL.md +502 -0
  32. package/.pi/skills/mm-tasks/SKILL.md +24 -0
  33. package/.pi/skills/mm-update/SKILL.md +32 -0
  34. package/.pi/skills/mm-week/SKILL.md +28 -0
  35. package/.pi/skills/mm-welcome/SKILL.md +24 -0
  36. package/AGENTS.md +188 -0
  37. package/README.md +126 -9
  38. package/bin/loader.js +67 -0
  39. package/bin/mirror-hook.js +7 -0
  40. package/bin/mirror.js +7 -0
  41. package/docs/releases/index.md +100 -0
  42. package/docs/releases/pending-cutoffs.md +510 -0
  43. package/docs/releases/v0.10.0.md +123 -0
  44. package/docs/releases/v0.10.1.md +66 -0
  45. package/docs/releases/v0.10.10.md +51 -0
  46. package/docs/releases/v0.10.11.md +39 -0
  47. package/docs/releases/v0.10.12.md +57 -0
  48. package/docs/releases/v0.10.13.md +35 -0
  49. package/docs/releases/v0.10.14.md +42 -0
  50. package/docs/releases/v0.10.15.md +53 -0
  51. package/docs/releases/v0.10.16.md +35 -0
  52. package/docs/releases/v0.10.17.md +43 -0
  53. package/docs/releases/v0.10.2.md +64 -0
  54. package/docs/releases/v0.10.3.md +78 -0
  55. package/docs/releases/v0.10.4.md +42 -0
  56. package/docs/releases/v0.10.5.md +57 -0
  57. package/docs/releases/v0.10.6.md +47 -0
  58. package/docs/releases/v0.10.7.md +53 -0
  59. package/docs/releases/v0.10.8.md +49 -0
  60. package/docs/releases/v0.10.9.md +37 -0
  61. package/docs/releases/v0.11.0.md +86 -0
  62. package/docs/releases/v0.12.0.md +67 -0
  63. package/docs/releases/v0.13.0.md +64 -0
  64. package/docs/releases/v0.14.0.md +68 -0
  65. package/docs/releases/v0.15.0.md +48 -0
  66. package/docs/releases/v0.16.0.md +50 -0
  67. package/docs/releases/v0.16.1.md +55 -0
  68. package/docs/releases/v0.16.2.md +36 -0
  69. package/docs/releases/v0.17.0.md +50 -0
  70. package/docs/releases/v0.17.1.md +58 -0
  71. package/docs/releases/v0.17.2.md +42 -0
  72. package/docs/releases/v0.17.3.md +58 -0
  73. package/docs/releases/v0.18.0.md +84 -0
  74. package/docs/releases/v0.18.1.md +51 -0
  75. package/docs/releases/v0.18.2.md +69 -0
  76. package/docs/releases/v0.19.0.md +85 -0
  77. package/docs/releases/v0.19.1.md +46 -0
  78. package/docs/releases/v0.20.0.md +85 -0
  79. package/docs/releases/v0.21.0.md +61 -0
  80. package/docs/releases/v0.21.1.md +47 -0
  81. package/docs/releases/v0.22.0.md +77 -0
  82. package/docs/releases/v0.22.1.md +42 -0
  83. package/docs/releases/v0.23.0.md +105 -0
  84. package/docs/releases/v0.24.0.md +125 -0
  85. package/docs/releases/v0.25.0.md +107 -0
  86. package/docs/releases/v0.26.0.md +139 -0
  87. package/docs/releases/v0.26.1.md +65 -0
  88. package/docs/releases/v0.26.2.md +43 -0
  89. package/docs/releases/v0.27.0.md +63 -0
  90. package/docs/releases/v0.28.0.md +59 -0
  91. package/docs/releases/v0.29.0.md +61 -0
  92. package/docs/releases/v0.29.1.md +59 -0
  93. package/docs/releases/v0.29.2.md +59 -0
  94. package/docs/releases/v0.29.3.md +93 -0
  95. package/docs/releases/v0.30.0.md +75 -0
  96. package/docs/releases/v0.30.1.md +93 -0
  97. package/docs/releases/v0.30.2.md +66 -0
  98. package/docs/releases/v0.31.0.md +122 -0
  99. package/docs/releases/v0.31.1.md +142 -0
  100. package/docs/releases/v0.31.10.md +118 -0
  101. package/docs/releases/v0.31.11.md +88 -0
  102. package/docs/releases/v0.31.12.md +105 -0
  103. package/docs/releases/v0.31.13.md +99 -0
  104. package/docs/releases/v0.31.14.md +97 -0
  105. package/docs/releases/v0.31.2.md +115 -0
  106. package/docs/releases/v0.31.3.md +142 -0
  107. package/docs/releases/v0.31.4.md +117 -0
  108. package/docs/releases/v0.31.5.md +155 -0
  109. package/docs/releases/v0.31.6.md +132 -0
  110. package/docs/releases/v0.31.7.md +132 -0
  111. package/docs/releases/v0.31.8.md +120 -0
  112. package/docs/releases/v0.31.9.md +120 -0
  113. package/docs/releases/v0.32.0.md +261 -0
  114. package/docs/releases/v0.32.1.md +59 -0
  115. package/docs/releases/v0.33.0.md +164 -0
  116. package/docs/releases/v0.8.0.md +118 -0
  117. package/docs/releases/v0.9.0.md +98 -0
  118. package/docs/releases/v0.9.1.md +83 -0
  119. package/package.json +102 -6
  120. package/plugins/mirror-mind/.claude-plugin/plugin.json +17 -0
  121. package/plugins/mirror-mind/hooks/hooks.json +62 -0
  122. package/plugins/mirror-mind/hooks/log-assistant-reply.sh +98 -0
  123. package/plugins/mirror-mind/hooks/log-session-end.sh +98 -0
  124. package/plugins/mirror-mind/hooks/log-user-prompt.sh +98 -0
  125. package/plugins/mirror-mind/hooks/mirror-inject.sh +98 -0
  126. package/plugins/mirror-mind/hooks/session-start.sh +98 -0
  127. package/plugins/mirror-mind/skills/mm-backup/SKILL.md +27 -0
  128. package/plugins/mirror-mind/skills/mm-build/SKILL.md +1206 -0
  129. package/plugins/mirror-mind/skills/mm-consolidate/SKILL.md +112 -0
  130. package/plugins/mirror-mind/skills/mm-consult/SKILL.md +83 -0
  131. package/plugins/mirror-mind/skills/mm-conversations/SKILL.md +17 -0
  132. package/plugins/mirror-mind/skills/mm-discard/SKILL.md +40 -0
  133. package/plugins/mirror-mind/skills/mm-explore/SKILL.md +241 -0
  134. package/plugins/mirror-mind/skills/mm-help/SKILL.md +104 -0
  135. package/plugins/mirror-mind/skills/mm-identity/SKILL.md +96 -0
  136. package/plugins/mirror-mind/skills/mm-journal/SKILL.md +21 -0
  137. package/plugins/mirror-mind/skills/mm-journey/SKILL.md +37 -0
  138. package/plugins/mirror-mind/skills/mm-journeys/SKILL.md +15 -0
  139. package/plugins/mirror-mind/skills/mm-memories/SKILL.md +20 -0
  140. package/plugins/mirror-mind/skills/mm-mirror/SKILL.md +67 -0
  141. package/plugins/mirror-mind/skills/mm-mute/SKILL.md +18 -0
  142. package/plugins/mirror-mind/skills/mm-new/SKILL.md +18 -0
  143. package/plugins/mirror-mind/skills/mm-recall/SKILL.md +17 -0
  144. package/plugins/mirror-mind/skills/mm-release-notes/SKILL.md +31 -0
  145. package/plugins/mirror-mind/skills/mm-seed/SKILL.md +15 -0
  146. package/plugins/mirror-mind/skills/mm-shadow/SKILL.md +117 -0
  147. package/plugins/mirror-mind/skills/mm-soul/SKILL.md +488 -0
  148. package/plugins/mirror-mind/skills/mm-tasks/SKILL.md +36 -0
  149. package/plugins/mirror-mind/skills/mm-update/SKILL.md +30 -0
  150. package/plugins/mirror-mind/skills/mm-week/SKILL.md +46 -0
  151. package/plugins/mirror-mind/skills/mm-welcome/SKILL.md +22 -0
  152. package/scripts/codex-hooks/session-end.sh +85 -0
  153. package/scripts/codex-hooks/session-start.sh +85 -0
  154. package/scripts/codex-mirror.sh +48 -0
  155. package/templates/identity/README.md +119 -0
  156. package/templates/identity/ego/behavior.yaml +52 -0
  157. package/templates/identity/ego/constraints.yaml +15 -0
  158. package/templates/identity/ego/identity.yaml +43 -0
  159. package/templates/identity/journeys/personal-growth.yaml +39 -0
  160. package/templates/identity/organization/identity.yaml +24 -0
  161. package/templates/identity/organization/principles.yaml +17 -0
  162. package/templates/identity/personas/coach.yaml +94 -0
  163. package/templates/identity/personas/designer.yaml +93 -0
  164. package/templates/identity/personas/doctor.yaml +96 -0
  165. package/templates/identity/personas/engineer.yaml +77 -0
  166. package/templates/identity/personas/financial.yaml +97 -0
  167. package/templates/identity/personas/prompt-engineer.yaml +122 -0
  168. package/templates/identity/personas/researcher.yaml +88 -0
  169. package/templates/identity/personas/strategist.yaml +91 -0
  170. package/templates/identity/personas/teacher.yaml +95 -0
  171. package/templates/identity/personas/therapist.yaml +91 -0
  172. package/templates/identity/personas/thinker.yaml +74 -0
  173. package/templates/identity/personas/writer.yaml +76 -0
  174. package/templates/identity/self/config.yaml +16 -0
  175. package/templates/identity/self/soul.yaml +105 -0
  176. package/templates/identity/user/identity.yaml +30 -0
  177. package/ts/src/backup/staging.ts +62 -0
  178. package/ts/src/backup/zipBackup.ts +267 -0
  179. package/ts/src/backup/zipReader.ts +109 -0
  180. package/ts/src/backup/zipWriter.ts +148 -0
  181. package/ts/src/builder/activeCheckpoint.ts +134 -0
  182. package/ts/src/builder/aggregateStatus.ts +34 -0
  183. package/ts/src/builder/approve.ts +149 -0
  184. package/ts/src/builder/argv.ts +292 -0
  185. package/ts/src/builder/ariadMethod.ts +536 -0
  186. package/ts/src/builder/artifacts/artifactSurfaces.ts +106 -0
  187. package/ts/src/builder/artifacts/artifactWriter.ts +113 -0
  188. package/ts/src/builder/artifacts/closureArtifacts.ts +199 -0
  189. package/ts/src/builder/artifacts/deliveryStoryArtifacts.ts +316 -0
  190. package/ts/src/builder/artifacts/planArtifacts.ts +242 -0
  191. package/ts/src/builder/artifacts/scaffoldSections.ts +273 -0
  192. package/ts/src/builder/artifacts/scaffoldState.ts +227 -0
  193. package/ts/src/builder/artifacts/storyFiles.ts +61 -0
  194. package/ts/src/builder/artifacts/storyIndex.ts +166 -0
  195. package/ts/src/builder/cadence.ts +59 -0
  196. package/ts/src/builder/card.ts +192 -0
  197. package/ts/src/builder/checkpointRefused.ts +66 -0
  198. package/ts/src/builder/closure.ts +964 -0
  199. package/ts/src/builder/commands.ts +2053 -0
  200. package/ts/src/builder/cursorPosition.ts +176 -0
  201. package/ts/src/builder/cursorTransitions.ts +77 -0
  202. package/ts/src/builder/deliveryCursor.ts +577 -0
  203. package/ts/src/builder/deliveryStoryClosure.ts +521 -0
  204. package/ts/src/builder/deliveryStoryPlan.ts +536 -0
  205. package/ts/src/builder/deliveryStoryReady.ts +160 -0
  206. package/ts/src/builder/deliveryStoryRoadmapClosure.ts +151 -0
  207. package/ts/src/builder/expand.ts +336 -0
  208. package/ts/src/builder/flowUnit.ts +339 -0
  209. package/ts/src/builder/homeSurface.ts +122 -0
  210. package/ts/src/builder/implementationGuard.ts +125 -0
  211. package/ts/src/builder/index.ts +11 -0
  212. package/ts/src/builder/lifecycleRefusal.ts +92 -0
  213. package/ts/src/builder/lifecycleRibbon.ts +159 -0
  214. package/ts/src/builder/load.ts +313 -0
  215. package/ts/src/builder/methodAdoption.ts +113 -0
  216. package/ts/src/builder/methodDefinition.ts +429 -0
  217. package/ts/src/builder/methodInspection.ts +371 -0
  218. package/ts/src/builder/plan.ts +408 -0
  219. package/ts/src/builder/planPreauthorization.ts +265 -0
  220. package/ts/src/builder/prepare.ts +225 -0
  221. package/ts/src/builder/projectPaths.ts +64 -0
  222. package/ts/src/builder/pull.ts +356 -0
  223. package/ts/src/builder/pullCandidates.ts +463 -0
  224. package/ts/src/builder/pullCandidatesRender.ts +238 -0
  225. package/ts/src/builder/refinementField.ts +93 -0
  226. package/ts/src/builder/releaseIntent.ts +173 -0
  227. package/ts/src/builder/resumeState.ts +84 -0
  228. package/ts/src/builder/resumeSurface.ts +149 -0
  229. package/ts/src/builder/roadmapGrammar.ts +300 -0
  230. package/ts/src/builder/roadmapScan.ts +97 -0
  231. package/ts/src/builder/roadmapScope.ts +210 -0
  232. package/ts/src/builder/scopePhrases.ts +146 -0
  233. package/ts/src/builder/storyPaths.ts +196 -0
  234. package/ts/src/builder/storyPlanPreauthorization.ts +287 -0
  235. package/ts/src/builder/surfaceProtocol.ts +42 -0
  236. package/ts/src/builder/templateGeneration.ts +148 -0
  237. package/ts/src/builder/transition.ts +178 -0
  238. package/ts/src/consult/args.ts +99 -0
  239. package/ts/src/consult/core.ts +122 -0
  240. package/ts/src/consult/modelCatalog.ts +55 -0
  241. package/ts/src/consult/render.ts +47 -0
  242. package/ts/src/conversation/append.ts +414 -0
  243. package/ts/src/conversation/backfill.ts +387 -0
  244. package/ts/src/conversation/closeTail.ts +467 -0
  245. package/ts/src/conversation/extraction.ts +333 -0
  246. package/ts/src/conversation/extractionDriver.ts +130 -0
  247. package/ts/src/conversation/extractionRun.ts +70 -0
  248. package/ts/src/conversation/hookPayload.ts +51 -0
  249. package/ts/src/conversation/journeyInference.ts +165 -0
  250. package/ts/src/conversation/journeyRepair.ts +114 -0
  251. package/ts/src/conversation/lifecycleFaces.ts +197 -0
  252. package/ts/src/conversation/lifecycleWrites.ts +313 -0
  253. package/ts/src/conversation/listing.ts +77 -0
  254. package/ts/src/conversation/logger.ts +851 -0
  255. package/ts/src/conversation/loggerCli.ts +321 -0
  256. package/ts/src/conversation/loggerRuntime.ts +259 -0
  257. package/ts/src/conversation/metadataLifecycle.ts +443 -0
  258. package/ts/src/conversation/recall.ts +66 -0
  259. package/ts/src/conversation/sessionComposites.ts +258 -0
  260. package/ts/src/conversation/sessionImport.ts +90 -0
  261. package/ts/src/conversation/transcriptBackfill.ts +141 -0
  262. package/ts/src/cultivation/applyActions.ts +241 -0
  263. package/ts/src/cultivation/cluster.ts +86 -0
  264. package/ts/src/cultivation/consolidationStore.ts +281 -0
  265. package/ts/src/cultivation/promptContext.ts +62 -0
  266. package/ts/src/cultivation/propose.ts +305 -0
  267. package/ts/src/cultivation/scan.ts +155 -0
  268. package/ts/src/db/backupGate.ts +47 -0
  269. package/ts/src/db/bootstrap.ts +108 -0
  270. package/ts/src/db/bootstrapLock.ts +223 -0
  271. package/ts/src/db/copyGuard.ts +60 -0
  272. package/ts/src/db/database.ts +397 -0
  273. package/ts/src/db/decode.ts +66 -0
  274. package/ts/src/db/ftsIntegrity.ts +41 -0
  275. package/ts/src/db/migrateOnOpen.ts +214 -0
  276. package/ts/src/db/migrations.ts +576 -0
  277. package/ts/src/db/readyOnOpen.ts +35 -0
  278. package/ts/src/db/rowDecode.ts +42 -0
  279. package/ts/src/db/schema.ts +432 -0
  280. package/ts/src/db/schemaInventory.ts +225 -0
  281. package/ts/src/db/schemaInventorySnapshot.ts +2107 -0
  282. package/ts/src/db/schemaState.ts +91 -0
  283. package/ts/src/db/schemaTsDivergence.ts +114 -0
  284. package/ts/src/descriptor/descriptorRead.ts +49 -0
  285. package/ts/src/docs/docsLint.ts +265 -0
  286. package/ts/src/explorer/handoff.ts +522 -0
  287. package/ts/src/explorer/render.ts +335 -0
  288. package/ts/src/explorer/story.ts +769 -0
  289. package/ts/src/explorer/transition.ts +72 -0
  290. package/ts/src/extensions/bindings.ts +170 -0
  291. package/ts/src/extensions/catalog.ts +249 -0
  292. package/ts/src/extensions/catalogCommands.ts +513 -0
  293. package/ts/src/extensions/catalogWrites.ts +652 -0
  294. package/ts/src/extensions/contextRuntime.ts +325 -0
  295. package/ts/src/extensions/dispatch.ts +374 -0
  296. package/ts/src/extensions/errors.ts +24 -0
  297. package/ts/src/extensions/manifest.ts +356 -0
  298. package/ts/src/extensions/migrations.ts +350 -0
  299. package/ts/src/extraction/conversation.ts +304 -0
  300. package/ts/src/extraction/conversationMetadata.ts +206 -0
  301. package/ts/src/extraction/fencing.ts +106 -0
  302. package/ts/src/extraction/json.ts +17 -0
  303. package/ts/src/extraction/prompts.ts +470 -0
  304. package/ts/src/frontDoor/args.ts +30 -0
  305. package/ts/src/frontDoor/argvShape.ts +106 -0
  306. package/ts/src/frontDoor/buildLoadRuntime.ts +139 -0
  307. package/ts/src/frontDoor/buildRoute.ts +398 -0
  308. package/ts/src/frontDoor/cli.ts +1872 -0
  309. package/ts/src/frontDoor/cloneRoleGuard.ts +98 -0
  310. package/ts/src/frontDoor/consultRoute.ts +50 -0
  311. package/ts/src/frontDoor/contentTailRoute.ts +239 -0
  312. package/ts/src/frontDoor/conversationLoggerRoute.ts +83 -0
  313. package/ts/src/frontDoor/cultivationRoute.ts +210 -0
  314. package/ts/src/frontDoor/dbPath.ts +131 -0
  315. package/ts/src/frontDoor/dbSafetyToolsRoute.ts +240 -0
  316. package/ts/src/frontDoor/exploreRoute.ts +572 -0
  317. package/ts/src/frontDoor/extensionCatalogRoute.ts +252 -0
  318. package/ts/src/frontDoor/frontDoorLog.ts +57 -0
  319. package/ts/src/frontDoor/identityWrite.ts +36 -0
  320. package/ts/src/frontDoor/journeyWriteRoute.ts +26 -0
  321. package/ts/src/frontDoor/lifecycleWriteRoute.ts +110 -0
  322. package/ts/src/frontDoor/liveBackup.ts +100 -0
  323. package/ts/src/frontDoor/mirrorModeRoute.ts +163 -0
  324. package/ts/src/frontDoor/namedRefusal.ts +35 -0
  325. package/ts/src/frontDoor/nodeSupport.ts +24 -0
  326. package/ts/src/frontDoor/render/consolidate.ts +199 -0
  327. package/ts/src/frontDoor/render/conversations.ts +33 -0
  328. package/ts/src/frontDoor/render/cultivationShared.ts +21 -0
  329. package/ts/src/frontDoor/render/descriptor.ts +20 -0
  330. package/ts/src/frontDoor/render/detectPersona.ts +50 -0
  331. package/ts/src/frontDoor/render/icons.ts +13 -0
  332. package/ts/src/frontDoor/render/identity.ts +59 -0
  333. package/ts/src/frontDoor/render/identityRows.ts +17 -0
  334. package/ts/src/frontDoor/render/inspectPersona.ts +53 -0
  335. package/ts/src/frontDoor/render/journeyStatus.ts +78 -0
  336. package/ts/src/frontDoor/render/journeys.ts +79 -0
  337. package/ts/src/frontDoor/render/list.ts +41 -0
  338. package/ts/src/frontDoor/render/memories.ts +67 -0
  339. package/ts/src/frontDoor/render/recall.ts +49 -0
  340. package/ts/src/frontDoor/render/shadow.ts +155 -0
  341. package/ts/src/frontDoor/render/tasks.ts +99 -0
  342. package/ts/src/frontDoor/render/tasksImportSync.ts +63 -0
  343. package/ts/src/frontDoor/render/week.ts +113 -0
  344. package/ts/src/frontDoor/routing.ts +1001 -0
  345. package/ts/src/frontDoor/runtimeRoute.ts +623 -0
  346. package/ts/src/frontDoor/searchRoute.ts +166 -0
  347. package/ts/src/frontDoor/seedPaths.ts +98 -0
  348. package/ts/src/frontDoor/sessionStartWelcomeRoute.ts +166 -0
  349. package/ts/src/frontDoor/soulRoute.ts +433 -0
  350. package/ts/src/frontDoor/stdinSource.ts +37 -0
  351. package/ts/src/frontDoor/tasksImportSyncRoute.ts +110 -0
  352. package/ts/src/frontDoor/tasksWriteRoute.ts +101 -0
  353. package/ts/src/frontDoor/usage.ts +176 -0
  354. package/ts/src/guards/claudePlugin.ts +298 -0
  355. package/ts/src/guards/packContents.ts +306 -0
  356. package/ts/src/guards/piSourcedSkills.ts +70 -0
  357. package/ts/src/guards/retiredRouteShadows.ts +57 -0
  358. package/ts/src/guards/retiredSurfaces.ts +564 -0
  359. package/ts/src/hooks/claude.ts +214 -0
  360. package/ts/src/hooks/codex.ts +45 -0
  361. package/ts/src/hooks/gemini.ts +126 -0
  362. package/ts/src/hooks/main.ts +109 -0
  363. package/ts/src/hooks/mirrorState.ts +71 -0
  364. package/ts/src/hooks/payload.ts +73 -0
  365. package/ts/src/hooks/runtime.ts +179 -0
  366. package/ts/src/hooks/runtimeDetection.ts +34 -0
  367. package/ts/src/identity/applyConsolidationIdentityUpdate.ts +67 -0
  368. package/ts/src/identity/descriptorGenerate.ts +162 -0
  369. package/ts/src/identity/identityEdit.ts +143 -0
  370. package/ts/src/identity/identityKey.ts +77 -0
  371. package/ts/src/identity/identityRead.ts +69 -0
  372. package/ts/src/identity/identityStore.ts +80 -0
  373. package/ts/src/identity/journeyListing.ts +53 -0
  374. package/ts/src/identity/personaInspect.ts +44 -0
  375. package/ts/src/identity/personaListing.ts +37 -0
  376. package/ts/src/identity/setIdentity.ts +64 -0
  377. package/ts/src/index.ts +231 -0
  378. package/ts/src/init/init.ts +111 -0
  379. package/ts/src/journey/journeyOptions.ts +131 -0
  380. package/ts/src/journey/journeyRemoval.ts +158 -0
  381. package/ts/src/journey/journeyStatus.ts +149 -0
  382. package/ts/src/journey/journeySyncFile.ts +87 -0
  383. package/ts/src/journey/journeyWrite.ts +203 -0
  384. package/ts/src/journey/parentJourney.ts +41 -0
  385. package/ts/src/journey/validateParentJourney.ts +55 -0
  386. package/ts/src/mcp/boundary.ts +151 -0
  387. package/ts/src/mcp/guards.ts +244 -0
  388. package/ts/src/mcp/main.ts +121 -0
  389. package/ts/src/mcp/payload.ts +141 -0
  390. package/ts/src/mcp/protocol.ts +141 -0
  391. package/ts/src/mcp/readModels.ts +241 -0
  392. package/ts/src/mcp/registry.ts +201 -0
  393. package/ts/src/mcp/serve.ts +120 -0
  394. package/ts/src/mcp/tools/deterministic.ts +137 -0
  395. package/ts/src/mcp/tools/providerCrossing.ts +187 -0
  396. package/ts/src/mcp/wire.ts +8 -0
  397. package/ts/src/memory/journal.ts +180 -0
  398. package/ts/src/memory/listing.ts +107 -0
  399. package/ts/src/memory/memoryWrite.ts +88 -0
  400. package/ts/src/memory/reinforcement.ts +35 -0
  401. package/ts/src/mirror/context.ts +161 -0
  402. package/ts/src/mirror/defaultResolution.ts +199 -0
  403. package/ts/src/mirror/mirrorForm.ts +43 -0
  404. package/ts/src/mirror/orchestration.ts +364 -0
  405. package/ts/src/mirror/reception.ts +194 -0
  406. package/ts/src/mirror/render.ts +75 -0
  407. package/ts/src/mirror/runtimeSession.ts +205 -0
  408. package/ts/src/mode/operatingMode.ts +148 -0
  409. package/ts/src/observability/callOutcome.ts +115 -0
  410. package/ts/src/observability/inspectLedger.ts +329 -0
  411. package/ts/src/observability/ledgerHooks.ts +126 -0
  412. package/ts/src/observability/llmCalls.ts +154 -0
  413. package/ts/src/persona/detectPersona.ts +81 -0
  414. package/ts/src/planning/promptAssembly.ts +111 -0
  415. package/ts/src/planning/weekPending.ts +81 -0
  416. package/ts/src/planning/weekPlan.ts +183 -0
  417. package/ts/src/planning/weekSave.ts +117 -0
  418. package/ts/src/providers/config.ts +189 -0
  419. package/ts/src/providers/cost.ts +64 -0
  420. package/ts/src/providers/credits.ts +204 -0
  421. package/ts/src/providers/embedding.ts +321 -0
  422. package/ts/src/providers/familyProviders.ts +147 -0
  423. package/ts/src/providers/llm.ts +334 -0
  424. package/ts/src/providers/openrouter.ts +244 -0
  425. package/ts/src/providers/redaction.ts +110 -0
  426. package/ts/src/providers/replay.ts +15 -0
  427. package/ts/src/providers/transport.ts +410 -0
  428. package/ts/src/repair/encodingRepair.ts +253 -0
  429. package/ts/src/runtime/backup.ts +151 -0
  430. package/ts/src/runtime/channel.ts +146 -0
  431. package/ts/src/runtime/config.ts +168 -0
  432. package/ts/src/runtime/diagnose.ts +686 -0
  433. package/ts/src/runtime/git.ts +510 -0
  434. package/ts/src/runtime/installKind.ts +220 -0
  435. package/ts/src/runtime/migrate.ts +154 -0
  436. package/ts/src/runtime/packageIdentity.ts +102 -0
  437. package/ts/src/runtime/releaseNotes.ts +244 -0
  438. package/ts/src/runtime/status.ts +557 -0
  439. package/ts/src/runtime/strategies/clone.ts +200 -0
  440. package/ts/src/runtime/strategies/package.ts +328 -0
  441. package/ts/src/runtime/treeRoot.ts +30 -0
  442. package/ts/src/runtime/update.ts +445 -0
  443. package/ts/src/runtime/updateGate.ts +40 -0
  444. package/ts/src/runtime/updatePipeline.ts +159 -0
  445. package/ts/src/runtime/version.ts +36 -0
  446. package/ts/src/runtime/wiring.ts +130 -0
  447. package/ts/src/search/memorySearch.ts +338 -0
  448. package/ts/src/search/ranker.ts +154 -0
  449. package/ts/src/seed/seed.ts +256 -0
  450. package/ts/src/seed/seedYaml.ts +133 -0
  451. package/ts/src/soul/apply.ts +218 -0
  452. package/ts/src/soul/harvest.ts +267 -0
  453. package/ts/src/soul/prompts/soul_beauty_voice.md +103 -0
  454. package/ts/src/soul/prompts/soul_self_voice.md +219 -0
  455. package/ts/src/soul/prompts/soul_wisdom_voice.md +121 -0
  456. package/ts/src/soul/prompts.ts +85 -0
  457. package/ts/src/soul/render.ts +358 -0
  458. package/ts/src/soul/state.ts +212 -0
  459. package/ts/src/soul/transition.ts +37 -0
  460. package/ts/src/tasks/journeyPathParse.ts +113 -0
  461. package/ts/src/tasks/taskImportSync.ts +142 -0
  462. package/ts/src/tasks/taskStore.ts +312 -0
  463. package/ts/src/tasks/weekView.ts +120 -0
  464. package/ts/src/util/clipCodePoints.ts +26 -0
  465. package/ts/src/util/paths.ts +63 -0
  466. package/ts/src/util/program.ts +9 -0
  467. package/ts/src/util/pyGenerators.ts +144 -0
  468. package/ts/src/util/pythonText.ts +317 -0
  469. package/ts/src/util/semver.ts +45 -0
  470. package/ts/src/util/shellWord.ts +25 -0
  471. package/ts/src/util/slug.ts +64 -0
  472. package/ts/src/welcome/card.ts +339 -0
  473. package/ts/src/welcome/statusLine.ts +101 -0
  474. package/ts/src/welcome/updateCache.ts +129 -0
@@ -0,0 +1,1206 @@
1
+ ---
2
+ name: "mm-build"
3
+ description: Activates Builder Mode for a journey and loads project context/docs
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Builder Mode
8
+
9
+ Activates Builder Mode for a specific journey. Loads identity context and project docs.
10
+
11
+ ## Usage
12
+
13
+ Pi and Gemini CLI:
14
+
15
+ ```
16
+ /mm-build <journey-slug>
17
+ ```
18
+
19
+ Codex:
20
+
21
+ ```
22
+ $mm-build <journey-slug>
23
+ ```
24
+
25
+ Claude Code:
26
+
27
+ ```
28
+ /mm:build <journey-slug>
29
+ ```
30
+
31
+ ---
32
+
33
+ # Base Builder Mode Behavior
34
+
35
+ This is the default behavior for every journey, including journeys that have not
36
+ adopted Ariad or any Builder method.
37
+
38
+ ## 1. Load Context (DB)
39
+
40
+ ```bash
41
+ mirror build load <slug>
42
+ ```
43
+
44
+ The command:
45
+
46
+ - Activates `■ Builder Mode` in the operating-mode lifecycle
47
+ - Renders the Mode Transition Surface (`■ BUILDER MODE ACTIVE`)
48
+ - Prints identity context (soul + ego + user + journey, persona=engineer)
49
+ - Prints relevant memories
50
+ - Starts a new database conversation session
51
+ - Emits `project_path=<path>` as the last output line
52
+
53
+ ## 1.1 Transition Surface
54
+
55
+ Render the `build load` transition surface visibly before continuing with project
56
+ doc loading or substantive Builder work.
57
+
58
+ For journeys without adopted Ariad, preserve original Builder behavior:
59
+
60
+ - load context;
61
+ - read project docs;
62
+ - stop at the Builder Activation Boundary;
63
+ - ask what work should be done next.
64
+
65
+ Do not render Ariad surfaces, Ariad lifecycle suggestions, roadmap snapshot,
66
+ pull candidates, cursor state, or checkpoint language for journeys that have not
67
+ adopted Ariad.
68
+
69
+ For Ariad-adopted journeys, see **Ariad Runtime Behavior** below.
70
+
71
+ Builder Mode surface should orient the user around:
72
+
73
+ - active journey
74
+ - journey path/stage, when present
75
+ - project path, when present
76
+ - compact briefing/synthesis
77
+ - boundary: `Builder executes commitment.`
78
+
79
+ ## 1.2 Journey Binding
80
+
81
+ Every `build` command after `build load` carries `--journey <slug>`. The slug
82
+ is the journey this session's `build load` activated, and its `■ BUILDER MODE
83
+ ACTIVE` surface names it. For a journey the Navigator names explicitly, pass
84
+ that slug instead.
85
+
86
+ The runtime never guesses the journey. Without `--journey`, a command binds
87
+ only to a session in Builder Mode named with `--session-id` or
88
+ `MIRROR_SESSION_ID`. An agent shell names none, so the command refuses with
89
+ `requires a journey`. A guessed journey once moved other journeys' cursors and
90
+ wrote files into other projects.
91
+
92
+ If that refusal appears and this session's slug is no longer in view, ask the
93
+ Navigator. Do not take the slug from `mode status`, the status line, or any
94
+ other database-wide state. They can show another window's journey.
95
+
96
+ ## 2. Read Project Docs
97
+
98
+ Parse `project_path` from the last output line above. If `project_path` is not
99
+ set, skip this step and proceed — the journey has no associated project yet.
100
+
101
+ Use file tools to load project documentation. Prefer the project's actual
102
+ documentation structure over any fixed scaffold.
103
+
104
+ ### Always read when present
105
+
106
+ - `<project_path>/README.md` — public overview, setup, and usage
107
+ - `<project_path>/REFERENCE.md` — detailed operational reference
108
+ - `<project_path>/CLAUDE.md` — project-specific operating instructions
109
+ - `<project_path>/docs/index.md` — documentation map
110
+
111
+ ### Discover available docs
112
+
113
+ Run:
114
+
115
+ ```bash
116
+ find <project_path>/docs -maxdepth 3 -type f -name '*.md' | sort
117
+ ```
118
+
119
+ Then read the docs relevant to the current task.
120
+
121
+ For Mirror Mind, the primary docs are:
122
+
123
+ - `<project_path>/docs/getting-started.md`
124
+ - `<project_path>/docs/project/briefing.md`
125
+ - `<project_path>/docs/project/decisions.md`
126
+ - `<project_path>/docs/product/specs/runtime-interface/index.md`
127
+ - `<project_path>/docs/project/roadmap/index.md`
128
+ - `<project_path>/docs/process/development-guide.md`
129
+ - `<project_path>/docs/process/worklog.md`
130
+ - `<project_path>/docs/product/principles.md`
131
+
132
+ When working inside a CV/Delivery Story/User Story/Technical Story, also read the relevant:
133
+
134
+ - `index.md`
135
+ - `plan.md`
136
+ - `test-guide.md`
137
+ - `refactoring.md`, if present
138
+
139
+ ## 3. Builder Activation Boundary
140
+
141
+ Activating Builder Mode or loading a journey is context setup only. After loading
142
+ the context and required docs, stop and ask what work should be done next.
143
+
144
+ Do not edit files, create tests, run implementation, start TDD, or mutate project
145
+ state until the user gives an explicit implementation or documentation
146
+ instruction, such as `implement`, `fix`, `edit`, `create`, `run tests`, or names a
147
+ specific story to execute.
148
+
149
+ Context activation is not execution consent.
150
+
151
+ ## 4. Work In Builder Mode
152
+
153
+ Once the user explicitly authorizes work:
154
+
155
+ - Work from `project_path` — read, edit, and create project files normally
156
+ - Keep project docs updated as the code evolves
157
+ - Commit at the end of each session with a descriptive English commit message
158
+
159
+ ## 5. Project Docs Maintenance
160
+
161
+ Follow the project's existing documentation structure. Do not create a generic
162
+ docs scaffold unless the user explicitly asks for one.
163
+
164
+ **When to update docs:**
165
+
166
+ - `README.md`: public positioning, setup, stack, or usage changes
167
+ - `REFERENCE.md`: CLI behavior, configuration, runtime contracts, or operational details change
168
+ - `docs/project/briefing.md`: stable architectural premises change
169
+ - `docs/project/decisions.md`: an incremental design decision is made
170
+ - `docs/product/specs/runtime-interface/index.md`: runtime lifecycle, hooks, skills, or extension contracts change
171
+ - `docs/project/roadmap/`: CV/Delivery Story/User Story/Technical Story status, plans, or verification guides change
172
+ - `docs/process/worklog.md`: a meaningful milestone is completed
173
+ - `docs/product/principles.md`: product, code, testing, or process principles change
174
+
175
+ ## 6. Configure `project_path`
176
+
177
+ If the journey does not yet have an associated project:
178
+
179
+ ```bash
180
+ mirror journey set-path <slug> /path/to/project
181
+ ```
182
+
183
+ ## 7. Finalize Session
184
+
185
+ When the user says "End the session":
186
+
187
+ ```bash
188
+ mirror mirror log "SESSION_SUMMARY"
189
+ ```
190
+
191
+ ---
192
+
193
+ # Adopted Method Behavior
194
+
195
+ A journey may adopt a Builder method. Method-specific behavior applies only when
196
+ that method has been adopted for the active journey.
197
+
198
+ Currently implemented method-specific runtime: **Ariad**.
199
+
200
+ For journeys without adopted Ariad:
201
+
202
+ - preserve Base Builder Mode behavior;
203
+ - do not render Ariad surfaces;
204
+ - do not route roadmap, pull, prepare, template, cursor, or lifecycle requests to Ariad commands;
205
+ - if the user asks for Ariad behavior, explain that Ariad must be adopted first.
206
+
207
+ ## Inspect Builder Method
208
+
209
+ When the user asks which Builder method governs the active journey, inspect the
210
+ current Builder method state:
211
+
212
+ ```bash
213
+ mirror build inspect-method --journey <slug>
214
+ ```
215
+
216
+ Render the command output visibly. If no Builder journey has been loaded in this
217
+ session, do not run the command: say so plainly and ask the user to activate or
218
+ name a journey. If the journey has not
219
+ adopted a Builder method yet, say so plainly. Do not infer that Ariad governs the
220
+ journey just because Ariad is available.
221
+
222
+ When the user asks what Ariad is as a Builder method, inspect the built-in method
223
+ defaults:
224
+
225
+ ```bash
226
+ mirror build inspect-method ariad
227
+ ```
228
+
229
+ This is read-only inspection.
230
+
231
+ ## Adopt Ariad
232
+
233
+ When the user explicitly asks to adopt Ariad for the active journey, run:
234
+
235
+ ```bash
236
+ mirror build adopt --journey <slug> --method ariad
237
+ ```
238
+
239
+ Render the adoption report visibly. This mutates Builder method state only. It
240
+ must not generate templates, create a delivery cursor, execute lifecycle work,
241
+ change story status, commit, push, or release.
242
+
243
+ ---
244
+
245
+ # Ariad Runtime Behavior
246
+
247
+ This section applies **only when the active journey has adopted Ariad**
248
+ (`adopted_method == ariad`).
249
+
250
+ ## Deterministic Ariad Surface Transport Protocol
251
+
252
+ This is a transport invariant for **all** Ariad commands and lifecycle phases,
253
+ not a phase-specific instruction. In the Ariad method DSL, surfaces are runtime
254
+ artifacts with `transport=verbatim`, `marker_protocol=ariad_compact`, and
255
+ `interpretation_policy=after_block_only`.
256
+
257
+ Ariad runtime commands emit deterministic surfaces wrapped as:
258
+
259
+ ```text
260
+ <<<ARIAD:<SURFACE_ID>>>
261
+ ...
262
+ <<<END:<SURFACE_ID>>>
263
+ ```
264
+
265
+ For any command output that contains one or more Ariad surface blocks, the final
266
+ assistant response must return **every marked block** from stdout verbatim before
267
+ any commentary. This is a hard rendering requirement, not optional tool-output
268
+ evidence. Do not summarize, translate, reorder, trim, rewrap, re-indent,
269
+ reformat, or mix prose inside a wrapped surface. Do not replace a surface with a
270
+ conversational summary, even when the user phrase is short (for example,
271
+ `validated`, `approved`, `ok`, or `continue`). If you catch yourself summarizing
272
+ a marked Ariad surface, stop and re-render the complete marked block before any
273
+ interpretation.
274
+
275
+ If multiple Ariad surface blocks are emitted, return all of them in the same
276
+ order. After the complete surface block(s), add a conversational interpretation
277
+ for the Navigator. This interpretation should explain what happened, what it
278
+ means, what is blocked or allowed now, and what the next Ariad step is. It may be
279
+ complete and helpful, not merely a one-line summary, but it must stay outside the
280
+ surface block and must not contradict the runtime boundary.
281
+
282
+ Use this pattern:
283
+
284
+ ```text
285
+ <<<ARIAD:<SURFACE_ID>>>
286
+ ...
287
+ <<<END:<SURFACE_ID>>>
288
+
289
+ What happened:
290
+ ...
291
+
292
+ Next step:
293
+ ...
294
+ ```
295
+
296
+ A refused lifecycle command renders `CHECKPOINT_REFUSED`. Return it verbatim like
297
+ any other surface. It shows the stage the cursor actually holds and the true reason,
298
+ and nothing changed: the refusal comes before any write. Read the reason before
299
+ acting. An already-complete step needs no rerun, a pending confirmation needs the
300
+ Navigator's answer, a step not reached needs the step before it, and missing
301
+ evidence needs the evidence the reason names. A failure that is not a refusal
302
+ prints a plain `Error:` line instead and makes no claim about what changed: run
303
+ `build show` to see where the cursor stands before trying again.
304
+
305
+ If a marked block was lost before it reached the Navigator (output filtered,
306
+ truncated, or never rendered), say which surface was lost and run `build show`, as
307
+ described in **Show The Active Checkpoint**. Return its `ACTIVE_CHECKPOINT` block
308
+ verbatim. Never substitute another command's surface, such as `check-implementation`,
309
+ as evidence of where the cursor stands.
310
+
311
+ ### Paths on Ariad surfaces
312
+
313
+ A card prints a path inside the project relative to the journey's `project_path`,
314
+ from the `project_path=` line `build load` prints. Open it by joining the two, never by joining it
315
+ to the working directory, which can belong to another repository. A card that
316
+ reports a file written or left in place names its project folder and journey on a
317
+ `project:` row. If that row names a project or journey other than the one this
318
+ session loaded, tell the Navigator before touching the files. Plan prints its files'
319
+ absolute paths as `*_path=` lines below its surface. They are not part of the
320
+ surface: use them as printed, and do not render them.
321
+
322
+ ### Statuses on Ariad surfaces
323
+
324
+ A row that names a roadmap package states its status as the first clause of the
325
+ package's `**Status:**` line, links reduced to their labels, cut to fit the row. The
326
+ rest of the line is in the package the row names; read it there when you need more
327
+ than the status, such as why a package is Blocked.
328
+
329
+ ## Ariad Activation Surfaces
330
+
331
+ For Ariad-adopted journeys whose delivery cursor has no active item,
332
+ `build load` emits:
333
+
334
+ - `PROJECT POSITION`
335
+ - `■ BUILDER ORIENTATION`
336
+
337
+ For Ariad-adopted journeys with no delivery cursor yet, or with an active item
338
+ or a pending confirmation, `build load` emits:
339
+
340
+ - `■ BUILDER RESUME`
341
+
342
+ Every position and next pull on these surfaces is the journey's own, derived
343
+ from its delivery cursor. With an active item, the position is the Capability
344
+ Value the item belongs to, and any recommended pull is chosen inside it. Without
345
+ one, the surfaces read `no item pulled yet`, list `project-wide candidates`,
346
+ recommend nothing, and give the literal `pull explicitly:` command. Never present
347
+ a candidate from the project-wide list as this journey's recommendation.
348
+
349
+ These surfaces are mandatory activation output. The final response to the user
350
+ must include the wrapped Ariad surface blocks verbatim from the command output.
351
+ If the command output contains `<<<ARIAD:BUILDER_RESUME>>>`,
352
+ `<<<ARIAD:PROJECT_POSITION>>>`, or `<<<ARIAD:BUILDER_ORIENTATION>>>`, the
353
+ response is invalid unless the visible reply also contains every complete
354
+ matching begin/end block in stdout order.
355
+
356
+ After rendering these surfaces, do not ask a generic question such as "inspeção
357
+ runtime, planejamento de Delivery, ou exploração?" and do not add a third
358
+ runtime-inspection option unless the surface itself recommends it. For an Ariad
359
+ journey with no active item, ask only which item the Navigator wants to pull,
360
+ from the project-wide list and without ranking it, or whether to inspect the
361
+ roadmap further, after the verbatim blocks.
362
+
363
+ For an Ariad journey with an active item, the resume's `allowed next actions` are
364
+ the steps the cursor accepts next, the recommended one first; `build show` prints
365
+ the same list. Offer the step the list names, and no lifecycle step it does not.
366
+ Offering is not doing: the Builder Activation Boundary holds, and no step runs
367
+ before the Navigator says so. Each step routes to a section of this skill, or in
368
+ Delivery Story flow to its Delivery Story command:
369
+
370
+ - `answer_pending_confirmation`: ask the Navigator the question the `pending
371
+ confirmation` row names. Never answer it.
372
+ - `prepare_active_item`: Prepare, `build prepare-item`.
373
+ - `expand_active_item`: Expand was blocked. After the Navigator fixes what
374
+ `EXPAND_BLOCKED` named, pull the Delivery Story again.
375
+ - `plan_active_item`: Plan Ariad Work.
376
+ - `implement_active_item`: the implementation guard, then the approved Plan.
377
+ - `validate_active_item`: Validate Ariad Work.
378
+ - `review_active_item_debt`: Review Ariad Debt.
379
+ - `check_active_item_coherence`: Check Ariad Coherence.
380
+ - `close_active_item`: Close Ariad Done.
381
+ - `pull_candidate_if_known`: the item is closed, or none is pulled. Pull the item
382
+ the Navigator chooses, as Pull And Prepare Ariad Work describes.
383
+ - `inspect_roadmap`: Inspect Roadmap And Pull Candidates.
384
+ - `inspect_method`: Inspect Builder Method.
385
+ - `sync_cursor`: Sync Delivery Cursor.
386
+ - `adopt_method`: Adopt Ariad.
387
+
388
+ A list of only `inspect_roadmap` and `inspect_method`, on an item that is open,
389
+ means the cursor holds a position Ariad does not know. Say so, and offer
390
+ `sync-cursor`, then Pull. `sync-cursor` drops the item and any pending question,
391
+ and returns the cadence to `stepwise`.
392
+
393
+ ## Compose Refinement Work
394
+
395
+ ### The Refinement authority
396
+
397
+ Refinement Work lives in project files, at this exact path beneath the trusted
398
+ `project_path`:
399
+
400
+ ```text
401
+ docs/project/refinement/index.md
402
+ ```
403
+
404
+ The root index is the sole authority for focus, ordering, and current RS/CR
405
+ status; linked documents own narrative, plans, evidence, and outcomes. Read the
406
+ project's own convention from the index before acting.
407
+
408
+ **There is no second store.** CV22.DS10.TS4 retired the compatibility-only
409
+ SQLite Workbench and its twenty commands; the front door answers each of them
410
+ with its cutoff. If the index does not exist, the project has not started
411
+ Refinement Work — say so and offer to create the index. Never inspect legacy
412
+ rows, never fall back to SQLite when a file-first operation is unclear, and
413
+ never treat an absent index as a different kind of authority.
414
+
415
+ ### File-first path
416
+
417
+ When the Navigator asks to inspect, show, or orient to Refinement Work, read the
418
+ canonical index and the linked documents needed to explain the current focus.
419
+ Render one compact, agent-composed `Refinement Workbench` view with these facts in
420
+ this order:
421
+
422
+ 1. canonical project-relative index path;
423
+ 2. focused RS and CR, or explicit `none` values;
424
+ 3. every RS with its canonical status;
425
+ 4. open CRs in canonical order with ID, RS, title, status, and canonical Driver
426
+ and Delivery details when assigned;
427
+ 5. terminal CR history after open work, preserving canonical Driver and Delivery
428
+ provenance when present;
429
+ 6. the next safe action for the focused item, grounded in its canonical status
430
+ and linked plan; and
431
+ 7. a boundary stating that inspection selected, changed, and executed nothing.
432
+
433
+ Use `▸` to distinguish focused items. Preserve index ordering exactly. Omit an
434
+ empty section cleanly or label it `none`; do not invent content. The root index
435
+ wins whenever linked narrative disagrees about focus or status. Name the source
436
+ path visibly and state that SQLite was not consulted. A representative shape is:
437
+
438
+ ```text
439
+ Refinement Workbench
440
+
441
+ source
442
+ <canonical project-relative index path>
443
+
444
+ CURRENT FOCUS
445
+ <focused RS or none>
446
+ ▸ <focused CR or none>
447
+
448
+ REFINEMENT STORIES
449
+ <RS rows in canonical order>
450
+
451
+ OPEN CHANGE REQUESTS
452
+ <non-terminal CR rows in canonical order>
453
+ Driver: <canonical human> · Delivery: <canonical PR or branch> # only when assigned
454
+
455
+ TERMINAL HISTORY
456
+ <terminal CR rows after open work, or none>
457
+ Driver: <canonical human> · Delivery: <canonical PR or branch> # only when present
458
+
459
+ NEXT SAFE ACTION
460
+ <one grounded next action>
461
+
462
+ BOUNDARY
463
+ Read-only inspection. No work was selected, changed, or executed.
464
+ SQLite was not consulted.
465
+ ```
466
+
467
+ This is a presentation contract for the agent reading project documents, not a
468
+ runtime-generated deterministic Ariad surface. Do not wrap it in
469
+ `<<<ARIAD:...>>>`, add a Markdown parser, or call legacy Workbench commands to
470
+ produce it. If the canonical index is unreadable or structurally ambiguous,
471
+ report the practical defect and stop instead of silently falling back to SQLite.
472
+ Read-only intent stays read-only: recommend a concrete correction, but do not
473
+ mutate files.
474
+
475
+ Treat Driver and Delivery as canonical project facts, not runtime discoveries.
476
+ Show them only when the index row provides values other than its documented empty
477
+ marker. Never infer assignment from the current Git checkout, branch author,
478
+ latest committer, active journey, conversation, or SQLite state. Follow the
479
+ project's collaboration convention when changing status: if it requires Driver
480
+ and Delivery before `in_progress`, `blocked`, or `validated`, stop for the missing
481
+ Navigator decision rather than synthesizing either value. Reassignment and stale
482
+ work disposition are semantic decisions and always remain explicit.
483
+
484
+ #### Collaborative file-first lifecycle
485
+
486
+ Read and follow any collaboration protocol linked by the canonical index. When no
487
+ more specific project rule exists, use this route:
488
+
489
+ - **Inspect before mutation.** Read the complete index and relevant linked
490
+ documents. Confirm focus, existing IDs, target RS, status, Driver, and Delivery.
491
+ - **Capture without selecting.** Require a concrete title, problem, expected
492
+ behavior, and explicit RS target. If the layout has no unassigned CR location,
493
+ stop rather than inventing one. Allocate the next unused project-wide numeric
494
+ ID from the complete index, preserve three-digit formatting, create one evolving
495
+ CR document with `Problem`, `Expected Behavior`, `Impact`, `Plan Or Decision`,
496
+ `Evidence`, and `Outcome`, append a `captured`/unassigned row, and preserve
497
+ `Current Focus` exactly.
498
+ - **Select explicitly.** Update only `Current Focus`. Selection changes no status
499
+ and authorizes neither planning nor implementation.
500
+ - **Plan before implementation.** Record scope, affected files, acceptance,
501
+ validation, exclusions, and authority boundaries. Move `captured` to `planned`
502
+ only after Navigator approval.
503
+ - **Assign before starting.** Before `in_progress`, obtain explicit human Driver
504
+ and branch/PR Delivery decisions, then update status and both fields atomically.
505
+ Replace a branch reference with the PR link after the PR opens.
506
+ - **Evidence is not validation.** Record checks and isolated smoke evidence during
507
+ implementation, but require an explicit natural Navigator validation route and
508
+ acceptance before `validated`.
509
+ - **Review before terminal closure.** Record proportionality/debt findings. `done`
510
+ requires accepted validation and resolved debt action. `blocked`, `parked`,
511
+ `rejected`, and `promoted` require narrative reasons; `parked` also requires a
512
+ revisit trigger and `promoted` a Delivery target. Move terminal CRs below open
513
+ work, preserve Driver/Delivery provenance, and clear focused CR state without
514
+ selecting the next item implicitly.
515
+ - **Return a handoff.** Report RS/CR, canonical status, Driver, Delivery, changed
516
+ files, checks, Navigator validation, limitations, unresolved decisions, and the
517
+ requested next action. A handoff never grants merge, publication, or release.
518
+ - **Let Git expose concurrency.** Refresh against the approved base before final
519
+ handoff. Never overwrite, silently renumber, merge narratives, delete another
520
+ contributor's work, or use SQLite to resolve ID/index/focus/status conflicts.
521
+ Stop for semantic conflict resolution.
522
+
523
+ When the Navigator asks how to create, work on, or collaborate through
524
+ Refinement Work, answer read-only and explain the complete contributor route. Do
525
+ not stop the explanation at terminal status: include the return handoff and how
526
+ ordinary Git conflicts protect concurrent ID, index, focus, status, assignment,
527
+ and narrative edits. Name the linked project protocol as the durable authority.
528
+
529
+ Status remains document vocabulary, not an application state machine. Do not add
530
+ ID reservation, locks, watchers, heartbeats, stale-work automation, Markdown
531
+ parsing, projection, synchronization, or custom Git commands without repeated
532
+ operational evidence and separate Navigator approval.
533
+
534
+ When the Navigator authorizes a mutable operation such as capture, select,
535
+ continue, update, or implement, that request also authorizes structural repairs
536
+ needed to complete it without a second confirmation only when every repair is:
537
+
538
+ - necessary for the requested operation;
539
+ - deterministic from existing project evidence;
540
+ - local to the involved Refinement documents;
541
+ - non-destructive and reversible through Git;
542
+ - meaning-preserving; and
543
+ - free of unrequested status, priority, focus, identity, SQLite, configuration,
544
+ commit, push, publication, or release decisions.
545
+
546
+ After completing the operation, explain in Navigator-facing project language
547
+ what defect was found, what was repaired, and what was left unchanged. Do not
548
+ lead with internal Mirror terms such as projection, artifact mismatch, or
549
+ runtime coherence.
550
+
551
+ Stop only when repair would choose product meaning, delete content, resolve a
552
+ concurrent conflict, or expand the original request. In that case, explain the
553
+ practical consequence, recommend the smallest safe solution, name the files it
554
+ would change, and ask for the missing decision. Never use legacy SQLite as a
555
+ recovery path.
556
+
557
+ Follow the canonical file's status vocabulary and ID convention. Do not invent
558
+ missing narrative or an RS assignment. Do not treat journey-local UUIDs or
559
+ legacy display codes as project artifact identity. Git owns history, conflicts,
560
+ and recovery; ordinary file work must not create an application-level Git
561
+ protocol.
562
+
563
+ ## Prepare Ariad Templates
564
+
565
+ When the user asks to prepare Ariad templates or make the adopted journey
566
+ documentation-ready, run:
567
+
568
+ ```bash
569
+ mirror build prepare-templates --journey <slug> --method ariad
570
+ ```
571
+
572
+ Render the report visibly. The operation may create missing method-declared
573
+ template files, but must preserve existing files and must not create a delivery
574
+ cursor, execute lifecycle work, change story status, commit, push, or release.
575
+
576
+ ## Sync Delivery Cursor
577
+
578
+ When the user asks to sync the initial Builder delivery cursor for an
579
+ Ariad-adopted journey, run:
580
+
581
+ ```bash
582
+ mirror build sync-cursor --journey <slug> --method ariad
583
+ ```
584
+
585
+ Render the cursor sync report visibly. This persists runtime resume state only.
586
+ It must not infer an active roadmap item, execute Pull/Prepare/Plan, change story
587
+ status, commit, push, or release.
588
+
589
+ ## Inspect Roadmap And Pull Candidates
590
+
591
+ When the user asks to see the roadmap, inspect the roadmap, show roadmap
592
+ candidates, see what can be pulled, choose the next story, or asks "o que posso
593
+ puxar agora?", run:
594
+
595
+ ```bash
596
+ mirror build pull-candidates --journey <slug> --method ariad
597
+ ```
598
+
599
+ Render the configured Ariad surfaces visibly, currently `ROADMAP SNAPSHOT` and
600
+ `■ Ariad Pull Candidates`. With an active item both are scoped to its Capability
601
+ Value: `candidates in <CV>`, a count of those outside, and a recommendation
602
+ inside the CV (or `no remaining candidates in <CV>`). Without one, the list is
603
+ `project-wide candidates` and no pull is recommended. This is read-only: it must
604
+ not pull an item, update the cursor, execute lifecycle work, change story status,
605
+ commit, push, or release.
606
+
607
+ ## Show The Active Checkpoint
608
+
609
+ When the user asks where the active item stands or asks to see the current checkpoint
610
+ again, or when a surface was lost, run:
611
+
612
+ ```bash
613
+ mirror build show --journey <slug> --method ariad
614
+ ```
615
+
616
+ Return the `ACTIVE_CHECKPOINT` surface verbatim. It shows the stage, the cursor's
617
+ position, the cadence, the steps the cursor accepts next, as the resume lists them,
618
+ and the story package's files: `index.md`, `plan.md`, and `test-guide.md` with
619
+ their state, and the closure records, each present or missing. It does not replay the
620
+ original checkpoint surface: that evidence lives in those records, so read the one the
621
+ Navigator needs, such as `plan.md` before Plan approval. It is read-only and changes
622
+ neither the cursor nor any file.
623
+
624
+ ## Pull And Prepare Ariad Work
625
+
626
+ When the user asks to change testing/runtime cadence, use:
627
+
628
+ ```bash
629
+ mirror build set-cadence --journey <slug> --method ariad --profile <stepwise|checkpoint|accelerated|autonomous>
630
+ ```
631
+
632
+ Use `stepwise` for detailed dogfooding: Plan stops for approval unless the Navigator naturally asks the Driver to create and execute the active story Plan without another approval turn. Use `checkpoint` for normal Ariad cadence. Use `accelerated` when the Navigator trusts the Driver to complete the active story Plan and continue directly into local implementation; the runtime automatically records bounded story Plan authority and still stops at Navigator Validation. Use `autonomous` only with explicit Navigator limits, for example:
633
+
634
+ ```bash
635
+ mirror build set-cadence --journey <slug> --method ariad \
636
+ --profile autonomous \
637
+ --limit "stop before push or release" \
638
+ --limit "stop on scope change" \
639
+ --limit "stop on failing checks"
640
+ ```
641
+
642
+ The Builder resume, `build show`, and the Builder orientation print the cadence
643
+ profile and, under `autonomous`, its limits. Read it there before Plan: under
644
+ `accelerated`, Plan continues into implementation without a Navigator turn.
645
+
646
+ Higher-autonomy cadence never grants permission to cross Navigator validation acceptance, debt decisions, unsafe operations, scope changes, push/release, or Done/history boundaries. For an active User Story or Technical Story in `story_by_story`, `accelerated` satisfies the Plan approval gate through a complete, structurally matching, single-use receipt instead of pausing for another Navigator turn; Plan completeness and mismatch checks still apply. In current Ariad, Pull is the Navigator signal to Prepare; pulling a Delivery Story also expands it into implementable User/Technical Stories and stops for confirmation of the recommended next story.
647
+
648
+ When the user asks to continue under the active cadence, use:
649
+
650
+ ```bash
651
+ mirror build continue-lifecycle --journey <slug> --method ariad \
652
+ --process "<process alignment evidence>" \
653
+ --project "<project/docs/artifacts alignment evidence>" \
654
+ --product "<product behavior alignment evidence>" \
655
+ --history-action "<required to cross Done/history boundary>" \
656
+ --roadmap-update "<required to cross Done/history boundary>" \
657
+ --next-recommendation "<required to cross Done/history boundary>"
658
+ ```
659
+
660
+ `continue-lifecycle` may emit multiple Ariad surfaces; return every marked block verbatim in order. In `stepwise` cadence it must refuse automatic continuation. In higher-autonomy cadence it may continue only through bypassable soft stops and must still stop at hard gates when required evidence is missing.
661
+
662
+ When the user asks to pull a roadmap item into active Ariad work, run the
663
+ contained Pull command with explicit item metadata:
664
+
665
+ ```bash
666
+ mirror build pull-item --journey <slug> --method ariad \
667
+ --item-code <code> \
668
+ --item-title "<title>" \
669
+ --item-level <delivery_story|user_story|technical_story> \
670
+ --why-now "<why this level now>"
671
+ ```
672
+
673
+ Render all emitted surfaces visibly. Pull may update runtime cursor active item
674
+ and automatically run Prepare. If the pulled item is a Delivery Story, Pull also
675
+ expands it into implementable child stories and recommends the next
676
+ User/Technical Story to plan. Pull must not create a Plan, approve a checkpoint,
677
+ implement, validate, review, close, commit, push, or release.
678
+
679
+ When the Pull card's source reads `not in the roadmap`, say so to the Navigator
680
+ before planning: the code may be mistyped, or the roadmap behind.
681
+
682
+ When the Navigator confirms the recommended child story after an Expand surface,
683
+ pull that child story explicitly with `--item-level user_story` or
684
+ `--item-level technical_story` using the recommended code/title from the surface.
685
+ Then plan that implementable story when requested.
686
+
687
+ When the user asks to prepare the pulled item, run:
688
+
689
+ ```bash
690
+ mirror build prepare-item --journey <slug> --method ariad
691
+ ```
692
+
693
+ Render the Prepare report visibly. Prepare may update the runtime cursor last
694
+ delivery event, but must not create a Plan, approve a checkpoint, start
695
+ implementation, change story status, commit, push, or release.
696
+
697
+ ## Delivery Story Candidate Table Authoring Contract
698
+
699
+ Expand resolves an already-authored Delivery Story package by its `index.md`
700
+ heading code, never by folder name or arithmetic on code and title -- an
701
+ authored package can live under any folder a human chose. Once resolved,
702
+ Expand reads its `## Candidate Stories` table, header-driven. The header must
703
+ include these four column names (case-insensitive, any order, extra columns
704
+ such as `Outcome` or `Risk` are fine):
705
+
706
+ ```text
707
+ | Code | Story | Type | Status |
708
+ ```
709
+
710
+ or the 5-column generated variant:
711
+
712
+ ```text
713
+ | Code | Story | Type | Outcome | Status |
714
+ ```
715
+
716
+ When authoring or reviewing a Delivery Story `index.md` by hand, use this exact
717
+ grammar (see `docs/project/roadmap/templates/delivery-story-index.md`). If the
718
+ Navigator proposes a different shape (for example `| Family | Scope | Type |
719
+ Risk |`), flag the mismatch before Pull/Expand runs so the table is
720
+ Expand-compatible by construction.
721
+
722
+ A pipe inside a cell is written `\|`, as GFM writes it, and reads back as `|`;
723
+ Ariad escapes the pipes in any title it writes into a cell.
724
+
725
+ If Expand renders `<<<ARIAD:EXPAND_BLOCKED>>>` (the resolved package's table
726
+ does not parse, two packages claim the same code, or a Delivery Story with no
727
+ package would need a story that an authored package already claims), return the
728
+ surface verbatim per the transport protocol, then explain what to fix: correct
729
+ the table header to the canonical grammar, resolve the duplicate heading, or
730
+ author the Delivery Story's `index.md` with a canonical candidate table that
731
+ lists the story already authored. Do not
732
+ hand-edit the package's materialized children to work around a blocked Expand,
733
+ and do not re-run Pull/Expand until the Navigator has fixed the authored
734
+ content.
735
+
736
+ ## Delivery Story Release Intent
737
+
738
+ When the active Ariad item belongs to a Delivery Story and the Navigator
739
+ explicitly says the DS is expected to create a release boundary, has no release
740
+ intent, or remains undecided, record only that planning state:
741
+
742
+ ```bash
743
+ mirror build release-intent --journey <slug> --method ariad \
744
+ --intent <planned|none|undecided>
745
+ ```
746
+
747
+ To inspect without changing state, omit `--intent`. Return the `RELEASE_INTENT`
748
+ surface verbatim.
749
+
750
+ Map only explicit meaning:
751
+
752
+ - `planned` — the DS is expected to create a release boundary if completed
753
+ coherently;
754
+ - `none` — the DS is explicitly not expected to create a release boundary;
755
+ - `undecided` — the decision is intentionally unresolved and may be revisited.
756
+
757
+ Do not infer intent from cadence, version changes, completed implementation,
758
+ existing tags, roadmap position, or a previous DS. Release intent belongs to the
759
+ Delivery Story ancestor and is not authorization to commit, push, create a tag,
760
+ promote stable, publish a release, or mutate a remote system. Those remain
761
+ separate gates.
762
+
763
+ ## Delivery Story Navigator Flow
764
+
765
+ When the active Ariad work is a Delivery Story or the Navigator refers to the
766
+ current Delivery Story and says a natural-language equivalent of:
767
+
768
+ - `quero seguir no nível da DS`
769
+ - `seguir no nível da Delivery Story`
770
+ - `use Delivery Story flow`
771
+ - `não preciso validar cada US`
772
+ - `aprove um plano geral da DS e eu valido no fim`
773
+
774
+ run:
775
+
776
+ ```bash
777
+ mirror build set-flow-unit --journey <slug> --method ariad --unit delivery_story
778
+ ```
779
+
780
+ Return the `DELIVERY_STORY_SCOPE_CONFIRMATION` surface verbatim. Explain after
781
+ the surface that child User/Technical Stories remain traceable Driver work
782
+ packages, and that choosing Delivery Story flow does not approve a Plan, start
783
+ implementation, validate, push, or release.
784
+
785
+ The scope confirmation is a Navigator stop. It asks whether the scope is right
786
+ before any DS Plan exists. The runtime records the stop without enforcing it: the
787
+ cursor holds `navigator_scope_confirmation` until the Plan replaces it, and
788
+ `plan-delivery-story` does not refuse while it is pending, so the question stays
789
+ true only if you wait for the answer. End the turn after the surface. Do not run
790
+ `plan-delivery-story` in the same turn, even when the Navigator's request also
791
+ asked for the Plan. Plan only on a later Navigator turn that confirms or corrects
792
+ the scope. Cadence and Plan preauthorization do not remove this stop.
793
+
794
+ A Builder resume that shows `pending confirmation: navigator_scope_confirmation`
795
+ is this same question, still open. Ask it again, or render it again with the
796
+ `set-flow-unit --unit delivery_story` command above, and plan only on the
797
+ Navigator's answer.
798
+
799
+ A flow unit is chosen only at the Delivery Story's flow decision, after Prepare or
800
+ Expand and before its Plan. Anywhere else `set-flow-unit --unit` refuses with one
801
+ `Error: no flow unit was chosen: ...` line and changes nothing. Relay that reason to
802
+ the Navigator. Do not reset or re-pull to force the choice without their decision.
803
+
804
+ `set-flow-unit` without `--unit` only inspects the current choice and renders
805
+ `NAVIGATOR_FLOW_UNIT`.
806
+
807
+ When the effective flow unit is `story_by_story`, preserve existing child-story
808
+ Plan behavior. Do not silently use Delivery Story-level Plan unless the
809
+ Navigator has selected `delivery_story` flow or explicitly asks to follow work at
810
+ Delivery Story level.
811
+
812
+ ## Delivery Story Plan Ariad Work
813
+
814
+ When the active Ariad work is a Delivery Story with
815
+ `navigator_flow_unit=delivery_story` and the Navigator says a natural-language
816
+ equivalent of:
817
+
818
+ - `planeje a DS`
819
+ - `planeje a Delivery Story`
820
+ - `plan the Delivery Story`
821
+ - `crie o plano geral da DS`
822
+
823
+ run:
824
+
825
+ ```bash
826
+ mirror build plan-delivery-story --journey <slug> --method ariad \
827
+ --objective "<aggregate Delivery Story objective>" \
828
+ --child <child-work-item-code>
829
+ ```
830
+
831
+ Pass one `--child` argument for each known child User/Technical Story work
832
+ package. If child work packages are already present in the cursor, the command
833
+ may use them; otherwise include the known roadmap child codes. If the user names
834
+ a specific journey, pass `--journey <slug>`.
835
+
836
+ Return the `DELIVERY_STORY_PLAN_CHECKPOINT` surface verbatim. Interpret only
837
+ after the block. Explain that the DS-level Plan is pending approval and that no
838
+ implementation, validation, push, or release is authorized by planning alone.
839
+
840
+ ### Conditional Plan preauthorization
841
+
842
+ Use conditional preauthorization only when the Navigator explicitly authorizes
843
+ one active Delivery Story by exact child identity and names the fixed next hard
844
+ stop at Navigator Validation. Vague continuation, cadence selection, “faça tudo”,
845
+ “não me pergunte nada”, or generic autonomy language never creates authority.
846
+ Delivery Story preauthorization applies only to `delivery_story` flow. Exact
847
+ User Story and Technical Story preauthorization is handled separately under
848
+ `story_by_story` flow below.
849
+
850
+ For an explicit matching request, include:
851
+
852
+ ```bash
853
+ mirror build plan-delivery-story --journey <slug> --method ariad \
854
+ --objective "<aggregate Delivery Story objective>" \
855
+ --child <every exact child code> \
856
+ --preauthorize-approval \
857
+ --stop-after navigator_validation
858
+ ```
859
+
860
+ Return `DELIVERY_STORY_PLAN_CHECKPOINT`,
861
+ `PLAN_PREAUTHORIZATION_RECORDED`, and artifact surfaces verbatim. The receipt is
862
+ not approval: complete the Driver-owned `plan.md` first. Required sections must
863
+ exist and contain no empty, `Pending`, TODO/TBD, or placeholder body. Never
864
+ replace an existing non-empty Plan with the runtime scaffold.
865
+
866
+ In the same assistant turn, after completing the Plan, consume the receipt with:
867
+
868
+ ```bash
869
+ mirror build approve-delivery-story-plan --journey <slug> --method ariad \
870
+ --use-preauthorization
871
+ ```
872
+
873
+ On exact match, return every approval/start surface, implement only local approved
874
+ work, and stop at Navigator Validation. On `PLAN_PREAUTHORIZATION_MISMATCH`,
875
+ return the bounded surface and stop at ordinary Plan approval. Never repair,
876
+ expand, reinterpret, or recreate authority silently. Child order is
877
+ presentational, but addition or removal is a mismatch.
878
+
879
+ Cancel pending authority when the Navigator withdraws it:
880
+
881
+ ```bash
882
+ mirror build cancel-delivery-story-plan-preauthorization --journey <slug> \
883
+ --method ariad
884
+ ```
885
+
886
+ Cancellation preserves the ordinary Plan approval gate. Preauthorization never
887
+ crosses validation acceptance, debt, Done/history, commit, push, release, deploy,
888
+ purchase, or another irreversible boundary.
889
+
890
+ If the Navigator asks to plan the Delivery Story before selecting
891
+ `delivery_story` flow, first surface or request the flow-unit choice; do not
892
+ silently use DS-level Plan from the default `story_by_story` flow. Surfacing the
893
+ choice with `set-flow-unit --unit delivery_story` ends the turn at its scope
894
+ confirmation, as described in Delivery Story Navigator Flow; plan on the
895
+ Navigator's next turn.
896
+
897
+ When the Navigator approves a pending DS-level Plan with natural language such
898
+ as `aprovo o plano da DS`, `plano da DS aprovado`, or `approve the Delivery
899
+ Story plan`, run:
900
+
901
+ ```bash
902
+ mirror build approve-delivery-story-plan --journey <slug> --method ariad
903
+ ```
904
+
905
+ Return every emitted Ariad surface verbatim, including
906
+ `DELIVERY_STORY_PLAN_CHECKPOINT`, `ARTIFACTS_MATERIALIZED`, and
907
+ `IMPLEMENTATION_STARTED` when present.
908
+
909
+ Plan approval authorizes local implementation under the approved DS Plan. After
910
+ rendering the approval surfaces, do **not** stop to ask for a separate
911
+ implementation command. Immediately begin implementing the approved plan: read
912
+ the generated `plan.md` / `test-guide.md` artifacts and relevant code, edit local
913
+ project files, and run appropriate checks. Still stop before hard gates: unsafe
914
+ operations, scope changes, debt decisions, push, release, deploy, purchase,
915
+ externally irreversible actions, and final Done/history boundaries remain
916
+ explicit Navigator authorization points.
917
+
918
+ ## Plan Ariad Work
919
+
920
+ When the user asks to plan the pulled item, create a plan for the active item, or
921
+ says a natural-language equivalent such as `planeje o item puxado`, run:
922
+
923
+ ```bash
924
+ mirror build plan-item --journey <slug> --method ariad
925
+ ```
926
+
927
+ Render the Plan Checkpoint visibly, and name the plan in the reply by its
928
+ project-relative path: the card's `story package`, then `/plan.md`. The card holds no plan: it names the story files,
929
+ `index.md`, `plan.md`, and `test-guide.md`, each with its state and the sections
930
+ still to author. The plan is read in `plan.md`. Right after `plan-item` that file
931
+ is usually the scaffold, so there is no plan to present yet: present it after it
932
+ is authored, by the sequence below. Keep runtime cursor fields compact; do not let
933
+ technical metadata replace the plan itself.
934
+
935
+ Plan may update runtime cursor checkpoint state and may create/update the
936
+ Plan-stage story package (`index.md`, `plan.md`, and `test-guide.md`) only for an
937
+ implementable User Story or Technical Story. Delivery Stories are never planned
938
+ as the implementable unit; they must expand first. Plan must not approve the
939
+ checkpoint, start implementation, change implementation files for the pulled
940
+ item, change story status, commit, push, or release.
941
+
942
+ ### Author the plan before asking for approval
943
+
944
+ Plan writes `plan.md` as a scaffold: template sentences with the item's title
945
+ pasted in. It is not a plan. The Objective, Scope, Acceptance Behavior, and
946
+ Validation Route are what the Navigator approves from: write them for this
947
+ story, in Navigator-facing language. The Non-Goals, Implementation Contract,
948
+ Stop Conditions, and Approval Gate may stand as written when they are true. Unless
949
+ the Plan checkpoint or `build show` names `index.md` authored, write its story
950
+ statement, Outcome, and Acceptance Behavior too: it may say scaffold, partly
951
+ authored, or incomplete.
952
+
953
+ The sequence:
954
+
955
+ 1. `plan-item`.
956
+ 2. Author `plan.md`, and `index.md` unless the Plan checkpoint or `build show`
957
+ names it authored.
958
+ 3. Run `build show` and return its `ACTIVE_CHECKPOINT` block. It must read
959
+ `✓ plan.md — authored`; if it does not, author what it names and run it again.
960
+ 4. Present the plan from `plan.md`, section by section: the Objective, Scope,
961
+ Non-Goals, Acceptance Behavior, and Validation Route as the file states them,
962
+ not paraphrased into claims the file does not make. Then ask for approval.
963
+ 5. On approval, `approve-plan`.
964
+
965
+ The runtime checks structure, not quality: one real line under a heading passes
966
+ it. That check is a floor. The bar is a plan the Navigator can approve from.
967
+
968
+ `approve-plan` refuses with `CHECKPOINT_REFUSED` while any section it requires is
969
+ missing, empty, pending, or still the scaffold's, and names each by its heading.
970
+ A refusal means: author what it names, run `build show`, and present the plan
971
+ again. Do not run `approve-plan` again in the same turn as if the approval were
972
+ still standing: the Navigator approved a plan that did not exist yet.
973
+
974
+ `done-item` refuses the same way while the story's `index.md` still says what
975
+ Expand or Plan wrote ("I want to <title>"). Write the story it is before closing
976
+ it.
977
+
978
+ ### Conditional story Plan preauthorization
979
+
980
+ Use story-level conditional preauthorization for one active User Story or
981
+ Technical Story in `story_by_story` flow through either of two routes:
982
+
983
+ - **natural explicit delegation in any cadence** — the Navigator asks the Driver
984
+ to create the active story Plan and execute it without another Plan approval
985
+ turn, for example `crie o plano e execute sem que eu precise autorizar`,
986
+ `faça o plano e implemente com preautorização concedida`, or an equivalent
987
+ natural phrase;
988
+ - **accelerated cadence** — `plan-item` automatically records bounded story Plan
989
+ authority, so the Driver completes the Plan and continues without a Plan stop.
990
+
991
+ The Navigator does not need to recite story identity, sibling exclusions,
992
+ fingerprint policy, mismatch behavior, or the Validation boundary. Ariad derives
993
+ those safeguards from the active cursor and method: exact active item and level,
994
+ `story_by_story` flow, current generation, no sibling scope, complete Plan,
995
+ single use, bounded mismatch fallback, and stop at Navigator Validation.
996
+
997
+ Vague continuation such as `continue`, an isolated `faça tudo`, or `não me
998
+ pergunte nada` does not create stepwise story authority. Selecting `accelerated`
999
+ is itself the explicit cadence decision that authorizes Plan continuation for
1000
+ active implementable stories. For natural explicit delegation, run:
1001
+
1002
+ ```bash
1003
+ mirror build plan-item --journey <slug> --method ariad \
1004
+ --preauthorize-approval \
1005
+ --stop-after navigator_validation
1006
+ ```
1007
+
1008
+ In `accelerated` cadence, run ordinary `plan-item` without the explicit flag; the
1009
+ runtime automatically records bounded story Plan authority and emits the same
1010
+ receipt surface. Do not pause for Navigator approval after either route.
1011
+
1012
+ Return `PLAN_CHECKPOINT`, `PLAN_PREAUTHORIZATION_RECORDED`, and artifact surfaces
1013
+ verbatim. Preserve existing `index.md`, `plan.md`, and `test-guide.md` bytes. The
1014
+ receipt is not approval: the Driver-owned Plan must be authored, as in
1015
+ [Author the plan before asking for approval](#author-the-plan-before-asking-for-approval),
1016
+ before authority can be consumed. The Objective, Scope, Acceptance Behavior, and
1017
+ Validation Route must be written for this story, not the scaffold's sentences, and
1018
+ the Non-Goals and Implementation Contract must not be empty. A plan that is not
1019
+ authored returns `PLAN_PREAUTHORIZATION_MISMATCH` with reason `plan_incomplete` and
1020
+ the sections still to author.
1021
+
1022
+ In the same assistant turn, after completing the exact story Plan, run:
1023
+
1024
+ ```bash
1025
+ mirror build approve-plan --journey <slug> --method ariad \
1026
+ --use-preauthorization
1027
+ ```
1028
+
1029
+ On exact match, return every approval and `IMPLEMENTATION_STARTED` surface,
1030
+ implement only the active story locally, and stop at Navigator Validation. On
1031
+ `PLAN_PREAUTHORIZATION_MISMATCH`, return the bounded surface and stop at ordinary
1032
+ Plan approval; never repair, reinterpret, or recreate authority silently.
1033
+
1034
+ Cancel pending story authority when the Navigator withdraws it:
1035
+
1036
+ ```bash
1037
+ mirror build cancel-plan-preauthorization --journey <slug> --method ariad
1038
+ ```
1039
+
1040
+ Cancellation preserves the ordinary Plan gate. Story authority is private,
1041
+ single-use, cursor-generation-bound, and cannot authorize a sibling story,
1042
+ Validation acceptance, Debt Review, Done/history, commit, push, release, deploy,
1043
+ purchase, or another irreversible action.
1044
+
1045
+ When the Navigator approves an ordinary Plan checkpoint, run:
1046
+
1047
+ ```bash
1048
+ mirror build approve-plan --journey <slug> --method ariad
1049
+ ```
1050
+
1051
+ If the user asks to implement while the Plan checkpoint is pending, run the guard
1052
+ before doing any implementation work:
1053
+
1054
+ ```bash
1055
+ mirror build check-implementation --journey <slug> --method ariad
1056
+ ```
1057
+
1058
+ Render the deterministic `IMPLEMENTATION_GUARD` surface. If the guard reports
1059
+ that Navigator approval is required, return the surface and stop. Do not mutate
1060
+ files.
1061
+
1062
+ ## Closure Records
1063
+
1064
+ `validation.md`, `review.md`, `coherence.md`, and `done.md` are records
1065
+ that Ariad seals: their last line is `<!-- ariad-seal sha256:… -->`. A closure
1066
+ command rewrites a record only while its seal still matches. Anything else is
1067
+ left exactly as it is, and the checkpoint says `preserved`.
1068
+
1069
+ `preserved` is not an error. It means a person wrote or edited the file, and
1070
+ their version stands. The checkpoint's fields are in the surface you render, and
1071
+ they were not written to the file.
1072
+
1073
+ - Never delete, rewrite, or re-seal an authored record to make Ariad write it.
1074
+ - Never copy a seal line into a file.
1075
+ - If the Navigator wants Ariad's record in the file, ask how they want their
1076
+ own notes kept.
1077
+
1078
+ ## Delivery Story Validation And Closure
1079
+
1080
+ When the active Ariad work is a Delivery Story with
1081
+ `navigator_flow_unit=delivery_story` and an approved aggregate DS Plan, route
1082
+ natural Navigator requests for aggregate DS closure through the Delivery Story
1083
+ runtime commands.
1084
+
1085
+ For natural validation requests such as `valide a DS`, `valide a Delivery
1086
+ Story`, or `validação da DS aceita`, run:
1087
+
1088
+ ```bash
1089
+ mirror build validate-delivery-story --journey <slug> --method ariad \
1090
+ --summary "<aggregate DS validation evidence>" \
1091
+ --navigator-accepted
1092
+ ```
1093
+
1094
+ For DS-level debt review requests, run:
1095
+
1096
+ ```bash
1097
+ mirror build review-delivery-story --journey <slug> --method ariad \
1098
+ --decision <no_action|defer|pay_now> \
1099
+ --summary "<DS-level debt review summary>"
1100
+ ```
1101
+
1102
+ For DS-level Done requests after Debt Review and Navigator closure confirmation,
1103
+ first align authored project state: mark the resolved Delivery Story package,
1104
+ every known child package/candidate row, and every canonical roadmap table row
1105
+ for the DS as Done. Then run:
1106
+
1107
+ ```bash
1108
+ mirror build done-delivery-story --journey <slug> --method ariad \
1109
+ --summary "<DS-level done/history summary>"
1110
+ ```
1111
+
1112
+ The command runs an authored roadmap closure preflight before cursor or artifact
1113
+ mutation. If any DS package, known child package/candidate row, or canonical
1114
+ roadmap row remains non-Done, the runtime refuses Done before cursor or artifact mutation and names project-relative files to align. The agent owns semantic
1115
+ Markdown updates; the runtime verifies explicit status evidence and never invents
1116
+ project meaning.
1117
+
1118
+ DS-level Coherence is not a separate lifecycle stage before Done. It is checked
1119
+ inside Done only after the authored status preflight passes, so the final surface
1120
+ can truthfully state that docs, roadmap, cursor, artifacts, and next-pull readiness
1121
+ remain consistent after closure.
1122
+
1123
+ Return every `DELIVERY_STORY_CLOSURE_CHECKPOINT` surface verbatim. Explain after
1124
+ the block that child User/Technical Stories remain evidence units and that
1125
+ push/release remain separate hard gates. Do not use these DS-level closure
1126
+ commands when the effective flow unit is `story_by_story`; preserve existing
1127
+ child-story lifecycle behavior in that mode.
1128
+
1129
+ ## Validate Ariad Work
1130
+
1131
+ After implementation is complete and before moving to Debt Review or Done,
1132
+ render the Validation checkpoint:
1133
+
1134
+ ```bash
1135
+ mirror build validate-item --journey <slug> --method ariad \
1136
+ --implementation-complete \
1137
+ --check "<automated check command or evidence>" \
1138
+ --checks-status <passed|failed|not_run> \
1139
+ --e2e-decision <required|not_required|waived|skipped> \
1140
+ --e2e-evidence "<E2E evidence or waiver/skipped reason>" \
1141
+ --navigator-route "<Navigator-visible validation route>" \
1142
+ --navigator-accepted \
1143
+ --expected-observation "<what the Navigator should observe>" \
1144
+ --pass-condition "<what counts as pass>" \
1145
+ --fail-condition "<what counts as fail>"
1146
+ ```
1147
+
1148
+ If the Navigator has already performed and accepted the validation route, also
1149
+ pass `--navigator-accepted`. Providing a route is not the same as acceptance.
1150
+
1151
+ Render the deterministic `VALIDATION_CHECKPOINT` surface. If required evidence
1152
+ is missing or Navigator validation has not been accepted, return the surface and
1153
+ stop; do not advance to Debt Review, Done, commit, push, or release.
1154
+
1155
+ ## Review Ariad Debt
1156
+
1157
+ After Validation has passed and before moving to Done, render the Debt Review
1158
+ checkpoint:
1159
+
1160
+ ```bash
1161
+ mirror build review-item --journey <slug> --method ariad \
1162
+ --debt "<debt finding, or No debt found>" \
1163
+ --decision <pending|no_action|defer|pay_now> \
1164
+ --defer-reason "<required when decision=defer>" \
1165
+ --revisit-trigger "<required when decision=defer>"
1166
+ ```
1167
+
1168
+ Render the deterministic `DEBT_REVIEW_CHECKPOINT` surface. If the decision is
1169
+ `pending`, `defer` without a reason/trigger, or `pay_now`, stop at the debt
1170
+ decision checkpoint. `pay_now` must route through a future Refactor loop before
1171
+ Done. Do not advance to Done, commit, push, or release while the debt decision
1172
+ is unresolved.
1173
+
1174
+ ## Check Ariad Coherence
1175
+
1176
+ After Debt Review is complete, verify Process, Project, and Product alignment:
1177
+
1178
+ ```bash
1179
+ mirror build coherence-item --journey <slug> --method ariad \
1180
+ --process "<process alignment evidence>" \
1181
+ --project "<project alignment evidence>" \
1182
+ --product "<product alignment evidence>"
1183
+ ```
1184
+
1185
+ Render the `COHERENCE_CHECKPOINT` surface. If it reports `pending_coherence`,
1186
+ correct the missing evidence and rerun the same command. Reentry is valid only
1187
+ for the exact `navigator_coherence` / `last_delivery_event=coherence` state. It
1188
+ re-evaluates the evidence; it does not bypass Coherence. Unrelated pending
1189
+ confirmations stay blocked, and `done-item` never consumes
1190
+ `navigator_coherence`.
1191
+
1192
+ ## Close Ariad Done
1193
+
1194
+ After Coherence is complete and the Navigator confirms there is nothing else to
1195
+ do in the story, render the Done checkpoint:
1196
+
1197
+ ```bash
1198
+ mirror build done-item --journey <slug> --method ariad \
1199
+ --history-action "<commit/history action taken or proposed>" \
1200
+ --roadmap-update "<roadmap/story package update>" \
1201
+ --next-recommendation "<next Pull, parent collapse, or release boundary>"
1202
+ ```
1203
+
1204
+ Render the deterministic `DONE_CHECKPOINT` surface. Done must name the history
1205
+ action, roadmap/story package update, and next Ariad movement. Do not push or
1206
+ release unless the effective policy explicitly allows it.