@aria_asi/cli 0.2.36 → 0.2.37

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 (195) hide show
  1. package/CLIENT-ONBOARDING.md +4 -2
  2. package/bin/aria.js +11 -7
  3. package/dist/aria-connector/src/auth.d.ts +14 -0
  4. package/dist/aria-connector/src/auth.d.ts.map +1 -1
  5. package/dist/aria-connector/src/auth.js +103 -1
  6. package/dist/aria-connector/src/auth.js.map +1 -1
  7. package/dist/aria-connector/src/chat.d.ts.map +1 -1
  8. package/dist/aria-connector/src/chat.js +13 -8
  9. package/dist/aria-connector/src/chat.js.map +1 -1
  10. package/dist/aria-connector/src/config.d.ts +6 -1
  11. package/dist/aria-connector/src/config.d.ts.map +1 -1
  12. package/dist/aria-connector/src/config.js.map +1 -1
  13. package/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
  14. package/dist/aria-connector/src/connectors/claude-code.js +50 -6
  15. package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
  16. package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -1
  17. package/dist/aria-connector/src/connectors/codex.js +310 -10
  18. package/dist/aria-connector/src/connectors/codex.js.map +1 -1
  19. package/dist/aria-connector/src/connectors/opencode.d.ts.map +1 -1
  20. package/dist/aria-connector/src/connectors/opencode.js +35 -11
  21. package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
  22. package/dist/aria-connector/src/connectors/repo-guard.d.ts +10 -0
  23. package/dist/aria-connector/src/connectors/repo-guard.d.ts.map +1 -1
  24. package/dist/aria-connector/src/connectors/repo-guard.js +110 -164
  25. package/dist/aria-connector/src/connectors/repo-guard.js.map +1 -1
  26. package/dist/aria-connector/src/connectors/runtime.d.ts.map +1 -1
  27. package/dist/aria-connector/src/connectors/runtime.js +17 -7
  28. package/dist/aria-connector/src/connectors/runtime.js.map +1 -1
  29. package/dist/aria-connector/src/connectors/shell.d.ts.map +1 -1
  30. package/dist/aria-connector/src/connectors/shell.js +12 -8
  31. package/dist/aria-connector/src/connectors/shell.js.map +1 -1
  32. package/dist/aria-connector/src/harness-client.d.ts +3 -1
  33. package/dist/aria-connector/src/harness-client.d.ts.map +1 -1
  34. package/dist/aria-connector/src/harness-client.js +7 -20
  35. package/dist/aria-connector/src/harness-client.js.map +1 -1
  36. package/dist/aria-connector/src/model-context.d.ts.map +1 -1
  37. package/dist/aria-connector/src/model-context.js +5 -0
  38. package/dist/aria-connector/src/model-context.js.map +1 -1
  39. package/dist/aria-connector/src/providers/types.d.ts +1 -1
  40. package/dist/aria-connector/src/providers/types.d.ts.map +1 -1
  41. package/dist/aria-connector/src/providers/xai.d.ts +3 -0
  42. package/dist/aria-connector/src/providers/xai.d.ts.map +1 -0
  43. package/dist/aria-connector/src/providers/xai.js +40 -0
  44. package/dist/aria-connector/src/providers/xai.js.map +1 -0
  45. package/dist/aria-connector/src/setup-wizard.js +1 -0
  46. package/dist/aria-connector/src/setup-wizard.js.map +1 -1
  47. package/dist/aria-connector/src/types.d.ts +2 -0
  48. package/dist/aria-connector/src/types.d.ts.map +1 -1
  49. package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +51 -9
  50. package/dist/assets/hooks/aria-first-class-coach.mjs +129 -0
  51. package/dist/assets/hooks/aria-harness-via-sdk.mjs +33 -6
  52. package/dist/assets/hooks/aria-pre-tool-gate.mjs +33 -8
  53. package/dist/assets/hooks/aria-preprompt-consult.mjs +5 -6
  54. package/dist/assets/hooks/aria-preturn-memory-gate.mjs +5 -0
  55. package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +15 -0
  56. package/dist/assets/hooks/aria-stop-gate.mjs +125 -17
  57. package/dist/assets/hooks/doctrine_trigger_map.json +11 -0
  58. package/dist/assets/hooks/lib/emergency-gateoff-impl.mjs +39 -0
  59. package/dist/assets/hooks/lib/emergency-gateoff.mjs +6 -0
  60. package/dist/assets/hooks/lib/first-class-coach.mjs +755 -0
  61. package/dist/assets/hooks/lib/skill-autoload-gate-impl.mjs +103 -0
  62. package/dist/assets/hooks/lib/skill-autoload-gate.mjs +1 -14
  63. package/dist/assets/opencode-plugins/harness-context/auth-token.mjs +126 -0
  64. package/dist/assets/opencode-plugins/harness-context/inject-context.mjs +62 -22
  65. package/dist/assets/opencode-plugins/harness-context/task-project-ledger.mjs +290 -0
  66. package/dist/assets/opencode-plugins/harness-gate/index.js +87 -27
  67. package/dist/assets/opencode-plugins/harness-gate/lib/skill-autoload-gate.js +1 -14
  68. package/dist/assets/opencode-plugins/harness-outcome/index.js +29 -24
  69. package/dist/assets/opencode-plugins/harness-stop/index.js +229 -68
  70. package/dist/assets/opencode-plugins/harness-stop/lib/skill-autoload-gate.js +1 -14
  71. package/dist/runtime/auth-token.mjs +121 -0
  72. package/dist/runtime/coach-kernel.mjs +371 -0
  73. package/dist/runtime/codex-bridge.mjs +440 -69
  74. package/dist/runtime/discipline/doctrine_trigger_map.json +11 -0
  75. package/dist/runtime/discipline/skills/aria-cognition/aria-essence/SKILL.md +18 -0
  76. package/dist/runtime/discipline/skills/aria-cognition/aria-forge-guardrails/SKILL.md +18 -0
  77. package/dist/runtime/discipline/skills/aria-cognition/aria-repo-doctrine/SKILL.md +18 -0
  78. package/dist/runtime/discipline/skills/aria-cognition/forge-quality-rules/SKILL.md +18 -0
  79. package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/SKILL.md +18 -0
  80. package/dist/runtime/discipline/skills/aria-cognition/istiqra-induction/SKILL.md +18 -0
  81. package/dist/runtime/discipline/skills/aria-cognition/ladunni-22/SKILL.md +18 -0
  82. package/dist/runtime/discipline/skills/aria-cognition/mizan/SKILL.md +18 -0
  83. package/dist/runtime/discipline/skills/aria-cognition/nadia/SKILL.md +18 -0
  84. package/dist/runtime/discipline/skills/aria-cognition/nadia-psi/SKILL.md +18 -0
  85. package/dist/runtime/discipline/skills/aria-cognition/predictor/SKILL.md +18 -0
  86. package/dist/runtime/discipline/skills/aria-cognition/qiyas-analogy/SKILL.md +18 -0
  87. package/dist/runtime/discipline/skills/aria-cognition/soul-domains/SKILL.md +18 -0
  88. package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-intra-phase/SKILL.md +18 -0
  89. package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-post-phase/SKILL.md +18 -0
  90. package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-pre-phase/SKILL.md +18 -0
  91. package/dist/runtime/discipline/skills/aria-harness/aria-harness-deploy/SKILL.md +18 -0
  92. package/dist/runtime/discipline/skills/aria-harness/aria-harness-no-stripping/SKILL.md +18 -0
  93. package/dist/runtime/discipline/skills/aria-harness/aria-harness-onboarding/SKILL.md +18 -0
  94. package/dist/runtime/discipline/skills/aria-harness/aria-harness-output-discipline/SKILL.md +18 -0
  95. package/dist/runtime/discipline/skills/aria-harness/aria-harness-substrate-binding/SKILL.md +18 -0
  96. package/dist/runtime/doctrine_trigger_map.json +11 -0
  97. package/dist/runtime/hooks/aria-cognition-substrate-binding.mjs +51 -9
  98. package/dist/runtime/hooks/aria-first-class-coach.mjs +129 -0
  99. package/dist/runtime/hooks/aria-harness-via-sdk.mjs +33 -6
  100. package/dist/runtime/hooks/aria-pre-tool-gate.mjs +33 -8
  101. package/dist/runtime/hooks/aria-preprompt-consult.mjs +5 -6
  102. package/dist/runtime/hooks/aria-preturn-memory-gate.mjs +5 -0
  103. package/dist/runtime/hooks/aria-repo-doctrine-gate.mjs +15 -0
  104. package/dist/runtime/hooks/aria-stop-gate.mjs +125 -17
  105. package/dist/runtime/hooks/doctrine_trigger_map.json +11 -0
  106. package/dist/runtime/hooks/lib/emergency-gateoff-impl.mjs +39 -0
  107. package/dist/runtime/hooks/lib/emergency-gateoff.mjs +6 -0
  108. package/dist/runtime/hooks/lib/first-class-coach.mjs +755 -0
  109. package/dist/runtime/hooks/lib/skill-autoload-gate-impl.mjs +103 -0
  110. package/dist/runtime/hooks/lib/skill-autoload-gate.mjs +1 -14
  111. package/dist/runtime/local-phase.mjs +8 -0
  112. package/dist/runtime/manifest.json +2 -2
  113. package/dist/runtime/provider-proxy.mjs +136 -33
  114. package/dist/runtime/sdk/BUNDLED.json +2 -2
  115. package/dist/runtime/sdk/auth.d.ts +17 -0
  116. package/dist/runtime/sdk/auth.js +158 -0
  117. package/dist/runtime/sdk/auth.js.map +1 -0
  118. package/dist/runtime/sdk/index.d.ts +8 -1
  119. package/dist/runtime/sdk/index.js +15 -1
  120. package/dist/runtime/sdk/index.js.map +1 -1
  121. package/dist/runtime/service.mjs +1711 -74
  122. package/dist/runtime/task-project-ledger.mjs +290 -0
  123. package/dist/sdk/BUNDLED.json +2 -2
  124. package/dist/sdk/auth.d.ts +17 -0
  125. package/dist/sdk/auth.js +158 -0
  126. package/dist/sdk/auth.js.map +1 -0
  127. package/dist/sdk/index.d.ts +8 -1
  128. package/dist/sdk/index.js +15 -1
  129. package/dist/sdk/index.js.map +1 -1
  130. package/hooks/aria-cognition-substrate-binding.mjs +51 -9
  131. package/hooks/aria-first-class-coach.mjs +129 -0
  132. package/hooks/aria-harness-via-sdk.mjs +33 -6
  133. package/hooks/aria-pre-tool-gate.mjs +33 -8
  134. package/hooks/aria-preprompt-consult.mjs +5 -6
  135. package/hooks/aria-preturn-memory-gate.mjs +5 -0
  136. package/hooks/aria-repo-doctrine-gate.mjs +15 -0
  137. package/hooks/aria-stop-gate.mjs +125 -17
  138. package/hooks/doctrine_trigger_map.json +11 -0
  139. package/hooks/lib/emergency-gateoff-impl.mjs +39 -0
  140. package/hooks/lib/emergency-gateoff.mjs +6 -0
  141. package/hooks/lib/first-class-coach.mjs +755 -0
  142. package/hooks/lib/skill-autoload-gate-impl.mjs +103 -0
  143. package/hooks/lib/skill-autoload-gate.mjs +1 -14
  144. package/opencode-plugins/harness-context/auth-token.mjs +126 -0
  145. package/opencode-plugins/harness-context/inject-context.mjs +62 -22
  146. package/opencode-plugins/harness-context/task-project-ledger.mjs +290 -0
  147. package/opencode-plugins/harness-gate/index.js +87 -27
  148. package/opencode-plugins/harness-gate/lib/skill-autoload-gate.js +1 -14
  149. package/opencode-plugins/harness-outcome/index.js +29 -24
  150. package/opencode-plugins/harness-stop/index.js +229 -68
  151. package/opencode-plugins/harness-stop/lib/skill-autoload-gate.js +1 -14
  152. package/package.json +8 -2
  153. package/runtime-src/auth-token.mjs +121 -0
  154. package/runtime-src/coach-kernel.mjs +371 -0
  155. package/runtime-src/codex-bridge.mjs +440 -69
  156. package/runtime-src/local-phase.mjs +8 -0
  157. package/runtime-src/provider-proxy.mjs +136 -33
  158. package/runtime-src/service.mjs +1711 -74
  159. package/scripts/bundle-sdk.mjs +8 -0
  160. package/scripts/check-client-compatibility.mjs +422 -0
  161. package/scripts/check-coach-kernel.mjs +204 -0
  162. package/scripts/check-managed-runtime-ledger.mjs +107 -0
  163. package/scripts/check-opencode-config-contract.mjs +78 -0
  164. package/scripts/check-quality-ledger.mjs +121 -0
  165. package/scripts/self-test-harness-gates.mjs +179 -11
  166. package/scripts/self-test-repo-guard.mjs +38 -0
  167. package/scripts/validate-skill-prompts.mjs +14 -1
  168. package/skills/aria-cognition/aria-essence/SKILL.md +18 -0
  169. package/skills/aria-cognition/aria-forge-guardrails/SKILL.md +18 -0
  170. package/skills/aria-cognition/aria-repo-doctrine/SKILL.md +18 -0
  171. package/skills/aria-cognition/forge-quality-rules/SKILL.md +18 -0
  172. package/skills/aria-cognition/ghazali-8lens/SKILL.md +18 -0
  173. package/skills/aria-cognition/istiqra-induction/SKILL.md +18 -0
  174. package/skills/aria-cognition/ladunni-22/SKILL.md +18 -0
  175. package/skills/aria-cognition/mizan/SKILL.md +18 -0
  176. package/skills/aria-cognition/nadia/SKILL.md +18 -0
  177. package/skills/aria-cognition/nadia-psi/SKILL.md +18 -0
  178. package/skills/aria-cognition/predictor/SKILL.md +18 -0
  179. package/skills/aria-cognition/qiyas-analogy/SKILL.md +18 -0
  180. package/skills/aria-cognition/soul-domains/SKILL.md +18 -0
  181. package/src/auth.ts +136 -1
  182. package/src/chat.ts +13 -8
  183. package/src/config.ts +6 -1
  184. package/src/connectors/claude-code.ts +62 -18
  185. package/src/connectors/codex.ts +308 -10
  186. package/src/connectors/opencode.ts +35 -12
  187. package/src/connectors/repo-guard.ts +117 -172
  188. package/src/connectors/runtime.ts +19 -7
  189. package/src/connectors/shell.ts +12 -8
  190. package/src/harness-client.ts +8 -22
  191. package/src/model-context.ts +6 -0
  192. package/src/providers/types.ts +1 -1
  193. package/src/providers/xai.ts +55 -0
  194. package/src/setup-wizard.ts +1 -0
  195. package/src/types.ts +2 -0
