@event4u/agent-config 14.10.0 → 14.12.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/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +161 -208
- package/README.md +1 -1
- package/dist/agent-src/commands/design.md +88 -0
- package/dist/agent-src/commands/project/analyze.md +47 -0
- package/dist/agent-src/commands/review/changes.md +67 -6
- package/dist/agent-src/commands/roadmap/create.md +49 -0
- package/dist/agent-src/commands/roadmap/next.md +27 -11
- package/dist/agent-src/commands/roadmap/process-full.md +14 -0
- package/dist/agent-src/commands/video/from-script.md +60 -3
- package/dist/agent-src/commands/video/stitch.md +14 -0
- package/dist/agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +1 -0
- package/dist/agent-src/contexts/execution/evidence-discipline.md +26 -0
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +154 -2
- package/dist/agent-src/rules/active-remediation.md +3 -3
- package/dist/agent-src/rules/code-provenance.md +2 -2
- package/dist/agent-src/rules/context-hygiene.md +13 -33
- package/dist/agent-src/rules/council-availability.md +2 -2
- package/dist/agent-src/rules/decision-revisit-gate.md +3 -1
- package/dist/agent-src/rules/design-fidelity.md +18 -0
- package/dist/agent-src/rules/design-review-after-ui-write.md +2 -2
- package/dist/agent-src/rules/evaluator-independence.md +56 -44
- package/dist/agent-src/rules/fix-what-you-see.md +9 -1
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +1 -1
- package/dist/agent-src/rules/minimal-safe-diff.md +14 -20
- package/dist/agent-src/rules/missing-skill-recovery.md +13 -1
- package/dist/agent-src/rules/playbook-precedence.md +105 -0
- package/dist/agent-src/rules/recurring-criticism.md +3 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +14 -13
- package/dist/agent-src/rules/scale-discipline.md +24 -0
- package/dist/agent-src/rules/security-sensitive-stop.md +2 -2
- package/dist/agent-src/rules/settings-ask-protocol.md +2 -2
- package/dist/agent-src/rules/ui-audit-gate.md +27 -15
- package/dist/agent-src/rules/untrusted-input-defense.md +2 -2
- package/dist/agent-src/skills/accessibility-auditor/SKILL.md +19 -0
- package/dist/agent-src/skills/adr-create/SKILL.md +7 -0
- package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +33 -0
- package/dist/agent-src/skills/ai-council/references/advanced-modes.md +17 -3
- package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +31 -0
- package/dist/agent-src/skills/ai-council/references/procedure.md +19 -0
- package/dist/agent-src/skills/alerting-doctrine/SKILL.md +225 -0
- package/dist/agent-src/skills/authz-review/SKILL.md +0 -1
- package/dist/agent-src/skills/blast-radius-analyzer/SKILL.md +32 -0
- package/dist/agent-src/skills/brand/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-asset-generation/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-audit/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-identity/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-strategy/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-to-tokens/SKILL.md +3 -0
- package/dist/agent-src/skills/check-refs/SKILL.md +3 -0
- package/dist/agent-src/skills/code-refactoring/SKILL.md +45 -1
- package/dist/agent-src/skills/code-review/SKILL.md +75 -5
- package/dist/agent-src/skills/command-routing/SKILL.md +6 -0
- package/dist/agent-src/skills/command-writing/SKILL.md +35 -0
- package/dist/agent-src/skills/condense-memory/SKILL.md +3 -0
- package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
- package/dist/agent-src/skills/conventional-commits-writing/SKILL.md +3 -0
- package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +10 -0
- package/dist/agent-src/skills/corpus-grounding/SKILL.md +3 -0
- package/dist/agent-src/skills/design-intelligence/SKILL.md +3 -0
- package/dist/agent-src/skills/design-intelligence/data/landing.csv +36 -35
- package/dist/agent-src/skills/design-intelligence/data/stacks/threejs.csv +1 -0
- package/dist/agent-src/skills/design-review/SKILL.md +79 -1
- package/dist/agent-src/skills/design-review/references/verification-automation.md +41 -0
- package/dist/agent-src/skills/design-system-capture/SKILL.md +35 -40
- package/dist/agent-src/skills/design-system-capture/references/import-procedure.md +50 -0
- package/dist/agent-src/skills/design-tokens/SKILL.md +3 -0
- package/dist/agent-src/skills/design-variations/SKILL.md +3 -0
- package/dist/agent-src/skills/developer-like-execution/SKILL.md +3 -0
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +3 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +28 -4
- package/dist/agent-src/skills/fe-design/SKILL.md +74 -41
- package/dist/agent-src/skills/fe-design/references/craft-floor.md +52 -0
- package/dist/agent-src/skills/fe-design/references/source-led-port.md +36 -0
- package/dist/agent-src/skills/file-editor/SKILL.md +5 -0
- package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +2 -2
- package/dist/agent-src/skills/git-workflow/SKILL.md +3 -0
- package/dist/agent-src/skills/html-deck/SKILL.md +3 -0
- package/dist/agent-src/skills/iconography/SKILL.md +3 -0
- package/dist/agent-src/skills/image-editing/SKILL.md +3 -0
- package/dist/agent-src/skills/image-generation/SKILL.md +3 -0
- package/dist/agent-src/skills/image-provider-routing/SKILL.md +3 -0
- package/dist/agent-src/skills/incident-commander/SKILL.md +10 -0
- package/dist/agent-src/skills/js-library-packaging/SKILL.md +173 -0
- package/dist/agent-src/skills/js-library-packaging/scripts/check_package_surface.ts +270 -0
- package/dist/agent-src/skills/laravel-migration/SKILL.md +3 -0
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +3 -0
- package/dist/agent-src/skills/lint-skills/SKILL.md +3 -0
- package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +3 -0
- package/dist/agent-src/skills/logging-monitoring/SKILL.md +234 -51
- package/dist/agent-src/skills/logo-generation/SKILL.md +3 -0
- package/dist/agent-src/skills/md-language-check/SKILL.md +3 -0
- package/dist/agent-src/skills/monorepo-workspace/SKILL.md +149 -0
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +6 -0
- package/dist/agent-src/skills/multi-tenancy/SKILL.md +4 -0
- package/dist/agent-src/skills/operational-readiness/SKILL.md +184 -0
- package/dist/agent-src/skills/override-management/SKILL.md +3 -0
- package/dist/agent-src/skills/persona-improvement/SKILL.md +3 -0
- package/dist/agent-src/skills/pest-testing/SKILL.md +3 -0
- package/dist/agent-src/skills/playbook-authoring/SKILL.md +162 -0
- package/dist/agent-src/skills/playwright-testing/SKILL.md +3 -0
- package/dist/agent-src/skills/privacy-review/SKILL.md +3 -0
- package/dist/agent-src/skills/project-analysis-core/SKILL.md +23 -0
- package/dist/agent-src/skills/prompt-engineering-image/SKILL.md +3 -0
- package/dist/agent-src/skills/quality-tools/SKILL.md +5 -0
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +81 -33
- package/dist/agent-src/skills/readme-reviewer/SKILL.md +3 -0
- package/dist/agent-src/skills/readme-writing/SKILL.md +3 -0
- package/dist/agent-src/skills/readme-writing-package/SKILL.md +3 -0
- package/dist/agent-src/skills/receiving-code-review/SKILL.md +2 -2
- package/dist/agent-src/skills/refine-prompt/SKILL.md +3 -0
- package/dist/agent-src/skills/refine-ticket/SKILL.md +3 -0
- package/dist/agent-src/skills/requesting-code-review/SKILL.md +2 -2
- package/dist/agent-src/skills/review-routing/SKILL.md +2 -2
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +23 -41
- package/dist/agent-src/skills/roadmap-writing/references/follow-up-roadmap-shape.md +47 -0
- package/dist/agent-src/skills/rtk-output-filtering/SKILL.md +22 -6
- package/dist/agent-src/skills/runway-cognition/SKILL.md +3 -0
- package/dist/agent-src/skills/scene-expander/scene-blueprint.schema.yaml +26 -0
- package/dist/agent-src/skills/secrets-management/SKILL.md +4 -0
- package/dist/agent-src/skills/server-hardening/SKILL.md +159 -0
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +3 -0
- package/dist/agent-src/skills/skill-management/SKILL.md +3 -0
- package/dist/agent-src/skills/skill-reviewer/SKILL.md +3 -0
- package/dist/agent-src/skills/skill-writing/SKILL.md +6 -0
- package/dist/agent-src/skills/skill-writing/references/procedure.md +24 -2
- package/dist/agent-src/skills/spreadsheet-authoring/SKILL.md +3 -0
- package/dist/agent-src/skills/storybook-workshop/SKILL.md +203 -0
- package/dist/agent-src/skills/storybook-workshop/scripts/story_contrast_floor.ts +134 -0
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +1 -1
- package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +25 -0
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +12 -0
- package/dist/agent-src/skills/systematic-debugging/SKILL.md +1 -1
- package/dist/agent-src/skills/terraform/SKILL.md +3 -0
- package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -1
- package/dist/agent-src/skills/threat-modeling/SKILL.md +0 -3
- package/dist/agent-src/skills/token-optimizer/SKILL.md +3 -0
- package/dist/agent-src/skills/typography-system/SKILL.md +3 -0
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +17 -1
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +3 -0
- package/dist/agent-src/skills/validate-feature-fit/SKILL.md +3 -0
- package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +2 -2
- package/dist/agent-src/skills/wireframe/SKILL.md +3 -0
- package/dist/agent-src/skills/wireframe/references/story-beat-ledger.schema.json +115 -0
- package/dist/agent-src/skills/workspace-link/SKILL.md +131 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/playbook.md +75 -0
- package/dist/agent-src/templates/roadmaps.md +37 -0
- package/dist/agent-src/templates/scripts/check_playbook_invokes.ts +231 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +24 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +216 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +159 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +73 -4
- package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +325 -40
- package/dist/cli/commands/uiAudit.js +221 -0
- package/dist/cli/commands/uiRender.js +206 -0
- package/dist/cli/main.js +22 -1
- package/dist/cli/mcp/content.js +64 -1
- package/dist/cli/mcp/dispatch.js +175 -10
- package/dist/cli/registry.js +3 -0
- package/dist/cli-delegate/{chunk-G23AT6GD.js → chunk-DMSZHXZS.js} +57 -1
- package/dist/cli-delegate/{chunk-77GR3VD4.js → chunk-FF7WAFMR.js} +58 -3
- package/dist/cli-delegate/{chunk-YM4GZDJG.js → chunk-JCW7ZLHK.js} +10 -0
- package/dist/cli-delegate/{chunk-H4VIVD4C.js → chunk-JJA2QEWA.js} +413 -391
- package/dist/cli-delegate/{chunk-PLSG6UL5.js → chunk-K4FFODTS.js} +341 -204
- package/dist/cli-delegate/{chunk-B2ERU2VA.js → chunk-WOKWX5PL.js} +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +8 -6
- package/dist/cli-delegate/cmd_conformance.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +3 -3
- package/dist/cli-delegate/cmd_export.js +4 -4
- package/dist/cli-delegate/cmd_handoff.js +1 -1
- package/dist/cli-delegate/cmd_preflight.js +2 -2
- package/dist/cli-delegate/cmd_prune.js +4 -4
- package/dist/cli-delegate/cmd_session_recycle.js +70 -9
- package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +4 -4
- package/dist/cli-delegate/cmd_uninstall.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +4 -4
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +362 -127
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +18 -8
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +16 -6
- package/dist/hooks/dispatch.js +2575 -1472
- package/dist/install/install.mjs +800 -708
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1685 -1250
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/lean_projection_mode.js +40 -0
- package/dist/scripts/_lib/scoped_projection.js +84 -0
- package/dist/scripts/_lib/ui_surface.js +89 -0
- package/dist/scripts/condense.js +6 -10
- package/dist/scripts/project_thin_rules.js +40 -2
- package/dist/server/schemas/settings.js +6 -0
- package/dist/shared/skillRanking.js +159 -0
- package/docs/contracts/provider-lifecycle.md +47 -18
- package/docs/contracts/settings-classes.md +35 -5
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +49 -0
- package/docs/guidelines/agent-infra/downstream-changes-mechanics.md +91 -0
- package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +92 -0
- package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +45 -1
- package/docs/guidelines/agent-infra/roadmap-deferred-resolution-provenance.md +54 -0
- package/docs/guidelines/code-clarity.md +21 -0
- package/docs/guidelines/design-antipatterns.md +4 -2
- package/docs/guidelines/design-asset-discipline.md +38 -0
- package/docs/guidelines/design-fidelity-mechanics.md +45 -29
- package/docs/guidelines/design-handover-extraction.md +35 -5
- package/docs/guidelines/design-modes.md +41 -1
- package/docs/guidelines/monorepo-antipatterns.md +141 -0
- package/docs/guidelines/redundancy-taxonomy.md +180 -0
- package/llms.txt +50 -39
- package/package.json +6 -2
- package/src/agent-src/templates/scripts/check_playbook_invokes.ts +231 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +24 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +216 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +159 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +73 -4
- package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +325 -40
- package/src/config/agent-settings.template.yml +44 -0
- package/src/config/assurance-capability-registry.json +223 -0
- package/src/config/assurance-threshold-budget.json +65 -0
- package/src/config/budgets.yml +19 -0
- package/src/config/ci-local-parity.yml +29 -0
- package/src/config/discovery/prompt-patterns.yml +56 -0
- package/src/config/discovery/unassigned-artefacts.yml +2 -0
- package/src/config/dispatch-economy-metrics.json +4 -2
- package/src/config/estate-count-budget.json +8 -3
- package/src/config/evaluator-budgets.json +14 -14
- package/src/config/gate-coverage.yml +392 -8
- package/src/config/gate-violation-baselines.json +76 -72
- package/src/config/hook-latency-budget.json +1 -0
- package/src/config/hook-token-budget.json +137 -125
- package/src/config/pack-size-budget.json +39 -10
- package/src/config/preamble-payload-budget.json +97 -71
- package/src/config/quorum-attendance-budget.json +12 -4
- package/src/config/routing-coverage-seed.json +29 -0
- package/src/config/rule-activation-census.json +7 -3
- package/src/config/rule-enforcement-baseline.json +0 -1
- package/src/config/rule-stub-ceilings.json +112 -91
- package/src/config/suggestion-capture.json +28 -0
- package/src/config/surface-matrix.yml +21 -2
- package/src/config/web-launch-readiness.json +188 -0
- package/src/scripts/_cli/cmd_doctor.ts +15 -16
- package/src/scripts/_cli/doctor_install_mode.ts +49 -0
- package/src/scripts/_cli/doctor_overrides.ts +154 -0
- package/src/scripts/_dispatch.bash +17 -0
- package/src/scripts/_lib/as_of.ts +412 -0
- package/src/scripts/_lib/exec_evidence.ts +7 -0
- package/src/scripts/_lib/gate_baseline.ts +150 -1
- package/src/scripts/_lib/hook_settings.ts +33 -0
- package/src/scripts/_lib/host_listing_model.ts +192 -0
- package/src/scripts/_lib/lean_projection_mode.ts +44 -0
- package/src/scripts/_lib/mcp_bridge.ts +199 -0
- package/src/scripts/_lib/review_independence.ts +62 -10
- package/src/scripts/_lib/rule_injection.ts +239 -0
- package/src/scripts/_lib/run_checkpoint.ts +54 -1
- package/src/scripts/_lib/scoped_projection.ts +96 -0
- package/src/scripts/_lib/session_register.ts +44 -2
- package/src/scripts/_lib/skill_catalogue.ts +38 -2
- package/src/scripts/_lib/skill_estate.ts +115 -0
- package/src/scripts/_lib/transcript_reads.ts +207 -0
- package/src/scripts/_lib/ui_authority.ts +343 -0
- package/src/scripts/ai-video/adapters/fal.sh +8 -3
- package/src/scripts/ai-video/adapters/gemini-veo.sh +10 -0
- package/src/scripts/ai-video/adapters/higgsfield.sh +10 -2
- package/src/scripts/ai-video/adapters/kling.sh +10 -0
- package/src/scripts/ai-video/adapters/sora.sh +10 -0
- package/src/scripts/ai-video/lib/calibrate-cost.sh +145 -0
- package/src/scripts/ai-video/lib/model-capabilities/README.md +53 -7
- package/src/scripts/ai-video/lib/model-capabilities/comfyui.json +15 -3
- package/src/scripts/ai-video/lib/model-capabilities/fal.json +36 -6
- package/src/scripts/ai-video/lib/model-capabilities/gemini-veo.json +23 -0
- package/src/scripts/ai-video/lib/model-capabilities/higgsfield.json +23 -0
- package/src/scripts/ai-video/lib/model-capabilities/kling.json +23 -0
- package/src/scripts/ai-video/lib/model-capabilities/musetalk.json +8 -2
- package/src/scripts/ai-video/lib/model-capabilities/replicate.json +36 -6
- package/src/scripts/ai-video/lib/model-capabilities/sora.json +45 -0
- package/src/scripts/ai-video/lib/model-capabilities/syncso.json +8 -2
- package/src/scripts/ai-video/lib/parse-blueprint.sh +52 -5
- package/src/scripts/ai-video/lib/resume-scan.sh +92 -3
- package/src/scripts/ai-video/lib/seam-plan.sh +212 -0
- package/src/scripts/ai-video/smoke-trace.sh +450 -2
- package/src/scripts/ai-video/stitch.sh +191 -10
- package/src/scripts/ai-video/test-pipeline.sh +84 -6
- package/src/scripts/ai_council/argument_exhaustion.ts +130 -0
- package/src/scripts/ai_council/cli_agency_bounds.ts +139 -0
- package/src/scripts/ai_council/cli_least_agency_canary.ts +347 -0
- package/src/scripts/ai_council/clients.ts +3 -2
- package/src/scripts/ai_council/consensus.ts +63 -6
- package/src/scripts/ai_council/events_log.ts +46 -1
- package/src/scripts/ai_council/orchestrator.ts +103 -108
- package/src/scripts/ai_council/orchestrator_results.ts +166 -0
- package/src/scripts/ai_council/prompts.ts +12 -5
- package/src/scripts/ai_council/quorum.ts +82 -1
- package/src/scripts/ai_council/quorum_wiring.ts +82 -5
- package/src/scripts/ai_council/stance_tally.ts +22 -0
- package/src/scripts/bench_hook_latency.ts +62 -0
- package/src/scripts/build_proof.ts +12 -1
- package/src/scripts/capture_skill_catalogue.ts +21 -0
- package/src/scripts/check_always_budget.ts +2 -1
- package/src/scripts/check_augmentignore.ts +2 -1
- package/src/scripts/check_beta_review_markers.ts +2 -1
- package/src/scripts/check_bundle_path_leakage.ts +162 -7
- package/src/scripts/check_command_examples.ts +557 -0
- package/src/scripts/check_composite_arming.ts +364 -0
- package/src/scripts/check_corpus_staleness.ts +2 -1
- package/src/scripts/check_council_pin_staleness.ts +3 -1
- package/src/scripts/check_enforcement_coverage.ts +116 -3
- package/src/scripts/check_enforcement_denominator.ts +365 -0
- package/src/scripts/check_estate_count.ts +122 -3
- package/src/scripts/check_gate_coverage.ts +2 -1
- package/src/scripts/check_hook_bundle_freshness.ts +13 -1
- package/src/scripts/check_knowledge_cards.ts +2 -1
- package/src/scripts/check_knowledge_pages.ts +3 -2
- package/src/scripts/check_memory.ts +2 -1
- package/src/scripts/check_no_automerge_key.ts +287 -0
- package/src/scripts/check_pack_conformance_fixture.ts +565 -0
- package/src/scripts/check_preamble_payload_budget.ts +30 -3
- package/src/scripts/check_proposal.ts +2 -1
- package/src/scripts/check_reach_staleness.ts +2 -1
- package/src/scripts/check_release_adjacent_health.ts +2 -1
- package/src/scripts/check_release_pr_shape.ts +5 -0
- package/src/scripts/check_review_schema.ts +34 -1
- package/src/scripts/check_roadmap_trackable.ts +48 -3
- package/src/scripts/check_routing_coverage.ts +352 -0
- package/src/scripts/check_score_contract.ts +505 -0
- package/src/scripts/check_skill_admissions.ts +514 -0
- package/src/scripts/check_source_size_budget.ts +2 -1
- package/src/scripts/check_standing_payload_delta.ts +505 -0
- package/src/scripts/check_trigger_evals.ts +2 -1
- package/src/scripts/check_web_launch_readiness.ts +705 -0
- package/src/scripts/classify_change_risk.ts +281 -0
- package/src/scripts/compute_skill_tiers.ts +186 -0
- package/src/scripts/condense.ts +8 -13
- package/src/scripts/council_attendance_metrics.ts +183 -0
- package/src/scripts/council_cli.ts +10 -8
- package/src/scripts/council_parse_rate.ts +116 -0
- package/src/scripts/derive_playbooks.ts +406 -0
- package/src/scripts/description_route_check.ts +494 -0
- package/src/scripts/design_slop_rules.ts +56 -2
- package/src/scripts/dispatch_r2_reviewer.ts +16 -0
- package/src/scripts/frontend_corpus_hash.ts +116 -0
- package/src/scripts/grade_target_readiness.ts +478 -0
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +124 -16
- package/src/scripts/hooks/concern_registry.ts +6 -0
- package/src/scripts/hooks/design_pass_hook.ts +356 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +30 -7
- package/src/scripts/hooks/rule_inject_hook.ts +318 -0
- package/src/scripts/hooks/suggestion_capture_hook.ts +368 -0
- package/src/scripts/hot_context_hook.ts +74 -7
- package/src/scripts/install.ts +40 -89
- package/src/scripts/lint_adapter_tier.ts +663 -0
- package/src/scripts/lint_archived_skills.ts +93 -0
- package/src/scripts/lint_budget_ownership.ts +56 -5
- package/src/scripts/lint_deterministic_time.ts +470 -0
- package/src/scripts/lint_framework_leakage.ts +5 -0
- package/src/scripts/lint_handoffs.ts +525 -1
- package/src/scripts/lint_judge_prompt_expectation.ts +155 -0
- package/src/scripts/lint_marketplace.ts +88 -0
- package/src/scripts/lint_media_policy_linkage.ts +140 -1
- package/src/scripts/lint_one_off_age.ts +6 -1
- package/src/scripts/lint_override_kernel_guard.ts +87 -5
- package/src/scripts/lint_roadmap_complexity.ts +56 -0
- package/src/scripts/lint_rule_enforcement_declaration.ts +24 -7
- package/src/scripts/lint_rule_norm_pin.ts +321 -0
- package/src/scripts/lint_skill_trigger_corpus.ts +349 -0
- package/src/scripts/lint_spawn_payload.ts +42 -5
- package/src/scripts/lint_symptom_intake.ts +2 -1
- package/src/scripts/mcp_parity_smoke.ts +30 -4
- package/src/scripts/mcp_render.ts +66 -1
- package/src/scripts/mcp_tool_fingerprint.ts +241 -0
- package/src/scripts/measure_risk_class_drift.ts +140 -0
- package/src/scripts/measure_skill_ranker_baseline.ts +212 -0
- package/src/scripts/media/lib/adapter-common.sh +211 -1
- package/src/scripts/media/lib/adapter-contract.md +74 -6
- package/src/scripts/model_rule_injection.ts +907 -0
- package/src/scripts/pack_install_smoke.ts +363 -0
- package/src/scripts/pr_conflict_census.ts +187 -0
- package/src/scripts/project_thin_rules.ts +45 -2
- package/src/scripts/release.ts +66 -860
- package/src/scripts/release_drill.ts +59 -3
- package/src/scripts/release_env.ts +298 -0
- package/src/scripts/release_publication.ts +720 -0
- package/src/scripts/report_pack_delta.ts +204 -0
- package/src/scripts/roadmap_context.ts +778 -0
- package/src/scripts/schemas/fidelity-measurement-sheet.schema.json +169 -0
- package/src/scripts/schemas/rule.schema.json +24 -2
- package/src/scripts/schemas/skill.schema.json +39 -0
- package/src/scripts/schemas/ui-authority.schema.json +114 -0
- package/src/scripts/select_analysis_mode.ts +112 -0
- package/src/scripts/session_register_hook.ts +29 -3
- package/src/scripts/sessions_cli.ts +67 -3
- package/src/scripts/skill_tools/score_skill_relevance.ts +36 -53
- package/src/scripts/sync_pr_branch.ts +40 -1
- package/src/scripts/token_sink_report.ts +239 -0
- package/src/scripts/trigger_coverage.ts +122 -3
- package/src/scripts/update_counts.ts +7 -3
- package/src/scripts/validate_frontmatter.ts +66 -0
- package/src/server/schemas/settings.ts +10 -0
- package/src/shared/skillRanking.ts +183 -0
- package/dist/agent-src/skills/accessibility-auditor/evals/evals.json +0 -15
- package/dist/agent-src/skills/agent-security-review/evals/triggers.json +0 -52
- package/dist/agent-src/skills/ai-code-blindspots/evals/triggers.json +0 -52
- package/dist/agent-src/skills/analysis-skill-router/evals/evals.json +0 -13
- package/dist/agent-src/skills/brand/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-asset-generation/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-audit/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-identity/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-strategy/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-to-tokens/evals/triggers.json +0 -17
- package/dist/agent-src/skills/bug-analyzer/evals/evals.json +0 -13
- package/dist/agent-src/skills/canvas-design/evals/triggers.json +0 -17
- package/dist/agent-src/skills/character-consistency/evals/evals.json +0 -16
- package/dist/agent-src/skills/code-intelligence/evals/triggers.json +0 -52
- package/dist/agent-src/skills/code-review/evals/evals.json +0 -100
- package/dist/agent-src/skills/command-routing/evals/evals.json +0 -14
- package/dist/agent-src/skills/complexity-first-planning/evals/triggers.json +0 -17
- package/dist/agent-src/skills/contract-review/evals/triggers.json +0 -17
- package/dist/agent-src/skills/conventional-commits-writing/evals/evals.json +0 -15
- package/dist/agent-src/skills/corpus-grounding/evals/triggers.json +0 -17
- package/dist/agent-src/skills/dashboard-design/evals/evals.json +0 -16
- package/dist/agent-src/skills/dcf-modeling/evals/domain-truth.json +0 -29
- package/dist/agent-src/skills/dcf-modeling/evals/evals.json +0 -20
- package/dist/agent-src/skills/decision-record/evals/evals.json +0 -20
- package/dist/agent-src/skills/decision-record/evals/triggers.json +0 -87
- package/dist/agent-src/skills/design-intelligence/evals/evals.json +0 -14
- package/dist/agent-src/skills/design-intelligence/evals/triggers.json +0 -17
- package/dist/agent-src/skills/design-system-capture/evals/evals.json +0 -15
- package/dist/agent-src/skills/design-tokens/evals/triggers.json +0 -17
- package/dist/agent-src/skills/design-variations/evals/triggers.json +0 -17
- package/dist/agent-src/skills/developer-like-execution/evals/evals.json +0 -16
- package/dist/agent-src/skills/doc-coauthoring/evals/evals.json +0 -16
- package/dist/agent-src/skills/doc-coauthoring/evals/triggers.json +0 -17
- package/dist/agent-src/skills/docx-authoring/evals/triggers.json +0 -52
- package/dist/agent-src/skills/dpa-review/evals/triggers.json +0 -17
- package/dist/agent-src/skills/editorial-calendar/evals/domain-truth.json +0 -16
- package/dist/agent-src/skills/editorial-calendar/evals/evals.json +0 -16
- package/dist/agent-src/skills/eloquent/evals/triggers.json +0 -17
- package/dist/agent-src/skills/estimate-ticket/evals/evals.json +0 -16
- package/dist/agent-src/skills/estimate-ticket/evals/output-schema.yml +0 -20
- package/dist/agent-src/skills/estimate-ticket/evals/triggers.json +0 -19
- package/dist/agent-src/skills/evaluate-llm-feature/evals/triggers.json +0 -52
- package/dist/agent-src/skills/existing-ui-audit/evals/triggers.json +0 -47
- package/dist/agent-src/skills/experiment-loop/evals/output-schema.yml +0 -27
- package/dist/agent-src/skills/experiment-loop/evals/triggers.json +0 -17
- package/dist/agent-src/skills/fe-design/evals/triggers.json +0 -55
- package/dist/agent-src/skills/forecasting/evals/domain-truth.json +0 -29
- package/dist/agent-src/skills/forecasting/evals/evals.json +0 -20
- package/dist/agent-src/skills/forensics-report/evals/triggers.json +0 -17
- package/dist/agent-src/skills/frontend-render-security/evals/triggers.json +0 -52
- package/dist/agent-src/skills/fundraising-narrative/evals/domain-truth.json +0 -16
- package/dist/agent-src/skills/fundraising-narrative/evals/evals.json +0 -16
- package/dist/agent-src/skills/gated-reach/evals/triggers.json +0 -72
- package/dist/agent-src/skills/github-ci/evals/evals.json +0 -25
- package/dist/agent-src/skills/history-design/evals/triggers.json +0 -17
- package/dist/agent-src/skills/html-deck/evals/triggers.json +0 -17
- package/dist/agent-src/skills/humanizer/evals/strip_fixtures.json +0 -57
- package/dist/agent-src/skills/humanizer/evals/triggers.json +0 -17
- package/dist/agent-src/skills/iconography/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-analyser/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-creator/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-editing/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-generation/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-provider-routing/evals/triggers.json +0 -17
- package/dist/agent-src/skills/incident-commander/evals/domain-truth.json +0 -16
- package/dist/agent-src/skills/incident-commander/evals/evals.json +0 -20
- package/dist/agent-src/skills/judge-artifact-completeness/evals/triggers.json +0 -17
- package/dist/agent-src/skills/judge-injection-defense/evals/triggers.json +0 -17
- package/dist/agent-src/skills/judge-synthesis/evals/triggers.json +0 -17
- package/dist/agent-src/skills/launch-readiness/evals/evals.json +0 -21
- package/dist/agent-src/skills/learning-tutor/evals/triggers.json +0 -52
- package/dist/agent-src/skills/legal-intake-triage/evals/triggers.json +0 -17
- package/dist/agent-src/skills/legal-practice-profile/evals/triggers.json +0 -17
- package/dist/agent-src/skills/license-compliance-audit/evals/triggers.json +0 -52
- package/dist/agent-src/skills/license-compliance-borrow-check/evals/triggers.json +0 -52
- package/dist/agent-src/skills/license-compliance-credits/evals/triggers.json +0 -52
- package/dist/agent-src/skills/llm-provider-knowledge/evals/triggers.json +0 -20
- package/dist/agent-src/skills/logging-monitoring/evals/evals.json +0 -16
- package/dist/agent-src/skills/logo-generation/evals/triggers.json +0 -17
- package/dist/agent-src/skills/messaging-architecture/evals/domain-truth.json +0 -16
- package/dist/agent-src/skills/messaging-architecture/evals/evals.json +0 -16
- package/dist/agent-src/skills/nda-triage/evals/triggers.json +0 -17
- package/dist/agent-src/skills/pdf-tools/evals/triggers.json +0 -52
- package/dist/agent-src/skills/perf-feedback-craft/evals/evals.json +0 -16
- package/dist/agent-src/skills/persona-improvement/evals/triggers.json +0 -52
- package/dist/agent-src/skills/php-coder/evals/triggers.json +0 -17
- package/dist/agent-src/skills/prediction-pool-optimizer/evals/triggers.json +0 -21
- package/dist/agent-src/skills/prompt-engineering-image/evals/triggers.json +0 -17
- package/dist/agent-src/skills/prompt-engineering-patterns/evals/evals.json +0 -16
- package/dist/agent-src/skills/prompt-validator/evals/triggers.json +0 -17
- package/dist/agent-src/skills/quality-tools/evals/evals.json +0 -15
- package/dist/agent-src/skills/reasoning-orchestrator/evals/triggers.json +0 -17
- package/dist/agent-src/skills/refine-prompt/evals/evals.json +0 -16
- package/dist/agent-src/skills/refine-ticket/evals/evals.json +0 -16
- package/dist/agent-src/skills/refine-ticket/evals/output-schema.yml +0 -16
- package/dist/agent-src/skills/refine-ticket/evals/triggers.json +0 -17
- package/dist/agent-src/skills/release-comms/evals/evals.json +0 -16
- package/dist/agent-src/skills/rice-prioritization/evals/evals.json +0 -20
- package/dist/agent-src/skills/runway-cognition/evals/domain-truth.json +0 -29
- package/dist/agent-src/skills/runway-cognition/evals/evals.json +0 -20
- package/dist/agent-src/skills/scenario-modeling/evals/domain-truth.json +0 -29
- package/dist/agent-src/skills/scenario-modeling/evals/evals.json +0 -20
- package/dist/agent-src/skills/schema-review/evals/triggers.json +0 -17
- package/dist/agent-src/skills/screenshot-hygiene/evals/triggers.json +0 -52
- package/dist/agent-src/skills/security-maturity-assessment/evals/triggers.json +0 -52
- package/dist/agent-src/skills/skill-writing/evals/triggers.json +0 -17
- package/dist/agent-src/skills/spreadsheet-authoring/evals/triggers.json +0 -47
- package/dist/agent-src/skills/subagent-orchestration/evals/evals.json +0 -60
- package/dist/agent-src/skills/supply-chain-intake/evals/triggers.json +0 -52
- package/dist/agent-src/skills/systematic-debugging/evals/evals.json +0 -20
- package/dist/agent-src/skills/test-case-discovery/evals/triggers.json +0 -52
- package/dist/agent-src/skills/test-driven-development/evals/evals.json +0 -16
- package/dist/agent-src/skills/threat-modeling/evals/evals.json +0 -21
- package/dist/agent-src/skills/typography-system/evals/evals.json +0 -14
- package/dist/agent-src/skills/typography-system/evals/triggers.json +0 -17
- package/dist/agent-src/skills/unit-economics-modeling/evals/domain-truth.json +0 -40
- package/dist/agent-src/skills/unit-economics-modeling/evals/evals.json +0 -24
- package/dist/agent-src/skills/verify-completion-evidence/evals/evals.json +0 -16
- package/dist/agent-src/skills/verify-repair-loop/evals/output-schema.yml +0 -20
- package/dist/agent-src/skills/verify-repair-loop/evals/triggers.json +0 -17
- package/dist/agent-src/skills/vision-articulation/evals/evals.json +0 -16
- package/dist/agent-src/skills/voice-and-tone-design/evals/evals.json +0 -16
- package/dist/agent-src/skills/wireframe/evals/triggers.json +0 -17
- package/dist/agent-src/skills/worktree-lifecycle/evals/evals.json +0 -38
- package/dist/agent-src/skills/worktree-lifecycle/evals/triggers.json +0 -52
- package/dist/cli/agent-config.js.map +0 -1
- package/dist/cli/bash/runBash.js.map +0 -1
- package/dist/cli/commands/commands.js.map +0 -1
- package/dist/cli/commands/config.js.map +0 -1
- package/dist/cli/commands/doctorShell.js.map +0 -1
- package/dist/cli/commands/mcpServer.js.map +0 -1
- package/dist/cli/commands/packs.js.map +0 -1
- package/dist/cli/commands/profiles.js.map +0 -1
- package/dist/cli/commands/recordTriggerEval.js.map +0 -1
- package/dist/cli/commands/rtkDetect.js.map +0 -1
- package/dist/cli/commands/settings.js.map +0 -1
- package/dist/cli/commands/uiServe.js.map +0 -1
- package/dist/cli/commands/versions.js.map +0 -1
- package/dist/cli/commands/workspaces.js.map +0 -1
- package/dist/cli/configRoot.js.map +0 -1
- package/dist/cli/discovery/loadManifest.js.map +0 -1
- package/dist/cli/firstRunNotice.js.map +0 -1
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/initRouting.js.map +0 -1
- package/dist/cli/log/logger.js.map +0 -1
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/mcp/content.js.map +0 -1
- package/dist/cli/mcp/dispatch.js.map +0 -1
- package/dist/cli/mcp/stdio.js.map +0 -1
- package/dist/cli/paths.js.map +0 -1
- package/dist/cli/python/knowledge_ingest.js.map +0 -1
- package/dist/cli/python/workspace_analytics.js.map +0 -1
- package/dist/cli/python/workspace_crypto.js.map +0 -1
- package/dist/cli/python/workspace_documents.js.map +0 -1
- package/dist/cli/python/workspace_drive.js.map +0 -1
- package/dist/cli/python/workspace_drive_health.js.map +0 -1
- package/dist/cli/python/workspace_explain.js.map +0 -1
- package/dist/cli/python/workspace_hosts.js.map +0 -1
- package/dist/cli/python/workspace_inbox.js.map +0 -1
- package/dist/cli/python/workspace_render.js.map +0 -1
- package/dist/cli/python/workspace_roles.js.map +0 -1
- package/dist/cli/python/workspace_secrets.js.map +0 -1
- package/dist/cli/python/workspace_sessions.js.map +0 -1
- package/dist/cli/python/workspace_skills.js.map +0 -1
- package/dist/cli/registry.js.map +0 -1
- package/dist/install/agentSwitchDetection.js.map +0 -1
- package/dist/install/agentSwitchProfile.js.map +0 -1
- package/dist/install/atomic.js.map +0 -1
- package/dist/install/claudePathsPlan.js.map +0 -1
- package/dist/install/conflict.js.map +0 -1
- package/dist/install/detect.js.map +0 -1
- package/dist/install/emit_host_rules_cli.js.map +0 -1
- package/dist/install/globalRuleLayers.js.map +0 -1
- package/dist/install/hostLayerFingerprint.js.map +0 -1
- package/dist/install/partitionEligibility.js.map +0 -1
- package/dist/install/paths.js.map +0 -1
- package/dist/install/plan.js.map +0 -1
- package/dist/install/preflight.js.map +0 -1
- package/dist/install/rtkDetection.js.map +0 -1
- package/dist/install/ruleInScope.js.map +0 -1
- package/dist/install/ruleLayerPartition.js.map +0 -1
- package/dist/install/rule_scope.js.map +0 -1
- package/dist/install/rule_scope_cli.js.map +0 -1
- package/dist/install/selectedTools.js.map +0 -1
- package/dist/install/toolDetection.js.map +0 -1
- package/dist/install/txlog.js.map +0 -1
- package/dist/install/types.js.map +0 -1
- package/dist/install/wizard-plan.js.map +0 -1
- package/dist/install/wizardDismissals.js.map +0 -1
- package/dist/scripts/_lib/agent_settings.js.map +0 -1
- package/dist/scripts/_lib/agent_src.js.map +0 -1
- package/dist/scripts/_lib/claude_builtin_names.js.map +0 -1
- package/dist/scripts/_lib/claude_plugin.js.map +0 -1
- package/dist/scripts/_lib/claude_settings_hooks.js.map +0 -1
- package/dist/scripts/_lib/compile_time_toggles.js.map +0 -1
- package/dist/scripts/_lib/environment_detector.js.map +0 -1
- package/dist/scripts/_lib/host_launch.js.map +0 -1
- package/dist/scripts/_lib/install_layout.js.map +0 -1
- package/dist/scripts/_lib/installed_lock.js.map +0 -1
- package/dist/scripts/_lib/model_tier.js.map +0 -1
- package/dist/scripts/_lib/prune_empty_dirs.js.map +0 -1
- package/dist/scripts/_lib/scoped_projection.js.map +0 -1
- package/dist/scripts/_lib/script_output.js.map +0 -1
- package/dist/scripts/_lib/spawn_env.js.map +0 -1
- package/dist/scripts/_lib/surface_tiers.js.map +0 -1
- package/dist/scripts/_lib/token_count.js.map +0 -1
- package/dist/scripts/_lib/trigger_eval_floors.js.map +0 -1
- package/dist/scripts/_lib/user_global_paths.js.map +0 -1
- package/dist/scripts/ai_council/modes.js.map +0 -1
- package/dist/scripts/ai_council/transport_resolver.js.map +0 -1
- package/dist/scripts/condense.js.map +0 -1
- package/dist/scripts/project_thin_rules.js.map +0 -1
- package/dist/server/app.js.map +0 -1
- package/dist/server/io/atomicMultiWrite.js.map +0 -1
- package/dist/server/io/atomicWrite.js.map +0 -1
- package/dist/server/io/sharedWriteCheck.js.map +0 -1
- package/dist/server/io/substituteTemplate.js.map +0 -1
- package/dist/server/io/yamlIO.js.map +0 -1
- package/dist/server/nicknameResolver.js.map +0 -1
- package/dist/server/port.js.map +0 -1
- package/dist/server/routes/discovery.js.map +0 -1
- package/dist/server/routes/install.js.map +0 -1
- package/dist/server/routes/ping.js.map +0 -1
- package/dist/server/routes/schema.js.map +0 -1
- package/dist/server/routes/settings.js.map +0 -1
- package/dist/server/routes/settingsChanges.js.map +0 -1
- package/dist/server/routes/userMd.js.map +0 -1
- package/dist/server/routes/wizard.js.map +0 -1
- package/dist/server/routes/workspace.js.map +0 -1
- package/dist/server/schemas/settings.js.map +0 -1
- package/dist/server/serverInfo.js.map +0 -1
- package/dist/server/token.js.map +0 -1
- package/dist/server/writeRoot.js.map +0 -1
- package/dist/shared/capabilities.js.map +0 -1
- package/dist/shared/interactiveContext.js.map +0 -1
- package/dist/shared/nicknamePrefill.js.map +0 -1
- package/dist/shared/settingsAsks.js.map +0 -1
- package/dist/shared/settingsCarveOut.js.map +0 -1
- package/dist/shared/settingsClasses.js.map +0 -1
- package/dist/shared/settingsConsent.js.map +0 -1
- package/dist/shared/settingsSurface.js.map +0 -1
- package/dist/shared/userMd/formAdapter.js.map +0 -1
- package/dist/shared/userMd/schema.js.map +0 -1
- package/dist/shared/userMd/utils.js.map +0 -1
- package/dist/ui/assets/index-Cxgy63kz.js.map +0 -1
- package/src/scripts/_lib/adr_frontmatter.test.ts +0 -365
- package/src/scripts/_lib/adversarial_council_gate.test.ts +0 -112
- package/src/scripts/_lib/adversarial_reconcile.test.ts +0 -197
- package/src/scripts/_lib/auto_dispatch.corpus.test.ts +0 -150
- package/src/scripts/_lib/secret_detector.test.ts +0 -108
- package/src/scripts/_lib/secret_detector_adversarial.test.ts +0 -116
- package/src/scripts/_lib/untrusted_content.test.ts +0 -175
- package/src/scripts/check_secret_leak.test.ts +0 -90
- package/src/scripts/design_slop_rules.test.ts +0 -239
- package/src/scripts/self_review_gate.test.ts +0 -296
- package/src/shared/capabilities.test.ts +0 -43
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule-injection core — THE single module both the offline model and the
|
|
3
|
+
* runtime concern read.
|
|
4
|
+
*
|
|
5
|
+
* WHY ONE MODULE. `road-to-trigger-delivered-rule-bodies` step 0.5 states the
|
|
6
|
+
* failure this prevents in as many words: *an experiment whose offline pricing
|
|
7
|
+
* and runtime delivery use different matchers measures nothing*. So the price /
|
|
8
|
+
* recall model (`src/scripts/model_rule_injection.ts`) and the delivery concern
|
|
9
|
+
* (`src/scripts/hooks/rule_inject_hook.ts`) both import THIS file, and neither
|
|
10
|
+
* re-implements selection, ordering, capping, or body loading.
|
|
11
|
+
*
|
|
12
|
+
* IT OWNS NO MATCHER. Trigger semantics belong to
|
|
13
|
+
* [`_lib/router_match.ts`](router_match.ts), which is already the single
|
|
14
|
+
* implementation for every surface that answers "which rules fire on this
|
|
15
|
+
* prompt?" and is pinned by `tests/scripts/router_match_parity.test.ts`. A
|
|
16
|
+
* second matcher here would be the violation that test exists to catch, so
|
|
17
|
+
* `matchTierRules` is a thin, deterministic wrapper over `match_prompt` and
|
|
18
|
+
* nothing more. Step 0.3's pre-registered comparison found no reason to write
|
|
19
|
+
* one — see `model_rule_injection.ts`'s header for the measured verdict.
|
|
20
|
+
*
|
|
21
|
+
* KERNEL IS NEVER INJECTED. The nine kernel rules are in standing context by
|
|
22
|
+
* definition; injecting one would be paying twice for a body that is already
|
|
23
|
+
* there. `match_prompt` returns kernel ids in `activated_rules` because kernel
|
|
24
|
+
* rules are always active — this module filters them out by construction rather
|
|
25
|
+
* than relying on a caller to remember.
|
|
26
|
+
*
|
|
27
|
+
* IT IMPORTS NO TOKENIZER, AND THAT IS A HOT-PATH FACT RATHER THAN A STYLE
|
|
28
|
+
* CHOICE. `_lib/token_count.ts` resolves `js-tiktoken` AT MODULE LOAD, and the
|
|
29
|
+
* concern that imports this file is statically reachable from
|
|
30
|
+
* `concern_registry.ts` — so importing it here made every hook dispatch on
|
|
31
|
+
* every slot pay a tokenizer load for a concern that is default-OFF and emits
|
|
32
|
+
* nothing. Measured on this tree: unbinding the concern moved the
|
|
33
|
+
* `pre_tool_use` p95 from 202 ms to 196 ms, and the CI latency gate went red on
|
|
34
|
+
* the branch that introduced it while passing on main.
|
|
35
|
+
*
|
|
36
|
+
* So the runtime cap is in BYTES. That is not a weaker bound — it is the same
|
|
37
|
+
* bound in the unit the budget actually enforces: `hook-token-budget.json`
|
|
38
|
+
* measures "bytes of concern stdout payload fields", so the cap and its
|
|
39
|
+
* registered row are now the same number instead of two units that need a
|
|
40
|
+
* conversion factor to compare. The offline model keeps exact-BPE tokens for
|
|
41
|
+
* its price table, where the tokenizer is the point and nothing is on a hot
|
|
42
|
+
* path.
|
|
43
|
+
*
|
|
44
|
+
* DETERMINISM IS THE CONTRACT, and the collision cases are the reason it needs
|
|
45
|
+
* stating. Two triggers on the SAME rule collapse to one entry (a rule is
|
|
46
|
+
* delivered once, however many of its triggers fired) while the trigger count
|
|
47
|
+
* survives as `score`. Two DIFFERENT rules both firing are returned in router
|
|
48
|
+
* declaration order, tier_1 before tier_2 — never in match order, which would
|
|
49
|
+
* make the output depend on trigger authoring order inside a rule. Capping
|
|
50
|
+
* sorts by descending score with router order as the tie-break, so the same
|
|
51
|
+
* prompt against the same router always yields the same bytes.
|
|
52
|
+
*/
|
|
53
|
+
import * as fs from 'node:fs';
|
|
54
|
+
import * as path from 'node:path';
|
|
55
|
+
|
|
56
|
+
import { match_prompt, type Router, type Trigger } from './router_match.js';
|
|
57
|
+
|
|
58
|
+
export type { Router, Trigger };
|
|
59
|
+
|
|
60
|
+
/** Tier a matched rule came from. Kernel is never a value here. */
|
|
61
|
+
export type Tier = 'tier_1' | 'tier_2';
|
|
62
|
+
|
|
63
|
+
export interface TierRuleMatch {
|
|
64
|
+
id: string;
|
|
65
|
+
tier: Tier;
|
|
66
|
+
/** How many of this rule's triggers matched. Ties break on router order. */
|
|
67
|
+
score: number;
|
|
68
|
+
/** Router declaration index within its tier — the deterministic tie-break. */
|
|
69
|
+
order: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Kinds of trigger a prompt alone can never fire. */
|
|
73
|
+
export const PATH_TRIGGER_KINDS = ['path_prefix', 'file_pattern'] as const;
|
|
74
|
+
|
|
75
|
+
export function loadRouter(repoRoot: string): Router {
|
|
76
|
+
const p = path.join(repoRoot, 'dist', 'router.json');
|
|
77
|
+
return JSON.parse(fs.readFileSync(p, 'utf8')) as Router;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Kernel rule ids, as declared by the router. */
|
|
81
|
+
export function kernelIds(router: Router): Set<string> {
|
|
82
|
+
const k = Array.isArray(router['kernel']) ? router['kernel'] : [];
|
|
83
|
+
return new Set(k.map((x) => String(x)));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function tierEntries(router: Router, tier: Tier): Array<{ id: string; triggers: Trigger[] }> {
|
|
87
|
+
const raw = router[tier];
|
|
88
|
+
if (!Array.isArray(raw)) return [];
|
|
89
|
+
return (raw as unknown as Array<Record<string, unknown>>).map((r) => ({
|
|
90
|
+
id: String(r['id'] ?? ''),
|
|
91
|
+
triggers: Array.isArray(r['triggers']) ? (r['triggers'] as Trigger[]) : [],
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Every tier rule declared by the router, with its trigger list. */
|
|
96
|
+
export function allTierRules(router: Router): Array<{ id: string; tier: Tier; triggers: Trigger[] }> {
|
|
97
|
+
const out: Array<{ id: string; tier: Tier; triggers: Trigger[] }> = [];
|
|
98
|
+
for (const tier of ['tier_1', 'tier_2'] as Tier[]) {
|
|
99
|
+
for (const e of tierEntries(router, tier)) out.push({ ...e, tier });
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Rules whose triggers are ALL path-shaped — unreachable from a prompt alone. */
|
|
105
|
+
export function pathOnlyRuleIds(router: Router): Set<string> {
|
|
106
|
+
const ids = new Set<string>();
|
|
107
|
+
for (const r of allTierRules(router)) {
|
|
108
|
+
if (r.triggers.length === 0) continue;
|
|
109
|
+
const allPath = r.triggers.every((t) =>
|
|
110
|
+
PATH_TRIGGER_KINDS.some((k) => k in t),
|
|
111
|
+
);
|
|
112
|
+
if (allPath) ids.add(r.id);
|
|
113
|
+
}
|
|
114
|
+
return ids;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Rules declaring at least one path-shaped trigger. */
|
|
118
|
+
export function pathCapableRuleIds(router: Router): Set<string> {
|
|
119
|
+
const ids = new Set<string>();
|
|
120
|
+
for (const r of allTierRules(router)) {
|
|
121
|
+
if (r.triggers.some((t) => PATH_TRIGGER_KINDS.some((k) => k in t))) ids.add(r.id);
|
|
122
|
+
}
|
|
123
|
+
return ids;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Rules declaring no trigger at all — cannot be delivered, must stay eager. */
|
|
127
|
+
export function triggerlessRuleIds(router: Router): string[] {
|
|
128
|
+
return allTierRules(router)
|
|
129
|
+
.filter((r) => r.triggers.length === 0)
|
|
130
|
+
.map((r) => r.id);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Which tier rules fire on this prompt (+ optional open files / command).
|
|
135
|
+
*
|
|
136
|
+
* Kernel is excluded. Order is router declaration order, tier_1 first.
|
|
137
|
+
*/
|
|
138
|
+
export function matchTierRules(
|
|
139
|
+
router: Router,
|
|
140
|
+
prompt: string,
|
|
141
|
+
openFiles?: Iterable<string> | null,
|
|
142
|
+
command?: string | null,
|
|
143
|
+
): TierRuleMatch[] {
|
|
144
|
+
const kernel = kernelIds(router);
|
|
145
|
+
const res = match_prompt(router, prompt, 'full', openFiles, command);
|
|
146
|
+
const scores = new Map<string, number>();
|
|
147
|
+
for (const mt of res.matched_triggers) {
|
|
148
|
+
const id = String(mt.rule ?? '');
|
|
149
|
+
if (id === '' || kernel.has(id)) continue;
|
|
150
|
+
scores.set(id, (scores.get(id) ?? 0) + 1);
|
|
151
|
+
}
|
|
152
|
+
const out: TierRuleMatch[] = [];
|
|
153
|
+
let order = 0;
|
|
154
|
+
for (const r of allTierRules(router)) {
|
|
155
|
+
const s = scores.get(r.id);
|
|
156
|
+
if (s === undefined) {
|
|
157
|
+
order += 1;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
out.push({ id: r.id, tier: r.tier, score: s, order });
|
|
161
|
+
order += 1;
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Where the projected body of a rule lives. */
|
|
167
|
+
export function ruleBodyPath(repoRoot: string, id: string): string {
|
|
168
|
+
return path.join(repoRoot, 'dist', 'agent-src', 'rules', `${id}.md`);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** The projected body, or `null` when the rule has no projected file. */
|
|
172
|
+
export function loadRuleBody(repoRoot: string, id: string): string | null {
|
|
173
|
+
const p = ruleBodyPath(repoRoot, id);
|
|
174
|
+
if (!fs.existsSync(p)) return null;
|
|
175
|
+
return fs.readFileSync(p, 'utf8');
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* UTF-8 byte length — the runtime measure, dependency-free by design.
|
|
180
|
+
*
|
|
181
|
+
* Deliberately NOT a token count: see the header. Bytes are exact, need no
|
|
182
|
+
* tokenizer, and are the unit `hook-token-budget.json` enforces.
|
|
183
|
+
*/
|
|
184
|
+
export function bytesOf(text: string): number {
|
|
185
|
+
return Buffer.byteLength(text, 'utf8');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface SelectionResult {
|
|
189
|
+
selected: TierRuleMatch[];
|
|
190
|
+
/** Matched but dropped because the byte cap was reached. */
|
|
191
|
+
dropped: TierRuleMatch[];
|
|
192
|
+
/** Byte sum of the selected bodies. */
|
|
193
|
+
bytes: number;
|
|
194
|
+
/** Per-rule body byte counts, keyed by id, for every MATCHED rule. */
|
|
195
|
+
bodyBytes: Map<string, number>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Apply the per-prompt BYTE cap.
|
|
200
|
+
*
|
|
201
|
+
* Highest score first, router order as tie-break; a rule whose body would push
|
|
202
|
+
* the running total past `capBytes` is dropped and the walk continues, so one
|
|
203
|
+
* oversized body cannot starve the rest. The returned `selected` list is
|
|
204
|
+
* re-sorted back into router order — cap order is a budgeting concern, delivery
|
|
205
|
+
* order is not.
|
|
206
|
+
*
|
|
207
|
+
* ONE selection for both callers. The offline model and the runtime concern
|
|
208
|
+
* call THIS function with THE SAME cap, so the set the price table prices is
|
|
209
|
+
* byte-for-byte the set the concern delivers. That is step 0.5's requirement,
|
|
210
|
+
* and expressing the cap in bytes makes it hold without a token/byte
|
|
211
|
+
* conversion sitting between the two arms.
|
|
212
|
+
*/
|
|
213
|
+
export function selectForInjection(
|
|
214
|
+
repoRoot: string,
|
|
215
|
+
matches: TierRuleMatch[],
|
|
216
|
+
capBytes: number,
|
|
217
|
+
): SelectionResult {
|
|
218
|
+
const bodyBytes = new Map<string, number>();
|
|
219
|
+
for (const m of matches) {
|
|
220
|
+
const body = loadRuleBody(repoRoot, m.id);
|
|
221
|
+
bodyBytes.set(m.id, body === null ? 0 : bytesOf(body));
|
|
222
|
+
}
|
|
223
|
+
const ranked = [...matches].sort((a, b) => b.score - a.score || a.order - b.order);
|
|
224
|
+
const selected: TierRuleMatch[] = [];
|
|
225
|
+
const dropped: TierRuleMatch[] = [];
|
|
226
|
+
let total = 0;
|
|
227
|
+
for (const m of ranked) {
|
|
228
|
+
const t = bodyBytes.get(m.id) ?? 0;
|
|
229
|
+
if (total + t > capBytes && selected.length > 0) {
|
|
230
|
+
dropped.push(m);
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
selected.push(m);
|
|
234
|
+
total += t;
|
|
235
|
+
}
|
|
236
|
+
selected.sort((a, b) => a.order - b.order);
|
|
237
|
+
dropped.sort((a, b) => a.order - b.order);
|
|
238
|
+
return { selected, dropped, bytes: total, bodyBytes };
|
|
239
|
+
}
|
|
@@ -57,6 +57,21 @@ export interface RunCheckpoint {
|
|
|
57
57
|
readonly next_step: string | null;
|
|
58
58
|
/** Commit the tree was on. A resume onto a different commit is normal, and visible. */
|
|
59
59
|
readonly head: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* The situational-awareness reading this run last took —
|
|
62
|
+
* `contextFingerprint()` over `origin/main` plus every open PR's head SHA.
|
|
63
|
+
*
|
|
64
|
+
* `road-to-roadmap-situational-awareness` § 5.6. Every other field here
|
|
65
|
+
* reports **roadmap** drift; none reported **repository** drift, so a run
|
|
66
|
+
* resumed after a long gap trusted a context reading it never re-took. A
|
|
67
|
+
* disagreement here forces a re-probe before the first step.
|
|
68
|
+
*
|
|
69
|
+
* Optional: a checkpoint written before this field existed, or by a run that
|
|
70
|
+
* could not reach the probe, is still a valid checkpoint. Absent means "not
|
|
71
|
+
* known", never "unchanged" — `verifyCheckpoint` treats a null on either
|
|
72
|
+
* side as unknown, the same way it already treats `head`.
|
|
73
|
+
*/
|
|
74
|
+
readonly context_fingerprint?: string | null;
|
|
60
75
|
readonly written_at: string;
|
|
61
76
|
}
|
|
62
77
|
|
|
@@ -109,6 +124,16 @@ export interface BuildOptions {
|
|
|
109
124
|
/** Injected so a test does not depend on the ambient git state. */
|
|
110
125
|
readonly head?: string | null;
|
|
111
126
|
readonly now?: () => Date;
|
|
127
|
+
/**
|
|
128
|
+
* The run's situational-awareness fingerprint
|
|
129
|
+
* (`roadmap:context --fingerprint`). Injected rather than read here, so this
|
|
130
|
+
* library keeps its no-subprocess property — `readHead` reads `.git`
|
|
131
|
+
* directly for the same reason, and the probe cannot.
|
|
132
|
+
*
|
|
133
|
+
* Omitted → the field is absent, and a resume reports "not known" rather
|
|
134
|
+
* than asserting the repository stood still.
|
|
135
|
+
*/
|
|
136
|
+
readonly contextFingerprint?: string | null;
|
|
112
137
|
}
|
|
113
138
|
|
|
114
139
|
/**
|
|
@@ -204,6 +229,12 @@ export function buildCheckpoint(
|
|
|
204
229
|
parked_steps: counts.parked,
|
|
205
230
|
next_step: counts.next,
|
|
206
231
|
head: opts.head ?? readHead(repoRoot),
|
|
232
|
+
// Absent rather than null when nothing was supplied: a checkpoint that
|
|
233
|
+
// predates this field and one written without a probe are the same
|
|
234
|
+
// state, and both must read as "not known".
|
|
235
|
+
...(opts.contextFingerprint !== undefined
|
|
236
|
+
? { context_fingerprint: opts.contextFingerprint }
|
|
237
|
+
: {}),
|
|
207
238
|
written_at: (opts.now ?? ((): Date => new Date()))().toISOString(),
|
|
208
239
|
};
|
|
209
240
|
}
|
|
@@ -310,7 +341,16 @@ export interface VerifyResult {
|
|
|
310
341
|
* 4, actual 3" tells it a step landed after the checkpoint was written and
|
|
311
342
|
* which count to trust.
|
|
312
343
|
*/
|
|
313
|
-
export function verifyCheckpoint(
|
|
344
|
+
export function verifyCheckpoint(
|
|
345
|
+
repoRoot: string,
|
|
346
|
+
cp: RunCheckpoint,
|
|
347
|
+
/**
|
|
348
|
+
* The fingerprint a fresh `roadmap:context --fingerprint` returned, when the
|
|
349
|
+
* resumed run took one. Omitted → the field reports "not known" rather than
|
|
350
|
+
* asserting the repository stood still.
|
|
351
|
+
*/
|
|
352
|
+
currentFingerprint?: string | null,
|
|
353
|
+
): VerifyResult {
|
|
314
354
|
let text: string;
|
|
315
355
|
try {
|
|
316
356
|
text = fs.readFileSync(roadmapPath(repoRoot, cp.roadmap), 'utf-8');
|
|
@@ -349,6 +389,19 @@ export function verifyCheckpoint(repoRoot: string, cp: RunCheckpoint): VerifyRes
|
|
|
349
389
|
// than a missing one: it trains the reader to skip the line.
|
|
350
390
|
agrees: cp.head === null || head === null || cp.head === head,
|
|
351
391
|
},
|
|
392
|
+
// Repository drift, which no other field here reports. The `actual` is
|
|
393
|
+
// supplied by the caller (the probe is a subprocess and this library
|
|
394
|
+
// stays I/O-light) — absent means the caller did not re-probe, and an
|
|
395
|
+
// unknown on either side is never a disagreement, exactly as for `head`.
|
|
396
|
+
{
|
|
397
|
+
field: 'context_fingerprint',
|
|
398
|
+
claimed: cp.context_fingerprint ?? null,
|
|
399
|
+
actual: currentFingerprint ?? null,
|
|
400
|
+
agrees:
|
|
401
|
+
(cp.context_fingerprint ?? null) === null ||
|
|
402
|
+
(currentFingerprint ?? null) === null ||
|
|
403
|
+
cp.context_fingerprint === currentFingerprint,
|
|
404
|
+
},
|
|
352
405
|
];
|
|
353
406
|
return { readable: true, fields, agrees: fields.every((f) => f.agrees) };
|
|
354
407
|
}
|
|
@@ -260,3 +260,99 @@ export function scoped_projection_stats(
|
|
|
260
260
|
workspaces: [...SCOPED_ACTIVE_WORKSPACES].sort(),
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
+
|
|
264
|
+
/** The installer's deploy tuple: [written, skipped, status, paths]. */
|
|
265
|
+
export type DeployTuple = [number, number, string, string[]];
|
|
266
|
+
|
|
267
|
+
// --- Deploy-tree prune mechanics ------------------------------------------
|
|
268
|
+
// Moved here WHOLE from `install.ts` (a pure move, names forwarded there) so
|
|
269
|
+
// the prune sits beside `is_pruned_under_scoped`, the predicate it consumes —
|
|
270
|
+
// which is what this module's header says it exists for. It also pays for the
|
|
271
|
+
// `check_source_size_budget` ratchet, which counts every line in a file above
|
|
272
|
+
// 1,500 and which `install.ts` at 5,466 lines cannot grow past.
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Remove skills/commands matching `is_pruned` from a completed deploy.
|
|
276
|
+
*
|
|
277
|
+
* road-to-install-contract-stability Phase 2 Step 2 (generalized in
|
|
278
|
+
* road-to-credible-install Phase 2 to back both the core-only lab prune and
|
|
279
|
+
* the scoped-projection pack prune off the same mechanics). Skills are
|
|
280
|
+
* pruned by whole directory (tier decided by the skill's `SKILL.md`
|
|
281
|
+
* frontmatter); commands by file (own frontmatter). Rules / personas /
|
|
282
|
+
* contexts / templates are core/shared and left intact. Returns
|
|
283
|
+
* `[pruned_count, adjusted_results]` with the pruned paths removed from each
|
|
284
|
+
* tool's `written_paths` so the manifest never records them.
|
|
285
|
+
*/
|
|
286
|
+
export function prune_modules_by(
|
|
287
|
+
deploy_results: Record<string, DeployTuple>,
|
|
288
|
+
is_pruned: (md_path: string) => boolean,
|
|
289
|
+
): [number, Record<string, DeployTuple>] {
|
|
290
|
+
let pruned = 0;
|
|
291
|
+
const adjusted: Record<string, DeployTuple> = {};
|
|
292
|
+
for (const tool_id of Object.keys(deploy_results)) {
|
|
293
|
+
const [written, skipped, status, paths] = deploy_results[tool_id] as DeployTuple;
|
|
294
|
+
const pruned_skill_dirs = new Set<string>();
|
|
295
|
+
for (const p of paths) {
|
|
296
|
+
const parts = p.split(path.sep);
|
|
297
|
+
if (parts.includes('skills')) {
|
|
298
|
+
const i = parts.indexOf('skills');
|
|
299
|
+
if (i + 1 < parts.length) {
|
|
300
|
+
const skill_root = parts.slice(0, i + 2).join(path.sep);
|
|
301
|
+
if (!pruned_skill_dirs.has(skill_root)) {
|
|
302
|
+
const skillmd = path.join(skill_root, 'SKILL.md');
|
|
303
|
+
if (fs.existsSync(skillmd) && is_pruned(skillmd)) {
|
|
304
|
+
pruned_skill_dirs.add(skill_root);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const keep: string[] = [];
|
|
311
|
+
const delete_files: string[] = [];
|
|
312
|
+
for (const p of paths) {
|
|
313
|
+
const parts = p.split(path.sep);
|
|
314
|
+
let is_target = false;
|
|
315
|
+
if (parts.includes('skills')) {
|
|
316
|
+
const i = parts.indexOf('skills');
|
|
317
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path.sep))) {
|
|
318
|
+
is_target = true;
|
|
319
|
+
}
|
|
320
|
+
} else if (
|
|
321
|
+
parts.includes('commands') &&
|
|
322
|
+
path.extname(p) === '.md' &&
|
|
323
|
+
is_pruned(p)
|
|
324
|
+
) {
|
|
325
|
+
is_target = true;
|
|
326
|
+
}
|
|
327
|
+
(is_target ? delete_files : keep).push(p);
|
|
328
|
+
}
|
|
329
|
+
for (const d of pruned_skill_dirs) {
|
|
330
|
+
fs.rmSync(d, { recursive: true, force: true });
|
|
331
|
+
}
|
|
332
|
+
for (const p of delete_files) {
|
|
333
|
+
if (p.split(path.sep).includes('commands') && fs.existsSync(p)) {
|
|
334
|
+
try {
|
|
335
|
+
fs.unlinkSync(p);
|
|
336
|
+
} catch {
|
|
337
|
+
// OSError → swallow, mirroring the .py.
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
pruned += delete_files.length;
|
|
342
|
+
adjusted[tool_id] = [Math.max(0, written - delete_files.length), skipped, status, keep];
|
|
343
|
+
}
|
|
344
|
+
return [pruned, adjusted];
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Remove lab-tier skills/commands from a completed deploy (core-only).
|
|
349
|
+
*
|
|
350
|
+
* road-to-install-contract-stability Phase 2 Step 2. Thin wrapper over
|
|
351
|
+
* `_prune_modules_by` — see that function for the mechanics.
|
|
352
|
+
*/
|
|
353
|
+
export function prune_lab_modules(
|
|
354
|
+
deploy_results: Record<string, DeployTuple>,
|
|
355
|
+
lab_ids: Set<string>,
|
|
356
|
+
): [number, Record<string, DeployTuple>] {
|
|
357
|
+
return prune_modules_by(deploy_results, (p) => surface_tiers.is_lab_artefact(p, lab_ids));
|
|
358
|
+
}
|
|
@@ -226,6 +226,22 @@ export interface SessionRecord {
|
|
|
226
226
|
* session that was never refused, is still a valid record.
|
|
227
227
|
*/
|
|
228
228
|
turn_end_refusals?: Record<string, number>;
|
|
229
|
+
/**
|
|
230
|
+
* Repo-relative paths this session has declared it owns, or absent when it
|
|
231
|
+
* has declared none.
|
|
232
|
+
*
|
|
233
|
+
* `road-to-roadmap-situational-awareness` § 3.1. The register compared slugs
|
|
234
|
+
* and branch names and nothing else, so two sessions on two different
|
|
235
|
+
* roadmaps that happen to edit the same file were invisible to each other —
|
|
236
|
+
* the axis that actually predicts a merge conflict was the one axis nobody
|
|
237
|
+
* carried.
|
|
238
|
+
*
|
|
239
|
+
* Additive on exactly the terms `turn_end_refusals` established: a session
|
|
240
|
+
* that declared no paths leaves the record **byte-identical** to what it was
|
|
241
|
+
* before this field existed, so a reader that does not know the field is
|
|
242
|
+
* unaffected and a diff of two records still shows only what changed.
|
|
243
|
+
*/
|
|
244
|
+
owned_paths?: string[];
|
|
229
245
|
}
|
|
230
246
|
|
|
231
247
|
/**
|
|
@@ -430,11 +446,21 @@ export function foreign_live_records(
|
|
|
430
446
|
* so the branch comparison was silent by construction while a whole
|
|
431
447
|
* implementation was duplicated. One of the two PRs is thrown away either way.
|
|
432
448
|
*/
|
|
433
|
-
|
|
449
|
+
/**
|
|
450
|
+
* `path` is the third axis, added last and cheapest to be wrong about: two
|
|
451
|
+
* sessions can be on different roadmaps and different branches and still be
|
|
452
|
+
* editing one file. It is reported SEPARATELY rather than folded into either of
|
|
453
|
+
* the two above, because the response differs — a roadmap collision means stop,
|
|
454
|
+
* a branch collision means coordinate, a path collision means take the disjoint
|
|
455
|
+
* steps first and say so.
|
|
456
|
+
*/
|
|
457
|
+
export type CollisionKind = 'roadmap' | 'branch' | 'path';
|
|
434
458
|
|
|
435
459
|
export interface Collision {
|
|
436
460
|
kind: CollisionKind;
|
|
437
461
|
record: SessionRecord;
|
|
462
|
+
/** For `kind: 'path'`, the shared paths. Absent on the other two kinds. */
|
|
463
|
+
paths?: string[];
|
|
438
464
|
}
|
|
439
465
|
|
|
440
466
|
/**
|
|
@@ -451,7 +477,11 @@ export interface Collision {
|
|
|
451
477
|
*/
|
|
452
478
|
export function classify_collisions(
|
|
453
479
|
others: readonly SessionRecord[],
|
|
454
|
-
here: {
|
|
480
|
+
here: {
|
|
481
|
+
branch: string | null;
|
|
482
|
+
roadmap_slug: string | null;
|
|
483
|
+
owned_paths?: readonly string[];
|
|
484
|
+
},
|
|
455
485
|
): Collision[] {
|
|
456
486
|
const out: Collision[] = [];
|
|
457
487
|
for (const r of others) {
|
|
@@ -468,5 +498,17 @@ export function classify_collisions(
|
|
|
468
498
|
out.push({ kind: 'branch', record: r });
|
|
469
499
|
}
|
|
470
500
|
}
|
|
501
|
+
// Last, and last on purpose: the two axes above are unchanged in meaning and
|
|
502
|
+
// in order, so a consumer that filters on `roadmap` or `branch` sees exactly
|
|
503
|
+
// what it saw before this axis existed.
|
|
504
|
+
const mine = new Set(here.owned_paths ?? []);
|
|
505
|
+
if (mine.size > 0) {
|
|
506
|
+
for (const r of others) {
|
|
507
|
+
const shared = (r.owned_paths ?? []).filter((p) => mine.has(p)).sort();
|
|
508
|
+
if (shared.length > 0) {
|
|
509
|
+
out.push({ kind: 'path', record: r, paths: shared });
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
471
513
|
return out;
|
|
472
514
|
}
|
|
@@ -730,6 +730,17 @@ export interface ProjectionModeCounts {
|
|
|
730
730
|
prunedUnderScoped: number;
|
|
731
731
|
/** Pack ids active by default under `scoped`, sorted. */
|
|
732
732
|
activePacks: string[];
|
|
733
|
+
/**
|
|
734
|
+
* Skills a `projection.mode: tiered` install deploys natively — those
|
|
735
|
+
* predicted to reach the model WITH their description. `null` when no tier
|
|
736
|
+
* split exists on this machine, which is the common case and is NOT zero.
|
|
737
|
+
*/
|
|
738
|
+
tierACount: number | null;
|
|
739
|
+
/**
|
|
740
|
+
* Skills `tiered` withholds from the native catalogue; still served by the
|
|
741
|
+
* MCP recovery tools. `null` under the same condition as `tierACount`.
|
|
742
|
+
*/
|
|
743
|
+
tierBCount: number | null;
|
|
733
744
|
}
|
|
734
745
|
|
|
735
746
|
/**
|
|
@@ -791,8 +802,26 @@ export function formatProjectionModes(
|
|
|
791
802
|
` legacy-all: ${counts.legacyAll}`,
|
|
792
803
|
` pruned under scoped: ${counts.prunedUnderScoped}`,
|
|
793
804
|
` active packs under scoped: ${counts.activePacks.length}`,
|
|
794
|
-
'',
|
|
795
805
|
];
|
|
806
|
+
if (counts.tierACount === null || counts.tierBCount === null) {
|
|
807
|
+
lines.push(
|
|
808
|
+
' tiered: no split on this machine (agents/runtime/state/skill-tiers.json',
|
|
809
|
+
' absent) — not zero, unmeasured. `tiered` ships the full surface',
|
|
810
|
+
' until a split exists.',
|
|
811
|
+
);
|
|
812
|
+
} else {
|
|
813
|
+
lines.push(
|
|
814
|
+
` tiered: tier A ${counts.tierACount} native + tier B ${counts.tierBCount} ` +
|
|
815
|
+
`MCP-only = ${counts.tierACount + counts.tierBCount}`,
|
|
816
|
+
);
|
|
817
|
+
if (counts.tierACount + counts.tierBCount !== counts.legacyAll) {
|
|
818
|
+
lines.push(
|
|
819
|
+
` ⚠️ tier A + tier B (${counts.tierACount + counts.tierBCount}) != ` +
|
|
820
|
+
`legacy-all (${counts.legacyAll}) — the split is STALE, recompute it.`,
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
lines.push('');
|
|
796
825
|
if (rows.length === 0) {
|
|
797
826
|
lines.push(
|
|
798
827
|
'No host root measured. Pass --host-root <dir> (repeatable) to read what',
|
|
@@ -959,6 +988,7 @@ export interface MigrationEligibility {
|
|
|
959
988
|
| 'observation-not-comparable'
|
|
960
989
|
| 'no-truncation-observed'
|
|
961
990
|
| 'already-scoped'
|
|
991
|
+
| 'already-tiered'
|
|
962
992
|
| 'below-observed-skill-volume';
|
|
963
993
|
/** Populated only when eligible, for the message. */
|
|
964
994
|
droppedEntries?: number;
|
|
@@ -981,11 +1011,17 @@ export interface MigrationEligibility {
|
|
|
981
1011
|
*/
|
|
982
1012
|
export function migrationEligibility(
|
|
983
1013
|
host: string,
|
|
984
|
-
resolvedMode: 'scoped' | 'legacy-all',
|
|
1014
|
+
resolvedMode: 'scoped' | 'legacy-all' | 'tiered',
|
|
985
1015
|
currentSkillCount: number,
|
|
986
1016
|
limits: ReadonlyMap<string, KnownHostLimit>,
|
|
987
1017
|
): MigrationEligibility {
|
|
988
1018
|
if (resolvedMode === 'scoped') return { eligible: false, reason: 'already-scoped' };
|
|
1019
|
+
// `tiered` already withholds skills from the native catalogue, so an offer to
|
|
1020
|
+
// migrate to `scoped` has nothing to buy. It gets its OWN reason rather than
|
|
1021
|
+
// reusing `already-scoped`: the two narrow on different axes (packs vs the
|
|
1022
|
+
// host's listing budget), and a caller reading the reason should be able to
|
|
1023
|
+
// tell which one the install is actually on.
|
|
1024
|
+
if (resolvedMode === 'tiered') return { eligible: false, reason: 'already-tiered' };
|
|
989
1025
|
const limit = limits.get(host);
|
|
990
1026
|
if (limit === undefined) return { eligible: false, reason: 'no-observation-for-host' };
|
|
991
1027
|
if (limit.projectedSkills === null) return { eligible: false, reason: 'observation-not-comparable' };
|