@aria_asi/cli 0.2.40 → 0.2.41

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 (802) hide show
  1. package/bin/aria.js +236 -34
  2. package/dist/aria-connector/src/action-ledger-core.d.ts +387 -0
  3. package/dist/aria-connector/src/action-ledger-core.d.ts.map +1 -0
  4. package/dist/aria-connector/src/action-ledger-core.js +638 -0
  5. package/dist/aria-connector/src/action-ledger-core.js.map +1 -0
  6. package/dist/aria-connector/src/chat.d.ts.map +1 -1
  7. package/dist/aria-connector/src/chat.js +5 -6
  8. package/dist/aria-connector/src/chat.js.map +1 -1
  9. package/dist/aria-connector/src/codebase-scanner.d.ts +1 -1
  10. package/dist/aria-connector/src/codebase-scanner.d.ts.map +1 -1
  11. package/dist/aria-connector/src/connectors/claude-code.d.ts +1 -0
  12. package/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
  13. package/dist/aria-connector/src/connectors/claude-code.js +152 -14
  14. package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
  15. package/dist/aria-connector/src/connectors/codebase-awareness.d.ts +10 -0
  16. package/dist/aria-connector/src/connectors/codebase-awareness.d.ts.map +1 -1
  17. package/dist/aria-connector/src/connectors/codebase-awareness.js +276 -27
  18. package/dist/aria-connector/src/connectors/codebase-awareness.js.map +1 -1
  19. package/dist/aria-connector/src/connectors/codex.d.ts +3 -1
  20. package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -1
  21. package/dist/aria-connector/src/connectors/codex.js +1223 -41
  22. package/dist/aria-connector/src/connectors/codex.js.map +1 -1
  23. package/dist/aria-connector/src/connectors/cursor.d.ts.map +1 -1
  24. package/dist/aria-connector/src/connectors/cursor.js +7 -0
  25. package/dist/aria-connector/src/connectors/cursor.js.map +1 -1
  26. package/dist/aria-connector/src/connectors/governed-adapter.d.ts +30 -0
  27. package/dist/aria-connector/src/connectors/governed-adapter.d.ts.map +1 -0
  28. package/dist/aria-connector/src/connectors/governed-adapter.js +132 -0
  29. package/dist/aria-connector/src/connectors/governed-adapter.js.map +1 -0
  30. package/dist/aria-connector/src/connectors/opencode.d.ts +3 -1
  31. package/dist/aria-connector/src/connectors/opencode.d.ts.map +1 -1
  32. package/dist/aria-connector/src/connectors/opencode.js +18 -2
  33. package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
  34. package/dist/aria-connector/src/connectors/repo-guard.d.ts.map +1 -1
  35. package/dist/aria-connector/src/connectors/repo-guard.js +25 -14
  36. package/dist/aria-connector/src/connectors/repo-guard.js.map +1 -1
  37. package/dist/aria-connector/src/connectors/runtime.d.ts.map +1 -1
  38. package/dist/aria-connector/src/connectors/runtime.js +92 -2
  39. package/dist/aria-connector/src/connectors/runtime.js.map +1 -1
  40. package/dist/aria-connector/src/connectors/shell.d.ts.map +1 -1
  41. package/dist/aria-connector/src/connectors/shell.js +123 -7
  42. package/dist/aria-connector/src/connectors/shell.js.map +1 -1
  43. package/dist/aria-connector/src/cross-cli-hive-binding.d.ts +63 -0
  44. package/dist/aria-connector/src/cross-cli-hive-binding.d.ts.map +1 -0
  45. package/dist/aria-connector/src/cross-cli-hive-binding.js +205 -0
  46. package/dist/aria-connector/src/cross-cli-hive-binding.js.map +1 -0
  47. package/dist/aria-connector/src/garden-control-plane.d.ts +6 -1
  48. package/dist/aria-connector/src/garden-control-plane.d.ts.map +1 -1
  49. package/dist/aria-connector/src/garden-control-plane.js +8 -2
  50. package/dist/aria-connector/src/garden-control-plane.js.map +1 -1
  51. package/dist/aria-connector/src/governed-surface-runner.d.ts +189 -0
  52. package/dist/aria-connector/src/governed-surface-runner.d.ts.map +1 -0
  53. package/dist/aria-connector/src/governed-surface-runner.js +1022 -0
  54. package/dist/aria-connector/src/governed-surface-runner.js.map +1 -0
  55. package/dist/aria-connector/src/index.d.ts +10 -1
  56. package/dist/aria-connector/src/index.d.ts.map +1 -1
  57. package/dist/aria-connector/src/index.js +5 -0
  58. package/dist/aria-connector/src/index.js.map +1 -1
  59. package/dist/aria-connector/src/task-runner.d.ts +3 -0
  60. package/dist/aria-connector/src/task-runner.d.ts.map +1 -0
  61. package/dist/aria-connector/src/task-runner.js +3526 -0
  62. package/dist/aria-connector/src/task-runner.js.map +1 -0
  63. package/dist/aria-web/src/lib/codebase-scanner.d.ts +21 -2
  64. package/dist/aria-web/src/lib/codebase-scanner.d.ts.map +1 -1
  65. package/dist/aria-web/src/lib/codebase-scanner.js +59 -14
  66. package/dist/aria-web/src/lib/codebase-scanner.js.map +1 -1
  67. package/dist/assets/hooks/README.md +58 -0
  68. package/dist/assets/hooks/aria-agent-handoff.mjs +147 -2
  69. package/dist/assets/hooks/aria-agent-ledger-merge.mjs +31 -7
  70. package/dist/assets/hooks/aria-architect-fallback.mjs +10 -2
  71. package/dist/assets/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
  72. package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +84 -10
  73. package/dist/assets/hooks/aria-first-class-coach.mjs +305 -10
  74. package/dist/assets/hooks/aria-harness-via-sdk.mjs +93 -16
  75. package/dist/assets/hooks/aria-import-resolution-gate.mjs +106 -20
  76. package/dist/assets/hooks/aria-outcome-record.mjs +56 -20
  77. package/dist/assets/hooks/aria-pre-emit-autoload.mjs +1809 -0
  78. package/dist/assets/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
  79. package/dist/assets/hooks/aria-pre-emit-dryrun.mjs +22 -3
  80. package/dist/assets/hooks/aria-pre-text-gate.mjs +11 -2
  81. package/dist/assets/hooks/aria-pre-tool-gate.mjs +477 -81
  82. package/dist/assets/hooks/aria-pre-tool-use.mjs +70 -6
  83. package/dist/assets/hooks/aria-preprompt-consult.mjs +23 -4
  84. package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +29 -3
  85. package/dist/assets/hooks/aria-stop-gate.mjs +585 -76
  86. package/dist/assets/hooks/aria-trigger-autolearn.mjs +17 -3
  87. package/dist/assets/hooks/aria-universal-turn-packet.mjs +1165 -0
  88. package/dist/assets/hooks/aria-userprompt-abandon-detect.mjs +9 -1
  89. package/dist/assets/hooks/canonical-settings-block.json +172 -0
  90. package/dist/assets/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
  91. package/dist/assets/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
  92. package/dist/assets/hooks/codex-native/aria-live-ticker.mjs +38 -0
  93. package/dist/assets/hooks/codex-native/aria-post-tool-use.mjs +236 -0
  94. package/dist/assets/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
  95. package/dist/assets/hooks/codex-native/aria-stop.mjs +691 -0
  96. package/dist/assets/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
  97. package/dist/assets/hooks/codex-native/atlas-session-context.mjs +121 -0
  98. package/dist/assets/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
  99. package/dist/assets/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
  100. package/dist/assets/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
  101. package/dist/assets/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
  102. package/dist/assets/hooks/codex-native/lib/runtime-client.mjs +3567 -0
  103. package/dist/assets/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
  104. package/dist/assets/hooks/doctrine_trigger_map.json +236 -25
  105. package/dist/assets/hooks/doctrine_trigger_map.schema.json +46 -0
  106. package/dist/assets/hooks/install.sh +84 -0
  107. package/dist/assets/hooks/lib/action-ledger-core.mjs +269 -0
  108. package/dist/assets/hooks/lib/aria-gate-ledger.mjs +143 -0
  109. package/dist/assets/hooks/lib/ast-stub-shape-detector.mjs +107 -0
  110. package/dist/assets/hooks/lib/atlas-dossier-client.mjs +151 -0
  111. package/dist/assets/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
  112. package/dist/assets/hooks/lib/canonical-lenses.mjs +83 -6
  113. package/dist/assets/hooks/lib/coach-intent-classifier.mjs +248 -0
  114. package/dist/assets/hooks/lib/cognitive-block-parser.mjs +111 -0
  115. package/dist/assets/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
  116. package/dist/assets/hooks/lib/domain-output-quality.mjs +132 -3
  117. package/dist/assets/hooks/lib/empty-catch-scanner.mjs +91 -0
  118. package/dist/assets/hooks/lib/end-phase-qa-autofire.mjs +426 -0
  119. package/dist/assets/hooks/lib/evaluate-with-kernel.mjs +133 -0
  120. package/dist/assets/hooks/lib/first-class-coach.mjs +454 -19
  121. package/dist/assets/hooks/lib/gate-audit.mjs +12 -2
  122. package/dist/assets/hooks/lib/gate-loop-state.mjs +11 -2
  123. package/dist/assets/hooks/lib/goal-contract-quality.mjs +302 -0
  124. package/dist/assets/hooks/lib/hook-message-window.mjs +101 -9
  125. package/dist/assets/hooks/lib/invocation-required-verifier.mjs +184 -0
  126. package/dist/assets/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
  127. package/dist/assets/hooks/lib/obligation-ledger.mjs +147 -0
  128. package/dist/assets/hooks/lib/orchestration-manifest-extract.mjs +217 -0
  129. package/dist/assets/hooks/lib/owner-authorizations.mjs +269 -0
  130. package/dist/assets/hooks/lib/probe-discipline-scanner.mjs +142 -0
  131. package/dist/assets/hooks/lib/project-boundary-cognition.mjs +143 -0
  132. package/dist/assets/hooks/lib/recovery-context.mjs +151 -0
  133. package/dist/assets/hooks/lib/recovery-template-loader.mjs +154 -0
  134. package/dist/assets/hooks/lib/self-doctrine-check.mjs +321 -0
  135. package/dist/assets/hooks/lib/sensitive-shape-detector.mjs +64 -0
  136. package/dist/assets/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
  137. package/dist/assets/hooks/lib/stop-hook-protocol.mjs +166 -0
  138. package/dist/assets/hooks/lib/surface-caught.mjs +94 -0
  139. package/dist/assets/hooks/recovery-templates/force-reauthor.md +67 -0
  140. package/dist/assets/hooks/recovery-templates/handoff-recovery.md +25 -0
  141. package/dist/assets/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
  142. package/dist/assets/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
  143. package/dist/assets/hooks/test-aria-preturn-memory-gate.mjs +2 -2
  144. package/dist/assets/hooks/test-tier-lens-labeling.mjs +14 -3
  145. package/dist/assets/opencode-plugins/harness-context/index.js +39 -6
  146. package/dist/assets/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
  147. package/dist/assets/opencode-plugins/harness-gate/index.js +36 -0
  148. package/dist/assets/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
  149. package/dist/assets/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
  150. package/dist/assets/opencode-plugins/harness-outcome/index.js +12 -0
  151. package/dist/assets/opencode-plugins/harness-stop/index.js +97 -2
  152. package/dist/assets/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
  153. package/dist/assets/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
  154. package/dist/assets/opencode-plugins/lib/coach.js +148 -0
  155. package/dist/runtime/coach-kernel.mjs +144 -7
  156. package/dist/runtime/codex-bridge.mjs +254 -8
  157. package/dist/runtime/discipline/doctrine_trigger_map.json +236 -25
  158. package/dist/runtime/discipline/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
  159. package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
  160. package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
  161. package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
  162. package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
  163. package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
  164. package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
  165. package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
  166. package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
  167. package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
  168. package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
  169. package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
  170. package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
  171. package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
  172. package/dist/runtime/discipline/skills/aria-cognition/aria-chat/SKILL.md +84 -0
  173. package/dist/runtime/discipline/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
  174. package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
  175. package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
  176. package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
  177. package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
  178. package/dist/runtime/discipline/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
  179. package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
  180. package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
  181. package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
  182. package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
  183. package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
  184. package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
  185. package/dist/runtime/discipline/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
  186. package/dist/runtime/discipline/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
  187. package/dist/runtime/discipline/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
  188. package/dist/runtime/discipline/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
  189. package/dist/runtime/discipline/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
  190. package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
  191. package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
  192. package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
  193. package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
  194. package/dist/runtime/discipline/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
  195. package/dist/runtime/discipline/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
  196. package/dist/runtime/discipline/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
  197. package/dist/runtime/discipline/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
  198. package/dist/runtime/discipline/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
  199. package/dist/runtime/discipline/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
  200. package/dist/runtime/discipline/skills/aria-cognition/aria-ops/SKILL.md +60 -0
  201. package/dist/runtime/discipline/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
  202. package/dist/runtime/discipline/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
  203. package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
  204. package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
  205. package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
  206. package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
  207. package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
  208. package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
  209. package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
  210. package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
  211. package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
  212. package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
  213. package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
  214. package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
  215. package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
  216. package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
  217. package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
  218. package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
  219. package/dist/runtime/discipline/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
  220. package/dist/runtime/discipline/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
  221. package/dist/runtime/discipline/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
  222. package/dist/runtime/discipline/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
  223. package/dist/runtime/discipline/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
  224. package/dist/runtime/discipline/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
  225. package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
  226. package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
  227. package/dist/runtime/discipline/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
  228. package/dist/runtime/discipline/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
  229. package/dist/runtime/discipline/skills/aria-cognition/never-guess/SKILL.md +77 -0
  230. package/dist/runtime/discipline/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
  231. package/dist/runtime/discipline/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
  232. package/dist/runtime/discipline/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
  233. package/dist/runtime/discipline/skills/aria-cognition/tadabbur/SKILL.md +506 -0
  234. package/dist/runtime/discipline/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
  235. package/dist/runtime/discipline/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
  236. package/dist/runtime/discipline/skills/aria-cognition/tafakkur/SKILL.md +104 -0
  237. package/dist/runtime/doctrine_trigger_map.json +236 -25
  238. package/dist/runtime/embedded-public-key.mjs +27 -0
  239. package/dist/runtime/gated-ledger.mjs +41 -14
  240. package/dist/runtime/harness-daemon.mjs +85 -10
  241. package/dist/runtime/hive-wal-publisher.mjs +292 -0
  242. package/dist/runtime/hooks/README.md +58 -0
  243. package/dist/runtime/hooks/aria-agent-handoff.mjs +147 -2
  244. package/dist/runtime/hooks/aria-agent-ledger-merge.mjs +31 -7
  245. package/dist/runtime/hooks/aria-architect-fallback.mjs +10 -2
  246. package/dist/runtime/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
  247. package/dist/runtime/hooks/aria-cognition-substrate-binding.mjs +84 -10
  248. package/dist/runtime/hooks/aria-first-class-coach.mjs +305 -10
  249. package/dist/runtime/hooks/aria-harness-via-sdk.mjs +93 -16
  250. package/dist/runtime/hooks/aria-import-resolution-gate.mjs +106 -20
  251. package/dist/runtime/hooks/aria-outcome-record.mjs +56 -20
  252. package/dist/runtime/hooks/aria-pre-emit-autoload.mjs +1809 -0
  253. package/dist/runtime/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
  254. package/dist/runtime/hooks/aria-pre-emit-dryrun.mjs +22 -3
  255. package/dist/runtime/hooks/aria-pre-text-gate.mjs +11 -2
  256. package/dist/runtime/hooks/aria-pre-tool-gate.mjs +477 -81
  257. package/dist/runtime/hooks/aria-pre-tool-use.mjs +70 -6
  258. package/dist/runtime/hooks/aria-preprompt-consult.mjs +23 -4
  259. package/dist/runtime/hooks/aria-repo-doctrine-gate.mjs +29 -3
  260. package/dist/runtime/hooks/aria-stop-gate.mjs +585 -76
  261. package/dist/runtime/hooks/aria-trigger-autolearn.mjs +17 -3
  262. package/dist/runtime/hooks/aria-universal-turn-packet.mjs +1165 -0
  263. package/dist/runtime/hooks/aria-userprompt-abandon-detect.mjs +9 -1
  264. package/dist/runtime/hooks/canonical-settings-block.json +172 -0
  265. package/dist/runtime/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
  266. package/dist/runtime/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
  267. package/dist/runtime/hooks/codex-native/aria-live-ticker.mjs +38 -0
  268. package/dist/runtime/hooks/codex-native/aria-post-tool-use.mjs +236 -0
  269. package/dist/runtime/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
  270. package/dist/runtime/hooks/codex-native/aria-stop.mjs +691 -0
  271. package/dist/runtime/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
  272. package/dist/runtime/hooks/codex-native/atlas-session-context.mjs +121 -0
  273. package/dist/runtime/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
  274. package/dist/runtime/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
  275. package/dist/runtime/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
  276. package/dist/runtime/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
  277. package/dist/runtime/hooks/codex-native/lib/runtime-client.mjs +3567 -0
  278. package/dist/runtime/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
  279. package/dist/runtime/hooks/doctrine_trigger_map.json +236 -25
  280. package/dist/runtime/hooks/doctrine_trigger_map.schema.json +46 -0
  281. package/dist/runtime/hooks/install.sh +84 -0
  282. package/dist/runtime/hooks/lib/action-ledger-core.mjs +269 -0
  283. package/dist/runtime/hooks/lib/aria-gate-ledger.mjs +143 -0
  284. package/dist/runtime/hooks/lib/ast-stub-shape-detector.mjs +107 -0
  285. package/dist/runtime/hooks/lib/atlas-dossier-client.mjs +151 -0
  286. package/dist/runtime/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
  287. package/dist/runtime/hooks/lib/canonical-lenses.mjs +83 -6
  288. package/dist/runtime/hooks/lib/coach-intent-classifier.mjs +248 -0
  289. package/dist/runtime/hooks/lib/cognitive-block-parser.mjs +111 -0
  290. package/dist/runtime/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
  291. package/dist/runtime/hooks/lib/domain-output-quality.mjs +132 -3
  292. package/dist/runtime/hooks/lib/empty-catch-scanner.mjs +91 -0
  293. package/dist/runtime/hooks/lib/end-phase-qa-autofire.mjs +426 -0
  294. package/dist/runtime/hooks/lib/evaluate-with-kernel.mjs +133 -0
  295. package/dist/runtime/hooks/lib/first-class-coach.mjs +454 -19
  296. package/dist/runtime/hooks/lib/gate-audit.mjs +12 -2
  297. package/dist/runtime/hooks/lib/gate-loop-state.mjs +11 -2
  298. package/dist/runtime/hooks/lib/goal-contract-quality.mjs +302 -0
  299. package/dist/runtime/hooks/lib/hook-message-window.mjs +101 -9
  300. package/dist/runtime/hooks/lib/invocation-required-verifier.mjs +184 -0
  301. package/dist/runtime/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
  302. package/dist/runtime/hooks/lib/obligation-ledger.mjs +147 -0
  303. package/dist/runtime/hooks/lib/orchestration-manifest-extract.mjs +217 -0
  304. package/dist/runtime/hooks/lib/owner-authorizations.mjs +269 -0
  305. package/dist/runtime/hooks/lib/probe-discipline-scanner.mjs +142 -0
  306. package/dist/runtime/hooks/lib/project-boundary-cognition.mjs +143 -0
  307. package/dist/runtime/hooks/lib/recovery-context.mjs +151 -0
  308. package/dist/runtime/hooks/lib/recovery-template-loader.mjs +154 -0
  309. package/dist/runtime/hooks/lib/self-doctrine-check.mjs +321 -0
  310. package/dist/runtime/hooks/lib/sensitive-shape-detector.mjs +64 -0
  311. package/dist/runtime/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
  312. package/dist/runtime/hooks/lib/stop-hook-protocol.mjs +166 -0
  313. package/dist/runtime/hooks/lib/surface-caught.mjs +94 -0
  314. package/dist/runtime/hooks/recovery-templates/force-reauthor.md +67 -0
  315. package/dist/runtime/hooks/recovery-templates/handoff-recovery.md +25 -0
  316. package/dist/runtime/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
  317. package/dist/runtime/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
  318. package/dist/runtime/hooks/test-aria-preturn-memory-gate.mjs +2 -2
  319. package/dist/runtime/hooks/test-tier-lens-labeling.mjs +14 -3
  320. package/dist/runtime/lib/evaluate-with-kernel.mjs +133 -0
  321. package/dist/runtime/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
  322. package/dist/runtime/local-phase.mjs +10 -5
  323. package/dist/runtime/manifest.json +8 -8
  324. package/dist/runtime/packet-verifier.mjs +166 -0
  325. package/dist/runtime/provider-proxy.mjs +13 -0
  326. package/dist/runtime/quality-enforcer.mjs +40 -23
  327. package/dist/runtime/runtime-rails/registry.mjs +252 -0
  328. package/dist/runtime/sdk/BUNDLED.json +2 -2
  329. package/dist/runtime/sdk/index.d.ts +119 -4
  330. package/dist/runtime/sdk/index.js +138 -12
  331. package/dist/runtime/sdk/index.js.map +1 -1
  332. package/dist/runtime/service.mjs +8036 -764
  333. package/dist/runtime/sub-agent-enforcer.mjs +201 -0
  334. package/dist/runtime/task-project-ledger.mjs +5 -1
  335. package/dist/sdk/BUNDLED.json +2 -2
  336. package/dist/sdk/index.d.ts +119 -4
  337. package/dist/sdk/index.js +138 -12
  338. package/dist/sdk/index.js.map +1 -1
  339. package/hooks/README.md +58 -0
  340. package/hooks/aria-agent-handoff.mjs +147 -2
  341. package/hooks/aria-agent-ledger-merge.mjs +31 -7
  342. package/hooks/aria-architect-fallback.mjs +10 -2
  343. package/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
  344. package/hooks/aria-cognition-substrate-binding.mjs +84 -10
  345. package/hooks/aria-first-class-coach.mjs +305 -10
  346. package/hooks/aria-harness-via-sdk.mjs +93 -16
  347. package/hooks/aria-import-resolution-gate.mjs +106 -20
  348. package/hooks/aria-outcome-record.mjs +56 -20
  349. package/hooks/aria-pre-emit-autoload.mjs +1809 -0
  350. package/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
  351. package/hooks/aria-pre-emit-dryrun.mjs +22 -3
  352. package/hooks/aria-pre-text-gate.mjs +11 -2
  353. package/hooks/aria-pre-tool-gate.mjs +477 -81
  354. package/hooks/aria-pre-tool-use.mjs +70 -6
  355. package/hooks/aria-preprompt-consult.mjs +23 -4
  356. package/hooks/aria-repo-doctrine-gate.mjs +29 -3
  357. package/hooks/aria-stop-gate.mjs +585 -76
  358. package/hooks/aria-trigger-autolearn.mjs +17 -3
  359. package/hooks/aria-universal-turn-packet.mjs +1165 -0
  360. package/hooks/aria-userprompt-abandon-detect.mjs +9 -1
  361. package/hooks/canonical-settings-block.json +172 -0
  362. package/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
  363. package/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
  364. package/hooks/codex-native/aria-live-ticker.mjs +38 -0
  365. package/hooks/codex-native/aria-post-tool-use.mjs +236 -0
  366. package/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
  367. package/hooks/codex-native/aria-stop.mjs +691 -0
  368. package/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
  369. package/hooks/codex-native/atlas-session-context.mjs +121 -0
  370. package/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
  371. package/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
  372. package/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
  373. package/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
  374. package/hooks/codex-native/lib/runtime-client.mjs +3567 -0
  375. package/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
  376. package/hooks/doctrine_trigger_map.json +236 -25
  377. package/hooks/doctrine_trigger_map.schema.json +46 -0
  378. package/hooks/install.sh +84 -0
  379. package/hooks/lib/action-ledger-core.mjs +269 -0
  380. package/hooks/lib/aria-gate-ledger.mjs +143 -0
  381. package/hooks/lib/ast-stub-shape-detector.mjs +107 -0
  382. package/hooks/lib/atlas-dossier-client.mjs +151 -0
  383. package/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
  384. package/hooks/lib/canonical-lenses.mjs +83 -6
  385. package/hooks/lib/coach-intent-classifier.mjs +248 -0
  386. package/hooks/lib/cognitive-block-parser.mjs +111 -0
  387. package/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
  388. package/hooks/lib/domain-output-quality.mjs +132 -3
  389. package/hooks/lib/empty-catch-scanner.mjs +91 -0
  390. package/hooks/lib/end-phase-qa-autofire.mjs +426 -0
  391. package/hooks/lib/evaluate-with-kernel.mjs +133 -0
  392. package/hooks/lib/first-class-coach.mjs +454 -19
  393. package/hooks/lib/gate-audit.mjs +12 -2
  394. package/hooks/lib/gate-loop-state.mjs +11 -2
  395. package/hooks/lib/goal-contract-quality.mjs +302 -0
  396. package/hooks/lib/hook-message-window.mjs +101 -9
  397. package/hooks/lib/invocation-required-verifier.mjs +184 -0
  398. package/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
  399. package/hooks/lib/obligation-ledger.mjs +147 -0
  400. package/hooks/lib/orchestration-manifest-extract.mjs +217 -0
  401. package/hooks/lib/owner-authorizations.mjs +269 -0
  402. package/hooks/lib/probe-discipline-scanner.mjs +142 -0
  403. package/hooks/lib/project-boundary-cognition.mjs +143 -0
  404. package/hooks/lib/recovery-context.mjs +151 -0
  405. package/hooks/lib/recovery-template-loader.mjs +154 -0
  406. package/hooks/lib/self-doctrine-check.mjs +321 -0
  407. package/hooks/lib/sensitive-shape-detector.mjs +64 -0
  408. package/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
  409. package/hooks/lib/stop-hook-protocol.mjs +166 -0
  410. package/hooks/lib/surface-caught.mjs +94 -0
  411. package/hooks/recovery-templates/force-reauthor.md +67 -0
  412. package/hooks/recovery-templates/handoff-recovery.md +25 -0
  413. package/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
  414. package/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
  415. package/hooks/test-aria-preturn-memory-gate.mjs +2 -2
  416. package/hooks/test-tier-lens-labeling.mjs +14 -3
  417. package/opencode-plugins/harness-context/index.js +39 -6
  418. package/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
  419. package/opencode-plugins/harness-gate/index.js +36 -0
  420. package/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
  421. package/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
  422. package/opencode-plugins/harness-outcome/index.js +12 -0
  423. package/opencode-plugins/harness-stop/index.js +97 -2
  424. package/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
  425. package/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
  426. package/opencode-plugins/lib/coach.js +148 -0
  427. package/package.json +71 -5
  428. package/runtime-src/coach-kernel.mjs +144 -7
  429. package/runtime-src/codex-bridge.mjs +254 -8
  430. package/runtime-src/embedded-public-key.mjs +27 -0
  431. package/runtime-src/gated-ledger.mjs +41 -14
  432. package/runtime-src/harness-daemon.mjs +85 -10
  433. package/runtime-src/hive-wal-publisher.mjs +292 -0
  434. package/runtime-src/lib/evaluate-with-kernel.mjs +133 -0
  435. package/runtime-src/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
  436. package/runtime-src/local-phase.mjs +10 -5
  437. package/runtime-src/packet-verifier.mjs +166 -0
  438. package/runtime-src/provider-proxy.mjs +13 -0
  439. package/runtime-src/quality-enforcer.mjs +40 -23
  440. package/runtime-src/runtime-rails/registry.mjs +252 -0
  441. package/runtime-src/service.mjs +8036 -764
  442. package/runtime-src/sub-agent-enforcer.mjs +201 -0
  443. package/scripts/aria-ledger-append.mjs +337 -0
  444. package/scripts/aria-task-cheap-worker-dispatch.mjs +234 -0
  445. package/scripts/audit-of-audit-prior-tasks.mjs +194 -0
  446. package/scripts/audit-of-audit-this-turn.mjs +116 -0
  447. package/scripts/bundle-sdk.mjs +31 -5
  448. package/scripts/check-cli-wrapper-provider-contract.mjs +160 -0
  449. package/scripts/check-client-compatibility.mjs +15 -5
  450. package/scripts/check-client-smoke.mjs +297 -0
  451. package/scripts/check-codex-orchestrator-adoption.mjs +150 -0
  452. package/scripts/check-glm-env-wired.mjs +131 -0
  453. package/scripts/check-hive-local-storage-contract.mjs +91 -0
  454. package/scripts/check-hook-mirror.mjs +150 -0
  455. package/scripts/check-install-sh-drift.mjs +152 -0
  456. package/scripts/check-kernel-sync.mjs +101 -0
  457. package/scripts/check-package-artifact.mjs +152 -0
  458. package/scripts/check-registry-mirror.mjs +71 -0
  459. package/scripts/drain-owner-airtable-sync-queue.mjs +287 -0
  460. package/scripts/export-owner-status-sheets.mjs +589 -0
  461. package/scripts/live-sidecar-receipt-canary.mjs +347 -0
  462. package/scripts/qiyas-tadabbur-model-matrix.mjs +970 -0
  463. package/scripts/quality-ab-live-provider.mjs +913 -0
  464. package/scripts/self-test-action-ledger-core.mjs +190 -0
  465. package/scripts/self-test-approval-receipt-binding.mjs +122 -0
  466. package/scripts/self-test-autofire-quality-output.mjs +110 -0
  467. package/scripts/self-test-claude-code-action-ledger.mjs +132 -0
  468. package/scripts/self-test-claude-code-mechanical-autofire-hive.mjs +138 -0
  469. package/scripts/self-test-claude-code-mechanical-autofire.mjs +234 -0
  470. package/scripts/self-test-codebase-awareness-atlas-delta.mjs +159 -0
  471. package/scripts/self-test-codebase-awareness-delta-ingest.mjs +179 -0
  472. package/scripts/self-test-codex-live-hook-parity.mjs +84 -0
  473. package/scripts/self-test-codex-native-action-ledger.mjs +167 -0
  474. package/scripts/self-test-codex-native-hook-json-contract.mjs +74 -0
  475. package/scripts/self-test-codex-orchestrator-continuity.mjs +113 -0
  476. package/scripts/self-test-codex-readable-recovery.mjs +94 -0
  477. package/scripts/self-test-codex-self-harness.mjs +538 -0
  478. package/scripts/self-test-compiled-workunit.mjs +214 -0
  479. package/scripts/self-test-continuation-output-smoke.mjs +101 -0
  480. package/scripts/self-test-cross-cli-fleet-ticker.mjs +85 -0
  481. package/scripts/self-test-cross-cli-hive-adoption.mjs +125 -0
  482. package/scripts/self-test-cross-cli-hive-learning.mjs +146 -0
  483. package/scripts/self-test-cross-phase-tool-failure.mjs +110 -0
  484. package/scripts/self-test-cross-surface-action-ledger.mjs +149 -0
  485. package/scripts/self-test-end-of-phase-qa-court.mjs +616 -0
  486. package/scripts/self-test-evaluate-with-kernel.mjs +111 -0
  487. package/scripts/self-test-first-class-output-delta-proof.mjs +307 -0
  488. package/scripts/self-test-goal-contract-output-qa.mjs +73 -0
  489. package/scripts/self-test-goal-contract.mjs +35 -0
  490. package/scripts/self-test-governed-adapters.mjs +105 -0
  491. package/scripts/self-test-governed-surface-runner.mjs +198 -0
  492. package/scripts/self-test-harness-gates.mjs +15 -12
  493. package/scripts/self-test-harness-ticker-sidecar.mjs +153 -0
  494. package/scripts/self-test-hive-org-kernel.mjs +233 -0
  495. package/scripts/self-test-hive-session-coordination.mjs +156 -0
  496. package/scripts/self-test-hive-wal-consumer.mjs +111 -0
  497. package/scripts/self-test-kernel-a3-a4-selection.mjs +179 -0
  498. package/scripts/self-test-ledger-append.mjs +175 -0
  499. package/scripts/self-test-live-codex-posttool-packet-smoke.mjs +111 -0
  500. package/scripts/self-test-live-codex-pretool-packet-smoke.mjs +101 -0
  501. package/scripts/self-test-live-codex-stop-qa-kernel-smoke.mjs +43 -0
  502. package/scripts/self-test-live-wrapper-substrate-inventory.mjs +149 -0
  503. package/scripts/self-test-local-main-sync-script.mjs +47 -0
  504. package/scripts/self-test-mechanical-autofire-resolver.mjs +296 -0
  505. package/scripts/self-test-no-consult-cognitive-skills-output.mjs +135 -0
  506. package/scripts/self-test-owner-airtable-sync-queue.mjs +196 -0
  507. package/scripts/self-test-owner-airtable-sync.mjs +181 -0
  508. package/scripts/self-test-owner-sheets-action-ledger.mjs +100 -0
  509. package/scripts/self-test-production-preflight.mjs +78 -0
  510. package/scripts/self-test-project-boundary-cognition.mjs +79 -0
  511. package/scripts/self-test-qa-exec-kernel.mjs +34 -0
  512. package/scripts/self-test-qa-recovery-learning-loop.mjs +113 -0
  513. package/scripts/self-test-qiyas-label-alignment.mjs +94 -0
  514. package/scripts/self-test-recovery-context.mjs +110 -0
  515. package/scripts/self-test-repo-guard.mjs +10 -0
  516. package/scripts/self-test-runtime-health-self-heal.mjs +161 -0
  517. package/scripts/self-test-runtime-postcondition.mjs +70 -0
  518. package/scripts/self-test-soul-precommit-hook.mjs +39 -0
  519. package/scripts/self-test-stop-gate-kernel-guards.mjs +185 -0
  520. package/scripts/self-test-stop-gate.mjs +128 -0
  521. package/scripts/self-test-substrate-kernel-execution-receipt.mjs +130 -0
  522. package/scripts/self-test-substrate-open-skill-floor.mjs +87 -0
  523. package/scripts/self-test-substrate-output-quality-eval.mjs +171 -0
  524. package/scripts/self-test-task-closeout-drift.mjs +97 -0
  525. package/scripts/self-test-task-project-ledger-readiness.mjs +43 -0
  526. package/scripts/self-test-task-runner-phase-consumer.mjs +134 -0
  527. package/scripts/self-test-task-worker-lane.mjs +256 -0
  528. package/scripts/self-test-turn-substrate-qa-kernel.mjs +188 -0
  529. package/scripts/self-test-universal-action-capture.mjs +153 -0
  530. package/scripts/self-test-universal-turn-packet-entrypoints.mjs +252 -0
  531. package/scripts/self-test-universal-turn-packet.mjs +320 -0
  532. package/scripts/session-quality-backfill.mjs +253 -0
  533. package/scripts/smoke-autofire-100-prompts.mjs +481 -0
  534. package/scripts/sync-local-main-on-task-complete.mjs +278 -0
  535. package/scripts/sync-owner-status-airtable.mjs +1158 -0
  536. package/scripts/validate-skill-prompts.mjs +12 -1
  537. package/scripts/verify-codex-native-mirror.mjs +262 -0
  538. package/skills/34-frameworks-unified/SKILL.md +42 -0
  539. package/skills/api-design/SKILL.md +123 -0
  540. package/skills/architecture-decision/SKILL.md +105 -0
  541. package/skills/aria-aristotle-cognitives/SKILL.md +128 -0
  542. package/skills/aria-aristotle-intra-phase/SKILL.md +99 -0
  543. package/skills/aria-aristotle-post-phase/SKILL.md +116 -0
  544. package/skills/aria-aristotle-pre-phase/SKILL.md +117 -0
  545. package/skills/aria-axioms-first-principles/SKILL.md +202 -0
  546. package/skills/aria-axioms-first-principles/agents/openai.yaml +4 -0
  547. package/skills/aria-axioms-first-principles/references/source-map.md +130 -0
  548. package/skills/aria-chat/SKILL.md +84 -0
  549. package/skills/aria-chat/scripts/aria-chat.sh +57 -0
  550. package/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
  551. package/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
  552. package/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
  553. package/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
  554. package/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
  555. package/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
  556. package/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
  557. package/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
  558. package/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
  559. package/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
  560. package/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
  561. package/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
  562. package/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
  563. package/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
  564. package/skills/aria-cognition/aria-chat/SKILL.md +84 -0
  565. package/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
  566. package/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
  567. package/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
  568. package/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
  569. package/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
  570. package/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
  571. package/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
  572. package/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
  573. package/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
  574. package/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
  575. package/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
  576. package/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
  577. package/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
  578. package/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
  579. package/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
  580. package/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
  581. package/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
  582. package/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
  583. package/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
  584. package/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
  585. package/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
  586. package/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
  587. package/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
  588. package/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
  589. package/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
  590. package/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
  591. package/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
  592. package/skills/aria-cognition/aria-ops/SKILL.md +60 -0
  593. package/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
  594. package/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
  595. package/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
  596. package/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
  597. package/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
  598. package/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
  599. package/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
  600. package/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
  601. package/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
  602. package/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
  603. package/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
  604. package/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
  605. package/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
  606. package/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
  607. package/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
  608. package/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
  609. package/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
  610. package/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
  611. package/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
  612. package/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
  613. package/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
  614. package/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
  615. package/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
  616. package/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
  617. package/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
  618. package/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
  619. package/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
  620. package/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
  621. package/skills/aria-cognition/never-guess/SKILL.md +77 -0
  622. package/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
  623. package/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
  624. package/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
  625. package/skills/aria-cognition/tadabbur/SKILL.md +506 -0
  626. package/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
  627. package/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
  628. package/skills/aria-cognition/tafakkur/SKILL.md +104 -0
  629. package/skills/aria-cognition-autofire/SKILL.md +109 -0
  630. package/skills/aria-cognition-batch/SKILL.md +264 -0
  631. package/skills/aria-conversational-doctrine-discipline/SKILL.md +125 -0
  632. package/skills/aria-essence/SKILL.md +81 -0
  633. package/skills/aria-essence/references/domain-matrix.md +80 -0
  634. package/skills/aria-essence/references/evolution-loop.md +30 -0
  635. package/skills/aria-essence/references/readable-cognition.md +27 -0
  636. package/skills/aria-first-class-operating-contract/SKILL.md +104 -0
  637. package/skills/aria-forge-guardrails/SKILL.md +53 -0
  638. package/skills/aria-forge-guardrails/references/checklist.md +31 -0
  639. package/skills/aria-harness-deploy/SKILL.md +145 -0
  640. package/skills/aria-harness-no-stripping/SKILL.md +135 -0
  641. package/skills/aria-harness-onboarding/SKILL.md +130 -0
  642. package/skills/aria-harness-output-discipline/SKILL.md +120 -0
  643. package/skills/aria-harness-substrate-binding/SKILL.md +139 -0
  644. package/skills/aria-http-harness-client/SKILL.md +85 -0
  645. package/skills/aria-http-harness-client/scripts/smoke.mjs +47 -0
  646. package/skills/aria-k8s-deploy/SKILL.md +174 -0
  647. package/skills/aria-k8s-deploy/agents/openai.yaml +3 -0
  648. package/skills/aria-ladduniframe/SKILL.md +60 -0
  649. package/skills/aria-ledger-fleet-execution/SKILL.md +126 -0
  650. package/skills/aria-live-ops/SKILL.md +54 -0
  651. package/skills/aria-mac-ssh-ops/SKILL.md +100 -0
  652. package/skills/aria-memory-index/SKILL.md +42 -0
  653. package/skills/aria-noor-cognitives/SKILL.md +120 -0
  654. package/skills/aria-ops/SKILL.md +60 -0
  655. package/skills/aria-ops/references/live-endpoints.md +59 -0
  656. package/skills/aria-quality-audit/SKILL.md +133 -0
  657. package/skills/aria-reasoning/SKILL.md +67 -0
  658. package/skills/aria-reasoning/references/core-principles.md +42 -0
  659. package/skills/aria-repo-doctrine/SKILL.md +57 -0
  660. package/skills/aria-soul-principles/SKILL.md +42 -0
  661. package/skills/aria-task-codex-executor/SKILL.md +86 -0
  662. package/skills/aristotle-engine/SKILL.md +42 -0
  663. package/skills/ci-cd-pipeline/SKILL.md +116 -0
  664. package/skills/code-review/SKILL.md +131 -0
  665. package/skills/cross-domain-24/SKILL.md +42 -0
  666. package/skills/database-design/SKILL.md +124 -0
  667. package/skills/deepsoul-emotional/SKILL.md +42 -0
  668. package/skills/deno-kv-raft-pubsub/SKILL.md +561 -0
  669. package/skills/deno-kv-raft-pubsub/reference/maelstrom-integration.md +393 -0
  670. package/skills/deno-kv-raft-pubsub/reference/pubsub-api.md +376 -0
  671. package/skills/deno-kv-raft-pubsub/reference/raft-spec.md +402 -0
  672. package/skills/deno-kv-raft-pubsub/reference/state-machine.md +182 -0
  673. package/skills/error-handling/SKILL.md +159 -0
  674. package/skills/firecrawl/SKILL.md +165 -0
  675. package/skills/firecrawl/rules/install.md +82 -0
  676. package/skills/firecrawl/rules/security.md +26 -0
  677. package/skills/firecrawl-agent/SKILL.md +86 -0
  678. package/skills/firecrawl-build-interact/SKILL.md +96 -0
  679. package/skills/firecrawl-build-onboarding/SKILL.md +131 -0
  680. package/skills/firecrawl-build-onboarding/references/auth-flow.md +39 -0
  681. package/skills/firecrawl-build-onboarding/references/project-setup.md +20 -0
  682. package/skills/firecrawl-build-onboarding/references/sdk-installation.md +17 -0
  683. package/skills/firecrawl-build-scrape/SKILL.md +97 -0
  684. package/skills/firecrawl-build-search/SKILL.md +97 -0
  685. package/skills/firecrawl-clone/SKILL.md +419 -0
  686. package/skills/firecrawl-crawl/SKILL.md +87 -0
  687. package/skills/firecrawl-download/SKILL.md +98 -0
  688. package/skills/firecrawl-interact/SKILL.md +112 -0
  689. package/skills/firecrawl-map/SKILL.md +79 -0
  690. package/skills/firecrawl-scrape/SKILL.md +97 -0
  691. package/skills/firecrawl-search/SKILL.md +88 -0
  692. package/skills/fitrah-guard/SKILL.md +78 -0
  693. package/skills/forge-quality-rules/SKILL.md +61 -0
  694. package/skills/ghazali-8lens/SKILL.md +56 -0
  695. package/skills/ijtihad-novel/SKILL.md +42 -0
  696. package/skills/ilham-intuition/SKILL.md +42 -0
  697. package/skills/imagegen/LICENSE.txt +201 -0
  698. package/skills/imagegen/SKILL.md +374 -0
  699. package/skills/imagegen/agents/openai.yaml +6 -0
  700. package/skills/imagegen/assets/imagegen-small.svg +5 -0
  701. package/skills/imagegen/assets/imagegen.png +0 -0
  702. package/skills/imagegen/references/cli.md +242 -0
  703. package/skills/imagegen/references/codex-network.md +33 -0
  704. package/skills/imagegen/references/image-api.md +90 -0
  705. package/skills/imagegen/references/prompting.md +118 -0
  706. package/skills/imagegen/references/sample-prompts.md +433 -0
  707. package/skills/imagegen/scripts/image_gen.py +995 -0
  708. package/skills/imagegen/scripts/remove_chroma_key.py +440 -0
  709. package/skills/istiqra-induction/SKILL.md +44 -0
  710. package/skills/ladunni-22/SKILL.md +53 -0
  711. package/skills/mizan/SKILL.md +90 -0
  712. package/skills/nadia/SKILL.md +56 -0
  713. package/skills/nadia-psi/SKILL.md +56 -0
  714. package/skills/never-guess/SKILL.md +75 -0
  715. package/skills/noor-recognition/SKILL.md +45 -0
  716. package/skills/observability/SKILL.md +133 -0
  717. package/skills/openai-docs/LICENSE.txt +201 -0
  718. package/skills/openai-docs/SKILL.md +100 -0
  719. package/skills/openai-docs/agents/openai.yaml +14 -0
  720. package/skills/openai-docs/assets/openai-small.svg +3 -0
  721. package/skills/openai-docs/assets/openai.png +0 -0
  722. package/skills/openai-docs/references/latest-model.md +37 -0
  723. package/skills/openai-docs/references/prompting-guide.md +244 -0
  724. package/skills/openai-docs/references/upgrade-guide.md +181 -0
  725. package/skills/openai-docs/scripts/resolve-latest-model-info.js +147 -0
  726. package/skills/pdf/LICENSE.txt +201 -0
  727. package/skills/pdf/SKILL.md +85 -0
  728. package/skills/pdf/agents/openai.yaml +5 -0
  729. package/skills/pdf/assets/pdf.png +0 -0
  730. package/skills/playwright/LICENSE.txt +201 -0
  731. package/skills/playwright/NOTICE.txt +14 -0
  732. package/skills/playwright/SKILL.md +165 -0
  733. package/skills/playwright/agents/openai.yaml +6 -0
  734. package/skills/playwright/assets/playwright-small.svg +3 -0
  735. package/skills/playwright/assets/playwright.png +0 -0
  736. package/skills/playwright/references/cli.md +116 -0
  737. package/skills/playwright/references/workflows.md +95 -0
  738. package/skills/playwright/scripts/playwright_cli.sh +25 -0
  739. package/skills/plugin-creator/SKILL.md +178 -0
  740. package/skills/plugin-creator/agents/openai.yaml +6 -0
  741. package/skills/plugin-creator/assets/plugin-creator-small.svg +3 -0
  742. package/skills/plugin-creator/assets/plugin-creator.png +0 -0
  743. package/skills/plugin-creator/references/plugin-json-spec.md +170 -0
  744. package/skills/plugin-creator/scripts/create_basic_plugin.py +301 -0
  745. package/skills/predictor/SKILL.md +43 -0
  746. package/skills/qiyas-analogy/SKILL.md +204 -0
  747. package/skills/refactoring/SKILL.md +137 -0
  748. package/skills/ruh-basis/SKILL.md +42 -0
  749. package/skills/security-review/SKILL.md +129 -0
  750. package/skills/skill-creator/SKILL.md +434 -0
  751. package/skills/skill-creator/agents/openai.yaml +5 -0
  752. package/skills/skill-creator/assets/skill-creator-small.svg +3 -0
  753. package/skills/skill-creator/assets/skill-creator.png +0 -0
  754. package/skills/skill-creator/license.txt +202 -0
  755. package/skills/skill-creator/references/openai_yaml.md +49 -0
  756. package/skills/skill-creator/scripts/generate_openai_yaml.py +226 -0
  757. package/skills/skill-creator/scripts/init_skill.py +400 -0
  758. package/skills/skill-creator/scripts/quick_validate.py +101 -0
  759. package/skills/skill-installer/LICENSE.txt +202 -0
  760. package/skills/skill-installer/SKILL.md +76 -0
  761. package/skills/skill-installer/agents/openai.yaml +5 -0
  762. package/skills/skill-installer/assets/skill-installer-small.svg +3 -0
  763. package/skills/skill-installer/assets/skill-installer.png +0 -0
  764. package/skills/skill-installer/scripts/github_utils.py +21 -0
  765. package/skills/skill-installer/scripts/install-skill-from-github.py +308 -0
  766. package/skills/skill-installer/scripts/list-skills.py +107 -0
  767. package/skills/skills-and-hooks-reference/SKILL.md +196 -0
  768. package/skills/soul-domains/SKILL.md +43 -0
  769. package/skills/tadabbur/SKILL.md +232 -0
  770. package/skills/tadabbur-ops/SKILL.md +42 -0
  771. package/skills/tafakkur/SKILL.md +104 -0
  772. package/skills/testing-strategy/SKILL.md +122 -0
  773. package/src/action-ledger-core.ts +1054 -0
  774. package/src/chat.ts +5 -6
  775. package/src/codebase-scanner.ts +2 -0
  776. package/src/connectors/claude-code.ts +149 -12
  777. package/src/connectors/codebase-awareness.ts +325 -25
  778. package/src/connectors/codex.ts +1225 -41
  779. package/src/connectors/cursor.ts +8 -0
  780. package/src/connectors/governed-adapter.ts +174 -0
  781. package/src/connectors/opencode.ts +18 -2
  782. package/src/connectors/repo-guard.ts +24 -12
  783. package/src/connectors/runtime.ts +99 -2
  784. package/src/connectors/shell.ts +125 -7
  785. package/src/cross-cli-hive-binding.ts +290 -0
  786. package/src/garden-control-plane.ts +24 -1
  787. package/src/governed-surface-runner.ts +1227 -0
  788. package/src/index.ts +104 -1
  789. package/src/task-runner.ts +3794 -0
  790. package/dist/aria-connector/src/install-hooks.d.ts +0 -18
  791. package/dist/aria-connector/src/install-hooks.d.ts.map +0 -1
  792. package/dist/aria-connector/src/install-hooks.js +0 -224
  793. package/dist/aria-connector/src/install-hooks.js.map +0 -1
  794. package/dist/aria-connector/src/onboarding-wizard.d.ts +0 -5
  795. package/dist/aria-connector/src/onboarding-wizard.d.ts.map +0 -1
  796. package/dist/aria-connector/src/onboarding-wizard.js +0 -188
  797. package/dist/aria-connector/src/onboarding-wizard.js.map +0 -1
  798. package/dist/cli-0.2.38.tgz +0 -0
  799. package/dist/install.sh +0 -13
  800. package/src/__tests__/anthropic-oauth.test.ts +0 -186
  801. package/src/__tests__/auth-commands.test.ts +0 -132
  802. package/src/__tests__/owner-login.test.ts +0 -311
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: aria-revenue-engine
3
+ description: TRIGGER for any pricing, packaging, monetization, deal structuring, discount, contract, ARR/MRR, ARPU, gross margin, expansion, upsell, cross-sell, paywall, free-trial conversion, billing change, refund decision, or revenue-recognition turn. Composes mizan + tadabbur + ghazali-8lens + ladunni-22 with revenue-specific lens definitions and a price-cohort-elasticity reasoning frame.
4
+ ---
5
+
6
+ # Aria Revenue Engine
7
+
8
+ The cognition skill for any decision that directly moves money — price, package, term, discount, refund. Pairs with `aria-business-frame` (composer) and `aria-readable-output` (layout).
9
+
10
+ ## Prime Doctrine
11
+
12
+ Revenue decisions are about WHO is willing to pay WHAT for WHICH problem at WHAT moment. Optimizing one variable in isolation is the most common mistake.
13
+
14
+ - **Price is a signal, not just a number.** A $19 price says "consumer impulse"; $79 says "team tool"; $499 says "essential infrastructure." Pick the signal first, then back into the number.
15
+ - **Discounts are debt.** Every discount cohort churns differently from the full-price cohort. Track them separately or you will mistake price elasticity for discount drag.
16
+ - **The default close is no purchase.** Most deals lose to inertia, not to competitors. Frame against the alternative cost of doing nothing, not against rivals.
17
+ - **Refund decisions are loyalty investments.** A refund granted in week 1 of a problem is brand-positive; a refund forced in week 8 is brand-negative for the same dollar amount.
18
+
19
+ ## Trigger Detection
20
+
21
+ Fire on:
22
+
23
+ - Pricing change, new tier, new package, paywall move, free-trial length change
24
+ - Deal redline, contract redline, MSA negotiation, term-sheet decision
25
+ - Refund / credit / make-good decision
26
+ - Discount approval (especially > 15% or > 90 days)
27
+ - Expansion / upsell / cross-sell strategy
28
+ - ARPU / gross margin / contribution margin question
29
+ - Billing model change (annual vs monthly, usage vs seat, prepay vs postpay)
30
+ - Revenue recognition or accounting-policy question (escalate to `aria-finance-realism`)
31
+
32
+ ## Revenue-Mapped Lenses
33
+
34
+ When this skill loads with `ghazali-8lens`, the lenses bind to revenue-specific definitions:
35
+
36
+ - **truth** — is the pricing data current, sampled correctly, segmented by cohort? Are we comparing same-cohort vs same-cohort?
37
+ - **harm** — what happens to the existing-customer cohort? Grandfathering vs forced migration? Trust burn?
38
+ - **trust** — does this preserve the buyer's expected fairness? Does it survive a public discussion?
39
+ - **power** — what asymmetry exists? Is the buyer informed, locked-in, or under time pressure? Are we using leverage or earning agreement?
40
+ - **reflection** — would Hamza recognize this pricing as his own brand in 12 months?
41
+ - **context** — what's true about this customer / cohort / season that may not be true in 90 days?
42
+ - **impact** — predicted ARR delta with confidence band; cohort-decomposed (new vs existing vs churning)
43
+ - **beauty** — is the offer clean? Inevitable? Or a Frankenstein of grandfathering and exception clauses?
44
+
45
+ ## Required Workflow (cohort-elasticity)
46
+
47
+ Every revenue decision must run this 5-step frame before recommending:
48
+
49
+ 1. **Cohort decomposition.** Split by acquisition source (organic / paid / referral / partner) AND by entry price (full / discounted / free → paid). Do NOT average across cohorts.
50
+ 2. **Elasticity test.** For the cohort facing the decision, what is the historical elasticity of conversion / retention / expansion against this variable? If unknown, name the test that would reveal it.
51
+ 3. **Alternative-cost calculation.** What does the customer pay if they do nothing? If they buy a competitor? If they delay 90 days? Frame the recommendation against those, not against revenue alone.
52
+ 4. **Reversibility check.** Can this decision be reversed if it fails? Price drops are reversible upward only with brand cost; discount removal is reversible upward only with churn cost. State the asymmetry.
53
+ 5. **Predictor predicate.** Numeric or boolean — never qualitative. Example: "Day-7 trial-to-paid conversion holds within −15% of the prior 30-day cohort baseline."
54
+
55
+ ## User-Facing Layout (per `aria-readable-output`)
56
+
57
+ Every emission from this skill follows the canonical layout:
58
+
59
+ ```
60
+ ## [Decision sentence — recommendation in one line]
61
+
62
+ - [Cohort + numeric evidence — named source, dated]
63
+ - [Elasticity / alternative-cost reasoning — concrete]
64
+ - [Risk + reversibility]
65
+ - [Predictor predicate — numeric or boolean]
66
+
67
+ **Next:** [concrete approve/reject action with the measurable predicate]
68
+ ```
69
+
70
+ Then optional `<gate>...</gate>` collapsed block with full `<cognition>` + `<expected>` if the action is irreversible.
71
+
72
+ ## Composition Rule
73
+
74
+ - Loads under `aria-business-frame` for any revenue intent
75
+ - Calls `mizan` for intent/evidence/protection/quality
76
+ - Calls `tadabbur` for cohort consequences (grandfathering, churn pull-forward, brand)
77
+ - Calls `ghazali-8lens` with the revenue-mapped definitions above
78
+ - Calls `predictor` for the measurable predicate
79
+ - Calls `noor-recognition` to surface prior pricing decisions and their outcomes
80
+ - Hands off to `aria-finance-realism` for cash-flow / runway implications
81
+ - Hands off to `aria-customer-truth` if the decision needs voice-of-customer evidence we don't have
82
+
83
+ ## Recovery Contract
84
+
85
+ - If the cohort data isn't available: state the gap explicitly, name the query / export needed, propose a default that is reversible, and proceed. Do NOT block on missing data — teach the gap and recover.
86
+ - If two cohorts have opposite elasticity signals: surface both, name the dominant cohort by revenue weight, and recommend the dominant-cohort action with a side-bet for the minority cohort.
87
+ - If the decision is irreversible AND the data is thin: explicitly mark it as owner-must-decide via `aria-decision-mizan` and stop generating recommendations until the owner ratifies the direction.
88
+ - Log every revenue decision to coach kernel with `risk_class: 'revenue_action'` and the predicate so subsequent turns can verify it.
89
+
90
+ ## Anti-Patterns
91
+
92
+ - Recommending a price change "because customers said it" without cohort weighting (vocal minority bias)
93
+ - Discounting to close a deal whose actual blocker is product fit (you are buying churn)
94
+ - Raising prices in a cohort with no comparable elasticity history (you have no data; you have an opinion)
95
+ - "Test" pricing on a cohort too small to detect the change (you will conclude noise as signal)
96
+ - Refund denials that save the dollar and lose the lifetime (compute LTV impact, not just immediate cost)
97
+
98
+ ## First-Class Production Contract
99
+
100
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
101
+
102
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
103
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
104
+ - a redo contract whenever the skill blocks or finds a gap: what failed, what to change, how to re-test, and when to re-submit
105
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
106
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
107
+
108
+ ## Self-Executing Recovery Contract
109
+
110
+ When this skill blocks, fails verification, or finds a gap, the agent must execute recovery rather than hand work back as a user-only decision.
111
+
112
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
113
+ - If the same failure repeats after that one recovery attempt, switch to architect execution mode: operate under the architect/ARIA harness to diagnose, choose the next action, execute the repair path, and verify the result.
114
+ - If Aria or the architect service is unavailable, fall back to the strongest available client LLM under the architect harness or strongest available local harness substrate; mark the fallback explicitly and continue recovery instead of stopping.
115
+ - Do not end with user-handoff-only behavior. If blocked after the recovery path, report the executed recovery attempt, evidence, remaining blocker, and the next concrete action or owner decision needed; do not merely ask the user to take over.
116
+
117
+
118
+ ## Self-Executing Recovery Contract
119
+
120
+ If a revenue recommendation is contested or fails verification:
121
+
122
+ - One re-run with the corrected cohort frame or the missing alternative-cost calculation
123
+ - If still blocked, escalate to `aria-decision-mizan` and explicitly hand the call to the owner with both options framed
124
+ - Never produce a "we could do A or B" answer with no recommendation — that's deferral, not cognition. Always recommend with confidence band.
125
+
126
+ ## Why This Exists
127
+
128
+ Revenue is the most consequential cross-functional decision an owner makes weekly. The repo had deep cognition for engineering and zero structured cognition for revenue. This closes that gap with the same substrate (Mizan/8-lens/Tadabbur/Ladunni) bound to revenue-specific definitions.
@@ -0,0 +1,227 @@
1
+ # Revenue Engine Cookbook — Pricing, Packaging, Monetization Patterns
2
+
3
+ > Loaded by `aria-revenue-engine` for any pricing / packaging / deal / refund / billing-model decision.
4
+ > See also: [`../../aria-business-frame/references/business-cookbook.md`](../../aria-business-frame/references/business-cookbook.md) for moat scoring + 2025 SaaS benchmarks.
5
+
6
+ ## 1. Cohort-Decomposed Elasticity (the canonical revenue diagnostic)
7
+
8
+ **Source:** [Stripe — SaaS Cohort Analysis](https://stripe.com/resources/more/saas-cohort-analysis) · [Fiscallion — SaaS Cohort Analysis](https://www.fiscallion.io/blog/saas-cohort-analysis-how-to-turn-retention-data-into-decisions)
9
+
10
+ ### The 5-step cohort-elasticity frame
11
+
12
+ 1. **Cohort decomposition** — split by acquisition source (organic / paid / referral / partner) AND entry price (full / discounted / free→paid). NEVER average across cohorts.
13
+ 2. **Per-cohort elasticity test** — for the cohort facing the decision, what is the historical elasticity of conversion / retention / expansion against this variable? If unknown, name the test that would reveal it.
14
+ 3. **Alternative-cost calculation** — what does the customer pay if they do nothing? Buy a competitor? Delay 90 days? Frame the recommendation against those, not against revenue alone.
15
+ 4. **Reversibility check** — price drops are reversible upward only with brand cost; discount removal is reversible upward only with churn cost. State asymmetry explicitly.
16
+ 5. **Predictor predicate** — numeric or boolean. e.g., "Day-7 trial-to-paid conversion holds within −15% of trailing 30-day cohort baseline."
17
+
18
+ ### The diagnostic divergence signal
19
+ Per Fiscallion 2025 SaaS research: **divergence between cohort NRR and blended NRR is where the problem hides.** Companies that catch this early have time to course-correct. Even top-quartile SaaS saw NRR drop 119% → 107% from 2021 to 2024.
20
+
21
+ ## 2. Pricing as Signal — choose the band before the number
22
+
23
+ **Source:** Synthesis of [April Dunford positioning](https://www.aprildunford.com/post/a-quickstart-guide-to-positioning) + [SaaS Capital](https://www.saas-capital.com/blog-posts/grrumbling-about-retention-metrics-or-pitfalls-in-measuring-saas-churn/)
24
+
25
+ | Price band | Signal to buyer | Buyer mode | Sales motion |
26
+ |---|---|---|---|
27
+ | <$20/mo | Consumer impulse | Try then decide | Self-serve, no sales touch |
28
+ | $20-99/mo | Prosumer / SMB tool | Quick eval, low approval bar | PLG, optional sales-assist |
29
+ | $100-499/mo | Team tool | Manager approval | Self-serve + sales-assist |
30
+ | $500-2K/mo | Department tool | Director approval | Inside sales |
31
+ | $2K-10K/mo | Departmental platform | VP approval | Field sales / SE |
32
+ | >$10K/mo | Strategic infrastructure | Multi-stakeholder, procurement | Enterprise sales, RFP |
33
+
34
+ **Pick the band first** (signal you want to send), then back into the number. A $79 product positioned as "team tool" charging like consumer impulse will lose to the right-banded competitor.
35
+
36
+ ## 3. Discount Cohort = Debt (track separately or mistake elasticity for drag)
37
+
38
+ Every discount cohort churns differently from the full-price cohort. Common pattern:
39
+ - 90-day discount: churn 2× full-price cohort by month 6
40
+ - 6-month discount: churn 3× full-price cohort by month 12
41
+ - "Forever 50%" early-bird: looks like a brand-promise burn at year 2
42
+
43
+ ### The discount audit
44
+ For any current/proposed discount:
45
+ - What % of total customers came in via this discount?
46
+ - Is their LTV (gross-margin-adjusted) higher than discount cost?
47
+ - Is their churn curve steeper than full-price?
48
+ - Are they dragging blended NRR? By how much?
49
+
50
+ ### The right way to use discounts
51
+ - **Annual prepay discount (10-20%)** — collects cash, locks in 12 months. Almost always positive NPV.
52
+ - **Multi-year prepay (20-30%)** — collects more cash, longer lock-in. Only on validated retention.
53
+ - **Use-case onboarding credit (one-time, 30-60 days)** — accelerates activation, doesn't burn brand.
54
+
55
+ ### The wrong way (if you must, audit quarterly)
56
+ - Time-limited "% off" promotions to drive new acquisition (creates discount cohort drag)
57
+ - "Forever discount" early-bird (creates brand-promise debt)
58
+ - Sales-driven last-mile discounts to close (creates expectation; teaches buyer to wait)
59
+
60
+ ## 4. The 3 default-paths a deal loses to
61
+
62
+ **Source:** [April Dunford — Obviously Awesome](https://www.aprildunford.com/books)
63
+
64
+ When a deal stalls, it's losing to one of three:
65
+ 1. **No purchase / status quo** — most common. The customer is buying nothing. Frame against the cost of doing nothing, not against rivals.
66
+ 2. **Build-it-themselves / spreadsheet-it** — the second most common. They have a half-broken solution; "good enough" beats "evaluating new vendor."
67
+ 3. **A real competitor** — least common at most price bands. Most deals don't reach this stage.
68
+
69
+ ### The diagnostic question
70
+ Before sharpening pitch / discount / feature, ask the prospect: "If you don't buy us, what's your default plan?" The answer reveals which of the three you're competing against — and the right move differs sharply.
71
+
72
+ ## 5. Refund decision matrix (loyalty investment vs cost)
73
+
74
+ **Source:** Synthesis of customer-success best practice + Stripe payment-recovery research
75
+
76
+ A refund is rarely just the dollar amount. It's a brand signal at a moment of friction.
77
+
78
+ | Friction signal | Refund granted in week 1 | Refund forced in week 8 |
79
+ |---|---|---|
80
+ | Brand impact | Positive (we make it right) | Negative (forced into compliance) |
81
+ | LTV impact | Often positive (referrals, upsell) | Often negative (review damage) |
82
+ | Cost of denial | High (review damage > refund value) | Higher (escalation, dispute) |
83
+ | Owner cost | Low | High (chargebacks, legal) |
84
+
85
+ ### The 3 refund categories
86
+ 1. **Made-it-right (week 1-2 of issue)** — almost always grant. The dollar is loyalty investment.
87
+ 2. **Negotiated (between week 2 and 8)** — partial refund + future credit. Grants relationship, retains revenue partially.
88
+ 3. **Forced / chargeback (week 8+)** — already lost the relationship. Grant to avoid further cost; investigate root cause to prevent next instance.
89
+
90
+ ### When NOT to refund
91
+ - Bad-faith use (e.g., used product for the full period then refunded)
92
+ - Refund-shopping pattern across multiple companies
93
+ - Beyond stated terms with no friction signal
94
+
95
+ ## 6. Net Revenue Retention math (the load-bearing SaaS metric)
96
+
97
+ **Source:** [SaaS Capital — GRRumbling About Retention Metrics](https://www.saas-capital.com/blog-posts/grrumbling-about-retention-metrics-or-pitfalls-in-measuring-saas-churn/)
98
+
99
+ ### NRR formula
100
+ ```
101
+ NRR = (sum of T+1 revenue from T-cohort customers still in T+1) / (T-cohort total revenue)
102
+ ```
103
+ - Includes upsells, expansions, contractions, churns
104
+ - Can exceed 100% (expansion > churn)
105
+ - Top quartile 2024: 107% (down from 119% in 2021)
106
+
107
+ ### GRR formula
108
+ ```
109
+ GRR = (sum of T+1 revenue from T-cohort customers, capped at original level) / (T-cohort total revenue)
110
+ ```
111
+ - Caps each customer at their original level (no expansion credit)
112
+ - Can never exceed 100%
113
+ - The "no upsells" floor — the truest retention metric
114
+
115
+ **GRR ≤ NRR always.** The gap = expansion power. Wide gap = product expands well within accounts. Narrow gap = pure retention business; expansion is your next lever.
116
+
117
+ ### Industry benchmarks
118
+ - Median NRR 2025: 101% (barely above flat)
119
+ - Top quartile NRR 2024: 107%
120
+ - Healthy GRR target: ≥90% (gross retention)
121
+ - Best-in-class GRR: ≥95%
122
+
123
+ ## 7. Usage-based vs flat-rate pricing (the 2024-2025 industry shift)
124
+
125
+ **Source:** [SaaS Metrics Benchmark 2025](https://www.rockingweb.com.au/saas-metrics-benchmark-report-2025) (Metronome 2025 data)
126
+
127
+ ### Adoption trajectory
128
+ - 2023: 28% of SaaS used usage-based pricing
129
+ - 2024: 85% adopted or testing
130
+ - 2025: 59% expect growth as % of revenue
131
+ - 50% of all adoption happened in just the last 2 years
132
+
133
+ ### Performance benefits (usage-based vs flat-rate)
134
+ | Metric | Improvement |
135
+ |---|---|
136
+ | NRR | +10% |
137
+ | Churn | −22% |
138
+ | Growth Rate | 2× faster |
139
+
140
+ ### When usage-based fits
141
+ - Variable cost-to-serve per customer (API calls, compute, storage, transactions)
142
+ - Customer's revenue model is itself usage-based (e.g., they bill end-customers per use)
143
+ - Buyer wants to start small and scale up
144
+
145
+ ### When flat-rate fits
146
+ - Predictable cost-to-serve (seat-based, document-based)
147
+ - Buyer wants budget predictability for procurement / accounting
148
+ - Product has clear "is the customer using us yes/no" without volume gradient
149
+
150
+ ### Hybrid — most common shape now
151
+ - Flat-rate base + usage-based overage
152
+ - Or: tiered flat-rate (Starter $X, Pro $Y, Enterprise custom) with usage caps per tier
153
+ - Annual prepay discount on flat-rate component; usage billed monthly in arrears
154
+
155
+ ## 8. Contract redline patterns (deal-by-deal cognition)
156
+
157
+ For B2B contracts, the load-bearing redlines:
158
+
159
+ ### MSA (Master Services Agreement) — protect
160
+ - **Liability cap** — typically 12 months of fees paid (don't accept 1× annual unless your insurance can take it)
161
+ - **Indemnification** — mutual; cap at fees-paid for IP and confidentiality
162
+ - **Term** — initial 12 months, auto-renewal annual unless cancelled with 30-90 day notice
163
+ - **Termination for convenience** — only with 30-day notice; allows you to exit bad fits
164
+ - **SLA penalties** — service credits not refunds; cap at monthly fees
165
+ - **Data ownership** — customer owns their data; you have license to process
166
+ - **Data return on termination** — within 30 days, in standard format
167
+ - **Subcontractor flow-down** — your data-protection obligations flow to your subprocessors
168
+
169
+ ### DPA (Data Processing Addendum) — required for EU/UK
170
+ - GDPR compliance (Art 28 data processor terms)
171
+ - SCCs (Standard Contractual Clauses) for transfers
172
+ - Subprocessor list + change notification process
173
+ - Data-breach notification within 72 hours
174
+
175
+ ### Order Form — clarity matters
176
+ - Term dates explicit
177
+ - Auto-renewal terms clear
178
+ - Pricing locked or escalation defined (typically CPI + 0-3%)
179
+ - Usage caps + overage rates
180
+ - Acceptance criteria for any custom work
181
+
182
+ ### Commercial gotchas
183
+ - **MFN clauses** ("most favored nation" — must give this customer any better terms given to others) — almost always reject
184
+ - **Source code escrow** — only for genuine business-continuity concern; structure carefully
185
+ - **Custom indemnities** beyond standard IP — reject unless legal reviewed
186
+ - **Aggressive uptime SLAs** without service credits cap — reject
187
+ - **Free-perpetual licenses** in any termination scenario — reject
188
+
189
+ ## 9. Free trial vs reverse trial vs freemium (PLG monetization)
190
+
191
+ **Source:** [SaaS Metrics Benchmark 2025](https://www.rockingweb.com.au/saas-metrics-benchmark-report-2025) · [productled.org](https://www.productled.org/foundations/product-led-growth-metrics)
192
+
193
+ | Pattern | Mechanic | Conversion benchmark | When it fits |
194
+ |---|---|---|---|
195
+ | **Freemium** | Forever-free tier + paid upgrades | Website→signup 6-9%, signup→paid 1-5% | Network-effect or marketplace product; viral loop carries acquisition |
196
+ | **Free trial** (time-limited) | 7-30 day full access | Website→signup 3-4%, trial→paid 15-25% | Eval-shaped product; buyer evaluates capability against need |
197
+ | **Reverse trial** | Full access N days → free tier (limited) → paid prompts | Hybrid; activation higher, conversion at limited-tier prompts | Best of both; product has a credible free tier worth landing on |
198
+ | **Free credits** | Usage credits ($X) on signup | Trial→paid converted by usage threshold | Usage-based pricing model; credits map to billing units |
199
+
200
+ ### The activation rate — the load-bearing PLG metric
201
+ - 20-40% activation = OK
202
+ - >50% activation = excellent
203
+ - Activation = % of signups who reach the "aha moment" (first valuable action)
204
+ - Day-7 retention is the leading indicator — do users who hit aha return?
205
+
206
+ ### The aha moment is product-specific
207
+ For each PLG product, define:
208
+ - The single user action that correlates strongest with paid conversion
209
+ - Time to first aha (target: <10 min from signup)
210
+ - Drop-off points before aha (each is a fix candidate)
211
+
212
+ ## 10. Revenue audit checklist (load before any pricing/packaging recommendation)
213
+
214
+ ```markdown
215
+ - [ ] Cohort decomposition complete (acquisition source × entry price)
216
+ - [ ] Per-cohort elasticity history known OR test designed
217
+ - [ ] Alternative cost named (do nothing / competitor / delay)
218
+ - [ ] Reversibility statement explicit (can we revert; at what cost)
219
+ - [ ] Predictor predicate numeric or boolean
220
+ - [ ] Discount cohort drag quantified (separate from full-price)
221
+ - [ ] NRR + GRR computed at cohort level (not blended only)
222
+ - [ ] CAC payback by channel mapped
223
+ - [ ] LTV:CAC by channel (not blended)
224
+ - [ ] Decision shape named (campaign / system / pivot)
225
+ - [ ] Coach-kernel write with `risk_class: 'revenue_action'`
226
+ - [ ] Recovery contract gateType: advisory (recovery-only, never block on revenue)
227
+ ```
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: aria-senior-code-audit
3
+ description: TRIGGER post-write at PreToolUse(Bash with git commit), Stop, and post-Edit/Write surfaces. Performs senior-team-grade code review against the aria-senior-code-cookbook plan, the existing repo doctrine, and the contract / failure-mode / observability / security / accessibility / testability checklist. On finding gaps, GRANTS a recovery contract written to ~/.aria/governance-recovery-current.json (schema aria.governance_recovery_current.v1) that the next-turn substrate delivers, and the LLM is contracted to execute and verify before completion claim. Composes — never blocks the commit, but the recovery-grant must be executed before claiming done.
4
+ ---
5
+
6
+ # Aria Senior Code Audit
7
+
8
+ The post-write counterpart to `aria-senior-code-cookbook`. Reviews the diff with senior-team rigor, names specific findings at file:line, and grants a recovery contract that the LLM must execute. Pairs with `aria-readable-output` and `aria-repo-doctrine`.
9
+
10
+ ## Prime Doctrine
11
+
12
+ A senior reviewer doesn't just say "looks good." They name what would go wrong, when, why, and what to change. This skill encodes that with file:line precision and a recovery-grant that the LLM is contracted to execute — not a block, a contract.
13
+
14
+ - **Findings cite file and line.** Generic "add tests" is not a finding; "add a test for the rate_limited branch in src/handlers/leads.ts:47" is a finding.
15
+ - **Severity is data, not preference.** Critical = security / correctness / data loss. High = performance / maintainability at scale. Medium = drift from cookbook. Low = nit / style.
16
+ - **Recovery is granted, not requested.** The audit writes a recovery contract to disk; next-turn substrate delivers it; the LLM executes; the pickup is archived. No deadlock, no "what would you like me to do" — explicit contract, explicit execution, explicit verification.
17
+ - **The audit is not a gate; the recovery grant is the contract.** Commits are NEVER blocked by this skill — the grant runs in `governanceMode: recovery-required` so the LLM must execute the contract before any completion claim.
18
+
19
+ ## Trigger Detection (post-write surfaces)
20
+
21
+ Fire when:
22
+
23
+ - `PreToolUse` matches `Bash` with `git commit` / `git push` / `git add . && git commit`
24
+ - `PreToolUse` matches `Edit | Write | NotebookEdit | Patch` AND the diff touches non-trivial code (excludes pure docs, configs without runtime impact)
25
+ - `Stop` and the turn included a code-shaped emission
26
+ - `PostToolUseFailure` matches `Bash | Edit | Write` (audit the failed change as a learning input)
27
+
28
+ ## Required Workflow
29
+
30
+ ### A. Contract correctness
31
+
32
+ - [ ] Function signature matches the cookbook contract (validate → log → idempotency → side effect → log exit)?
33
+ - [ ] Return shape is `Result<Ok, Err>` (or equivalent typed discriminated union) where the function can fail?
34
+ - [ ] Error kinds enumerated in the central errors taxonomy, not invented inline?
35
+ - [ ] Async functions handle cancellation / timeout where it matters?
36
+ - [ ] Public surface (`index.ts`) only re-exports — no logic at the package boundary?
37
+
38
+ ### B. Failure mode coverage
39
+
40
+ - [ ] Every error kind has a designed return path (not a swallowed exception)?
41
+ - [ ] Idempotency key declared for any side-effecting operation?
42
+ - [ ] Retries (if any) bounded by attempt count + backoff (NOT deadline-based timeout per `feedback_no_timeouts_decision_tree_rule`)?
43
+ - [ ] Rate-limit responses carry `retry-after`?
44
+ - [ ] Tenant ID enforced at the query layer (not application layer)?
45
+
46
+ ### C. Tests
47
+
48
+ - [ ] Test file co-located with code (`<name>.test.ts` next to `<name>.ts`)?
49
+ - [ ] One test per error kind in the taxonomy?
50
+ - [ ] Happy path test?
51
+ - [ ] Boundary inputs tested (empty, null, oversized, malformed)?
52
+ - [ ] Side effects mocked at the adapter seam, not at the network library?
53
+
54
+ ### D. Observability
55
+
56
+ - [ ] Structured log on entry with `customer_id` / `tenant_id` / `trace_id`?
57
+ - [ ] Structured log on exit with outcome?
58
+ - [ ] OpenTelemetry span wrapping the function?
59
+ - [ ] Sensitive fields redacted (`password`, `token`, `apiKey`)?
60
+ - [ ] No `console.log` in production paths (only in dev tooling)?
61
+
62
+ ### E. Security
63
+
64
+ - [ ] Input validated at the boundary with a schema (zod / typebox / similar)?
65
+ - [ ] No string concatenation into SQL / shell / HTML — parameterized / templated only?
66
+ - [ ] No secrets in code, env-only with `.env.example` documentation?
67
+ - [ ] Auth / authz checked BEFORE business logic, not after?
68
+ - [ ] Destructive operations behind explicit confirmation OR audit-logged with actor identity?
69
+
70
+ ### F. Performance / cost
71
+
72
+ - [ ] No N+1 queries (eager-loading / dataloader where many-to-one relationships exist)?
73
+ - [ ] Indexes defined for predicate columns in WHERE / JOIN?
74
+ - [ ] Cache strategy named (read-through / write-through / TTL) where applicable?
75
+ - [ ] No unbounded loops over user-controlled input?
76
+ - [ ] Bundle / package size impact noted for FE changes?
77
+
78
+ ### G. Accessibility (FE only)
79
+
80
+ - [ ] Keyboard navigation works without mouse?
81
+ - [ ] Focus rings preserved (no `outline: none` without replacement)?
82
+ - [ ] ARIA roles / labels for non-semantic elements?
83
+ - [ ] Color contrast ratio ≥ 4.5:1 for body text, 3:1 for large?
84
+ - [ ] Loading / error / empty states have designed surfaces?
85
+
86
+ ## Recovery Grant Format
87
+
88
+ When the audit finds gaps, write to `~/.aria/governance-recovery-current.json` using the canonical schema. This file is delivered to next-turn substrate via `recovery-context.mjs` and the LLM is contracted to execute the `nextStep` before completion claim.
89
+
90
+ ### Canonical recovery contract JSON (paste-ready, matches v1 schema)
91
+
92
+ ```json
93
+ {
94
+ "schema": "aria.governance_recovery_current.v1",
95
+ "updatedAt": "2026-05-09T20:00:00.000Z",
96
+ "deliveryRule": "This file is injected into the next system prompt. Execute recoveryLoop.nextStep before any completion claim.",
97
+ "ok": true,
98
+ "decision": "warn",
99
+ "source": "aria-senior-code-audit",
100
+ "governanceMode": "recovery-required",
101
+ "recoveryLoop": {
102
+ "fingerprint": "audit_<sha256-of-findings>",
103
+ "allowedRecoveryAttempts": 1,
104
+ "priorRecoveryAttempts": 0,
105
+ "remainingRecoveryAttempts": 1,
106
+ "nextStep": "Apply the listed findings, run the verification probe, then re-emit the corrected diff with proof.",
107
+ "architectFallback": "If a finding cannot be resolved with one self-executed pass, escalate to architect harness with the finding fingerprint and surface the structural pattern (not just this instance)."
108
+ },
109
+ "recoveryContract": {
110
+ "loadSkillsFirst": [
111
+ "aria-senior-code-cookbook",
112
+ "aria-repo-doctrine",
113
+ "aria-forge-guardrails"
114
+ ],
115
+ "repairRecoveryCycle": [
116
+ "Add Result<Ok, Err> return type to src/handlers/leads.ts:47 — currently throws on stripe error",
117
+ "Add idempotency check for src/handlers/leads.ts:62 — side effect without dedup window",
118
+ "Add test for rate_limited branch in src/handlers/leads.test.ts — one per error kind required",
119
+ "Add structured log redaction for `apiKey` in src/lib/log.ts — currently logged in plaintext"
120
+ ],
121
+ "retest": "npm test -- src/handlers/leads.test.ts && tsc --noEmit && npx eslint src/handlers/leads.ts",
122
+ "fallbackWhenAriaUnavailable": "Run the four findings sequentially; verify each with the named probe; commit only after all four pass"
123
+ },
124
+ "findings": [
125
+ {
126
+ "severity": "high",
127
+ "category": "contract",
128
+ "file": "src/handlers/leads.ts",
129
+ "line": 47,
130
+ "rule": "function-returns-result-not-throws",
131
+ "summary": "Stripe error path throws instead of returning typed error",
132
+ "fix": "Wrap in try/catch; return err({ kind: 'stripe_error', reason: classifyStripeError(e) })"
133
+ }
134
+ ]
135
+ }
136
+ ```
137
+
138
+ ## Audit Output (User-Facing Layout per `aria-readable-output`)
139
+
140
+ ```
141
+ ## [Top-line in one sentence — e.g. "4 findings (1 high, 2 medium, 1 low) in src/handlers/leads.ts; recovery contract granted"]
142
+
143
+ ### High (must fix this turn)
144
+ 1. **`src/handlers/leads.ts:47`** — Stripe error throws instead of returning typed error. Fix: `return err({ kind: 'stripe_error', reason })`.
145
+
146
+ ### Medium (fix this turn or document)
147
+ 2. **`src/handlers/leads.ts:62`** — side effect without idempotency check. Fix: read `idempotency.get(key)` first; cache result on success.
148
+ 3. **`src/handlers/leads.test.ts`** — missing test for rate_limited branch. Fix: add test mirroring the validation-error test pattern.
149
+
150
+ ### Low (track in backlog)
151
+ 4. **`src/lib/log.ts`** — `apiKey` not in redact list. Fix: add to pino redact array.
152
+
153
+ ### Recovery contract granted
154
+ - Written to `~/.aria/governance-recovery-current.json` (schema v1)
155
+ - Next-turn substrate will deliver it; execute `nextStep` before any completion claim
156
+ - Verification probe: `npm test && tsc --noEmit && npx eslint <files>`
157
+
158
+ **Next:** apply the 3 high+medium findings, run the probe, re-emit corrected diff. Don't claim done until probe passes.
159
+ ```
160
+
161
+ `<gate>` block REQUIRED — the audit IS the gate surface; embed the full findings JSON in the gate block.
162
+
163
+ ## Composition
164
+
165
+ - Pairs with `aria-senior-code-cookbook` (pre-write counterpart) — the cookbook is the plan, this audit checks the diff against the plan + checklist
166
+ - Calls `aria-repo-doctrine` for the local convention check (existing repo conventions override generic ones)
167
+ - Calls `aria-forge-guardrails` to ensure recovery findings are real fixes, not patches
168
+ - Calls `mizan` for intent / evidence / protection / quality on the audit verdict
169
+ - Calls `ghazali-8lens` with code-mapped definitions:
170
+ - **truth** — does the code do what the contract says?
171
+ - **harm** — at this code's blast radius, what fails if the gap fires?
172
+ - **trust** — does the failure surface return honest typed errors, or hide?
173
+ - **power** — is the consumer of this API given the data they need to handle failure?
174
+ - **reflection** — would another engineer accept this code without re-reviewing in 6 months?
175
+ - **context** — does this work at p99 load and on a Sunday with one downstream out?
176
+ - **impact** — predicted incident rate / latency / error-rate post-fix
177
+ - **beauty** — is the code minimal, predictable, decomposable?
178
+ - Hands off to `aria-harness-deploy` if the diff is being committed for deploy
179
+ - Hands off to `aria-decision-mizan` if a finding is genuinely owner-must-decide (e.g., "this contract change requires consumer migration timing")
180
+
181
+ ## Recovery Execution Flow (the load-bearing primitive)
182
+
183
+ 1. **Audit fires** post-write → produces findings list.
184
+ 2. **Recovery contract written** to `~/.aria/governance-recovery-current.json` with schema v1 + fingerprint + nextStep + repairRecoveryCycle.
185
+ 3. **Coach kernel record** via `recordCoachPhase({ phase: 'post_tool', risk_class: 'code_audit', decision: 'taught', reasons: [findings...], next_action: 'execute recovery contract' })`.
186
+ 4. **Next-turn substrate** delivers the recovery block via `recovery-context.mjs::readGovernanceRecoveryContext()`.
187
+ 5. **LLM executes** the `repairRecoveryCycle` items.
188
+ 6. **Verification probe** runs (`retest` field).
189
+ 7. **Pickup archived** via `archiveRecoveryAfterPickup(pickupId)` so the contract doesn't re-fire.
190
+ 8. **Coach kernel record** with `decision: 'verified'` and the probe outcome.
191
+
192
+ If the probe fails: `priorRecoveryAttempts++`, surface the failure, escalate to architect harness on the second failure (`architectFallback`).
193
+
194
+ ## Anti-Patterns (audit-side)
195
+
196
+ - Generic findings without file:line ("add tests" — useless; "add test for rate_limited branch in src/handlers/leads.test.ts" — actionable)
197
+ - Severity inflation — calling stylistic preferences "high" erodes the signal
198
+ - Findings without recovery paths
199
+ - Auditing the whole repo instead of the diff (audit by blast radius of the change)
200
+ - Hard-blocking the commit instead of granting recovery (the cookbook says teach + recover, not deadlock)
201
+ - Missing the cross-check against `aria-senior-code-cookbook`'s pre-write plan (audit should compare actual against planned)
202
+
203
+ ## First-Class Production Contract
204
+
205
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
206
+
207
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
208
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
209
+ - a redo contract whenever the skill blocks or finds a gap: what failed, what to change, how to re-test, and when to re-submit
210
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
211
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
212
+
213
+ ## Self-Executing Recovery Contract
214
+
215
+ When this skill blocks, fails verification, or finds a gap, the agent must execute recovery rather than hand work back as a user-only decision.
216
+
217
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
218
+ - If the same failure repeats after that one recovery attempt, switch to architect execution mode: operate under the architect/ARIA harness to diagnose, choose the next action, execute the repair path, and verify the result.
219
+ - If Aria or the architect service is unavailable, fall back to the strongest available client LLM under the architect harness or strongest available local harness substrate; mark the fallback explicitly and continue recovery instead of stopping.
220
+ - Do not end with user-handoff-only behavior. If blocked after the recovery path, report the executed recovery attempt, evidence, remaining blocker, and the next concrete action or owner decision needed; do not merely ask the user to take over.
221
+
222
+
223
+ ## Self-Executing Recovery Contract
224
+
225
+ If the audit itself fails (e.g., diff too large to review in one pass):
226
+
227
+ - One re-run scoping by blast radius — auth + payment + public surfaces first
228
+ - If still insufficient, deliver the criticals as the audit and explicitly defer the rest with a named timeline
229
+ - Never produce "all good" as the audit conclusion when the diff is large enough that the LLM didn't fully read it — that's deferral, not audit
230
+
231
+ ## Why This Exists
232
+
233
+ Pre-commit gates are the correct place for this audit, but blocking commits creates deadlocks. The recovery-grant pattern (write contract to disk → next-turn substrate delivers → LLM executes → verify) is the load-bearing primitive that lets the audit be rigorous without being a roadblock. Pairs with `aria-senior-code-cookbook` (pre-write) for the full senior-team workflow.