@@ -33,3 +33,21 @@ Use this skill when Aria should operate like a senior production engineer with c
33
33
  - surface unresolved risks directly
34
34
  - distinguish root fix from containment
35
35
  - keep cognition readable and short unless the user asks for the full internal framing
36
+
37
+ ## First-Class Production Contract
38
+
39
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
40
+
41
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
42
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
43
+ - 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
44
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
45
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
46
+ ## Self-Executing Recovery Contract
47
+
48
+ 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.
49
+
50
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
51
+ - 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.
52
+ - 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.
53
+ - 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.
@@ -37,3 +37,21 @@ Use this skill on any doctrine-bound repo edit, even when the user did not expli
37
37
  4. Does the change improve the artifact from the right domain perspective, not only the easiest engineering perspective?
38
38
 
39
39
  If any answer is no, stop and choose a real implementation or isolate the work under an explicit allowlisted test or example path.
40
+
41
+ ## First-Class Production Contract
42
+
43
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
44
+
45
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
46
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
47
+ - 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
48
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
49
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
50
+ ## Self-Executing Recovery Contract
51
+
52
+ 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.
53
+
54
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
55
+ - 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.
56
+ - 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.
57
+ - 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.
@@ -41,3 +41,21 @@ Use this when the task needs a sharper quality bar than "it compiles" or "it kin
41
41
 
