@event4u/agent-config 9.9.0 → 9.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +153 -194
- package/README.md +1 -1
- package/dist/agent-src/commands/agent-status.md +12 -11
- package/dist/agent-src/commands/agents/user/accept.md +115 -30
- package/dist/agent-src/commands/agents/user/delete.md +147 -0
- package/dist/agent-src/commands/agents/user/review.md +65 -28
- package/dist/agent-src/commands/agents/user/show.md +82 -29
- package/dist/agent-src/commands/agents/user/update.md +2 -2
- package/dist/agent-src/commands/agents/user.md +16 -3
- package/dist/agent-src/commands/check-current-md.md +0 -10
- package/dist/agent-src/commands/condense.md +28 -97
- package/dist/agent-src/commands/cost/report.md +7 -0
- package/dist/agent-src/commands/fix/portability.md +0 -8
- package/dist/agent-src/commands/fix/refs.md +0 -8
- package/dist/agent-src/commands/humanize.md +2 -2
- package/dist/agent-src/commands/jira-ticket.md +1 -1
- package/dist/agent-src/commands/memory/load.md +11 -0
- package/dist/agent-src/commands/optimize/skills.md +1 -1
- package/dist/agent-src/commands/pr/create.md +4 -4
- package/dist/agent-src/commands/profile/show.md +3 -3
- package/dist/agent-src/commands/rule-compliance-audit.md +5 -4
- package/dist/agent-src/commands/security-audit-config.md +1 -1
- package/dist/agent-src/commands/sync/gitignore/fix.md +1 -1
- package/dist/agent-src/commands/tdd.md +21 -0
- package/dist/agent-src/commands/team/delegate.md +2 -2
- package/dist/agent-src/commands/team-knowledge/bootstrap.md +9 -8
- package/dist/agent-src/commands/team-knowledge/consolidate.md +8 -7
- package/dist/agent-src/commands/team.md +4 -1
- package/dist/agent-src/commands/upstream-contribute.md +0 -1
- package/dist/agent-src/contexts/authority/commit-mechanics.md +7 -0
- package/dist/agent-src/contexts/authority/destructive-mechanics.md +16 -0
- package/dist/agent-src/contexts/authority/scope-mechanics.md +61 -0
- package/dist/agent-src/contexts/communication/rules-auto/reply-close-mechanics.md +20 -18
- package/dist/agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/source-of-truth-mechanics.md +9 -10
- package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +11 -0
- package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +26 -15
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -0
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +67 -37
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +1 -1
- package/dist/agent-src/contexts/execution/autonomy-examples.md +1 -1
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +7 -6
- package/dist/agent-src/contexts/execution/evidence-discipline.md +92 -77
- package/dist/agent-src/contexts/execution/orchestration-benchmark-gate.md +22 -21
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +24 -0
- package/dist/agent-src/contexts/execution/project-intelligence.md +122 -103
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +23 -21
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +5 -5
- package/dist/agent-src/contexts/execution/subagent-routing.md +11 -0
- package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +13 -13
- package/dist/agent-src/contexts/execution/subagent-steering.md +36 -34
- package/dist/agent-src/contexts/execution/toolchain-resolver.md +1 -1
- package/dist/agent-src/contexts/execution/user-memory-channels.md +189 -0
- package/dist/agent-src/contexts/execution/verification-mechanics.md +9 -0
- package/dist/agent-src/contexts/model-recommendations.md +3 -2
- package/dist/agent-src/contexts/subagent-configuration.md +3 -3
- package/dist/agent-src/ghostwriter/README.md +2 -2
- package/dist/agent-src/packs/README.md +1 -1
- package/dist/agent-src/personas/README.md +5 -5
- package/dist/agent-src/personas/_template-specialist/persona.md +3 -3
- package/dist/agent-src/personas/backend-architect.md +24 -23
- package/dist/agent-src/personas/eloquent-tamer.md +30 -30
- package/dist/agent-src/personas/frontend-engineer.md +30 -30
- package/dist/agent-src/personas/product-owner.md +41 -38
- package/dist/agent-src/personas/qa.md +13 -13
- package/dist/agent-src/personas/security-engineer.md +22 -22
- package/dist/agent-src/presets/README.md +3 -3
- package/dist/agent-src/profiles/README.md +3 -3
- package/dist/agent-src/rules/active-remediation.md +2 -2
- package/dist/agent-src/rules/artifact-engagement-recording.md +4 -4
- package/dist/agent-src/rules/ask-when-uncertain.md +0 -4
- package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
- package/dist/agent-src/rules/broken-access-control.md +4 -4
- package/dist/agent-src/rules/code-comment-discipline.md +1 -1
- package/dist/agent-src/rules/code-provenance.md +2 -2
- package/dist/agent-src/rules/commit-policy.md +4 -9
- package/dist/agent-src/rules/communication-through-line.md +5 -5
- package/dist/agent-src/rules/decision-revisit-gate.md +1 -1
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +1 -1
- package/dist/agent-src/rules/domain-adoption-policy.md +1 -1
- package/dist/agent-src/rules/domain-safety-pii.md +1 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +1 -1
- package/dist/agent-src/rules/fast-path-marker-visibility.md +43 -7
- package/dist/agent-src/rules/finance-safety-floor.md +1 -1
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +3 -3
- package/dist/agent-src/rules/history-discipline.md +1 -1
- package/dist/agent-src/rules/legal-safety-floor.md +1 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +5 -5
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +10 -8
- package/dist/agent-src/rules/media-governance-routing.md +13 -13
- package/dist/agent-src/rules/media-sync-ground-truth.md +29 -11
- package/dist/agent-src/rules/no-cheap-questions.md +7 -7
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +29 -18
- package/dist/agent-src/rules/non-destructive-by-default.md +5 -23
- package/dist/agent-src/rules/onboarding-gate.md +14 -4
- package/dist/agent-src/rules/persona-governance.md +2 -2
- package/dist/agent-src/rules/prefer-enums-over-literals.md +9 -9
- package/dist/agent-src/rules/preservation-guard.md +10 -2
- package/dist/agent-src/rules/question-not-instruction.md +1 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +6 -6
- package/dist/agent-src/rules/rule-type-governance.md +1 -1
- package/dist/agent-src/rules/scale-discipline.md +1 -1
- package/dist/agent-src/rules/scope-control.md +1 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +1 -1
- package/dist/agent-src/rules/security-sensitive-stop.md +17 -11
- package/dist/agent-src/rules/senior-engineering-discipline.md +17 -17
- package/dist/agent-src/rules/session-canary.md +1 -1
- package/dist/agent-src/rules/skill-quality.md +1 -1
- package/dist/agent-src/rules/source-confidentiality.md +21 -19
- package/dist/agent-src/rules/source-of-truth.md +6 -5
- package/dist/agent-src/rules/spreadsheet-source-quality.md +2 -2
- package/dist/agent-src/rules/strategy-safety-floor.md +1 -1
- package/dist/agent-src/rules/think-before-action.md +5 -5
- package/dist/agent-src/rules/token-budget-discipline.md +5 -3
- package/dist/agent-src/rules/token-efficiency.md +2 -2
- package/dist/agent-src/rules/untrusted-input-defense.md +4 -4
- package/dist/agent-src/rules/user-interaction.md +12 -0
- package/dist/agent-src/rules/verify-before-complete.md +4 -24
- package/dist/agent-src/skills/adversarial-review/SKILL.md +2 -2
- package/dist/agent-src/skills/agent-security-review/SKILL.md +52 -45
- package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +2 -2
- package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +20 -20
- package/dist/agent-src/skills/ai-council/SKILL.md +185 -128
- package/dist/agent-src/skills/analysis-skill-router/SKILL.md +3 -3
- package/dist/agent-src/skills/api-endpoint/SKILL.md +2 -2
- package/dist/agent-src/skills/artisan-commands/SKILL.md +2 -2
- package/dist/agent-src/skills/async-python-patterns/SKILL.md +8 -7
- package/dist/agent-src/skills/authz-review/SKILL.md +16 -15
- package/dist/agent-src/skills/aws-infrastructure/SKILL.md +5 -5
- package/dist/agent-src/skills/blade-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/bug-analyzer/SKILL.md +30 -12
- package/dist/agent-src/skills/code-intelligence/SKILL.md +0 -1
- package/dist/agent-src/skills/code-intelligence/evals/triggers.json +52 -0
- package/dist/agent-src/skills/code-review/SKILL.md +6 -6
- package/dist/agent-src/skills/command-routing/SKILL.md +5 -4
- package/dist/agent-src/skills/composer-packages/SKILL.md +2 -2
- package/dist/agent-src/skills/condense-memory/SKILL.md +43 -41
- package/dist/agent-src/skills/context-document/SKILL.md +23 -21
- package/dist/agent-src/skills/copilot-config/SKILL.md +6 -1
- package/dist/agent-src/skills/decision-record/SKILL.md +20 -18
- package/dist/agent-src/skills/design-intelligence/SKILL.md +4 -4
- package/dist/agent-src/skills/design-review/SKILL.md +15 -14
- package/dist/agent-src/skills/design-system-capture/reference/design-system-json.md +28 -25
- package/dist/agent-src/skills/devcontainer/SKILL.md +2 -2
- package/dist/agent-src/skills/docker/SKILL.md +1 -1
- package/dist/agent-src/skills/docx-authoring/evals/triggers.json +52 -0
- package/dist/agent-src/skills/emit-tickets/SKILL.md +2 -2
- package/dist/agent-src/skills/error-handling-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +2 -2
- package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +0 -1
- package/dist/agent-src/skills/evaluate-llm-feature/evals/triggers.json +52 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +6 -5
- package/dist/agent-src/skills/feature-planning/SKILL.md +2 -2
- package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +3 -3
- package/dist/agent-src/skills/flux/SKILL.md +1 -1
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +13 -13
- package/dist/agent-src/skills/git-workflow/SKILL.md +33 -33
- package/dist/agent-src/skills/grafana/SKILL.md +5 -0
- package/dist/agent-src/skills/humanizer/SKILL.md +83 -66
- package/dist/agent-src/skills/humanizer/data/patterns.md +14 -14
- package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +4 -4
- package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +82 -37
- package/dist/agent-src/skills/judge-bug-hunter/SKILL.md +17 -5
- package/dist/agent-src/skills/judge-injection-defense/SKILL.md +63 -25
- package/dist/agent-src/skills/judge-security-auditor/SKILL.md +2 -0
- package/dist/agent-src/skills/judge-synthesis/SKILL.md +72 -28
- package/dist/agent-src/skills/laravel-horizon/SKILL.md +5 -0
- package/dist/agent-src/skills/laravel-mail/SKILL.md +5 -4
- package/dist/agent-src/skills/laravel-middleware/SKILL.md +5 -4
- package/dist/agent-src/skills/laravel-notifications/SKILL.md +10 -9
- package/dist/agent-src/skills/laravel-pennant/SKILL.md +1 -1
- package/dist/agent-src/skills/laravel-pulse/SKILL.md +9 -8
- package/dist/agent-src/skills/laravel-reverb/SKILL.md +6 -5
- package/dist/agent-src/skills/laravel-scheduling/SKILL.md +6 -1
- package/dist/agent-src/skills/laravel-validation/SKILL.md +12 -0
- package/dist/agent-src/skills/launch-readiness/SKILL.md +1 -1
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +7 -7
- package/dist/agent-src/skills/learning-tutor/SKILL.md +44 -43
- package/dist/agent-src/skills/learning-tutor/evals/triggers.json +52 -0
- package/dist/agent-src/skills/license-compliance-audit/SKILL.md +7 -7
- package/dist/agent-src/skills/license-compliance-borrow-check/SKILL.md +3 -3
- package/dist/agent-src/skills/license-compliance-credits/SKILL.md +4 -4
- package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +0 -1
- package/dist/agent-src/skills/memory-consolidation/SKILL.md +69 -64
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +6 -6
- package/dist/agent-src/skills/pdf-tools/evals/triggers.json +52 -0
- package/dist/agent-src/skills/performance-analysis/SKILL.md +7 -3
- package/dist/agent-src/skills/persona-improvement/SKILL.md +0 -2
- package/dist/agent-src/skills/persona-improvement/evals/triggers.json +52 -0
- package/dist/agent-src/skills/php-coder/SKILL.md +10 -0
- package/dist/agent-src/skills/prediction-pool-optimizer/SKILL.md +129 -120
- package/dist/agent-src/skills/prediction-pool-optimizer/reference/ev-fixtures.md +36 -35
- package/dist/agent-src/skills/prediction-pool-optimizer/reference/odds-and-bonus.md +45 -41
- package/dist/agent-src/skills/project-analysis-core/SKILL.md +4 -4
- package/dist/agent-src/skills/project-analysis-hypothesis-driven/SKILL.md +3 -3
- package/dist/agent-src/skills/project-analysis-react/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analysis-symfony/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analysis-zend-laminas/SKILL.md +2 -2
- package/dist/agent-src/skills/prompt-engineering-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/prompt-validator/SKILL.md +39 -39
- package/dist/agent-src/skills/quality-tools/SKILL.md +15 -15
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +55 -19
- package/dist/agent-src/skills/react-shadcn-ui/reference/registry.md +29 -27
- package/dist/agent-src/skills/readme-writing-package/SKILL.md +2 -2
- package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +25 -25
- package/dist/agent-src/skills/recursive-verification/SKILL.md +6 -5
- package/dist/agent-src/skills/refine-prompt/SKILL.md +1 -1
- package/dist/agent-src/skills/refine-ticket/SKILL.md +20 -2
- package/dist/agent-src/skills/repomix-packer/SKILL.md +1 -1
- package/dist/agent-src/skills/requesting-code-review/SKILL.md +2 -2
- package/dist/agent-src/skills/roadmap-management/SKILL.md +80 -66
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +84 -77
- package/dist/agent-src/skills/rule-refactor/SKILL.md +1 -1
- package/dist/agent-src/skills/screenshot-hygiene/evals/triggers.json +52 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +26 -9
- package/dist/agent-src/skills/security-maturity-assessment/SKILL.md +38 -16
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +14 -11
- package/dist/agent-src/skills/skill-writing/SKILL.md +9 -8
- package/dist/agent-src/skills/song-to-script/SKILL.md +93 -85
- package/dist/agent-src/skills/sql-writing/SKILL.md +2 -2
- package/dist/agent-src/skills/stakeholder-tradeoff/SKILL.md +4 -3
- package/dist/agent-src/skills/standards-from-config/SKILL.md +61 -43
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +22 -8
- package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +28 -2
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +13 -13
- package/dist/agent-src/skills/systematic-debugging/SKILL.md +22 -21
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
- package/dist/agent-src/skills/technical-specification/SKILL.md +5 -0
- package/dist/agent-src/skills/terraform/SKILL.md +2 -2
- package/dist/agent-src/skills/terragrunt/SKILL.md +8 -8
- package/dist/agent-src/skills/testing-anti-patterns/process-anti-patterns.md +1 -1
- package/dist/agent-src/skills/threat-modeling/SKILL.md +19 -13
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +0 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +9 -9
- package/dist/agent-src/skills/validate-feature-fit/SKILL.md +3 -1
- package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +4 -6
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +67 -61
- package/dist/agent-src/skills/video-director/SKILL.md +7 -7
- package/dist/agent-src/skills/worktree-lifecycle/SKILL.md +3 -3
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/contexts/knowledge-pages.md +47 -45
- package/dist/agent-src/templates/contexts/lesson-card.md +2 -2
- package/dist/agent-src/templates/contexts/tenant-boundaries.md +2 -2
- package/dist/agent-src/templates/contexts.md +1 -1
- package/dist/agent-src/templates/features.md +1 -1
- package/dist/agent-src/templates/roadmaps.md +125 -116
- package/dist/agent-src/templates/rule.md +2 -1
- package/dist/agent-src/templates/scripts/pr_risk_review.ts +0 -0
- package/dist/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/dist/agent-src/templates/scripts/tier_usage_report.ts +2 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +1 -1
- package/dist/agent-src/user-types/README.md +8 -8
- package/dist/agent-src/user-types/galabau-field-crew.md +34 -33
- package/dist/agent-src/user-types/metalworking-shop.md +35 -34
- package/dist/agent-src/user-types/truck-driver.md +22 -20
- package/dist/cli/python/workspace_roles.js +2 -2
- package/dist/cli/python/workspace_roles.js.map +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +88 -62
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +6 -5
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +5 -4
- package/dist/hooks/dispatch.js +186 -12
- package/dist/install/install.mjs +8 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1199 -857
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/compile_time_toggles.js +48 -0
- package/dist/scripts/_lib/compile_time_toggles.js.map +1 -0
- package/dist/scripts/condense.js +234 -217
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/shared/userMd/utils.js +30 -0
- package/dist/shared/userMd/utils.js.map +1 -1
- package/dist/ui/assets/index-BpSQt5vm.js.map +1 -1
- package/docs/guidelines/agent-infra/api-cost-levers.md +56 -5
- package/docs/guidelines/agent-infra/simplicity-and-goal-demos.md +93 -33
- package/package.json +1 -1
- package/src/agent-src/templates/scripts/pr_risk_review.ts +0 -0
- package/src/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/src/agent-src/templates/scripts/tier_usage_report.ts +2 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +1 -1
- package/src/config/agent-settings.template.yml +32 -2
- package/src/config/ci-local-parity.yml +142 -0
- package/src/config/gate-coverage.yml +127 -0
- package/src/config/preamble-payload-budget.json +44 -0
- package/src/scripts/_cli/cmd_doctor.ts +78 -2
- package/src/scripts/_lib/agent_user_profile.ts +381 -0
- package/src/scripts/_lib/agents_overlay.ts +9 -0
- package/src/scripts/_lib/anchor_eval.ts +311 -0
- package/src/scripts/_lib/cc_transcript.ts +316 -0
- package/src/scripts/_lib/compile_time_toggles.ts +79 -0
- package/src/scripts/_lib/confusables.ts +101 -0
- package/src/scripts/_lib/duplicate_scope_census.ts +77 -0
- package/src/scripts/_lib/managed_agents_folder.ts +181 -0
- package/src/scripts/_lib/payload_hash_drift.ts +126 -0
- package/src/scripts/_lib/preservation_migration.ts +291 -0
- package/src/scripts/_lib/retrieval_sanitize.ts +166 -2
- package/src/scripts/_lib/scan_scope.ts +115 -0
- package/src/scripts/_lib/user_global_memory_audit.ts +187 -0
- package/src/scripts/_lib/user_global_observations.ts +830 -0
- package/src/scripts/_lib/user_global_revocations.ts +110 -0
- package/src/scripts/_lib/user_memory_gate_counters.ts +291 -0
- package/src/scripts/ai_council/blind_review.ts +0 -0
- package/src/scripts/ai_council/budget_guard.ts +90 -11
- package/src/scripts/ai_council/bundler.ts +2 -2
- package/src/scripts/ai_council/clients.ts +59 -3
- package/src/scripts/ai_council/config.ts +38 -0
- package/src/scripts/ai_council/orchestrator.ts +54 -9
- package/src/scripts/ai_team/team_dispatch.ts +17 -6
- package/src/scripts/anchor_eval_falsify.ts +198 -0
- package/src/scripts/anchor_scoring_run.ts +239 -0
- package/src/scripts/annotate_discovery.ts +1 -65
- package/src/scripts/bench_quality_run.ts +168 -4
- package/src/scripts/cache_realization_report.ts +782 -0
- package/src/scripts/check_artefact_count_messaging.ts +5 -1
- package/src/scripts/check_augment_description_cap.ts +15 -4
- package/src/scripts/check_ci_local_parity.ts +317 -0
- package/src/scripts/check_condensation.ts +96 -191
- package/src/scripts/check_context_paths.ts +38 -9
- package/src/scripts/check_gate_coverage.ts +299 -0
- package/src/scripts/check_iron_law_prominence.ts +22 -1
- package/src/scripts/check_kernel_prefix_stability.ts +0 -0
- package/src/scripts/check_no_new_legacy_path.ts +16 -6
- package/src/scripts/check_no_roadmap_refs.ts +22 -9
- package/src/scripts/check_originality_freshness.ts +167 -0
- package/src/scripts/check_preamble_payload_budget.ts +130 -0
- package/src/scripts/check_proposal.ts +0 -0
- package/src/scripts/check_references.ts +0 -1
- package/src/scripts/check_safety_floor_untouched.ts +171 -24
- package/src/scripts/check_site_links.ts +62 -3
- package/src/scripts/ci_status.ts +0 -0
- package/src/scripts/cluster_near_miss_patterns.ts +0 -0
- package/src/scripts/code_graph/build.ts +0 -0
- package/src/scripts/command_suggester/types.ts +0 -0
- package/src/scripts/compile_router.ts +10 -14
- package/src/scripts/condense.sh +3 -4
- package/src/scripts/condense.ts +247 -228
- package/src/scripts/cost/track.mjs +168 -33
- package/src/scripts/cost_summary.ts +33 -1
- package/src/scripts/council_cli.ts +45 -3
- package/src/scripts/discovery_graph.ts +0 -0
- package/src/scripts/encoding_corpus.ts +500 -0
- package/src/scripts/encoding_corpus_report.ts +216 -0
- package/src/scripts/generate_index.ts +19 -2
- package/src/scripts/install-hooks.sh +2 -2
- package/src/scripts/learning_sidecar.ts +0 -0
- package/src/scripts/lint_confusables.ts +10 -72
- package/src/scripts/lint_featured_skills.ts +0 -0
- package/src/scripts/lint_hidden_unicode.ts +208 -0
- package/src/scripts/lint_load_context.ts +17 -5
- package/src/scripts/lint_new_skill_gate.ts +9 -3
- package/src/scripts/lint_no_python_twin_rationale.ts +17 -2
- package/src/scripts/lint_originality.ts +1 -1
- package/src/scripts/lint_skill_originality.ts +1 -1
- package/src/scripts/lint_ticket_buildable.ts +1 -1
- package/src/scripts/mcp_server/tools.ts +4 -4
- package/src/scripts/measure_scope_dedup.ts +224 -0
- package/src/scripts/memory_lookup.ts +0 -0
- package/src/scripts/mine_session.ts +98 -0
- package/src/scripts/orchestration_payload_hash_drift.ts +145 -0
- package/src/scripts/preamble_byte_census.ts +574 -0
- package/src/scripts/probe_skill_registration.ts +2 -2
- package/src/scripts/redact_hook_capture.ts +13 -0
- package/src/scripts/release.ts +65 -10
- package/src/scripts/router_telemetry.ts +1 -1
- package/src/scripts/second_brain_retrieval.ts +14 -4
- package/src/scripts/skill_linter.ts +5 -0
- package/src/scripts/surface-tiers.yml +2 -0
- package/src/scripts/validate_pack_yaml.ts +0 -0
- package/src/server/schemas/settings.ts +8 -0
- package/src/shared/userMd/utils.ts +31 -0
- package/dist/agent-src/rules/telegraph-speak.md +0 -87
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* exit codes (0 = clean, 1 = issues found, 3 = internal error),
|
|
9
9
|
* stdout/stderr split, and byte-identical finding messages.
|
|
10
10
|
*
|
|
11
|
-
* Compares
|
|
11
|
+
* Compares src/ source files with their dist/agent-src/
|
|
12
12
|
* condensed versions. Checks that condensation preserved structural
|
|
13
13
|
* integrity:
|
|
14
14
|
* - All headings from source present in condensed
|
|
@@ -33,7 +33,13 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
33
33
|
|
|
34
34
|
type Severity = 'error' | 'warning' | 'info';
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
// The authoring tree. Was `.agent-src.uncondensed` until 2026-07-29 — that tree
|
|
37
|
+
// has held ZERO files since the flat-`src/` migration (ADR-051), so this gate
|
|
38
|
+
// scanned nothing and exited 0 while wired into CI. `src/` is the single source
|
|
39
|
+
// of truth per `src/rules/source-of-truth.md`; pairs resolve for `rules/` and
|
|
40
|
+
// `skills/`, and any `src/` subtree without a `dist/agent-src/` counterpart is
|
|
41
|
+
// skipped by the missing-target guard in `scanAll`.
|
|
42
|
+
const SOURCE_DIR = 'src';
|
|
37
43
|
const TARGET_DIR = 'dist/agent-src';
|
|
38
44
|
|
|
39
45
|
interface Issue {
|
|
@@ -136,187 +142,19 @@ function pythonFormatFixed(x: number, n: number): string {
|
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
// ---------------------------------------------------------------------------
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
//
|
|
145
|
+
// The path rewriter — imported, never re-implemented.
|
|
146
|
+
//
|
|
147
|
+
// This file used to carry its own 187-line copy of the rewriter chain, on the
|
|
148
|
+
// grounds that `condense.py` was not yet migrated to TS. It is (ADR-200), so the
|
|
149
|
+
// copy was a standing drift hazard: the invariant this gate asserts is
|
|
150
|
+
// `dist == rewrite(src)`, and a private copy means the gate compares dist against
|
|
151
|
+
// a *different* rewriter than the projector actually runs. Two implementations of
|
|
152
|
+
// the reference = two definitions of correct, which is the same blind-gate shape
|
|
153
|
+
// this gate exists to catch. Verified equivalent on all 556 real pairs before the
|
|
154
|
+
// copy was deleted.
|
|
142
155
|
// ---------------------------------------------------------------------------
|
|
143
156
|
|
|
144
|
-
|
|
145
|
-
const _PROJECTED_SRC_PREFIX = 'dist/agent-src/';
|
|
146
|
-
const _LEGACY_PROJECTED_SRC_PREFIX = '.agent-src/';
|
|
147
|
-
|
|
148
|
-
// A YAML list item under load_context*: ` - some/path.md` (optionally quoted)
|
|
149
|
-
const _FM_LIST_ITEM_RE = /^(\s*-\s*)(["']?)([^"'\n]+?\.md)(["']?)\s*$/;
|
|
150
|
-
// `path_prefix:` line — top-level or under `triggers:` (with leading dash)
|
|
151
|
-
const _FM_PATH_PREFIX_RE = /^(\s*(?:-\s+)?path_prefix:\s*)(["']?)([^"'\n]+?)(["']?)\s*$/;
|
|
152
|
-
// Body-link patterns (relative two-up to docs/) — capture the docs/... tail
|
|
153
|
-
const _BODY_DOCS_RE = /\.\.\/\.\.\/(docs\/(?:guidelines|contracts)\/[^)\s]+\.md)/g;
|
|
154
|
-
// Plain YAML list item — any scalar (packs: / workspaces: blocks)
|
|
155
|
-
const _FM_PLAIN_LIST_RE = /^\s*-\s*(["']?)([^"'\n]+?)\1\s*$/;
|
|
156
|
-
|
|
157
|
-
const _HRR_BANNER_MARKER = '<!-- agent-config:human-review-banner -->';
|
|
158
|
-
|
|
159
|
-
function _depthPrefix(sourceRelativePath: string): string {
|
|
160
|
-
// Python: Path(...).parts — split on path separators, drop empty parts.
|
|
161
|
-
const parts = sourceRelativePath.split('/').filter((p) => p.length > 0);
|
|
162
|
-
const depth = Math.max(parts.length - 1, 1);
|
|
163
|
-
return '../'.repeat(depth);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function _splitFrontmatter(content: string): [string[] | null, string] {
|
|
167
|
-
if (!content.startsWith('---\n')) return [null, content];
|
|
168
|
-
const end = content.indexOf('\n---\n', 4);
|
|
169
|
-
if (end === -1) return [null, content];
|
|
170
|
-
const fmText = content.slice(4, end);
|
|
171
|
-
const body = content.slice(end + '\n---\n'.length);
|
|
172
|
-
return [fmText.split('\n'), body];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function _rewriteLoadContextValue(value: string, prefix: string): string {
|
|
176
|
-
if (value.startsWith('../') || value.startsWith('./') || value.startsWith('/')) {
|
|
177
|
-
return value;
|
|
178
|
-
}
|
|
179
|
-
if (value.startsWith(_LEGACY_SRC_PREFIX)) {
|
|
180
|
-
return prefix + value.slice(_LEGACY_SRC_PREFIX.length);
|
|
181
|
-
}
|
|
182
|
-
if (value.startsWith(_PROJECTED_SRC_PREFIX)) {
|
|
183
|
-
return prefix + value.slice(_PROJECTED_SRC_PREFIX.length);
|
|
184
|
-
}
|
|
185
|
-
if (value.startsWith(_LEGACY_PROJECTED_SRC_PREFIX)) {
|
|
186
|
-
return prefix + value.slice(_LEGACY_PROJECTED_SRC_PREFIX.length);
|
|
187
|
-
}
|
|
188
|
-
return prefix + value;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function _rewritePathPrefixValue(value: string): string {
|
|
192
|
-
// No-op — path_prefix: is a literal match pattern, not a file reference.
|
|
193
|
-
return value;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function _lstrip(s: string): string {
|
|
197
|
-
return s.replace(/^\s+/u, '');
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function _rewriteFrontmatterLines(lines: string[], prefix: string): string[] {
|
|
201
|
-
let inLoadContext = false;
|
|
202
|
-
const out: string[] = [];
|
|
203
|
-
for (const line of lines) {
|
|
204
|
-
const bare = _lstrip(line);
|
|
205
|
-
if (bare.startsWith('load_context:') || bare.startsWith('load_context_eager:')) {
|
|
206
|
-
inLoadContext = true;
|
|
207
|
-
out.push(line);
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
if (inLoadContext) {
|
|
211
|
-
const m = _FM_LIST_ITEM_RE.exec(line);
|
|
212
|
-
if (m) {
|
|
213
|
-
const indent = m[1] ?? '';
|
|
214
|
-
const q1 = m[2] ?? '';
|
|
215
|
-
const value = m[3] ?? '';
|
|
216
|
-
const q2 = m[4] ?? '';
|
|
217
|
-
const rewritten = _rewriteLoadContextValue(value, prefix);
|
|
218
|
-
out.push(`${indent}${q1}${rewritten}${q2}`);
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
inLoadContext = false;
|
|
222
|
-
// fall through to path_prefix / passthrough
|
|
223
|
-
}
|
|
224
|
-
const pm = _FM_PATH_PREFIX_RE.exec(line);
|
|
225
|
-
if (pm) {
|
|
226
|
-
const head = pm[1] ?? '';
|
|
227
|
-
const q1 = pm[2] ?? '';
|
|
228
|
-
const value = pm[3] ?? '';
|
|
229
|
-
const q2 = pm[4] ?? '';
|
|
230
|
-
out.push(`${head}${q1}${_rewritePathPrefixValue(value)}${q2}`);
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
out.push(line);
|
|
234
|
-
}
|
|
235
|
-
return out;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function _rewriteBodyLinks(body: string, prefix: string): string {
|
|
239
|
-
return body.replace(_BODY_DOCS_RE, (_match, tail: string) => prefix + tail);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function _parseTrustAndOwner(fmLines: string[]): [string, boolean, string] {
|
|
243
|
-
let level = 'core';
|
|
244
|
-
let hrr = false;
|
|
245
|
-
const packs: string[] = [];
|
|
246
|
-
const workspaces: string[] = [];
|
|
247
|
-
let inTrust = false;
|
|
248
|
-
let inPacks = false;
|
|
249
|
-
let inWorkspaces = false;
|
|
250
|
-
for (const line of fmLines) {
|
|
251
|
-
const stripped = _lstrip(line);
|
|
252
|
-
const indent = line.length - stripped.length;
|
|
253
|
-
if (indent === 0 && stripped.endsWith(':')) {
|
|
254
|
-
const key = stripped.slice(0, -1);
|
|
255
|
-
inTrust = key === 'trust';
|
|
256
|
-
inPacks = key === 'packs';
|
|
257
|
-
inWorkspaces = key === 'workspaces';
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
if (inTrust && stripped.startsWith('level:')) {
|
|
261
|
-
level = pyStrip(pyStrip(pyStrip(stripped.split(/:(.*)/s)[1] ?? '')).replace(/^"|"$/g, '')).replace(
|
|
262
|
-
/^'|'$/g,
|
|
263
|
-
'',
|
|
264
|
-
);
|
|
265
|
-
// Python: stripped.split(":", 1)[1].strip().strip('"').strip("'")
|
|
266
|
-
const after = stripped.slice(stripped.indexOf(':') + 1);
|
|
267
|
-
level = stripDoubleSingle(pyStrip(after));
|
|
268
|
-
} else if (inTrust && stripped.startsWith('human_review_required:')) {
|
|
269
|
-
const after = stripped.slice(stripped.indexOf(':') + 1);
|
|
270
|
-
const val = pyStrip(after);
|
|
271
|
-
hrr = val.toLowerCase() === 'true';
|
|
272
|
-
} else if (inPacks || inWorkspaces) {
|
|
273
|
-
const m = _FM_PLAIN_LIST_RE.exec(line);
|
|
274
|
-
if (m) {
|
|
275
|
-
const value = pyStrip(m[2] ?? '');
|
|
276
|
-
(inPacks ? packs : workspaces).push(value);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
let owner = 'unknown';
|
|
281
|
-
if (packs.length > 0) {
|
|
282
|
-
owner = (packs[0] ?? '').split('-')[0] ?? '';
|
|
283
|
-
} else if (workspaces.length > 0) {
|
|
284
|
-
owner = workspaces[0] ?? '';
|
|
285
|
-
}
|
|
286
|
-
return [level, hrr, owner];
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/** Python `.strip('"').strip("'")` — strip leading/trailing chars from a set. */
|
|
290
|
-
function stripChars(s: string, chars: string): string {
|
|
291
|
-
let start = 0;
|
|
292
|
-
let end = s.length;
|
|
293
|
-
while (start < end && chars.includes(s[start] as string)) start += 1;
|
|
294
|
-
while (end > start && chars.includes(s[end - 1] as string)) end -= 1;
|
|
295
|
-
return s.slice(start, end);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function stripDoubleSingle(s: string): string {
|
|
299
|
-
return stripChars(stripChars(s, '"'), "'");
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function _injectHrrBanner(body: string, level: string, owner: string): string {
|
|
303
|
-
if (body.includes(_HRR_BANNER_MARKER)) return body;
|
|
304
|
-
const banner = `${_HRR_BANNER_MARKER}\n> HUMAN REVIEW REQUIRED · trust: ${level} · owner: ${owner}\n\n`;
|
|
305
|
-
return banner + body.replace(/^\n+/, '');
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
function _rewritePaths(content: string, sourceRelativePath: string): string {
|
|
309
|
-
const prefix = _depthPrefix(sourceRelativePath);
|
|
310
|
-
const [fmLines, bodyInitial] = _splitFrontmatter(content);
|
|
311
|
-
let body = _rewriteBodyLinks(bodyInitial, prefix);
|
|
312
|
-
if (fmLines === null) return body;
|
|
313
|
-
const newFm = _rewriteFrontmatterLines(fmLines, prefix);
|
|
314
|
-
const [level, hrr, owner] = _parseTrustAndOwner(fmLines);
|
|
315
|
-
if (hrr && level) {
|
|
316
|
-
body = _injectHrrBanner(body, level, owner);
|
|
317
|
-
}
|
|
318
|
-
return `---\n${newFm.join('\n')}\n---\n${body}`;
|
|
319
|
-
}
|
|
157
|
+
import { _rewrite_paths as _rewritePaths } from './condense.js';
|
|
320
158
|
|
|
321
159
|
// ---------------------------------------------------------------------------
|
|
322
160
|
// Extraction helpers (port of check_condensation.py)
|
|
@@ -454,6 +292,32 @@ function extractIronLawSections(text: string): Array<[string, number, string]> {
|
|
|
454
292
|
function checkPair(relPath: string, source: string, condensed: string): Issue[] {
|
|
455
293
|
const issues: Issue[] = [];
|
|
456
294
|
|
|
295
|
+
// ADR-201 + council verdict B: the PRIMARY invariant. `source` reaching this
|
|
296
|
+
// function has already had the deterministic path rewrite applied, so
|
|
297
|
+
// `source === condensed` is exactly `dist == rewrite(src)` — byte-for-byte.
|
|
298
|
+
//
|
|
299
|
+
// This assertion was IMPOSSIBLE before ADR-201: an LLM prose rewrite has no
|
|
300
|
+
// expected output, which is why the determinism sub-gate failed by construction
|
|
301
|
+
// and why the old source-keyed hash certified drift as clean (observed three
|
|
302
|
+
// times in one session). With the rewrite removed, the property the gate was
|
|
303
|
+
// always supposed to hold finally becomes checkable.
|
|
304
|
+
//
|
|
305
|
+
// The structural checks below are retained as DIAGNOSTICS: when bytes differ
|
|
306
|
+
// they name what differs (frontmatter, a lost Iron Law, a mangled code block)
|
|
307
|
+
// instead of leaving the operator with an opaque inequality. If bytes match,
|
|
308
|
+
// every structural check is trivially satisfied.
|
|
309
|
+
if (source !== condensed) {
|
|
310
|
+
issues.push({
|
|
311
|
+
file: relPath,
|
|
312
|
+
check: 'not_byte_exact',
|
|
313
|
+
severity: 'error',
|
|
314
|
+
message:
|
|
315
|
+
'dist is not the byte-exact path-rewritten copy of src — either the ' +
|
|
316
|
+
'projection is stale (run the sync) or dist was hand-edited. ' +
|
|
317
|
+
'Diagnostics below name the difference.',
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
457
321
|
// Frontmatter check
|
|
458
322
|
const srcFm = extractFrontmatter(source);
|
|
459
323
|
const cmpFm = extractFrontmatter(condensed);
|
|
@@ -567,7 +431,14 @@ function checkPair(relPath: string, source: string, condensed: string): Issue[]
|
|
|
567
431
|
}
|
|
568
432
|
}
|
|
569
433
|
|
|
570
|
-
// Word
|
|
434
|
+
// Word-count ratio — kept ONLY as an excessive-reduction alarm.
|
|
435
|
+
//
|
|
436
|
+
// Post-ADR-201 the projection is a verbatim copy, so the expected reduction is
|
|
437
|
+
// 0% and the old `minimal_reduction` info fired on 413 of 428 files by design.
|
|
438
|
+
// A diagnostic that flags 96% of its inputs is not a diagnostic, it is noise
|
|
439
|
+
// that trains the reader to skip the output. The excessive-reduction warning
|
|
440
|
+
// stays: under byte-exactness it can only fire if something upstream mangled a
|
|
441
|
+
// file, which is exactly when a loud second signal earns its place.
|
|
571
442
|
const srcWords = wordCount(source);
|
|
572
443
|
const cmpWords = wordCount(condensed);
|
|
573
444
|
if (srcWords > 0) {
|
|
@@ -578,16 +449,9 @@ function checkPair(relPath: string, source: string, condensed: string): Issue[]
|
|
|
578
449
|
check: 'excessive_reduction',
|
|
579
450
|
severity: 'warning',
|
|
580
451
|
message:
|
|
581
|
-
`
|
|
452
|
+
`Projection lost ${fmt0f(reduction)}% of the words — content loss ` +
|
|
582
453
|
`(${srcWords} → ${cmpWords} words)`,
|
|
583
454
|
});
|
|
584
|
-
} else if (reduction < 5 && srcWords > 100) {
|
|
585
|
-
issues.push({
|
|
586
|
-
file: relPath,
|
|
587
|
-
check: 'minimal_reduction',
|
|
588
|
-
severity: 'info',
|
|
589
|
-
message: `Condensation only reduced ${fmt0f(reduction)}% (${srcWords} → ${cmpWords} words)`,
|
|
590
|
-
});
|
|
591
455
|
}
|
|
592
456
|
}
|
|
593
457
|
|
|
@@ -619,15 +483,31 @@ function rglobMdSorted(dir: string): string[] {
|
|
|
619
483
|
return out;
|
|
620
484
|
}
|
|
621
485
|
|
|
486
|
+
/** A gate that scans nothing must never report success. This fired for real:
|
|
487
|
+
* `SOURCE_DIR` pointed at a tree emptied by the ADR-051 migration, so the check
|
|
488
|
+
* ran in CI against 0 pairs and exited 0 for as long as the tree stayed dead.
|
|
489
|
+
* Zero findings over zero inputs is a broken gate, not a pass. */
|
|
490
|
+
function scannedNothing(sourceDir: string): Issue {
|
|
491
|
+
return {
|
|
492
|
+
file: SOURCE_DIR,
|
|
493
|
+
check: 'scanned_nothing',
|
|
494
|
+
severity: 'error',
|
|
495
|
+
message:
|
|
496
|
+
`scanned 0 source/target pairs under '${sourceDir}' — a gate that inspects ` +
|
|
497
|
+
`nothing cannot pass. Check SOURCE_DIR/TARGET_DIR against the real tree.`,
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
|
|
622
501
|
function scanAll(root: string): Issue[] {
|
|
623
502
|
const issues: Issue[] = [];
|
|
624
503
|
const sourceDir = path.join(root, SOURCE_DIR);
|
|
625
504
|
const targetDir = path.join(root, TARGET_DIR);
|
|
626
505
|
|
|
627
506
|
if (!fs.existsSync(sourceDir) || !fs.existsSync(targetDir)) {
|
|
628
|
-
return
|
|
507
|
+
return [scannedNothing(sourceDir)];
|
|
629
508
|
}
|
|
630
509
|
|
|
510
|
+
let scanned = 0;
|
|
631
511
|
for (const sourceFile of rglobMdSorted(sourceDir)) {
|
|
632
512
|
const rel = path.relative(sourceDir, sourceFile);
|
|
633
513
|
const targetFile = path.join(targetDir, rel);
|
|
@@ -641,12 +521,37 @@ function scanAll(root: string): Issue[] {
|
|
|
641
521
|
continue;
|
|
642
522
|
}
|
|
643
523
|
|
|
524
|
+
// Pair via the projector's root PRECEDENCE, not by naive src/-relative
|
|
525
|
+
// pathing. `src/` and `src/agent-src/` are both artefact roots, so the same
|
|
526
|
+
// relative path can name two UNRELATED files — `profiles/README.md` exists
|
|
527
|
+
// under both, documenting different things (the CLI's profile YAMLs vs the
|
|
528
|
+
// agent-src seed profiles). Pairing them by string produced a byte-exactness
|
|
529
|
+
// failure that looked like a stale shadow file and was really a collision in
|
|
530
|
+
// this loop. `src/agent-src/<rel>` wins because that is the root the
|
|
531
|
+
// projector resolves first.
|
|
532
|
+
const agentSrcCandidate = path.join(sourceDir, 'agent-src', rel);
|
|
533
|
+
const effectiveSource =
|
|
534
|
+
!sourceFile.includes(`${path.sep}agent-src${path.sep}`) && fs.existsSync(agentSrcCandidate)
|
|
535
|
+
? agentSrcCandidate
|
|
536
|
+
: sourceFile;
|
|
537
|
+
if (effectiveSource !== sourceFile) {
|
|
538
|
+
continue; // the agent-src copy is the real pair; it gets its own iteration
|
|
539
|
+
}
|
|
540
|
+
|
|
644
541
|
let sourceText = fs.readFileSync(sourceFile, 'utf-8');
|
|
645
542
|
const targetText = fs.readFileSync(targetFile, 'utf-8');
|
|
646
543
|
sourceText = _rewritePaths(sourceText, relStr);
|
|
544
|
+
scanned += 1;
|
|
647
545
|
issues.push(...checkPair(relStr, sourceText, targetText));
|
|
648
546
|
}
|
|
649
547
|
|
|
548
|
+
if (scanned === 0) {
|
|
549
|
+
issues.push(scannedNothing(sourceDir));
|
|
550
|
+
}
|
|
551
|
+
// Gate-coverage contract (src/config/gate-coverage.yml): emit exactly one
|
|
552
|
+
// machine-readable count so `check_gate_coverage` never has to parse the
|
|
553
|
+
// human report. A guard that parses prose is the fragile thing it replaces.
|
|
554
|
+
process.stdout.write(`scanned: ${String(scanned)}\n`);
|
|
650
555
|
return issues;
|
|
651
556
|
}
|
|
652
557
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* scan trees / order / locked sub-trees / grandfathered files, same
|
|
10
10
|
* orphan self-reference subtraction (latent: substring replace).
|
|
11
11
|
*
|
|
12
|
-
* Validates that every `*.md` under
|
|
12
|
+
* Validates that every `*.md` under `src/agent-src/contexts/`:
|
|
13
13
|
* 1. Lives in a locked sub-tree (or is a grandfathered root file).
|
|
14
14
|
* 2. Does not collide on basename with another context in another sub-tree.
|
|
15
15
|
* 3. Is referenced by at least one rule, skill, command, or other context.
|
|
@@ -24,8 +24,8 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
24
24
|
|
|
25
25
|
const _HERE = fileURLToPath(import.meta.url);
|
|
26
26
|
const ROOT = path.resolve(path.dirname(_HERE), '..', '..');
|
|
27
|
-
const CONTEXTS_ROOT = path.join(ROOT, '
|
|
28
|
-
// Logical relpath of the contexts root under ROOT (e.g. "
|
|
27
|
+
const CONTEXTS_ROOT = path.join(ROOT, 'src', 'agent-src', 'contexts');
|
|
28
|
+
// Logical relpath of the contexts root under ROOT (e.g. "src/agent-src/contexts").
|
|
29
29
|
const CONTEXTS_REL = path.relative(ROOT, CONTEXTS_ROOT).split(path.sep).join('/');
|
|
30
30
|
|
|
31
31
|
const LOCKED_SUBTREES = [
|
|
@@ -49,11 +49,21 @@ const GRANDFATHERED_ROOT_FILES: ReadonlySet<string> = new Set([
|
|
|
49
49
|
'subagent-configuration.md',
|
|
50
50
|
]);
|
|
51
51
|
|
|
52
|
+
// Retargeted 2026-07-29 — see the note in check_no_roadmap_refs: these pointed at
|
|
53
|
+
// the tree emptied by ADR-051, so only `agents/roadmaps` was ever scanned.
|
|
54
|
+
//
|
|
55
|
+
// `src/domains` is NOT a 1:1 rename of an old entry — it is a root that did not
|
|
56
|
+
// exist in the pre-migration layout and holds pack command definitions that cite
|
|
57
|
+
// contexts. A straight four-for-four remap produced three false "orphan" verdicts
|
|
58
|
+
// (research-schema, host-capability-manifest, non-interactive-contract — each in
|
|
59
|
+
// fact referenced 8/11/12 times) because their citations live under src/domains.
|
|
60
|
+
// A retarget has to follow where the references moved, not just where the files did.
|
|
52
61
|
const REFERENCE_SCAN_DIRS = [
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
62
|
+
'src/rules',
|
|
63
|
+
'src/skills',
|
|
64
|
+
'src/agent-src/commands',
|
|
65
|
+
'src/agent-src/contexts',
|
|
66
|
+
'src/domains',
|
|
57
67
|
'agents/roadmaps',
|
|
58
68
|
] as const;
|
|
59
69
|
|
|
@@ -198,6 +208,10 @@ function _build_reference_corpus(root: string): string {
|
|
|
198
208
|
}
|
|
199
209
|
}
|
|
200
210
|
}
|
|
211
|
+
// Gate-coverage contract (src/config/gate-coverage.yml): the reference corpus
|
|
212
|
+
// size IS this gate's scan count — an empty corpus makes every "unreferenced"
|
|
213
|
+
// verdict vacuous, which is exactly how the dead root went unnoticed.
|
|
214
|
+
process.stdout.write(`scanned: ${String(chunks.length)}\n`);
|
|
201
215
|
return chunks.join('\n');
|
|
202
216
|
}
|
|
203
217
|
|
|
@@ -212,11 +226,26 @@ function _replaceAll(haystack: string, needle: string): string {
|
|
|
212
226
|
function _check_orphans(contexts: string[], corpus: string, root: string): Violation[] {
|
|
213
227
|
const out: Violation[] = [];
|
|
214
228
|
for (const ctx of contexts) {
|
|
215
|
-
const rel_src = _relToPosix(ctx, root); //
|
|
229
|
+
const rel_src = _relToPosix(ctx, root); // src/agent-src/contexts/...
|
|
216
230
|
const rel_short = rel_src.includes('contexts/')
|
|
217
231
|
? rel_src.slice(rel_src.indexOf('contexts/') + 'contexts/'.length)
|
|
218
232
|
: rel_src;
|
|
219
|
-
|
|
233
|
+
// Sibling contexts link each other by BARE BASENAME —
|
|
234
|
+
// `[`x`](x.md)` — which none of the three path-qualified candidates
|
|
235
|
+
// below can see. That gap was invisible until 2026-07-29: the old
|
|
236
|
+
// contexts scan root was the ADR-051-emptied tree, so context→context
|
|
237
|
+
// references were never in the corpus at all, and no orphan verdict
|
|
238
|
+
// ever depended on them. Matched as a LINK TARGET (`](…)`) rather than
|
|
239
|
+
// a loose substring, so a prose mention of the filename does not count
|
|
240
|
+
// as a reference.
|
|
241
|
+
const base = path.basename(ctx);
|
|
242
|
+
const candidates = [
|
|
243
|
+
rel_src,
|
|
244
|
+
`contexts/${rel_short}`,
|
|
245
|
+
rel_short,
|
|
246
|
+
`](${base})`,
|
|
247
|
+
`](./${base})`,
|
|
248
|
+
];
|
|
220
249
|
let own_text = '';
|
|
221
250
|
try {
|
|
222
251
|
own_text = fs.readFileSync(ctx, 'utf-8');
|