@aria_asi/cli 0.2.39 → 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.
- package/bin/aria.js +236 -34
- package/dist/aria-connector/src/action-ledger-core.d.ts +387 -0
- package/dist/aria-connector/src/action-ledger-core.d.ts.map +1 -0
- package/dist/aria-connector/src/action-ledger-core.js +638 -0
- package/dist/aria-connector/src/action-ledger-core.js.map +1 -0
- package/dist/aria-connector/src/chat.d.ts.map +1 -1
- package/dist/aria-connector/src/chat.js +5 -6
- package/dist/aria-connector/src/chat.js.map +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.d.ts +1 -0
- package/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.js +152 -14
- package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts +10 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.js +276 -27
- package/dist/aria-connector/src/connectors/codebase-awareness.js.map +1 -1
- package/dist/aria-connector/src/connectors/codex.d.ts +3 -1
- package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codex.js +1271 -40
- package/dist/aria-connector/src/connectors/codex.js.map +1 -1
- package/dist/aria-connector/src/connectors/cursor.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/cursor.js +7 -0
- package/dist/aria-connector/src/connectors/cursor.js.map +1 -1
- package/dist/aria-connector/src/connectors/governed-adapter.d.ts +30 -0
- package/dist/aria-connector/src/connectors/governed-adapter.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/governed-adapter.js +132 -0
- package/dist/aria-connector/src/connectors/governed-adapter.js.map +1 -0
- package/dist/aria-connector/src/connectors/opencode.d.ts +3 -1
- package/dist/aria-connector/src/connectors/opencode.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/opencode.js +18 -2
- package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
- package/dist/aria-connector/src/connectors/repo-guard.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/repo-guard.js +25 -14
- package/dist/aria-connector/src/connectors/repo-guard.js.map +1 -1
- package/dist/aria-connector/src/connectors/runtime.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/runtime.js +92 -2
- package/dist/aria-connector/src/connectors/runtime.js.map +1 -1
- package/dist/aria-connector/src/connectors/shell.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/shell.js +123 -7
- package/dist/aria-connector/src/connectors/shell.js.map +1 -1
- package/dist/aria-connector/src/cross-cli-hive-binding.d.ts +63 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.d.ts.map +1 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.js +205 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.js.map +1 -0
- package/dist/aria-connector/src/garden-control-plane.d.ts +6 -1
- package/dist/aria-connector/src/garden-control-plane.d.ts.map +1 -1
- package/dist/aria-connector/src/garden-control-plane.js +8 -2
- package/dist/aria-connector/src/garden-control-plane.js.map +1 -1
- package/dist/aria-connector/src/governed-surface-runner.d.ts +189 -0
- package/dist/aria-connector/src/governed-surface-runner.d.ts.map +1 -0
- package/dist/aria-connector/src/governed-surface-runner.js +1022 -0
- package/dist/aria-connector/src/governed-surface-runner.js.map +1 -0
- package/dist/aria-connector/src/index.d.ts +10 -1
- package/dist/aria-connector/src/index.d.ts.map +1 -1
- package/dist/aria-connector/src/index.js +5 -0
- package/dist/aria-connector/src/index.js.map +1 -1
- package/dist/aria-connector/src/task-runner.d.ts +3 -0
- package/dist/aria-connector/src/task-runner.d.ts.map +1 -0
- package/dist/aria-connector/src/task-runner.js +3526 -0
- package/dist/aria-connector/src/task-runner.js.map +1 -0
- package/dist/aria-web/src/lib/codebase-scanner.d.ts +21 -2
- package/dist/aria-web/src/lib/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-web/src/lib/codebase-scanner.js +59 -14
- package/dist/aria-web/src/lib/codebase-scanner.js.map +1 -1
- package/dist/assets/hooks/README.md +58 -0
- package/dist/assets/hooks/aria-agent-handoff.mjs +147 -2
- package/dist/assets/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/dist/assets/hooks/aria-architect-fallback.mjs +10 -2
- package/dist/assets/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/dist/assets/hooks/aria-first-class-coach.mjs +305 -10
- package/dist/assets/hooks/aria-harness-via-sdk.mjs +93 -16
- package/dist/assets/hooks/aria-import-resolution-gate.mjs +106 -20
- package/dist/assets/hooks/aria-outcome-record.mjs +56 -20
- package/dist/assets/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/dist/assets/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/dist/assets/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/dist/assets/hooks/aria-pre-text-gate.mjs +11 -2
- package/dist/assets/hooks/aria-pre-tool-gate.mjs +516 -92
- package/dist/assets/hooks/aria-pre-tool-use.mjs +70 -6
- package/dist/assets/hooks/aria-preprompt-consult.mjs +23 -4
- package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/dist/assets/hooks/aria-stop-gate.mjs +585 -76
- package/dist/assets/hooks/aria-trigger-autolearn.mjs +17 -3
- package/dist/assets/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/dist/assets/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/dist/assets/hooks/canonical-settings-block.json +172 -0
- package/dist/assets/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/dist/assets/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/dist/assets/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/dist/assets/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/dist/assets/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/dist/assets/hooks/codex-native/aria-stop.mjs +691 -0
- package/dist/assets/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/dist/assets/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/dist/assets/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/dist/assets/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/dist/assets/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/dist/assets/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/dist/assets/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/dist/assets/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/dist/assets/hooks/doctrine_trigger_map.json +236 -25
- package/dist/assets/hooks/doctrine_trigger_map.schema.json +46 -0
- package/dist/assets/hooks/install.sh +84 -0
- package/dist/assets/hooks/lib/action-ledger-core.mjs +269 -0
- package/dist/assets/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/dist/assets/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/dist/assets/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/dist/assets/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/dist/assets/hooks/lib/canonical-lenses.mjs +83 -6
- package/dist/assets/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/dist/assets/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/dist/assets/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/dist/assets/hooks/lib/domain-output-quality.mjs +132 -3
- package/dist/assets/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/dist/assets/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/dist/assets/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/assets/hooks/lib/first-class-coach.mjs +454 -19
- package/dist/assets/hooks/lib/gate-audit.mjs +12 -2
- package/dist/assets/hooks/lib/gate-loop-state.mjs +11 -2
- package/dist/assets/hooks/lib/goal-contract-quality.mjs +302 -0
- package/dist/assets/hooks/lib/hook-message-window.mjs +101 -9
- package/dist/assets/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/dist/assets/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/assets/hooks/lib/obligation-ledger.mjs +147 -0
- package/dist/assets/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/dist/assets/hooks/lib/owner-authorizations.mjs +269 -0
- package/dist/assets/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/dist/assets/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/dist/assets/hooks/lib/recovery-context.mjs +151 -0
- package/dist/assets/hooks/lib/recovery-template-loader.mjs +154 -0
- package/dist/assets/hooks/lib/self-doctrine-check.mjs +321 -0
- package/dist/assets/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/dist/assets/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/dist/assets/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/dist/assets/hooks/lib/surface-caught.mjs +94 -0
- package/dist/assets/hooks/recovery-templates/force-reauthor.md +67 -0
- package/dist/assets/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/dist/assets/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/dist/assets/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/dist/assets/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/dist/assets/hooks/test-tier-lens-labeling.mjs +14 -3
- package/dist/assets/opencode-plugins/harness-context/index.js +39 -6
- package/dist/assets/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
- package/dist/assets/opencode-plugins/harness-gate/index.js +36 -0
- package/dist/assets/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
- package/dist/assets/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
- package/dist/assets/opencode-plugins/harness-outcome/index.js +12 -0
- package/dist/assets/opencode-plugins/harness-stop/index.js +97 -2
- package/dist/assets/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
- package/dist/assets/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
- package/dist/assets/opencode-plugins/lib/coach.js +148 -0
- package/dist/runtime/coach-kernel.mjs +144 -7
- package/dist/runtime/codex-bridge.mjs +254 -8
- package/dist/runtime/discipline/doctrine_trigger_map.json +236 -25
- package/dist/runtime/discipline/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-chat/SKILL.md +84 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ops/SKILL.md +60 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
- package/dist/runtime/discipline/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
- package/dist/runtime/discipline/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/never-guess/SKILL.md +77 -0
- package/dist/runtime/discipline/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
- package/dist/runtime/discipline/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
- package/dist/runtime/discipline/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur/SKILL.md +506 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/tafakkur/SKILL.md +104 -0
- package/dist/runtime/doctrine_trigger_map.json +236 -25
- package/dist/runtime/embedded-public-key.mjs +27 -0
- package/dist/runtime/gated-ledger.mjs +41 -14
- package/dist/runtime/harness-daemon.mjs +85 -10
- package/dist/runtime/hive-wal-publisher.mjs +292 -0
- package/dist/runtime/hooks/README.md +58 -0
- package/dist/runtime/hooks/aria-agent-handoff.mjs +147 -2
- package/dist/runtime/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/dist/runtime/hooks/aria-architect-fallback.mjs +10 -2
- package/dist/runtime/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/dist/runtime/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/dist/runtime/hooks/aria-first-class-coach.mjs +305 -10
- package/dist/runtime/hooks/aria-harness-via-sdk.mjs +93 -16
- package/dist/runtime/hooks/aria-import-resolution-gate.mjs +106 -20
- package/dist/runtime/hooks/aria-outcome-record.mjs +56 -20
- package/dist/runtime/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/dist/runtime/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/dist/runtime/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/dist/runtime/hooks/aria-pre-text-gate.mjs +11 -2
- package/dist/runtime/hooks/aria-pre-tool-gate.mjs +516 -92
- package/dist/runtime/hooks/aria-pre-tool-use.mjs +70 -6
- package/dist/runtime/hooks/aria-preprompt-consult.mjs +23 -4
- package/dist/runtime/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/dist/runtime/hooks/aria-stop-gate.mjs +585 -76
- package/dist/runtime/hooks/aria-trigger-autolearn.mjs +17 -3
- package/dist/runtime/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/dist/runtime/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/dist/runtime/hooks/canonical-settings-block.json +172 -0
- package/dist/runtime/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/dist/runtime/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/dist/runtime/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/dist/runtime/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/dist/runtime/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/dist/runtime/hooks/codex-native/aria-stop.mjs +691 -0
- package/dist/runtime/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/dist/runtime/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/dist/runtime/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/dist/runtime/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/dist/runtime/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/dist/runtime/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/dist/runtime/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/dist/runtime/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/dist/runtime/hooks/doctrine_trigger_map.json +236 -25
- package/dist/runtime/hooks/doctrine_trigger_map.schema.json +46 -0
- package/dist/runtime/hooks/install.sh +84 -0
- package/dist/runtime/hooks/lib/action-ledger-core.mjs +269 -0
- package/dist/runtime/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/dist/runtime/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/dist/runtime/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/dist/runtime/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/dist/runtime/hooks/lib/canonical-lenses.mjs +83 -6
- package/dist/runtime/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/dist/runtime/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/dist/runtime/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/dist/runtime/hooks/lib/domain-output-quality.mjs +132 -3
- package/dist/runtime/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/dist/runtime/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/dist/runtime/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/runtime/hooks/lib/first-class-coach.mjs +454 -19
- package/dist/runtime/hooks/lib/gate-audit.mjs +12 -2
- package/dist/runtime/hooks/lib/gate-loop-state.mjs +11 -2
- package/dist/runtime/hooks/lib/goal-contract-quality.mjs +302 -0
- package/dist/runtime/hooks/lib/hook-message-window.mjs +101 -9
- package/dist/runtime/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/dist/runtime/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/runtime/hooks/lib/obligation-ledger.mjs +147 -0
- package/dist/runtime/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/dist/runtime/hooks/lib/owner-authorizations.mjs +269 -0
- package/dist/runtime/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/dist/runtime/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/dist/runtime/hooks/lib/recovery-context.mjs +151 -0
- package/dist/runtime/hooks/lib/recovery-template-loader.mjs +154 -0
- package/dist/runtime/hooks/lib/self-doctrine-check.mjs +321 -0
- package/dist/runtime/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/dist/runtime/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/dist/runtime/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/dist/runtime/hooks/lib/surface-caught.mjs +94 -0
- package/dist/runtime/hooks/recovery-templates/force-reauthor.md +67 -0
- package/dist/runtime/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/dist/runtime/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/dist/runtime/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/dist/runtime/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/dist/runtime/hooks/test-tier-lens-labeling.mjs +14 -3
- package/dist/runtime/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/runtime/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/runtime/local-phase.mjs +10 -5
- package/dist/runtime/manifest.json +8 -8
- package/dist/runtime/packet-verifier.mjs +166 -0
- package/dist/runtime/provider-proxy.mjs +13 -0
- package/dist/runtime/quality-enforcer.mjs +40 -23
- package/dist/runtime/runtime-rails/registry.mjs +252 -0
- package/dist/runtime/sdk/BUNDLED.json +2 -2
- package/dist/runtime/sdk/index.d.ts +119 -4
- package/dist/runtime/sdk/index.js +138 -12
- package/dist/runtime/sdk/index.js.map +1 -1
- package/dist/runtime/service.mjs +8036 -764
- package/dist/runtime/sub-agent-enforcer.mjs +201 -0
- package/dist/runtime/task-project-ledger.mjs +5 -1
- package/dist/sdk/BUNDLED.json +2 -2
- package/dist/sdk/index.d.ts +119 -4
- package/dist/sdk/index.js +138 -12
- package/dist/sdk/index.js.map +1 -1
- package/hooks/README.md +58 -0
- package/hooks/aria-agent-handoff.mjs +147 -2
- package/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/hooks/aria-architect-fallback.mjs +10 -2
- package/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/hooks/aria-first-class-coach.mjs +305 -10
- package/hooks/aria-harness-via-sdk.mjs +93 -16
- package/hooks/aria-import-resolution-gate.mjs +106 -20
- package/hooks/aria-outcome-record.mjs +56 -20
- package/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/hooks/aria-pre-text-gate.mjs +11 -2
- package/hooks/aria-pre-tool-gate.mjs +516 -92
- package/hooks/aria-pre-tool-use.mjs +70 -6
- package/hooks/aria-preprompt-consult.mjs +23 -4
- package/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/hooks/aria-stop-gate.mjs +585 -76
- package/hooks/aria-trigger-autolearn.mjs +17 -3
- package/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/hooks/canonical-settings-block.json +172 -0
- package/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/hooks/codex-native/aria-stop.mjs +691 -0
- package/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/hooks/doctrine_trigger_map.json +236 -25
- package/hooks/doctrine_trigger_map.schema.json +46 -0
- package/hooks/install.sh +84 -0
- package/hooks/lib/action-ledger-core.mjs +269 -0
- package/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/hooks/lib/canonical-lenses.mjs +83 -6
- package/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/hooks/lib/domain-output-quality.mjs +132 -3
- package/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/hooks/lib/first-class-coach.mjs +454 -19
- package/hooks/lib/gate-audit.mjs +12 -2
- package/hooks/lib/gate-loop-state.mjs +11 -2
- package/hooks/lib/goal-contract-quality.mjs +302 -0
- package/hooks/lib/hook-message-window.mjs +101 -9
- package/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/hooks/lib/obligation-ledger.mjs +147 -0
- package/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/hooks/lib/owner-authorizations.mjs +269 -0
- package/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/hooks/lib/recovery-context.mjs +151 -0
- package/hooks/lib/recovery-template-loader.mjs +154 -0
- package/hooks/lib/self-doctrine-check.mjs +321 -0
- package/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/hooks/lib/surface-caught.mjs +94 -0
- package/hooks/recovery-templates/force-reauthor.md +67 -0
- package/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/hooks/test-tier-lens-labeling.mjs +14 -3
- package/opencode-plugins/harness-context/index.js +39 -6
- package/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
- package/opencode-plugins/harness-gate/index.js +36 -0
- package/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
- package/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
- package/opencode-plugins/harness-outcome/index.js +12 -0
- package/opencode-plugins/harness-stop/index.js +97 -2
- package/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
- package/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
- package/opencode-plugins/lib/coach.js +148 -0
- package/package.json +71 -5
- package/runtime-src/coach-kernel.mjs +144 -7
- package/runtime-src/codex-bridge.mjs +254 -8
- package/runtime-src/embedded-public-key.mjs +27 -0
- package/runtime-src/gated-ledger.mjs +41 -14
- package/runtime-src/harness-daemon.mjs +85 -10
- package/runtime-src/hive-wal-publisher.mjs +292 -0
- package/runtime-src/lib/evaluate-with-kernel.mjs +133 -0
- package/runtime-src/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/runtime-src/local-phase.mjs +10 -5
- package/runtime-src/packet-verifier.mjs +166 -0
- package/runtime-src/provider-proxy.mjs +13 -0
- package/runtime-src/quality-enforcer.mjs +40 -23
- package/runtime-src/runtime-rails/registry.mjs +252 -0
- package/runtime-src/service.mjs +8036 -764
- package/runtime-src/sub-agent-enforcer.mjs +201 -0
- package/scripts/aria-ledger-append.mjs +337 -0
- package/scripts/aria-task-cheap-worker-dispatch.mjs +234 -0
- package/scripts/audit-of-audit-prior-tasks.mjs +194 -0
- package/scripts/audit-of-audit-this-turn.mjs +116 -0
- package/scripts/bundle-sdk.mjs +31 -5
- package/scripts/check-cli-wrapper-provider-contract.mjs +160 -0
- package/scripts/check-client-compatibility.mjs +15 -5
- package/scripts/check-client-smoke.mjs +297 -0
- package/scripts/check-codex-orchestrator-adoption.mjs +150 -0
- package/scripts/check-glm-env-wired.mjs +131 -0
- package/scripts/check-hive-local-storage-contract.mjs +91 -0
- package/scripts/check-hook-mirror.mjs +150 -0
- package/scripts/check-install-sh-drift.mjs +152 -0
- package/scripts/check-kernel-sync.mjs +101 -0
- package/scripts/check-package-artifact.mjs +152 -0
- package/scripts/check-registry-mirror.mjs +71 -0
- package/scripts/drain-owner-airtable-sync-queue.mjs +287 -0
- package/scripts/export-owner-status-sheets.mjs +589 -0
- package/scripts/live-sidecar-receipt-canary.mjs +347 -0
- package/scripts/qiyas-tadabbur-model-matrix.mjs +970 -0
- package/scripts/quality-ab-live-provider.mjs +913 -0
- package/scripts/self-test-action-ledger-core.mjs +190 -0
- package/scripts/self-test-approval-receipt-binding.mjs +122 -0
- package/scripts/self-test-autofire-quality-output.mjs +110 -0
- package/scripts/self-test-claude-code-action-ledger.mjs +132 -0
- package/scripts/self-test-claude-code-mechanical-autofire-hive.mjs +138 -0
- package/scripts/self-test-claude-code-mechanical-autofire.mjs +234 -0
- package/scripts/self-test-codebase-awareness-atlas-delta.mjs +159 -0
- package/scripts/self-test-codebase-awareness-delta-ingest.mjs +179 -0
- package/scripts/self-test-codex-live-hook-parity.mjs +84 -0
- package/scripts/self-test-codex-native-action-ledger.mjs +167 -0
- package/scripts/self-test-codex-native-hook-json-contract.mjs +74 -0
- package/scripts/self-test-codex-orchestrator-continuity.mjs +113 -0
- package/scripts/self-test-codex-readable-recovery.mjs +94 -0
- package/scripts/self-test-codex-self-harness.mjs +538 -0
- package/scripts/self-test-compiled-workunit.mjs +214 -0
- package/scripts/self-test-continuation-output-smoke.mjs +101 -0
- package/scripts/self-test-cross-cli-fleet-ticker.mjs +85 -0
- package/scripts/self-test-cross-cli-hive-adoption.mjs +125 -0
- package/scripts/self-test-cross-cli-hive-learning.mjs +146 -0
- package/scripts/self-test-cross-phase-tool-failure.mjs +110 -0
- package/scripts/self-test-cross-surface-action-ledger.mjs +149 -0
- package/scripts/self-test-end-of-phase-qa-court.mjs +616 -0
- package/scripts/self-test-evaluate-with-kernel.mjs +111 -0
- package/scripts/self-test-first-class-output-delta-proof.mjs +307 -0
- package/scripts/self-test-goal-contract-output-qa.mjs +73 -0
- package/scripts/self-test-goal-contract.mjs +35 -0
- package/scripts/self-test-governed-adapters.mjs +105 -0
- package/scripts/self-test-governed-surface-runner.mjs +198 -0
- package/scripts/self-test-harness-gates.mjs +15 -12
- package/scripts/self-test-harness-ticker-sidecar.mjs +153 -0
- package/scripts/self-test-hive-org-kernel.mjs +233 -0
- package/scripts/self-test-hive-session-coordination.mjs +156 -0
- package/scripts/self-test-hive-wal-consumer.mjs +111 -0
- package/scripts/self-test-kernel-a3-a4-selection.mjs +179 -0
- package/scripts/self-test-ledger-append.mjs +175 -0
- package/scripts/self-test-live-codex-posttool-packet-smoke.mjs +111 -0
- package/scripts/self-test-live-codex-pretool-packet-smoke.mjs +101 -0
- package/scripts/self-test-live-codex-stop-qa-kernel-smoke.mjs +43 -0
- package/scripts/self-test-live-wrapper-substrate-inventory.mjs +149 -0
- package/scripts/self-test-local-main-sync-script.mjs +47 -0
- package/scripts/self-test-mechanical-autofire-resolver.mjs +296 -0
- package/scripts/self-test-no-consult-cognitive-skills-output.mjs +135 -0
- package/scripts/self-test-owner-airtable-sync-queue.mjs +196 -0
- package/scripts/self-test-owner-airtable-sync.mjs +181 -0
- package/scripts/self-test-owner-sheets-action-ledger.mjs +100 -0
- package/scripts/self-test-production-preflight.mjs +78 -0
- package/scripts/self-test-project-boundary-cognition.mjs +79 -0
- package/scripts/self-test-qa-exec-kernel.mjs +34 -0
- package/scripts/self-test-qa-recovery-learning-loop.mjs +113 -0
- package/scripts/self-test-qiyas-label-alignment.mjs +94 -0
- package/scripts/self-test-recovery-context.mjs +110 -0
- package/scripts/self-test-repo-guard.mjs +10 -0
- package/scripts/self-test-runtime-health-self-heal.mjs +161 -0
- package/scripts/self-test-runtime-postcondition.mjs +70 -0
- package/scripts/self-test-soul-precommit-hook.mjs +39 -0
- package/scripts/self-test-stop-gate-kernel-guards.mjs +185 -0
- package/scripts/self-test-stop-gate.mjs +128 -0
- package/scripts/self-test-substrate-kernel-execution-receipt.mjs +130 -0
- package/scripts/self-test-substrate-open-skill-floor.mjs +87 -0
- package/scripts/self-test-substrate-output-quality-eval.mjs +171 -0
- package/scripts/self-test-task-closeout-drift.mjs +97 -0
- package/scripts/self-test-task-project-ledger-readiness.mjs +43 -0
- package/scripts/self-test-task-runner-phase-consumer.mjs +134 -0
- package/scripts/self-test-task-worker-lane.mjs +256 -0
- package/scripts/self-test-turn-substrate-qa-kernel.mjs +188 -0
- package/scripts/self-test-universal-action-capture.mjs +153 -0
- package/scripts/self-test-universal-turn-packet-entrypoints.mjs +252 -0
- package/scripts/self-test-universal-turn-packet.mjs +320 -0
- package/scripts/session-quality-backfill.mjs +253 -0
- package/scripts/smoke-autofire-100-prompts.mjs +481 -0
- package/scripts/sync-local-main-on-task-complete.mjs +278 -0
- package/scripts/sync-owner-status-airtable.mjs +1158 -0
- package/scripts/validate-skill-prompts.mjs +12 -1
- package/scripts/verify-codex-native-mirror.mjs +262 -0
- package/skills/34-frameworks-unified/SKILL.md +42 -0
- package/skills/api-design/SKILL.md +123 -0
- package/skills/architecture-decision/SKILL.md +105 -0
- package/skills/aria-aristotle-cognitives/SKILL.md +128 -0
- package/skills/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/skills/aria-aristotle-post-phase/SKILL.md +116 -0
- package/skills/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/skills/aria-axioms-first-principles/SKILL.md +202 -0
- package/skills/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/skills/aria-axioms-first-principles/references/source-map.md +130 -0
- package/skills/aria-chat/SKILL.md +84 -0
- package/skills/aria-chat/scripts/aria-chat.sh +57 -0
- package/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
- package/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
- package/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
- package/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
- package/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
- package/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
- package/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
- package/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
- package/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
- package/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
- package/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
- package/skills/aria-cognition/aria-chat/SKILL.md +84 -0
- package/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
- package/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
- package/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
- package/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
- package/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
- package/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
- package/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
- package/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
- package/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
- package/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
- package/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
- package/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
- package/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
- package/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
- package/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
- package/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
- package/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
- package/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
- package/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
- package/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
- package/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
- package/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
- package/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
- package/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
- package/skills/aria-cognition/aria-ops/SKILL.md +60 -0
- package/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
- package/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
- package/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
- package/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
- package/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
- package/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
- package/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
- package/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
- package/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
- package/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
- package/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
- package/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
- package/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
- package/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
- package/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
- package/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
- package/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
- package/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
- package/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
- package/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
- package/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
- package/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
- package/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
- package/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
- package/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
- package/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
- package/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
- package/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
- package/skills/aria-cognition/never-guess/SKILL.md +77 -0
- package/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
- package/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
- package/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
- package/skills/aria-cognition/tadabbur/SKILL.md +506 -0
- package/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
- package/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
- package/skills/aria-cognition/tafakkur/SKILL.md +104 -0
- package/skills/aria-cognition-autofire/SKILL.md +109 -0
- package/skills/aria-cognition-batch/SKILL.md +264 -0
- package/skills/aria-conversational-doctrine-discipline/SKILL.md +125 -0
- package/skills/aria-essence/SKILL.md +81 -0
- package/skills/aria-essence/references/domain-matrix.md +80 -0
- package/skills/aria-essence/references/evolution-loop.md +30 -0
- package/skills/aria-essence/references/readable-cognition.md +27 -0
- package/skills/aria-first-class-operating-contract/SKILL.md +104 -0
- package/skills/aria-forge-guardrails/SKILL.md +53 -0
- package/skills/aria-forge-guardrails/references/checklist.md +31 -0
- package/skills/aria-harness-deploy/SKILL.md +145 -0
- package/skills/aria-harness-no-stripping/SKILL.md +135 -0
- package/skills/aria-harness-onboarding/SKILL.md +130 -0
- package/skills/aria-harness-output-discipline/SKILL.md +120 -0
- package/skills/aria-harness-substrate-binding/SKILL.md +139 -0
- package/skills/aria-http-harness-client/SKILL.md +85 -0
- package/skills/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/skills/aria-k8s-deploy/SKILL.md +174 -0
- package/skills/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/skills/aria-ladduniframe/SKILL.md +60 -0
- package/skills/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/skills/aria-live-ops/SKILL.md +54 -0
- package/skills/aria-mac-ssh-ops/SKILL.md +100 -0
- package/skills/aria-memory-index/SKILL.md +42 -0
- package/skills/aria-noor-cognitives/SKILL.md +120 -0
- package/skills/aria-ops/SKILL.md +60 -0
- package/skills/aria-ops/references/live-endpoints.md +59 -0
- package/skills/aria-quality-audit/SKILL.md +133 -0
- package/skills/aria-reasoning/SKILL.md +67 -0
- package/skills/aria-reasoning/references/core-principles.md +42 -0
- package/skills/aria-repo-doctrine/SKILL.md +57 -0
- package/skills/aria-soul-principles/SKILL.md +42 -0
- package/skills/aria-task-codex-executor/SKILL.md +86 -0
- package/skills/aristotle-engine/SKILL.md +42 -0
- package/skills/ci-cd-pipeline/SKILL.md +116 -0
- package/skills/code-review/SKILL.md +131 -0
- package/skills/cross-domain-24/SKILL.md +42 -0
- package/skills/database-design/SKILL.md +124 -0
- package/skills/deepsoul-emotional/SKILL.md +42 -0
- package/skills/deno-kv-raft-pubsub/SKILL.md +561 -0
- package/skills/deno-kv-raft-pubsub/reference/maelstrom-integration.md +393 -0
- package/skills/deno-kv-raft-pubsub/reference/pubsub-api.md +376 -0
- package/skills/deno-kv-raft-pubsub/reference/raft-spec.md +402 -0
- package/skills/deno-kv-raft-pubsub/reference/state-machine.md +182 -0
- package/skills/error-handling/SKILL.md +159 -0
- package/skills/firecrawl/SKILL.md +165 -0
- package/skills/firecrawl/rules/install.md +82 -0
- package/skills/firecrawl/rules/security.md +26 -0
- package/skills/firecrawl-agent/SKILL.md +86 -0
- package/skills/firecrawl-build-interact/SKILL.md +96 -0
- package/skills/firecrawl-build-onboarding/SKILL.md +131 -0
- package/skills/firecrawl-build-onboarding/references/auth-flow.md +39 -0
- package/skills/firecrawl-build-onboarding/references/project-setup.md +20 -0
- package/skills/firecrawl-build-onboarding/references/sdk-installation.md +17 -0
- package/skills/firecrawl-build-scrape/SKILL.md +97 -0
- package/skills/firecrawl-build-search/SKILL.md +97 -0
- package/skills/firecrawl-clone/SKILL.md +419 -0
- package/skills/firecrawl-crawl/SKILL.md +87 -0
- package/skills/firecrawl-download/SKILL.md +98 -0
- package/skills/firecrawl-interact/SKILL.md +112 -0
- package/skills/firecrawl-map/SKILL.md +79 -0
- package/skills/firecrawl-scrape/SKILL.md +97 -0
- package/skills/firecrawl-search/SKILL.md +88 -0
- package/skills/fitrah-guard/SKILL.md +78 -0
- package/skills/forge-quality-rules/SKILL.md +61 -0
- package/skills/ghazali-8lens/SKILL.md +56 -0
- package/skills/ijtihad-novel/SKILL.md +42 -0
- package/skills/ilham-intuition/SKILL.md +42 -0
- package/skills/imagegen/LICENSE.txt +201 -0
- package/skills/imagegen/SKILL.md +374 -0
- package/skills/imagegen/agents/openai.yaml +6 -0
- package/skills/imagegen/assets/imagegen-small.svg +5 -0
- package/skills/imagegen/assets/imagegen.png +0 -0
- package/skills/imagegen/references/cli.md +242 -0
- package/skills/imagegen/references/codex-network.md +33 -0
- package/skills/imagegen/references/image-api.md +90 -0
- package/skills/imagegen/references/prompting.md +118 -0
- package/skills/imagegen/references/sample-prompts.md +433 -0
- package/skills/imagegen/scripts/image_gen.py +995 -0
- package/skills/imagegen/scripts/remove_chroma_key.py +440 -0
- package/skills/istiqra-induction/SKILL.md +44 -0
- package/skills/ladunni-22/SKILL.md +53 -0
- package/skills/mizan/SKILL.md +90 -0
- package/skills/nadia/SKILL.md +56 -0
- package/skills/nadia-psi/SKILL.md +56 -0
- package/skills/never-guess/SKILL.md +75 -0
- package/skills/noor-recognition/SKILL.md +45 -0
- package/skills/observability/SKILL.md +133 -0
- package/skills/openai-docs/LICENSE.txt +201 -0
- package/skills/openai-docs/SKILL.md +100 -0
- package/skills/openai-docs/agents/openai.yaml +14 -0
- package/skills/openai-docs/assets/openai-small.svg +3 -0
- package/skills/openai-docs/assets/openai.png +0 -0
- package/skills/openai-docs/references/latest-model.md +37 -0
- package/skills/openai-docs/references/prompting-guide.md +244 -0
- package/skills/openai-docs/references/upgrade-guide.md +181 -0
- package/skills/openai-docs/scripts/resolve-latest-model-info.js +147 -0
- package/skills/pdf/LICENSE.txt +201 -0
- package/skills/pdf/SKILL.md +85 -0
- package/skills/pdf/agents/openai.yaml +5 -0
- package/skills/pdf/assets/pdf.png +0 -0
- package/skills/playwright/LICENSE.txt +201 -0
- package/skills/playwright/NOTICE.txt +14 -0
- package/skills/playwright/SKILL.md +165 -0
- package/skills/playwright/agents/openai.yaml +6 -0
- package/skills/playwright/assets/playwright-small.svg +3 -0
- package/skills/playwright/assets/playwright.png +0 -0
- package/skills/playwright/references/cli.md +116 -0
- package/skills/playwright/references/workflows.md +95 -0
- package/skills/playwright/scripts/playwright_cli.sh +25 -0
- package/skills/plugin-creator/SKILL.md +178 -0
- package/skills/plugin-creator/agents/openai.yaml +6 -0
- package/skills/plugin-creator/assets/plugin-creator-small.svg +3 -0
- package/skills/plugin-creator/assets/plugin-creator.png +0 -0
- package/skills/plugin-creator/references/plugin-json-spec.md +170 -0
- package/skills/plugin-creator/scripts/create_basic_plugin.py +301 -0
- package/skills/predictor/SKILL.md +43 -0
- package/skills/qiyas-analogy/SKILL.md +204 -0
- package/skills/refactoring/SKILL.md +137 -0
- package/skills/ruh-basis/SKILL.md +42 -0
- package/skills/security-review/SKILL.md +129 -0
- package/skills/skill-creator/SKILL.md +434 -0
- package/skills/skill-creator/agents/openai.yaml +5 -0
- package/skills/skill-creator/assets/skill-creator-small.svg +3 -0
- package/skills/skill-creator/assets/skill-creator.png +0 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/references/openai_yaml.md +49 -0
- package/skills/skill-creator/scripts/generate_openai_yaml.py +226 -0
- package/skills/skill-creator/scripts/init_skill.py +400 -0
- package/skills/skill-creator/scripts/quick_validate.py +101 -0
- package/skills/skill-installer/LICENSE.txt +202 -0
- package/skills/skill-installer/SKILL.md +76 -0
- package/skills/skill-installer/agents/openai.yaml +5 -0
- package/skills/skill-installer/assets/skill-installer-small.svg +3 -0
- package/skills/skill-installer/assets/skill-installer.png +0 -0
- package/skills/skill-installer/scripts/github_utils.py +21 -0
- package/skills/skill-installer/scripts/install-skill-from-github.py +308 -0
- package/skills/skill-installer/scripts/list-skills.py +107 -0
- package/skills/skills-and-hooks-reference/SKILL.md +196 -0
- package/skills/soul-domains/SKILL.md +43 -0
- package/skills/tadabbur/SKILL.md +232 -0
- package/skills/tadabbur-ops/SKILL.md +42 -0
- package/skills/tafakkur/SKILL.md +104 -0
- package/skills/testing-strategy/SKILL.md +122 -0
- package/src/action-ledger-core.ts +1054 -0
- package/src/chat.ts +5 -6
- package/src/codebase-scanner.ts +2 -0
- package/src/connectors/claude-code.ts +149 -12
- package/src/connectors/codebase-awareness.ts +325 -25
- package/src/connectors/codex.ts +1273 -40
- package/src/connectors/cursor.ts +8 -0
- package/src/connectors/governed-adapter.ts +174 -0
- package/src/connectors/opencode.ts +18 -2
- package/src/connectors/repo-guard.ts +24 -12
- package/src/connectors/runtime.ts +99 -2
- package/src/connectors/shell.ts +125 -7
- package/src/cross-cli-hive-binding.ts +290 -0
- package/src/garden-control-plane.ts +24 -1
- package/src/governed-surface-runner.ts +1227 -0
- package/src/index.ts +104 -1
- package/src/task-runner.ts +3794 -0
- package/dist/aria-connector/src/install-hooks.d.ts +0 -18
- package/dist/aria-connector/src/install-hooks.d.ts.map +0 -1
- package/dist/aria-connector/src/install-hooks.js +0 -224
- package/dist/aria-connector/src/install-hooks.js.map +0 -1
- package/dist/aria-connector/src/onboarding-wizard.d.ts +0 -5
- package/dist/aria-connector/src/onboarding-wizard.d.ts.map +0 -1
- package/dist/aria-connector/src/onboarding-wizard.js +0 -188
- package/dist/aria-connector/src/onboarding-wizard.js.map +0 -1
- package/dist/cli-0.2.38.tgz +0 -0
- package/dist/install.sh +0 -13
- package/src/__tests__/anthropic-oauth.test.ts +0 -186
- package/src/__tests__/auth-commands.test.ts +0 -132
- package/src/__tests__/owner-login.test.ts +0 -311
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# Senior Code Audit Cookbook — Pre-commit Audit + Recovery Grant Patterns
|
|
2
|
+
|
|
3
|
+
> Loaded by `aria-senior-code-audit` for post-write code review with recovery-grant contracts.
|
|
4
|
+
> See also: [`../../aria-senior-code-cookbook/references/engineering-cookbook.md`](../../aria-senior-code-cookbook/references/engineering-cookbook.md) (function contracts, idempotency, observability, security)
|
|
5
|
+
> See also: [`../../aria-repo-audit/references/repo-audit-cookbook.md`](../../aria-repo-audit/references/repo-audit-cookbook.md) (severity × blast radius, finding categories)
|
|
6
|
+
|
|
7
|
+
## 1. The 7-Category Audit Checklist (run all 7)
|
|
8
|
+
|
|
9
|
+
### A. Contract correctness
|
|
10
|
+
- [ ] Function signature matches cookbook contract (validate → log → idempotency → side-effect → log exit)
|
|
11
|
+
- [ ] Return shape is `Result<Ok, Err>` (or equivalent typed discriminated union) where the function can fail
|
|
12
|
+
- [ ] Error kinds enumerated in central errors taxonomy (not invented inline)
|
|
13
|
+
- [ ] Async functions handle cancellation / timeout where applicable
|
|
14
|
+
- [ ] Public surface (`index.ts`) only re-exports — no logic at the package boundary
|
|
15
|
+
- [ ] Function name matches semantic convention (`getX` throws on not-found, `findX` returns null, `tryX` returns Result)
|
|
16
|
+
|
|
17
|
+
### B. Failure mode coverage
|
|
18
|
+
- [ ] Every error kind has a designed return path (not a swallowed exception)
|
|
19
|
+
- [ ] Idempotency key declared for any side-effecting POST
|
|
20
|
+
- [ ] Retries (if any) bounded by attempt count + backoff (NOT deadline-based timeout per `feedback_no_timeouts_decision_tree_rule`)
|
|
21
|
+
- [ ] Rate-limit responses carry `Retry-After`
|
|
22
|
+
- [ ] Tenant ID enforced at query layer (not application layer)
|
|
23
|
+
|
|
24
|
+
### C. Tests
|
|
25
|
+
- [ ] Test file co-located with code (`<name>.test.ts` next to `<name>.ts`)
|
|
26
|
+
- [ ] One test per error kind in the taxonomy
|
|
27
|
+
- [ ] Happy path test
|
|
28
|
+
- [ ] Boundary inputs tested (empty, null, oversized, malformed)
|
|
29
|
+
- [ ] Side effects mocked at the adapter seam, not at the network library
|
|
30
|
+
|
|
31
|
+
### D. Observability
|
|
32
|
+
- [ ] Structured log on entry with `customer_id` / `tenant_id` / `trace_id`
|
|
33
|
+
- [ ] Structured log on exit with outcome
|
|
34
|
+
- [ ] OpenTelemetry span wrapping the function
|
|
35
|
+
- [ ] Sensitive fields redacted (`password`, `token`, `apiKey`, `authorization`)
|
|
36
|
+
- [ ] No `console.log` in production paths
|
|
37
|
+
|
|
38
|
+
### E. Security (OWASP A01-A10:2025)
|
|
39
|
+
- [ ] Input validated at boundary with schema (zod / typebox)
|
|
40
|
+
- [ ] No string concatenation into SQL / shell / HTML — parameterized only
|
|
41
|
+
- [ ] No secrets in code; env-only with `.env.example` documentation
|
|
42
|
+
- [ ] Auth + authz checked BEFORE business logic, not after
|
|
43
|
+
- [ ] Destructive operations behind explicit confirmation OR audit-logged with actor identity
|
|
44
|
+
- [ ] CI dependency scan passes (no high-severity CVEs)
|
|
45
|
+
|
|
46
|
+
### F. Performance / cost
|
|
47
|
+
- [ ] No N+1 queries (eager-loading / dataloader)
|
|
48
|
+
- [ ] Indexes defined for predicate columns in WHERE / JOIN
|
|
49
|
+
- [ ] Cache strategy named where applicable
|
|
50
|
+
- [ ] No unbounded loops over user-controlled input
|
|
51
|
+
- [ ] Bundle / package size impact noted for FE changes
|
|
52
|
+
|
|
53
|
+
### G. Accessibility (FE only, WCAG 2.2 AA)
|
|
54
|
+
- [ ] Keyboard navigation works
|
|
55
|
+
- [ ] Focus rings preserved (no naked `outline: none`)
|
|
56
|
+
- [ ] ARIA roles / labels for non-semantic elements
|
|
57
|
+
- [ ] Color contrast ≥4.5:1 body, ≥3:1 large
|
|
58
|
+
- [ ] Target size ≥24×24 CSS pixels (WCAG 2.2 NEW)
|
|
59
|
+
- [ ] Loading / error / empty states designed
|
|
60
|
+
|
|
61
|
+
## 2. The Recovery Grant Schema v2
|
|
62
|
+
|
|
63
|
+
When findings exist, write to `~/.aria/governance-recovery-current.json` using the canonical v2 schema:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"schema": "aria.governance_recovery_current.v2",
|
|
68
|
+
"updatedAt": "2026-05-09T20:00:00.000Z",
|
|
69
|
+
"deliveryRule": "This file is injected into the next system prompt. Execute recoveryLoop.nextStep before any completion claim.",
|
|
70
|
+
"ok": true,
|
|
71
|
+
"decision": "warn",
|
|
72
|
+
"source": "aria-senior-code-audit",
|
|
73
|
+
"governanceMode": "recovery-required",
|
|
74
|
+
"gateType": "escalating",
|
|
75
|
+
"sla": {
|
|
76
|
+
"target_response_seconds": 900,
|
|
77
|
+
"started_at": "2026-05-09T20:00:00.000Z"
|
|
78
|
+
},
|
|
79
|
+
"recoveryLoop": {
|
|
80
|
+
"fingerprint": "audit_<sha256-of-findings>",
|
|
81
|
+
"allowedRecoveryAttempts": 1,
|
|
82
|
+
"priorRecoveryAttempts": 0,
|
|
83
|
+
"remainingRecoveryAttempts": 1,
|
|
84
|
+
"nextStep": "Apply listed findings, run verification probe, re-emit corrected diff with proof.",
|
|
85
|
+
"architectFallback": "If findings cannot be resolved with one self-executed pass, escalate to architect harness with the finding fingerprint."
|
|
86
|
+
},
|
|
87
|
+
"recoveryContract": {
|
|
88
|
+
"loadSkillsFirst": [
|
|
89
|
+
"aria-senior-code-cookbook",
|
|
90
|
+
"aria-repo-doctrine",
|
|
91
|
+
"aria-forge-guardrails"
|
|
92
|
+
],
|
|
93
|
+
"repairRecoveryCycle": [
|
|
94
|
+
"Add Result<Ok, Err> return type to src/handlers/leads.ts:47 — currently throws on stripe error",
|
|
95
|
+
"Add idempotency check at src/handlers/leads.ts:62 — side effect without dedup",
|
|
96
|
+
"Add test for rate_limited branch in src/handlers/leads.test.ts",
|
|
97
|
+
"Add structured log redaction for 'apiKey' in src/lib/log.ts"
|
|
98
|
+
],
|
|
99
|
+
"retest": "npm test -- src/handlers/leads.test.ts && tsc --noEmit && npx eslint src/handlers/leads.ts",
|
|
100
|
+
"fallbackWhenAriaUnavailable": "Run findings sequentially; verify each with named probe; commit only after all pass"
|
|
101
|
+
},
|
|
102
|
+
"policy_recall_required": [
|
|
103
|
+
"memory:feedback_no_graceful_degradation.md",
|
|
104
|
+
"memory:feedback_doctrine_first.md"
|
|
105
|
+
],
|
|
106
|
+
"priorReflections": [
|
|
107
|
+
{
|
|
108
|
+
"schema": "aria.coach_reflection.v1",
|
|
109
|
+
"at": "2026-05-09T18:30:00.000Z",
|
|
110
|
+
"skill": "aria-senior-code-audit",
|
|
111
|
+
"fingerprint": "audit_abc123",
|
|
112
|
+
"plan": "applied 3 findings; ran probe",
|
|
113
|
+
"outcome": "probe passed but new finding emerged",
|
|
114
|
+
"evaluation": "partial",
|
|
115
|
+
"rootCauseHypothesis": "error taxonomy not propagated to nested handler",
|
|
116
|
+
"alternativeHypothesis": "load aria-backend-architect first; map taxonomy across handler tree"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"findings": [
|
|
120
|
+
{
|
|
121
|
+
"severity": "high",
|
|
122
|
+
"category": "contract",
|
|
123
|
+
"file": "src/handlers/leads.ts",
|
|
124
|
+
"line": 47,
|
|
125
|
+
"rule": "function-returns-result-not-throws",
|
|
126
|
+
"summary": "Stripe error path throws instead of returning typed error",
|
|
127
|
+
"fix": "Wrap in try/catch; return err({ kind: 'stripe_error', reason: classifyStripeError(e) })"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 3. The Recovery Execution Flow (load-bearing primitive)
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
1. AUDIT FIRES post-write → produces findings list
|
|
137
|
+
2. RECOVERY CONTRACT WRITTEN to ~/.aria/governance-recovery-current.json
|
|
138
|
+
- Schema v2 + fingerprint + nextStep + repairRecoveryCycle
|
|
139
|
+
- gateType: escalating (most pass; criticals route to review)
|
|
140
|
+
- SLA: 900 seconds default
|
|
141
|
+
3. COACH KERNEL EVENT recorded:
|
|
142
|
+
recordCoachPhase({
|
|
143
|
+
phase: 'audit_findings',
|
|
144
|
+
risk_class: 'code_audit',
|
|
145
|
+
decision: 'taught',
|
|
146
|
+
reasons: [findings...],
|
|
147
|
+
next_action: 'execute recovery contract'
|
|
148
|
+
})
|
|
149
|
+
4. NEXT-TURN SUBSTRATE delivers recovery block via recovery-context.mjs
|
|
150
|
+
5. LLM EXECUTES the repairRecoveryCycle items
|
|
151
|
+
6. VERIFICATION PROBE runs (retest field)
|
|
152
|
+
7. PICKUP ARCHIVED via archiveRecoveryAfterPickup(pickupId)
|
|
153
|
+
8. COACH KERNEL EVENT recorded:
|
|
154
|
+
recordCoachPhase({
|
|
155
|
+
phase: 'recovery_executed',
|
|
156
|
+
decision: 'verified',
|
|
157
|
+
probe_outcome: 'pass'
|
|
158
|
+
})
|
|
159
|
+
9. REFLECTION recorded if partial/fail (Reflexion pattern):
|
|
160
|
+
recordReflection({
|
|
161
|
+
plan: ..., outcome: ..., evaluation: 'partial',
|
|
162
|
+
alternativeHypothesis: ... // for next trial
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
If probe fails on retry:
|
|
166
|
+
- priorRecoveryAttempts++
|
|
167
|
+
- Surface failure to owner
|
|
168
|
+
- Escalate to architect harness on second failure (architectFallback)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 4. Pre-commit Hook Integration
|
|
172
|
+
|
|
173
|
+
### Setup (one-time per repo)
|
|
174
|
+
```bash
|
|
175
|
+
# .githooks/pre-commit
|
|
176
|
+
#!/usr/bin/env bash
|
|
177
|
+
set -e
|
|
178
|
+
|
|
179
|
+
# Run senior-code-audit on staged changes
|
|
180
|
+
node ~/.aria/sdk/bin/aria-senior-code-audit \
|
|
181
|
+
--staged \
|
|
182
|
+
--recovery-grant-mode \
|
|
183
|
+
--severity-threshold high
|
|
184
|
+
|
|
185
|
+
# If findings exist:
|
|
186
|
+
# - Recovery contract written to ~/.aria/governance-recovery-current.json
|
|
187
|
+
# - Commit proceeds (recovery is escalating, not blocking)
|
|
188
|
+
# - Owner sees the findings + grant in commit output
|
|
189
|
+
# - Next session starts with the recovery contract loaded
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Why pre-commit, not pre-push?
|
|
193
|
+
- Pre-commit catches issues earlier (faster feedback)
|
|
194
|
+
- Pre-push is too late (PR already drafted, mental context lost)
|
|
195
|
+
- Pre-commit can be `--no-verify` bypassed by intent (audit-trail records the bypass)
|
|
196
|
+
|
|
197
|
+
### The owner override
|
|
198
|
+
If audit findings would block important work:
|
|
199
|
+
```bash
|
|
200
|
+
git commit -m "wip: ..." # finds and grants recovery; commit proceeds (gateType: escalating)
|
|
201
|
+
git commit -m "wip: ..." --no-verify # bypasses audit ENTIRELY; recorded in audit trail
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`--no-verify` records itself to `~/.aria/runtime/state/audit-bypass.jsonl` so owner sees the pattern over time.
|
|
205
|
+
|
|
206
|
+
## 5. The Audit Output Layout (per `aria-readable-output`)
|
|
207
|
+
|
|
208
|
+
```markdown
|
|
209
|
+
## [4 findings (1 high, 2 medium, 1 low) in src/handlers/leads.ts; recovery contract granted]
|
|
210
|
+
|
|
211
|
+
### High (must fix this turn)
|
|
212
|
+
1. **`src/handlers/leads.ts:47`** — Stripe error throws instead of returning typed error
|
|
213
|
+
- Fix: `return err({ kind: 'stripe_error', reason: classifyStripeError(e) })`
|
|
214
|
+
- Rule: `function-returns-result-not-throws`
|
|
215
|
+
|
|
216
|
+
### Medium (fix this turn or document deviation)
|
|
217
|
+
2. **`src/handlers/leads.ts:62`** — side effect without idempotency check
|
|
218
|
+
- Fix: read `idempotency.get(key)` first; cache result on success
|
|
219
|
+
- Rule: `idempotency-required-on-side-effecting-post`
|
|
220
|
+
|
|
221
|
+
3. **`src/handlers/leads.test.ts`** — missing test for rate_limited branch
|
|
222
|
+
- Fix: add test mirroring validation-error test pattern
|
|
223
|
+
- Rule: `one-test-per-error-kind`
|
|
224
|
+
|
|
225
|
+
### Low (track in backlog)
|
|
226
|
+
4. **`src/lib/log.ts`** — `apiKey` not in redact list
|
|
227
|
+
- Fix: add to pino redact array
|
|
228
|
+
- Rule: `redact-sensitive-fields`
|
|
229
|
+
|
|
230
|
+
### Recovery contract granted
|
|
231
|
+
- Written to `~/.aria/governance-recovery-current.json` (schema v2)
|
|
232
|
+
- gateType: escalating · SLA: 15min · attempt 1 of 1
|
|
233
|
+
- Next-turn substrate delivers; execute `nextStep` before any completion claim
|
|
234
|
+
- Verification probe: `npm test && tsc --noEmit && npx eslint <files>`
|
|
235
|
+
|
|
236
|
+
**Next:** apply the 3 high+medium findings, run the probe, re-emit corrected diff. Don't claim done until probe passes.
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Then `<gate>` block (collapsed) with the full findings JSON for the gate runtime to read.
|
|
240
|
+
|
|
241
|
+
## 6. The Failed-Probe Handling (Reflexion pattern)
|
|
242
|
+
|
|
243
|
+
When the verification probe fails after recovery attempt:
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
// In coach-kernel
|
|
247
|
+
recordReflection({
|
|
248
|
+
sessionId: currentSession,
|
|
249
|
+
skill: 'aria-senior-code-audit',
|
|
250
|
+
fingerprint: previousAuditFingerprint,
|
|
251
|
+
plan: 'applied 3 findings; ran npm test',
|
|
252
|
+
outcome: '2 of 3 findings landed; rate_limited test still fails because mock returns wrong shape',
|
|
253
|
+
evaluation: 'partial',
|
|
254
|
+
rootCauseHypothesis: 'mock setup pattern not in cookbook; LLM defaulted to wrong shape',
|
|
255
|
+
alternativeHypothesis: 'load adapter-mocking pattern from engineering-cookbook §C before next attempt',
|
|
256
|
+
trialNumber: 2,
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The next turn substrate sees this reflection. The next attempt is informed by the rootCause + alternative hypothesis. This is multi-trial learning at the audit level.
|
|
261
|
+
|
|
262
|
+
### When to escalate to architect
|
|
263
|
+
After 2 failed trials on the same fingerprint:
|
|
264
|
+
- Reflection ledger shows the LLM is stuck
|
|
265
|
+
- Architect harness is invoked via `runWithGovernance()` from the harness SDK
|
|
266
|
+
- Architect harness has access to broader context, can read the full repo, can decompose the problem differently
|
|
267
|
+
- Architect produces revised recovery contract; LLM executes the new plan
|
|
268
|
+
|
|
269
|
+
## 7. Severity Calibration (avoid inflation)
|
|
270
|
+
|
|
271
|
+
**Critical** = ANY of:
|
|
272
|
+
- Cross-tenant data leak risk
|
|
273
|
+
- Authentication / authorization bypass
|
|
274
|
+
- Payment failure or duplicate charge risk
|
|
275
|
+
- Data loss without backup
|
|
276
|
+
- Public-facing 500 error in normal usage
|
|
277
|
+
- Secret exposure (key, token, password in code)
|
|
278
|
+
|
|
279
|
+
**High** = ANY of:
|
|
280
|
+
- Significant performance regression in user-facing path (>2× baseline)
|
|
281
|
+
- Missing error path that causes UX confusion
|
|
282
|
+
- Missing tests in critical-path code
|
|
283
|
+
- Drift from doctrine / cookbook in production code
|
|
284
|
+
- OWASP issue not on critical list
|
|
285
|
+
- Multi-tenant isolation at app layer instead of query layer
|
|
286
|
+
|
|
287
|
+
**Medium** = ANY of:
|
|
288
|
+
- Cookbook deviation in non-critical code
|
|
289
|
+
- Test coverage gap in non-critical path
|
|
290
|
+
- Missing observability fields
|
|
291
|
+
- Code organization / naming drift from team conventions
|
|
292
|
+
- Performance issue in non-hot path
|
|
293
|
+
|
|
294
|
+
**Low** = nits, style, naming preferences, refactor opportunities
|
|
295
|
+
|
|
296
|
+
### The calibration test
|
|
297
|
+
"Would this finding firing at 3am wake me up?"
|
|
298
|
+
- Yes → Critical
|
|
299
|
+
- During business hours, urgent → High
|
|
300
|
+
- This week → Medium
|
|
301
|
+
- Whenever → Low
|
|
302
|
+
|
|
303
|
+
## 8. The Cross-skill Integration
|
|
304
|
+
|
|
305
|
+
### Audit calls cookbook
|
|
306
|
+
Before reporting findings, audit checks against `aria-senior-code-cookbook`'s plan (if one was emitted in this session). Findings should compare actual vs planned, not actual vs ideal.
|
|
307
|
+
|
|
308
|
+
### Audit hands off to specialist skills
|
|
309
|
+
- Backend issue → handoff to `aria-backend-architect` (deeper backend cognition)
|
|
310
|
+
- Frontend issue → handoff to `aria-frontend-architect`
|
|
311
|
+
- Cross-layer issue → handoff to `aria-fullstack-orchestrator`
|
|
312
|
+
- Doctrine drift → handoff to `aria-repo-doctrine`
|
|
313
|
+
- Architecture decision → handoff to `aria-decision-mizan` (if owner-must-decide)
|
|
314
|
+
|
|
315
|
+
### Audit triggers reflection
|
|
316
|
+
Every audit run produces a reflection event (Reflexion pattern). Even successful audits — the reflection captures "what worked well" so future audits compound learning.
|
|
317
|
+
|
|
318
|
+
## 9. Audit anti-patterns
|
|
319
|
+
|
|
320
|
+
### Generic findings without file:line
|
|
321
|
+
"Add tests" — useless. "Add test for rate_limited branch in src/handlers/leads.test.ts" — actionable.
|
|
322
|
+
|
|
323
|
+
### Severity inflation
|
|
324
|
+
Calling stylistic preferences "high" erodes the signal. Stick to the calibration test.
|
|
325
|
+
|
|
326
|
+
### Findings without recovery paths
|
|
327
|
+
Complaints, not findings. Each finding has a concrete fix.
|
|
328
|
+
|
|
329
|
+
### Auditing whole repo on a small PR
|
|
330
|
+
Audit by blast radius of the diff, not the whole codebase. The repo audit skill (`aria-repo-audit`) is for sweep audits.
|
|
331
|
+
|
|
332
|
+
### Hard-blocking the commit
|
|
333
|
+
Recovery-grant pattern: commit proceeds, recovery is contracted. NEVER block commits.
|
|
334
|
+
|
|
335
|
+
### Missing the cookbook cross-check
|
|
336
|
+
Audit should compare actual against the pre-write plan when one exists. If `aria-senior-code-cookbook` produced a plan and the diff doesn't follow it, that's the dominant finding.
|
|
337
|
+
|
|
338
|
+
### Generating a 200-finding laundry list
|
|
339
|
+
Noise, not audit. Cap output at 10-15 findings; if more exist, deliver criticals + highs and explicitly defer the rest.
|
|
340
|
+
|
|
341
|
+
## 10. Audit checklist (paste-ready)
|
|
342
|
+
|
|
343
|
+
```markdown
|
|
344
|
+
## Per-PR audit
|
|
345
|
+
- [ ] Diff scanned (not whole repo)
|
|
346
|
+
- [ ] All 7 audit categories swept (Contract / Failure / Tests / Observability / Security / Perf / Accessibility)
|
|
347
|
+
- [ ] Findings have severity per calibration test
|
|
348
|
+
- [ ] Findings have file:line + rule + concrete fix
|
|
349
|
+
- [ ] Cross-checked against aria-senior-code-cookbook plan (if present)
|
|
350
|
+
|
|
351
|
+
## Recovery grant
|
|
352
|
+
- [ ] Schema v2 contract written to ~/.aria/governance-recovery-current.json
|
|
353
|
+
- [ ] gateType: escalating (most pass; criticals route)
|
|
354
|
+
- [ ] SLA: 900s default; adjust for blast radius
|
|
355
|
+
- [ ] Verification probe named (the exact command)
|
|
356
|
+
- [ ] policy_recall_required listed (memory:<file>.md identifiers)
|
|
357
|
+
- [ ] priorReflections feed-forward if available
|
|
358
|
+
|
|
359
|
+
## Coach kernel
|
|
360
|
+
- [ ] audit_findings event recorded
|
|
361
|
+
- [ ] recovery_grant event recorded
|
|
362
|
+
- [ ] Per repair: recovery_executed event with verified outcome
|
|
363
|
+
- [ ] Reflection recorded if partial/fail
|
|
364
|
+
|
|
365
|
+
## Output
|
|
366
|
+
- [ ] Readable layout (per aria-readable-output)
|
|
367
|
+
- [ ] <gate> block with full findings JSON
|
|
368
|
+
- [ ] No commit-blocking; teach + recover only
|
|
369
|
+
```
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aria-senior-code-cookbook
|
|
3
|
+
description: TRIGGER pre-code at UserPromptSubmit / pre-tool surfaces whenever the intent is to write, refactor, scaffold, or organize code — including handler / endpoint / module / package / component / hook / migration / schema / test / cron / worker / pipeline / SDK / CLI / IaC / k8s manifest. Prepends paste-ready cookbook patterns covering organization, naming, contract-first design, error taxonomy, tests, observability, and the team's load-bearing conventions BEFORE the LLM writes a line. Pairs with aria-senior-code-audit (post-write review) and aria-readable-output (output layout). Composes — does not block.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Aria Senior Code Cookbook
|
|
7
|
+
|
|
8
|
+
The cognition skill that fires BEFORE code is written. A senior team has unwritten rules — file structure, naming, error shapes, test placement, observability defaults. This skill makes those rules explicit, paste-ready, and substrate-anchored so every LLM agent (Claude / Codex / OpenCode) writes against the same priors.
|
|
9
|
+
|
|
10
|
+
## Prime Doctrine
|
|
11
|
+
|
|
12
|
+
The fastest path to senior-grade code is having the cookbook in the prompt before the first line is written, not catching bad patterns in review.
|
|
13
|
+
|
|
14
|
+
- **Organization is correctness, not aesthetic.** A handler in the wrong directory creates a 6-month coupling debt that no audit catches.
|
|
15
|
+
- **Naming is the API contract for humans.** `getUser(id)` and `findUserById(id)` are not interchangeable — they signal different failure modes (throws vs returns null).
|
|
16
|
+
- **Error shape before happy path.** Decide what the function returns under failure BEFORE writing the success branch. The error shape is the contract.
|
|
17
|
+
- **Tests next to code, not in a parallel hierarchy.** Co-located tests get maintained; far-away tests rot.
|
|
18
|
+
- **Observability is not added — it is structural.** The first line of any non-trivial function logs / traces with structured fields. Retrofitting observability is more expensive than installing it.
|
|
19
|
+
|
|
20
|
+
## Trigger Detection (pre-code surfaces)
|
|
21
|
+
|
|
22
|
+
Fire BEFORE the LLM writes code when the user prompt contains any of:
|
|
23
|
+
|
|
24
|
+
- "write a handler / endpoint / function / class / hook / component / module / service"
|
|
25
|
+
- "refactor X into Y" / "extract X" / "split this file"
|
|
26
|
+
- "scaffold a new package / app / service"
|
|
27
|
+
- "add a migration / schema change / index"
|
|
28
|
+
- "wire up tests for X"
|
|
29
|
+
- "set up observability / logging / tracing"
|
|
30
|
+
- "build a CLI / SDK / API client"
|
|
31
|
+
- Tool-call patterns matching `Edit | Write | NotebookEdit | Bash` with code-shaped diff intent
|
|
32
|
+
|
|
33
|
+
Do NOT fire on read-only ops (read, grep, glob, ls, status), on doc-only edits, or on config files unrelated to runtime contract.
|
|
34
|
+
|
|
35
|
+
## Required Workflow (paste-ready patterns)
|
|
36
|
+
|
|
37
|
+
### 1. File Organization (TypeScript / Node monorepo, the team's canonical shape)
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
package/
|
|
41
|
+
├── src/
|
|
42
|
+
│ ├── index.ts ← public surface (re-exports), nothing else
|
|
43
|
+
│ ├── types.ts ← shared types; never inline cross-module types
|
|
44
|
+
│ ├── errors.ts ← typed error classes, single source of truth
|
|
45
|
+
│ ├── handlers/
|
|
46
|
+
│ │ ├── <name>.ts ← one handler = one file; named after the route/event
|
|
47
|
+
│ │ └── <name>.test.ts ← co-located test; vitest or jest
|
|
48
|
+
│ ├── lib/
|
|
49
|
+
│ │ ├── <utility>.ts ← pure utilities, no I/O
|
|
50
|
+
│ │ └── <utility>.test.ts
|
|
51
|
+
│ ├── adapters/
|
|
52
|
+
│ │ └── <integration>.ts ← all I/O lives here; mockable seam
|
|
53
|
+
│ └── runtime/
|
|
54
|
+
│ └── server.ts ← entrypoint, wiring only, no logic
|
|
55
|
+
├── package.json
|
|
56
|
+
├── tsconfig.json
|
|
57
|
+
└── README.md ← contract + run / test / deploy
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Anti-pattern: `src/utils/helpers.ts` — "utils" and "helpers" are semantic dumping grounds. Name by what it does (`src/lib/url-canonical.ts`).
|
|
61
|
+
|
|
62
|
+
### 2. Function Contract (TypeScript)
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
/**
|
|
66
|
+
* Canonical function shape — read this before writing any non-trivial function.
|
|
67
|
+
*
|
|
68
|
+
* @param input – validated at the boundary; trust nothing from outside
|
|
69
|
+
* @returns – discriminated union: success or named failure
|
|
70
|
+
* @throws – never (this contract returns errors, doesn't throw)
|
|
71
|
+
*/
|
|
72
|
+
export async function chargeCard(
|
|
73
|
+
input: ChargeCardInput,
|
|
74
|
+
): Promise<Result<ChargeCardOk, ChargeCardError>> {
|
|
75
|
+
// 1. validate at the boundary
|
|
76
|
+
const parsed = ChargeCardInputSchema.safeParse(input);
|
|
77
|
+
if (!parsed.success) {
|
|
78
|
+
return err({ kind: 'validation', issues: parsed.error.issues });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 2. log entry with structured fields (NOT just message)
|
|
82
|
+
log.info('charge_card.start', {
|
|
83
|
+
customerId: parsed.data.customerId,
|
|
84
|
+
amount: parsed.data.amount,
|
|
85
|
+
idempotencyKey: parsed.data.idempotencyKey,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// 3. idempotency check BEFORE side effect
|
|
89
|
+
const existing = await idempotency.get(parsed.data.idempotencyKey);
|
|
90
|
+
if (existing) return ok(existing);
|
|
91
|
+
|
|
92
|
+
// 4. side effect, with named failure surface
|
|
93
|
+
try {
|
|
94
|
+
const charge = await stripe.charges.create({ /* ... */ });
|
|
95
|
+
await idempotency.set(parsed.data.idempotencyKey, charge);
|
|
96
|
+
log.info('charge_card.ok', { chargeId: charge.id });
|
|
97
|
+
return ok({ chargeId: charge.id, amount: charge.amount });
|
|
98
|
+
} catch (e) {
|
|
99
|
+
log.error('charge_card.failed', { reason: classifyStripeError(e) });
|
|
100
|
+
return err({ kind: 'stripe_error', reason: classifyStripeError(e) });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The shape is non-negotiable: validate → log entry → idempotency → side effect → log exit. Any deviation requires explicit reason in PR.
|
|
106
|
+
|
|
107
|
+
### 3. Error Taxonomy
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// errors.ts — single file, no scattered AppError subclasses
|
|
111
|
+
export type AppError =
|
|
112
|
+
| { kind: 'validation'; issues: ZodIssue[] }
|
|
113
|
+
| { kind: 'not_found'; resource: string; id: string }
|
|
114
|
+
| { kind: 'unauthorized'; reason: 'missing' | 'expired' | 'forbidden' }
|
|
115
|
+
| { kind: 'rate_limited'; retryAfterMs: number }
|
|
116
|
+
| { kind: 'stripe_error'; reason: 'card_declined' | 'network' | 'unknown' }
|
|
117
|
+
| { kind: 'database_error'; reason: string }
|
|
118
|
+
| { kind: 'internal'; reason: string };
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Each error kind is a designed surface — the FE / caller knows how to handle it. `internal` is the catch-all and triggers an alert; other kinds are expected.
|
|
122
|
+
|
|
123
|
+
### 4. Naming Conventions
|
|
124
|
+
|
|
125
|
+
| Pattern | Meaning |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `getX(id)` | throws on not-found; for required fetches |
|
|
128
|
+
| `findX(id)` | returns null/undefined on not-found; for optional fetches |
|
|
129
|
+
| `loadX(id)` | async, may hit network/cache; signals expense |
|
|
130
|
+
| `tryX(...)` | returns Result<Ok, Err>; never throws |
|
|
131
|
+
| `assertX(...)` | throws if invariant violated; for guards |
|
|
132
|
+
| `withX(...)` | higher-order; wraps a function with X behavior |
|
|
133
|
+
| `createX(...)` | returns a new instance |
|
|
134
|
+
| `applyX(...)` | mutates input |
|
|
135
|
+
| `is/has/canX` | predicate, returns boolean |
|
|
136
|
+
|
|
137
|
+
Anti-pattern: `processX` (means nothing), `handleX` (means nothing — what does it handle?), `manageX` (means nothing).
|
|
138
|
+
|
|
139
|
+
### 5. Test Shape
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
143
|
+
import { chargeCard } from './charge-card';
|
|
144
|
+
|
|
145
|
+
describe('chargeCard', () => {
|
|
146
|
+
beforeEach(() => vi.clearAllMocks());
|
|
147
|
+
|
|
148
|
+
it('returns ok on successful charge', async () => { /* ... */ });
|
|
149
|
+
|
|
150
|
+
// EVERY error kind from the taxonomy gets a test:
|
|
151
|
+
it('returns validation error on invalid input', async () => { /* ... */ });
|
|
152
|
+
it('returns existing charge on duplicate idempotency key', async () => { /* ... */ });
|
|
153
|
+
it('returns stripe_error on card declined', async () => { /* ... */ });
|
|
154
|
+
it('returns rate_limited when stripe rate limits us', async () => { /* ... */ });
|
|
155
|
+
it('logs structured fields on entry and exit', async () => { /* ... */ });
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Coverage rule: every error branch tested. Happy path tested. Boundary inputs tested. Test count typically ≥ error-kind count + 2.
|
|
160
|
+
|
|
161
|
+
### 6. Observability Defaults
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
// log.ts — structured logging, NEVER console.log
|
|
165
|
+
import pino from 'pino';
|
|
166
|
+
export const log = pino({
|
|
167
|
+
level: process.env.LOG_LEVEL ?? 'info',
|
|
168
|
+
base: { service: 'aria-soul', version: process.env.GIT_SHA },
|
|
169
|
+
redact: ['*.password', '*.token', '*.apiKey', '*.authorization'],
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// trace.ts — OpenTelemetry, every handler wrapped
|
|
173
|
+
import { trace } from '@opentelemetry/api';
|
|
174
|
+
export const tracer = trace.getTracer('aria-soul');
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
In every handler, the first wrapping concern is a span; the second is structured log. Both carry `trace_id`, `customer_id`, `tenant_id`.
|
|
178
|
+
|
|
179
|
+
### 7. React / Next.js Component Contract (FE)
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
type ButtonProps = {
|
|
183
|
+
label: string;
|
|
184
|
+
onClick: () => void;
|
|
185
|
+
variant?: 'primary' | 'secondary' | 'destructive';
|
|
186
|
+
loading?: boolean;
|
|
187
|
+
disabled?: boolean;
|
|
188
|
+
// explicitly NOT extending HTMLButtonAttributes — keep surface minimal
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export function Button({ label, onClick, variant = 'primary', loading, disabled }: ButtonProps) {
|
|
192
|
+
// accessibility built in, not retrofitted
|
|
193
|
+
return (
|
|
194
|
+
<button
|
|
195
|
+
type="button"
|
|
196
|
+
onClick={onClick}
|
|
197
|
+
disabled={disabled || loading}
|
|
198
|
+
aria-busy={loading}
|
|
199
|
+
data-variant={variant}
|
|
200
|
+
className={buttonStyles({ variant })}
|
|
201
|
+
>
|
|
202
|
+
{loading ? <Spinner /> : label}
|
|
203
|
+
</button>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Component contract rules: minimal prop surface, accessibility default, loading/disabled/error states designed not afterthought, `data-variant` for testability.
|
|
209
|
+
|
|
210
|
+
### 8. Migration / Schema Change
|
|
211
|
+
|
|
212
|
+
```sql
|
|
213
|
+
-- 2026-05-09-add-customer-tier.sql
|
|
214
|
+
-- BACKWARD COMPATIBLE: nullable column with default; old code keeps working.
|
|
215
|
+
ALTER TABLE customers ADD COLUMN tier text NOT NULL DEFAULT 'free';
|
|
216
|
+
|
|
217
|
+
-- Index AFTER column, in the same migration only if small table.
|
|
218
|
+
CREATE INDEX CONCURRENTLY idx_customers_tier ON customers (tier);
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Rules: backwards-compat additive change first (nullable / default), backfill script second, NOT-NULL constraint third migration after backfill. Never combine with feature code in same PR.
|
|
222
|
+
|
|
223
|
+
## Composition
|
|
224
|
+
|
|
225
|
+
- Calls `aria-repo-doctrine` for repo-mutation discipline
|
|
226
|
+
- Calls `aria-readable-output` for the cookbook injection layout
|
|
227
|
+
- Pairs with `aria-senior-code-audit` (post-write counterpart)
|
|
228
|
+
- Composes with `aria-frontend-architect` / `aria-backend-architect` / `aria-fullstack-orchestrator` (which determine WHAT to build; this skill governs HOW)
|
|
229
|
+
- Composes with `mizan` and `ghazali-8lens` per business-frame defaults
|
|
230
|
+
|
|
231
|
+
## User-Facing Layout (per `aria-readable-output`)
|
|
232
|
+
|
|
233
|
+
When this skill fires pre-code, the LLM emits:
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
## [Plan in one line — e.g. "Add /api/leads handler with idempotency, validation, structured logs, 4 tests"]
|
|
237
|
+
|
|
238
|
+
### Cookbook patterns this build follows
|
|
239
|
+
- File: `src/handlers/leads.ts` + `src/handlers/leads.test.ts` (co-located)
|
|
240
|
+
- Contract: validate → log entry → idempotency → side effect → log exit
|
|
241
|
+
- Errors: validation | not_found | rate_limited | database_error
|
|
242
|
+
- Tests: one per error kind + happy path + boundary input
|
|
243
|
+
- Observability: structured log + OTel span on entry; trace_id propagated
|
|
244
|
+
|
|
245
|
+
**Next:** [first concrete commit message + the file the LLM will create first]
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Then the actual code. The cookbook is the prior, not the deliverable.
|
|
249
|
+
|
|
250
|
+
## Recovery Contract (cookbook-time)
|
|
251
|
+
|
|
252
|
+
If the LLM is asked to write code that violates the cookbook (e.g., "just dump it in utils/helpers.ts"):
|
|
253
|
+
|
|
254
|
+
- Surface the violation in the plan section, not after the code is written
|
|
255
|
+
- Recommend the canonical location with one sentence of why
|
|
256
|
+
- Proceed with the canonical pattern; if the owner overrides, mark the deviation in the PR description
|
|
257
|
+
|
|
258
|
+
## First-Class Production Contract
|
|
259
|
+
|
|
260
|
+
This skill must deepen the work, not decorate it. When loaded, apply it as a production requirement:
|
|
261
|
+
|
|
262
|
+
- no placeholders, no fake fallbacks, no vague future wiring, and no cosmetic compliance
|
|
263
|
+
- real proof from the repo, runtime, tests, logs, endpoint, or owner instruction before any completion claim
|
|
264
|
+
- 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
|
|
265
|
+
- architect/ARIA console escalation when the same failure repeats twice, crosses system boundaries, or cannot be verified locally
|
|
266
|
+
- owner-visible output that states the exact state of the work: changed, verified, blocked, or needing a decision
|
|
267
|
+
|
|
268
|
+
## Self-Executing Recovery Contract
|
|
269
|
+
|
|
270
|
+
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.
|
|
271
|
+
|
|
272
|
+
- Make exactly one self-executed recovery attempt using the strongest safe local, repository, runtime, test, log, endpoint, or owner-provided evidence available.
|
|
273
|
+
- 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.
|
|
274
|
+
- 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.
|
|
275
|
+
- 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.
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
## Self-Executing Recovery Contract
|
|
279
|
+
|
|
280
|
+
If the cookbook can't be applied because the existing repo has a different convention:
|
|
281
|
+
|
|
282
|
+
- Read the existing convention via `aria-repo-doctrine` (existing patterns are the local cookbook)
|
|
283
|
+
- Match the existing convention rather than imposing this one — local consistency beats global ideal
|
|
284
|
+
- Surface the gap in the PR if the existing convention is itself a cookbook anti-pattern; recommend the migration path as a separate PR
|
|
285
|
+
|
|
286
|
+
## Why This Exists
|
|
287
|
+
|
|
288
|
+
Every senior team has a cookbook. Most are oral tradition. This skill makes ours substrate-anchored so the LLM agents (Claude / Codex / OpenCode) write against the same priors. Pairs with `aria-senior-code-audit` for the post-write check.
|