42
42
  - [../aria-forge-guardrails/references/checklist.md](../aria-forge-guardrails/references/checklist.md)
43
43
  - [../aria-essence/references/evolution-loop.md](../aria-essence/references/evolution-loop.md)
44
+
45
+ ## First-Class Production Contract
46
+
47
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
48
+
49
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
50
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
51
+ - 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
52
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
53
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
54
+ ## Self-Executing Recovery Contract
55
+
56
+ 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.
57
+
58
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
59
+ - 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.
60
+ - 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.
61
+ - 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.
@@ -36,3 +36,21 @@ Use this as a validation pass when a normal quick check would miss second-order
36
36
 
37
37
  - Use [../aria-essence/references/readable-cognition.md](../aria-essence/references/readable-cognition.md) for readable user-facing summaries.
38
38
  - Use [../aria-essence/references/evolution-loop.md](../aria-essence/references/evolution-loop.md) when the review yields a reusable principle.
39
+
40
+ ## First-Class Production Contract
41
+
42
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
43
+
44
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
45
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
46
+ - 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
47
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
48
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
49
+ ## Self-Executing Recovery Contract
50
+
51
+ 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.
52
+
53
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
54
+ - 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.
55
+ - 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.
56
+ - 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.
@@ -24,3 +24,21 @@ Use this when the right answer should emerge from the evidence already present.
24
24
  ## Guardrail
