@event4u/agent-config 1.15.0 → 1.17.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/.agent-src/commands/{agents-audit.md → agents/audit.md} +4 -3
- package/.agent-src/commands/{agents-cleanup.md → agents/cleanup.md} +12 -6
- package/.agent-src/commands/{agents-prepare.md → agents/prepare.md} +4 -3
- package/.agent-src/commands/agents.md +46 -0
- package/.agent-src/commands/bug-fix.md +1 -1
- package/.agent-src/commands/bug-investigate.md +2 -2
- package/.agent-src/commands/{chat-history-checkpoint.md → chat-history/checkpoint.md} +5 -5
- package/.agent-src/commands/{chat-history-clear.md → chat-history/clear.md} +5 -5
- package/.agent-src/commands/{chat-history-resume.md → chat-history/resume.md} +4 -4
- package/.agent-src/commands/chat-history/show.md +107 -0
- package/.agent-src/commands/chat-history.md +33 -89
- package/.agent-src/commands/check-current-md.md +1 -1
- package/.agent-src/commands/{commit-in-chunks.md → commit/in-chunks.md} +15 -13
- package/.agent-src/commands/commit.md +22 -2
- package/.agent-src/commands/{context-create.md → context/create.md} +4 -3
- package/.agent-src/commands/{context-refactor.md → context/refactor.md} +4 -3
- package/.agent-src/commands/context.md +44 -0
- package/.agent-src/commands/{copilot-agents-init.md → copilot-agents/init.md} +4 -3
- package/.agent-src/commands/{copilot-agents-optimize.md → copilot-agents/optimize.md} +4 -3
- package/.agent-src/commands/copilot-agents.md +44 -0
- package/.agent-src/commands/council/default.md +221 -0
- package/.agent-src/commands/council/design.md +97 -0
- package/.agent-src/commands/council/optimize.md +116 -0
- package/.agent-src/commands/council/pr.md +124 -0
- package/.agent-src/commands/council.md +54 -0
- package/.agent-src/commands/{create-pr-description.md → create-pr/description-only.md} +4 -2
- package/.agent-src/commands/create-pr.md +49 -5
- package/.agent-src/commands/e2e-heal.md +1 -1
- package/.agent-src/commands/e2e-plan.md +1 -1
- package/.agent-src/commands/{feature-dev.md → feature/dev.md} +6 -3
- package/.agent-src/commands/{feature-explore.md → feature/explore.md} +5 -4
- package/.agent-src/commands/{feature-plan.md → feature/plan.md} +32 -5
- package/.agent-src/commands/{feature-refactor.md → feature/refactor.md} +4 -3
- package/.agent-src/commands/{feature-roadmap.md → feature/roadmap.md} +7 -6
- package/.agent-src/commands/feature.md +52 -0
- package/.agent-src/commands/{fix-ci.md → fix/ci.md} +4 -3
- package/.agent-src/commands/{fix-portability.md → fix/portability.md} +4 -3
- package/.agent-src/commands/{fix-pr-bot-comments.md → fix/pr-bots.md} +4 -3
- package/.agent-src/commands/{fix-pr-developer-comments.md → fix/pr-developers.md} +4 -3
- package/.agent-src/commands/{fix-pr-comments.md → fix/pr.md} +7 -6
- package/.agent-src/commands/{fix-references.md → fix/refs.md} +4 -3
- package/.agent-src/commands/{fix-seeder.md → fix/seeder.md} +4 -3
- package/.agent-src/commands/fix.md +54 -0
- package/.agent-src/commands/jira-ticket.md +1 -1
- package/.agent-src/commands/{do-and-judge.md → judge/on-diff.md} +7 -6
- package/.agent-src/commands/judge/solo.md +90 -0
- package/.agent-src/commands/{do-in-steps.md → judge/steps.md} +8 -7
- package/.agent-src/commands/judge.md +35 -70
- package/.agent-src/commands/{memory-add.md → memory/add.md} +7 -6
- package/.agent-src/commands/{memory-full.md → memory/load.md} +6 -5
- package/.agent-src/commands/{memory-promote.md → memory/promote.md} +6 -5
- package/.agent-src/commands/{propose-memory.md → memory/propose.md} +6 -5
- package/.agent-src/commands/memory.md +48 -0
- package/.agent-src/commands/mode.md +5 -5
- package/.agent-src/commands/{module-create.md → module/create.md} +4 -3
- package/.agent-src/commands/{module-explore.md → module/explore.md} +4 -3
- package/.agent-src/commands/module.md +44 -0
- package/.agent-src/commands/onboard.md +3 -3
- package/.agent-src/commands/{optimize-agents.md → optimize/agents.md} +5 -4
- package/.agent-src/commands/{optimize-augmentignore.md → optimize/augmentignore.md} +4 -4
- package/.agent-src/commands/{optimize-rtk-filters.md → optimize/rtk.md} +4 -3
- package/.agent-src/commands/{optimize-skills.md → optimize/skills.md} +5 -4
- package/.agent-src/commands/optimize.md +48 -0
- package/.agent-src/commands/{override-create.md → override/create.md} +4 -3
- package/.agent-src/commands/{override-manage.md → override/manage.md} +4 -3
- package/.agent-src/commands/override.md +44 -0
- package/.agent-src/commands/review-changes.md +26 -1
- package/.agent-src/commands/review-routing.md +1 -1
- package/.agent-src/commands/{roadmap-create.md → roadmap/create.md} +33 -5
- package/.agent-src/commands/{roadmap-execute.md → roadmap/execute.md} +4 -3
- package/.agent-src/commands/roadmap.md +44 -0
- package/.agent-src/commands/set-cost-profile.md +3 -3
- package/.agent-src/commands/sync-agent-settings.md +2 -2
- package/.agent-src/commands/{tests-create.md → tests/create.md} +5 -4
- package/.agent-src/commands/{tests-execute.md → tests/execute.md} +4 -3
- package/.agent-src/commands/tests.md +44 -0
- package/.agent-src/commands/upstream-contribute.md +1 -1
- package/.agent-src/contexts/authority/commit-mechanics.md +57 -0
- package/.agent-src/contexts/authority/destructive-mechanics.md +66 -0
- package/.agent-src/contexts/authority/scope-mechanics.md +87 -0
- package/.agent-src/contexts/communication/rules-auto/artifact-engagement-recording-mechanics.md +72 -0
- package/.agent-src/contexts/communication/rules-auto/augment-portability-mechanics.md +79 -0
- package/.agent-src/contexts/communication/rules-auto/augment-source-of-truth-mechanics.md +98 -0
- package/.agent-src/contexts/communication/rules-auto/cli-output-handling-mechanics.md +87 -0
- package/.agent-src/contexts/communication/rules-auto/command-suggestion-policy-mechanics.md +62 -0
- package/.agent-src/contexts/communication/rules-auto/docs-sync-mechanics.md +78 -0
- package/.agent-src/contexts/communication/rules-auto/package-ci-checks-mechanics.md +85 -0
- package/.agent-src/contexts/communication/rules-auto/review-routing-awareness-mechanics.md +65 -0
- package/.agent-src/contexts/communication/rules-auto/roadmap-progress-sync-mechanics.md +78 -0
- package/.agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +62 -0
- package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +55 -0
- package/.agent-src/contexts/communication/rules-auto/ui-audit-gate-mechanics.md +53 -0
- package/.agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +77 -0
- package/.agent-src/contexts/execution/autonomy-detection.md +54 -0
- package/.agent-src/contexts/execution/autonomy-examples.md +90 -0
- package/.agent-src/contexts/execution/autonomy-mechanics.md +29 -0
- package/.agent-src/contexts/execution/verification-mechanics.md +80 -0
- package/.agent-src/contexts/judges/no-consolidate-rationale.md +102 -0
- package/.agent-src/contexts/judges/persona-voice-rubric.md +140 -0
- package/.agent-src/personas/README.md +1 -1
- package/.agent-src/rules/agent-authority.md +24 -0
- package/.agent-src/rules/architecture.md +1 -1
- package/.agent-src/rules/artifact-drafting-protocol.md +1 -1
- package/.agent-src/rules/artifact-engagement-recording.md +14 -70
- package/.agent-src/rules/ask-when-uncertain.md +28 -43
- package/.agent-src/rules/augment-portability.md +15 -61
- package/.agent-src/rules/augment-source-of-truth.md +27 -93
- package/.agent-src/rules/autonomous-execution.md +78 -114
- package/.agent-src/rules/capture-learnings.md +1 -1
- package/.agent-src/rules/chat-history-cadence.md +3 -3
- package/.agent-src/rules/chat-history-ownership.md +3 -3
- package/.agent-src/rules/chat-history-visibility.md +3 -3
- package/.agent-src/rules/cli-output-handling.md +10 -76
- package/.agent-src/rules/command-suggestion-policy.md +93 -0
- package/.agent-src/rules/commit-conventions.md +17 -14
- package/.agent-src/rules/commit-policy.md +14 -42
- package/.agent-src/rules/context-hygiene.md +3 -3
- package/.agent-src/rules/direct-answers.md +34 -49
- package/.agent-src/rules/docker-commands.md +5 -5
- package/.agent-src/rules/docs-sync.md +16 -70
- package/.agent-src/rules/e2e-testing.md +1 -1
- package/.agent-src/rules/guidelines.md +4 -4
- package/.agent-src/rules/improve-before-implement.md +2 -2
- package/.agent-src/rules/language-and-tone.md +50 -133
- package/.agent-src/rules/minimal-safe-diff.md +3 -3
- package/.agent-src/rules/missing-tool-handling.md +28 -22
- package/.agent-src/rules/model-recommendation.md +4 -4
- package/.agent-src/rules/no-cheap-questions.md +82 -0
- package/.agent-src/rules/no-roadmap-references.md +73 -0
- package/.agent-src/rules/non-destructive-by-default.md +15 -49
- package/.agent-src/rules/onboarding-gate.md +5 -5
- package/.agent-src/rules/package-ci-checks.md +21 -61
- package/.agent-src/rules/preservation-guard.md +64 -29
- package/.agent-src/rules/review-routing-awareness.md +26 -45
- package/.agent-src/rules/roadmap-progress-sync.md +28 -96
- package/.agent-src/rules/role-mode-adherence.md +2 -2
- package/.agent-src/rules/scope-control.md +65 -46
- package/.agent-src/rules/security-sensitive-stop.md +9 -9
- package/.agent-src/rules/size-enforcement.md +1 -1
- package/.agent-src/rules/skill-quality.md +16 -48
- package/.agent-src/rules/{slash-commands.md → slash-command-routing-policy.md} +7 -4
- package/.agent-src/rules/think-before-action.md +55 -45
- package/.agent-src/rules/token-efficiency.md +4 -4
- package/.agent-src/rules/tool-safety.md +19 -16
- package/.agent-src/rules/{ui-audit-before-build.md → ui-audit-gate.md} +27 -41
- package/.agent-src/rules/user-interaction.md +16 -71
- package/.agent-src/rules/verify-before-complete.md +12 -67
- package/.agent-src/scripts/update_roadmap_progress.py +9 -4
- package/.agent-src/skills/ai-council/SKILL.md +335 -0
- package/.agent-src/skills/api-endpoint/SKILL.md +2 -2
- package/.agent-src/skills/api-testing/SKILL.md +1 -1
- package/.agent-src/skills/blade-ui/SKILL.md +1 -1
- package/.agent-src/skills/blast-radius-analyzer/SKILL.md +1 -1
- package/.agent-src/skills/bug-analyzer/SKILL.md +1 -1
- package/.agent-src/skills/check-refs/SKILL.md +59 -40
- package/.agent-src/skills/command-routing/SKILL.md +1 -1
- package/.agent-src/skills/command-writing/SKILL.md +1 -1
- package/.agent-src/skills/conventional-commits-writing/SKILL.md +86 -28
- package/.agent-src/skills/copilot-agents-optimization/SKILL.md +7 -7
- package/.agent-src/skills/developer-like-execution/SKILL.md +6 -6
- package/.agent-src/skills/finishing-a-development-branch/SKILL.md +101 -65
- package/.agent-src/skills/flux/SKILL.md +31 -11
- package/.agent-src/skills/git-workflow/SKILL.md +1 -1
- package/.agent-src/skills/github-ci/SKILL.md +2 -2
- package/.agent-src/skills/guideline-writing/SKILL.md +11 -11
- package/.agent-src/skills/judge-code-quality/SKILL.md +7 -8
- package/.agent-src/skills/judge-security-auditor/SKILL.md +4 -5
- package/.agent-src/skills/judge-test-coverage/SKILL.md +3 -4
- package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +4 -4
- package/.agent-src/skills/lint-skills/SKILL.md +57 -39
- package/.agent-src/skills/livewire/SKILL.md +1 -1
- package/.agent-src/skills/md-language-check/SKILL.md +61 -39
- package/.agent-src/skills/override-management/SKILL.md +7 -7
- package/.agent-src/skills/php-coder/SKILL.md +1 -1
- package/.agent-src/skills/playwright-testing/SKILL.md +2 -2
- package/.agent-src/skills/quality-tools/SKILL.md +2 -2
- package/.agent-src/skills/react-shadcn-ui/SKILL.md +116 -43
- package/.agent-src/skills/readme-reviewer/SKILL.md +31 -30
- package/.agent-src/skills/readme-writing/SKILL.md +79 -54
- package/.agent-src/skills/readme-writing-package/SKILL.md +51 -48
- package/.agent-src/skills/receiving-code-review/SKILL.md +53 -48
- package/.agent-src/skills/refine-prompt/SKILL.md +0 -1
- package/.agent-src/skills/requesting-code-review/SKILL.md +35 -30
- package/.agent-src/skills/review-routing/SKILL.md +2 -2
- package/.agent-src/skills/rule-writing/SKILL.md +1 -1
- package/.agent-src/skills/security/SKILL.md +7 -2
- package/.agent-src/skills/security-audit/SKILL.md +7 -3
- package/.agent-src/skills/skill-reviewer/SKILL.md +1 -1
- package/.agent-src/skills/skill-writing/SKILL.md +3 -3
- package/.agent-src/skills/subagent-orchestration/SKILL.md +1 -0
- package/.agent-src/skills/systematic-debugging/SKILL.md +69 -61
- package/.agent-src/skills/test-driven-development/SKILL.md +59 -57
- package/.agent-src/skills/test-performance/SKILL.md +0 -1
- package/.agent-src/skills/traefik/SKILL.md +4 -4
- package/.agent-src/skills/upstream-contribute/SKILL.md +1 -1
- package/.agent-src/skills/validate-feature-fit/SKILL.md +2 -2
- package/.agent-src/skills/{verify-before-complete → verify-completion-evidence}/SKILL.md +30 -28
- package/.agent-src/templates/agent-settings.md +8 -8
- package/.agent-src/templates/contexts/auth-model.md +1 -1
- package/.agent-src/templates/scripts/README.md +2 -2
- package/.agent-src/templates/scripts/telemetry/aggregator.py +16 -1
- package/.agent-src/templates/scripts/telemetry/engagement.py +59 -0
- package/.agent-src/templates/scripts/telemetry/report_renderer.py +28 -1
- package/.agent-src/templates/scripts/telemetry_record.py +14 -1
- package/.claude-plugin/marketplace.json +31 -12
- package/AGENTS.md +11 -9
- package/CHANGELOG.md +213 -2
- package/README.md +43 -44
- package/config/agent-settings.template.yml +58 -1
- package/config/gitignore-block.txt +3 -0
- package/docs/architecture.md +5 -7
- package/docs/catalog.md +359 -0
- package/docs/contracts/STABILITY.md +46 -1
- package/docs/contracts/adr-chat-history-split.md +1 -3
- package/docs/contracts/adr-command-suggestion.md +3 -5
- package/docs/contracts/adr-implement-ticket-runtime.md +1 -2
- package/docs/contracts/adr-product-ui-track.md +5 -8
- package/docs/contracts/adr-prompt-driven-execution.md +3 -4
- package/docs/contracts/agent-memory-contract.md +8 -13
- package/docs/contracts/artifact-engagement-flow.md +7 -10
- package/docs/contracts/command-clusters.md +56 -46
- package/docs/contracts/command-suggestion-flow.md +4 -6
- package/docs/contracts/context-paths.md +99 -0
- package/docs/contracts/file-ownership-matrix.json +6722 -0
- package/docs/contracts/file-ownership-matrix.md +134 -0
- package/docs/contracts/implement-ticket-flow.md +8 -11
- package/docs/contracts/linear-ai-rules-inclusion.md +1 -2
- package/docs/contracts/linear-ai-three-layers.md +0 -2
- package/docs/contracts/load-context-budget-model.md +178 -0
- package/docs/contracts/load-context-schema.md +184 -0
- package/docs/contracts/rule-interactions.md +0 -1
- package/docs/contracts/rule-interactions.yml +96 -0
- package/docs/contracts/rule-priority-hierarchy.md +87 -0
- package/docs/contracts/ui-track-flow.md +8 -18
- package/docs/customization.md +16 -0
- package/docs/end-to-end-walkthroughs.md +165 -0
- package/docs/getting-started.md +29 -10
- package/docs/github-topics.md +12 -3
- package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +100 -0
- package/docs/guidelines/agent-infra/language-and-tone-examples.md +79 -0
- package/{.agent-src → docs}/guidelines/docs/readme-size-and-splitting.md +26 -25
- package/docs/guidelines/php/git.md +164 -0
- package/docs/migrations/commands-1.15.0.md +1 -1
- package/docs/showcase.md +9 -4
- package/docs/skills-catalog.md +14 -8
- package/docs/ui-track-mental-model.md +2 -2
- package/llms.txt +13 -7
- package/package.json +1 -1
- package/scripts/_one_off_phase4_dispatch_latency.py +108 -0
- package/scripts/_one_off_phase6_trigger_jaccard.py +92 -0
- package/scripts/_phase2_shim_helper.py +109 -0
- package/scripts/agent-config +33 -0
- package/scripts/ai_council/__init__.py +39 -0
- package/scripts/ai_council/_default_prices.py +41 -0
- package/scripts/ai_council/_one_off_2a4_acceptance.py +208 -0
- package/scripts/ai_council/_one_off_context_layer_v1_estimate.py +67 -0
- package/scripts/ai_council/_one_off_context_layer_v1_review.py +292 -0
- package/scripts/ai_council/_one_off_followups_review.py +259 -0
- package/scripts/ai_council/_one_off_nondestructive_inline_audit.py +209 -0
- package/scripts/ai_council/_one_off_phase_2a_budget_rebalance.py +257 -0
- package/scripts/ai_council/_one_off_phase_2a_post_revert.py +197 -0
- package/scripts/ai_council/_one_off_rebalancing_audit.py +149 -0
- package/scripts/ai_council/_one_off_roundtrip.py +106 -0
- package/scripts/ai_council/_one_off_rule_hardening_v1.py +251 -0
- package/scripts/ai_council/_one_off_structural_open_questions.py +232 -0
- package/scripts/ai_council/_one_off_structural_optimization.py +144 -0
- package/scripts/ai_council/_one_off_structural_v3_gaps.py +252 -0
- package/scripts/ai_council/_one_off_structural_v3_review.py +240 -0
- package/scripts/ai_council/budget_guard.py +172 -0
- package/scripts/ai_council/bundler.py +261 -0
- package/scripts/ai_council/clients.py +381 -0
- package/scripts/ai_council/modes.py +127 -0
- package/scripts/ai_council/orchestrator.py +350 -0
- package/scripts/ai_council/pricing.py +213 -0
- package/scripts/ai_council/project_context.py +159 -0
- package/scripts/ai_council/prompts.py +232 -0
- package/scripts/ai_council/session.py +144 -0
- package/scripts/check_always_budget.py +444 -0
- package/scripts/check_augmentignore.py +69 -0
- package/scripts/check_cluster_patterns.py +159 -0
- package/scripts/check_command_count_messaging.py +127 -0
- package/scripts/check_context_paths.py +201 -0
- package/scripts/check_no_roadmap_refs.py +155 -0
- package/scripts/check_phase_coupling.py +148 -0
- package/scripts/check_portability.py +57 -0
- package/scripts/check_public_catalog_links.py +122 -0
- package/scripts/check_references.py +33 -3
- package/scripts/check_roadmap_trackable.py +111 -0
- package/scripts/check_safety_floor_untouched.py +125 -0
- package/scripts/command_suggester/cooldown.py +1 -1
- package/scripts/command_suggester/loader.py +4 -1
- package/scripts/compress.py +59 -13
- package/scripts/generate_index.py +270 -0
- package/scripts/generate_ownership_matrix.py +323 -0
- package/scripts/hooks/augment-roadmap-progress.sh +57 -0
- package/scripts/install.py +49 -28
- package/scripts/install_anthropic_key.sh +5 -0
- package/scripts/install_openai_key.sh +106 -0
- package/scripts/lint_load_context.py +163 -0
- package/scripts/lint_no_new_atomic_commands.py +12 -11
- package/scripts/requirements-evals.txt +1 -0
- package/scripts/roadmap_progress_hook.py +159 -0
- package/scripts/schemas/command.schema.json +22 -1
- package/scripts/schemas/rule.schema.json +10 -0
- package/scripts/skill_linter.py +13 -4
- package/scripts/sync_agent_settings.py +26 -3
- package/scripts/update_counts.py +16 -4
- package/scripts/update_prices.py +124 -0
- package/.agent-src/guidelines/php/git.md +0 -96
- package/.agent-src/rules/command-suggestion.md +0 -134
- /package/{.agent-src → docs}/guidelines/agent-infra/agent-interaction-and-decision-quality.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/break-glass-usage.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/developer-judgment.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/engineering-memory-data-format.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/layered-settings.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/memory-access.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/naming.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/output-patterns.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/review-routing-data-format.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/role-contracts.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/role-mode-router.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/runtime-layer.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/self-improvement-pipeline.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/size-and-scope.md +0 -0
- /package/{.agent-src → docs}/guidelines/agent-infra/tool-integration.md +0 -0
- /package/{.agent-src → docs}/guidelines/e2e/playwright.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/api-design.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/artisan-commands.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/blade-ui.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/controllers.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/database.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/eloquent.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/flux.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/general.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/jobs.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/livewire.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/logging.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/naming.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/dependency-injection.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/dtos.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/events.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/factory.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/pipelines.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/policies.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/repositories.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/service-layer.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns/strategy.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/patterns.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/performance.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/resources.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/security.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/sql.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/validations.md +0 -0
- /package/{.agent-src → docs}/guidelines/php/websocket.md +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"""Council adjudication of Phase 2A always-budget overshoot.
|
|
2
|
+
|
|
3
|
+
Phase 2A of road-to-structural-optimization slimmed the top-3
|
|
4
|
+
budget-consuming `type: always` rules (language-and-tone,
|
|
5
|
+
ask-when-uncertain, direct-answers) by extracting MECHANICS into
|
|
6
|
+
contexts under contexts/communication/rules-always/. Under the
|
|
7
|
+
locked Model (b) literal, the extended budget grew from 47,448 to
|
|
8
|
+
52,534 chars (49,000 cap → 107.2 %), 5.2 pp above the 2 % G3
|
|
9
|
+
tolerance band defined in
|
|
10
|
+
docs/contracts/load-context-budget-model.md.
|
|
11
|
+
|
|
12
|
+
Per that contract: an overshoot above the band rejects the model
|
|
13
|
+
and escalates to council. Phase 2A § Abort/rollback fires its
|
|
14
|
+
budget kill-switch in this exact case.
|
|
15
|
+
|
|
16
|
+
This one-off bundles the linter output, the three slimmed rules,
|
|
17
|
+
the three new mechanics contexts, and the locked budget contract,
|
|
18
|
+
and asks the council to pick the smallest viable resolution.
|
|
19
|
+
|
|
20
|
+
Invocation:
|
|
21
|
+
.venv/bin/python -m scripts.ai_council._one_off_phase_2a_budget_rebalance
|
|
22
|
+
"""
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
import sys
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
|
|
28
|
+
from scripts.ai_council.bundler import bundle_files
|
|
29
|
+
from scripts.ai_council.clients import (
|
|
30
|
+
AnthropicClient,
|
|
31
|
+
OpenAIClient,
|
|
32
|
+
load_anthropic_key,
|
|
33
|
+
load_openai_key,
|
|
34
|
+
)
|
|
35
|
+
from scripts.ai_council.orchestrator import (
|
|
36
|
+
CostBudget,
|
|
37
|
+
CouncilQuestion,
|
|
38
|
+
consult,
|
|
39
|
+
estimate,
|
|
40
|
+
)
|
|
41
|
+
from scripts.ai_council.pricing import estimate_cost, load_prices
|
|
42
|
+
from scripts.ai_council.project_context import detect_project_context
|
|
43
|
+
from scripts.ai_council.session import SessionManifest, save as save_session
|
|
44
|
+
|
|
45
|
+
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
46
|
+
ARTEFACTS = [
|
|
47
|
+
REPO_ROOT / "docs/contracts/load-context-budget-model.md",
|
|
48
|
+
REPO_ROOT / ".agent-src.uncompressed/rules/language-and-tone.md",
|
|
49
|
+
REPO_ROOT / ".agent-src.uncompressed/rules/ask-when-uncertain.md",
|
|
50
|
+
REPO_ROOT / ".agent-src.uncompressed/rules/direct-answers.md",
|
|
51
|
+
REPO_ROOT / ".agent-src.uncompressed/contexts/communication/rules-always/language-and-tone-mechanics.md",
|
|
52
|
+
REPO_ROOT / ".agent-src.uncompressed/contexts/communication/rules-always/ask-when-uncertain-mechanics.md",
|
|
53
|
+
REPO_ROOT / ".agent-src.uncompressed/contexts/communication/rules-always/direct-answers-mechanics.md",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
ORIGINAL_ASK = (
|
|
57
|
+
"Phase 2A of road-to-structural-optimization slimmed the top-3 "
|
|
58
|
+
"always-rules and breached the 2 % G3 tolerance band on the "
|
|
59
|
+
"always-budget under Model (b) literal. The contract requires "
|
|
60
|
+
"council escalation. Council task: pick the smallest viable "
|
|
61
|
+
"resolution from a fixed option set."
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
REVIEW_PROMPT = """\
|
|
65
|
+
# Council Adjudication — Phase 2A Always-Budget Overshoot
|
|
66
|
+
|
|
67
|
+
## Measured state (linter output, model (b) literal)
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
FAIL always-rule extended budget: 52,534 / 49,000 chars (107.2%)
|
|
71
|
+
thresholds: warn 80% · fail 90% · per-rule ≤ 6,000 (ext) ·
|
|
72
|
+
top-3 ≤ 24,500 (ext) · depth ≤ 2 · G3 band ≤ +2%
|
|
73
|
+
|
|
74
|
+
ext= 8529 raw= 4636 scope-control.md (top-3) allowlisted ≤ 8,529
|
|
75
|
+
ext= 7887 raw= 4607 non-destructive-by-default.md (top-3) allowlisted ≤ 7,887
|
|
76
|
+
ext= 6827 raw= 2424 ask-when-uncertain.md (top-3) PER-RULE BREACH
|
|
77
|
+
ext= 6283 raw= 2758 direct-answers.md PER-RULE BREACH
|
|
78
|
+
ext= 5863 raw= 3658 language-and-tone.md
|
|
79
|
+
ext= 5781 raw= 3309 commit-policy.md
|
|
80
|
+
ext= 5481 raw= 2196 verify-before-complete.md
|
|
81
|
+
ext= 4415 raw= 4415 no-cheap-questions.md
|
|
82
|
+
ext= 1468 raw= 1468 agent-authority.md
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Pre-Phase-2A baseline (Phase 0.2.3 retroactive test, locked):
|
|
86
|
+
**47,448 / 49,000 = 96.8 %** (within tolerance, model (b) accepted).
|
|
87
|
+
|
|
88
|
+
Phase-2A delta per slimmed rule (raw rule shrank, mechanics
|
|
89
|
+
context loaded as new dependency):
|
|
90
|
+
|
|
91
|
+
| Rule | ext before | ext after | delta |
|
|
92
|
+
|---|---:|---:|---:|
|
|
93
|
+
| language-and-tone | 5,832 | 5,863 | +31 |
|
|
94
|
+
| ask-when-uncertain | 5,196 | 6,827 | +1,631 |
|
|
95
|
+
| direct-answers | 4,722 | 6,283 | +1,561 |
|
|
96
|
+
|
|
97
|
+
Phase 0.4 worked example council-locked the +1,561 delta on
|
|
98
|
+
direct-answers. ask-when-uncertain (+1,631) is structurally
|
|
99
|
+
identical. The total overshoot is **+3,534 chars over cap**.
|
|
100
|
+
|
|
101
|
+
## Why the literal model can no longer hit budget
|
|
102
|
+
|
|
103
|
+
Under model (b) literal each rule pays full cost for every context
|
|
104
|
+
it loads. Each mechanics extraction adds ~1.5–2 KB of frontmatter +
|
|
105
|
+
headers + context-introduction overhead per rule. Phase 2A is
|
|
106
|
+
structurally unable to satisfy the roadmap success criterion
|
|
107
|
+
("budget delta ≥ −5 %") under model (b); extraction *always* adds
|
|
108
|
+
overhead unless mechanics are consolidated and shared across rules.
|
|
109
|
+
|
|
110
|
+
## Fixed option set (pick exactly one)
|
|
111
|
+
|
|
112
|
+
- **R1 — Switch to Model (c) shared-divisor.** Reserved by the
|
|
113
|
+
contract as "first refinement step if the 2 % tolerance band is
|
|
114
|
+
exceeded". Under (c), `Σ RawSize(c) / N_loaders`. Currently each
|
|
115
|
+
mechanics file has N=1, so (c) reduces to (b). Buy-in for (c)
|
|
116
|
+
enables R5 below.
|
|
117
|
+
- **R2 — Raise TOTAL_CAP.** Set cap to 56,000 chars (current
|
|
118
|
+
utilization 93.8 % under new cap). Acknowledges extraction
|
|
119
|
+
overhead is real; freezes Phase 2A wins; abandons the −5 %
|
|
120
|
+
delta success criterion.
|
|
121
|
+
- **R3 — Raise PER_RULE_CAP to 7,000 + add allowlist entries +
|
|
122
|
+
raise TOTAL_CAP to 54,000.** Minimal-change variant: keeps the
|
|
123
|
+
shape, accepts the two new per-rule breaches, raises cap
|
|
124
|
+
modestly.
|
|
125
|
+
- **R4 — Revert Phase 2A.** Abandon mechanics extraction on the
|
|
126
|
+
three rules; restore them to original size; mark Phase 2A as
|
|
127
|
+
"structurally infeasible under locked contract"; close roadmap
|
|
128
|
+
phase.
|
|
129
|
+
- **R5 — Consolidate the three mechanics into one shared context
|
|
130
|
+
+ adopt R1.** Single `rules-always-mechanics.md` loaded by all
|
|
131
|
+
three slimmed rules; under (c) each rule pays 1/3 of the
|
|
132
|
+
consolidated context size. Highest engineering cost, only path
|
|
133
|
+
that delivers a net negative delta.
|
|
134
|
+
|
|
135
|
+
## Output Contract (STRICT)
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
### Verdict
|
|
139
|
+
**Choice:** <R1 | R2 | R3 | R4 | R5>
|
|
140
|
+
**One-sentence rationale:** <≤ 30 words>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
### Required follow-up actions (numbered, ≤ 4)
|
|
145
|
+
1. <smallest concrete step, files named>
|
|
146
|
+
2. <...>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
### Risk note
|
|
151
|
+
**Single biggest risk of the chosen option:** <one sentence>
|
|
152
|
+
**Mitigation:** <one sentence>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
### Contract amendment needed?
|
|
157
|
+
**Amend load-context-budget-model.md?** <YES — section · NO>
|
|
158
|
+
**Amend road-to-structural-optimization Phase 2A success criterion?**
|
|
159
|
+
<YES — new criterion in 1 line · NO>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Be decisive — total response ≤ 1,000 words. Artefacts follow
|
|
163
|
+
verbatim.
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def main() -> int:
|
|
168
|
+
anthropic = AnthropicClient(api_key=load_anthropic_key(), model="claude-sonnet-4-5")
|
|
169
|
+
openai = OpenAIClient(api_key=load_openai_key(), model="gpt-4o")
|
|
170
|
+
members = [anthropic, openai]
|
|
171
|
+
|
|
172
|
+
context = bundle_files(ARTEFACTS)
|
|
173
|
+
project = detect_project_context(REPO_ROOT)
|
|
174
|
+
table = load_prices()
|
|
175
|
+
|
|
176
|
+
user_prompt = REVIEW_PROMPT + "\n\n---\n\n" + context.text
|
|
177
|
+
|
|
178
|
+
question = CouncilQuestion(
|
|
179
|
+
mode="files",
|
|
180
|
+
user_prompt=user_prompt,
|
|
181
|
+
max_tokens=2560,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
estimates = estimate(
|
|
185
|
+
question, members, table, project=project, original_ask=ORIGINAL_ASK,
|
|
186
|
+
)
|
|
187
|
+
print("=== ESTIMATE (single round) ===")
|
|
188
|
+
total_est = 0.0
|
|
189
|
+
for c, e in zip(members, estimates):
|
|
190
|
+
print(f" {c.name}/{c.model}: ~{e.input_tokens} in + {e.output_tokens} out = ${e.total_usd:.4f}")
|
|
191
|
+
total_est += e.total_usd
|
|
192
|
+
print(f" TOTAL per round (max): ${total_est:.4f}")
|
|
193
|
+
print()
|
|
194
|
+
|
|
195
|
+
budget = CostBudget(
|
|
196
|
+
max_input_tokens=200_000,
|
|
197
|
+
max_output_tokens=80_000,
|
|
198
|
+
max_calls=20,
|
|
199
|
+
max_total_usd=2.50,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
rounds_collected: list[list] = []
|
|
203
|
+
|
|
204
|
+
def _on_round_complete(round_idx: int, round_responses) -> None:
|
|
205
|
+
rounds_collected.append(list(round_responses))
|
|
206
|
+
print(f"=== ROUND {round_idx + 1} COMPLETE ===")
|
|
207
|
+
for r in round_responses:
|
|
208
|
+
if r.error:
|
|
209
|
+
print(f" [error] {r.provider}/{r.model}: {r.error}")
|
|
210
|
+
continue
|
|
211
|
+
actual = estimate_cost(r.provider, r.model, r.input_tokens, r.output_tokens, table)
|
|
212
|
+
print(f" [done] {r.provider}/{r.model}: {r.input_tokens} in / "
|
|
213
|
+
f"{r.output_tokens} out · {r.latency_ms} ms · ${actual.total_usd:.4f}")
|
|
214
|
+
print()
|
|
215
|
+
|
|
216
|
+
print("=== CONSULT (1 round, Phase 2A budget rebalance) ===")
|
|
217
|
+
consult(
|
|
218
|
+
members, question, budget,
|
|
219
|
+
rounds=1,
|
|
220
|
+
on_round_complete=_on_round_complete,
|
|
221
|
+
table=table, project=project, original_ask=ORIGINAL_ASK,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
if not rounds_collected:
|
|
225
|
+
print("[error] no rounds completed", file=sys.stderr)
|
|
226
|
+
return 1
|
|
227
|
+
|
|
228
|
+
actual_total = 0.0
|
|
229
|
+
for round_responses in rounds_collected:
|
|
230
|
+
for r in round_responses:
|
|
231
|
+
if r.error:
|
|
232
|
+
continue
|
|
233
|
+
actual = estimate_cost(r.provider, r.model, r.input_tokens, r.output_tokens, table)
|
|
234
|
+
actual_total += actual.total_usd
|
|
235
|
+
print(f"=== TOTAL ACTUAL: ${actual_total:.4f} ===")
|
|
236
|
+
|
|
237
|
+
final_round = rounds_collected[-1]
|
|
238
|
+
if not [r for r in final_round if not r.error]:
|
|
239
|
+
return 1
|
|
240
|
+
|
|
241
|
+
manifest = SessionManifest(
|
|
242
|
+
mode="files",
|
|
243
|
+
artefact="agents/roadmaps/road-to-structural-optimization.md",
|
|
244
|
+
original_ask=ORIGINAL_ASK,
|
|
245
|
+
members=[f"{r.provider}/{r.model}" for r in final_round],
|
|
246
|
+
rounds=len(rounds_collected),
|
|
247
|
+
cost_usd_estimated=total_est,
|
|
248
|
+
cost_usd_actual=actual_total,
|
|
249
|
+
extra={"purpose": "Phase 2A always-budget overshoot adjudication"},
|
|
250
|
+
)
|
|
251
|
+
session_dir = save_session(manifest=manifest, responses=rounds_collected)
|
|
252
|
+
print(f"[saved] {session_dir.relative_to(REPO_ROOT)}/")
|
|
253
|
+
return 1 if any(r.error for round_r in rounds_collected for r in round_r) else 0
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
if __name__ == "__main__":
|
|
257
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"""Council adjudication of post-revert always-budget contract.
|
|
2
|
+
|
|
3
|
+
Phase 2A executed R4 (revert) per the prior council verdict. The
|
|
4
|
+
three slimmed always-rules and their mechanics contexts have been
|
|
5
|
+
restored; mechanics-context directory removed. Measured state on
|
|
6
|
+
this branch is now 47,448 / 49,000 chars = 96.8 % — strictly better
|
|
7
|
+
than `main` at 100.6 % which currently passes via the G3 tolerance
|
|
8
|
+
band.
|
|
9
|
+
|
|
10
|
+
The strict 90 % FAIL gate in scripts/check_always_budget.py was
|
|
11
|
+
written assuming Phase 2A would succeed in dropping utilization
|
|
12
|
+
below 90 %. Phase 2A is now structurally infeasible under model (b)
|
|
13
|
+
(per the previous council finding) and the cap-tightening was
|
|
14
|
+
deferred to Phase 5. Branch must unblock CI without regressing the
|
|
15
|
+
contract spirit.
|
|
16
|
+
|
|
17
|
+
Council task: pick the smallest viable reconciliation.
|
|
18
|
+
"""
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import sys
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
|
|
24
|
+
from scripts.ai_council.bundler import bundle_files
|
|
25
|
+
from scripts.ai_council.clients import (
|
|
26
|
+
AnthropicClient,
|
|
27
|
+
OpenAIClient,
|
|
28
|
+
load_anthropic_key,
|
|
29
|
+
load_openai_key,
|
|
30
|
+
)
|
|
31
|
+
from scripts.ai_council.orchestrator import (
|
|
32
|
+
CostBudget,
|
|
33
|
+
CouncilQuestion,
|
|
34
|
+
consult,
|
|
35
|
+
estimate,
|
|
36
|
+
)
|
|
37
|
+
from scripts.ai_council.pricing import estimate_cost, load_prices
|
|
38
|
+
from scripts.ai_council.project_context import detect_project_context
|
|
39
|
+
from scripts.ai_council.session import SessionManifest, save as save_session
|
|
40
|
+
|
|
41
|
+
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
42
|
+
ARTEFACTS = [
|
|
43
|
+
REPO_ROOT / "docs/contracts/load-context-budget-model.md",
|
|
44
|
+
REPO_ROOT / "scripts/check_always_budget.py",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
ORIGINAL_ASK = (
|
|
48
|
+
"Phase 2A reverted (R4) per prior council verdict. Branch budget is "
|
|
49
|
+
"96.8 % (gap-zone FAIL); main is 100.6 % (PASS via G3 band). Branch "
|
|
50
|
+
"is strictly better than main yet rejected by the strict 90 % gate. "
|
|
51
|
+
"Pick the smallest contract reconciliation to unblock CI."
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
REVIEW_PROMPT = """\
|
|
55
|
+
# Council Adjudication — Post-Revert Always-Budget Reconciliation
|
|
56
|
+
|
|
57
|
+
## Current state (after R4 revert is committed locally)
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
FAIL always-rule extended budget: 47,448 / 49,000 chars (96.8%)
|
|
61
|
+
thresholds: warn 80% · fail 90% · per-rule ≤ 6,000 (ext) ·
|
|
62
|
+
top-3 ≤ 24,500 (ext) · depth ≤ 2 · G3 band ≤ +2%
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`main` (last green): **49,311 / 49,000 = 100.6 %** — passes because
|
|
66
|
+
the linter only rejects 90–100 % (gap zone) and > 102 %; 100–102 %
|
|
67
|
+
is the documented G3 tolerance band.
|
|
68
|
+
|
|
69
|
+
This branch is objectively closer to the cap than `main` but
|
|
70
|
+
rejected. The 90 % gate was written under the assumption Phase 2A
|
|
71
|
+
would land below 90 %. Phase 2A is structurally infeasible under
|
|
72
|
+
model (b) (prior council finding); roadmap re-routes the trim to
|
|
73
|
+
Phase 5 via either model (c) shared-divisor or shared-mechanics
|
|
74
|
+
consolidation.
|
|
75
|
+
|
|
76
|
+
## Fixed option set (pick exactly one)
|
|
77
|
+
|
|
78
|
+
- **A1 — Recovery-band carve-out.** Extend the linter so "current
|
|
79
|
+
pct ≤ last-green-`main` pct AND pct ≤ 100 %" becomes a documented
|
|
80
|
+
`WARN (recovery band)`, not FAIL. Persists until Phase 5
|
|
81
|
+
re-tightens. No baseline regression possible; needs `main`-pct
|
|
82
|
+
lookup (committed scalar in repo or CI artifact).
|
|
83
|
+
- **A2 — Lower FAIL_THRESHOLD to 100 %.** Drop the 90 % gate to
|
|
84
|
+
match the contract's spirit ("< cap is acceptable; > cap +2 %
|
|
85
|
+
fails"). Phase 5 re-tightens to 85 %/95 % per its own task list.
|
|
86
|
+
Smallest diff. Risk: removes the early-warning gate.
|
|
87
|
+
- **A3 — Trim ~3.4k chars from current rules.** Find another
|
|
88
|
+
candidate (none of the three Phase-2A targets, since 2A proved
|
|
89
|
+
extraction adds overhead). Risk: the next-largest rules touch
|
|
90
|
+
the safety floor (Q3=A locked).
|
|
91
|
+
- **A4 — Bump TOTAL_CAP to 53,000 + keep 90 % FAIL.** Rewrites the
|
|
92
|
+
contract's total cap upward; freezes current state at ~89.5 %.
|
|
93
|
+
Defers Phase 5 trim to a separate roadmap. Cleanest CI but
|
|
94
|
+
contract drift.
|
|
95
|
+
- **A5 — Mark phase as `irreducible-at-current-method` and freeze
|
|
96
|
+
the linter at current state.** Pin a `CURRENT_BASELINE = 47_448`
|
|
97
|
+
ceiling alongside the 90 % gate; PASS while pct ≤ baseline,
|
|
98
|
+
FAIL on regression. Deflects Phase 5 work upstream into model (c).
|
|
99
|
+
|
|
100
|
+
## Constraints
|
|
101
|
+
|
|
102
|
+
- Safety-floor rules (`non-destructive-by-default`, `commit-policy`,
|
|
103
|
+
`scope-control`, `verify-before-complete`) are Q3=A locked and
|
|
104
|
+
may not be slimmed.
|
|
105
|
+
- `road-to-structural-optimization` Phase 5 owns the long-term
|
|
106
|
+
trim — do not duplicate work into Phase 2A.
|
|
107
|
+
- The four other phases (1, 2B, 3, 4, 6) on this branch are
|
|
108
|
+
blocked by this CI gate; the choice gates roadmap throughput.
|
|
109
|
+
|
|
110
|
+
## Output Contract (STRICT)
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
### Verdict
|
|
114
|
+
**Choice:** <A1 | A2 | A3 | A4 | A5>
|
|
115
|
+
**One-sentence rationale:** <≤ 30 words>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
### Required follow-up actions (numbered, ≤ 4)
|
|
120
|
+
1. <smallest concrete step, files named>
|
|
121
|
+
2. <...>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
### Risk note
|
|
126
|
+
**Single biggest risk of the chosen option:** <one sentence>
|
|
127
|
+
**Mitigation:** <one sentence>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
### Contract amendment needed?
|
|
132
|
+
**Amend load-context-budget-model.md?** <YES — section · NO>
|
|
133
|
+
**Amend road-to-structural-optimization Phase 5 success criterion?**
|
|
134
|
+
<YES — new criterion in 1 line · NO>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Be decisive — total response ≤ 800 words. Artefacts follow verbatim.
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def main() -> int:
|
|
142
|
+
anthropic = AnthropicClient(api_key=load_anthropic_key(), model="claude-sonnet-4-5")
|
|
143
|
+
openai = OpenAIClient(api_key=load_openai_key(), model="gpt-4o")
|
|
144
|
+
members = [anthropic, openai]
|
|
145
|
+
|
|
146
|
+
context = bundle_files(ARTEFACTS)
|
|
147
|
+
project = detect_project_context(REPO_ROOT)
|
|
148
|
+
table = load_prices()
|
|
149
|
+
|
|
150
|
+
user_prompt = REVIEW_PROMPT + "\n\n---\n\n" + context.text
|
|
151
|
+
|
|
152
|
+
question = CouncilQuestion(mode="files", user_prompt=user_prompt, max_tokens=2048)
|
|
153
|
+
estimates = estimate(question, members, table, project=project, original_ask=ORIGINAL_ASK)
|
|
154
|
+
print("=== ESTIMATE (single round) ===")
|
|
155
|
+
total_est = 0.0
|
|
156
|
+
for c, e in zip(members, estimates):
|
|
157
|
+
print(f" {c.name}/{c.model}: ~{e.input_tokens} in + {e.output_tokens} out = ${e.total_usd:.4f}")
|
|
158
|
+
total_est += e.total_usd
|
|
159
|
+
print(f" TOTAL per round (max): ${total_est:.4f}")
|
|
160
|
+
|
|
161
|
+
budget = CostBudget(max_input_tokens=200_000, max_output_tokens=80_000, max_calls=20, max_total_usd=2.50)
|
|
162
|
+
rounds_collected: list[list] = []
|
|
163
|
+
|
|
164
|
+
def _on_round_complete(round_idx, round_responses) -> None:
|
|
165
|
+
rounds_collected.append(list(round_responses))
|
|
166
|
+
print(f"=== ROUND {round_idx + 1} COMPLETE ===")
|
|
167
|
+
for r in round_responses:
|
|
168
|
+
if r.error:
|
|
169
|
+
print(f" [error] {r.provider}/{r.model}: {r.error}")
|
|
170
|
+
continue
|
|
171
|
+
a = estimate_cost(r.provider, r.model, r.input_tokens, r.output_tokens, table)
|
|
172
|
+
print(f" [done] {r.provider}/{r.model}: {r.input_tokens} in / {r.output_tokens} out · ${a.total_usd:.4f}")
|
|
173
|
+
|
|
174
|
+
print("=== CONSULT (1 round, post-revert reconciliation) ===")
|
|
175
|
+
consult(members, question, budget, rounds=1, on_round_complete=_on_round_complete,
|
|
176
|
+
table=table, project=project, original_ask=ORIGINAL_ASK)
|
|
177
|
+
if not rounds_collected:
|
|
178
|
+
return 1
|
|
179
|
+
actual = sum(estimate_cost(r.provider, r.model, r.input_tokens, r.output_tokens, table).total_usd
|
|
180
|
+
for rr in rounds_collected for r in rr if not r.error)
|
|
181
|
+
print(f"=== TOTAL ACTUAL: ${actual:.4f} ===")
|
|
182
|
+
final = rounds_collected[-1]
|
|
183
|
+
if not [r for r in final if not r.error]:
|
|
184
|
+
return 1
|
|
185
|
+
manifest = SessionManifest(
|
|
186
|
+
mode="files", artefact="agents/roadmaps/road-to-structural-optimization.md",
|
|
187
|
+
original_ask=ORIGINAL_ASK, members=[f"{r.provider}/{r.model}" for r in final],
|
|
188
|
+
rounds=len(rounds_collected), cost_usd_estimated=total_est, cost_usd_actual=actual,
|
|
189
|
+
extra={"purpose": "Post-revert always-budget contract reconciliation"},
|
|
190
|
+
)
|
|
191
|
+
sd = save_session(manifest=manifest, responses=rounds_collected)
|
|
192
|
+
print(f"[saved] {sd.relative_to(REPO_ROOT)}/")
|
|
193
|
+
return 0
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
if __name__ == "__main__":
|
|
197
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""One-off council consultation — Phase 0 audit findings on rebalancing roadmap.
|
|
2
|
+
|
|
3
|
+
Validates whether the rebalancing roadmap premise still holds against the
|
|
4
|
+
actual PR #34 diff. Transient script; can be deleted after the consult runs.
|
|
5
|
+
|
|
6
|
+
Invocation:
|
|
7
|
+
.venv/bin/python -m scripts.ai_council._one_off_rebalancing_audit
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import sys
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
from scripts.ai_council.clients import AnthropicClient, load_anthropic_key
|
|
15
|
+
from scripts.ai_council.orchestrator import CostBudget, CouncilQuestion, consult, estimate
|
|
16
|
+
from scripts.ai_council.pricing import estimate_cost, load_prices
|
|
17
|
+
from scripts.ai_council.project_context import detect_project_context
|
|
18
|
+
|
|
19
|
+
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
20
|
+
|
|
21
|
+
ORIGINAL_ASK = (
|
|
22
|
+
"Phase 0 audit of the rebalancing roadmap. The roadmap was written based on "
|
|
23
|
+
"five rounds of external review claiming PR #34 over-deleted implicit "
|
|
24
|
+
"expertise. Validate whether the premise still holds against the actual diff. "
|
|
25
|
+
"Three concrete questions: (1) is the deletion narrative supported by the "
|
|
26
|
+
"numbers? (2) which of the 6 phases are already done or moot? "
|
|
27
|
+
"(3) what is the actual minimum-viable scope still worth executing?"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
ARTEFACT = """# Phase 0 audit findings - road-to-rebalancing.md
|
|
31
|
+
|
|
32
|
+
## Premise from the roadmap
|
|
33
|
+
|
|
34
|
+
The risk surface is whether implicit expertise (edge cases, decision forks,
|
|
35
|
+
failure modes, anti-patterns) was trimmed alongside the redundancy.
|
|
36
|
+
Rebalancing means restoring intelligence without re-inflating Always-rules.
|
|
37
|
+
|
|
38
|
+
## Actual numbers from the PR #34 diff
|
|
39
|
+
|
|
40
|
+
Scope: git diff origin/main...HEAD, path .agent-src.uncompressed/rules/
|
|
41
|
+
|
|
42
|
+
- 35 files changed: 202 insertions, 204 deletions => net -2 lines total.
|
|
43
|
+
- Largest delta: language-and-tone.md 37 ins / 96 del. The 96 lines were
|
|
44
|
+
EXTRACTED to docs/guidelines/language-and-tone-examples.md (79 lines),
|
|
45
|
+
not deleted. Net knowledge loss: ~17 lines of duplicated phrasing.
|
|
46
|
+
- Second-largest: roadmap-progress-sync.md 26 ins / 33 del - minor.
|
|
47
|
+
- All other rules: <=8 line changes each, mostly renames.
|
|
48
|
+
- ZERO rule files deleted outright.
|
|
49
|
+
|
|
50
|
+
## Phase-by-phase realities
|
|
51
|
+
|
|
52
|
+
### Phase 0 - Removed-Knowledge Audit
|
|
53
|
+
This document IS Phase 0. Findings: 80% redundancy, examples extracted to
|
|
54
|
+
safe layer, zero decision-logic deletions. Phase 0 is now COMPLETE.
|
|
55
|
+
|
|
56
|
+
### Phase 1 - Pilot Context Split (3 rules)
|
|
57
|
+
Candidates: autonomous-execution, minimal-safe-diff, scope-control.
|
|
58
|
+
- autonomous-execution: 8 line delta in PR, no extraction yet.
|
|
59
|
+
- minimal-safe-diff: already auto-trigger; 6 line delta.
|
|
60
|
+
- scope-control: 40 line ADDITION (not deletion) in this PR. Pilot value low.
|
|
61
|
+
|
|
62
|
+
### Phase 2 - load_context: convention + linter
|
|
63
|
+
0 rules use load_context: today. Convention does not exist.
|
|
64
|
+
Genuinely net-new work.
|
|
65
|
+
|
|
66
|
+
### Phase 3 - Guidelines domain folders
|
|
67
|
+
Already done. 47 guidelines, 46 already in domain folders
|
|
68
|
+
(agent-infra/, docs/, e2e/, php/). Only language-and-tone-examples.md
|
|
69
|
+
is flat at root. Phase 3 reduces to deciding where the one flat file goes.
|
|
70
|
+
|
|
71
|
+
### Phase 4 - Golden-Transcript-backed demos under examples/flows/
|
|
72
|
+
Partially shipped. docs/end-to-end-walkthroughs.md (built last cycle)
|
|
73
|
+
already does this with 4 traces anchored to GT-1, GT-P1, GT-U2, GT-2.
|
|
74
|
+
Required cases per roadmap: implement-ticket-demo, work-freeform-demo,
|
|
75
|
+
ui-track-demo, blocked-path-demo (all covered) plus mixed-flow-demo
|
|
76
|
+
(NOT covered yet).
|
|
77
|
+
Net-new: 1 mixed-flow demo + folder move from docs/ to examples/flows/.
|
|
78
|
+
|
|
79
|
+
### Phase 5 - Rule priority hierarchy + interaction matrix
|
|
80
|
+
Partially shipped. docs/contracts/rule-interactions.yml and
|
|
81
|
+
rule-interactions.md exist (13 pairs across 9 rules).
|
|
82
|
+
rule-priority-hierarchy.md does NOT exist.
|
|
83
|
+
|
|
84
|
+
### Phase 6 - Senior-agent behavior tests
|
|
85
|
+
Not started. Net-new work, but only valuable if Phase 1 actually runs
|
|
86
|
+
and produces something to validate.
|
|
87
|
+
|
|
88
|
+
## Question to council
|
|
89
|
+
|
|
90
|
+
Given:
|
|
91
|
+
- The deletion narrative is empirically thin (-2 net lines after extraction).
|
|
92
|
+
- 3 of 6 phases are already done or near-done.
|
|
93
|
+
- Phase 1 pilot value is questionable on the 3 named candidates.
|
|
94
|
+
|
|
95
|
+
Should this roadmap:
|
|
96
|
+
|
|
97
|
+
(A) Close out as substantially-already-done. Execute only the small delta
|
|
98
|
+
(1 mixed-flow demo, move walkthroughs to examples/flows/, add the
|
|
99
|
+
priority-hierarchy doc, add load_context: convention if cheap),
|
|
100
|
+
then archive.
|
|
101
|
+
|
|
102
|
+
(B) Drop Phase 1 pilot - the three named candidates don't show evidence of
|
|
103
|
+
over-deletion. Execute Phase 2 + Phase 4 (1 missing demo + restructure)
|
|
104
|
+
+ Phase 5 (priority-hierarchy doc) only.
|
|
105
|
+
|
|
106
|
+
(C) Original full scope - assume the audit missed something subtle and run
|
|
107
|
+
all 6 phases as written.
|
|
108
|
+
|
|
109
|
+
(D) Other framing - propose a tighter scope based on what the audit shows.
|
|
110
|
+
|
|
111
|
+
Identify blind spots: did the diff miss content moves between branches?
|
|
112
|
+
Are there rules whose implicit expertise lives in non-line-count signal?
|
|
113
|
+
Recommend (A/B/C/D) with rationale.
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def main() -> int:
|
|
118
|
+
api_key = load_anthropic_key()
|
|
119
|
+
client = AnthropicClient(api_key=api_key)
|
|
120
|
+
project = detect_project_context(REPO_ROOT)
|
|
121
|
+
table = load_prices()
|
|
122
|
+
|
|
123
|
+
question = CouncilQuestion(mode="roadmap", user_prompt=ARTEFACT, max_tokens=2048)
|
|
124
|
+
estimates = estimate(question, [client], table, project=project, original_ask=ORIGINAL_ASK)
|
|
125
|
+
print(f"[estimate] ~{estimates[0].input_tokens} in + {estimates[0].output_tokens} out = ${estimates[0].total_usd:.4f}")
|
|
126
|
+
|
|
127
|
+
budget = CostBudget(
|
|
128
|
+
max_input_tokens=50_000, max_output_tokens=20_000,
|
|
129
|
+
max_calls=5, max_total_usd=0.50,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
print(f"[consult] calling {client.name}/{client.model} ...")
|
|
133
|
+
responses = consult([client], question, budget, table=table, project=project, original_ask=ORIGINAL_ASK)
|
|
134
|
+
if not responses or responses[0].error:
|
|
135
|
+
err = responses[0].error if responses else "no response"
|
|
136
|
+
print(f"[error] {err}", file=sys.stderr)
|
|
137
|
+
return 1
|
|
138
|
+
|
|
139
|
+
r = responses[0]
|
|
140
|
+
actual = estimate_cost(r.provider, r.model, r.input_tokens, r.output_tokens, table)
|
|
141
|
+
print(f"[done] {r.input_tokens} in / {r.output_tokens} out, {r.latency_ms} ms, actual ${actual.total_usd:.4f}")
|
|
142
|
+
print("=" * 72)
|
|
143
|
+
print(r.text)
|
|
144
|
+
print("=" * 72)
|
|
145
|
+
return 0
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if __name__ == "__main__":
|
|
149
|
+
raise SystemExit(main())
|