@event4u/agent-config 9.9.0 → 9.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +212 -194
- package/README.md +13 -16
- package/agents/templates/.ai-council.yml.example +481 -0
- package/agents/templates/.ai-video.xml.example +247 -0
- package/dist/agent-src/commands/agent-status.md +12 -11
- package/dist/agent-src/commands/agents/user/accept.md +115 -30
- package/dist/agent-src/commands/agents/user/delete.md +147 -0
- package/dist/agent-src/commands/agents/user/review.md +65 -28
- package/dist/agent-src/commands/agents/user/show.md +82 -29
- package/dist/agent-src/commands/agents/user/update.md +2 -2
- package/dist/agent-src/commands/agents/user.md +16 -3
- package/dist/agent-src/commands/check-current-md.md +0 -10
- package/dist/agent-src/commands/condense.md +28 -97
- package/dist/agent-src/commands/cost/report.md +7 -0
- package/dist/agent-src/commands/fix/portability.md +0 -8
- package/dist/agent-src/commands/fix/refs.md +0 -8
- package/dist/agent-src/commands/humanize.md +2 -2
- package/dist/agent-src/commands/jira-ticket.md +1 -1
- package/dist/agent-src/commands/memory/load.md +11 -0
- package/dist/agent-src/commands/optimize/skills.md +1 -1
- package/dist/agent-src/commands/pr/create.md +4 -4
- package/dist/agent-src/commands/profile/show.md +3 -3
- package/dist/agent-src/commands/rule-compliance-audit.md +5 -4
- package/dist/agent-src/commands/security-audit-config.md +1 -1
- package/dist/agent-src/commands/sync/gitignore/fix.md +1 -1
- package/dist/agent-src/commands/tdd.md +21 -0
- package/dist/agent-src/commands/team/delegate.md +2 -2
- package/dist/agent-src/commands/team-knowledge/bootstrap.md +9 -8
- package/dist/agent-src/commands/team-knowledge/consolidate.md +8 -7
- package/dist/agent-src/commands/team.md +4 -1
- package/dist/agent-src/commands/upstream-contribute.md +0 -1
- package/dist/agent-src/contexts/authority/commit-mechanics.md +7 -0
- package/dist/agent-src/contexts/authority/destructive-mechanics.md +16 -0
- package/dist/agent-src/contexts/authority/scope-mechanics.md +61 -0
- package/dist/agent-src/contexts/communication/rules-auto/reply-close-mechanics.md +20 -18
- package/dist/agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/source-of-truth-mechanics.md +9 -10
- package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +11 -0
- package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +26 -15
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -0
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +67 -37
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +1 -1
- package/dist/agent-src/contexts/execution/autonomy-examples.md +1 -1
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +7 -6
- package/dist/agent-src/contexts/execution/evidence-discipline.md +92 -77
- package/dist/agent-src/contexts/execution/orchestration-benchmark-gate.md +22 -21
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +24 -0
- package/dist/agent-src/contexts/execution/project-intelligence.md +122 -103
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +23 -21
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +5 -5
- package/dist/agent-src/contexts/execution/subagent-routing.md +11 -0
- package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +13 -13
- package/dist/agent-src/contexts/execution/subagent-steering.md +36 -34
- package/dist/agent-src/contexts/execution/toolchain-resolver.md +1 -1
- package/dist/agent-src/contexts/execution/user-memory-channels.md +189 -0
- package/dist/agent-src/contexts/execution/verification-mechanics.md +9 -0
- package/dist/agent-src/contexts/model-recommendations.md +3 -2
- package/dist/agent-src/contexts/subagent-configuration.md +3 -3
- package/dist/agent-src/ghostwriter/README.md +2 -2
- package/dist/agent-src/packs/README.md +1 -1
- package/dist/agent-src/personas/README.md +5 -5
- package/dist/agent-src/personas/_template-specialist/persona.md +3 -3
- package/dist/agent-src/personas/backend-architect.md +24 -23
- package/dist/agent-src/personas/eloquent-tamer.md +30 -30
- package/dist/agent-src/personas/frontend-engineer.md +30 -30
- package/dist/agent-src/personas/product-owner.md +41 -38
- package/dist/agent-src/personas/qa.md +13 -13
- package/dist/agent-src/personas/security-engineer.md +22 -22
- package/dist/agent-src/presets/README.md +3 -3
- package/dist/agent-src/profiles/README.md +3 -3
- package/dist/agent-src/rules/active-remediation.md +2 -2
- package/dist/agent-src/rules/artifact-engagement-recording.md +4 -4
- package/dist/agent-src/rules/ask-when-uncertain.md +0 -4
- package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
- package/dist/agent-src/rules/broken-access-control.md +4 -4
- package/dist/agent-src/rules/code-comment-discipline.md +1 -1
- package/dist/agent-src/rules/code-provenance.md +2 -2
- package/dist/agent-src/rules/commit-policy.md +4 -9
- package/dist/agent-src/rules/communication-through-line.md +5 -5
- package/dist/agent-src/rules/decision-revisit-gate.md +1 -1
- package/dist/agent-src/rules/design-fidelity.md +1 -1
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +1 -1
- package/dist/agent-src/rules/domain-adoption-policy.md +1 -1
- package/dist/agent-src/rules/domain-safety-pii.md +1 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +1 -1
- package/dist/agent-src/rules/fast-path-marker-visibility.md +43 -7
- package/dist/agent-src/rules/finance-safety-floor.md +1 -1
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +3 -3
- package/dist/agent-src/rules/history-discipline.md +1 -1
- package/dist/agent-src/rules/legal-safety-floor.md +1 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +5 -5
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +10 -8
- package/dist/agent-src/rules/media-governance-routing.md +13 -13
- package/dist/agent-src/rules/media-sync-ground-truth.md +29 -11
- package/dist/agent-src/rules/no-cheap-questions.md +7 -7
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +29 -18
- package/dist/agent-src/rules/non-destructive-by-default.md +5 -23
- package/dist/agent-src/rules/onboarding-gate.md +14 -4
- package/dist/agent-src/rules/persona-governance.md +2 -2
- package/dist/agent-src/rules/prefer-enums-over-literals.md +9 -9
- package/dist/agent-src/rules/preservation-guard.md +10 -2
- package/dist/agent-src/rules/question-not-instruction.md +1 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +6 -6
- package/dist/agent-src/rules/rule-type-governance.md +1 -1
- package/dist/agent-src/rules/scale-discipline.md +1 -1
- package/dist/agent-src/rules/scope-control.md +1 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +1 -1
- package/dist/agent-src/rules/security-sensitive-stop.md +17 -11
- package/dist/agent-src/rules/senior-engineering-discipline.md +17 -17
- package/dist/agent-src/rules/session-canary.md +1 -1
- package/dist/agent-src/rules/skill-quality.md +1 -1
- package/dist/agent-src/rules/source-confidentiality.md +21 -19
- package/dist/agent-src/rules/source-of-truth.md +6 -5
- package/dist/agent-src/rules/spreadsheet-source-quality.md +2 -2
- package/dist/agent-src/rules/strategy-safety-floor.md +1 -1
- package/dist/agent-src/rules/think-before-action.md +5 -5
- package/dist/agent-src/rules/token-budget-discipline.md +5 -3
- package/dist/agent-src/rules/token-efficiency.md +2 -2
- package/dist/agent-src/rules/untrusted-input-defense.md +4 -4
- package/dist/agent-src/rules/user-interaction.md +12 -0
- package/dist/agent-src/rules/verify-before-complete.md +4 -24
- package/dist/agent-src/skills/adversarial-review/SKILL.md +2 -2
- package/dist/agent-src/skills/agent-security-review/SKILL.md +52 -45
- package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +2 -2
- package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +20 -20
- package/dist/agent-src/skills/ai-council/SKILL.md +185 -128
- package/dist/agent-src/skills/analysis-skill-router/SKILL.md +3 -3
- package/dist/agent-src/skills/api-endpoint/SKILL.md +2 -2
- package/dist/agent-src/skills/artisan-commands/SKILL.md +2 -2
- package/dist/agent-src/skills/async-python-patterns/SKILL.md +8 -7
- package/dist/agent-src/skills/authz-review/SKILL.md +16 -15
- package/dist/agent-src/skills/aws-infrastructure/SKILL.md +5 -5
- package/dist/agent-src/skills/blade-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/bug-analyzer/SKILL.md +30 -12
- package/dist/agent-src/skills/code-intelligence/SKILL.md +0 -1
- package/dist/agent-src/skills/code-intelligence/evals/triggers.json +52 -0
- package/dist/agent-src/skills/code-review/SKILL.md +6 -6
- package/dist/agent-src/skills/command-routing/SKILL.md +5 -4
- package/dist/agent-src/skills/composer-packages/SKILL.md +2 -2
- package/dist/agent-src/skills/condense-memory/SKILL.md +43 -41
- package/dist/agent-src/skills/context-document/SKILL.md +23 -21
- package/dist/agent-src/skills/copilot-config/SKILL.md +6 -1
- package/dist/agent-src/skills/decision-record/SKILL.md +20 -18
- package/dist/agent-src/skills/design-intelligence/SKILL.md +4 -4
- package/dist/agent-src/skills/design-review/SKILL.md +15 -14
- package/dist/agent-src/skills/design-system-capture/reference/design-system-json.md +28 -25
- package/dist/agent-src/skills/devcontainer/SKILL.md +2 -2
- package/dist/agent-src/skills/docker/SKILL.md +1 -1
- package/dist/agent-src/skills/docx-authoring/evals/triggers.json +52 -0
- package/dist/agent-src/skills/emit-tickets/SKILL.md +2 -2
- package/dist/agent-src/skills/error-handling-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +2 -2
- package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +0 -1
- package/dist/agent-src/skills/evaluate-llm-feature/evals/triggers.json +52 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +21 -7
- package/dist/agent-src/skills/fe-design/SKILL.md +10 -0
- package/dist/agent-src/skills/feature-planning/SKILL.md +2 -2
- package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +3 -3
- package/dist/agent-src/skills/flux/SKILL.md +1 -1
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +13 -13
- package/dist/agent-src/skills/git-workflow/SKILL.md +33 -33
- package/dist/agent-src/skills/grafana/SKILL.md +5 -0
- package/dist/agent-src/skills/humanizer/SKILL.md +83 -66
- package/dist/agent-src/skills/humanizer/data/patterns.md +14 -14
- package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +4 -4
- package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +82 -37
- package/dist/agent-src/skills/judge-bug-hunter/SKILL.md +17 -5
- package/dist/agent-src/skills/judge-injection-defense/SKILL.md +63 -25
- package/dist/agent-src/skills/judge-security-auditor/SKILL.md +2 -0
- package/dist/agent-src/skills/judge-synthesis/SKILL.md +72 -28
- package/dist/agent-src/skills/laravel-horizon/SKILL.md +5 -0
- package/dist/agent-src/skills/laravel-mail/SKILL.md +5 -4
- package/dist/agent-src/skills/laravel-middleware/SKILL.md +5 -4
- package/dist/agent-src/skills/laravel-notifications/SKILL.md +10 -9
- package/dist/agent-src/skills/laravel-pennant/SKILL.md +1 -1
- package/dist/agent-src/skills/laravel-pulse/SKILL.md +9 -8
- package/dist/agent-src/skills/laravel-reverb/SKILL.md +6 -5
- package/dist/agent-src/skills/laravel-scheduling/SKILL.md +6 -1
- package/dist/agent-src/skills/laravel-validation/SKILL.md +12 -0
- package/dist/agent-src/skills/launch-readiness/SKILL.md +1 -1
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +7 -7
- package/dist/agent-src/skills/learning-tutor/SKILL.md +44 -43
- package/dist/agent-src/skills/learning-tutor/evals/triggers.json +52 -0
- package/dist/agent-src/skills/license-compliance-audit/SKILL.md +7 -7
- package/dist/agent-src/skills/license-compliance-borrow-check/SKILL.md +3 -3
- package/dist/agent-src/skills/license-compliance-credits/SKILL.md +4 -4
- package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +0 -1
- package/dist/agent-src/skills/memory-consolidation/SKILL.md +69 -64
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +6 -6
- package/dist/agent-src/skills/pdf-tools/evals/triggers.json +52 -0
- package/dist/agent-src/skills/performance-analysis/SKILL.md +7 -3
- package/dist/agent-src/skills/persona-improvement/SKILL.md +0 -2
- package/dist/agent-src/skills/persona-improvement/evals/triggers.json +52 -0
- package/dist/agent-src/skills/php-coder/SKILL.md +10 -0
- package/dist/agent-src/skills/prediction-pool-optimizer/SKILL.md +129 -120
- package/dist/agent-src/skills/prediction-pool-optimizer/reference/ev-fixtures.md +36 -35
- package/dist/agent-src/skills/prediction-pool-optimizer/reference/odds-and-bonus.md +45 -41
- package/dist/agent-src/skills/project-analysis-core/SKILL.md +4 -4
- package/dist/agent-src/skills/project-analysis-hypothesis-driven/SKILL.md +3 -3
- package/dist/agent-src/skills/project-analysis-react/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analysis-symfony/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analysis-zend-laminas/SKILL.md +2 -2
- package/dist/agent-src/skills/prompt-engineering-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/prompt-validator/SKILL.md +39 -39
- package/dist/agent-src/skills/quality-tools/SKILL.md +15 -15
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +55 -19
- package/dist/agent-src/skills/react-shadcn-ui/reference/registry.md +29 -27
- package/dist/agent-src/skills/readme-writing-package/SKILL.md +2 -2
- package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +25 -25
- package/dist/agent-src/skills/recursive-verification/SKILL.md +6 -5
- package/dist/agent-src/skills/refine-prompt/SKILL.md +1 -1
- package/dist/agent-src/skills/refine-ticket/SKILL.md +20 -2
- package/dist/agent-src/skills/repomix-packer/SKILL.md +1 -1
- package/dist/agent-src/skills/requesting-code-review/SKILL.md +2 -2
- package/dist/agent-src/skills/roadmap-management/SKILL.md +80 -66
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +84 -77
- package/dist/agent-src/skills/rule-refactor/SKILL.md +1 -1
- package/dist/agent-src/skills/screenshot-hygiene/evals/triggers.json +52 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +26 -9
- package/dist/agent-src/skills/security-maturity-assessment/SKILL.md +38 -16
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +14 -11
- package/dist/agent-src/skills/skill-writing/SKILL.md +9 -8
- package/dist/agent-src/skills/song-to-script/SKILL.md +93 -85
- package/dist/agent-src/skills/sql-writing/SKILL.md +2 -2
- package/dist/agent-src/skills/stakeholder-tradeoff/SKILL.md +4 -3
- package/dist/agent-src/skills/standards-from-config/SKILL.md +61 -43
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +22 -8
- package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +28 -2
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +13 -13
- package/dist/agent-src/skills/systematic-debugging/SKILL.md +22 -21
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
- package/dist/agent-src/skills/technical-specification/SKILL.md +5 -0
- package/dist/agent-src/skills/terraform/SKILL.md +2 -2
- package/dist/agent-src/skills/terragrunt/SKILL.md +8 -8
- package/dist/agent-src/skills/testing-anti-patterns/process-anti-patterns.md +1 -1
- package/dist/agent-src/skills/threat-modeling/SKILL.md +19 -13
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +0 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +9 -9
- package/dist/agent-src/skills/validate-feature-fit/SKILL.md +3 -1
- package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +4 -6
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +67 -61
- package/dist/agent-src/skills/video-director/SKILL.md +7 -7
- package/dist/agent-src/skills/worktree-lifecycle/SKILL.md +3 -3
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/contexts/knowledge-pages.md +47 -45
- package/dist/agent-src/templates/contexts/lesson-card.md +2 -2
- package/dist/agent-src/templates/contexts/tenant-boundaries.md +2 -2
- package/dist/agent-src/templates/contexts.md +1 -1
- package/dist/agent-src/templates/features.md +1 -1
- package/dist/agent-src/templates/roadmaps.md +125 -116
- package/dist/agent-src/templates/rule.md +2 -1
- package/dist/agent-src/templates/scripts/pr_risk_review.ts +0 -0
- package/dist/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/dist/agent-src/templates/scripts/tier_usage_report.ts +2 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +30 -30
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +22 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +21 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +179 -0
- package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +155 -4
- package/dist/agent-src/templates/scripts/work_engine/state.ts +21 -4
- package/dist/agent-src/user-types/README.md +8 -8
- package/dist/agent-src/user-types/galabau-field-crew.md +34 -33
- package/dist/agent-src/user-types/metalworking-shop.md +35 -34
- package/dist/agent-src/user-types/truck-driver.md +22 -20
- package/dist/cli/initRouting.js +74 -11
- package/dist/cli/initRouting.js.map +1 -1
- package/dist/cli/main.js +14 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/python/workspace_roles.js +2 -2
- package/dist/cli/python/workspace_roles.js.map +1 -1
- package/dist/cli-delegate/chunk-4SV3XGFA.js +6910 -0
- package/dist/cli-delegate/chunk-736JCWLM.js +1104 -0
- package/dist/cli-delegate/chunk-7DSAMZFU.js +356 -0
- package/dist/cli-delegate/chunk-7HQ52DHU.js +74 -0
- package/dist/cli-delegate/chunk-BJGXZNPM.js +266 -0
- package/dist/cli-delegate/chunk-FTAISGDQ.js +117 -0
- package/dist/cli-delegate/chunk-GME3Q44L.js +82 -0
- package/dist/cli-delegate/chunk-GRRPEPRN.js +336 -0
- package/dist/cli-delegate/chunk-HJ6DAJHR.js +502 -0
- package/dist/cli-delegate/chunk-IR7P7JWA.js +872 -0
- package/dist/cli-delegate/chunk-J55WI3RR.js +47 -0
- package/dist/cli-delegate/chunk-MCJYCQPF.js +35 -0
- package/dist/cli-delegate/chunk-NDJLNC6Q.js +169 -0
- package/dist/cli-delegate/chunk-OMIVVCG2.js +26 -0
- package/dist/cli-delegate/chunk-OY53J6II.js +7336 -0
- package/dist/cli-delegate/chunk-RDGRHAAB.js +259 -0
- package/dist/cli-delegate/chunk-TFG57JJM.js +1969 -0
- package/dist/cli-delegate/chunk-XX6TOPD7.js +715 -0
- package/dist/cli-delegate/chunk-YMFO6FDN.js +10603 -0
- package/dist/cli-delegate/cmd_analyze_session.js +294 -0
- package/dist/cli-delegate/cmd_conformance.js +646 -0
- package/dist/cli-delegate/cmd_converge.js +326 -0
- package/dist/cli-delegate/cmd_doctor.js +144 -0
- package/dist/cli-delegate/cmd_explain.js +2508 -0
- package/dist/cli-delegate/cmd_export.js +296 -0
- package/dist/cli-delegate/cmd_fleet.js +332 -0
- package/dist/cli-delegate/cmd_memory_get.js +3878 -0
- package/dist/cli-delegate/cmd_migrate.js +11 -0
- package/dist/cli-delegate/cmd_preflight.js +270 -0
- package/dist/cli-delegate/cmd_prune.js +444 -0
- package/dist/cli-delegate/cmd_refresh.js +28 -0
- package/dist/cli-delegate/cmd_settings_check.js +574 -0
- package/dist/cli-delegate/cmd_settings_migrate.js +223 -0
- package/dist/cli-delegate/cmd_sync.js +264 -0
- package/dist/cli-delegate/cmd_uninstall.js +656 -0
- package/dist/cli-delegate/cmd_update.js +425 -0
- package/dist/cli-delegate/cmd_upgrade.js +444 -0
- package/dist/cli-delegate/cmd_validate.js +305 -0
- package/dist/cli-delegate/cmd_versions.js +370 -0
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +100 -67
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +16 -10
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +7 -5
- package/dist/hooks/dispatch.js +186 -12
- package/dist/install/emit_host_rules_cli.js +2 -1
- package/dist/install/emit_host_rules_cli.js.map +1 -1
- package/dist/install/install.mjs +418 -378
- package/dist/install/rule_scope.js +5 -1
- package/dist/install/rule_scope.js.map +1 -1
- package/dist/install/toolDetection.js +40 -12
- package/dist/install/toolDetection.js.map +1 -1
- package/dist/install/wizard-plan.js +2 -2
- package/dist/install/wizard-plan.js.map +1 -1
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +2194 -1003
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/compile_time_toggles.js +48 -0
- package/dist/scripts/_lib/compile_time_toggles.js.map +1 -0
- package/dist/scripts/condense.js +234 -217
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/shared/userMd/utils.js +30 -0
- package/dist/shared/userMd/utils.js.map +1 -1
- package/dist/ui/assets/index-BpSQt5vm.js.map +1 -1
- package/docs/guidelines/agent-infra/api-cost-levers.md +56 -5
- package/docs/guidelines/agent-infra/simplicity-and-goal-demos.md +93 -33
- package/package.json +4 -2
- package/src/agent-src/templates/scripts/pr_risk_review.ts +0 -0
- package/src/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/src/agent-src/templates/scripts/tier_usage_report.ts +2 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +30 -30
- package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +22 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +21 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +179 -0
- package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +155 -4
- package/src/agent-src/templates/scripts/work_engine/state.ts +21 -4
- package/src/config/agent-settings.template.yml +32 -2
- package/src/config/ci-local-parity.yml +142 -0
- package/src/config/discovery/packs.yml +7 -0
- package/src/config/evaluator-budgets.json +1 -1
- package/src/config/gate-coverage.yml +127 -0
- package/src/config/pack-size-budget.json +27 -0
- package/src/config/preamble-payload-budget.json +44 -0
- package/src/install/emit_host_rules_cli.ts +2 -1
- package/src/install/rule_scope.ts +5 -1
- package/src/install/toolDetection.ts +39 -8
- package/src/install/wizard-plan.ts +2 -2
- package/src/scripts/_cli/cmd_conformance.ts +2 -1
- package/src/scripts/_cli/cmd_converge.ts +2 -1
- package/src/scripts/_cli/cmd_doctor.ts +292 -15
- package/src/scripts/_cli/cmd_export.ts +2 -1
- package/src/scripts/_cli/cmd_fleet.ts +2 -1
- package/src/scripts/_cli/cmd_migrate.ts +2 -1
- package/src/scripts/_cli/cmd_preflight.ts +2 -1
- package/src/scripts/_cli/cmd_refresh.ts +2 -1
- package/src/scripts/_cli/cmd_update.ts +2 -1
- package/src/scripts/_cli/cmd_upgrade.ts +2 -1
- package/src/scripts/_cli/cmd_versions.ts +2 -1
- package/src/scripts/_cli/detection_report.ts +480 -0
- package/src/scripts/_dispatch.bash +52 -14
- package/src/scripts/_lib/agent_user_profile.ts +381 -0
- package/src/scripts/_lib/agents_overlay.ts +9 -0
- package/src/scripts/_lib/anchor_eval.ts +311 -0
- package/src/scripts/_lib/cc_transcript.ts +316 -0
- package/src/scripts/_lib/changelog_eras.ts +103 -9
- package/src/scripts/_lib/compile_time_toggles.ts +79 -0
- package/src/scripts/_lib/confusables.ts +101 -0
- package/src/scripts/_lib/duplicate_scope_census.ts +77 -0
- package/src/scripts/_lib/environment_detector.ts +441 -0
- package/src/scripts/_lib/managed_agents_folder.ts +181 -0
- package/src/scripts/_lib/package_root.ts +72 -0
- package/src/scripts/_lib/payload_hash_drift.ts +126 -0
- package/src/scripts/_lib/preservation_migration.ts +291 -0
- package/src/scripts/_lib/retrieval_sanitize.ts +166 -2
- package/src/scripts/_lib/scan_scope.ts +115 -0
- package/src/scripts/_lib/user_global_memory_audit.ts +187 -0
- package/src/scripts/_lib/user_global_observations.ts +830 -0
- package/src/scripts/_lib/user_global_revocations.ts +110 -0
- package/src/scripts/_lib/user_memory_gate_counters.ts +291 -0
- package/src/scripts/ai_council/blind_review.ts +0 -0
- package/src/scripts/ai_council/budget_guard.ts +90 -11
- package/src/scripts/ai_council/bundler.ts +2 -2
- package/src/scripts/ai_council/clients.ts +59 -3
- package/src/scripts/ai_council/config.ts +53 -7
- package/src/scripts/ai_council/modes.ts +68 -2
- package/src/scripts/ai_council/orchestrator.ts +54 -9
- package/src/scripts/ai_council/transport_resolver.ts +331 -0
- package/src/scripts/ai_team/team_dispatch.ts +17 -6
- package/src/scripts/anchor_eval_falsify.ts +198 -0
- package/src/scripts/anchor_scoring_run.ts +239 -0
- package/src/scripts/annotate_discovery.ts +1 -65
- package/src/scripts/bench_quality_run.ts +168 -4
- package/src/scripts/cache_realization_report.ts +782 -0
- package/src/scripts/check_artefact_count_messaging.ts +5 -1
- package/src/scripts/check_augment_description_cap.ts +15 -4
- package/src/scripts/check_bundle_path_leakage.ts +10 -4
- package/src/scripts/check_ci_local_parity.ts +317 -0
- package/src/scripts/check_condensation.ts +96 -191
- package/src/scripts/check_context_paths.ts +38 -9
- package/src/scripts/check_dependency_floors.ts +153 -0
- package/src/scripts/check_gate_coverage.ts +299 -0
- package/src/scripts/check_iron_law_prominence.ts +22 -1
- package/src/scripts/check_kernel_prefix_stability.ts +0 -0
- package/src/scripts/check_no_new_legacy_path.ts +16 -6
- package/src/scripts/check_no_roadmap_refs.ts +22 -9
- package/src/scripts/check_originality_freshness.ts +167 -0
- package/src/scripts/check_pack_size.ts +188 -0
- package/src/scripts/check_preamble_payload_budget.ts +130 -0
- package/src/scripts/check_proposal.ts +0 -0
- package/src/scripts/check_references.ts +0 -1
- package/src/scripts/check_safety_floor_untouched.ts +171 -24
- package/src/scripts/check_site_links.ts +62 -3
- package/src/scripts/ci_status.ts +0 -0
- package/src/scripts/cluster_near_miss_patterns.ts +0 -0
- package/src/scripts/code_graph/build.ts +0 -0
- package/src/scripts/command_suggester/types.ts +0 -0
- package/src/scripts/compile_router.ts +10 -14
- package/src/scripts/condense.sh +3 -4
- package/src/scripts/condense.ts +247 -228
- package/src/scripts/cost/track.mjs +168 -33
- package/src/scripts/cost_summary.ts +33 -1
- package/src/scripts/council_cli.ts +51 -5
- package/src/scripts/discovery_graph.ts +0 -0
- package/src/scripts/encoding_corpus.ts +500 -0
- package/src/scripts/encoding_corpus_report.ts +216 -0
- package/src/scripts/evaluator_umbrella.sh +34 -1
- package/src/scripts/generate_index.ts +19 -2
- package/src/scripts/install-hooks.sh +2 -2
- package/src/scripts/learning_sidecar.ts +0 -0
- package/src/scripts/lint_confusables.ts +10 -72
- package/src/scripts/lint_eval_fixture_citations.ts +113 -0
- package/src/scripts/lint_featured_skills.ts +0 -0
- package/src/scripts/lint_hidden_unicode.ts +208 -0
- package/src/scripts/lint_load_context.ts +17 -5
- package/src/scripts/lint_new_skill_gate.ts +9 -3
- package/src/scripts/lint_no_python_twin_rationale.ts +17 -2
- package/src/scripts/lint_originality.ts +1 -1
- package/src/scripts/lint_skill_originality.ts +1 -1
- package/src/scripts/lint_ticket_buildable.ts +1 -1
- package/src/scripts/lint_ui_stack_bundles.ts +170 -0
- package/src/scripts/mcp_server/tools.ts +4 -4
- package/src/scripts/measure_scope_dedup.ts +224 -0
- package/src/scripts/memory_lookup.ts +0 -0
- package/src/scripts/mine_session.ts +98 -0
- package/src/scripts/orchestration_payload_hash_drift.ts +145 -0
- package/src/scripts/preamble_byte_census.ts +574 -0
- package/src/scripts/probe_skill_registration.ts +2 -2
- package/src/scripts/redact_hook_capture.ts +13 -0
- package/src/scripts/release.ts +65 -10
- package/src/scripts/router_telemetry.ts +1 -1
- package/src/scripts/second_brain_retrieval.ts +14 -4
- package/src/scripts/skill_linter.ts +5 -0
- package/src/scripts/surface-tiers.yml +2 -0
- package/src/scripts/validate_pack_yaml.ts +0 -0
- package/src/server/schemas/settings.ts +8 -0
- package/src/shared/userMd/utils.ts +31 -0
- package/dist/agent-src/rules/telegraph-speak.md +0 -87
|
@@ -109,7 +109,7 @@ export const UNLIMITED_TOKENS_FALLBACK = 16384;
|
|
|
109
109
|
// OpenAI reasoning models (o1, o3, o4 families) reject `max_tokens` and the
|
|
110
110
|
// `system` role; they require `max_completion_tokens` and accept only `user`
|
|
111
111
|
// (and `developer`) messages.
|
|
112
|
-
const _REASONING_PREFIXES: readonly string[] = ['o1', 'o3', 'o4'];
|
|
112
|
+
const _REASONING_PREFIXES: readonly string[] = ['o1', 'o3', 'o4', 'gpt-5'];
|
|
113
113
|
|
|
114
114
|
export function _is_reasoning_model(model: string): boolean {
|
|
115
115
|
const name = model.toLowerCase();
|
|
@@ -132,6 +132,38 @@ export class CliClientError extends Error {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Anthropic cache_control TTL tiers (road-to-cache-economy Phase 4).
|
|
137
|
+
* `'5m'` is the permanent default — see `prompt_cache.ttl` in
|
|
138
|
+
* `docs/contracts/ai-council-config.md` for the falsification condition
|
|
139
|
+
* that would be required before `'1h'` is ever enabled anywhere.
|
|
140
|
+
*/
|
|
141
|
+
export type PromptCacheTtl = '5m' | '1h';
|
|
142
|
+
export const DEFAULT_PROMPT_CACHE_TTL: PromptCacheTtl = '5m';
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Anthropic's cache_control ordering rule: within one request, a 1-hour
|
|
146
|
+
* breakpoint must be positioned before any 5-minute breakpoint. This
|
|
147
|
+
* client always applies the SAME configured ttl to both of its
|
|
148
|
+
* breakpoints (see `_ask_impl`), so the two are never mixed in
|
|
149
|
+
* practice — this guard exists so a future per-breakpoint ttl never
|
|
150
|
+
* regresses that invariant silently.
|
|
151
|
+
*/
|
|
152
|
+
export function assertCacheBreakpointOrder(ttls: readonly PromptCacheTtl[]): void {
|
|
153
|
+
let sawFiveMinute = false;
|
|
154
|
+
for (const ttl of ttls) {
|
|
155
|
+
if (ttl === '5m') {
|
|
156
|
+
sawFiveMinute = true;
|
|
157
|
+
} else if (ttl === '1h' && sawFiveMinute) {
|
|
158
|
+
throw new TypeError(
|
|
159
|
+
`cache_control breakpoint order violation: a '1h' breakpoint ` +
|
|
160
|
+
`followed a '5m' one (${JSON.stringify(ttls)}) — Anthropic ` +
|
|
161
|
+
`requires every 1h breakpoint before any 5m breakpoint.`,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
135
167
|
/** Normalised output from a single council member (dataclass `CouncilResponse`). */
|
|
136
168
|
export class CouncilResponse {
|
|
137
169
|
provider: string;
|
|
@@ -319,6 +351,10 @@ interface ApiClientOptions {
|
|
|
319
351
|
// unless it asks — so a single call never pays the ~1.25× write premium by
|
|
320
352
|
// surprise. Only AnthropicClient consumes this; other providers ignore it.
|
|
321
353
|
enable_prompt_cache?: boolean | undefined;
|
|
354
|
+
// TTL tier for both cache_control breakpoints (road-to-cache-economy
|
|
355
|
+
// Phase 4). Default '5m' when omitted — see `DEFAULT_PROMPT_CACHE_TTL`.
|
|
356
|
+
// Only meaningful when `enable_prompt_cache` is true.
|
|
357
|
+
prompt_cache_ttl?: PromptCacheTtl | undefined;
|
|
322
358
|
}
|
|
323
359
|
|
|
324
360
|
/** Shared ctor-options shape for the CLI clients. */
|
|
@@ -380,11 +416,17 @@ export class AnthropicClient extends ExternalAIClient {
|
|
|
380
416
|
// ApiClientOptions.enable_prompt_cache. Prevents silent activation (and the
|
|
381
417
|
// write premium) for callers that don't benefit from a shared-prefix cache.
|
|
382
418
|
private _enablePromptCache: boolean;
|
|
419
|
+
// TTL applied to BOTH cache_control breakpoints below. '5m' (the
|
|
420
|
+
// default) is never serialised on the wire — omitting `ttl` is the
|
|
421
|
+
// Anthropic API's own 5-minute default, so the default case stays
|
|
422
|
+
// byte-identical to the pre-Phase-4 request shape.
|
|
423
|
+
private _promptCacheTtl: PromptCacheTtl;
|
|
383
424
|
|
|
384
425
|
constructor(opts: ApiClientOptions = {}) {
|
|
385
426
|
super();
|
|
386
427
|
this.model = opts.model ?? DEFAULT_ANTHROPIC_MODEL;
|
|
387
428
|
this._enablePromptCache = opts.enable_prompt_cache ?? false;
|
|
429
|
+
this._promptCacheTtl = opts.prompt_cache_ttl ?? DEFAULT_PROMPT_CACHE_TTL;
|
|
388
430
|
if (opts.client !== undefined && opts.client !== null) {
|
|
389
431
|
this._client = opts.client;
|
|
390
432
|
return;
|
|
@@ -455,6 +497,18 @@ export class AnthropicClient extends ExternalAIClient {
|
|
|
455
497
|
// base_system_prompt alone is often below the model's min cacheable
|
|
456
498
|
// prefix and would never cache solo — the artefact block is where
|
|
457
499
|
// the real saving lands. Two breakpoints (≤ the 4 allowed).
|
|
500
|
+
//
|
|
501
|
+
// Both breakpoints share the SAME configured ttl (road-to-
|
|
502
|
+
// cache-economy Phase 4) — they never diverge, so the API's
|
|
503
|
+
// "1h before 5m" ordering rule can never be violated here; the
|
|
504
|
+
// assertion below is a regression guard, not a live branch.
|
|
505
|
+
// Default '5m' omits the `ttl` field entirely (Anthropic's own
|
|
506
|
+
// default), so an unconfigured member's wire shape is unchanged
|
|
507
|
+
// from before Phase 4.
|
|
508
|
+
const ttl = this._promptCacheTtl;
|
|
509
|
+
assertCacheBreakpointOrder([ttl, ttl]);
|
|
510
|
+
const cache_control: Record<string, unknown> =
|
|
511
|
+
ttl === '1h' ? { type: 'ephemeral', ttl: '1h' } : { type: 'ephemeral' };
|
|
458
512
|
const kwargs: Record<string, unknown> = this._enablePromptCache
|
|
459
513
|
? {
|
|
460
514
|
model: this.model,
|
|
@@ -463,7 +517,7 @@ export class AnthropicClient extends ExternalAIClient {
|
|
|
463
517
|
{
|
|
464
518
|
type: 'text',
|
|
465
519
|
text: system_prompt,
|
|
466
|
-
cache_control
|
|
520
|
+
cache_control,
|
|
467
521
|
},
|
|
468
522
|
],
|
|
469
523
|
messages: [
|
|
@@ -473,11 +527,13 @@ export class AnthropicClient extends ExternalAIClient {
|
|
|
473
527
|
// volatile suffix (round critiques) rides after
|
|
474
528
|
// it, so round N+1 reads the cached prefix
|
|
475
529
|
// instead of re-writing it (A3 read unlock).
|
|
530
|
+
// The volatile suffix NEVER carries cache_control
|
|
531
|
+
// — the ttl reaches only the stable prefix.
|
|
476
532
|
content: [
|
|
477
533
|
{
|
|
478
534
|
type: 'text',
|
|
479
535
|
text: stable_prompt,
|
|
480
|
-
cache_control
|
|
536
|
+
cache_control,
|
|
481
537
|
},
|
|
482
538
|
...(volatile_suffix
|
|
483
539
|
? [{ type: 'text', text: volatile_suffix }]
|
|
@@ -14,12 +14,16 @@
|
|
|
14
14
|
* Validation contract (8 rules, all enforced at load time):
|
|
15
15
|
*
|
|
16
16
|
* 1. `enabled` is a bool.
|
|
17
|
-
* 2. `defaults.mode` ∈ {`api`, `manual`, `cli`}; per-member mode
|
|
18
|
-
* set. Semantics: `api` = SDK call against a stored key (billable);
|
|
17
|
+
* 2. `defaults.mode` ∈ {`api`, `manual`, `cli`, `auto`}; per-member mode
|
|
18
|
+
* same set. Semantics: `api` = SDK call against a stored key (billable);
|
|
19
19
|
* `manual` = copy & paste — human transports prompt + reply between
|
|
20
20
|
* the agent and an external chat surface (free); `cli` = shell out to
|
|
21
21
|
* a locally-installed CLI under subscription auth (free for
|
|
22
|
-
* first-party CLIs, billable for community wrappers)
|
|
22
|
+
* first-party CLIs, billable for community wrappers); `auto` = pick
|
|
23
|
+
* per provider per invocation (cli → api → unavailable), resolved by
|
|
24
|
+
* `transport_resolver.ts`. `auto` is opt-in — it is never the shipped
|
|
25
|
+
* default, because flipping it would move an existing user's spend
|
|
26
|
+
* from per-token dollars onto subscription quota with no config edit.
|
|
23
27
|
* 3. `members.<name>` keys are restricted to the known provider set.
|
|
24
28
|
* 4. `cost_budget.*` numeric fields are >= 0.
|
|
25
29
|
* 5. Enabled members carry a non-empty `model` and `api_key_ref` when
|
|
@@ -30,7 +34,8 @@
|
|
|
30
34
|
* even if syntactically plausible.
|
|
31
35
|
* 7. Resolved `file:` key paths must have mode 0o600 (delegated to
|
|
32
36
|
* `resolve_api_key`; runs at use-time, not parse-time).
|
|
33
|
-
* 8. `binary:` is only valid when the member's effective mode is `cli
|
|
37
|
+
* 8. `binary:` is only valid when the member's effective mode is `cli` or
|
|
38
|
+
* `auto` (auto may resolve to the cli rung);
|
|
34
39
|
* `cli_call_budget.max_calls_per_day.<provider>` keys must be valid
|
|
35
40
|
* providers.
|
|
36
41
|
*
|
|
@@ -60,7 +65,7 @@ const _VALID_PROVIDERS: ReadonlySet<string> = new Set([
|
|
|
60
65
|
'xai',
|
|
61
66
|
'perplexity',
|
|
62
67
|
]);
|
|
63
|
-
const _VALID_MODES: ReadonlySet<string> = new Set(['api', 'manual', 'cli']);
|
|
68
|
+
const _VALID_MODES: ReadonlySet<string> = new Set(['api', 'manual', 'cli', 'auto']);
|
|
64
69
|
|
|
65
70
|
/**
|
|
66
71
|
* Prefixes that signal "this is a raw API key" so we refuse it loudly
|
|
@@ -362,6 +367,9 @@ export interface CostBudgetConfig {
|
|
|
362
367
|
readonly max_output_tokens: number;
|
|
363
368
|
readonly max_calls: number;
|
|
364
369
|
readonly max_total_usd: number;
|
|
370
|
+
/** Rolling 24h cap. 0 disables it — and disabling it also disables the spend
|
|
371
|
+
* ledger, since the orchestrator only appends an entry while a cap is live. */
|
|
372
|
+
readonly daily_limit_usd: number;
|
|
365
373
|
}
|
|
366
374
|
|
|
367
375
|
export interface MemberConfig {
|
|
@@ -380,6 +388,13 @@ export interface MemberConfig {
|
|
|
380
388
|
* back to deterministic config order.
|
|
381
389
|
*/
|
|
382
390
|
readonly tier: number | null;
|
|
391
|
+
/**
|
|
392
|
+
* Cache-control TTL tier for this member's Anthropic breakpoints
|
|
393
|
+
* (road-to-cache-economy Phase 4). `'5m'` is the permanent default —
|
|
394
|
+
* see `prompt_cache.ttl` in `docs/contracts/ai-council-config.md` for
|
|
395
|
+
* the falsification condition that gates ever enabling `'1h'`.
|
|
396
|
+
*/
|
|
397
|
+
readonly prompt_cache_ttl: '5m' | '1h';
|
|
383
398
|
}
|
|
384
399
|
|
|
385
400
|
/**
|
|
@@ -1591,12 +1606,14 @@ function _build_cost_budget(d: Dict): CostBudgetConfig {
|
|
|
1591
1606
|
max_output_tokens: _pyInt(_get(d, 'max_output_tokens', 200_000)),
|
|
1592
1607
|
max_calls: _pyInt(_get(d, 'max_calls', 50)),
|
|
1593
1608
|
max_total_usd: _pyFloat(_get(d, 'max_total_usd', 20.0)),
|
|
1609
|
+
daily_limit_usd: _pyFloat(_get(d, 'daily_limit_usd', 0.0)),
|
|
1594
1610
|
};
|
|
1595
1611
|
const fields: Array<[keyof CostBudgetConfig, boolean]> = [
|
|
1596
1612
|
['max_input_tokens', false],
|
|
1597
1613
|
['max_output_tokens', false],
|
|
1598
1614
|
['max_calls', false],
|
|
1599
1615
|
['max_total_usd', true],
|
|
1616
|
+
['daily_limit_usd', true],
|
|
1600
1617
|
];
|
|
1601
1618
|
for (const [fname, isFloat] of fields) {
|
|
1602
1619
|
const val = cb[fname];
|
|
@@ -1643,10 +1660,13 @@ function _build_member(
|
|
|
1643
1660
|
`members.${name}.binary must be a non-empty string when set.`,
|
|
1644
1661
|
);
|
|
1645
1662
|
}
|
|
1646
|
-
|
|
1663
|
+
// `auto` may resolve to the cli rung, so a binary override is
|
|
1664
|
+
// legitimate there too — rejecting it would make `auto` unusable for
|
|
1665
|
+
// anyone whose CLI is not on `$PATH` under its default name.
|
|
1666
|
+
if (effective_mode !== 'cli' && effective_mode !== 'auto') {
|
|
1647
1667
|
throw new CouncilConfigError(
|
|
1648
1668
|
`members.${name}.binary is only valid when the member's ` +
|
|
1649
|
-
`effective mode is 'cli' (got ${_pyRepr(effective_mode)}). Set ` +
|
|
1669
|
+
`effective mode is 'cli' or 'auto' (got ${_pyRepr(effective_mode)}). Set ` +
|
|
1650
1670
|
`\`mode: cli\` on the member or \`defaults.mode: cli\` to use ` +
|
|
1651
1671
|
`this field.`,
|
|
1652
1672
|
);
|
|
@@ -1716,6 +1736,31 @@ function _build_member(
|
|
|
1716
1736
|
}
|
|
1717
1737
|
tier = tier_raw;
|
|
1718
1738
|
}
|
|
1739
|
+
// road-to-cache-economy Phase 4: `prompt_cache` stays accepted as a
|
|
1740
|
+
// bare bool (the pre-existing, undocumented enable/disable form —
|
|
1741
|
+
// untouched here) OR as a mapping carrying `ttl`. '5m' is the
|
|
1742
|
+
// permanent default; see docs/contracts/ai-council-config.md
|
|
1743
|
+
// § Prompt cache TTL for the falsification condition on '1h'.
|
|
1744
|
+
const prompt_cache_raw = _get(cfg, 'prompt_cache', null);
|
|
1745
|
+
let prompt_cache_ttl: '5m' | '1h' = '5m';
|
|
1746
|
+
if (prompt_cache_raw !== null && prompt_cache_raw !== undefined && !_isBool(prompt_cache_raw)) {
|
|
1747
|
+
if (!_isDict(prompt_cache_raw)) {
|
|
1748
|
+
throw new CouncilConfigError(
|
|
1749
|
+
`members.${name}.prompt_cache must be a bool or a mapping ` +
|
|
1750
|
+
`(got ${_pyTypeName(prompt_cache_raw)}).`,
|
|
1751
|
+
);
|
|
1752
|
+
}
|
|
1753
|
+
const ttl_raw = _get(prompt_cache_raw, 'ttl', '5m');
|
|
1754
|
+
if (ttl_raw !== '5m' && ttl_raw !== '1h') {
|
|
1755
|
+
throw new CouncilConfigError(
|
|
1756
|
+
`members.${name}.prompt_cache.ttl must be '5m' or '1h' (got ` +
|
|
1757
|
+
`${_pyRepr(ttl_raw)}). '5m' remains the default until a ` +
|
|
1758
|
+
`pre-registered 30-debate gap sample clears 40% at ` +
|
|
1759
|
+
`>=5-minute inter-round gaps.`,
|
|
1760
|
+
);
|
|
1761
|
+
}
|
|
1762
|
+
prompt_cache_ttl = ttl_raw;
|
|
1763
|
+
}
|
|
1719
1764
|
return {
|
|
1720
1765
|
name,
|
|
1721
1766
|
enabled: member_enabled,
|
|
@@ -1726,6 +1771,7 @@ function _build_member(
|
|
|
1726
1771
|
model_ladder: ladder,
|
|
1727
1772
|
participate_low_impact: participate_raw,
|
|
1728
1773
|
tier,
|
|
1774
|
+
prompt_cache_ttl,
|
|
1729
1775
|
};
|
|
1730
1776
|
}
|
|
1731
1777
|
|
|
@@ -12,17 +12,43 @@
|
|
|
12
12
|
* - `manual` — copy-paste loop with the user as transport (free).
|
|
13
13
|
* - `cli` — shell out to a locally-installed provider CLI under the
|
|
14
14
|
* user's subscription auth. `billable=False`.
|
|
15
|
+
* - `auto` — resolve per provider per invocation (cli → api → unavailable).
|
|
16
|
+
* Accepted here as a VALUE; the concrete transport is chosen by
|
|
17
|
+
* `transport_resolver.ts`, which owns the chain and the billing
|
|
18
|
+
* classification. `manual` is never part of the auto chain.
|
|
15
19
|
*
|
|
16
20
|
* Resolution precedence — first non-empty wins:
|
|
17
21
|
*
|
|
18
22
|
* 1. Invocation flag e.g. `/council mode:manual`
|
|
19
23
|
* 2. Per-member setting `ai_council.members.<name>.mode`
|
|
20
|
-
* 3. Global setting `ai_council.mode`
|
|
24
|
+
* 3. Global setting `ai_council.mode` OR `ai_council.defaults.mode`
|
|
25
|
+
* (see `resolve_global_mode` — both shapes reach
|
|
26
|
+
* this resolver, and they must agree)
|
|
21
27
|
* 4. Built-in default `manual`
|
|
28
|
+
*
|
|
29
|
+
* ## Two distinct defaults — the reconciliation (road-to-zero-ceremony-detection)
|
|
30
|
+
*
|
|
31
|
+
* The contract used to describe a single fallback (`"api"`) while this module
|
|
32
|
+
* implemented `manual`. Both were right about different layers, and the docs
|
|
33
|
+
* conflated them. They are now named separately:
|
|
34
|
+
*
|
|
35
|
+
* - **Loader default** — when a config file omits `defaults.mode` entirely,
|
|
36
|
+
* `config.ts::_build_defaults` fills `api`. Unchanged; this is what every
|
|
37
|
+
* real config observes, because the loader always populates the key.
|
|
38
|
+
* - **Built-in fallback** — when NO layer supplies a mode at all (a settings
|
|
39
|
+
* dict handed straight to the resolver, no config file involved), the answer
|
|
40
|
+
* is `manual`, below. That is the fail-closed direction the no-silent-spend
|
|
41
|
+
* Iron Law requires: a caller who supplied no transport preference has not
|
|
42
|
+
* asked to spend money, so the free transport wins.
|
|
22
43
|
*/
|
|
23
44
|
|
|
24
|
-
export const VALID_MODES: ReadonlySet<string> = new Set(['api', 'manual', 'cli']);
|
|
45
|
+
export const VALID_MODES: ReadonlySet<string> = new Set(['api', 'manual', 'cli', 'auto']);
|
|
25
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Built-in fallback when no layer supplies a mode. `manual` — free, no key,
|
|
49
|
+
* no spend. NOT the same as the loader's `defaults.mode` default (`api`); see
|
|
50
|
+
* the module header.
|
|
51
|
+
*/
|
|
26
52
|
export const DEFAULT_MODE = 'manual';
|
|
27
53
|
|
|
28
54
|
/** Raised when a configured / invoked mode is not in `VALID_MODES`. */
|
|
@@ -72,6 +98,46 @@ function _pyReprList(items: string[]): string {
|
|
|
72
98
|
return `[${items.map((i) => _pyRepr(i)).join(', ')}]`;
|
|
73
99
|
}
|
|
74
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Extract the global transport mode from an `ai_council` block, accepting BOTH
|
|
103
|
+
* shapes the block legitimately arrives in.
|
|
104
|
+
*
|
|
105
|
+
* `council_cli.ts::_synthesize_ai_council_block` FLATTENS the loader's
|
|
106
|
+
* `defaults.mode` onto a top-level `mode` key, so the normal path presents the
|
|
107
|
+
* flat shape. But `build_members` is on the exported surface, and callers that
|
|
108
|
+
* hand it a RAW `.ai-council.yml`-shaped dict present the nested shape. Reading
|
|
109
|
+
* only the flat key silently dropped the configured default on that path and
|
|
110
|
+
* fell through to `DEFAULT_MODE`.
|
|
111
|
+
*
|
|
112
|
+
* Flat wins when both are present — it is the synthesized, already-resolved
|
|
113
|
+
* value. Returns `null` when neither shape carries a usable string, letting the
|
|
114
|
+
* precedence chain continue to the built-in.
|
|
115
|
+
*/
|
|
116
|
+
export function resolve_global_mode(
|
|
117
|
+
aiBlock: ReadonlyMap<string, unknown> | Record<string, unknown> | null | undefined,
|
|
118
|
+
): string | null {
|
|
119
|
+
if (aiBlock === null || aiBlock === undefined) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const flat = _normalise(_settingsGet(aiBlock, 'mode'));
|
|
123
|
+
if (flat !== null) {
|
|
124
|
+
return flat;
|
|
125
|
+
}
|
|
126
|
+
const defaults = _settingsGet(aiBlock, 'defaults');
|
|
127
|
+
if (defaults === null || defaults === undefined) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
if (!(defaults instanceof Map) && typeof defaults !== 'object') {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
if (Array.isArray(defaults)) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return _normalise(
|
|
137
|
+
_settingsGet(defaults as ReadonlyMap<string, unknown> | Record<string, unknown>, 'mode'),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
75
141
|
export interface ResolveModeOptions {
|
|
76
142
|
invocationMode?: string | null;
|
|
77
143
|
memberSettings?: ReadonlyMap<string, unknown> | Record<string, unknown> | null;
|
|
@@ -51,6 +51,7 @@ import type {
|
|
|
51
51
|
import {
|
|
52
52
|
estimate_cost,
|
|
53
53
|
estimate_input_tokens,
|
|
54
|
+
reprice_with_cache,
|
|
54
55
|
} from './pricing.js';
|
|
55
56
|
import type { ProjectContext } from './project_context.js';
|
|
56
57
|
import type { AdvisorPlan } from './advisors.js';
|
|
@@ -779,22 +780,34 @@ function _run_round(
|
|
|
779
780
|
spent.output += response.output_tokens;
|
|
780
781
|
let actual_usd: number | null = null;
|
|
781
782
|
if (estimates !== null && table !== null) {
|
|
782
|
-
//
|
|
783
|
-
//
|
|
784
|
-
//
|
|
785
|
-
|
|
783
|
+
// Realized cost bills the OBSERVED cache read/write tokens
|
|
784
|
+
// (Anthropic's usage.input_tokens excludes them), unlike the
|
|
785
|
+
// cache-agnostic pre-flight estimate above — see
|
|
786
|
+
// `reprice_with_cache`'s docstring for why the two stay separate.
|
|
787
|
+
// ttl is '5m': the request builder emits `cache_control:
|
|
788
|
+
// {type:'ephemeral'}` with no explicit ttl, i.e. the 5-min default.
|
|
789
|
+
const actual = reprice_with_cache(
|
|
786
790
|
member.name,
|
|
787
791
|
member.model,
|
|
788
|
-
|
|
789
|
-
|
|
792
|
+
{
|
|
793
|
+
input_tokens: response.input_tokens,
|
|
794
|
+
cache_read_input_tokens: response.cache_read_input_tokens,
|
|
795
|
+
cache_creation_input_tokens: response.cache_creation_input_tokens,
|
|
796
|
+
output_tokens: response.output_tokens,
|
|
797
|
+
},
|
|
790
798
|
table,
|
|
799
|
+
'5m',
|
|
791
800
|
);
|
|
792
801
|
actual_usd = _total_usd(actual);
|
|
793
802
|
spent.usd += _total_usd(actual);
|
|
794
803
|
// Persist to the rolling 24h ledger when the daily cap is
|
|
795
804
|
// active. Errors are swallowed inside record_spend.
|
|
796
805
|
if (budget.daily_limit_usd > 0 && !response.error) {
|
|
797
|
-
_record_daily_spend(_total_usd(actual), member.name, member.model
|
|
806
|
+
_record_daily_spend(_total_usd(actual), member.name, member.model, {
|
|
807
|
+
cache_read_input_tokens: response.cache_read_input_tokens,
|
|
808
|
+
cache_creation_input_tokens: response.cache_creation_input_tokens,
|
|
809
|
+
cache_ttl: '5m',
|
|
810
|
+
});
|
|
798
811
|
}
|
|
799
812
|
}
|
|
800
813
|
_stamp_transport_metadata(response, member, actual_usd);
|
|
@@ -1116,12 +1129,32 @@ export interface RunDebateOptions {
|
|
|
1116
1129
|
project?: ProjectContext | null;
|
|
1117
1130
|
original_ask?: string;
|
|
1118
1131
|
max_rounds?: number;
|
|
1132
|
+
/**
|
|
1133
|
+
* Third argument (road-to-cache-economy Phase 4): the observed
|
|
1134
|
+
* wall-clock gap, in ms, between the PREVIOUS round finishing (≈ when
|
|
1135
|
+
* its stable prefix was written to the prompt cache) and THIS round
|
|
1136
|
+
* starting (≈ when the same prefix would be read, if byte-identical).
|
|
1137
|
+
* `null` on round 1 — nothing was written yet. Existing callers that
|
|
1138
|
+
* declare only the first two parameters keep working unchanged (JS
|
|
1139
|
+
* ignores extra call arguments).
|
|
1140
|
+
*/
|
|
1119
1141
|
on_round_complete?:
|
|
1120
|
-
| ((
|
|
1142
|
+
| ((
|
|
1143
|
+
round_number: number,
|
|
1144
|
+
responses: CouncilResponse[],
|
|
1145
|
+
cache_gap_ms_since_previous_round?: number | null,
|
|
1146
|
+
) => void)
|
|
1121
1147
|
| null;
|
|
1122
1148
|
on_continue?: DebateContinuePrompt | null;
|
|
1123
1149
|
advisor_plans?: Map<string, AdvisorPlan> | null;
|
|
1124
1150
|
seed_round_1?: CouncilResponse[] | null;
|
|
1151
|
+
/**
|
|
1152
|
+
* Injectable wall-clock source for the Phase-4 gap measurement above.
|
|
1153
|
+
* Defaults to `Date.now`. Tests inject a scripted clock so "rounds
|
|
1154
|
+
* seconds apart" vs "a >5-minute gap" can be asserted deterministically,
|
|
1155
|
+
* without a real multi-minute sleep.
|
|
1156
|
+
*/
|
|
1157
|
+
now?: (() => number) | null;
|
|
1125
1158
|
/**
|
|
1126
1159
|
* Phase 3: when true (from `ai_council.debate_gates.enabled`), round-2+
|
|
1127
1160
|
* prompts carry the anti-conformity directive. Default `false` → the debate
|
|
@@ -1186,6 +1219,7 @@ export function run_debate(
|
|
|
1186
1219
|
const on_continue = opts.on_continue ?? null;
|
|
1187
1220
|
const advisor_plans = opts.advisor_plans ?? null;
|
|
1188
1221
|
const seed_round_1 = opts.seed_round_1 ?? null;
|
|
1222
|
+
const now = opts.now ?? Date.now;
|
|
1189
1223
|
|
|
1190
1224
|
if (max_rounds < 1) {
|
|
1191
1225
|
throw new Error(`max_rounds must be >= 1 (got ${max_rounds})`);
|
|
@@ -1207,6 +1241,9 @@ export function run_debate(
|
|
|
1207
1241
|
// per-round positions block rides in a volatile suffix (see consult loop).
|
|
1208
1242
|
let current_suffix = '';
|
|
1209
1243
|
let current_user_prompt = question.user_prompt;
|
|
1244
|
+
// road-to-cache-economy Phase 4: wall-clock marker for the inter-round
|
|
1245
|
+
// cache-gap measurement. `null` until round 1 finishes.
|
|
1246
|
+
let previous_round_end_ms: number | null = null;
|
|
1210
1247
|
|
|
1211
1248
|
// Phase 3 restate: one pre-round-1 call per member. Runs BEFORE any debate
|
|
1212
1249
|
// spend so a diverging restatement can be flagged before round-2 cost.
|
|
@@ -1231,6 +1268,9 @@ export function run_debate(
|
|
|
1231
1268
|
|
|
1232
1269
|
for (let round_idx = 0; round_idx < max_rounds; round_idx++) {
|
|
1233
1270
|
const round_number = round_idx + 1;
|
|
1271
|
+
const round_start_ms = now();
|
|
1272
|
+
const cache_gap_ms_since_previous_round: number | null =
|
|
1273
|
+
previous_round_end_ms === null ? null : round_start_ms - previous_round_end_ms;
|
|
1234
1274
|
let results: CouncilResponse[];
|
|
1235
1275
|
if (round_idx === 0 && seed_round_1 !== null) {
|
|
1236
1276
|
// Pivot from /council default — reuse the existing round 1
|
|
@@ -1276,7 +1316,7 @@ export function run_debate(
|
|
|
1276
1316
|
}
|
|
1277
1317
|
all_rounds.push(results);
|
|
1278
1318
|
if (on_round_complete !== null) {
|
|
1279
|
-
on_round_complete(round_number, results);
|
|
1319
|
+
on_round_complete(round_number, results, cache_gap_ms_since_previous_round);
|
|
1280
1320
|
}
|
|
1281
1321
|
|
|
1282
1322
|
// Prep the user-prompt for the next round so the cost estimate
|
|
@@ -1334,6 +1374,11 @@ export function run_debate(
|
|
|
1334
1374
|
}
|
|
1335
1375
|
}
|
|
1336
1376
|
}
|
|
1377
|
+
// road-to-cache-economy Phase 4: mark the end of this round AFTER the
|
|
1378
|
+
// continue-prompt gate above — an interactive pause there is exactly
|
|
1379
|
+
// the kind of real-world inter-round gap this measurement exists to
|
|
1380
|
+
// observe, so it must fall inside the window, not before it.
|
|
1381
|
+
previous_round_end_ms = now();
|
|
1337
1382
|
}
|
|
1338
1383
|
|
|
1339
1384
|
return all_rounds;
|