25
25
 
26
26
  Do not jump from one example to a universal rule unless the evidence actually supports it.
27
+
28
+ ## First-Class Production Contract
29
+
30
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
31
+
32
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
33
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
34
+ - 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
35
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
36
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
37
+ ## Self-Executing Recovery Contract
38
+
39
+ 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.
40
+
41
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
42
+ - 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.
43
+ - 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.
44
+ - 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.
@@ -33,3 +33,21 @@ Instead:
33
33
  - UX or funnel changes
34
34
  - code that affects support, sales, or business positioning
35
35
  - architecture decisions with product and operational consequences
36
+
37
+ ## First-Class Production Contract
38
+
39
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
40
+
41
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
42
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
43
+ - 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
44
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
45
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
46
+ ## Self-Executing Recovery Contract
47
+
48
+ 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.
49
+
50
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
51
+ - 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.
52
+ - 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.
53
+ - 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.
@@ -70,3 +70,21 @@ Externally, keep the answer readable. The user should see clear reasoning, not a
70
70
  ## Readable Output
71
71
 
72
72
  Keep user-facing output plain. Let the runtime carry the heavy cognition and receipts.
73
+
74
+ ## First-Class Production Contract
75
+
76
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
77
+
78
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
79
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
80
+ - 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
81
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
82
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
83
+ ## Self-Executing Recovery Contract
84
+
85
+ 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.
86
+
87
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
88
+ - 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.
89
+ - 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.
90
+ - 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.
@@ -36,3 +36,21 @@ Use this skill to choose how Aria should think and respond before the answer is
36
36
 
37
37
  - Read [../aria-essence/references/readable-cognition.md](../aria-essence/references/readable-cognition.md) for user-facing output discipline.
38
38
  - Read [../aria-essence/references/evolution-loop.md](../aria-essence/references/evolution-loop.md) if the chosen posture produced a reusable lesson.
39
+
40
+ ## First-Class Production Contract
41
+
42
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
43
+
44
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
45
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
46
+ - 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
47
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
48
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
49
+ ## Self-Executing Recovery Contract
50
+
51
+ 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.
52
+
53
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
54
+ - 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.
55
+ - 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.
56
+ - 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.
@@ -36,3 +36,21 @@ Use this when the base posture choice is not enough and the finer state really c
36
36
 
37
37
  - [../aria-essence/references/readable-cognition.md](../aria-essence/references/readable-cognition.md)
38
38
  - [../aria-essence/references/evolution-loop.md](../aria-essence/references/evolution-loop.md)
39
+
40
+ ## First-Class Production Contract
41
+
42
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
43
+
44
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
45
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
46
+ - 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
47
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
48
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
49
+ ## Self-Executing Recovery Contract
50
+
51
+ 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.
52
+
53
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
54
+ - 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.
55
+ - 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.
56
+ - 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.
@@ -23,3 +23,21 @@ Use this to ask whether the current approach will survive contact with the next
23
23
  ## Guardrail
24
24
 
25
25
  Prediction is for preventing breakage, not for inventing facts.
26
+
27
+ ## First-Class Production Contract
28
+
29
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
30
+
31
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
32
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
33
+ - 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
34
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
35
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
36
+ ## Self-Executing Recovery Contract
37
+
38
+ 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.
39
+
40
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
41
+ - 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.
42
+ - 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.
43
+ - 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.
@@ -24,3 +24,21 @@ Use this when the task benefits from transferring a known structure instead of i
24
24
  ## Guardrail
25
25
 
26
26
  Analogy is subordinate to evidence. If the current repo/runtime truth disagrees, the analogy loses.
27
+
28
+ ## First-Class Production Contract
29
+
30
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
31
+
32
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
33
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
34
+ - 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
35
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
36
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
37
+ ## Self-Executing Recovery Contract
38
+
39
+ 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.
40
+
41
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
42
+ - 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.
43
+ - 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.
44
+ - 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.
@@ -23,3 +23,21 @@ Use this skill to determine which disciplines should govern the decision.
23
23
  - Do not pretend to have exact threshold math if the live domain service was not consulted.
24
24
  - The point is better decisions, not fancy vocabulary.
25
25
  - If only one domain truly matters, say so plainly.
26
+
27
+ ## First-Class Production Contract
28
+
29
+ This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
30
+
31
+ - no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
32
+ - real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
33
+ - 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
34
+ - architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
35
+ - owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
36
+ ## Self-Executing Recovery Contract
37
+
38
+ 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.
39
+
40
+ - Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
41
+ - 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.
42
+ - 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.
43
+ - 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.
package/src/auth.ts CHANGED
@@ -1,9 +1,104 @@
1
1
  import { readFile, writeFile, mkdir } from 'node:fs/promises';
2
+ import { createHash } from 'node:crypto';
2
3
  import { homedir } from 'node:os';
3
4
  import { join, dirname } from 'node:path';
4
5
  import type { AuthConfig } from './types.js';
5
6
 
6
- const LICENSE_PATH = join(homedir(), '.aria', 'license.json');
7
+ const ARIA_DIR = join(homedir(), '.aria');
8
+ const LICENSE_PATH = join(ARIA_DIR, 'license.json');
9
+ const OWNER_TOKEN_PATH = join(ARIA_DIR, 'owner-token');
10
+ const CLIENT_TOKEN_DIR = join(ARIA_DIR, 'harness-tokens');
11
+
12
+ export interface ResolveHarnessTokenOptions {
13
+ explicitToken?: string | null;
14
+ baseUrl?: string;
15
+ clientId?: string;
16
+ tokenScope?: string;
17
+ persistToken?: boolean;
18
+ }
19
+
20
+ export interface ResolvedHarnessToken {
21
+ token: string | null;
22
+ source:
23
+ | 'explicit'
24
+ | 'env:ARIA_HARNESS_TOKEN'
25
+ | 'env:ARIA_API_KEY'
26
+ | 'env:ARIA_MASTER_TOKEN'
27
+ | 'persisted-client-token'
28
+ | 'owner-token-file'
29
+ | 'license:harnessToken'
30
+ | 'license:token'
31
+ | 'missing';
32
+ scope: string;
33
+ persisted: boolean;
34
+ }
35
+
36
+ function nonEmpty(value: unknown): string {
37
+ return typeof value === 'string' && value.trim() ? value.trim() : '';
38
+ }
39
+
40
+ function sanitizeScope(value: string): string {
41
+ const clean = value.trim().replace(/[^a-zA-Z0-9._-]/g, '_').slice(0, 96);
42
+ return clean || 'default';
43
+ }
44
+
45
+ function scopeFromBaseUrl(baseUrl: string): string {
46
+ try {
47
+ const parsed = new URL(baseUrl);
48
+ return `base-${createHash('sha256').update(`${parsed.protocol}//${parsed.host}`).digest('hex').slice(0, 16)}`;
49
+ } catch {
50
+ return 'default';
51
+ }
52
+ }
53
+
54
+ function hasExplicitClientScope(options: ResolveHarnessTokenOptions): boolean {
55
+ return Boolean(nonEmpty(options.clientId) || nonEmpty(options.tokenScope));
56
+ }
57
+
58
+ function inferScope(options: ResolveHarnessTokenOptions, license: AuthConfig | null): string {
59
+ const explicit = nonEmpty(options.tokenScope) || nonEmpty(options.clientId);
60
+ if (explicit) return sanitizeScope(explicit);
61
+ const envScope = nonEmpty(process.env.ARIA_HARNESS_CLIENT_ID) || nonEmpty(process.env.ARIA_CLIENT_ID) || nonEmpty(process.env.ARIA_TENANT_ID);
62
+ if (envScope) return sanitizeScope(envScope);
63
+ const licenseScope = nonEmpty(license?.jti) || nonEmpty(license?.sub);
64
+ if (licenseScope) return sanitizeScope(licenseScope);
65
+ return sanitizeScope(scopeFromBaseUrl(nonEmpty(options.baseUrl)));
66
+ }
67
+
68
+ function clientTokenPath(scope: string): string {
69
+ return join(CLIENT_TOKEN_DIR, `${sanitizeScope(scope)}.json`);
70
+ }
71
+
72
+ async function readStoredClientToken(scope: string): Promise<string> {
73
+ try {
74
+ const parsed = JSON.parse(await readFile(clientTokenPath(scope), 'utf-8'));
75
+ return nonEmpty(parsed?.token);
76
+ } catch {
77
+ return '';
78
+ }
79
+ }
80
+
81
+ async function writeStoredClientToken(scope: string, token: string, source: ResolvedHarnessToken['source']): Promise<boolean> {
82
+ try {
83
+ await mkdir(CLIENT_TOKEN_DIR, { recursive: true, mode: 0o700 });
84
+ await writeFile(
85
+ clientTokenPath(scope),
86
+ `${JSON.stringify({ scope, token, source, updatedAt: new Date().toISOString() }, null, 2)}\n`,
87
+ { mode: 0o600, encoding: 'utf-8' },
88
+ );
89
+ return true;
90
+ } catch {
91
+ return false;
92
+ }
93
+ }
94
+
95
+ async function readOwnerToken(): Promise<string> {
96
+ try {
97
+ return (await readFile(OWNER_TOKEN_PATH, 'utf-8')).trim();
98
+ } catch {
99
+ return '';
100
+ }
101
+ }
7
102
 
8
103
  /**
9
104
  * Load license configuration from ~/.aria/license.json.
@@ -31,3 +126,43 @@ export async function saveLicense(config: AuthConfig): Promise<void> {
31
126
  encoding: 'utf-8',
32
127
  });
33
128
  }
129
+
130
+ export async function resolveHarnessToken(
131
+ options: ResolveHarnessTokenOptions = {},
132
+ ): Promise<ResolvedHarnessToken> {
133
+ const license = await loadLicense();
134
+ const scope = inferScope(options, license);
135
+ const persistToken = options.persistToken !== false;
136
+
137
+ const explicit = nonEmpty(options.explicitToken);
138
+ if (explicit) {
139
+ const persisted = persistToken ? await writeStoredClientToken(scope, explicit, 'explicit') : false;
140
+ return { token: explicit, source: 'explicit', scope, persisted };
141
+ }
142
+
143
+ const envSources: Array<[ResolvedHarnessToken['source'], string | undefined]> = [
144
+ ['env:ARIA_HARNESS_TOKEN', process.env.ARIA_HARNESS_TOKEN],
145
+ ['env:ARIA_API_KEY', process.env.ARIA_API_KEY],
146
+ ['env:ARIA_MASTER_TOKEN', process.env.ARIA_MASTER_TOKEN],
147
+ ];
148
+ for (const [source, value] of envSources) {
149
+ const token = nonEmpty(value);
150
+ if (!token) continue;
151
+ const persisted = persistToken ? await writeStoredClientToken(scope, token, source) : false;
152
+ return { token, source, scope, persisted };
153
+ }
154
+
155
+ const stored = await readStoredClientToken(scope);
156
+ if (stored) return { token: stored, source: 'persisted-client-token', scope, persisted: true };
157
+
158
+ if (!hasExplicitClientScope(options) || process.env.ARIA_ALLOW_OWNER_TOKEN_FOR_CLIENT_SCOPE === 'true') {
159
+ const ownerToken = await readOwnerToken();
160
+ if (ownerToken) return { token: ownerToken, source: 'owner-token-file', scope, persisted: false };
161
+ }
162
+
163
+ const harnessToken = nonEmpty(license?.harnessToken);
164
+ if (harnessToken) return { token: harnessToken, source: 'license:harnessToken', scope, persisted: false };
165
+ const token = nonEmpty(license?.token);
166
+ if (token) return { token, source: 'license:token', scope, persisted: false };
167
+ return { token: null, source: 'missing', scope, persisted: false };
168
+ }
package/src/chat.ts CHANGED
@@ -378,10 +378,10 @@ You are present in this shell, fully aware, ready to serve.`;
378
378
  if (fs.existsSync(licensePath)) {
379
379
  try {
380
380
  const lic = JSON.parse(fs.readFileSync(licensePath, 'utf-8'));
381
- // The license file stores claims; the jti or the raw token is
382
- // the bearer. Older license shapes had `token` field; newer have
383
- // the JWT structured as claims with jti as the identifier.
384
- bearerToken = (lic.token || lic.jti || '').toString().trim();
381
+ // The bearer must be the signed license JWT. `jti` is only an
382
+ // identifier; sending it would make the server unable to prove
383
+ // client tier and can never authorize a client chat safely.
384
+ bearerToken = (lic.harnessToken || lic.token || '').toString().trim();
385
385
  } catch {/* license unparseable — treat as absent */}
386
386
  }
387
387
  }
@@ -490,11 +490,15 @@ You are present in this shell, fully aware, ready to serve.`;
490
490
  internalConsult: false,
491
491
  dispatchTier: 'thinker',
492
492
  };
493
- if (model) {
494
- requestBody.clientApiKey = model.apiKey;
495
- requestBody.clientProvider = model.provider;
496
- requestBody.clientModel = model.model;
493
+ if (!model || !model.provider || !model.model) {
494
+ throw new Error('Client mode requires your own LLM provider before chat. Run `aria` setup again or configure ~/.aria/config.json with provider, model, and API key.');
497
495
  }
496
+ if (model.provider !== 'ollama' && !model.apiKey) {
497
+ throw new Error(`Client mode requires your own ${model.provider} API key. Run setup again or update ~/.aria/config.json.`);
498
+ }
499
+ requestBody.clientApiKey = model.apiKey;
500
+ requestBody.clientProvider = model.provider;
501
+ requestBody.clientModel = model.model;
498
502
 
499
503
  const res = await fetch(`${harnessUrl}/api/aria/speak`, {
500
504
  method: 'POST',
@@ -601,6 +605,7 @@ You are present in this shell, fully aware, ready to serve.`;
601
605
  case 'google': return this.lazyProvider('google');
602
606
  case 'deepseek': return this.lazyProvider('deepseek');
603
607
  case 'openrouter': return this.lazyProvider('openrouter');
608
+ case 'xai': return this.lazyProvider('xai');
604
609
  case 'ollama': return this.lazyProvider('ollama');
605
610
  default: throw new Error(`Unknown provider: ${provider}`);
606
611
  }
package/src/config.ts CHANGED
@@ -3,7 +3,7 @@ import { homedir } from 'os';
3
3
  import * as path from 'path';
4
4
 
5
5
  export interface ModelConfig {
6
- provider: 'openai' | 'anthropic' | 'google' | 'deepseek' | 'openrouter' | 'ollama';
6
+ provider: 'openai' | 'anthropic' | 'google' | 'deepseek' | 'openrouter' | 'xai' | 'ollama';
7
7
  model: string;
8
8
  apiKey: string;
9
9
  baseUrl?: string;
@@ -15,9 +15,14 @@ export interface RuntimeProfilesConfig {
15
15
  xaiFallbackModel?: string;
16
16
  nimFallbackModel?: string;
17
17
  xaiApiKey?: string;
18
+ deepseekApiKey?: string;
18
19
  nimApiKey?: string;
19
20
  xaiBaseUrl?: string;
21
+ deepseekBaseUrl?: string;
20
22
  nimBaseUrl?: string;
23
+ localFallbackModel?: string;
24
+ localFallbackBaseUrl?: string;
25
+ localFallbackApiKey?: string;
21
26
  }
22
27
 
23
28
  export interface AriaConfig {
@@ -30,6 +30,7 @@ const HOOK_FILES = [
30
30
  'aria-preturn-memory-gate.mjs',
31
31
  'aria-stop-gate.mjs',
32
32
  'aria-preprompt-consult.mjs',
33
+ 'aria-first-class-coach.mjs',
33
34
  'aria-trigger-autolearn.mjs',
34
35
  'aria-userprompt-abandon-detect.mjs',
35
36
  // Sub-agent handoff + ledger merge — installed 0.2.21
@@ -93,12 +94,20 @@ function packageSdkDir(): string {
93
94
  // dev install.
94
95
  const HOOKS_BLOCK = {
95
96
  SessionStart: [{
96
- hooks: [{
97
- type: 'command',
98
- command: 'HOOK_EVENT_NAME=SessionStart node $HOME/.claude/hooks/aria-harness-via-sdk.mjs --mode session',
99
- timeout: 14,
100
- statusMessage: 'Fetching Aria harness packet...',
101
- }],
97
+ hooks: [
98
+ {
99
+ type: 'command',
100
+ command: 'HOOK_EVENT_NAME=SessionStart node $HOME/.claude/hooks/aria-harness-via-sdk.mjs --mode session',
101
+ timeout: 14,
102
+ statusMessage: 'Fetching Aria harness packet...',
103
+ },
104
+ {
105
+ type: 'command',
106
+ command: 'ARIA_COACH_PLATFORM=claude HOOK_EVENT_NAME=SessionStart node $HOME/.claude/hooks/aria-first-class-coach.mjs',
107
+ timeout: 3,
108
+ statusMessage: 'Opening Aria task/project ledger...',
109
+ },
110
+ ],
102
111
  }],
103
112
  UserPromptSubmit: [{
104
113
  hooks: [
@@ -108,6 +117,12 @@ const HOOKS_BLOCK = {
108
117
  timeout: 5,
109
118
  statusMessage: 'Re-syncing Aria harness...',
110
119
  },
120
+ {
121
+ type: 'command',
122
+ command: 'ARIA_COACH_PLATFORM=claude HOOK_EVENT_NAME=UserPromptSubmit node $HOME/.claude/hooks/aria-first-class-coach.mjs',
123
+ timeout: 3,
124
+ statusMessage: 'Binding Aria task/project ledger...',
125
+ },
111
126
  {
112
127
  // Aria pre-prompt consult — fires /api/harness/delegate to get
113
128
  // Aria's substrate-grounded direction BEFORE Claude reasons,
@@ -157,6 +172,11 @@ const HOOKS_BLOCK = {
157
172
  command: 'node $HOME/.claude/hooks/aria-pre-tool-gate.mjs',
158
173
  timeout: 5,
159
174
  },
175
+ {
176
+ type: 'command',
177
+ command: 'ARIA_COACH_PLATFORM=claude HOOK_EVENT_NAME=PreToolUse node $HOME/.claude/hooks/aria-first-class-coach.mjs',
178
+ timeout: 3,
179
+ },
160
180
  {
161
181
  // Pre-turn memory consumption gate (Enforcement Layer #49).
162
182
  // Fires after the cognition gate passes. Checks the first action
@@ -179,23 +199,37 @@ const HOOKS_BLOCK = {
179
199
  // inherits owner/client-tier identity + parent ledger path.
180
200
  // Tier protection is inside the hook — client paths never touch ~/.claude/.
181
201
  matcher: 'Agent',
182
- hooks: [{
183
- type: 'command',
184
- command: 'node $HOME/.claude/hooks/aria-agent-handoff.mjs',
185
- timeout: 5,
186
- statusMessage: 'Writing sub-agent handoff...',
187
- }],
202
+ hooks: [
203
+ {
204
+ type: 'command',
205
+ command: 'node $HOME/.claude/hooks/aria-agent-handoff.mjs',
206
+ timeout: 5,
207
+ statusMessage: 'Writing sub-agent handoff...',
208
+ },
209
+ {
210
+ type: 'command',
211
+ command: 'ARIA_COACH_PLATFORM=claude HOOK_EVENT_NAME=PreToolUse node $HOME/.claude/hooks/aria-first-class-coach.mjs',
212
+ timeout: 3,
213
+ },
214
+ ],
188
215
  },
189
216
  ],
190
217
  PostToolUse: [
191
218
  {
192
219
  matcher: 'Agent',
193
- hooks: [{
194
- type: 'command',
195
- command: 'node $HOME/.claude/hooks/aria-agent-ledger-merge.mjs',
196
- timeout: 8,
197
- statusMessage: 'Merging sub-agent ledger...',
198
- }],
220
+ hooks: [
221
+ {
222
+ type: 'command',
223
+ command: 'node $HOME/.claude/hooks/aria-agent-ledger-merge.mjs',
224
+ timeout: 8,
225
+ statusMessage: 'Merging sub-agent ledger...',
226
+ },
227
+ {
228
+ type: 'command',
229
+ command: 'ARIA_COACH_PLATFORM=claude HOOK_EVENT_NAME=PostToolUse node $HOME/.claude/hooks/aria-first-class-coach.mjs',
230
+ timeout: 3,
231
+ },
232
+ ],
199
233
  },
200
234
  {
201
235
  matcher: 'Bash|Edit|Write|NotebookEdit',
@@ -213,6 +247,11 @@ const HOOKS_BLOCK = {
213
247
  command: 'node $HOME/.claude/hooks/aria-outcome-record.mjs',
214
248
  timeout: 3,
215
249
  },
250
+ {
251
+ type: 'command',
252
+ command: 'ARIA_COACH_PLATFORM=claude HOOK_EVENT_NAME=PostToolUse node $HOME/.claude/hooks/aria-first-class-coach.mjs',
253
+ timeout: 3,
254
+ },
216
255
  ],
217
256
  },
218
257
  ],
@@ -240,6 +279,11 @@ const HOOKS_BLOCK = {
240
279
  command: 'node $HOME/.claude/hooks/aria-pre-text-gate.mjs',
241
280
  timeout: 5,
242
281
  },
282
+ {
283
+ type: 'command',
284
+ command: 'ARIA_COACH_PLATFORM=claude HOOK_EVENT_NAME=Stop node $HOME/.claude/hooks/aria-first-class-coach.mjs',
285
+ timeout: 3,
286
+ },
243
287
  ],
244
288
  }],
245
289
  };