@event4u/agent-config 5.10.1 → 6.1.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 +237 -233
- package/AGENTS.md +6 -6
- package/CHANGELOG.md +218 -38
- package/CONTRIBUTING.md +27 -15
- package/MIGRATION.md +102 -0
- package/README.md +49 -20
- package/dist/agent-src/README.md +64 -0
- package/dist/agent-src/commands/agent-handoff.md +125 -0
- package/dist/agent-src/commands/agent-status.md +141 -0
- package/dist/agent-src/commands/agents/audit.md +159 -0
- package/dist/agent-src/commands/agents/init.md +195 -0
- package/dist/agent-src/commands/agents/optimize.md +188 -0
- package/dist/agent-src/commands/agents/user/accept.md +124 -0
- package/dist/agent-src/commands/agents/user/init.md +164 -0
- package/dist/agent-src/commands/agents/user/review.md +114 -0
- package/dist/agent-src/commands/agents/user/show.md +116 -0
- package/dist/agent-src/commands/agents/user/update.md +104 -0
- package/dist/agent-src/commands/agents/user.md +72 -0
- package/dist/agent-src/commands/agents.md +67 -0
- package/dist/agent-src/commands/analytics/prune.md +72 -0
- package/dist/agent-src/commands/analytics/show.md +101 -0
- package/dist/agent-src/commands/analytics.md +78 -0
- package/dist/agent-src/commands/analyze-reference-repo.md +205 -0
- package/dist/agent-src/commands/bug-fix.md +194 -0
- package/dist/agent-src/commands/bug-investigate.md +187 -0
- package/dist/agent-src/commands/challenge-me/vision.md +355 -0
- package/dist/agent-src/commands/challenge-me/with-docs.md +340 -0
- package/dist/agent-src/commands/challenge-me.md +69 -0
- package/dist/agent-src/commands/chat-history/import.md +172 -0
- package/dist/agent-src/commands/chat-history.md +62 -0
- package/dist/agent-src/commands/check-current-md.md +144 -0
- package/dist/agent-src/commands/commit/in-chunks.md +148 -0
- package/dist/agent-src/commands/commit.md +196 -0
- package/dist/agent-src/commands/condense.md +240 -0
- package/dist/agent-src/commands/context/create.md +182 -0
- package/dist/agent-src/commands/context/refactor.md +184 -0
- package/dist/agent-src/commands/context.md +53 -0
- package/dist/agent-src/commands/cost-report.md +132 -0
- package/dist/agent-src/commands/council/analysis.md +148 -0
- package/dist/agent-src/commands/council/debate.md +135 -0
- package/dist/agent-src/commands/council/default.md +290 -0
- package/dist/agent-src/commands/council/design.md +108 -0
- package/dist/agent-src/commands/council/optimize.md +124 -0
- package/dist/agent-src/commands/council/pr.md +131 -0
- package/dist/agent-src/commands/council.md +112 -0
- package/dist/agent-src/commands/e2e-heal.md +111 -0
- package/dist/agent-src/commands/e2e-plan.md +98 -0
- package/dist/agent-src/commands/estimate-ticket.md +93 -0
- package/dist/agent-src/commands/evals/agent-handoff.json +34 -0
- package/dist/agent-src/commands/evals/agent-status.json +34 -0
- package/dist/agent-src/commands/evals/agents.json +34 -0
- package/dist/agent-src/commands/evals/commit.json +34 -0
- package/dist/agent-src/commands/evals/condense.json +34 -0
- package/dist/agent-src/commands/evals/council.json +34 -0
- package/dist/agent-src/commands/evals/create-pr.json +34 -0
- package/dist/agent-src/commands/evals/estimate-ticket.json +34 -0
- package/dist/agent-src/commands/evals/feature.json +34 -0
- package/dist/agent-src/commands/evals/fix.json +34 -0
- package/dist/agent-src/commands/evals/implement-ticket.json +34 -0
- package/dist/agent-src/commands/evals/jira-ticket.json +34 -0
- package/dist/agent-src/commands/evals/judge.json +34 -0
- package/dist/agent-src/commands/evals/memory.json +34 -0
- package/dist/agent-src/commands/evals/mode.json +34 -0
- package/dist/agent-src/commands/evals/optimize.json +34 -0
- package/dist/agent-src/commands/evals/refine-ticket.json +34 -0
- package/dist/agent-src/commands/evals/review-changes.json +34 -0
- package/dist/agent-src/commands/evals/roadmap.json +34 -0
- package/dist/agent-src/commands/evals/work.json +34 -0
- package/dist/agent-src/commands/feature/dev.md +125 -0
- package/dist/agent-src/commands/feature/explore.md +192 -0
- package/dist/agent-src/commands/feature/plan.md +333 -0
- package/dist/agent-src/commands/feature/refactor.md +195 -0
- package/dist/agent-src/commands/feature/roadmap.md +223 -0
- package/dist/agent-src/commands/feature.md +64 -0
- package/dist/agent-src/commands/fix/ci.md +60 -0
- package/dist/agent-src/commands/fix/portability.md +109 -0
- package/dist/agent-src/commands/fix/pr-comments.md +201 -0
- package/dist/agent-src/commands/fix/refs.md +106 -0
- package/dist/agent-src/commands/fix/seeder.md +159 -0
- package/dist/agent-src/commands/fix.md +88 -0
- package/dist/agent-src/commands/ghostwriter/delete.md +125 -0
- package/dist/agent-src/commands/ghostwriter/fetch.md +191 -0
- package/dist/agent-src/commands/ghostwriter/list.md +109 -0
- package/dist/agent-src/commands/ghostwriter/show.md +120 -0
- package/dist/agent-src/commands/ghostwriter/write.md +166 -0
- package/dist/agent-src/commands/ghostwriter.md +102 -0
- package/dist/agent-src/commands/grill-me.md +46 -0
- package/dist/agent-src/commands/image/analyse.md +53 -0
- package/dist/agent-src/commands/image/create.md +55 -0
- package/dist/agent-src/commands/image/verify.md +50 -0
- package/dist/agent-src/commands/image.md +71 -0
- package/dist/agent-src/commands/implement-ticket.md +170 -0
- package/dist/agent-src/commands/jira-ticket.md +85 -0
- package/dist/agent-src/commands/judge/on-diff.md +125 -0
- package/dist/agent-src/commands/judge/solo.md +97 -0
- package/dist/agent-src/commands/judge/steps.md +95 -0
- package/dist/agent-src/commands/judge.md +87 -0
- package/dist/agent-src/commands/knowledge/cross-repo.md +73 -0
- package/dist/agent-src/commands/knowledge/forget.md +98 -0
- package/dist/agent-src/commands/knowledge/ingest.md +116 -0
- package/dist/agent-src/commands/knowledge/list.md +96 -0
- package/dist/agent-src/commands/knowledge.md +71 -0
- package/dist/agent-src/commands/memory/add.md +149 -0
- package/dist/agent-src/commands/memory/learn-low-impact.md +149 -0
- package/dist/agent-src/commands/memory/load.md +176 -0
- package/dist/agent-src/commands/memory/mine-session.md +184 -0
- package/dist/agent-src/commands/memory/promote.md +196 -0
- package/dist/agent-src/commands/memory/propose.md +123 -0
- package/dist/agent-src/commands/memory.md +62 -0
- package/dist/agent-src/commands/mode.md +134 -0
- package/dist/agent-src/commands/module/create.md +145 -0
- package/dist/agent-src/commands/module/explore.md +199 -0
- package/dist/agent-src/commands/module.md +53 -0
- package/dist/agent-src/commands/optimize/agents-dir.md +120 -0
- package/dist/agent-src/commands/optimize/augmentignore.md +313 -0
- package/dist/agent-src/commands/optimize/rtk.md +162 -0
- package/dist/agent-src/commands/optimize/skills.md +133 -0
- package/dist/agent-src/commands/optimize-prompt.md +68 -0
- package/dist/agent-src/commands/optimize.md +62 -0
- package/dist/agent-src/commands/orchestrate.md +130 -0
- package/dist/agent-src/commands/override/create.md +109 -0
- package/dist/agent-src/commands/override/manage.md +108 -0
- package/dist/agent-src/commands/override.md +73 -0
- package/dist/agent-src/commands/package-reset.md +164 -0
- package/dist/agent-src/commands/package-test.md +240 -0
- package/dist/agent-src/commands/post-as/ghostwriter.md +73 -0
- package/dist/agent-src/commands/post-as/me.md +131 -0
- package/dist/agent-src/commands/post-as.md +64 -0
- package/dist/agent-src/commands/pr/create/description-only.md +162 -0
- package/dist/agent-src/commands/pr/create.md +279 -0
- package/dist/agent-src/commands/prediction-pool.md +236 -0
- package/dist/agent-src/commands/prepare-for-review.md +108 -0
- package/dist/agent-src/commands/profile/activate.md +83 -0
- package/dist/agent-src/commands/profile/deactivate.md +70 -0
- package/dist/agent-src/commands/profile/show.md +81 -0
- package/dist/agent-src/commands/profile.md +70 -0
- package/dist/agent-src/commands/project-analyze.md +322 -0
- package/dist/agent-src/commands/project-health.md +107 -0
- package/dist/agent-src/commands/quality-fix.md +146 -0
- package/dist/agent-src/commands/refine-ticket.md +99 -0
- package/dist/agent-src/commands/research/deep.md +156 -0
- package/dist/agent-src/commands/research/report.md +141 -0
- package/dist/agent-src/commands/research.md +180 -0
- package/dist/agent-src/commands/review-changes.md +214 -0
- package/dist/agent-src/commands/review-routing.md +126 -0
- package/dist/agent-src/commands/roadmap/ai-council.md +190 -0
- package/dist/agent-src/commands/roadmap/create.md +215 -0
- package/dist/agent-src/commands/roadmap/process-full.md +110 -0
- package/dist/agent-src/commands/roadmap/process-phase.md +76 -0
- package/dist/agent-src/commands/roadmap/process-step.md +64 -0
- package/dist/agent-src/commands/roadmap.md +84 -0
- package/dist/agent-src/commands/rule-compliance-audit.md +157 -0
- package/dist/agent-src/commands/security-audit-config.md +84 -0
- package/dist/agent-src/commands/set-cost-profile.md +119 -0
- package/dist/agent-src/commands/skill/preview.md +69 -0
- package/dist/agent-src/commands/skill.md +50 -0
- package/dist/agent-src/commands/skills/discover.md +78 -0
- package/dist/agent-src/commands/skills.md +58 -0
- package/dist/agent-src/commands/sync-agent-settings.md +142 -0
- package/dist/agent-src/commands/sync-gitignore/fix.md +150 -0
- package/dist/agent-src/commands/sync-gitignore.md +141 -0
- package/dist/agent-src/commands/tests/create.md +92 -0
- package/dist/agent-src/commands/tests/execute.md +86 -0
- package/dist/agent-src/commands/tests.md +77 -0
- package/dist/agent-src/commands/threat-model.md +127 -0
- package/dist/agent-src/commands/update-form-request-messages.md +201 -0
- package/dist/agent-src/commands/upstream-contribute.md +183 -0
- package/dist/agent-src/commands/video/from-script.md +159 -0
- package/dist/agent-src/commands/video/from-song.md +491 -0
- package/dist/agent-src/commands/video/scene.md +131 -0
- package/dist/agent-src/commands/video/stitch.md +89 -0
- package/dist/agent-src/commands/video/storyboard.md +101 -0
- package/dist/agent-src/commands/video.md +75 -0
- package/dist/agent-src/commands/work.md +176 -0
- package/dist/agent-src/contexts/augment-infrastructure.md +178 -0
- package/dist/agent-src/contexts/authority/commit-mechanics.md +93 -0
- package/dist/agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +138 -0
- package/dist/agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +89 -0
- package/dist/agent-src/contexts/communication/rules-auto/source-of-truth-mechanics.md +99 -0
- package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +98 -0
- package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +259 -0
- package/dist/agent-src/contexts/contracts/consumer-agents-md-guide.md +127 -0
- package/dist/agent-src/contexts/contracts/emergency-triage-block.md +53 -0
- package/dist/agent-src/contexts/execution/non-interactive-contract.md +132 -0
- package/dist/agent-src/contexts/execution/rdp-gate.md +75 -0
- package/dist/agent-src/contexts/execution/toolchain-resolver.md +113 -0
- package/dist/agent-src/contexts/subagent-configuration.md +63 -0
- package/dist/agent-src/personas/README.md +114 -0
- package/dist/agent-src/personas/advisors/contrarian.md +95 -0
- package/dist/agent-src/personas/advisors/executor.md +99 -0
- package/dist/agent-src/personas/advisors/expansionist.md +98 -0
- package/dist/agent-src/personas/advisors/first-principles.md +98 -0
- package/dist/agent-src/personas/advisors/outsider.md +102 -0
- package/dist/agent-src/profiles/agency.yml +36 -0
- package/dist/agent-src/profiles/content_creator.yml +34 -0
- package/dist/agent-src/profiles/developer.yml +31 -0
- package/dist/agent-src/profiles/finance.yml +30 -0
- package/dist/agent-src/profiles/founder.yml +33 -0
- package/dist/agent-src/profiles/ops.yml +33 -0
- package/dist/agent-src/rules/ask-when-uncertain.md +70 -0
- package/dist/agent-src/rules/augment-edit-discipline.md +31 -0
- package/dist/agent-src/rules/autonomous-execution.md +113 -0
- package/dist/agent-src/rules/commit-policy.md +59 -0
- package/dist/agent-src/rules/direct-answers.md +64 -0
- package/dist/agent-src/rules/domain-adoption-policy.md +160 -0
- package/dist/agent-src/rules/external-reference-deep-dive.md +72 -0
- package/dist/agent-src/rules/git-history-discipline.md +148 -0
- package/dist/agent-src/rules/improve-before-implement.md +124 -0
- package/dist/agent-src/rules/language-and-tone.md +64 -0
- package/dist/agent-src/rules/lethal-trifecta-guard.md +80 -0
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +38 -0
- package/dist/agent-src/rules/media-governance-routing.md +85 -0
- package/dist/agent-src/rules/missing-tool-handling.md +22 -0
- package/dist/agent-src/rules/model-recommendation.md +25 -0
- package/dist/agent-src/rules/no-attribution-footers.md +57 -0
- package/dist/agent-src/rules/no-cheap-questions.md +75 -0
- package/dist/agent-src/rules/no-pr-progress-comments.md +108 -0
- package/dist/agent-src/rules/no-roadmap-references.md +141 -0
- package/dist/agent-src/rules/non-destructive-by-default.md +58 -0
- package/dist/agent-src/rules/notes-first-reasoning.md +71 -0
- package/dist/agent-src/rules/persona-governance.md +93 -0
- package/dist/agent-src/rules/preservation-guard.md +97 -0
- package/dist/agent-src/rules/provider-lifecycle-discipline.md +78 -0
- package/dist/agent-src/rules/roadmap-progress-sync.md +131 -0
- package/dist/agent-src/rules/scope-control.md +68 -0
- package/dist/agent-src/rules/security-sensitive-stop.md +100 -0
- package/dist/agent-src/rules/source-confidentiality.md +97 -0
- package/dist/agent-src/rules/source-of-truth.md +80 -0
- package/dist/agent-src/rules/think-before-action.md +49 -0
- package/dist/agent-src/rules/untrusted-input-defense.md +76 -0
- package/dist/agent-src/rules/user-interrupt-priority.md +49 -0
- package/dist/agent-src/rules/verify-before-complete.md +78 -0
- package/dist/agent-src/scripts/archive_completed_roadmaps.py +171 -0
- package/dist/agent-src/scripts/update_roadmap_progress.py +537 -0
- package/dist/agent-src/skills/accessibility-auditor/SKILL.md +147 -0
- package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +13 -0
- package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +34 -0
- package/dist/agent-src/skills/adversarial-review/SKILL.md +170 -0
- package/dist/agent-src/skills/agent-security-review/SKILL.md +113 -0
- package/dist/agent-src/skills/agent-security-review/evals/triggers.json +51 -0
- package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +143 -0
- package/dist/agent-src/skills/ai-council/SKILL.md +912 -0
- package/dist/agent-src/skills/api-design/SKILL.md +120 -0
- package/dist/agent-src/skills/api-design/data/api-patterns.csv +13 -0
- package/dist/agent-src/skills/api-design/data/manifest.json +34 -0
- package/dist/agent-src/skills/api-endpoint/SKILL.md +100 -0
- package/dist/agent-src/skills/async-python-patterns/SKILL.md +158 -0
- package/dist/agent-src/skills/authz-review/SKILL.md +188 -0
- package/dist/agent-src/skills/blade-ui/SKILL.md +135 -0
- package/dist/agent-src/skills/blast-radius-analyzer/SKILL.md +193 -0
- package/dist/agent-src/skills/character-consistency/SKILL.md +192 -0
- package/dist/agent-src/skills/check-refs/SKILL.md +96 -0
- package/dist/agent-src/skills/code-review/SKILL.md +224 -0
- package/dist/agent-src/skills/command-routing/SKILL.md +134 -0
- package/dist/agent-src/skills/command-writing/SKILL.md +301 -0
- package/dist/agent-src/skills/complexity-first-planning/SKILL.md +96 -0
- package/dist/agent-src/skills/complexity-first-planning/evals/triggers.json +16 -0
- package/dist/agent-src/skills/condense-memory/SKILL.md +123 -0
- package/dist/agent-src/skills/context-document/SKILL.md +160 -0
- package/dist/agent-src/skills/copilot-config/SKILL.md +207 -0
- package/dist/agent-src/skills/corpus-grounding/SKILL.md +205 -0
- package/dist/agent-src/skills/corpus-grounding/evals/triggers.json +16 -0
- package/dist/agent-src/skills/corpus-grounding/scripts/bm25_search.py +212 -0
- package/dist/agent-src/skills/corpus-grounding/scripts/decision_engine.py +438 -0
- package/dist/agent-src/skills/corpus-grounding/scripts/ground.py +166 -0
- package/dist/agent-src/skills/corpus-grounding/scripts/schema_validator.py +160 -0
- package/dist/agent-src/skills/dashboard-design/SKILL.md +129 -0
- package/dist/agent-src/skills/database/SKILL.md +111 -0
- package/dist/agent-src/skills/database/data/manifest.json +35 -0
- package/dist/agent-src/skills/database/data/query-tuning.csv +13 -0
- package/dist/agent-src/skills/deep-reading-analyst/SKILL.md +188 -0
- package/dist/agent-src/skills/defense-in-depth/SKILL.md +157 -0
- package/dist/agent-src/skills/design-intelligence/ATTRIBUTION.md +54 -0
- package/dist/agent-src/skills/design-intelligence/LICENSE.apache-2.0.txt +202 -0
- package/dist/agent-src/skills/design-intelligence/SKILL.md +177 -0
- package/dist/agent-src/skills/design-intelligence/data/app-interface.csv +31 -0
- package/dist/agent-src/skills/design-intelligence/data/charts.csv +26 -0
- package/dist/agent-src/skills/design-intelligence/data/colors.csv +162 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/academia.txt +120 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/bauhaus.txt +140 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/bold-typography.txt +107 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/claymorphism.txt +76 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/cyberpunk.txt +157 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/enterprise.txt +89 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/flat-design.txt +66 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/kinetic.txt +98 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/material-design.txt +133 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/modern-dark.txt +123 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/monochrome.txt +216 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/neo-brutalism.txt +65 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/neumorphism.txt +75 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/saas.txt +109 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/sketch.txt +83 -0
- package/dist/agent-src/skills/design-intelligence/data/design-languages/terminal.txt +80 -0
- package/dist/agent-src/skills/design-intelligence/data/icons.csv +106 -0
- package/dist/agent-src/skills/design-intelligence/data/landing.csv +35 -0
- package/dist/agent-src/skills/design-intelligence/data/manifest.json +500 -0
- package/dist/agent-src/skills/design-intelligence/data/products.csv +162 -0
- package/dist/agent-src/skills/design-intelligence/data/react-performance.csv +45 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/angular.csv +51 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/astro.csv +54 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/flutter.csv +53 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/html-tailwind.csv +56 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/jetpack-compose.csv +53 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/laravel.csv +51 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/nextjs.csv +53 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/nuxt-ui.csv +51 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/nuxtjs.csv +59 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/react-native.csv +52 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/react.csv +54 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/shadcn.csv +61 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/svelte.csv +54 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/swiftui.csv +51 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/threejs.csv +54 -0
- package/dist/agent-src/skills/design-intelligence/data/stacks/vue.csv +50 -0
- package/dist/agent-src/skills/design-intelligence/data/styles.csv +85 -0
- package/dist/agent-src/skills/design-intelligence/data/typography.csv +74 -0
- package/dist/agent-src/skills/design-intelligence/data/ui-reasoning.csv +162 -0
- package/dist/agent-src/skills/design-intelligence/data/ux-guidelines.csv +100 -0
- package/dist/agent-src/skills/design-intelligence/evals/triggers.json +16 -0
- package/dist/agent-src/skills/design-intelligence/references/design-languages.md +45 -0
- package/dist/agent-src/skills/design-intelligence/references/design-rules-checklist.md +268 -0
- package/dist/agent-src/skills/design-review/SKILL.md +233 -0
- package/dist/agent-src/skills/design-tokens/SKILL.md +135 -0
- package/dist/agent-src/skills/design-tokens/evals/triggers.json +16 -0
- package/dist/agent-src/skills/design-tokens/scripts/tokens.py +296 -0
- package/dist/agent-src/skills/design-tokens/templates/design-tokens-starter.json +143 -0
- package/dist/agent-src/skills/developer-like-execution/SKILL.md +293 -0
- package/dist/agent-src/skills/error-handling-patterns/SKILL.md +139 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +217 -0
- package/dist/agent-src/skills/fe-design/SKILL.md +265 -0
- package/dist/agent-src/skills/feature-planning/SKILL.md +271 -0
- package/dist/agent-src/skills/flux/SKILL.md +126 -0
- package/dist/agent-src/skills/jira-integration/SKILL.md +187 -0
- package/dist/agent-src/skills/lint-skills/SKILL.md +95 -0
- package/dist/agent-src/skills/livewire/SKILL.md +139 -0
- package/dist/agent-src/skills/mcp-builder/SKILL.md +113 -0
- package/dist/agent-src/skills/md-language-check/SKILL.md +130 -0
- package/dist/agent-src/skills/memory-consolidation/SKILL.md +266 -0
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +195 -0
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +197 -0
- package/dist/agent-src/skills/persona-writing/SKILL.md +158 -0
- package/dist/agent-src/skills/prompt-engineering-patterns/SKILL.md +150 -0
- package/dist/agent-src/skills/prompt-validator/SKILL.md +167 -0
- package/dist/agent-src/skills/prompt-validator/evals/triggers.json +16 -0
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +235 -0
- package/dist/agent-src/skills/react-shadcn-ui/scripts/shadcn_add.py +299 -0
- package/dist/agent-src/skills/readme-reviewer/SKILL.md +242 -0
- package/dist/agent-src/skills/readme-writing/SKILL.md +240 -0
- package/dist/agent-src/skills/readme-writing-package/SKILL.md +350 -0
- package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +119 -0
- package/dist/agent-src/skills/reasoning-orchestrator/evals/triggers.json +16 -0
- package/dist/agent-src/skills/receiving-code-review/SKILL.md +200 -0
- package/dist/agent-src/skills/refine-prompt/SKILL.md +291 -0
- package/dist/agent-src/skills/refine-ticket/SKILL.md +338 -0
- package/dist/agent-src/skills/repomix-packer/SKILL.md +141 -0
- package/dist/agent-src/skills/roadmap-management/SKILL.md +461 -0
- package/dist/agent-src/skills/rule-refactor/SKILL.md +149 -0
- package/dist/agent-src/skills/rule-writing/SKILL.md +277 -0
- package/dist/agent-src/skills/scene-expander/SKILL.md +158 -0
- package/dist/agent-src/skills/scene-expander/scene-blueprint.schema.yaml +114 -0
- package/dist/agent-src/skills/script-writing/SKILL.md +231 -0
- package/dist/agent-src/skills/secrets-management/SKILL.md +148 -0
- package/dist/agent-src/skills/sentry-integration/SKILL.md +175 -0
- package/dist/agent-src/skills/song-to-script/SKILL.md +303 -0
- package/dist/agent-src/skills/sql-writing/SKILL.md +85 -0
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +356 -0
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +154 -0
- package/dist/agent-src/skills/tailwind-engineer/scripts/tailwind_config_gen.py +463 -0
- package/dist/agent-src/skills/technical-specification/SKILL.md +251 -0
- package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +164 -0
- package/dist/agent-src/skills/testing-anti-patterns/process-anti-patterns.md +67 -0
- package/dist/agent-src/skills/threat-modeling/SKILL.md +207 -0
- package/dist/agent-src/skills/threat-modeling/data/manifest.json +83 -0
- package/dist/agent-src/skills/threat-modeling/data/reasoning.csv +10 -0
- package/dist/agent-src/skills/threat-modeling/data/surfaces.csv +10 -0
- package/dist/agent-src/skills/threat-modeling/data/threats.csv +16 -0
- package/dist/agent-src/skills/token-optimizer/SKILL.md +115 -0
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +261 -0
- package/dist/agent-src/templates/AGENTS.md +34 -0
- package/dist/agent-src/templates/agents/.gitattributes.fragment +15 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +286 -0
- package/dist/agent-src/templates/agents/proposal.example.md +155 -0
- package/dist/agent-src/templates/command.md +105 -0
- package/dist/agent-src/templates/copilot-instructions.md +167 -0
- package/dist/agent-src/templates/github-workflows/proposal-drift.yml +118 -0
- package/dist/agent-src/templates/hooks/pre-commit-frontmatter +66 -0
- package/dist/agent-src/templates/hooks/pre-commit-roadmap-progress +99 -0
- package/dist/agent-src/templates/persona.md +99 -0
- package/dist/agent-src/templates/rule.md +135 -0
- package/dist/agent-src/templates/scripts/check_memory.py +282 -0
- package/dist/agent-src/templates/scripts/check_memory_proposal.py +180 -0
- package/dist/agent-src/templates/scripts/memory_lookup.py +436 -0
- package/dist/agent-src/templates/scripts/memory_report.py +314 -0
- package/dist/agent-src/templates/scripts/memory_signal.py +165 -0
- package/dist/agent-src/templates/scripts/memory_status.py +76 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/memory.py +136 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/_passthrough.py +44 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.py +513 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.py +471 -0
- package/dist/agent-src/templates/scripts/work_engine/orchestration.py +193 -0
- package/dist/agent-src/templates/scripts/work_engine/scoring/memory_visibility.py +283 -0
- package/dist/agent-src/templates/scripts/work_engine/stack/runner.py +481 -0
- package/dist/agent-src/user-types/README.md +124 -0
- package/dist/cli/agent-config.js +31 -252
- package/dist/cli/agent-config.js.map +1 -1
- package/dist/cli/commands/commands.js +157 -0
- package/dist/cli/commands/commands.js.map +1 -0
- package/dist/cli/commands/mcpServer.js +54 -0
- package/dist/cli/commands/mcpServer.js.map +1 -0
- package/dist/cli/commands/packs.js +1 -1
- package/dist/cli/commands/packs.js.map +1 -1
- package/dist/cli/commands/profiles.js +77 -0
- package/dist/cli/commands/profiles.js.map +1 -0
- package/dist/cli/commands/profiles.test.js +88 -0
- package/dist/cli/commands/profiles.test.js.map +1 -0
- package/dist/cli/commands/workspaces.js +1 -1
- package/dist/cli/commands/workspaces.js.map +1 -1
- package/dist/cli/discovery/loadManifest.js.map +1 -1
- package/dist/cli/main.js +309 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/mcp/content.js +127 -0
- package/dist/cli/mcp/content.js.map +1 -0
- package/dist/cli/mcp/content.test.js +54 -0
- package/dist/cli/mcp/content.test.js.map +1 -0
- package/dist/cli/mcp/dispatch.js +167 -0
- package/dist/cli/mcp/dispatch.js.map +1 -0
- package/dist/cli/mcp/dispatch.test.js +108 -0
- package/dist/cli/mcp/dispatch.test.js.map +1 -0
- package/dist/cli/mcp/stdio.js +69 -0
- package/dist/cli/mcp/stdio.js.map +1 -0
- package/dist/cli/paths.js +8 -2
- package/dist/cli/paths.js.map +1 -1
- package/dist/cli/registry.js +2 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +3231 -2099
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +11 -6
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +802 -467
- package/dist/discovery/trust-report.md +6 -6
- package/dist/discovery/workspaces.json +521 -478
- package/dist/install/detect.js +2 -2
- package/dist/install/detect.js.map +1 -1
- package/dist/install/wizard-plan.js +18 -18
- package/dist/install/wizard-plan.js.map +1 -1
- package/dist/mcp/registry-manifest.json +4 -4
- package/dist/router.json +1 -1
- package/dist/server/io/substituteTemplate.js +5 -5
- package/dist/server/io/substituteTemplate.js.map +1 -1
- package/dist/server/routes/settings.js +2 -2
- package/dist/server/routes/settings.js.map +1 -1
- package/dist/server/routes/userMd.js +1 -1
- package/dist/server/routes/userMd.js.map +1 -1
- package/dist/server/routes/wizard.js +31 -16
- package/dist/server/routes/wizard.js.map +1 -1
- package/dist/server/routes/workspace.js +556 -117
- package/dist/server/routes/workspace.js.map +1 -1
- package/dist/server/schemas/settings.js +25 -2
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/shared/userMd/formAdapter.js +2 -2
- package/dist/ui/assets/index-CoQo90sz.js +40 -0
- package/dist/ui/assets/index-CoQo90sz.js.map +1 -0
- package/dist/ui/index.html +1 -1
- package/docs/DISTRIBUTION_CHECKLIST.md +2 -2
- package/docs/MIGRATION.md +1 -1
- package/docs/adrs/cost/0001-hard-stop-hook.md +10 -10
- package/docs/adrs/memory/0001-consumer-side-snapshot.md +19 -11
- package/docs/adrs/memory/README.md +6 -5
- package/docs/adrs/router/0001-three-tier-routing.md +5 -5
- package/docs/adrs/schema/0001-json-schema-frontmatter.md +8 -8
- package/docs/adrs/smoke/0001-per-tier-smoke-scripts.md +11 -11
- package/docs/adrs/telegraph/0001-default-off-until-bench.md +3 -3
- package/docs/architecture/augment-projection.md +10 -10
- package/docs/architecture/claude-bundle.md +5 -5
- package/docs/architecture/current-onboard-baseline.md +4 -4
- package/docs/architecture/current-safety-behavior.md +16 -16
- package/docs/architecture/multi-tool-projection.md +8 -8
- package/docs/architecture/source-projection.md +11 -11
- package/docs/architecture.md +17 -17
- package/docs/archive/CHANGELOG-pre-2.17.0.md +1 -1
- package/docs/archive/CHANGELOG-pre-2.2.0.md +37 -37
- package/docs/archive/CHANGELOG-pre-2.20.0.md +1 -1
- package/docs/archive/CHANGELOG-pre-2.25.0.md +2 -2
- package/docs/archive/CHANGELOG-pre-2.7.0.md +1 -1
- package/docs/archive/CHANGELOG-pre-3.0.0.md +1 -1
- package/docs/archive/CHANGELOG-pre-3.1.0.md +1 -1
- package/docs/archive/CHANGELOG-pre-3.2.0.md +1 -1
- package/docs/archive/CHANGELOG-pre-4.5.0.md +2 -2
- package/docs/archive/CHANGELOG-pre-5.4.0.md +1 -1
- package/docs/archive/CHANGELOG-pre-5.9.0.md +1 -1
- package/docs/archive/CHANGELOG-pre-6.0.0.md +473 -0
- package/docs/artefact-census.md +71 -0
- package/docs/benchmark.md +54 -53
- package/docs/benchmarks.md +2 -2
- package/docs/case-studies/frontend-design-positioning.md +86 -0
- package/docs/catalog.md +472 -456
- package/docs/command-flows.md +230 -0
- package/docs/contracts/CHANGELOG-conventions.md +2 -2
- package/docs/contracts/STABILITY.md +1 -1
- package/docs/contracts/adoption-signal-floor.md +2 -2
- package/docs/contracts/adr-architectural-consensus-mechanism.md +1 -1
- package/docs/contracts/adr-chat-history-split.md +1 -1
- package/docs/contracts/adr-gtm-context-spine.md +2 -2
- package/docs/contracts/adr-install-user-type-axis.md +3 -3
- package/docs/contracts/adr-layout.md +5 -6
- package/docs/contracts/adr-level-6-productization.md +1 -1
- package/docs/contracts/adr-mcp-runtime.md +8 -8
- package/docs/contracts/adr-prompt-driven-execution.md +1 -1
- package/docs/contracts/adr-settings-sync-engine.md +3 -3
- package/docs/contracts/adr-user-types-axis.md +2 -2
- package/docs/contracts/adr-wing4-context-spine.md +2 -2
- package/docs/contracts/agent-user-schema.md +6 -6
- package/docs/contracts/agents-md-tech-stack.md +2 -2
- package/docs/contracts/ai-council-config.md +46 -11
- package/docs/contracts/at-rest-encryption.md +48 -7
- package/docs/contracts/audit-log-v1.md +3 -3
- package/docs/contracts/benchmark-ab-contract.md +6 -1
- package/docs/contracts/benchmark-corpus-spec.md +2 -2
- package/docs/contracts/benchmark-report-schema.md +4 -4
- package/docs/contracts/branch-protection-policy.md +5 -0
- package/docs/contracts/capability-packs.md +217 -0
- package/docs/contracts/ci-cost-budget.md +6 -1
- package/docs/contracts/ci-green-floor.md +1 -1
- package/docs/contracts/command-category-governance.md +79 -0
- package/docs/contracts/command-clusters.md +43 -5
- package/docs/contracts/config-presets.md +1 -1
- package/docs/contracts/cost-dashboard.md +1 -1
- package/docs/contracts/cost-enforcement.md +1 -1
- package/docs/contracts/cost-profile-defaults.md +2 -2
- package/docs/contracts/cost-summary-schema.md +5 -5
- package/docs/contracts/creative-pack-boundary.md +58 -0
- package/docs/contracts/daily-workspace.md +9 -3
- package/docs/contracts/discovery-manifest.md +5 -5
- package/docs/contracts/discovery-manifest.schema.json +16 -3
- package/docs/contracts/evidence-based-pruning.md +101 -0
- package/docs/contracts/explain-modes.md +38 -1
- package/docs/contracts/file-ownership-matrix.json +1804 -4620
- package/docs/contracts/frontmatter-contract.md +6 -6
- package/docs/contracts/ghostwriter-schema.md +1 -1
- package/docs/contracts/gui-wizard.md +1 -1
- package/docs/contracts/harness-expectations.md +5 -0
- package/docs/contracts/hook-architecture-v1.md +1 -1
- package/docs/contracts/host-agent-protocol.md +19 -1
- package/docs/contracts/implement-ticket-flow.md +6 -7
- package/docs/contracts/install-scopes.md +7 -2
- package/docs/contracts/installed-tools-lockfile.md +2 -2
- package/docs/contracts/linear-ai-rules-inclusion.md +2 -2
- package/docs/contracts/linear-ai-three-layers.md +1 -1
- package/docs/contracts/linter-structural-model.md +2 -2
- package/docs/contracts/load-context-budget-model.md +1 -1
- package/docs/contracts/load-context-schema.md +1 -1
- package/docs/contracts/local-analytics.md +9 -1
- package/docs/contracts/low-impact-corpus-format.md +1 -1
- package/docs/contracts/mcp-cloud-scope.md +6 -6
- package/docs/contracts/mcp-phase-1-scope.md +5 -5
- package/docs/contracts/mcp-tool-inventory.md +10 -10
- package/docs/contracts/measurement-baseline.md +6 -6
- package/docs/contracts/memory-visibility-v1.md +1 -5
- package/docs/contracts/migrate-command.md +44 -8
- package/docs/contracts/multi-tool-projection-fidelity.md +3 -3
- package/docs/contracts/namespace.md +2 -2
- package/docs/contracts/orchestration-dsl-v1.md +2 -2
- package/docs/contracts/package-self-orientation.md +17 -17
- package/docs/contracts/persona-schema.md +1 -1
- package/docs/contracts/pilot/language-and-tone.md +1 -1
- package/docs/contracts/plain-language-surface.md +2 -2
- package/docs/contracts/profile-system.md +26 -1
- package/docs/contracts/provider-lifecycle.md +3 -3
- package/docs/contracts/release-pr-gating.md +5 -0
- package/docs/contracts/release-trunk-sync.md +3 -3
- package/docs/contracts/review-lens-schema.md +59 -0
- package/docs/contracts/role-experience.md +10 -6
- package/docs/contracts/router-blending.md +2 -2
- package/docs/contracts/rule-classification.md +1 -1
- package/docs/contracts/rule-interactions.md +1 -1
- package/docs/contracts/rule-router.md +3 -3
- package/docs/contracts/safety-model.md +2 -2
- package/docs/contracts/session-profile-overlay.md +40 -3
- package/docs/contracts/settings-api.md +3 -3
- package/docs/contracts/settings-sync-yaml-subset.md +4 -4
- package/docs/contracts/skill-bundled-assets.md +62 -0
- package/docs/contracts/skill-discovery.md +1 -1
- package/docs/contracts/skill-distribution-channels.md +6 -1
- package/docs/contracts/skill-dry-run.md +2 -2
- package/docs/contracts/skill-family-map.yml +915 -0
- package/docs/contracts/smoke-contracts.md +5 -5
- package/docs/contracts/telegraph-telemetry.md +2 -2
- package/docs/contracts/trust-and-safety.md +3 -3
- package/docs/contracts/universal-skills.md +16 -17
- package/docs/contracts/value-dashboard-spec.md +21 -21
- package/docs/contracts/value-report-schema.md +8 -8
- package/docs/contracts/workspace-boundary.md +84 -0
- package/docs/customization.md +11 -11
- package/docs/decisions/ADR-006-skill-tools-python-pilot.md +2 -2
- package/docs/decisions/ADR-007-agent-discovery-scopes.md +1 -1
- package/docs/decisions/ADR-008-installed-tools-manifest.md +1 -1
- package/docs/decisions/ADR-009-event4u-namespace.md +4 -4
- package/docs/decisions/ADR-013-discovery-frontmatter-contract.md +27 -8
- package/docs/decisions/ADR-015-discovery-manifest-contract.md +5 -5
- package/docs/decisions/ADR-017-monorepo-physical-layout.md +5 -5
- package/docs/decisions/ADR-018-trust-and-safety-layer.md +2 -2
- package/docs/decisions/ADR-019-router-json-dist-location.md +2 -2
- package/docs/decisions/ADR-020-global-only-consumer-scope.md +27 -2
- package/docs/decisions/ADR-022-daily-workspace-decomposition.md +2 -2
- package/docs/decisions/ADR-024-workspace-v0-feature-floor.md +1 -1
- package/docs/decisions/ADR-026-explain-mode-translation.md +1 -1
- package/docs/decisions/ADR-028-root-layout.md +1 -1
- package/docs/decisions/ADR-030-claude-code-command-projection.md +2 -2
- package/docs/decisions/ADR-038-canonical-settings-path.md +20 -0
- package/docs/decisions/ADR-041-controlled-command-verbs.md +133 -0
- package/docs/decisions/ADR-042-runtime-resolver-decision-gate.md +113 -0
- package/docs/decisions/ADR-043-monorepo-collapse-to-src-domains.md +128 -0
- package/docs/decisions/ADR-044-command-naming-scheme-hyphenated.md +250 -0
- package/docs/decisions/ADR-045-src-source-layout-and-profiles-as-views.md +111 -0
- package/docs/decisions/ADR-046-thin-command-principle.md +93 -0
- package/docs/decisions/ADR-047-framework-neutral-stack-adaptive-commands.md +94 -0
- package/docs/decisions/ADR-048-command-justification-rule.md +106 -0
- package/docs/decisions/ADR-049-configuration-trust-boundary.md +114 -0
- package/docs/decisions/ADR-050-workspace-vs-package-root-boundary.md +121 -0
- package/docs/decisions/ADR-051-uncondensed-source-container-relocation.md +114 -0
- package/docs/decisions/ADR-052-packages-removal-and-pack-home-migration.md +86 -0
- package/docs/decisions/ADR-053-agents-namespace-dual-role-resolution.md +132 -0
- package/docs/decisions/ADR-054-rule-adherence-decay-triggered-restate.md +143 -0
- package/docs/decisions/ADR-055-flow-layer-data-model.md +235 -0
- package/docs/decisions/ADR-056-unvalidated-video-adapters-disposition.md +124 -0
- package/docs/decisions/ADR-057-consolidation-evidence-gate-outcomes.md +135 -0
- package/docs/decisions/ADR-058-condensed-output-relocation-to-dist.md +94 -0
- package/docs/decisions/ADR-059-render-resume-filesystem-as-state.md +161 -0
- package/docs/decisions/ADR-060-comfyui-sandbox-model.md +154 -0
- package/docs/decisions/ADR-061-corpus-grounding-layer.md +170 -0
- package/docs/decisions/ADR-062-encrypt-at-rest-store-architecture.md +121 -0
- package/docs/decisions/ADR-063-append-jsonl-encryption-deferred.md +83 -0
- package/docs/decisions/ADR-064-append-jsonl-per-record-encryption.md +113 -0
- package/docs/decisions/ADR-065-tier3-inbox-handoff-v0.md +86 -0
- package/docs/decisions/ADR-066-skill-body-prerendering.md +93 -0
- package/docs/decisions/ADR-067-glama-registry-listing.md +259 -0
- package/docs/decisions/ADR-068-host-tier-detection.md +90 -0
- package/docs/decisions/ADR-069-prompt-renderer.md +97 -0
- package/docs/decisions/ADR-070-tier1-drive-loop.md +94 -0
- package/docs/decisions/ADR-071-launch-drive-integration.md +95 -0
- package/docs/decisions/ADR-072-codex-gemini-drive-configs.md +90 -0
- package/docs/decisions/ADR-073-drive-health-kill-switch.md +81 -0
- package/docs/decisions/ADR-074-drive-kill-switch-auto-recovery.md +84 -0
- package/docs/decisions/ADR-075-workspace-gui-drive.md +83 -0
- package/docs/decisions/ADR-076-workspace-multi-turn.md +92 -0
- package/docs/decisions/ADR-077-workspace-followup-gui.md +70 -0
- package/docs/decisions/ADR-078-drive-health-panel.md +70 -0
- package/docs/decisions/ADR-079-workspace-host-picker.md +81 -0
- package/docs/decisions/ADR-080-host-session-expired-410.md +92 -0
- package/docs/decisions/ADR-081-drive-health-reset-and-410-affordance.md +71 -0
- package/docs/decisions/ADR-082-410-one-click-relaunch.md +58 -0
- package/docs/decisions/ADR-083-session-thread-and-arbitrary-continuation.md +85 -0
- package/docs/decisions/ADR-084-drive-health-refresh-on-drive.md +52 -0
- package/docs/decisions/ADR-085-mcp-stdio-end-user-distribution-shape.md +158 -0
- package/docs/decisions/ADR-086-read-only-cross-agent-mcp-discovery-helper.md +171 -0
- package/docs/decisions/ADR-087-installer-e2e-test-strategy.md +111 -0
- package/docs/decisions/ADR-088-no-external-runtime-federation.md +144 -0
- package/docs/decisions/ADR-089-lean-local-plugin-install.md +111 -0
- package/docs/decisions/ADR-090-visibility-command-frontmatter-field.md +95 -0
- package/docs/decisions/ADR-091-split-meta-capability-packs.md +113 -0
- package/docs/decisions/ADR-092-defer-command-tier-alias-removal.md +93 -0
- package/docs/decisions/ADR-093-ai-council-config-user-global.md +111 -0
- package/docs/decisions/ADR-094-agent-memory-layer-removal.md +94 -0
- package/docs/decisions/ADR-095-workspace-boundary-contract.md +108 -0
- package/docs/decisions/INDEX.md +55 -0
- package/docs/deploy/small-team-recipe.md +1 -1
- package/docs/deploy/team-deployment-posture.md +1 -1
- package/docs/development.md +9 -11
- package/docs/distribution/public-install-smoke.md +1 -1
- package/docs/distribution/registries.md +5 -5
- package/docs/distribution/registry-submissions.md +2 -2
- package/docs/end-to-end-walkthroughs.md +10 -10
- package/docs/experiences/agency.md +49 -0
- package/docs/experiences/content_creator.md +47 -0
- package/docs/experiences/developer.md +49 -0
- package/docs/experiences/finance.md +48 -0
- package/docs/experiences/founder.md +47 -0
- package/docs/experiences/ops.md +47 -0
- package/docs/featured-commands.md +12 -12
- package/docs/featured-skills.md +32 -32
- package/docs/flows.md +67 -0
- package/docs/getting-started-by-role.md +41 -41
- package/docs/getting-started-laravel.md +26 -26
- package/docs/getting-started-local-stdio.md +77 -0
- package/docs/getting-started.md +5 -5
- package/docs/governance.md +96 -0
- package/docs/guidelines/agent-infra/5w2h-analysis.md +1 -1
- package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +6 -6
- package/docs/guidelines/agent-infra/comparison-matrix.md +179 -0
- package/docs/guidelines/agent-infra/corpus-grounding-authoring.md +91 -0
- package/docs/guidelines/agent-infra/critical-thinking.md +1 -1
- package/docs/guidelines/agent-infra/direct-answers-demos.md +23 -26
- package/docs/guidelines/agent-infra/engineering-memory-data-format.md +1 -5
- package/docs/guidelines/agent-infra/first-principles.md +1 -1
- package/docs/guidelines/agent-infra/frontier-reasoning-operating-profile.md +164 -0
- package/docs/guidelines/agent-infra/inversion-thinking.md +1 -1
- package/docs/guidelines/agent-infra/ios-simulator-guide.md +9 -14
- package/docs/guidelines/agent-infra/language-and-tone-examples.md +29 -2
- package/docs/guidelines/agent-infra/layered-settings.md +3 -3
- package/docs/guidelines/agent-infra/linked-projects-onboarding-gate.md +80 -0
- package/docs/guidelines/agent-infra/mcp-request-signing.md +19 -22
- package/docs/guidelines/agent-infra/memory-access.md +25 -31
- package/docs/guidelines/agent-infra/mental-models.md +1 -1
- package/docs/guidelines/agent-infra/missing-tool-handling.md +66 -0
- package/docs/guidelines/agent-infra/model-recommendation.md +101 -0
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/scqa-framework.md +3 -3
- package/docs/guidelines/agent-infra/security-lint-containment.md +81 -0
- package/docs/guidelines/agent-infra/self-improvement-pipeline.md +1 -1
- package/docs/guidelines/agent-infra/six-hats.md +1 -1
- package/docs/guidelines/agent-infra/systems-thinking.md +1 -1
- package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +72 -0
- package/docs/guidelines/agent-infra/verify-before-complete-demos.md +1 -1
- package/docs/guidelines/augment-portability-patterns.md +1 -1
- package/docs/guides/local-analytics.md +1 -1
- package/docs/guides/local-knowledge.md +3 -3
- package/docs/hook-payload-capture.md +5 -5
- package/docs/installation.md +4 -4
- package/docs/mcp-registries.md +94 -0
- package/docs/mcp-server.md +4 -4
- package/docs/mcp.md +5 -2
- package/docs/parity/bench-external.json +58 -0
- package/docs/parity/external-runtime.md +46 -0
- package/docs/personas.md +3 -3
- package/docs/profiles.md +15 -11
- package/docs/quality.md +4 -4
- package/docs/safety.md +3 -3
- package/docs/setup/mcp-client-config.md +134 -9
- package/docs/setup/mcp-server-docker.md +9 -7
- package/docs/setup/per-ide/claude-code.md +3 -3
- package/docs/setup/per-ide/claude-desktop.md +1 -1
- package/docs/setup/per-ide/cursor.md +2 -2
- package/docs/setup/per-ide/windsurf.md +1 -1
- package/docs/showcase.md +12 -12
- package/docs/skill-duplication-findings.md +91 -0
- package/docs/skills-catalog.md +231 -224
- package/docs/skills-taxonomy.md +90 -0
- package/docs/ui-track-mental-model.md +2 -2
- package/docs/value.md +50 -50
- package/docs/walkthroughs/assets/workspace-role-grid.png +0 -0
- package/docs/walkthroughs/assets/workspace-session-started.png +0 -0
- package/docs/walkthroughs/assets/workspace-task-picker.png +0 -0
- package/docs/walkthroughs/daily-workspace.md +127 -0
- package/llms.txt +21 -14
- package/package.json +10 -9
- package/src/config/agent-settings.template.yml +674 -0
- package/src/config/discovery/command-verbs.yml +56 -0
- package/src/config/discovery/packs.yml +284 -0
- package/src/config/discovery/workspaces.yml +74 -0
- package/src/config/gitignore-block.txt +94 -0
- package/src/scripts/__pycache__/validate_frontmatter.cpython-312.pyc +0 -0
- package/src/scripts/_archive/README.md +59 -0
- package/src/scripts/_archive/_bootstrap_tier_frontmatter.py +151 -0
- package/src/scripts/_archive/_p43_bodies.py +235 -0
- package/src/scripts/_archive/_p43_condense.py +118 -0
- package/src/scripts/_archive/_p4_migrate.py +199 -0
- package/src/scripts/_cli/cmd_doctor.py +1669 -0
- package/src/scripts/_cli/cmd_export.py +157 -0
- package/src/scripts/_cli/cmd_migrate.py +524 -0
- package/src/scripts/_cli/cmd_refresh.py +179 -0
- package/src/scripts/_cli/cmd_settings_migrate.py +147 -0
- package/src/scripts/_cli/cmd_update.py +279 -0
- package/src/scripts/_cli/cmd_upgrade.py +172 -0
- package/src/scripts/_cli/cmd_versions.py +160 -0
- package/src/scripts/_dispatch.bash +1129 -0
- package/src/scripts/_lib/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/scripts/_lib/__pycache__/agent_src.cpython-312.pyc +0 -0
- package/src/scripts/_lib/agent_src.py +491 -0
- package/src/scripts/_lib/bench_ab_cache.py +162 -0
- package/src/scripts/_lib/bench_ab_scoring_v2.py +227 -0
- package/src/scripts/_lib/changelog_eras.py +330 -0
- package/src/scripts/_lib/claude_desktop_bundler.py +238 -0
- package/src/scripts/_lib/cli_wrapper.py +64 -0
- package/src/scripts/_lib/global_deploy_inventory.py +312 -0
- package/src/scripts/_lib/install_regenerator.py +134 -0
- package/src/scripts/_lib/installed_lock.py +256 -0
- package/src/scripts/_lib/link_crypto.py +206 -0
- package/src/scripts/_lib/model_tier.py +52 -0
- package/src/scripts/_lib/scope_guard.sh +163 -0
- package/src/scripts/_lib/security_lint.py +228 -0
- package/src/scripts/_lib/value_ladder.py +696 -0
- package/src/scripts/_lib/value_report.py +455 -0
- package/src/scripts/_phase4_bucket.py +210 -0
- package/src/scripts/_pilot_measure.py +53 -0
- package/src/scripts/adoption_report.py +195 -0
- package/src/scripts/adoption_snapshot.py +219 -0
- package/src/scripts/adoption_status.py +166 -0
- package/src/scripts/agent-config +57 -0
- package/src/scripts/ai-video/adapters/comfyui.sh +392 -0
- package/src/scripts/ai-video/adapters/fal.sh +311 -0
- package/src/scripts/ai-video/adapters/gemini-veo.sh +246 -0
- package/src/scripts/ai-video/adapters/higgsfield.sh +310 -0
- package/src/scripts/ai-video/adapters/kling.sh +248 -0
- package/src/scripts/ai-video/adapters/musetalk.sh +120 -0
- package/src/scripts/ai-video/adapters/openai-images.sh +147 -0
- package/src/scripts/ai-video/adapters/replicate.sh +289 -0
- package/src/scripts/ai-video/adapters/sora.sh +207 -0
- package/src/scripts/ai-video/adapters/syncso.sh +200 -0
- package/src/scripts/ai-video/audio-adapters/allin1.sh +115 -0
- package/src/scripts/ai-video/audio-adapters/whisperx.sh +128 -0
- package/src/scripts/ai-video/lib/adapter-common.sh +231 -0
- package/src/scripts/ai-video/lib/adapter-contract.md +329 -0
- package/src/scripts/ai-video/lib/audio-adapter-contract.md +210 -0
- package/src/scripts/ai-video/lib/comfyui-nodes.allowlist.json +21 -0
- package/src/scripts/ai-video/lib/comfyui-templates/ltx-2.json +79 -0
- package/src/scripts/ai-video/lib/comfyui-templates/wan22-ti2v-5b.json +78 -0
- package/src/scripts/ai-video/lib/embed-provenance.sh +194 -0
- package/src/scripts/ai-video/lib/fixtures/allin1/analysis.json +13 -0
- package/src/scripts/ai-video/lib/fixtures/comfyui/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/fal/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/fal/scene-0001.mp4 +1 -0
- package/src/scripts/ai-video/lib/fixtures/gemini-veo/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/higgsfield/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/kling/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/kling/scene-0001.mp4 +1 -0
- package/src/scripts/ai-video/lib/fixtures/musetalk/lipsync-0001.mp4 +1 -0
- package/src/scripts/ai-video/lib/fixtures/musetalk/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/openai-images/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/replicate/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/replicate/scene-0001.mp4 +1 -0
- package/src/scripts/ai-video/lib/fixtures/sora/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/syncso/lipsync-0001.mp4 +1 -0
- package/src/scripts/ai-video/lib/fixtures/syncso/result.json +1 -0
- package/src/scripts/ai-video/lib/fixtures/whisperx/transcript.json +26 -0
- package/src/scripts/ai-video/lib/ingest-song.sh +89 -0
- package/src/scripts/ai-video/lib/load-config.sh +180 -0
- package/src/scripts/ai-video/lib/model-capabilities/README.md +82 -0
- package/src/scripts/ai-video/lib/model-capabilities/comfyui.json +31 -0
- package/src/scripts/ai-video/lib/model-capabilities/fal.json +77 -0
- package/src/scripts/ai-video/lib/model-capabilities/musetalk.json +24 -0
- package/src/scripts/ai-video/lib/model-capabilities/replicate.json +82 -0
- package/src/scripts/ai-video/lib/model-capabilities/syncso.json +23 -0
- package/src/scripts/ai-video/lib/resume-scan.sh +212 -0
- package/src/scripts/ai-video/lib/telemetry.sh +115 -0
- package/src/scripts/ai-video/lib/validate-deps.sh +132 -0
- package/src/scripts/ai-video/lib/validate-vocal-map.sh +121 -0
- package/src/scripts/ai-video/smoke-trace.sh +179 -0
- package/src/scripts/ai-video/stitch.sh +161 -0
- package/src/scripts/ai-video/test-pipeline.sh +169 -0
- package/src/scripts/ai_council/advisors.py +148 -0
- package/src/scripts/ai_council/clients.py +1385 -0
- package/src/scripts/ai_council/compile_corpus.py +179 -0
- package/src/scripts/ai_council/config.py +1419 -0
- package/src/scripts/ai_council/events_log.py +141 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_2a4_acceptance.py +208 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_budget_v2_audit.py +206 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_context_layer_v1_estimate.py +67 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_context_layer_v1_review.py +292 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_followups_review.py +259 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_nondestructive_inline_audit.py +209 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_phase4_dispatch_latency.py +108 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_phase6_trigger_jaccard.py +92 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_phase_2a_budget_rebalance.py +257 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_phase_2a_post_revert.py +197 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_rebalancing_audit.py +149 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_roundtrip.py +111 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_rule_hardening_v1.py +251 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_silent_taskfiles.py +98 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_structural_open_questions.py +232 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_structural_optimization.py +144 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_structural_v3_gaps.py +252 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_structural_v3_review.py +240 -0
- package/src/scripts/ai_council/one_off_archive/2026-05/_one_off_tier_retrofit.py +180 -0
- package/src/scripts/ai_council/pricing.py +215 -0
- package/src/scripts/ai_council/session.py +366 -0
- package/src/scripts/annotate_discovery.py +149 -0
- package/src/scripts/apply_modules_config.py +290 -0
- package/src/scripts/audit_adr_coverage.py +173 -0
- package/src/scripts/audit_auto_rules.py +175 -0
- package/src/scripts/audit_cloud_compatibility.py +362 -0
- package/src/scripts/audit_command_surface.py +682 -0
- package/src/scripts/audit_initial_context.py +237 -0
- package/src/scripts/audit_likelihood.py +148 -0
- package/src/scripts/audit_mcp_tools.py +146 -0
- package/src/scripts/audit_overlap.py +145 -0
- package/src/scripts/audit_skill_descriptions.py +180 -0
- package/src/scripts/audit_skill_overlap.py +207 -0
- package/src/scripts/audit_user_type_axis.py +140 -0
- package/src/scripts/backfill_model_tier.py +184 -0
- package/src/scripts/bench_ab_cache_dispatch.py +68 -0
- package/src/scripts/bench_ab_clone.py +220 -0
- package/src/scripts/bench_ab_diff.py +220 -0
- package/src/scripts/bench_ab_integrity.py +143 -0
- package/src/scripts/bench_ab_run.py +235 -0
- package/src/scripts/bench_ab_task_runner.py +814 -0
- package/src/scripts/bench_ab_tracka_run.py +202 -0
- package/src/scripts/bench_ab_v2_run.py +247 -0
- package/src/scripts/bench_ab_v2_stats.py +347 -0
- package/src/scripts/bench_baseline_ready.py +108 -0
- package/src/scripts/bench_condense_memory.py +168 -0
- package/src/scripts/bench_drift_check.py +151 -0
- package/src/scripts/bench_per_tool.py +216 -0
- package/src/scripts/bench_rtk_savings.py +320 -0
- package/src/scripts/bench_run.py +272 -0
- package/src/scripts/bench_runner.py +158 -0
- package/src/scripts/build_cloud_bundle.py +458 -0
- package/src/scripts/build_discovery_manifest.py +757 -0
- package/src/scripts/build_linear_digest.py +260 -0
- package/src/scripts/build_mcp_registry_manifest.py +181 -0
- package/src/scripts/build_rule_trigger_matrix.py +350 -0
- package/src/scripts/capture_showcase_session.py +361 -0
- package/src/scripts/check_always_budget.py +532 -0
- package/src/scripts/check_artefact_checksums.py +111 -0
- package/src/scripts/check_augment_description_cap.py +79 -0
- package/src/scripts/check_augmentignore.py +72 -0
- package/src/scripts/check_beta_review_markers.py +127 -0
- package/src/scripts/check_bite_sized_granularity.py +98 -0
- package/src/scripts/check_cluster_patterns.py +206 -0
- package/src/scripts/check_command_count_messaging.py +152 -0
- package/src/scripts/check_condensation.py +375 -0
- package/src/scripts/check_condensed_paths.py +231 -0
- package/src/scripts/check_context_paths.py +202 -0
- package/src/scripts/check_council_references.py +228 -0
- package/src/scripts/check_discovery_determinism.py +70 -0
- package/src/scripts/check_gate_paths.py +128 -0
- package/src/scripts/check_memory.py +429 -0
- package/src/scripts/check_memory_proposal.py +182 -0
- package/src/scripts/check_module_management_neutral.py +147 -0
- package/src/scripts/check_no_external_sources.py +101 -0
- package/src/scripts/check_no_new_legacy_path.py +100 -0
- package/src/scripts/check_no_roadmap_refs.py +155 -0
- package/src/scripts/check_one_off_location.py +81 -0
- package/src/scripts/check_overlay_cascade_subdirs.py +129 -0
- package/src/scripts/check_portability.py +574 -0
- package/src/scripts/check_public_catalog_links.py +125 -0
- package/src/scripts/check_public_links.py +185 -0
- package/src/scripts/check_references.py +559 -0
- package/src/scripts/check_release_includes_discovery.py +61 -0
- package/src/scripts/check_release_pr_shape.py +123 -0
- package/src/scripts/check_release_published.py +145 -0
- package/src/scripts/check_reply_consistency.py +169 -0
- package/src/scripts/check_roadmap_trackable.py +114 -0
- package/src/scripts/check_role_doc_links.py +110 -0
- package/src/scripts/check_safety_floor_untouched.py +125 -0
- package/src/scripts/check_skill_requires.py +147 -0
- package/src/scripts/check_template_pin_drift.py +129 -0
- package/src/scripts/check_test_coverage_diff.py +180 -0
- package/src/scripts/check_token_optimizer_freshness.py +146 -0
- package/src/scripts/check_update_banner.py +86 -0
- package/src/scripts/ci_time_ratio.py +168 -0
- package/src/scripts/compile_router.py +232 -0
- package/src/scripts/condense.py +1919 -0
- package/src/scripts/condense_memory.py +178 -0
- package/src/scripts/config/packs.py +157 -0
- package/src/scripts/config/profile_explain.py +89 -0
- package/src/scripts/config/profiles.py +191 -0
- package/src/scripts/config/session_profiles.py +542 -0
- package/src/scripts/cost_by_conversation.py +78 -0
- package/src/scripts/cost_summary.py +97 -0
- package/src/scripts/council_cli.py +2571 -0
- package/src/scripts/cross_repo_retrieve.py +172 -0
- package/src/scripts/discovery_stats.py +70 -0
- package/src/scripts/external_sources_denylist.json +91 -0
- package/src/scripts/extract_audit_patterns.py +202 -0
- package/src/scripts/first_run_gate_hook.py +179 -0
- package/src/scripts/gen_discovery_baseline.py +127 -0
- package/src/scripts/generate_catalog.py +116 -0
- package/src/scripts/generate_command_flows.py +191 -0
- package/src/scripts/generate_index.py +303 -0
- package/src/scripts/generate_ownership_matrix.py +378 -0
- package/src/scripts/generate_pack_manifests.py +340 -0
- package/src/scripts/hook_manifest.yaml +251 -0
- package/src/scripts/hooks/dispatch_hook.py +461 -0
- package/src/scripts/hooks/replay_hook.py +144 -0
- package/src/scripts/hooks_doctor.py +223 -0
- package/src/scripts/hooks_status.py +157 -0
- package/src/scripts/injection_scan_hook.py +145 -0
- package/src/scripts/install +425 -0
- package/src/scripts/install-hooks.sh +215 -0
- package/src/scripts/install.py +5258 -0
- package/src/scripts/install.sh +1156 -0
- package/src/scripts/inventory_abstraction_budget.py +622 -0
- package/src/scripts/inventory_frontmatter.py +164 -0
- package/src/scripts/inventory_meta_layers.py +288 -0
- package/src/scripts/iron_law_sha.py +107 -0
- package/src/scripts/linked_projects_list.py +91 -0
- package/src/scripts/lint_agent_security.py +112 -0
- package/src/scripts/lint_agent_skill_names.py +150 -0
- package/src/scripts/lint_agents_layout.py +197 -0
- package/src/scripts/lint_agents_md.py +210 -0
- package/src/scripts/lint_archived_skills.py +159 -0
- package/src/scripts/lint_artefact_frontmatter.py +188 -0
- package/src/scripts/lint_bench_ab.py +173 -0
- package/src/scripts/lint_bench_corpus.py +255 -0
- package/src/scripts/lint_command_flow_coverage.py +132 -0
- package/src/scripts/lint_command_routing.py +160 -0
- package/src/scripts/lint_command_tiers.py +216 -0
- package/src/scripts/lint_command_verbs.py +206 -0
- package/src/scripts/lint_commit_subjects.py +139 -0
- package/src/scripts/lint_context_spine_usage.py +137 -0
- package/src/scripts/lint_discovery_manifest.py +176 -0
- package/src/scripts/lint_discovery_vocabulary.py +222 -0
- package/src/scripts/lint_empty_roadmaps.py +80 -0
- package/src/scripts/lint_examples.py +102 -0
- package/src/scripts/lint_explain_trace.py +80 -0
- package/src/scripts/lint_featured_skills.py +144 -0
- package/src/scripts/lint_flows.py +215 -0
- package/src/scripts/lint_framework_leakage.py +375 -0
- package/src/scripts/lint_framework_leakage_allowlist.json +575 -0
- package/src/scripts/lint_frontmatter_boilerplate.py +77 -0
- package/src/scripts/lint_ghostwriter_source.py +242 -0
- package/src/scripts/lint_handoffs.py +217 -0
- package/src/scripts/lint_hidden_unicode.py +132 -0
- package/src/scripts/lint_hook_concern_budget.py +207 -0
- package/src/scripts/lint_hook_manifest.py +217 -0
- package/src/scripts/lint_instruction_smuggling.py +107 -0
- package/src/scripts/lint_load_context.py +196 -0
- package/src/scripts/lint_marketplace.py +180 -0
- package/src/scripts/lint_marketplace_install_completeness.py +198 -0
- package/src/scripts/lint_mcp_config_security.py +124 -0
- package/src/scripts/lint_mcp_registry_manifest.py +69 -0
- package/src/scripts/lint_media_policy_linkage.py +140 -0
- package/src/scripts/lint_model_tier_coverage.py +73 -0
- package/src/scripts/lint_namespace.py +135 -0
- package/src/scripts/lint_namespace_collisions.py +103 -0
- package/src/scripts/lint_new_skill_gate.py +144 -0
- package/src/scripts/lint_no_new_atomic_commands.py +180 -0
- package/src/scripts/lint_one_off_age.py +184 -0
- package/src/scripts/lint_orchestration_dsl.py +217 -0
- package/src/scripts/lint_orchestrator_auto_detect.py +111 -0
- package/src/scripts/lint_pack_boundaries.py +147 -0
- package/src/scripts/lint_pack_dependencies.py +137 -0
- package/src/scripts/lint_pack_first_win.py +121 -0
- package/src/scripts/lint_persona_governance.py +164 -0
- package/src/scripts/lint_positioning.py +143 -0
- package/src/scripts/lint_profile_overlay_set_only.py +179 -0
- package/src/scripts/lint_regression.py +251 -0
- package/src/scripts/lint_roadmap_ci_steps.py +186 -0
- package/src/scripts/lint_roadmap_complexity.py +220 -0
- package/src/scripts/lint_role_experiences.py +255 -0
- package/src/scripts/lint_rule_interactions.py +170 -0
- package/src/scripts/lint_rule_tiers.py +90 -0
- package/src/scripts/lint_showcase_sessions.py +148 -0
- package/src/scripts/lint_skill_frontmatter_safety.py +144 -0
- package/src/scripts/lint_skill_tools.py +168 -0
- package/src/scripts/lint_topics_yaml.py +89 -0
- package/src/scripts/lint_trust_coherence.py +212 -0
- package/src/scripts/lint_value_dashboard.py +218 -0
- package/src/scripts/lint_workspace_boundary.py +122 -0
- package/src/scripts/mcp_parity_smoke.py +316 -0
- package/src/scripts/mcp_registry_submit.sh +187 -0
- package/src/scripts/mcp_server/__init__.py +19 -0
- package/src/scripts/mcp_server/consumer_tool_catalog.json +275 -0
- package/src/scripts/mcp_server/prompts.py +442 -0
- package/src/scripts/mcp_server/resources.py +201 -0
- package/src/scripts/mcp_server/tools.py +926 -0
- package/src/scripts/measure_augment_budget.py +214 -0
- package/src/scripts/measure_density.py +232 -0
- package/src/scripts/measure_frugality_savings.py +164 -0
- package/src/scripts/measure_markitdown_lift.py +127 -0
- package/src/scripts/measure_patterns.py +376 -0
- package/src/scripts/measure_projection_bytes.py +159 -0
- package/src/scripts/measure_rule_budget.py +347 -0
- package/src/scripts/measure_skill_reduction.py +102 -0
- package/src/scripts/memory_lookup.py +436 -0
- package/src/scripts/memory_report.py +314 -0
- package/src/scripts/memory_signal.py +165 -0
- package/src/scripts/memory_status.py +76 -0
- package/src/scripts/migrate_command_suggestions.py +151 -0
- package/src/scripts/migrate_frontmatter_defaults.py +245 -0
- package/src/scripts/mine_session.py +356 -0
- package/src/scripts/move_artefact.py +143 -0
- package/src/scripts/new_skill.py +148 -0
- package/src/scripts/pack_dependency_allowlist.json +70 -0
- package/src/scripts/pack_mcp_content.py +293 -0
- package/src/scripts/plan_physical_move.py +353 -0
- package/src/scripts/print_required_checks.py +196 -0
- package/src/scripts/probe_projection_fidelity.py +202 -0
- package/src/scripts/profile_staleness_hook.py +69 -0
- package/src/scripts/profile_use.py +164 -0
- package/src/scripts/project_thin_rules.py +168 -0
- package/src/scripts/prototype_lint_contradictions.py +150 -0
- package/src/scripts/prove_pack_extractable.py +187 -0
- package/src/scripts/recruit_preflight.sh +152 -0
- package/src/scripts/refine_ticket_detect.py +646 -0
- package/src/scripts/release.py +1091 -0
- package/src/scripts/render_benchmark_md.py +401 -0
- package/src/scripts/render_value_md.py +347 -0
- package/src/scripts/repro/repro_marketplace_install_gap.sh +161 -0
- package/src/scripts/roadmap_progress_hook.py +274 -0
- package/src/scripts/router_telemetry.py +470 -0
- package/src/scripts/run_skill_evals.py +185 -0
- package/src/scripts/runtime_registry.py +166 -0
- package/src/scripts/schemas/command.schema.json +224 -0
- package/src/scripts/schemas/flow.schema.json +59 -0
- package/src/scripts/schemas/pack.schema.json +95 -0
- package/src/scripts/schemas/rule.schema.json +145 -0
- package/src/scripts/score_skill_selection.py +198 -0
- package/src/scripts/security_audit_config.py +153 -0
- package/src/scripts/skill_collision_clusters.py +162 -0
- package/src/scripts/skill_discovery.py +254 -0
- package/src/scripts/skill_linter.py +3694 -0
- package/src/scripts/skill_overlap.py +204 -0
- package/src/scripts/skill_preview.py +179 -0
- package/src/scripts/skill_tools/audit_persona_coverage.py +147 -0
- package/src/scripts/skill_tools/audit_user_type_coverage.py +148 -0
- package/src/scripts/skill_tools/run_block_d_eval.py +129 -0
- package/src/scripts/skill_tools/score_skill_relevance.py +169 -0
- package/src/scripts/skill_tools/suggest_skill_for_task.py +113 -0
- package/src/scripts/skill_trigger_eval.py +682 -0
- package/src/scripts/skill_usage_collect.py +191 -0
- package/src/scripts/skill_usage_report.py +162 -0
- package/src/scripts/smoke/kernel.sh +107 -0
- package/src/scripts/smoke/router.sh +148 -0
- package/src/scripts/smoke/schema.sh +78 -0
- package/src/scripts/smoke/skills.sh +112 -0
- package/src/scripts/smoke_path_resolution.py +93 -0
- package/src/scripts/smoke_quickstart.py +144 -0
- package/src/scripts/snapshot_agent_outputs.py +144 -0
- package/src/scripts/spotcheck_thin_root.py +134 -0
- package/src/scripts/sync_agent_settings.py +180 -0
- package/src/scripts/sync_github_metadata.py +147 -0
- package/src/scripts/sync_gitignore.py +291 -0
- package/src/scripts/telegraph_stats.py +119 -0
- package/src/scripts/trigger_coverage.py +129 -0
- package/src/scripts/update_counts.py +199 -0
- package/src/scripts/update_prices.py +125 -0
- package/src/scripts/validate_agent_settings.py +124 -0
- package/src/scripts/validate_decision_engine.py +136 -0
- package/src/scripts/validate_discovery_manifest.py +94 -0
- package/src/scripts/validate_frontmatter.py +647 -0
- package/src/scripts/validate_pack_yaml.py +179 -0
- package/src/scripts/verify_physical_move.py +185 -0
- package/src/scripts/wrapper_freshness_hook.py +86 -0
- package/.agent-src/README.md +0 -64
- package/.agent-src/commands/agent-handoff.md +0 -120
- package/.agent-src/commands/agent-status.md +0 -136
- package/.agent-src/commands/agents/audit.md +0 -157
- package/.agent-src/commands/agents/init.md +0 -191
- package/.agent-src/commands/agents/optimize.md +0 -186
- package/.agent-src/commands/agents/user/accept.md +0 -121
- package/.agent-src/commands/agents/user/init.md +0 -161
- package/.agent-src/commands/agents/user/review.md +0 -111
- package/.agent-src/commands/agents/user/show.md +0 -113
- package/.agent-src/commands/agents/user/update.md +0 -102
- package/.agent-src/commands/agents/user.md +0 -70
- package/.agent-src/commands/agents.md +0 -61
- package/.agent-src/commands/analytics/prune.md +0 -70
- package/.agent-src/commands/analytics/show.md +0 -99
- package/.agent-src/commands/analytics.md +0 -56
- package/.agent-src/commands/analyze-reference-repo.md +0 -203
- package/.agent-src/commands/bug-fix.md +0 -192
- package/.agent-src/commands/bug-investigate.md +0 -185
- package/.agent-src/commands/challenge-me/vision.md +0 -353
- package/.agent-src/commands/challenge-me/with-docs.md +0 -338
- package/.agent-src/commands/challenge-me.md +0 -67
- package/.agent-src/commands/chat-history/import.md +0 -171
- package/.agent-src/commands/chat-history/learn.md +0 -183
- package/.agent-src/commands/chat-history/show.md +0 -111
- package/.agent-src/commands/chat-history.md +0 -58
- package/.agent-src/commands/check-current-md.md +0 -142
- package/.agent-src/commands/commit/in-chunks.md +0 -145
- package/.agent-src/commands/commit.md +0 -190
- package/.agent-src/commands/condense.md +0 -235
- package/.agent-src/commands/context/create.md +0 -180
- package/.agent-src/commands/context/refactor.md +0 -182
- package/.agent-src/commands/context.md +0 -50
- package/.agent-src/commands/cost-report.md +0 -130
- package/.agent-src/commands/council/analysis.md +0 -146
- package/.agent-src/commands/council/debate.md +0 -133
- package/.agent-src/commands/council/default.md +0 -288
- package/.agent-src/commands/council/design.md +0 -106
- package/.agent-src/commands/council/optimize.md +0 -122
- package/.agent-src/commands/council/pr.md +0 -129
- package/.agent-src/commands/council.md +0 -106
- package/.agent-src/commands/create-pr/description-only.md +0 -159
- package/.agent-src/commands/create-pr.md +0 -249
- package/.agent-src/commands/e2e-heal.md +0 -109
- package/.agent-src/commands/e2e-plan.md +0 -96
- package/.agent-src/commands/estimate-ticket.md +0 -88
- package/.agent-src/commands/feature/dev.md +0 -123
- package/.agent-src/commands/feature/explore.md +0 -190
- package/.agent-src/commands/feature/plan.md +0 -332
- package/.agent-src/commands/feature/refactor.md +0 -193
- package/.agent-src/commands/feature/roadmap.md +0 -221
- package/.agent-src/commands/feature.md +0 -58
- package/.agent-src/commands/fix/ci.md +0 -58
- package/.agent-src/commands/fix/portability.md +0 -106
- package/.agent-src/commands/fix/pr-bot-comments.md +0 -156
- package/.agent-src/commands/fix/pr-comments.md +0 -68
- package/.agent-src/commands/fix/pr-developer-comments.md +0 -162
- package/.agent-src/commands/fix/refs.md +0 -103
- package/.agent-src/commands/fix/seeder.md +0 -157
- package/.agent-src/commands/fix.md +0 -60
- package/.agent-src/commands/ghostwriter/delete.md +0 -122
- package/.agent-src/commands/ghostwriter/fetch.md +0 -189
- package/.agent-src/commands/ghostwriter/list.md +0 -106
- package/.agent-src/commands/ghostwriter/show.md +0 -117
- package/.agent-src/commands/ghostwriter/write.md +0 -164
- package/.agent-src/commands/ghostwriter.md +0 -100
- package/.agent-src/commands/grill-me.md +0 -44
- package/.agent-src/commands/image/analyse.md +0 -51
- package/.agent-src/commands/image/create.md +0 -53
- package/.agent-src/commands/image/verify.md +0 -48
- package/.agent-src/commands/image.md +0 -69
- package/.agent-src/commands/implement-ticket.md +0 -165
- package/.agent-src/commands/jira-ticket.md +0 -80
- package/.agent-src/commands/judge/on-diff.md +0 -123
- package/.agent-src/commands/judge/solo.md +0 -95
- package/.agent-src/commands/judge/steps.md +0 -93
- package/.agent-src/commands/judge.md +0 -60
- package/.agent-src/commands/knowledge/cross-repo.md +0 -71
- package/.agent-src/commands/knowledge/forget.md +0 -96
- package/.agent-src/commands/knowledge/ingest.md +0 -114
- package/.agent-src/commands/knowledge/list.md +0 -94
- package/.agent-src/commands/knowledge.md +0 -69
- package/.agent-src/commands/memory/add.md +0 -146
- package/.agent-src/commands/memory/learn-low-impact.md +0 -147
- package/.agent-src/commands/memory/load.md +0 -175
- package/.agent-src/commands/memory/mine-session.md +0 -156
- package/.agent-src/commands/memory/promote.md +0 -194
- package/.agent-src/commands/memory/propose.md +0 -121
- package/.agent-src/commands/memory.md +0 -56
- package/.agent-src/commands/mode.md +0 -129
- package/.agent-src/commands/module/create.md +0 -143
- package/.agent-src/commands/module/explore.md +0 -197
- package/.agent-src/commands/module.md +0 -50
- package/.agent-src/commands/optimize/agents-dir.md +0 -118
- package/.agent-src/commands/optimize/augmentignore.md +0 -311
- package/.agent-src/commands/optimize/rtk.md +0 -160
- package/.agent-src/commands/optimize/skills.md +0 -131
- package/.agent-src/commands/optimize-prompt.md +0 -66
- package/.agent-src/commands/optimize.md +0 -56
- package/.agent-src/commands/orchestrate.md +0 -128
- package/.agent-src/commands/override/create.md +0 -107
- package/.agent-src/commands/override/manage.md +0 -106
- package/.agent-src/commands/override.md +0 -50
- package/.agent-src/commands/package-reset.md +0 -162
- package/.agent-src/commands/package-test.md +0 -238
- package/.agent-src/commands/post-as/ghostwriter.md +0 -70
- package/.agent-src/commands/post-as/me.md +0 -128
- package/.agent-src/commands/post-as.md +0 -62
- package/.agent-src/commands/prediction-pool.md +0 -234
- package/.agent-src/commands/prepare-for-review.md +0 -106
- package/.agent-src/commands/profile/activate.md +0 -81
- package/.agent-src/commands/profile/deactivate.md +0 -68
- package/.agent-src/commands/profile/show.md +0 -70
- package/.agent-src/commands/profile.md +0 -68
- package/.agent-src/commands/project-analyze.md +0 -320
- package/.agent-src/commands/project-health.md +0 -105
- package/.agent-src/commands/quality-fix.md +0 -137
- package/.agent-src/commands/refine-ticket.md +0 -94
- package/.agent-src/commands/research/deep.md +0 -154
- package/.agent-src/commands/research/report.md +0 -139
- package/.agent-src/commands/research.md +0 -177
- package/.agent-src/commands/review-changes.md +0 -205
- package/.agent-src/commands/review-routing.md +0 -117
- package/.agent-src/commands/roadmap/ai-council.md +0 -188
- package/.agent-src/commands/roadmap/create.md +0 -213
- package/.agent-src/commands/roadmap/process-full.md +0 -108
- package/.agent-src/commands/roadmap/process-phase.md +0 -74
- package/.agent-src/commands/roadmap/process-step.md +0 -62
- package/.agent-src/commands/roadmap.md +0 -78
- package/.agent-src/commands/rule-compliance-audit.md +0 -148
- package/.agent-src/commands/set-cost-profile.md +0 -117
- package/.agent-src/commands/skill/preview.md +0 -67
- package/.agent-src/commands/skill.md +0 -48
- package/.agent-src/commands/skills/discover.md +0 -76
- package/.agent-src/commands/skills.md +0 -56
- package/.agent-src/commands/sync-agent-settings.md +0 -139
- package/.agent-src/commands/sync-gitignore/fix.md +0 -147
- package/.agent-src/commands/sync-gitignore.md +0 -138
- package/.agent-src/commands/tests/create.md +0 -83
- package/.agent-src/commands/tests/execute.md +0 -67
- package/.agent-src/commands/tests.md +0 -50
- package/.agent-src/commands/threat-model.md +0 -125
- package/.agent-src/commands/update-form-request-messages.md +0 -199
- package/.agent-src/commands/upstream-contribute.md +0 -181
- package/.agent-src/commands/video/from-script.md +0 -127
- package/.agent-src/commands/video/from-song.md +0 -351
- package/.agent-src/commands/video/scene.md +0 -96
- package/.agent-src/commands/video/stitch.md +0 -87
- package/.agent-src/commands/video/storyboard.md +0 -99
- package/.agent-src/commands/video.md +0 -73
- package/.agent-src/commands/work.md +0 -166
- package/.agent-src/contexts/augment-infrastructure.md +0 -178
- package/.agent-src/contexts/authority/commit-mechanics.md +0 -93
- package/.agent-src/contexts/communication/rules-auto/augment-source-of-truth-mechanics.md +0 -98
- package/.agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +0 -138
- package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +0 -89
- package/.agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +0 -98
- package/.agent-src/contexts/contracts/artifact-engagement-flow.md +0 -259
- package/.agent-src/contexts/contracts/consumer-agents-md-guide.md +0 -127
- package/.agent-src/contexts/contracts/emergency-triage-block.md +0 -53
- package/.agent-src/contexts/subagent-configuration.md +0 -62
- package/.agent-src/personas/README.md +0 -114
- package/.agent-src/personas/advisors/contrarian.md +0 -95
- package/.agent-src/personas/advisors/executor.md +0 -99
- package/.agent-src/personas/advisors/expansionist.md +0 -98
- package/.agent-src/personas/advisors/first-principles.md +0 -98
- package/.agent-src/personas/advisors/outsider.md +0 -102
- package/.agent-src/profiles/agency.yml +0 -27
- package/.agent-src/profiles/content_creator.yml +0 -30
- package/.agent-src/profiles/developer.yml +0 -26
- package/.agent-src/profiles/finance.yml +0 -24
- package/.agent-src/profiles/founder.yml +0 -25
- package/.agent-src/profiles/ops.yml +0 -25
- package/.agent-src/rules/ask-when-uncertain.md +0 -70
- package/.agent-src/rules/augment-edit-discipline.md +0 -31
- package/.agent-src/rules/augment-source-of-truth.md +0 -75
- package/.agent-src/rules/autonomous-execution.md +0 -101
- package/.agent-src/rules/commit-policy.md +0 -59
- package/.agent-src/rules/direct-answers.md +0 -64
- package/.agent-src/rules/domain-adoption-policy.md +0 -160
- package/.agent-src/rules/external-reference-deep-dive.md +0 -72
- package/.agent-src/rules/git-history-discipline.md +0 -102
- package/.agent-src/rules/improve-before-implement.md +0 -112
- package/.agent-src/rules/language-and-tone.md +0 -64
- package/.agent-src/rules/linked-projects-onboarding-gate.md +0 -79
- package/.agent-src/rules/media-governance-routing.md +0 -85
- package/.agent-src/rules/missing-tool-handling.md +0 -76
- package/.agent-src/rules/model-recommendation.md +0 -85
- package/.agent-src/rules/no-attribution-footers.md +0 -57
- package/.agent-src/rules/no-cheap-questions.md +0 -75
- package/.agent-src/rules/no-pr-progress-comments.md +0 -109
- package/.agent-src/rules/no-roadmap-references.md +0 -141
- package/.agent-src/rules/non-destructive-by-default.md +0 -58
- package/.agent-src/rules/persona-governance.md +0 -93
- package/.agent-src/rules/preservation-guard.md +0 -97
- package/.agent-src/rules/provider-lifecycle-discipline.md +0 -78
- package/.agent-src/rules/roadmap-progress-sync.md +0 -99
- package/.agent-src/rules/scope-control.md +0 -68
- package/.agent-src/rules/security-sensitive-stop.md +0 -87
- package/.agent-src/rules/think-before-action.md +0 -41
- package/.agent-src/rules/user-interrupt-priority.md +0 -49
- package/.agent-src/rules/verify-before-complete.md +0 -78
- package/.agent-src/scripts/update_roadmap_progress.py +0 -416
- package/.agent-src/skills/accessibility-auditor/SKILL.md +0 -136
- package/.agent-src/skills/adversarial-review/SKILL.md +0 -156
- package/.agent-src/skills/agents-md-thin-root/SKILL.md +0 -143
- package/.agent-src/skills/ai-council/SKILL.md +0 -912
- package/.agent-src/skills/api-design/SKILL.md +0 -112
- package/.agent-src/skills/api-endpoint/SKILL.md +0 -94
- package/.agent-src/skills/async-python-patterns/SKILL.md +0 -158
- package/.agent-src/skills/authz-review/SKILL.md +0 -180
- package/.agent-src/skills/blade-ui/SKILL.md +0 -129
- package/.agent-src/skills/blast-radius-analyzer/SKILL.md +0 -192
- package/.agent-src/skills/character-consistency/SKILL.md +0 -141
- package/.agent-src/skills/check-refs/SKILL.md +0 -96
- package/.agent-src/skills/code-review/SKILL.md +0 -224
- package/.agent-src/skills/command-routing/SKILL.md +0 -134
- package/.agent-src/skills/command-writing/SKILL.md +0 -282
- package/.agent-src/skills/condense-memory/SKILL.md +0 -123
- package/.agent-src/skills/context-document/SKILL.md +0 -160
- package/.agent-src/skills/copilot-config/SKILL.md +0 -208
- package/.agent-src/skills/dashboard-design/SKILL.md +0 -123
- package/.agent-src/skills/database/SKILL.md +0 -103
- package/.agent-src/skills/deep-reading-analyst/SKILL.md +0 -198
- package/.agent-src/skills/defense-in-depth/SKILL.md +0 -157
- package/.agent-src/skills/design-review/SKILL.md +0 -233
- package/.agent-src/skills/developer-like-execution/SKILL.md +0 -292
- package/.agent-src/skills/error-handling-patterns/SKILL.md +0 -139
- package/.agent-src/skills/existing-ui-audit/SKILL.md +0 -209
- package/.agent-src/skills/fe-design/SKILL.md +0 -255
- package/.agent-src/skills/feature-planning/SKILL.md +0 -271
- package/.agent-src/skills/flux/SKILL.md +0 -121
- package/.agent-src/skills/jira-integration/SKILL.md +0 -187
- package/.agent-src/skills/lint-skills/SKILL.md +0 -95
- package/.agent-src/skills/livewire/SKILL.md +0 -134
- package/.agent-src/skills/mcp-builder/SKILL.md +0 -113
- package/.agent-src/skills/md-language-check/SKILL.md +0 -130
- package/.agent-src/skills/memory-consolidation/SKILL.md +0 -220
- package/.agent-src/skills/merge-conflicts/SKILL.md +0 -195
- package/.agent-src/skills/motion-choreographer/SKILL.md +0 -171
- package/.agent-src/skills/persona-writing/SKILL.md +0 -158
- package/.agent-src/skills/prompt-engineering-patterns/SKILL.md +0 -150
- package/.agent-src/skills/react-shadcn-ui/SKILL.md +0 -213
- package/.agent-src/skills/readme-reviewer/SKILL.md +0 -242
- package/.agent-src/skills/readme-writing/SKILL.md +0 -240
- package/.agent-src/skills/readme-writing-package/SKILL.md +0 -350
- package/.agent-src/skills/receiving-code-review/SKILL.md +0 -200
- package/.agent-src/skills/refine-prompt/SKILL.md +0 -291
- package/.agent-src/skills/refine-ticket/SKILL.md +0 -338
- package/.agent-src/skills/repomix-packer/SKILL.md +0 -141
- package/.agent-src/skills/roadmap-management/SKILL.md +0 -461
- package/.agent-src/skills/rule-refactor/SKILL.md +0 -149
- package/.agent-src/skills/rule-writing/SKILL.md +0 -277
- package/.agent-src/skills/scene-expander/SKILL.md +0 -147
- package/.agent-src/skills/scene-expander/scene-blueprint.schema.yaml +0 -108
- package/.agent-src/skills/script-writing/SKILL.md +0 -231
- package/.agent-src/skills/secrets-management/SKILL.md +0 -148
- package/.agent-src/skills/sentry-integration/SKILL.md +0 -175
- package/.agent-src/skills/song-to-script/SKILL.md +0 -216
- package/.agent-src/skills/sql-writing/SKILL.md +0 -79
- package/.agent-src/skills/subagent-orchestration/SKILL.md +0 -349
- package/.agent-src/skills/tailwind-engineer/SKILL.md +0 -148
- package/.agent-src/skills/technical-specification/SKILL.md +0 -251
- package/.agent-src/skills/testing-anti-patterns/SKILL.md +0 -164
- package/.agent-src/skills/testing-anti-patterns/process-anti-patterns.md +0 -67
- package/.agent-src/skills/threat-modeling/SKILL.md +0 -197
- package/.agent-src/skills/token-optimizer/SKILL.md +0 -115
- package/.agent-src/skills/upstream-contribute/SKILL.md +0 -261
- package/.agent-src/templates/AGENTS.md +0 -34
- package/.agent-src/templates/agents/.gitattributes.fragment +0 -16
- package/.agent-src/templates/agents/agent-project-settings.example.yml +0 -286
- package/.agent-src/templates/agents/memory/architecture-decisions.example.yml +0 -95
- package/.agent-src/templates/agents/proposal.example.md +0 -155
- package/.agent-src/templates/command.md +0 -105
- package/.agent-src/templates/copilot-instructions.md +0 -167
- package/.agent-src/templates/github-workflows/proposal-drift.yml +0 -118
- package/.agent-src/templates/hooks/pre-commit-frontmatter +0 -66
- package/.agent-src/templates/hooks/pre-commit-roadmap-progress +0 -99
- package/.agent-src/templates/persona.md +0 -99
- package/.agent-src/templates/rule.md +0 -135
- package/.agent-src/templates/scripts/check_memory.py +0 -283
- package/.agent-src/templates/scripts/check_memory_proposal.py +0 -180
- package/.agent-src/templates/scripts/memory_lookup.py +0 -577
- package/.agent-src/templates/scripts/memory_report.py +0 -184
- package/.agent-src/templates/scripts/memory_signal.py +0 -167
- package/.agent-src/templates/scripts/memory_status.py +0 -257
- package/.agent-src/templates/scripts/work_engine/directives/backend/memory.py +0 -136
- package/.agent-src/templates/scripts/work_engine/directives/ui/_passthrough.py +0 -44
- package/.agent-src/templates/scripts/work_engine/directives/ui/polish.py +0 -510
- package/.agent-src/templates/scripts/work_engine/directives/ui/review.py +0 -468
- package/.agent-src/templates/scripts/work_engine/orchestration.py +0 -182
- package/.agent-src/templates/scripts/work_engine/scoring/memory_visibility.py +0 -284
- package/.agent-src/user-types/README.md +0 -124
- package/config/agent-settings.template.yml +0 -578
- package/config/discovery/packs.yml +0 -181
- package/config/discovery/workspaces.yml +0 -72
- package/config/gitignore-block.txt +0 -88
- package/dist/ui/assets/index-DcAWIwwY.js +0 -40
- package/dist/ui/assets/index-DcAWIwwY.js.map +0 -1
- package/docs/contracts/agent-memory-contract.md +0 -159
- package/docs/parity/bench-ruflo.json +0 -58
- package/docs/parity/ruflo.md +0 -46
- package/scripts/__pycache__/validate_frontmatter.cpython-312.pyc +0 -0
- package/scripts/_archive/README.md +0 -59
- package/scripts/_archive/_bootstrap_tier_frontmatter.py +0 -151
- package/scripts/_archive/_p43_bodies.py +0 -235
- package/scripts/_archive/_p43_condense.py +0 -118
- package/scripts/_archive/_p4_migrate.py +0 -199
- package/scripts/_cli/cmd_doctor.py +0 -1583
- package/scripts/_cli/cmd_export.py +0 -157
- package/scripts/_cli/cmd_migrate.py +0 -437
- package/scripts/_cli/cmd_refresh.py +0 -179
- package/scripts/_cli/cmd_settings_migrate.py +0 -147
- package/scripts/_cli/cmd_update.py +0 -279
- package/scripts/_cli/cmd_upgrade.py +0 -172
- package/scripts/_cli/cmd_versions.py +0 -160
- package/scripts/_dispatch.bash +0 -1126
- package/scripts/_lib/__pycache__/__init__.cpython-312.pyc +0 -0
- package/scripts/_lib/__pycache__/agent_src.cpython-312.pyc +0 -0
- package/scripts/_lib/agent_src.py +0 -187
- package/scripts/_lib/bench_ab_cache.py +0 -162
- package/scripts/_lib/changelog_eras.py +0 -330
- package/scripts/_lib/claude_desktop_bundler.py +0 -238
- package/scripts/_lib/cli_wrapper.py +0 -64
- package/scripts/_lib/install_regenerator.py +0 -129
- package/scripts/_lib/installed_lock.py +0 -256
- package/scripts/_lib/scope_guard.sh +0 -162
- package/scripts/_lib/value_ladder.py +0 -696
- package/scripts/_lib/value_report.py +0 -455
- package/scripts/_phase4_bucket.py +0 -210
- package/scripts/_pilot_measure.py +0 -53
- package/scripts/adoption_report.py +0 -195
- package/scripts/adoption_snapshot.py +0 -219
- package/scripts/adoption_status.py +0 -166
- package/scripts/agent-config +0 -57
- package/scripts/ai-video/adapters/gemini-veo.sh +0 -62
- package/scripts/ai-video/adapters/higgsfield.sh +0 -245
- package/scripts/ai-video/adapters/kling.sh +0 -59
- package/scripts/ai-video/adapters/openai-images.sh +0 -143
- package/scripts/ai-video/adapters/sora.sh +0 -60
- package/scripts/ai-video/lib/adapter-common.sh +0 -116
- package/scripts/ai-video/lib/adapter-contract.md +0 -163
- package/scripts/ai-video/lib/fixtures/gemini-veo/result.json +0 -1
- package/scripts/ai-video/lib/fixtures/higgsfield/result.json +0 -1
- package/scripts/ai-video/lib/fixtures/kling/result.json +0 -1
- package/scripts/ai-video/lib/fixtures/openai-images/result.json +0 -1
- package/scripts/ai-video/lib/fixtures/sora/result.json +0 -1
- package/scripts/ai-video/lib/load-config.sh +0 -140
- package/scripts/ai-video/lib/validate-deps.sh +0 -132
- package/scripts/ai-video/stitch.sh +0 -154
- package/scripts/ai-video/test-pipeline.sh +0 -169
- package/scripts/ai_council/advisors.py +0 -148
- package/scripts/ai_council/clients.py +0 -1385
- package/scripts/ai_council/compile_corpus.py +0 -179
- package/scripts/ai_council/config.py +0 -1364
- package/scripts/ai_council/events_log.py +0 -141
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_2a4_acceptance.py +0 -208
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_budget_v2_audit.py +0 -206
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_context_layer_v1_estimate.py +0 -67
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_context_layer_v1_review.py +0 -292
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_followups_review.py +0 -259
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_nondestructive_inline_audit.py +0 -209
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_phase4_dispatch_latency.py +0 -108
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_phase6_trigger_jaccard.py +0 -92
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_phase_2a_budget_rebalance.py +0 -257
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_phase_2a_post_revert.py +0 -197
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_rebalancing_audit.py +0 -149
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_roundtrip.py +0 -111
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_rule_hardening_v1.py +0 -251
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_silent_taskfiles.py +0 -98
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_structural_open_questions.py +0 -232
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_structural_optimization.py +0 -144
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_structural_v3_gaps.py +0 -252
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_structural_v3_review.py +0 -240
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_tier_retrofit.py +0 -180
- package/scripts/ai_council/pricing.py +0 -215
- package/scripts/ai_council/session.py +0 -366
- package/scripts/annotate_discovery.py +0 -149
- package/scripts/apply_modules_config.py +0 -290
- package/scripts/audit_adr_coverage.py +0 -175
- package/scripts/audit_auto_rules.py +0 -175
- package/scripts/audit_cloud_compatibility.py +0 -362
- package/scripts/audit_command_surface.py +0 -374
- package/scripts/audit_initial_context.py +0 -234
- package/scripts/audit_likelihood.py +0 -148
- package/scripts/audit_mcp_tools.py +0 -146
- package/scripts/audit_overlap.py +0 -145
- package/scripts/audit_skill_descriptions.py +0 -180
- package/scripts/audit_user_type_axis.py +0 -140
- package/scripts/backfill_model_tier.py +0 -182
- package/scripts/bench_ab_cache_dispatch.py +0 -68
- package/scripts/bench_ab_clone.py +0 -170
- package/scripts/bench_ab_diff.py +0 -220
- package/scripts/bench_ab_integrity.py +0 -143
- package/scripts/bench_ab_run.py +0 -235
- package/scripts/bench_ab_task_runner.py +0 -369
- package/scripts/bench_ab_tracka_run.py +0 -202
- package/scripts/bench_baseline_ready.py +0 -108
- package/scripts/bench_condense_memory.py +0 -168
- package/scripts/bench_drift_check.py +0 -151
- package/scripts/bench_per_tool.py +0 -216
- package/scripts/bench_rtk_savings.py +0 -320
- package/scripts/bench_run.py +0 -272
- package/scripts/bench_runner.py +0 -158
- package/scripts/build_cloud_bundle.py +0 -458
- package/scripts/build_discovery_manifest.py +0 -679
- package/scripts/build_linear_digest.py +0 -260
- package/scripts/build_mcp_registry_manifest.py +0 -181
- package/scripts/build_rule_trigger_matrix.py +0 -350
- package/scripts/capture_showcase_session.py +0 -361
- package/scripts/check_always_budget.py +0 -532
- package/scripts/check_artefact_checksums.py +0 -111
- package/scripts/check_augment_description_cap.py +0 -79
- package/scripts/check_augmentignore.py +0 -72
- package/scripts/check_beta_review_markers.py +0 -127
- package/scripts/check_bite_sized_granularity.py +0 -99
- package/scripts/check_cluster_patterns.py +0 -175
- package/scripts/check_command_count_messaging.py +0 -158
- package/scripts/check_condensation.py +0 -375
- package/scripts/check_condensed_paths.py +0 -221
- package/scripts/check_context_paths.py +0 -202
- package/scripts/check_council_references.py +0 -228
- package/scripts/check_discovery_determinism.py +0 -70
- package/scripts/check_gate_paths.py +0 -117
- package/scripts/check_memory.py +0 -443
- package/scripts/check_memory_proposal.py +0 -182
- package/scripts/check_module_management_neutral.py +0 -149
- package/scripts/check_no_roadmap_refs.py +0 -155
- package/scripts/check_one_off_location.py +0 -81
- package/scripts/check_overlay_cascade_subdirs.py +0 -129
- package/scripts/check_portability.py +0 -574
- package/scripts/check_public_catalog_links.py +0 -125
- package/scripts/check_public_links.py +0 -185
- package/scripts/check_references.py +0 -541
- package/scripts/check_release_includes_discovery.py +0 -61
- package/scripts/check_release_pr_shape.py +0 -119
- package/scripts/check_release_published.py +0 -145
- package/scripts/check_reply_consistency.py +0 -169
- package/scripts/check_roadmap_trackable.py +0 -114
- package/scripts/check_role_doc_links.py +0 -110
- package/scripts/check_safety_floor_untouched.py +0 -125
- package/scripts/check_skill_requires.py +0 -143
- package/scripts/check_template_pin_drift.py +0 -129
- package/scripts/check_test_coverage_diff.py +0 -180
- package/scripts/check_token_optimizer_freshness.py +0 -146
- package/scripts/check_update_banner.py +0 -86
- package/scripts/ci_time_ratio.py +0 -168
- package/scripts/compile_router.py +0 -232
- package/scripts/condense.py +0 -1649
- package/scripts/condense_memory.py +0 -178
- package/scripts/config/profiles.py +0 -188
- package/scripts/config/session_profiles.py +0 -492
- package/scripts/cost_by_conversation.py +0 -78
- package/scripts/cost_summary.py +0 -97
- package/scripts/council_cli.py +0 -2544
- package/scripts/cross_repo_retrieve.py +0 -172
- package/scripts/discovery_stats.py +0 -70
- package/scripts/extract_audit_patterns.py +0 -202
- package/scripts/first_run_gate_hook.py +0 -178
- package/scripts/gen_discovery_baseline.py +0 -127
- package/scripts/generate_catalog.py +0 -116
- package/scripts/generate_index.py +0 -302
- package/scripts/generate_ownership_matrix.py +0 -378
- package/scripts/generate_pack_manifests.py +0 -183
- package/scripts/hook_manifest.yaml +0 -243
- package/scripts/hooks/dispatch_hook.py +0 -461
- package/scripts/hooks/replay_hook.py +0 -144
- package/scripts/hooks_doctor.py +0 -223
- package/scripts/hooks_status.py +0 -157
- package/scripts/install +0 -424
- package/scripts/install-hooks.sh +0 -185
- package/scripts/install.py +0 -5027
- package/scripts/install.sh +0 -1140
- package/scripts/inventory_abstraction_budget.py +0 -621
- package/scripts/inventory_frontmatter.py +0 -164
- package/scripts/inventory_meta_layers.py +0 -288
- package/scripts/iron_law_sha.py +0 -107
- package/scripts/linked_projects_list.py +0 -91
- package/scripts/lint_agents_layout.py +0 -191
- package/scripts/lint_agents_md.py +0 -208
- package/scripts/lint_archived_skills.py +0 -159
- package/scripts/lint_artefact_frontmatter.py +0 -180
- package/scripts/lint_bench_ab.py +0 -172
- package/scripts/lint_bench_corpus.py +0 -255
- package/scripts/lint_command_tiers.py +0 -128
- package/scripts/lint_commit_subjects.py +0 -139
- package/scripts/lint_context_spine_usage.py +0 -137
- package/scripts/lint_discovery_manifest.py +0 -136
- package/scripts/lint_discovery_vocabulary.py +0 -156
- package/scripts/lint_examples.py +0 -102
- package/scripts/lint_explain_trace.py +0 -80
- package/scripts/lint_featured_skills.py +0 -139
- package/scripts/lint_framework_leakage.py +0 -375
- package/scripts/lint_framework_leakage_allowlist.json +0 -575
- package/scripts/lint_frontmatter_boilerplate.py +0 -77
- package/scripts/lint_ghostwriter_source.py +0 -240
- package/scripts/lint_handoffs.py +0 -217
- package/scripts/lint_hook_concern_budget.py +0 -207
- package/scripts/lint_hook_manifest.py +0 -217
- package/scripts/lint_load_context.py +0 -196
- package/scripts/lint_marketplace.py +0 -180
- package/scripts/lint_marketplace_install_completeness.py +0 -188
- package/scripts/lint_mcp_registry_manifest.py +0 -69
- package/scripts/lint_media_policy_linkage.py +0 -140
- package/scripts/lint_model_tier_coverage.py +0 -73
- package/scripts/lint_namespace.py +0 -135
- package/scripts/lint_no_new_atomic_commands.py +0 -180
- package/scripts/lint_one_off_age.py +0 -184
- package/scripts/lint_orchestration_dsl.py +0 -217
- package/scripts/lint_pack_boundaries.py +0 -147
- package/scripts/lint_pack_first_win.py +0 -103
- package/scripts/lint_persona_governance.py +0 -164
- package/scripts/lint_positioning.py +0 -143
- package/scripts/lint_regression.py +0 -232
- package/scripts/lint_roadmap_ci_steps.py +0 -186
- package/scripts/lint_roadmap_complexity.py +0 -220
- package/scripts/lint_role_experiences.py +0 -237
- package/scripts/lint_rule_interactions.py +0 -170
- package/scripts/lint_rule_tiers.py +0 -90
- package/scripts/lint_showcase_sessions.py +0 -148
- package/scripts/lint_skill_tools.py +0 -168
- package/scripts/lint_topics_yaml.py +0 -89
- package/scripts/lint_trust_coherence.py +0 -212
- package/scripts/lint_value_dashboard.py +0 -218
- package/scripts/mcp_parity_smoke.py +0 -164
- package/scripts/mcp_registry_submit.sh +0 -187
- package/scripts/mcp_server/__init__.py +0 -19
- package/scripts/mcp_server/consumer_tool_catalog.json +0 -275
- package/scripts/mcp_server/prompts.py +0 -441
- package/scripts/mcp_server/resources.py +0 -201
- package/scripts/mcp_server/tools.py +0 -838
- package/scripts/measure_augment_budget.py +0 -214
- package/scripts/measure_density.py +0 -232
- package/scripts/measure_frugality_savings.py +0 -164
- package/scripts/measure_markitdown_lift.py +0 -127
- package/scripts/measure_patterns.py +0 -376
- package/scripts/measure_projection_bytes.py +0 -159
- package/scripts/measure_rule_budget.py +0 -347
- package/scripts/measure_skill_reduction.py +0 -102
- package/scripts/memory_lookup.py +0 -705
- package/scripts/memory_report.py +0 -336
- package/scripts/memory_signal.py +0 -212
- package/scripts/memory_status.py +0 -257
- package/scripts/migrate_command_suggestions.py +0 -151
- package/scripts/migrate_frontmatter_defaults.py +0 -245
- package/scripts/mine_session.py +0 -279
- package/scripts/move_artefact.py +0 -143
- package/scripts/new_skill.py +0 -148
- package/scripts/pack_mcp_content.py +0 -288
- package/scripts/plan_physical_move.py +0 -353
- package/scripts/print_required_checks.py +0 -196
- package/scripts/probe_projection_fidelity.py +0 -202
- package/scripts/profile_staleness_hook.py +0 -69
- package/scripts/profile_use.py +0 -125
- package/scripts/project_thin_rules.py +0 -168
- package/scripts/prototype_lint_contradictions.py +0 -150
- package/scripts/recruit_preflight.sh +0 -152
- package/scripts/refine_ticket_detect.py +0 -646
- package/scripts/release.py +0 -1049
- package/scripts/render_benchmark_md.py +0 -312
- package/scripts/render_value_md.py +0 -347
- package/scripts/repro/repro_marketplace_install_gap.sh +0 -161
- package/scripts/roadmap_progress_hook.py +0 -274
- package/scripts/router_telemetry.py +0 -470
- package/scripts/run_skill_evals.py +0 -185
- package/scripts/runtime_registry.py +0 -166
- package/scripts/schemas/command.schema.json +0 -178
- package/scripts/schemas/rule.schema.json +0 -145
- package/scripts/score_skill_selection.py +0 -198
- package/scripts/skill_collision_clusters.py +0 -162
- package/scripts/skill_discovery.py +0 -254
- package/scripts/skill_linter.py +0 -3686
- package/scripts/skill_overlap.py +0 -204
- package/scripts/skill_preview.py +0 -179
- package/scripts/skill_tools/audit_persona_coverage.py +0 -147
- package/scripts/skill_tools/audit_user_type_coverage.py +0 -148
- package/scripts/skill_tools/run_block_d_eval.py +0 -129
- package/scripts/skill_tools/score_skill_relevance.py +0 -169
- package/scripts/skill_tools/suggest_skill_for_task.py +0 -113
- package/scripts/skill_trigger_eval.py +0 -682
- package/scripts/skill_usage_collect.py +0 -191
- package/scripts/skill_usage_report.py +0 -162
- package/scripts/smoke/kernel.sh +0 -107
- package/scripts/smoke/router.sh +0 -148
- package/scripts/smoke/schema.sh +0 -71
- package/scripts/smoke/skills.sh +0 -112
- package/scripts/smoke_path_resolution.py +0 -93
- package/scripts/smoke_quickstart.py +0 -144
- package/scripts/snapshot_agent_outputs.py +0 -144
- package/scripts/spotcheck_thin_root.py +0 -134
- package/scripts/sync_agent_settings.py +0 -180
- package/scripts/sync_github_metadata.py +0 -147
- package/scripts/sync_gitignore.py +0 -291
- package/scripts/telegraph_stats.py +0 -119
- package/scripts/trigger_coverage.py +0 -129
- package/scripts/update_counts.py +0 -195
- package/scripts/update_prices.py +0 -125
- package/scripts/validate_agent_settings.py +0 -124
- package/scripts/validate_decision_engine.py +0 -136
- package/scripts/validate_discovery_manifest.py +0 -94
- package/scripts/validate_frontmatter.py +0 -571
- package/scripts/verify_physical_move.py +0 -185
- package/scripts/wrapper_freshness_hook.py +0 -86
- /package/{.agent-src → dist/agent-src}/contexts/authority/destructive-mechanics.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/authority/kernel-rule-edits.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/authority/scope-mechanics.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/communication/rules-auto/guidelines-mechanics.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/communication/rules-auto/token-efficiency-mechanics.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/communication/rules-auto/user-interaction-mechanics.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/contracts/agents-md-anatomy.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/contracts/command-suggestion-flow.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/contracts/frugality-charter.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/contracts/research-schema.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/documentation-hierarchy.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/execution/autonomy-detection.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/execution/autonomy-examples.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/execution/autonomy-mechanics.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/execution/cheap-question-mechanics.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/execution/interrupt-examples.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/execution/roadmap-process-loop.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/execution/verification-mechanics.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/judges/no-consolidate-rationale.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/judges/persona-voice-rubric.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/model-recommendations.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/override-system.md +0 -0
- /package/{.agent-src → dist/agent-src}/contexts/skills-and-commands.md +0 -0
- /package/{.agent-src → dist/agent-src}/ghostwriter/README.md +0 -0
- /package/{.agent-src → dist/agent-src}/ghostwriter/fictional-fixture-v1.md +0 -0
- /package/{.agent-src → dist/agent-src}/packs/README.md +0 -0
- /package/{.agent-src → dist/agent-src}/packs/agency-delivery.yml +0 -0
- /package/{.agent-src → dist/agent-src}/packs/content-engine.yml +0 -0
- /package/{.agent-src → dist/agent-src}/packs/founder-mvp.yml +0 -0
- /package/{.agent-src → dist/agent-src}/personas/_template-specialist/persona.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/ai-agent.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/ai-video-technical-director.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/backend-architect.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/cmo.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/critical-challenger.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/customer-success-lead.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/developer.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/discovery-lead.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/eloquent-tamer.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/engineering-manager.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/finance-partner.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/frontend-engineer.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/growth-pm.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/hollywood-director.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/people-strategist.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/product-owner.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/qa.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/revops-maintainer.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/revops.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/security-engineer.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/senior-engineer.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/stakeholder.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/strategist.md +0 -0
- /package/{.agent-src → dist/agent-src}/personas/tech-writer.md +0 -0
- /package/{.agent-src → dist/agent-src}/presets/README.md +0 -0
- /package/{.agent-src → dist/agent-src}/presets/balanced.yml +0 -0
- /package/{.agent-src → dist/agent-src}/presets/fast.yml +0 -0
- /package/{.agent-src → dist/agent-src}/presets/strict.yml +0 -0
- /package/{.agent-src → dist/agent-src}/profiles/README.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/agent-authority.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/analysis-skill-routing.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/architecture.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/artifact-drafting-protocol.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/artifact-engagement-recording.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/cli-output-handling.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/command-suggestion-policy.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/commit-conventions.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/context-hygiene.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/copilot-routing.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/devcontainer-routing.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/docker-commands.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/domain-safety-disclaimer.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/domain-safety-pii.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/domain-safety-retention.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/downstream-changes.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/engineering-safety-floor.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/fast-path-marker-visibility.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/finance-safety-floor.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/framework-neutrality-in-generic-skills.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/guidelines.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/invite-challenge.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/laravel-routing.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/laravel-translations.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/low-impact-corpus-privacy-floor.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/markdown-safe-codeblocks.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/media-sync-ground-truth.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/minimal-safe-diff.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/no-decorative-emojis-in-git-surfaces.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/onboarding-gate.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/package-ci-checks.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/php-coding.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/reviewer-awareness.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/roadmap-ci-steps-policy.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/role-mode-adherence.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/rule-type-governance.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/runtime-safety.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/size-enforcement.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/skill-improvement-trigger.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/skill-quality.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/slash-command-routing-policy.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/strategy-safety-floor.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/symfony-routing.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/telegraph-speak.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/token-efficiency.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/token-optimizer-maintenance.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/tool-safety.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/ui-audit-gate.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/upstream-proposal.md +0 -0
- /package/{.agent-src → dist/agent-src}/rules/user-interaction.md +0 -0
- /package/{.agent-src → dist/agent-src}/scripts/scan-seeder-violations.php +0 -0
- /package/{.agent-src → dist/agent-src}/skills/activation-design/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/adr-create/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/agent-docs-writing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/analysis-autonomous-mode/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/analysis-skill-router/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/api-testing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/architecture-review-lens/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/artisan-commands/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/aws-infrastructure/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/bug-analyzer/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/build-buy-partner/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/canvas-design/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/canvas-design/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/churn-prevention/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/code-refactoring/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/comp-banding/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/competitive-moat-analysis/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/competitive-positioning/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/composer-packages/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/content-funnel-design/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/context-authoring/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/contracts-cognition/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/conventional-commits-writing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/copilot-agents-optimization/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/customer-research/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/data-flow-mapper/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/data-handling-judgment/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/dcf-modeling/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/deal-qualification-meddic/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/decision-record/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/dependency-upgrade/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/description-assist/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/devcontainer/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/discovery-interview/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/doc-coauthoring/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/doc-coauthoring/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/docker/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/editorial-calendar/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/eloquent/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/eloquent/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/estimate-ticket/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/estimate-ticket/evals/output-schema.yml +0 -0
- /package/{.agent-src → dist/agent-src}/skills/estimate-ticket/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/expansion-playbook/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/file-editor/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/finishing-a-development-branch/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/forecast-accuracy/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/forecasting/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/form-handler/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/fundraising-narrative/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/funnel-analysis/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/git-workflow/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/github-ci/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/grafana/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/gtm-launch/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/guideline-writing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/hiring-loop-design/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/image-analyser/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/image-analyser/canon-spec.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/image-analyser/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/image-creator/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/image-creator/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/incident-commander/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/jobs-events/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/judge-bug-hunter/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/judge-code-quality/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/judge-security-auditor/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/judge-test-coverage/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-api-endpoint/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-dto/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-horizon/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-mail/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-middleware/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-migration/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-notifications/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-pennant/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-pulse/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-reverb/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-scheduling/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-validation/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/laravel-websocket/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/launch-readiness/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/learning-to-rule-or-skill/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/livewire-architect/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/logging-monitoring/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/market-entry-analysis/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/markitdown/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/mcp/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/messaging-architecture/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/migration-architect/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/mobile-e2e-strategy/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/module-detect-on-the-fly/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/module-management/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/multi-tenancy/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/nextjs-patterns/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/okr-tree-modeling/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/onboarding-design/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/onboarding-program/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/one-on-one-cadence/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/openapi/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/org-design/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/override-management/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/perf-feedback-craft/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/performance/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/performance-analysis/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/pest-testing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/php-coder/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/php-coder/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/php-debugging/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/php-service/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/pipeline-strategy/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/pixar-storyteller/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/playwright-architect/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/playwright-testing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/po-discovery/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/positioning-strategy/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/prediction-pool-optimizer/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/prediction-pool-optimizer/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/prediction-pool-optimizer/reference/ev-fixtures.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/prediction-pool-optimizer/reference/odds-and-bonus.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/privacy-review/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analysis-core/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analysis-hypothesis-driven/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analysis-laravel/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analysis-nextjs/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analysis-node-express/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analysis-react/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analysis-symfony/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analysis-zend-laminas/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-analyzer/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/project-docs/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/prompt-optimizer/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/quality-tools/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/react-native-setup/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/refine-ticket/detection-map.yml +0 -0
- /package/{.agent-src → dist/agent-src}/skills/refine-ticket/evals/output-schema.yml +0 -0
- /package/{.agent-src → dist/agent-src}/skills/refine-ticket/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/release-comms/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/requesting-code-review/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/retention-loops/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/review-routing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/rice-prioritization/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/risk-officer/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/roadmap-writing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/rtk-output-filtering/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/runway-cognition/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/scenario-modeling/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/security/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/security-audit/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/sequential-thinking/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/skill-improvement-pipeline/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/skill-management/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/skill-reviewer/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/skill-writing/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/skill-writing/evals/triggers.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/stakeholder-tradeoff/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/prompts/README.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/prompts/do-and-judge-two-stage.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/prompts/do-and-judge.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/prompts/do-competitively.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/prompts/do-in-parallel.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/prompts/do-in-steps.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/prompts/do-in-worktrees.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/prompts/judge-with-debate.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/subagent-orchestration/schemas/subagent-status.json +0 -0
- /package/{.agent-src → dist/agent-src}/skills/symfony-workflow/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/systematic-debugging/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/tech-debt-tracker/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/terraform/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/terragrunt/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/test-driven-development/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/test-performance/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/throughput-vs-morale-tradeoff/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/traefik/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/ui-component-architect/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/unit-economics-modeling/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/universal-project-analysis/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/using-git-worktrees/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/validate-feature-fit/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/verify-completion-evidence/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/video-director/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/vision-articulation/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/voc-extract/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/skills/voice-and-tone-design/SKILL.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/agent-settings.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/agents/memory/domain-invariants.example.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/agents/memory/historical-patterns.example.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/agents/memory/incident-learnings.example.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/agents/memory/ownership.example.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/agents/memory/product-rules.example.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/contexts/auth-model.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/contexts/data-sensitivity.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/contexts/deployment-order.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/contexts/observability.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/contexts/tenant-boundaries.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/contexts.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/features.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/github-workflows/memory-hygiene.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/github-workflows/pr-risk-review.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/github-workflows/roadmap-progress-check.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/overrides/command.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/overrides/guideline.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/overrides/rule.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/overrides/skill.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/overrides/template.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/roadmaps.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/README.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/historical-bug-patterns.example.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/implement_ticket/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/implement_ticket/__main__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/memory_hash.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/ownership-map.example.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/pr-risk-config.example.yml +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/pr_review_routing.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/pr_risk_review.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry/aggregator.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry/boundary.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry/engagement.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry/report_renderer.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry/settings.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry_record.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry_report.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/telemetry_status.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/tier_usage_report.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/__main__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/_lib/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/_lib/agent_settings.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/_lib/user_global_paths.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/cli.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/cli_args.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/delivery_state.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/backend/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/backend/analyze.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/backend/implement.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/backend/plan.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/backend/refine.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/backend/report.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/backend/test.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/backend/verify.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/mixed/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/mixed/contract.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/mixed/stitch.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/mixed/ui.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui/apply.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui/audit.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui/design.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui_trivial/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui_trivial/_skipped.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui_trivial/apply.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui_trivial/refine.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui_trivial/report.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/directives/ui_trivial/test.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/dispatcher.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/emitters.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/errors.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hook_bootstrap.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/_chat_history_base.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/chat_history_append.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/chat_history_halt_append.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/decision_gate.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/decision_trace.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/directive_set_guard.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/halt_surface_audit.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/memory_visibility.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/state_shape_validation.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/builtin/trace.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/context.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/events.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/exceptions.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/registry.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/runner.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/hooks/settings.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/input_builders.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/intent/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/intent/classify.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/migration/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/migration/v0_to_v1.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/persona_policy.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/resolvers/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/resolvers/diff.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/resolvers/file.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/resolvers/prompt.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/scoring/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/scoring/confidence.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/scoring/decision_engine.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/scoring/decision_trace.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/stack/__init__.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/stack/detect.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/state.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/scripts/work_engine/state_io.py +0 -0
- /package/{.agent-src → dist/agent-src}/templates/skill-archive-note.md +0 -0
- /package/{.agent-src → dist/agent-src}/templates/skill.md +0 -0
- /package/{.agent-src → dist/agent-src}/user-types/_template/user-type.md +0 -0
- /package/{.agent-src → dist/agent-src}/user-types/galabau-field-crew.md +0 -0
- /package/{.agent-src → dist/agent-src}/user-types/metalworking-shop.md +0 -0
- /package/{.agent-src → dist/agent-src}/user-types/truck-driver.md +0 -0
- /package/{config → src/config}/discovery/session-profiles.yml +0 -0
- /package/{config → src/config}/discovery/unassigned-artefacts.yml +0 -0
- /package/{config → src/config}/profiles/balanced.ini +0 -0
- /package/{config → src/config}/profiles/full.ini +0 -0
- /package/{config → src/config}/profiles/minimal.ini +0 -0
- /package/{scripts → src/scripts}/_archive/_backfill_skill_domains.py +0 -0
- /package/{scripts → src/scripts}/_archive/_phase2_shim_helper.py +0 -0
- /package/{scripts → src/scripts}/_archive/_pilot_council_question.py +0 -0
- /package/{scripts → src/scripts}/_cli/__init__.py +0 -0
- /package/{scripts → src/scripts}/_cli/cmd_explain.py +0 -0
- /package/{scripts → src/scripts}/_cli/cmd_prune.py +0 -0
- /package/{scripts → src/scripts}/_cli/cmd_settings_check.py +0 -0
- /package/{scripts → src/scripts}/_cli/cmd_sync.py +0 -0
- /package/{scripts → src/scripts}/_cli/cmd_uninstall.py +0 -0
- /package/{scripts → src/scripts}/_cli/cmd_validate.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/__init__.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/assumptions.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/council.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/halt.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/inputs.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/memory.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/provider.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/render.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/route.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/scrubber.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/__init__.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/assumptions.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/council.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/halt.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/header.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/inputs.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/memory.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/pack.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/provider.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/sections/route.py +0 -0
- /package/{scripts → src/scripts}/_cli/explain_last/state_loader.py +0 -0
- /package/{scripts → src/scripts}/_emit_domain_table.py +0 -0
- /package/{scripts → src/scripts}/_lib/__init__.py +0 -0
- /package/{scripts → src/scripts}/_lib/agent_settings.py +0 -0
- /package/{scripts → src/scripts}/_lib/agents_overlay.py +0 -0
- /package/{scripts → src/scripts}/_lib/bench_ab_scoring.py +0 -0
- /package/{scripts → src/scripts}/_lib/bench_cost.py +0 -0
- /package/{scripts → src/scripts}/_lib/bench_quality.py +0 -0
- /package/{scripts → src/scripts}/_lib/bench_report.py +0 -0
- /package/{scripts → src/scripts}/_lib/bench_telegraph.py +0 -0
- /package/{scripts → src/scripts}/_lib/bench_telegraph_report.py +0 -0
- /package/{scripts → src/scripts}/_lib/fs_atomic.py +0 -0
- /package/{scripts → src/scripts}/_lib/installed_tools.py +0 -0
- /package/{scripts → src/scripts}/_lib/json_pointers.py +0 -0
- /package/{scripts → src/scripts}/_lib/linked_projects.py +0 -0
- /package/{scripts → src/scripts}/_lib/module_detection.py +0 -0
- /package/{scripts → src/scripts}/_lib/pin_resolver.py +0 -0
- /package/{scripts → src/scripts}/_lib/script_output.py +0 -0
- /package/{scripts → src/scripts}/_lib/token_count.py +0 -0
- /package/{scripts → src/scripts}/_lib/update_check.py +0 -0
- /package/{scripts → src/scripts}/_lib/user_global_paths.py +0 -0
- /package/{scripts → src/scripts}/_tmp_scan_framework_leakage.py +0 -0
- /package/{scripts → src/scripts}/adr/regenerate_index.py +0 -0
- /package/{scripts/ai-video/lib/fixtures/kling → src/scripts/ai-video/lib/fixtures/comfyui}/scene-0001.mp4 +0 -0
- /package/{scripts → src/scripts}/ai-video/lib/fixtures/gemini-veo/scene-0001.mp4 +0 -0
- /package/{scripts → src/scripts}/ai-video/lib/fixtures/higgsfield/scene-0001.mp4 +0 -0
- /package/{scripts → src/scripts}/ai-video/lib/fixtures/openai-images/scene-0001.png +0 -0
- /package/{scripts → src/scripts}/ai-video/lib/fixtures/sora/scene-0001.mp4 +0 -0
- /package/{scripts → src/scripts}/ai-video/lib/operator-pick.sh +0 -0
- /package/{scripts → src/scripts}/ai-video/lib/parse-blueprint.sh +0 -0
- /package/{scripts → src/scripts}/ai-video/lib/probe-audio.sh +0 -0
- /package/{scripts → src/scripts}/ai-video/lib/redact.sh +0 -0
- /package/{scripts → src/scripts}/ai_council/__init__.py +0 -0
- /package/{scripts → src/scripts}/ai_council/_default_prices.py +0 -0
- /package/{scripts → src/scripts}/ai_council/airgap.py +0 -0
- /package/{scripts → src/scripts}/ai_council/budget_guard.py +0 -0
- /package/{scripts → src/scripts}/ai_council/bundler.py +0 -0
- /package/{scripts → src/scripts}/ai_council/cli_hints.py +0 -0
- /package/{scripts → src/scripts}/ai_council/confidence_gate.py +0 -0
- /package/{scripts → src/scripts}/ai_council/consensus.py +0 -0
- /package/{scripts → src/scripts}/ai_council/learn_low_impact_preview.py +0 -0
- /package/{scripts → src/scripts}/ai_council/low_impact.py +0 -0
- /package/{scripts → src/scripts}/ai_council/low_impact_corpus.py +0 -0
- /package/{scripts → src/scripts}/ai_council/low_impact_intake.py +0 -0
- /package/{scripts → src/scripts}/ai_council/modes.py +0 -0
- /package/{scripts → src/scripts}/ai_council/necessity.py +0 -0
- /package/{scripts → src/scripts}/ai_council/one_off_archive/2026-05/README.md +0 -0
- /package/{scripts → src/scripts}/ai_council/one_off_archive/2026-05/_one_off_add_quiet.py +0 -0
- /package/{scripts → src/scripts}/ai_council/one_off_archive/2026-05/_one_off_inject_quiet_flag.py +0 -0
- /package/{scripts → src/scripts}/ai_council/one_off_archive/2026-05/_one_off_measure_v2.sh +0 -0
- /package/{scripts → src/scripts}/ai_council/one_off_archive/2026-05/_one_off_measure_verbosity.sh +0 -0
- /package/{scripts → src/scripts}/ai_council/one_off_archive/2026-05/_one_off_per_task.sh +0 -0
- /package/{scripts → src/scripts}/ai_council/orchestrator.py +0 -0
- /package/{scripts → src/scripts}/ai_council/probation_gate.py +0 -0
- /package/{scripts → src/scripts}/ai_council/project_context.py +0 -0
- /package/{scripts → src/scripts}/ai_council/prompts.py +0 -0
- /package/{scripts → src/scripts}/ai_council/redact_low_impact_entry.py +0 -0
- /package/{scripts → src/scripts}/ai_council/replay.py +0 -0
- /package/{scripts → src/scripts}/ai_council/shadow_dispatch.py +0 -0
- /package/{scripts → src/scripts}/ai_council/solo_dispatch.py +0 -0
- /package/{scripts → src/scripts}/bootstrap.sh +0 -0
- /package/{scripts → src/scripts}/chat_history.py +0 -0
- /package/{scripts → src/scripts}/check_council_layout.py +0 -0
- /package/{scripts → src/scripts}/check_iron_law_prominence.py +0 -0
- /package/{scripts → src/scripts}/check_kernel_rule_bundle.py +0 -0
- /package/{scripts → src/scripts}/check_md_language.py +0 -0
- /package/{scripts → src/scripts}/check_no_local_settings_committed.py +0 -0
- /package/{scripts → src/scripts}/check_proposal.py +0 -0
- /package/{scripts → src/scripts}/check_release_trunk_sync.py +0 -0
- /package/{scripts → src/scripts}/ci_status.py +0 -0
- /package/{scripts → src/scripts}/ci_summary.py +0 -0
- /package/{scripts → src/scripts}/cleanup_other_scope.sh +0 -0
- /package/{scripts → src/scripts}/command_suggester/__init__.py +0 -0
- /package/{scripts → src/scripts}/command_suggester/cooldown.py +0 -0
- /package/{scripts → src/scripts}/command_suggester/loader.py +0 -0
- /package/{scripts → src/scripts}/command_suggester/match.py +0 -0
- /package/{scripts → src/scripts}/command_suggester/rank.py +0 -0
- /package/{scripts → src/scripts}/command_suggester/render.py +0 -0
- /package/{scripts → src/scripts}/command_suggester/sanitize.py +0 -0
- /package/{scripts → src/scripts}/command_suggester/settings.py +0 -0
- /package/{scripts → src/scripts}/command_suggester/types.py +0 -0
- /package/{scripts → src/scripts}/condense.sh +0 -0
- /package/{scripts → src/scripts}/config/__init__.py +0 -0
- /package/{scripts → src/scripts}/config/presets.py +0 -0
- /package/{scripts → src/scripts}/context_hygiene_hook.py +0 -0
- /package/{scripts → src/scripts}/cost/budget.mjs +0 -0
- /package/{scripts → src/scripts}/cost/preflight.mjs +0 -0
- /package/{scripts → src/scripts}/cost/track.mjs +0 -0
- /package/{scripts → src/scripts}/council_prune.py +0 -0
- /package/{scripts → src/scripts}/count_token_optimizer_usage.sh +0 -0
- /package/{scripts → src/scripts}/expected_perms.json +0 -0
- /package/{scripts → src/scripts}/first-run.sh +0 -0
- /package/{scripts → src/scripts}/ghostwriter_fixture_allowlist.txt +0 -0
- /package/{scripts → src/scripts}/hermetic-install.sh +0 -0
- /package/{scripts → src/scripts}/hooks/__init__.py +0 -0
- /package/{scripts → src/scripts}/hooks/augment-chat-history.sh +0 -0
- /package/{scripts → src/scripts}/hooks/augment-context-hygiene.sh +0 -0
- /package/{scripts → src/scripts}/hooks/augment-dispatcher.sh +0 -0
- /package/{scripts → src/scripts}/hooks/augment-onboarding-gate.sh +0 -0
- /package/{scripts → src/scripts}/hooks/augment-roadmap-progress.sh +0 -0
- /package/{scripts → src/scripts}/hooks/cline-dispatcher.sh +0 -0
- /package/{scripts → src/scripts}/hooks/cowork-dispatcher.sh +0 -0
- /package/{scripts → src/scripts}/hooks/cursor-dispatcher.sh +0 -0
- /package/{scripts → src/scripts}/hooks/dispatch_issues.py +0 -0
- /package/{scripts → src/scripts}/hooks/envelope.py +0 -0
- /package/{scripts → src/scripts}/hooks/gemini-dispatcher.sh +0 -0
- /package/{scripts → src/scripts}/hooks/state_io.py +0 -0
- /package/{scripts → src/scripts}/hooks/windsurf-dispatcher.sh +0 -0
- /package/{scripts → src/scripts}/install_anthropic_key.sh +0 -0
- /package/{scripts → src/scripts}/install_openai_key.sh +0 -0
- /package/{scripts → src/scripts}/lint_global_paths.py +0 -0
- /package/{scripts → src/scripts}/lint_readme_jargon.py +0 -0
- /package/{scripts → src/scripts}/lint_readme_size.py +0 -0
- /package/{scripts → src/scripts}/mcp_render.py +0 -0
- /package/{scripts → src/scripts}/mcp_server/__main__.py +0 -0
- /package/{scripts → src/scripts}/mcp_server/catalog.py +0 -0
- /package/{scripts → src/scripts}/mcp_server/metadata.py +0 -0
- /package/{scripts → src/scripts}/mcp_server/requirements.txt +0 -0
- /package/{scripts → src/scripts}/mcp_server/server.py +0 -0
- /package/{scripts → src/scripts}/mcp_server/telemetry.py +0 -0
- /package/{scripts → src/scripts}/mcp_setup.sh +0 -0
- /package/{scripts → src/scripts}/mcp_telemetry_health.py +0 -0
- /package/{scripts → src/scripts}/mcp_telemetry_query.py +0 -0
- /package/{scripts → src/scripts}/mcp_telemetry_store.py +0 -0
- /package/{scripts → src/scripts}/memory_hash.py +0 -0
- /package/{scripts → src/scripts}/minimal_safe_diff_hook.py +0 -0
- /package/{scripts → src/scripts}/onboarding_gate_hook.py +0 -0
- /package/{scripts → src/scripts}/prediction-pool/adapters/_schema.md +0 -0
- /package/{scripts → src/scripts}/prediction-pool/adapters/kicktipp.yml +0 -0
- /package/{scripts → src/scripts}/prediction-pool/poisson_sim.py +0 -0
- /package/{scripts → src/scripts}/prediction-pool/pool_winsim.py +0 -0
- /package/{scripts → src/scripts}/prediction-pool/score_ev.py +0 -0
- /package/{scripts → src/scripts}/prepack-check.mjs +0 -0
- /package/{scripts → src/scripts}/probe_skill_registration.py +0 -0
- /package/{scripts → src/scripts}/propose_modules_config.py +0 -0
- /package/{scripts → src/scripts}/readme_linter.py +0 -0
- /package/{scripts → src/scripts}/redact_hook_capture.py +0 -0
- /package/{scripts → src/scripts}/requirements-evals.txt +0 -0
- /package/{scripts → src/scripts}/runtime_dispatcher.py +0 -0
- /package/{scripts → src/scripts}/runtime_handler.py +0 -0
- /package/{scripts → src/scripts}/schemas/agent-settings.schema.json +0 -0
- /package/{scripts → src/scripts}/schemas/persona.schema.json +0 -0
- /package/{scripts → src/scripts}/schemas/skill.schema.json +0 -0
- /package/{scripts → src/scripts}/schemas/user-type-axis.schema.json +0 -0
- /package/{scripts → src/scripts}/schemas/user-type.schema.json +0 -0
- /package/{scripts → src/scripts}/setup_eval_venv.sh +0 -0
- /package/{scripts → src/scripts}/skill_tools/__init__.py +0 -0
- /package/{scripts → src/scripts}/sync_yaml_rt.py +0 -0
- /package/{scripts → src/scripts}/tool_registry.py +0 -0
- /package/{scripts → src/scripts}/tools/__init__.py +0 -0
- /package/{scripts → src/scripts}/tools/adapter_errors.py +0 -0
- /package/{scripts → src/scripts}/tools/base_adapter.py +0 -0
- /package/{scripts → src/scripts}/tools/github_adapter.py +0 -0
- /package/{scripts → src/scripts}/tools/jira_adapter.py +0 -0
- /package/{scripts → src/scripts}/update-github-metadata.sh +0 -0
- /package/{scripts → src/scripts}/validate_safe_paths.py +0 -0
- /package/{scripts → src/scripts}/validate_telegraph_carveouts.py +0 -0
- /package/{scripts → src/scripts}/verify_before_complete_hook.py +0 -0
- /package/{templates → src/templates}/agent-config-wrapper.sh +0 -0
- /package/{templates → src/templates}/agent-user.md +0 -0
- /package/{templates → src/templates}/agent-user.yml +0 -0
- /package/{templates → src/templates}/claude_desktop_config.json.template +0 -0
- /package/{templates → src/templates}/consumer-settings/ONBOARDING.md +0 -0
- /package/{templates → src/templates}/consumer-settings/README.md +0 -0
- /package/{templates → src/templates}/consumer-settings/augment-cli-hooks.json +0 -0
- /package/{templates → src/templates}/consumer-settings/augment-settings.json +0 -0
- /package/{templates → src/templates}/consumer-settings/claude-settings.json +0 -0
- /package/{templates → src/templates}/consumer-settings/copilot-settings.json +0 -0
- /package/{templates → src/templates}/cursor-rule.mdc.j2 +0 -0
- /package/{templates → src/templates}/marketing-copy.yml +0 -0
- /package/{templates → src/templates}/minimal/.agent-settings.yml +0 -0
- /package/{templates → src/templates}/minimal/agents-overrides-readme.md +0 -0
- /package/{templates → src/templates}/minimal/overrides-gitkeep +0 -0
- /package/{templates → src/templates}/windsurf-rule.md.j2 +0 -0
|
@@ -0,0 +1,3694 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Minimal skill/rule linter for agent-config repositories.
|
|
4
|
+
|
|
5
|
+
MVP checks:
|
|
6
|
+
- Detect skill vs rule
|
|
7
|
+
- Required skill sections
|
|
8
|
+
- Basic rule validation
|
|
9
|
+
- Vague validation detection
|
|
10
|
+
- Output format presence
|
|
11
|
+
- Gotchas / Do NOT presence
|
|
12
|
+
- Single file, --all, --changed
|
|
13
|
+
- Text and JSON output
|
|
14
|
+
|
|
15
|
+
Exit codes:
|
|
16
|
+
0 = pass
|
|
17
|
+
1 = warnings only
|
|
18
|
+
2 = errors
|
|
19
|
+
3 = internal error
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import argparse
|
|
25
|
+
import json
|
|
26
|
+
import re
|
|
27
|
+
import subprocess
|
|
28
|
+
import sys
|
|
29
|
+
from dataclasses import dataclass, asdict
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
from typing import Iterable, List, Literal, Optional
|
|
32
|
+
|
|
33
|
+
# Sibling module — stdlib-only frontmatter schema validator.
|
|
34
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
35
|
+
from validate_frontmatter import ( # noqa: E402
|
|
36
|
+
apply_schema_defaults,
|
|
37
|
+
parse_frontmatter as parse_frontmatter_for_schema,
|
|
38
|
+
load_schema,
|
|
39
|
+
validate as validate_against_schema,
|
|
40
|
+
)
|
|
41
|
+
from _lib.agent_src import artefact_roots, resolve_logical # noqa: E402
|
|
42
|
+
|
|
43
|
+
Severity = Literal["error", "warning", "info"]
|
|
44
|
+
ArtifactType = Literal["skill", "rule", "command", "guideline", "persona", "user-type", "unknown"]
|
|
45
|
+
|
|
46
|
+
REQUIRED_PERSONA_SECTIONS_CORE = [
|
|
47
|
+
"Focus",
|
|
48
|
+
"Mindset",
|
|
49
|
+
"Unique Questions",
|
|
50
|
+
"Output Expectations",
|
|
51
|
+
"Anti-Patterns",
|
|
52
|
+
]
|
|
53
|
+
REQUIRED_PERSONA_SECTIONS_SPECIALIST = REQUIRED_PERSONA_SECTIONS_CORE + [
|
|
54
|
+
"Critical Rules",
|
|
55
|
+
"Workflows",
|
|
56
|
+
]
|
|
57
|
+
# Back-compat alias — used by tier-agnostic callers; defaults to the core spine.
|
|
58
|
+
REQUIRED_PERSONA_SECTIONS = REQUIRED_PERSONA_SECTIONS_CORE
|
|
59
|
+
VALID_PERSONA_TIERS = {"core", "specialist"}
|
|
60
|
+
# Locked in docs/contracts/persona-schema.md § 4: core ≤ 120, specialist ≤ 100.
|
|
61
|
+
PERSONA_LINE_BUDGETS = {"core": 120, "specialist": 100}
|
|
62
|
+
|
|
63
|
+
# User-type spine — locked in docs/contracts/user-type-schema.md § 3.
|
|
64
|
+
# Runtime end-user simulation lens (sister axis to personas — methodology vs
|
|
65
|
+
# end-user). Single tier in v1 (no core/specialist split).
|
|
66
|
+
REQUIRED_USERTYPE_SECTIONS = [
|
|
67
|
+
"Focus",
|
|
68
|
+
"Daily Workflow",
|
|
69
|
+
"Vocabulary",
|
|
70
|
+
"Operational Constraints",
|
|
71
|
+
"Unique Questions",
|
|
72
|
+
"Ticket Red Flags",
|
|
73
|
+
"Anti-Patterns",
|
|
74
|
+
]
|
|
75
|
+
USERTYPE_LINE_BUDGET = 120
|
|
76
|
+
# Wing-scoped overrides — Wing-3 (GTM) and Wing-4 (Money/Strategy/Ops) carry
|
|
77
|
+
# denser cognition (funnel × channel × lifecycle, or finance × org × strategy)
|
|
78
|
+
# than Wing-1/2 specialists, so the line cap rises to keep the seven-section
|
|
79
|
+
# spine intact without amputating workflows. Persona-schema.md § 4 wing matrix.
|
|
80
|
+
VALID_PERSONA_WINGS = {1, 2, 3, 4}
|
|
81
|
+
PERSONA_LINE_BUDGETS_BY_WING = {
|
|
82
|
+
("specialist", 3): 140,
|
|
83
|
+
("specialist", 4): 140,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
REQUIRED_SKILL_SECTIONS = [
|
|
88
|
+
"When to use",
|
|
89
|
+
"Gotcha",
|
|
90
|
+
"Procedure",
|
|
91
|
+
"Output format",
|
|
92
|
+
"Do NOT",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
# Aliases: linter accepts any of these as matching the required section
|
|
96
|
+
SECTION_ALIASES = {
|
|
97
|
+
"Gotcha": {"Gotcha", "Gotchas"},
|
|
98
|
+
"Procedure": set(), # prefix-matched separately
|
|
99
|
+
"Do NOT": {"Do NOT", "Do not", "Anti-patterns"},
|
|
100
|
+
"Output format": {"Output format", "Output"},
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
RECOMMENDED_SKILL_SECTIONS: list[str] = []
|
|
104
|
+
|
|
105
|
+
RULE_BAD_SIGNS = [
|
|
106
|
+
"## Procedure",
|
|
107
|
+
"## Output format",
|
|
108
|
+
"## Gotchas",
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
# --- Frugality charter validator (see road-to-token-frugality Phase 0.4) ---
|
|
112
|
+
# Layer 1 = writer-cite check (every writer skill carries the section + link).
|
|
113
|
+
# Layer 2 = charter index integrity (the four canonical rules referenced by
|
|
114
|
+
# the charter resolve to real H2/H3 anchors in the rule files).
|
|
115
|
+
|
|
116
|
+
FRUGALITY_WRITER_SKILLS = {
|
|
117
|
+
"skill-writing", "rule-writing", "command-writing",
|
|
118
|
+
"guideline-writing", "context-authoring", "agent-docs-writing",
|
|
119
|
+
"conventional-commits-writing", "readme-writing",
|
|
120
|
+
"readme-writing-package", "adr-create",
|
|
121
|
+
"persona-writing", "roadmap-writing", "script-writing",
|
|
122
|
+
}
|
|
123
|
+
FRUGALITY_CHARTER_RELPATH = "contexts/communication/frugality-charter.md"
|
|
124
|
+
FRUGALITY_CHARTER_INDEX_RULES = {
|
|
125
|
+
"direct-answers.md": "iron-law-3",
|
|
126
|
+
"user-interaction.md": "iron-law-1",
|
|
127
|
+
"no-cheap-questions.md": "pre-send-self-check",
|
|
128
|
+
"token-efficiency.md": "the-iron-laws",
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
VAGUE_VALIDATION_PATTERNS = [
|
|
132
|
+
r"\bcheck if it works\b",
|
|
133
|
+
r"\bverify it works\b",
|
|
134
|
+
r"\btest manually\b",
|
|
135
|
+
r"\bcheck manually\b",
|
|
136
|
+
r"\bmake sure it works\b",
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
TRIGGER_WARNING_PATTERNS = [
|
|
140
|
+
r"\bgeneral helper\b",
|
|
141
|
+
r"\blaravel skill\b",
|
|
142
|
+
r"\bgeneral coding\b",
|
|
143
|
+
r"\beverything about\b",
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
ORDERED_STEP_PATTERN = re.compile(r"^(?:\s*|\#{1,4}\s*)(\d+)\.\s+", re.MULTILINE)
|
|
147
|
+
SECTION_PATTERN = re.compile(r"^##\s+(.+?)\s*$", re.MULTILINE)
|
|
148
|
+
FRONTMATTER_PATTERN = re.compile(r"^---\n(.*?)\n---\n", re.DOTALL)
|
|
149
|
+
DESCRIPTION_PATTERN = re.compile(r'^description:\s*"?(.*?)"?\s*$', re.MULTILINE)
|
|
150
|
+
TYPE_PATTERN = re.compile(r'^type:\s*"?(always|auto|manual)"?\s*$', re.MULTILINE)
|
|
151
|
+
SOURCE_PATTERN = re.compile(r'^source:\s*"?(package|project)"?\s*$', re.MULTILINE)
|
|
152
|
+
STATUS_PATTERN = re.compile(r'^status:\s*"?(active|deprecated|superseded)"?\s*$', re.MULTILINE)
|
|
153
|
+
REPLACED_BY_PATTERN = re.compile(r'^replaced_by:\s*"?([\w-]+)"?\s*$', re.MULTILINE)
|
|
154
|
+
TIER_PATTERN = re.compile(r'^tier:\s*"?([\w-]+)"?\s*$', re.MULTILINE)
|
|
155
|
+
|
|
156
|
+
# --- Senior-tier required-block patterns (skill-quality.md § Senior-Tier Required Structure) ---
|
|
157
|
+
# Heading-only checks; detail-shape lives in skill-quality-mechanics.md.
|
|
158
|
+
SENIOR_RELATED_SKILLS_PATTERN = re.compile(r"^##\s+Related Skills\s*$", re.MULTILINE)
|
|
159
|
+
SENIOR_RELATED_WHEN_PATTERN = re.compile(r"\*\*WHEN to use this\*\*", re.IGNORECASE)
|
|
160
|
+
SENIOR_RELATED_WHEN_NOT_PATTERN = re.compile(r"\*\*WHEN NOT to use this\*\*", re.IGNORECASE)
|
|
161
|
+
SENIOR_PROACTIVE_PATTERN = re.compile(
|
|
162
|
+
r"^##\s+When the agent should load this\s*$", re.MULTILINE
|
|
163
|
+
)
|
|
164
|
+
SENIOR_OUTPUT_PATTERN = re.compile(r"^##\s+Output\s*$", re.MULTILINE)
|
|
165
|
+
H1_PATTERN = re.compile(r"^# .+", re.MULTILINE)
|
|
166
|
+
DOUBLE_BLANK_PATTERN = re.compile(r"\n{3,}")
|
|
167
|
+
|
|
168
|
+
VALID_RULE_TYPES = {"always", "auto", "manual"}
|
|
169
|
+
VALID_RULE_SOURCES = {"package", "project"}
|
|
170
|
+
VALID_STATUSES = {"active", "deprecated", "superseded"}
|
|
171
|
+
|
|
172
|
+
# --- Router schema (docs/contracts/rule-router.md) ---
|
|
173
|
+
ROUTER_ALLOWED_TRIGGER_KEYS = {"keyword", "phrase", "intent", "file_pattern",
|
|
174
|
+
"path_prefix", "command"}
|
|
175
|
+
ROUTER_ALLOWED_PROFILES = {"minimal", "balanced", "full"}
|
|
176
|
+
KERNEL_RULE_IDS: set[str] = {
|
|
177
|
+
"agent-authority", "ask-when-uncertain", "commit-policy",
|
|
178
|
+
"direct-answers", "language-and-tone", "no-cheap-questions",
|
|
179
|
+
"non-destructive-by-default", "scope-control",
|
|
180
|
+
"verify-before-complete",
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
# --- Runtime execution metadata constants ---
|
|
184
|
+
VALID_EXECUTION_TYPES = {"manual", "assisted", "automated"}
|
|
185
|
+
VALID_EXECUTION_HANDLERS = {"none", "shell", "php", "node", "internal"}
|
|
186
|
+
VALID_EXECUTION_SAFETY_MODES = {"strict"}
|
|
187
|
+
VALID_EXECUTION_FIELDS = {"type", "handler", "timeout_seconds", "safety_mode", "allowed_tools", "command"}
|
|
188
|
+
|
|
189
|
+
# --- Wing-3 GTM cognition-boundary patterns (council Q7 / iter-2 OQ3) ---
|
|
190
|
+
# Triggered only when a skill's context_spine declares a Wing-3 slot.
|
|
191
|
+
# See docs/contracts/adr-gtm-context-spine.md and
|
|
192
|
+
# agents/roadmaps/road-to-gtm-and-growth.md § G2.
|
|
193
|
+
WING3_SPINE_SLOTS = {"channel-stage", "funnel-stage", "customer-segment"}
|
|
194
|
+
|
|
195
|
+
CONTEXT_SPINE_INLINE_PATTERN = re.compile(
|
|
196
|
+
r'^context_spine:\s*\[(.*?)\]\s*$', re.MULTILINE
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
# agent-operability: external SaaS URLs the agent would have to auth against
|
|
200
|
+
WING3_SAAS_URL_PATTERN = re.compile(
|
|
201
|
+
r"https?://[\w.-]*\.(salesforce|hubspot|marketo|pardot|mailchimp|"
|
|
202
|
+
r"intercom|amplitude|mixpanel|segment|klaviyo|sendgrid|mailgun|"
|
|
203
|
+
r"pendo|gong|outreach|salesloft|apollo)\.(com|io)\b",
|
|
204
|
+
re.IGNORECASE,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
# vendor-independence: brand / SDK / platform slugs that lock cognition
|
|
208
|
+
WING3_VENDOR_BLACKLIST = re.compile(
|
|
209
|
+
r"\b(salesforce|hubspot|marketo|pardot|mailchimp|intercom|drift|"
|
|
210
|
+
r"klaviyo|sendgrid|mailgun|amplitude|mixpanel|pendo|gong|"
|
|
211
|
+
r"outreach\.io|salesloft|apollo\.io|zendesk|freshworks)\b",
|
|
212
|
+
re.IGNORECASE,
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
# transferability: stack-locked tooling instructions
|
|
216
|
+
WING3_STACK_LOCKED_PATTERN = re.compile(
|
|
217
|
+
r"\b(npm install|pip install|composer require|gem install|"
|
|
218
|
+
r"cargo add|yarn add|pnpm add|bundle add)\s+[\w@/.-]+",
|
|
219
|
+
re.IGNORECASE,
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
# channel-agnosticism: channel-specific tactical prescriptions
|
|
223
|
+
WING3_CHANNEL_TACTIC_PATTERN = re.compile(
|
|
224
|
+
r"\b(email subject line|tweet length|linkedin (post|ad)|"
|
|
225
|
+
r"facebook ad|google ads?|tiktok (post|video)|instagram (post|reel)|"
|
|
226
|
+
r"sms character limit|cold email template)\b",
|
|
227
|
+
re.IGNORECASE,
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
# --- Wing-4 Money/Strategy/Ops cognition-boundary patterns (council Q7 / J2) ---
|
|
231
|
+
# Triggered only when a skill's context_spine declares a Wing-4 slot.
|
|
232
|
+
# See docs/contracts/adr-wing4-context-spine.md and
|
|
233
|
+
# agents/roadmaps/road-to-money-strategy-ops.md § J2.
|
|
234
|
+
WING4_SPINE_SLOTS = {"fiscal-period", "org-stage", "regulatory-regime"}
|
|
235
|
+
|
|
236
|
+
# agent-operability: external finance / HR / legal SaaS URLs
|
|
237
|
+
WING4_SAAS_URL_PATTERN = re.compile(
|
|
238
|
+
r"https?://[\w.-]*\.(quickbooks|intuit|netsuite|xero|sage|"
|
|
239
|
+
r"carta|pulley|gusto|bamboohr|lattice|15five|justworks|"
|
|
240
|
+
r"docusign|ironclad|onetrust|rippling|workday|deel|"
|
|
241
|
+
r"namely|adp|paychex|trinet|hibob|cultureamp)\.(com|io|co)\b",
|
|
242
|
+
re.IGNORECASE,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
# vendor-independence: finance / HR / legal brand / SDK slugs
|
|
246
|
+
WING4_VENDOR_BLACKLIST = re.compile(
|
|
247
|
+
r"\b(quickbooks|netsuite|xero|sage intacct|"
|
|
248
|
+
r"carta|pulley|gusto|bamboohr|lattice|15five|justworks|"
|
|
249
|
+
r"docusign|ironclad|onetrust|rippling|workday|deel|"
|
|
250
|
+
r"namely|adp|paychex|trinet|hibob|culture amp)\b",
|
|
251
|
+
re.IGNORECASE,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
# stage-agnosticism: prescriptive stage-specific thresholds that lock cognition
|
|
255
|
+
# Catches hardcoded runway / ARR / burn / team-size prescriptions tied to a
|
|
256
|
+
# specific funding stage. Framework-style framing ("read the org-stage slot",
|
|
257
|
+
# "applies across seed and public") passes; hard prescriptions ("18 months of
|
|
258
|
+
# runway", "Series A teams must hire") fire.
|
|
259
|
+
WING4_STAGE_AGNOSTIC_PATTERN = re.compile(
|
|
260
|
+
r"(?:"
|
|
261
|
+
r"\b\d+\s+months?\s+of\s+runway\b"
|
|
262
|
+
r"|\brunway\s+of\s+at\s+least\s+\d+\s+months?\b"
|
|
263
|
+
r"|\bminimum\s+runway\s+of\s+\d+\b"
|
|
264
|
+
r"|\b(?:seed|series\s+[a-d]|growth|pre-?ipo|post-?ipo)[-\s]stage\s+"
|
|
265
|
+
r"(?:companies|startups|teams|founders|orgs)\s+(?:must|should|always|never)\b"
|
|
266
|
+
r"|\bteam\s+of\s+\d+\s+(?:or\s+more|or\s+fewer)\b"
|
|
267
|
+
r"|\b(?:arr|mrr|burn\s+rate)\s+(?:of|over|under|above|below)\s+\$\d+"
|
|
268
|
+
r")",
|
|
269
|
+
re.IGNORECASE,
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
@dataclass
|
|
274
|
+
class Issue:
|
|
275
|
+
severity: Severity
|
|
276
|
+
code: str
|
|
277
|
+
message: str
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
@dataclass
|
|
281
|
+
class LintResult:
|
|
282
|
+
file: str
|
|
283
|
+
artifact_type: ArtifactType
|
|
284
|
+
status: Literal["pass", "pass_with_warnings", "fail"]
|
|
285
|
+
issues: List[Issue]
|
|
286
|
+
suggestions: List[str]
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def read_text(path: Path) -> str:
|
|
290
|
+
return path.read_text(encoding="utf-8")
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
# --- Role-contract anchor cache (see road-to-role-modes Phase 1) ---
|
|
294
|
+
# Populated lazily so the linter stays fast when the guideline is absent.
|
|
295
|
+
_ROLE_CONTRACT_CANDIDATES = (
|
|
296
|
+
Path("docs/guidelines/agent-infra/role-contracts.md"),
|
|
297
|
+
)
|
|
298
|
+
_ROLE_CONTRACT_SLUGS_CACHE: Optional[set[str]] = None
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def _load_role_contract_slugs() -> set[str]:
|
|
302
|
+
"""Return the set of H3 mode slugs defined in role-contracts.md.
|
|
303
|
+
|
|
304
|
+
Empty set if the guideline cannot be found — callers MUST treat an
|
|
305
|
+
empty cache as "no data" and skip the check rather than flagging
|
|
306
|
+
every reference as broken.
|
|
307
|
+
"""
|
|
308
|
+
global _ROLE_CONTRACT_SLUGS_CACHE
|
|
309
|
+
if _ROLE_CONTRACT_SLUGS_CACHE is not None:
|
|
310
|
+
return _ROLE_CONTRACT_SLUGS_CACHE
|
|
311
|
+
slugs: set[str] = set()
|
|
312
|
+
for candidate in _ROLE_CONTRACT_CANDIDATES:
|
|
313
|
+
if not candidate.exists():
|
|
314
|
+
continue
|
|
315
|
+
try:
|
|
316
|
+
text = candidate.read_text(encoding="utf-8")
|
|
317
|
+
except OSError:
|
|
318
|
+
continue
|
|
319
|
+
in_skeletons = False
|
|
320
|
+
for line in text.splitlines():
|
|
321
|
+
if line.startswith("## "):
|
|
322
|
+
in_skeletons = line.strip().lower().startswith(
|
|
323
|
+
"## contract skeletons"
|
|
324
|
+
)
|
|
325
|
+
continue
|
|
326
|
+
if in_skeletons and line.startswith("### "):
|
|
327
|
+
name = line[4:].strip().lower()
|
|
328
|
+
slugs.add(re.sub(r"[^a-z0-9]+", "-", name).strip("-"))
|
|
329
|
+
if slugs:
|
|
330
|
+
break
|
|
331
|
+
_ROLE_CONTRACT_SLUGS_CACHE = slugs
|
|
332
|
+
return slugs
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
_ROLE_CONTRACT_REF_PATTERN = re.compile(
|
|
336
|
+
r"role-contracts\.md#([a-z0-9][a-z0-9-]*)", re.IGNORECASE
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def lint_role_contract_refs(text: str) -> List[Issue]:
|
|
341
|
+
"""Warn if a file references `role-contracts.md#<slug>` for a mode
|
|
342
|
+
that does not exist as an H3 heading in the guideline. No-op when
|
|
343
|
+
the guideline is missing or declares no modes (bootstrap safety).
|
|
344
|
+
"""
|
|
345
|
+
slugs = _load_role_contract_slugs()
|
|
346
|
+
if not slugs:
|
|
347
|
+
return []
|
|
348
|
+
issues: List[Issue] = []
|
|
349
|
+
seen: set[str] = set()
|
|
350
|
+
for match in _ROLE_CONTRACT_REF_PATTERN.finditer(text):
|
|
351
|
+
slug = match.group(1).lower()
|
|
352
|
+
if slug in seen:
|
|
353
|
+
continue
|
|
354
|
+
seen.add(slug)
|
|
355
|
+
if slug not in slugs:
|
|
356
|
+
issues.append(Issue(
|
|
357
|
+
"warning", "unknown_role_contract",
|
|
358
|
+
f"References role-contracts.md#{slug} but no such "
|
|
359
|
+
f"mode is defined in the guideline (known: "
|
|
360
|
+
f"{', '.join(sorted(slugs))})",
|
|
361
|
+
))
|
|
362
|
+
return issues
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def extract_sections(text: str) -> set[str]:
|
|
366
|
+
return {match.group(1).strip() for match in SECTION_PATTERN.finditer(text)}
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
def _count_code_blocks(text: str) -> int:
|
|
370
|
+
"""Return the number of fenced code blocks (``` … ```) in *text*."""
|
|
371
|
+
fence_count = 0
|
|
372
|
+
for line in text.splitlines():
|
|
373
|
+
stripped = line.lstrip()
|
|
374
|
+
if stripped.startswith("```"):
|
|
375
|
+
fence_count += 1
|
|
376
|
+
return fence_count // 2
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
def _fenced_content_ratio(text: str) -> float:
|
|
380
|
+
"""Return the fraction of non-empty lines that sit inside fenced blocks.
|
|
381
|
+
|
|
382
|
+
Retained as a helper for backwards compatibility; the size gates use
|
|
383
|
+
:func:`_density_score` from the structural model instead (Phase 3 of
|
|
384
|
+
road-to-structural-linter-reform).
|
|
385
|
+
"""
|
|
386
|
+
inside = False
|
|
387
|
+
fenced_lines = 0
|
|
388
|
+
non_empty = 0
|
|
389
|
+
for line in text.splitlines():
|
|
390
|
+
stripped = line.strip()
|
|
391
|
+
if stripped.startswith("```"):
|
|
392
|
+
inside = not inside
|
|
393
|
+
if stripped:
|
|
394
|
+
non_empty += 1
|
|
395
|
+
continue
|
|
396
|
+
if stripped:
|
|
397
|
+
non_empty += 1
|
|
398
|
+
if inside:
|
|
399
|
+
fenced_lines += 1
|
|
400
|
+
if non_empty == 0:
|
|
401
|
+
return 0.0
|
|
402
|
+
return fenced_lines / non_empty
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
# --- Structural-density model (docs/contracts/linter-structural-model.md) ---
|
|
406
|
+
# Replaces the raw line/word/fenced-ratio gates with four primitives that
|
|
407
|
+
# distinguish complexity from bloat. Calibrated 2026-05-08 against the full
|
|
408
|
+
# 310-artefact corpus (agents/runtime/density/snapshot.jsonl).
|
|
409
|
+
|
|
410
|
+
PROCEDURE_HEADING_PATTERN = re.compile(
|
|
411
|
+
r"^##\s+Procedure(\s*[:\u2014\-].*)?\s*$", re.MULTILINE
|
|
412
|
+
)
|
|
413
|
+
COMMAND_FRONTMATTER_DELEGATION_KEYS = ("cluster:", "routes_to:")
|
|
414
|
+
MD_LINK_PATTERN = re.compile(r"\[[^\]]+\]\(([^)]+\.md[^)]*)\)")
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def _density_score(text: str) -> float:
|
|
418
|
+
"""Return structural density 0.0–1.0 — see docs/contracts/linter-structural-model.md.
|
|
419
|
+
|
|
420
|
+
density = structured_lines / non_blank_lines, where structured_lines =
|
|
421
|
+
fenced + table + bullet + numbered + heading. Higher = more structured
|
|
422
|
+
(catalogue, table, code, list); lower = prose-dominant.
|
|
423
|
+
"""
|
|
424
|
+
inside_fence = False
|
|
425
|
+
structured = 0
|
|
426
|
+
non_blank = 0
|
|
427
|
+
for raw in text.splitlines():
|
|
428
|
+
stripped = raw.strip()
|
|
429
|
+
if not stripped:
|
|
430
|
+
continue
|
|
431
|
+
non_blank += 1
|
|
432
|
+
if stripped.startswith("```"):
|
|
433
|
+
inside_fence = not inside_fence
|
|
434
|
+
structured += 1
|
|
435
|
+
continue
|
|
436
|
+
if inside_fence:
|
|
437
|
+
structured += 1
|
|
438
|
+
continue
|
|
439
|
+
if stripped.startswith("#"):
|
|
440
|
+
structured += 1
|
|
441
|
+
continue
|
|
442
|
+
if stripped.startswith("|") and stripped.endswith("|"):
|
|
443
|
+
structured += 1
|
|
444
|
+
continue
|
|
445
|
+
if stripped.startswith(("- ", "* ", "+ ")):
|
|
446
|
+
structured += 1
|
|
447
|
+
continue
|
|
448
|
+
if re.match(r"^\d+\.\s", stripped):
|
|
449
|
+
structured += 1
|
|
450
|
+
continue
|
|
451
|
+
if non_blank == 0:
|
|
452
|
+
return 0.0
|
|
453
|
+
return round(structured / non_blank, 3)
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
def _count_procedure_sections(text: str) -> int:
|
|
457
|
+
"""Count `## Procedure` (or `## Procedure: <name>`) blocks in *text*."""
|
|
458
|
+
return len(PROCEDURE_HEADING_PATTERN.findall(text))
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def _command_delegation_signal(text: str, frontmatter: Optional[str]) -> bool:
|
|
462
|
+
"""Return True when a command has a delegation signal.
|
|
463
|
+
|
|
464
|
+
Signals: frontmatter declares ``cluster:`` or ``routes_to:`` — OR — the
|
|
465
|
+
body contains ≥ 3 markdown links to other ``.md`` files. Either signal
|
|
466
|
+
is sufficient (council review 2026-05-08).
|
|
467
|
+
"""
|
|
468
|
+
if frontmatter:
|
|
469
|
+
for key in COMMAND_FRONTMATTER_DELEGATION_KEYS:
|
|
470
|
+
if re.search(rf"^{re.escape(key)}", frontmatter, re.MULTILINE):
|
|
471
|
+
return True
|
|
472
|
+
if len(MD_LINK_PATTERN.findall(text)) >= 3:
|
|
473
|
+
return True
|
|
474
|
+
return False
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
def _strip_markdown_for_check(text: str) -> str:
|
|
478
|
+
"""Strip fenced code, inline code spans, and markdown links so heuristic
|
|
479
|
+
regex matches operate on prose only.
|
|
480
|
+
|
|
481
|
+
Used by rule-body heuristics whose targets (e.g. ``procedural_rule``)
|
|
482
|
+
must not flip on legitimate skill pointers like ``[git-workflow](…)``
|
|
483
|
+
or ``` `skill:symfony-workflow` ```. Frontmatter is handled by the
|
|
484
|
+
caller via ``text.split("---", 2)[-1]``.
|
|
485
|
+
"""
|
|
486
|
+
text = re.sub(r"```[^\n]*\n.*?```", "", text, flags=re.DOTALL)
|
|
487
|
+
text = re.sub(r"`[^`\n]+`", "", text)
|
|
488
|
+
text = re.sub(r"\[[^\]]*\]\([^)]*\)", "", text)
|
|
489
|
+
return text
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
def _iron_law_blocks(text: str) -> int:
|
|
493
|
+
"""Count fenced blocks that look like verbatim Iron-Law imperatives.
|
|
494
|
+
|
|
495
|
+
Heuristic: fenced block whose body has ≥ 30 alphabetical chars and
|
|
496
|
+
≥ 60 % uppercase across ≥ 1 non-empty line. The 30-char floor filters
|
|
497
|
+
short ALL-CAPS markers (``OK``, ``WIP``); the 60 %-uppercase floor
|
|
498
|
+
catches verbatim imperatives (``NEVER COMMIT.``).
|
|
499
|
+
"""
|
|
500
|
+
blocks = 0
|
|
501
|
+
inside = False
|
|
502
|
+
body: list[str] = []
|
|
503
|
+
for raw in text.splitlines():
|
|
504
|
+
if raw.strip().startswith("```"):
|
|
505
|
+
if inside and body:
|
|
506
|
+
non_empty = [b for b in body if b.strip()]
|
|
507
|
+
letters = "".join(non_empty)
|
|
508
|
+
upper = sum(1 for c in letters if c.isalpha() and c.isupper())
|
|
509
|
+
total = sum(1 for c in letters if c.isalpha())
|
|
510
|
+
if total >= 30 and upper / total >= 0.6 and non_empty:
|
|
511
|
+
blocks += 1
|
|
512
|
+
inside = not inside
|
|
513
|
+
body = []
|
|
514
|
+
continue
|
|
515
|
+
if inside:
|
|
516
|
+
body.append(raw)
|
|
517
|
+
return blocks
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
def extract_description(text: str) -> Optional[str]:
|
|
521
|
+
frontmatter = FRONTMATTER_PATTERN.search(text)
|
|
522
|
+
if not frontmatter:
|
|
523
|
+
return None
|
|
524
|
+
description = DESCRIPTION_PATTERN.search(frontmatter.group(1))
|
|
525
|
+
return description.group(1).strip() if description else None
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
NAME_PATTERN = re.compile(r'^name:\s*"?(.*?)"?\s*$', re.MULTILINE)
|
|
529
|
+
DISABLE_MODEL_PATTERN = re.compile(r'^disable-model-invocation:\s*"?(true|false)"?\s*$', re.MULTILINE)
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
def detect_artifact_type(path: Path, text: str) -> ArtifactType:
|
|
533
|
+
path_str = str(path).lower()
|
|
534
|
+
has_skill_heading = "## When to use" in text and "## Procedure" in text
|
|
535
|
+
|
|
536
|
+
# A file inside a /commands/ tree is a command — the commands tree wins,
|
|
537
|
+
# even for a cluster head literally named `skill.md` or a sub-command under
|
|
538
|
+
# a `skills/` cluster dir (e.g. /commands/skills/discover.md). The only
|
|
539
|
+
# /commands/ file that is NOT a command is a nested skill body, which is
|
|
540
|
+
# always `SKILL.md` (case-sensitive — command files are lowercase).
|
|
541
|
+
if "/commands/" in path_str and path.name != "SKILL.md":
|
|
542
|
+
return "command"
|
|
543
|
+
# Skills: a SKILL.md body, or anything under a /skills/ tree.
|
|
544
|
+
if path.name.lower() == "skill.md" or "/skills/" in path_str:
|
|
545
|
+
return "skill"
|
|
546
|
+
if "/rules/" in path_str:
|
|
547
|
+
return "rule"
|
|
548
|
+
if "/guidelines/" in path_str:
|
|
549
|
+
return "guideline"
|
|
550
|
+
if "/personas/" in path_str:
|
|
551
|
+
return "persona"
|
|
552
|
+
if "/user-types/" in path_str:
|
|
553
|
+
return "user-type"
|
|
554
|
+
if has_skill_heading:
|
|
555
|
+
return "skill"
|
|
556
|
+
return "unknown"
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
def classify_status(issues: List[Issue]) -> Literal["pass", "pass_with_warnings", "fail"]:
|
|
560
|
+
severities = {issue.severity for issue in issues}
|
|
561
|
+
if "error" in severities:
|
|
562
|
+
return "fail"
|
|
563
|
+
if "warning" in severities:
|
|
564
|
+
return "pass_with_warnings"
|
|
565
|
+
return "pass"
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
def extract_section_block(text: str, section_name: str) -> str:
|
|
570
|
+
pattern = re.compile(
|
|
571
|
+
rf"^##\s+{re.escape(section_name)}\s*$" r"(.*?)(?=^##\s+|\Z)",
|
|
572
|
+
re.MULTILINE | re.DOTALL,
|
|
573
|
+
)
|
|
574
|
+
match = pattern.search(text)
|
|
575
|
+
return match.group(1).strip() if match else ""
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
def parse_ordered_list_items(text: str) -> list[str]:
|
|
579
|
+
return [line.strip() for line in text.splitlines() if re.match(r"^\s*\d+\.\s+", line)]
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
def count_bullets(text: str) -> int:
|
|
583
|
+
return sum(1 for line in text.splitlines() if re.match(r"^\s*[*-]\s+", line))
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
def has_validation_step(procedure_block: str) -> bool:
|
|
587
|
+
lowered = procedure_block.lower()
|
|
588
|
+
if "validate" in lowered or "validation" in lowered:
|
|
589
|
+
return True
|
|
590
|
+
good_signals = [
|
|
591
|
+
"expected", "status code", "no errors", "appears in", "exact check", "concrete checks",
|
|
592
|
+
"verify", "confirm", "must pass", "must fail", "assert", "check that", "ensure",
|
|
593
|
+
"run test", "run phpstan", "run ecs", "run rector", "lint", "passes",
|
|
594
|
+
"exit code", "should return", "should contain", "must contain", "must return",
|
|
595
|
+
]
|
|
596
|
+
return any(signal in lowered for signal in good_signals)
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
_INSPECT_VERB_PATTERN = re.compile(
|
|
600
|
+
r"\b(?:"
|
|
601
|
+
# Direct inspection
|
|
602
|
+
r"inspect|examine|audit|survey"
|
|
603
|
+
# Read / look
|
|
604
|
+
r"|read|look\s+at"
|
|
605
|
+
# Check (word-boundary — matches "check that", "check current", "check what")
|
|
606
|
+
r"|check"
|
|
607
|
+
# Review (broad — matches "review existing", "review the failures")
|
|
608
|
+
r"|review"
|
|
609
|
+
# Comprehension / orientation
|
|
610
|
+
r"|understand|identify|analyze|analyse"
|
|
611
|
+
# Discovery
|
|
612
|
+
r"|detect|gather|discover"
|
|
613
|
+
r")\b",
|
|
614
|
+
re.IGNORECASE,
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
def has_inspect_step(procedure_block: str) -> bool:
|
|
619
|
+
"""Return True if the procedure block opens with an inspect / read step.
|
|
620
|
+
|
|
621
|
+
Corpus-driven verb list (see docs/contracts/linter-structural-model.md):
|
|
622
|
+
the first ordered step in a skill procedure should orient the agent in
|
|
623
|
+
the live system — read existing code, examine current state, detect
|
|
624
|
+
stack — before mutating anything. Regex uses word boundaries to avoid
|
|
625
|
+
substring matches inside unrelated words (e.g. ``read`` inside
|
|
626
|
+
``already``).
|
|
627
|
+
"""
|
|
628
|
+
return bool(_INSPECT_VERB_PATTERN.search(procedure_block))
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
def find_vague_validation(text: str) -> list[str]:
|
|
632
|
+
hits: list[str] = []
|
|
633
|
+
for pattern in VAGUE_VALIDATION_PATTERNS:
|
|
634
|
+
for match in re.finditer(pattern, text, re.IGNORECASE):
|
|
635
|
+
hits.append(match.group(0))
|
|
636
|
+
return hits
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
def is_probably_too_broad(text: str, description: Optional[str]) -> bool:
|
|
640
|
+
# Only check description and "When to use" for broad signals — not the entire text
|
|
641
|
+
haystacks: list[str] = []
|
|
642
|
+
if description:
|
|
643
|
+
haystacks.append(description.lower())
|
|
644
|
+
when_block = extract_section_block(text, "When to use")
|
|
645
|
+
if when_block:
|
|
646
|
+
haystacks.append(when_block.lower())
|
|
647
|
+
if not haystacks:
|
|
648
|
+
return False
|
|
649
|
+
combined = "\n".join(haystacks)
|
|
650
|
+
broad_signals = ["everything about", "general purpose", "general-purpose", "all markdown", "helper for everything"]
|
|
651
|
+
return any(signal in combined for signal in broad_signals)
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
def dedupe_preserve_order(items: Iterable[str]) -> list[str]:
|
|
655
|
+
seen: set[str] = set()
|
|
656
|
+
result: list[str] = []
|
|
657
|
+
for item in items:
|
|
658
|
+
if item not in seen:
|
|
659
|
+
seen.add(item)
|
|
660
|
+
result.append(item)
|
|
661
|
+
return result
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
def section_matches(required: str, sections: set[str]) -> bool:
|
|
665
|
+
"""Check if a required section name matches any extracted section, supporting aliases and prefix matching."""
|
|
666
|
+
# Direct match
|
|
667
|
+
if required in sections:
|
|
668
|
+
return True
|
|
669
|
+
# Alias match (e.g. "Gotcha" matches "Gotchas")
|
|
670
|
+
aliases = SECTION_ALIASES.get(required, set())
|
|
671
|
+
if aliases & sections:
|
|
672
|
+
return True
|
|
673
|
+
# Prefix match (e.g. "Procedure" matches "Procedure: Create X")
|
|
674
|
+
for s in sections:
|
|
675
|
+
if s.startswith(required + ":") or s.startswith(required + " "):
|
|
676
|
+
return True
|
|
677
|
+
return False
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
def find_procedure_block(text: str) -> Optional[str]:
|
|
681
|
+
"""Find the procedure section block, supporting prefix-named variants."""
|
|
682
|
+
block = extract_section_block(text, "Procedure")
|
|
683
|
+
if block:
|
|
684
|
+
return block
|
|
685
|
+
# Try prefix match: find "## Procedure: ..." or "## Procedure " headings
|
|
686
|
+
match = re.search(r"^##\s+Procedure[:\s]", text, re.MULTILINE)
|
|
687
|
+
if match:
|
|
688
|
+
# Extract from this heading to the next ## heading
|
|
689
|
+
start = match.end()
|
|
690
|
+
next_heading = re.search(r"^##\s+", text[start:], re.MULTILINE)
|
|
691
|
+
if next_heading:
|
|
692
|
+
return text[start:start + next_heading.start()].strip()
|
|
693
|
+
return text[start:].strip()
|
|
694
|
+
return None
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
def lint_skill(path: Path, text: str) -> LintResult:
|
|
698
|
+
issues: List[Issue] = []
|
|
699
|
+
suggestions: List[str] = []
|
|
700
|
+
|
|
701
|
+
sections = extract_sections(text)
|
|
702
|
+
description = extract_description(text)
|
|
703
|
+
|
|
704
|
+
for section in REQUIRED_SKILL_SECTIONS:
|
|
705
|
+
if not section_matches(section, sections):
|
|
706
|
+
issues.append(Issue("error", "missing_section", f"Missing required section: {section}"))
|
|
707
|
+
|
|
708
|
+
for section in RECOMMENDED_SKILL_SECTIONS:
|
|
709
|
+
if not section_matches(section, sections):
|
|
710
|
+
issues.append(Issue("warning", "missing_recommended_section", f"Missing recommended section: {section}"))
|
|
711
|
+
|
|
712
|
+
if description:
|
|
713
|
+
if len(description) > 200:
|
|
714
|
+
issues.append(Issue("error", "description_too_long",
|
|
715
|
+
f"Description is {len(description)} chars (hard cap: 200) — see road-to-governance-cleanup F6"))
|
|
716
|
+
for pattern in TRIGGER_WARNING_PATTERNS:
|
|
717
|
+
if re.search(pattern, description, re.IGNORECASE):
|
|
718
|
+
issues.append(Issue("warning", "weak_trigger", f"Description looks too generic: {description}"))
|
|
719
|
+
break
|
|
720
|
+
else:
|
|
721
|
+
issues.append(Issue("warning", "missing_description", "Frontmatter description is missing or unreadable"))
|
|
722
|
+
|
|
723
|
+
# --- Bare-noun name check ---
|
|
724
|
+
skill_name = path.parent.name if path.name == "SKILL.md" else path.stem
|
|
725
|
+
if skill_name and "-" not in skill_name and len(skill_name) >= 3:
|
|
726
|
+
# Single word without qualifier — likely too generic
|
|
727
|
+
ALLOWED_BARE_NOUNS = {"database", "devcontainer", "docker", "eloquent", "flux", "forecasting",
|
|
728
|
+
"grafana", "laravel", "livewire", "markitdown", "mcp", "openapi",
|
|
729
|
+
"performance", "security", "terraform", "terragrunt", "traefik",
|
|
730
|
+
"websocket"}
|
|
731
|
+
if skill_name.lower() not in ALLOWED_BARE_NOUNS:
|
|
732
|
+
issues.append(Issue("warning", "bare_noun_name",
|
|
733
|
+
f"Bare-noun skill name `{skill_name}` — consider adding a qualifier (e.g., `{skill_name}-management`)"))
|
|
734
|
+
|
|
735
|
+
# --- Status lifecycle check ---
|
|
736
|
+
frontmatter = extract_frontmatter(text)
|
|
737
|
+
if frontmatter:
|
|
738
|
+
status_match = STATUS_PATTERN.search(frontmatter)
|
|
739
|
+
if status_match:
|
|
740
|
+
status = status_match.group(1)
|
|
741
|
+
if status == "deprecated":
|
|
742
|
+
replaced_by = extract_frontmatter_field(frontmatter, REPLACED_BY_PATTERN)
|
|
743
|
+
msg = f"Skill is deprecated"
|
|
744
|
+
if replaced_by:
|
|
745
|
+
msg += f" (replaced by: {replaced_by})"
|
|
746
|
+
issues.append(Issue("warning", "deprecated_skill", msg))
|
|
747
|
+
elif status == "superseded":
|
|
748
|
+
replaced_by = extract_frontmatter_field(frontmatter, REPLACED_BY_PATTERN)
|
|
749
|
+
msg = f"Skill is superseded — should be removed"
|
|
750
|
+
if replaced_by:
|
|
751
|
+
msg += f" (replaced by: {replaced_by})"
|
|
752
|
+
issues.append(Issue("warning", "superseded_skill", msg))
|
|
753
|
+
|
|
754
|
+
# --- Execution metadata check ---
|
|
755
|
+
execution = parse_execution_block(frontmatter)
|
|
756
|
+
if execution is not None:
|
|
757
|
+
issues.extend(lint_execution_metadata(execution))
|
|
758
|
+
|
|
759
|
+
# --- Senior-tier required-block check (skill-quality.md § Senior-Tier Required Structure) ---
|
|
760
|
+
tier_match = TIER_PATTERN.search(frontmatter)
|
|
761
|
+
if tier_match and tier_match.group(1) == "senior":
|
|
762
|
+
issues.extend(lint_senior_tier_blocks(text))
|
|
763
|
+
|
|
764
|
+
# --- Wing-3 GTM cognition-boundary check (council Q7 / adr-gtm-context-spine.md) ---
|
|
765
|
+
spine_slots = parse_context_spine(frontmatter)
|
|
766
|
+
if spine_slots and any(s in WING3_SPINE_SLOTS for s in spine_slots):
|
|
767
|
+
issues.extend(lint_wing3_boundaries(text))
|
|
768
|
+
|
|
769
|
+
# --- Wing-4 Money/Strategy/Ops cognition-boundary check (council Q7 / J2) ---
|
|
770
|
+
if spine_slots and any(s in WING4_SPINE_SLOTS for s in spine_slots):
|
|
771
|
+
issues.extend(lint_wing4_boundaries(text))
|
|
772
|
+
|
|
773
|
+
procedure_block = find_procedure_block(text)
|
|
774
|
+
if procedure_block is not None:
|
|
775
|
+
if not procedure_block:
|
|
776
|
+
issues.append(Issue("error", "empty_procedure", "Procedure section is empty"))
|
|
777
|
+
else:
|
|
778
|
+
# Check for ordered steps OR sub-headings as structural indicators
|
|
779
|
+
has_ordered = ORDERED_STEP_PATTERN.search(procedure_block)
|
|
780
|
+
has_subheadings = bool(re.search(r"^###\s+", procedure_block, re.MULTILINE))
|
|
781
|
+
if not has_ordered and not has_subheadings:
|
|
782
|
+
issues.append(Issue("error", "unordered_procedure", "Procedure has no ordered steps or sub-headings"))
|
|
783
|
+
meaningful_steps = len(ORDERED_STEP_PATTERN.findall(procedure_block))
|
|
784
|
+
if meaningful_steps < 3:
|
|
785
|
+
issues.append(Issue("warning", "short_procedure", "Procedure has fewer than 3 ordered steps"))
|
|
786
|
+
# Check validation in procedure block OR in the full skill text
|
|
787
|
+
# (some skills have ### Validate under a sibling ## section)
|
|
788
|
+
if not has_validation_step(procedure_block) and not has_validation_step(text):
|
|
789
|
+
issues.append(Issue("error", "missing_validation", "Skill lacks a concrete validation step"))
|
|
790
|
+
vague_hits = find_vague_validation(procedure_block)
|
|
791
|
+
for hit in vague_hits:
|
|
792
|
+
issues.append(Issue("error", "vague_validation", f"Vague validation detected: {hit}"))
|
|
793
|
+
if not has_inspect_step(procedure_block):
|
|
794
|
+
issues.append(Issue("warning", "missing_inspect_step", "Procedure has no explicit inspect/check step"))
|
|
795
|
+
|
|
796
|
+
if "## Output format" in text:
|
|
797
|
+
output_block = extract_section_block(text, "Output format")
|
|
798
|
+
if not output_block or len(parse_ordered_list_items(output_block)) < 2:
|
|
799
|
+
issues.append(Issue("warning", "weak_output_format", "Output format should contain at least 2 ordered requirements"))
|
|
800
|
+
suggestions.append("Add 2-4 ordered output requirements")
|
|
801
|
+
else:
|
|
802
|
+
suggestions.append("Add an Output format section with ordered response constraints")
|
|
803
|
+
|
|
804
|
+
# Check Gotcha/Gotchas section (alias support)
|
|
805
|
+
gotcha_block = extract_section_block(text, "Gotchas") or extract_section_block(text, "Gotcha")
|
|
806
|
+
if gotcha_block:
|
|
807
|
+
if count_bullets(gotcha_block) < 1:
|
|
808
|
+
issues.append(Issue("warning", "weak_gotchas", "Gotchas should contain at least one realistic failure mode"))
|
|
809
|
+
else:
|
|
810
|
+
suggestions.append("Add at least one realistic failure pattern to Gotchas")
|
|
811
|
+
|
|
812
|
+
if "## Do NOT" in text:
|
|
813
|
+
do_not_block = extract_section_block(text, "Do NOT")
|
|
814
|
+
if count_bullets(do_not_block) < 1:
|
|
815
|
+
issues.append(Issue("warning", "weak_do_not", "Do NOT should contain at least one enforceable constraint"))
|
|
816
|
+
else:
|
|
817
|
+
suggestions.append("Add at least one enforceable Do NOT constraint")
|
|
818
|
+
|
|
819
|
+
if is_probably_too_broad(text, description):
|
|
820
|
+
issues.append(Issue("warning", "broad_scope", "Skill scope appears broad and may need splitting"))
|
|
821
|
+
suggestions.append("Narrow the trigger or split unrelated workflows")
|
|
822
|
+
|
|
823
|
+
# --- Developer judgment check for assisted skills ---
|
|
824
|
+
fm = extract_frontmatter(text)
|
|
825
|
+
exec_block = parse_execution_block(fm) if fm else None
|
|
826
|
+
exec_type = exec_block.get("type", "") if exec_block else ""
|
|
827
|
+
if exec_type == "assisted" and procedure_block:
|
|
828
|
+
validation_terms = ["validat", "check", "verify", "confirm", "challenge",
|
|
829
|
+
"existing", "duplicate", "contradict", "fit", "misfit"]
|
|
830
|
+
has_validation = any(term in procedure_block.lower() for term in validation_terms)
|
|
831
|
+
if not has_validation:
|
|
832
|
+
issues.append(Issue("warning", "missing_validation_step",
|
|
833
|
+
"Assisted skill has no validation/challenge step in procedure"))
|
|
834
|
+
suggestions.append("Add a requirement-checking or validation step before implementation")
|
|
835
|
+
|
|
836
|
+
# --- Size check (docs/contracts/linter-structural-model.md) ---
|
|
837
|
+
# Structural-density gate replaces raw line count (Phase 3 of
|
|
838
|
+
# road-to-structural-linter-reform, 2026-05-08): warn only when the skill
|
|
839
|
+
# is *both* large AND prose-dominant OR ships ≥ 2 independently invocable
|
|
840
|
+
# procedures. Reference catalogues (quality-tools 411 L / density 0.83)
|
|
841
|
+
# pass; multi-procedure skills are flagged for split.
|
|
842
|
+
#
|
|
843
|
+
# Frontmatter opt-out: `meta_skill: true` exempts a skill from the size
|
|
844
|
+
# warn when the skill's purpose *is* breadth (skill-writing, agent-docs-
|
|
845
|
+
# writing, skill-reviewer, etc.). Meta-skills inherently bundle multiple
|
|
846
|
+
# procedures and inline examples.
|
|
847
|
+
total_lines = len(text.splitlines())
|
|
848
|
+
is_meta_skill = bool(fm) and re.search(r"^meta_skill:\s*true\s*$", fm, re.MULTILINE)
|
|
849
|
+
if total_lines > 400 and not is_meta_skill:
|
|
850
|
+
density = _density_score(text)
|
|
851
|
+
procedures = _count_procedure_sections(text)
|
|
852
|
+
if density < 0.6 or procedures >= 2:
|
|
853
|
+
reason = (
|
|
854
|
+
f"density {density:.2f} < 0.60"
|
|
855
|
+
if density < 0.6
|
|
856
|
+
else f"{procedures} ## Procedure blocks (≥ 2)"
|
|
857
|
+
)
|
|
858
|
+
issues.append(Issue(
|
|
859
|
+
"warning",
|
|
860
|
+
"skill_too_large",
|
|
861
|
+
f"Skill has {total_lines} lines and {reason}; review for split "
|
|
862
|
+
f"(see linter-structural-model contract)",
|
|
863
|
+
))
|
|
864
|
+
|
|
865
|
+
# --- Pointer-only / guideline-dependent skill detection ---
|
|
866
|
+
if procedure_block:
|
|
867
|
+
proc_lines = [line.strip() for line in procedure_block.splitlines() if line.strip()]
|
|
868
|
+
|
|
869
|
+
# Delegation patterns: references to external docs instead of own workflow
|
|
870
|
+
delegation_patterns = re.findall(
|
|
871
|
+
r"(?:see|read|check|follow|refer\s+to|consult|per|apply\s+.*from)\s+.*"
|
|
872
|
+
r"(?:guideline|skill|rule|doc|documentation)",
|
|
873
|
+
procedure_block, re.IGNORECASE)
|
|
874
|
+
delegation_count = len(delegation_patterns)
|
|
875
|
+
|
|
876
|
+
# Action verbs that indicate the skill has its own operational workflow
|
|
877
|
+
action_verbs = re.findall(
|
|
878
|
+
r"\b(?:run|execute|create|write|validate|verify|inspect|check|ensure|test|build|"
|
|
879
|
+
r"generate|compare|extract|parse|detect|fix|update|add|remove|install|configure|"
|
|
880
|
+
r"deploy|trace|review|map|resolve|measure|confirm)\b",
|
|
881
|
+
procedure_block, re.IGNORECASE)
|
|
882
|
+
action_count = len(set(v.lower() for v in action_verbs))
|
|
883
|
+
|
|
884
|
+
# Count actual ordered steps
|
|
885
|
+
meaningful_steps = len(ORDERED_STEP_PATTERN.findall(procedure_block))
|
|
886
|
+
|
|
887
|
+
# Thin procedure: few steps AND few lines
|
|
888
|
+
has_thin_procedure = meaningful_steps < 3 and len(proc_lines) < 8
|
|
889
|
+
|
|
890
|
+
# Error: effectively a pointer, not a real skill
|
|
891
|
+
if delegation_count >= 3 and action_count <= 1 and has_thin_procedure:
|
|
892
|
+
issues.append(Issue("error", "guideline_dependent_skill",
|
|
893
|
+
f"Skill is effectively a pointer to guidelines/docs "
|
|
894
|
+
f"({delegation_count} delegations, {action_count} action verbs, "
|
|
895
|
+
f"{meaningful_steps} steps) — not an executable workflow"))
|
|
896
|
+
suggestions.append("Add concrete steps, decision points, and validation directly into the skill")
|
|
897
|
+
# Warning: likely too dependent on external guidance
|
|
898
|
+
elif delegation_count >= 2 and action_count <= 2 and has_thin_procedure:
|
|
899
|
+
issues.append(Issue("warning", "pointer_only_skill",
|
|
900
|
+
f"Skill appears too guideline-dependent "
|
|
901
|
+
f"({delegation_count} delegations, {action_count} action verbs, "
|
|
902
|
+
f"{meaningful_steps} steps) — may lack its own executable workflow"))
|
|
903
|
+
suggestions.append("Expand the skill so it remains executable without opening a guideline")
|
|
904
|
+
|
|
905
|
+
# --- evals.json schema validator ---
|
|
906
|
+
# When a skill ships sibling `evals/evals.json` (quantitative behavior
|
|
907
|
+
# eval per skill-writing § 7), validate its shape. Triggers.json is a
|
|
908
|
+
# separate concern handled elsewhere. All issues here are WARN.
|
|
909
|
+
issues.extend(validate_evals_json(path))
|
|
910
|
+
|
|
911
|
+
return LintResult(
|
|
912
|
+
file=str(path),
|
|
913
|
+
artifact_type="skill",
|
|
914
|
+
status=classify_status(issues),
|
|
915
|
+
issues=issues,
|
|
916
|
+
suggestions=dedupe_preserve_order(suggestions),
|
|
917
|
+
)
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
def validate_evals_json(skill_path: Path) -> list[Issue]:
|
|
921
|
+
"""Validate `{skill_dir}/evals/evals.json` against the schema declared
|
|
922
|
+
in `skill-writing` § 7. Returns WARN-level issues only; never blocks.
|
|
923
|
+
Skipped entirely when the file is absent."""
|
|
924
|
+
evals_path = skill_path.parent / "evals" / "evals.json"
|
|
925
|
+
if not evals_path.is_file():
|
|
926
|
+
return []
|
|
927
|
+
issues: list[Issue] = []
|
|
928
|
+
try:
|
|
929
|
+
data = json.loads(evals_path.read_text(encoding="utf-8"))
|
|
930
|
+
except (OSError, json.JSONDecodeError) as exc:
|
|
931
|
+
return [Issue("warning", "evals_json_unreadable",
|
|
932
|
+
f"evals/evals.json could not be parsed: {exc}")]
|
|
933
|
+
if not isinstance(data, dict):
|
|
934
|
+
return [Issue("warning", "evals_json_shape",
|
|
935
|
+
"evals/evals.json root must be an object")]
|
|
936
|
+
if "skill" not in data or not isinstance(data["skill"], str):
|
|
937
|
+
issues.append(Issue("warning", "evals_json_missing_skill",
|
|
938
|
+
"evals/evals.json must declare top-level 'skill' (string)"))
|
|
939
|
+
scenarios = data.get("scenarios")
|
|
940
|
+
if not isinstance(scenarios, list) or len(scenarios) < 1:
|
|
941
|
+
issues.append(Issue("warning", "evals_json_no_scenarios",
|
|
942
|
+
"evals/evals.json must declare 'scenarios' (non-empty array)"))
|
|
943
|
+
return issues
|
|
944
|
+
valid_kinds = {"contains", "file_exists", "rubric"}
|
|
945
|
+
for idx, scenario in enumerate(scenarios):
|
|
946
|
+
loc = f"scenarios[{idx}]"
|
|
947
|
+
if not isinstance(scenario, dict):
|
|
948
|
+
issues.append(Issue("warning", "evals_json_scenario_shape",
|
|
949
|
+
f"{loc} must be an object"))
|
|
950
|
+
continue
|
|
951
|
+
for key in ("id", "prompt"):
|
|
952
|
+
if key not in scenario or not isinstance(scenario[key], str) or not scenario[key].strip():
|
|
953
|
+
issues.append(Issue("warning", "evals_json_scenario_missing_field",
|
|
954
|
+
f"{loc} missing required string field '{key}'"))
|
|
955
|
+
assertions = scenario.get("assertions")
|
|
956
|
+
if not isinstance(assertions, list) or len(assertions) < 1:
|
|
957
|
+
issues.append(Issue("warning", "evals_json_scenario_no_assertions",
|
|
958
|
+
f"{loc}.assertions must be a non-empty array"))
|
|
959
|
+
continue
|
|
960
|
+
for a_idx, assertion in enumerate(assertions):
|
|
961
|
+
a_loc = f"{loc}.assertions[{a_idx}]"
|
|
962
|
+
if not isinstance(assertion, dict):
|
|
963
|
+
issues.append(Issue("warning", "evals_json_assertion_shape",
|
|
964
|
+
f"{a_loc} must be an object"))
|
|
965
|
+
continue
|
|
966
|
+
kind = assertion.get("kind")
|
|
967
|
+
if kind not in valid_kinds:
|
|
968
|
+
issues.append(Issue("warning", "evals_json_assertion_kind",
|
|
969
|
+
f"{a_loc}.kind must be one of {sorted(valid_kinds)}, got {kind!r}"))
|
|
970
|
+
continue
|
|
971
|
+
required_field = {"contains": "value", "file_exists": "path", "rubric": "criterion"}[kind]
|
|
972
|
+
if required_field not in assertion or not isinstance(assertion[required_field], str):
|
|
973
|
+
issues.append(Issue("warning", "evals_json_assertion_missing_field",
|
|
974
|
+
f"{a_loc} (kind={kind}) missing required string field '{required_field}'"))
|
|
975
|
+
return issues
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
def extract_frontmatter(text: str) -> Optional[str]:
|
|
979
|
+
match = FRONTMATTER_PATTERN.search(text)
|
|
980
|
+
return match.group(1) if match else None
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
def _parse_trust_level(frontmatter: str) -> Optional[str]:
|
|
984
|
+
"""Parse `trust.level:` from the nested `trust:` mapping in frontmatter.
|
|
985
|
+
|
|
986
|
+
Returns the level string (e.g. ``"core"``, ``"advisory"``) or ``None``
|
|
987
|
+
if absent. Stdlib-only — mirrors the line-walking approach of
|
|
988
|
+
``_parse_yaml_list`` so the linter stays pyyaml-free.
|
|
989
|
+
"""
|
|
990
|
+
lines = frontmatter.splitlines()
|
|
991
|
+
in_block = False
|
|
992
|
+
for line in lines:
|
|
993
|
+
if not in_block:
|
|
994
|
+
if line.startswith("trust:"):
|
|
995
|
+
rhs = line[len("trust:"):].strip()
|
|
996
|
+
if rhs == "":
|
|
997
|
+
in_block = True
|
|
998
|
+
continue
|
|
999
|
+
if line.startswith(" level:"):
|
|
1000
|
+
return line[len(" level:"):].strip().strip('"').strip("'")
|
|
1001
|
+
if line.startswith(" "):
|
|
1002
|
+
continue
|
|
1003
|
+
break
|
|
1004
|
+
return None
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
def _parse_yaml_list(frontmatter: str, key: str) -> Optional[list]:
|
|
1008
|
+
"""Parse a simple top-level YAML list `key:` from frontmatter.
|
|
1009
|
+
|
|
1010
|
+
Supports the two shapes we emit in rule frontmatter:
|
|
1011
|
+
triggers:
|
|
1012
|
+
- keyword: "foo"
|
|
1013
|
+
- phrase: "bar baz"
|
|
1014
|
+
routes_to:
|
|
1015
|
+
- skill:php-coder
|
|
1016
|
+
- guideline:agent-infra/asking-and-brevity-examples
|
|
1017
|
+
|
|
1018
|
+
Returns ``None`` if the key is absent (so the caller can distinguish
|
|
1019
|
+
"missing" from "empty"); returns ``[]`` for an explicitly empty list.
|
|
1020
|
+
"""
|
|
1021
|
+
lines = frontmatter.splitlines()
|
|
1022
|
+
out: list = []
|
|
1023
|
+
in_block = False
|
|
1024
|
+
for line in lines:
|
|
1025
|
+
if not in_block:
|
|
1026
|
+
if line.startswith(f"{key}:"):
|
|
1027
|
+
rhs = line[len(key) + 1:].strip()
|
|
1028
|
+
if rhs in ("", "[]"):
|
|
1029
|
+
if rhs == "[]":
|
|
1030
|
+
return []
|
|
1031
|
+
in_block = True
|
|
1032
|
+
else:
|
|
1033
|
+
return None # unexpected scalar shape
|
|
1034
|
+
continue
|
|
1035
|
+
if line.startswith(" - "):
|
|
1036
|
+
item = line[4:].strip()
|
|
1037
|
+
if ":" in item and not item.startswith(("'", '"')):
|
|
1038
|
+
k, _, v = item.partition(":")
|
|
1039
|
+
out.append({k.strip(): v.strip().strip('"').strip("'")})
|
|
1040
|
+
else:
|
|
1041
|
+
out.append(item.strip('"').strip("'"))
|
|
1042
|
+
elif line.strip() == "" or line.startswith(" "):
|
|
1043
|
+
continue
|
|
1044
|
+
else:
|
|
1045
|
+
break
|
|
1046
|
+
return out if in_block else None
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
def lint_router_frontmatter(rule_id: str, frontmatter: str,
|
|
1050
|
+
rule_type: Optional[str]) -> List[Issue]:
|
|
1051
|
+
"""Validate `triggers:` / `routes_to:` per docs/contracts/rule-router.md.
|
|
1052
|
+
|
|
1053
|
+
Strict checks (always errors): kernel rules MUST NOT carry router fields;
|
|
1054
|
+
`triggers:` items must use one allowed key; `routes_to:` items must
|
|
1055
|
+
follow `kind:id` with kind ∈ {skill, guideline} and the target file
|
|
1056
|
+
must exist on disk.
|
|
1057
|
+
|
|
1058
|
+
Lenient checks (info-level until Phase 4 migrations land): non-kernel
|
|
1059
|
+
rules without `triggers:` / `routes_to:` get an informational note,
|
|
1060
|
+
not an error — the existing description-matching path still works.
|
|
1061
|
+
|
|
1062
|
+
Trust-tier carve-out: rules with ``trust.level: core`` are exempt from
|
|
1063
|
+
the ``router_routes_to_missing`` migration hint — they are authoritative
|
|
1064
|
+
by design and their body legitimately lives inline.
|
|
1065
|
+
"""
|
|
1066
|
+
issues: List[Issue] = []
|
|
1067
|
+
triggers = _parse_yaml_list(frontmatter, "triggers")
|
|
1068
|
+
routes_to = _parse_yaml_list(frontmatter, "routes_to")
|
|
1069
|
+
|
|
1070
|
+
# Manual rules are reference-only — not auto-injected, not router-routed
|
|
1071
|
+
# (ADR-004). Skip router validation so legacy triggers/routes_to fields
|
|
1072
|
+
# remain documented in the rule body without forcing maintenance.
|
|
1073
|
+
if rule_type == "manual":
|
|
1074
|
+
return issues
|
|
1075
|
+
|
|
1076
|
+
is_kernel = rule_id in KERNEL_RULE_IDS or rule_type == "always"
|
|
1077
|
+
|
|
1078
|
+
if is_kernel:
|
|
1079
|
+
if triggers is not None:
|
|
1080
|
+
issues.append(Issue("error", "kernel_has_triggers",
|
|
1081
|
+
"Kernel rules MUST NOT declare triggers: (kernel is unconditional)"))
|
|
1082
|
+
if routes_to is not None:
|
|
1083
|
+
issues.append(Issue("error", "kernel_has_routes_to",
|
|
1084
|
+
"Kernel rules MUST NOT declare routes_to: (kernel body stays inline)"))
|
|
1085
|
+
return issues
|
|
1086
|
+
|
|
1087
|
+
# Non-kernel rule path
|
|
1088
|
+
if triggers is None:
|
|
1089
|
+
issues.append(Issue("info", "router_triggers_missing",
|
|
1090
|
+
"Non-kernel rule has no triggers: — falls back to description matching "
|
|
1091
|
+
"until Phase 4 migration lands"))
|
|
1092
|
+
else:
|
|
1093
|
+
for idx, item in enumerate(triggers):
|
|
1094
|
+
if not isinstance(item, dict) or len(item) != 1:
|
|
1095
|
+
issues.append(Issue("error", "trigger_shape_invalid",
|
|
1096
|
+
f"triggers[{idx}] must be a single-key mapping"))
|
|
1097
|
+
continue
|
|
1098
|
+
(k,) = item.keys()
|
|
1099
|
+
if k not in ROUTER_ALLOWED_TRIGGER_KEYS:
|
|
1100
|
+
allowed = ", ".join(sorted(ROUTER_ALLOWED_TRIGGER_KEYS))
|
|
1101
|
+
issues.append(Issue("error", "trigger_key_unknown",
|
|
1102
|
+
f"triggers[{idx}] key '{k}' not in allowed set ({allowed})"))
|
|
1103
|
+
|
|
1104
|
+
if routes_to is None:
|
|
1105
|
+
# Trust-tier carve-out: rules pinned at trust.level: core are
|
|
1106
|
+
# authoritative — their body IS the behavior and may legitimately
|
|
1107
|
+
# live inline without a routes_to: delegation. The Phase 4
|
|
1108
|
+
# migration hint applies only to lower-trust rules.
|
|
1109
|
+
trust_level = _parse_trust_level(frontmatter)
|
|
1110
|
+
if trust_level != "core":
|
|
1111
|
+
issues.append(Issue("info", "router_routes_to_missing",
|
|
1112
|
+
"Non-kernel rule has no routes_to: — body should migrate to skill / "
|
|
1113
|
+
"guideline in Phase 4"))
|
|
1114
|
+
else:
|
|
1115
|
+
repo_root = Path(__file__).resolve().parent.parent.parent
|
|
1116
|
+
for idx, item in enumerate(routes_to):
|
|
1117
|
+
if not isinstance(item, str) or ":" not in item:
|
|
1118
|
+
issues.append(Issue("error", "route_shape_invalid",
|
|
1119
|
+
f"routes_to[{idx}] must be 'kind:id'"))
|
|
1120
|
+
continue
|
|
1121
|
+
kind, _, target_id = item.partition(":")
|
|
1122
|
+
# Multi-root aware (ADR-017): resolve logical paths via every
|
|
1123
|
+
# source root so kernel rules keep routing to skills/commands
|
|
1124
|
+
# that moved into packages/*/.
|
|
1125
|
+
target: Optional[Path] = None
|
|
1126
|
+
if kind == "skill":
|
|
1127
|
+
target = resolve_logical(f"skills/{target_id}/SKILL.md")
|
|
1128
|
+
elif kind == "guideline":
|
|
1129
|
+
gpath = repo_root / "docs" / "guidelines" / f"{target_id}.md"
|
|
1130
|
+
target = gpath if gpath.exists() else None
|
|
1131
|
+
elif kind == "command":
|
|
1132
|
+
target = resolve_logical(f"commands/{target_id}.md")
|
|
1133
|
+
elif kind == "contract":
|
|
1134
|
+
# Contracts live in two places: stable host docs in
|
|
1135
|
+
# docs/contracts/ and load-bearing flows under
|
|
1136
|
+
# contexts/contracts/ inside any source root (road-to-path-fixes
|
|
1137
|
+
# P4 / Council R2). Try both before failing.
|
|
1138
|
+
cpath = repo_root / "docs" / "contracts" / f"{target_id}.md"
|
|
1139
|
+
if cpath.exists():
|
|
1140
|
+
target = cpath
|
|
1141
|
+
else:
|
|
1142
|
+
target = resolve_logical(f"contexts/contracts/{target_id}.md")
|
|
1143
|
+
else:
|
|
1144
|
+
issues.append(Issue("error", "route_kind_unknown",
|
|
1145
|
+
f"routes_to[{idx}] kind '{kind}' must be 'skill', 'guideline', 'command', or 'contract'"))
|
|
1146
|
+
continue
|
|
1147
|
+
if target is None or not target.exists():
|
|
1148
|
+
issues.append(Issue("error", "route_target_missing",
|
|
1149
|
+
f"routes_to[{idx}] target '{item}' not found under any artefact root"))
|
|
1150
|
+
return issues
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
def extract_frontmatter_field(frontmatter: str, pattern: re.Pattern[str]) -> Optional[str]:
|
|
1154
|
+
match = pattern.search(frontmatter)
|
|
1155
|
+
return match.group(1).strip() if match else None
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
def parse_execution_block(frontmatter: str) -> Optional[dict]:
|
|
1159
|
+
"""Parse the execution block from YAML frontmatter.
|
|
1160
|
+
|
|
1161
|
+
Uses simple line-based parsing to avoid requiring PyYAML.
|
|
1162
|
+
Returns None if no execution block is present.
|
|
1163
|
+
"""
|
|
1164
|
+
lines = frontmatter.splitlines()
|
|
1165
|
+
exec_start = None
|
|
1166
|
+
for i, line in enumerate(lines):
|
|
1167
|
+
if re.match(r'^execution:\s*$', line):
|
|
1168
|
+
exec_start = i
|
|
1169
|
+
break
|
|
1170
|
+
if exec_start is None:
|
|
1171
|
+
return None
|
|
1172
|
+
|
|
1173
|
+
result: dict = {}
|
|
1174
|
+
for line in lines[exec_start + 1:]:
|
|
1175
|
+
# Stop at next top-level key (no indentation)
|
|
1176
|
+
if line and not line[0].isspace():
|
|
1177
|
+
break
|
|
1178
|
+
stripped = line.strip()
|
|
1179
|
+
if not stripped or stripped.startswith('#'):
|
|
1180
|
+
continue
|
|
1181
|
+
# Handle list items (for allowed_tools)
|
|
1182
|
+
if stripped.startswith('- '):
|
|
1183
|
+
if '_current_list' in result:
|
|
1184
|
+
result[result['_current_list']].append(stripped[2:].strip().strip('"').strip("'"))
|
|
1185
|
+
continue
|
|
1186
|
+
# Handle key: value pairs
|
|
1187
|
+
match = re.match(r'^(\w+):\s*(.*?)\s*$', stripped)
|
|
1188
|
+
if match:
|
|
1189
|
+
key = match.group(1)
|
|
1190
|
+
value = match.group(2).strip('"').strip("'")
|
|
1191
|
+
if value == '[]':
|
|
1192
|
+
result[key] = []
|
|
1193
|
+
result['_current_list'] = key
|
|
1194
|
+
elif re.match(r'^\[.*\]$', value):
|
|
1195
|
+
# Inline YAML/JSON array like [github] or ["github", "jira"]
|
|
1196
|
+
inner = value[1:-1].strip()
|
|
1197
|
+
if inner:
|
|
1198
|
+
items = [item.strip().strip('"').strip("'") for item in inner.split(',')]
|
|
1199
|
+
result[key] = items
|
|
1200
|
+
else:
|
|
1201
|
+
result[key] = []
|
|
1202
|
+
result['_current_list'] = key
|
|
1203
|
+
elif value == '':
|
|
1204
|
+
# Could be a list starting on next line
|
|
1205
|
+
result[key] = []
|
|
1206
|
+
result['_current_list'] = key
|
|
1207
|
+
else:
|
|
1208
|
+
# Try to parse as int
|
|
1209
|
+
try:
|
|
1210
|
+
result[key] = int(value)
|
|
1211
|
+
except ValueError:
|
|
1212
|
+
result[key] = value
|
|
1213
|
+
result.pop('_current_list', None)
|
|
1214
|
+
|
|
1215
|
+
result.pop('_current_list', None)
|
|
1216
|
+
return result
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
def lint_senior_tier_blocks(text: str) -> List[Issue]:
|
|
1220
|
+
"""Validate the four required blocks for `tier: senior` skills.
|
|
1221
|
+
|
|
1222
|
+
Per .agent-src.uncondensed/rules/skill-quality.md § Senior-Tier
|
|
1223
|
+
Required Structure: Context-First lead (description), Related Skills
|
|
1224
|
+
(with WHEN / WHEN NOT lists), Proactive Triggers, Output Artifacts.
|
|
1225
|
+
|
|
1226
|
+
The Context-First lead is checked structurally via description length
|
|
1227
|
+
+ content; here we enforce the three section blocks and the WHEN /
|
|
1228
|
+
WHEN NOT two-list pattern inside Related Skills.
|
|
1229
|
+
"""
|
|
1230
|
+
issues: List[Issue] = []
|
|
1231
|
+
|
|
1232
|
+
if not SENIOR_RELATED_SKILLS_PATTERN.search(text):
|
|
1233
|
+
issues.append(Issue(
|
|
1234
|
+
"error",
|
|
1235
|
+
"missing_senior_related_skills",
|
|
1236
|
+
"Senior-tier skill missing `## Related Skills` block (skill-quality.md § Senior-Tier Required Structure)",
|
|
1237
|
+
))
|
|
1238
|
+
else:
|
|
1239
|
+
related_block = extract_section_block(text, "Related Skills") or ""
|
|
1240
|
+
if not SENIOR_RELATED_WHEN_PATTERN.search(related_block):
|
|
1241
|
+
issues.append(Issue(
|
|
1242
|
+
"error",
|
|
1243
|
+
"missing_senior_related_when",
|
|
1244
|
+
"Senior-tier `## Related Skills` block missing `**WHEN to use this**` list",
|
|
1245
|
+
))
|
|
1246
|
+
if not SENIOR_RELATED_WHEN_NOT_PATTERN.search(related_block):
|
|
1247
|
+
issues.append(Issue(
|
|
1248
|
+
"error",
|
|
1249
|
+
"missing_senior_related_when_not",
|
|
1250
|
+
"Senior-tier `## Related Skills` block missing `**WHEN NOT to use this**` list",
|
|
1251
|
+
))
|
|
1252
|
+
|
|
1253
|
+
if not SENIOR_PROACTIVE_PATTERN.search(text):
|
|
1254
|
+
issues.append(Issue(
|
|
1255
|
+
"error",
|
|
1256
|
+
"missing_senior_proactive_triggers",
|
|
1257
|
+
"Senior-tier skill missing `## When the agent should load this` block",
|
|
1258
|
+
))
|
|
1259
|
+
|
|
1260
|
+
if not SENIOR_OUTPUT_PATTERN.search(text):
|
|
1261
|
+
issues.append(Issue(
|
|
1262
|
+
"error",
|
|
1263
|
+
"missing_senior_output_artifacts",
|
|
1264
|
+
"Senior-tier skill missing `## Output` block declaring artifact name + shape",
|
|
1265
|
+
))
|
|
1266
|
+
|
|
1267
|
+
return issues
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
def parse_context_spine(frontmatter: str) -> Optional[List[str]]:
|
|
1271
|
+
"""Parse `context_spine:` from frontmatter.
|
|
1272
|
+
|
|
1273
|
+
Supports the inline form `context_spine: [a, b, c]` (most skills) and
|
|
1274
|
+
the block form via `_parse_yaml_list`. Returns the slot list, ``[]``
|
|
1275
|
+
for an explicitly empty array, or ``None`` if the key is absent.
|
|
1276
|
+
"""
|
|
1277
|
+
match = CONTEXT_SPINE_INLINE_PATTERN.search(frontmatter)
|
|
1278
|
+
if match is not None:
|
|
1279
|
+
inner = match.group(1).strip()
|
|
1280
|
+
if not inner:
|
|
1281
|
+
return []
|
|
1282
|
+
return [s.strip().strip('"').strip("'") for s in inner.split(",") if s.strip()]
|
|
1283
|
+
block = _parse_yaml_list(frontmatter, "context_spine")
|
|
1284
|
+
return block
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
def _strip_wing3_carve_outs(text: str) -> str:
|
|
1288
|
+
"""Remove fenced code, inline backticks, the ``## Do NOT`` block, and
|
|
1289
|
+
``**WHEN NOT to use this**`` bullets so legitimate citations of vendor
|
|
1290
|
+
names (as off-scope examples) do not trip Wing-3 boundary checks.
|
|
1291
|
+
"""
|
|
1292
|
+
text = re.sub(r"```[^\n]*\n.*?```", "", text, flags=re.DOTALL)
|
|
1293
|
+
text = re.sub(r"`[^`]+`", "", text)
|
|
1294
|
+
text = re.sub(
|
|
1295
|
+
r"^##\s+Do NOT\s*$.*?(?=^##\s+|\Z)",
|
|
1296
|
+
"", text, flags=re.MULTILINE | re.DOTALL,
|
|
1297
|
+
)
|
|
1298
|
+
text = re.sub(
|
|
1299
|
+
r"\*\*WHEN NOT to use this\*\*.*?(?=\*\*WHEN|^##\s+|\Z)",
|
|
1300
|
+
"", text, flags=re.DOTALL | re.IGNORECASE,
|
|
1301
|
+
)
|
|
1302
|
+
return text
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
def lint_wing3_boundaries(text: str) -> List[Issue]:
|
|
1306
|
+
"""Four Wing-3 GTM cognition-boundary checks.
|
|
1307
|
+
|
|
1308
|
+
Triggered when a skill's ``context_spine`` declares at least one
|
|
1309
|
+
Wing-3 slot (channel-stage, funnel-stage, customer-segment). Enforces
|
|
1310
|
+
council Q7 / iter-2 OQ3 verdict that GTM cognition stays:
|
|
1311
|
+
|
|
1312
|
+
- **agent-operability** — no external SaaS URLs the agent would auth against.
|
|
1313
|
+
- **vendor-independence** — no platform / SDK / brand slugs.
|
|
1314
|
+
- **transferability** — no stack-locked tooling instructions.
|
|
1315
|
+
- **channel-agnosticism** — no channel-specific tactical prescriptions.
|
|
1316
|
+
|
|
1317
|
+
Carve-outs: fenced code, inline backticks, the ``## Do NOT`` block,
|
|
1318
|
+
and ``**WHEN NOT to use this**`` lists — so authors can cite a vendor
|
|
1319
|
+
as off-scope without tripping the linter.
|
|
1320
|
+
"""
|
|
1321
|
+
issues: List[Issue] = []
|
|
1322
|
+
body = _strip_wing3_carve_outs(text)
|
|
1323
|
+
|
|
1324
|
+
match = WING3_SAAS_URL_PATTERN.search(body)
|
|
1325
|
+
if match:
|
|
1326
|
+
issues.append(Issue(
|
|
1327
|
+
"warning", "wing3_agent_operability",
|
|
1328
|
+
f"Wing-3 skill cites external SaaS URL `{match.group(0)}` outside "
|
|
1329
|
+
f"carve-outs — cognition skills must operate without SaaS auth "
|
|
1330
|
+
f"(council Q7 boundary)",
|
|
1331
|
+
))
|
|
1332
|
+
|
|
1333
|
+
match = WING3_VENDOR_BLACKLIST.search(body)
|
|
1334
|
+
if match:
|
|
1335
|
+
issues.append(Issue(
|
|
1336
|
+
"warning", "wing3_vendor_independence",
|
|
1337
|
+
f"Wing-3 skill names vendor `{match.group(0)}` outside carve-outs "
|
|
1338
|
+
f"— keep cognition vendor-agnostic (council Q7 boundary)",
|
|
1339
|
+
))
|
|
1340
|
+
|
|
1341
|
+
match = WING3_STACK_LOCKED_PATTERN.search(body)
|
|
1342
|
+
if match:
|
|
1343
|
+
issues.append(Issue(
|
|
1344
|
+
"warning", "wing3_transferability",
|
|
1345
|
+
f"Wing-3 skill includes stack-locked instruction `{match.group(0)}` "
|
|
1346
|
+
f"outside carve-outs — cognition should transfer across stacks "
|
|
1347
|
+
f"(council Q7 boundary)",
|
|
1348
|
+
))
|
|
1349
|
+
|
|
1350
|
+
match = WING3_CHANNEL_TACTIC_PATTERN.search(body)
|
|
1351
|
+
if match:
|
|
1352
|
+
issues.append(Issue(
|
|
1353
|
+
"warning", "wing3_channel_agnosticism",
|
|
1354
|
+
f"Wing-3 skill prescribes channel-specific tactic "
|
|
1355
|
+
f"`{match.group(0)}` outside carve-outs — keep cognition "
|
|
1356
|
+
f"channel-agnostic (council Q7 boundary)",
|
|
1357
|
+
))
|
|
1358
|
+
|
|
1359
|
+
return issues
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
def lint_wing4_boundaries(text: str) -> List[Issue]:
|
|
1363
|
+
"""Four Wing-4 Money/Strategy/Ops cognition-boundary checks.
|
|
1364
|
+
|
|
1365
|
+
Triggered when a skill's ``context_spine`` declares at least one
|
|
1366
|
+
Wing-4 slot (fiscal-period, org-stage, regulatory-regime). Enforces
|
|
1367
|
+
council Q7 / J2 verdict that Money/Strategy/Ops cognition stays:
|
|
1368
|
+
|
|
1369
|
+
- **agent-operability** — no external finance/HR/legal SaaS URLs.
|
|
1370
|
+
- **vendor-independence** — no QuickBooks/Carta/Gusto-class brand slugs.
|
|
1371
|
+
- **transferability** — no stack-locked tooling instructions.
|
|
1372
|
+
- **stage-agnosticism** — no prescriptive stage-specific thresholds.
|
|
1373
|
+
|
|
1374
|
+
Carve-outs are identical to Wing-3: fenced code, inline backticks,
|
|
1375
|
+
the ``## Do NOT`` block, and ``**WHEN NOT to use this**`` lists.
|
|
1376
|
+
Regulatory regime names (GDPR / HIPAA / SOC2 / PCI / CCPA) are
|
|
1377
|
+
cognition-relevant constraints, not vendors — they pass.
|
|
1378
|
+
"""
|
|
1379
|
+
issues: List[Issue] = []
|
|
1380
|
+
body = _strip_wing3_carve_outs(text)
|
|
1381
|
+
|
|
1382
|
+
match = WING4_SAAS_URL_PATTERN.search(body)
|
|
1383
|
+
if match:
|
|
1384
|
+
issues.append(Issue(
|
|
1385
|
+
"warning", "wing4_agent_operability",
|
|
1386
|
+
f"Wing-4 skill cites external SaaS URL `{match.group(0)}` outside "
|
|
1387
|
+
f"carve-outs — cognition skills must operate without SaaS auth "
|
|
1388
|
+
f"(council Q7 boundary)",
|
|
1389
|
+
))
|
|
1390
|
+
|
|
1391
|
+
match = WING4_VENDOR_BLACKLIST.search(body)
|
|
1392
|
+
if match:
|
|
1393
|
+
issues.append(Issue(
|
|
1394
|
+
"warning", "wing4_vendor_independence",
|
|
1395
|
+
f"Wing-4 skill names vendor `{match.group(0)}` outside carve-outs "
|
|
1396
|
+
f"— keep cognition vendor-agnostic (council Q7 boundary)",
|
|
1397
|
+
))
|
|
1398
|
+
|
|
1399
|
+
match = WING3_STACK_LOCKED_PATTERN.search(body)
|
|
1400
|
+
if match:
|
|
1401
|
+
issues.append(Issue(
|
|
1402
|
+
"warning", "wing4_transferability",
|
|
1403
|
+
f"Wing-4 skill includes stack-locked instruction `{match.group(0)}` "
|
|
1404
|
+
f"outside carve-outs — cognition should transfer across stacks "
|
|
1405
|
+
f"(council Q7 boundary)",
|
|
1406
|
+
))
|
|
1407
|
+
|
|
1408
|
+
match = WING4_STAGE_AGNOSTIC_PATTERN.search(body)
|
|
1409
|
+
if match:
|
|
1410
|
+
issues.append(Issue(
|
|
1411
|
+
"warning", "wing4_stage_agnosticism",
|
|
1412
|
+
f"Wing-4 skill prescribes stage-locked threshold "
|
|
1413
|
+
f"`{match.group(0)}` outside carve-outs — cognition must "
|
|
1414
|
+
f"transfer across seed and public (council Q7 boundary)",
|
|
1415
|
+
))
|
|
1416
|
+
|
|
1417
|
+
return issues
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
def lint_execution_metadata(execution: dict) -> List[Issue]:
|
|
1421
|
+
"""Validate the execution block of a skill."""
|
|
1422
|
+
issues: List[Issue] = []
|
|
1423
|
+
|
|
1424
|
+
# Validate type
|
|
1425
|
+
exec_type = execution.get("type")
|
|
1426
|
+
if exec_type is not None:
|
|
1427
|
+
if exec_type not in VALID_EXECUTION_TYPES:
|
|
1428
|
+
issues.append(Issue("error", "invalid_execution_type",
|
|
1429
|
+
f"Invalid execution.type '{exec_type}'; "
|
|
1430
|
+
f"must be one of: {', '.join(sorted(VALID_EXECUTION_TYPES))}"))
|
|
1431
|
+
else:
|
|
1432
|
+
issues.append(Issue("error", "missing_execution_type",
|
|
1433
|
+
"Execution block present but missing 'type' field"))
|
|
1434
|
+
|
|
1435
|
+
# Validate handler
|
|
1436
|
+
handler = execution.get("handler")
|
|
1437
|
+
if handler is not None:
|
|
1438
|
+
if handler not in VALID_EXECUTION_HANDLERS:
|
|
1439
|
+
issues.append(Issue("error", "invalid_execution_handler",
|
|
1440
|
+
f"Invalid execution.handler '{handler}'; "
|
|
1441
|
+
f"must be one of: {', '.join(sorted(VALID_EXECUTION_HANDLERS))}"))
|
|
1442
|
+
|
|
1443
|
+
# Automated-specific checks
|
|
1444
|
+
if exec_type == "automated":
|
|
1445
|
+
if handler is None or handler == "none":
|
|
1446
|
+
issues.append(Issue("error", "automated_missing_handler",
|
|
1447
|
+
"Automated execution requires a handler other than 'none'"))
|
|
1448
|
+
safety_mode = execution.get("safety_mode")
|
|
1449
|
+
if safety_mode is None:
|
|
1450
|
+
issues.append(Issue("error", "automated_missing_safety_mode",
|
|
1451
|
+
"Automated execution requires 'safety_mode: strict'"))
|
|
1452
|
+
elif safety_mode not in VALID_EXECUTION_SAFETY_MODES:
|
|
1453
|
+
issues.append(Issue("error", "invalid_safety_mode",
|
|
1454
|
+
f"Invalid safety_mode '{safety_mode}'; must be 'strict'"))
|
|
1455
|
+
if "allowed_tools" not in execution:
|
|
1456
|
+
issues.append(Issue("warning", "automated_missing_allowed_tools",
|
|
1457
|
+
"Automated execution should declare 'allowed_tools' (use [] for none)"))
|
|
1458
|
+
|
|
1459
|
+
# Validate safety_mode if present (even for non-automated)
|
|
1460
|
+
safety_mode = execution.get("safety_mode")
|
|
1461
|
+
if safety_mode is not None and safety_mode not in VALID_EXECUTION_SAFETY_MODES:
|
|
1462
|
+
issues.append(Issue("error", "invalid_safety_mode",
|
|
1463
|
+
f"Invalid safety_mode '{safety_mode}'; must be 'strict'"))
|
|
1464
|
+
|
|
1465
|
+
# Validate timeout_seconds
|
|
1466
|
+
timeout = execution.get("timeout_seconds")
|
|
1467
|
+
if timeout is not None:
|
|
1468
|
+
if not isinstance(timeout, int) or timeout <= 0:
|
|
1469
|
+
issues.append(Issue("warning", "invalid_timeout",
|
|
1470
|
+
f"timeout_seconds should be a positive integer, got '{timeout}'"))
|
|
1471
|
+
|
|
1472
|
+
# Validate allowed_tools is a list of strings
|
|
1473
|
+
allowed_tools = execution.get("allowed_tools")
|
|
1474
|
+
if allowed_tools is not None:
|
|
1475
|
+
if not isinstance(allowed_tools, list):
|
|
1476
|
+
issues.append(Issue("error", "invalid_allowed_tools",
|
|
1477
|
+
"allowed_tools must be a list"))
|
|
1478
|
+
elif not all(isinstance(t, str) for t in allowed_tools):
|
|
1479
|
+
issues.append(Issue("error", "invalid_allowed_tools_entries",
|
|
1480
|
+
"All entries in allowed_tools must be strings"))
|
|
1481
|
+
|
|
1482
|
+
# Validate command shape if present. Skills that declare `command` are
|
|
1483
|
+
# runtime-executable; skills without it stay in proposal-only mode.
|
|
1484
|
+
command = execution.get("command")
|
|
1485
|
+
if command is not None:
|
|
1486
|
+
if not isinstance(command, list) or not all(isinstance(c, str) for c in command):
|
|
1487
|
+
issues.append(Issue("error", "invalid_command",
|
|
1488
|
+
"command must be a list of strings (argv form)"))
|
|
1489
|
+
elif len(command) == 0:
|
|
1490
|
+
issues.append(Issue("error", "empty_command",
|
|
1491
|
+
"command must not be empty"))
|
|
1492
|
+
|
|
1493
|
+
# Check for unknown fields
|
|
1494
|
+
known_fields = VALID_EXECUTION_FIELDS
|
|
1495
|
+
unknown = set(execution.keys()) - known_fields
|
|
1496
|
+
for field in sorted(unknown):
|
|
1497
|
+
issues.append(Issue("warning", "unknown_execution_field",
|
|
1498
|
+
f"Unknown field in execution block: '{field}'"))
|
|
1499
|
+
|
|
1500
|
+
return issues
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
def lint_rule(path: Path, text: str) -> LintResult:
|
|
1504
|
+
issues: List[Issue] = []
|
|
1505
|
+
suggestions: List[str] = []
|
|
1506
|
+
|
|
1507
|
+
# --- Frontmatter checks ---
|
|
1508
|
+
frontmatter = extract_frontmatter(text)
|
|
1509
|
+
if frontmatter is None:
|
|
1510
|
+
issues.append(Issue("error", "missing_frontmatter", "Rule is missing YAML frontmatter (--- block)"))
|
|
1511
|
+
else:
|
|
1512
|
+
# type field
|
|
1513
|
+
rule_type = extract_frontmatter_field(frontmatter, TYPE_PATTERN)
|
|
1514
|
+
if rule_type is None:
|
|
1515
|
+
issues.append(Issue("error", "missing_type", "Frontmatter missing 'type' field (must be 'always', 'auto', or 'manual')"))
|
|
1516
|
+
elif rule_type not in VALID_RULE_TYPES:
|
|
1517
|
+
issues.append(Issue("error", "invalid_type", f"Invalid type '{rule_type}'; must be 'always', 'auto', or 'manual'"))
|
|
1518
|
+
|
|
1519
|
+
# source field — optional (schema default `package` injected at read);
|
|
1520
|
+
# validate the value only when present.
|
|
1521
|
+
rule_source = extract_frontmatter_field(frontmatter, SOURCE_PATTERN)
|
|
1522
|
+
if rule_source is not None and rule_source not in VALID_RULE_SOURCES:
|
|
1523
|
+
issues.append(Issue("error", "invalid_source", f"Invalid source '{rule_source}'; must be 'package' or 'project'"))
|
|
1524
|
+
|
|
1525
|
+
# description required for auto rules
|
|
1526
|
+
if rule_type == "auto":
|
|
1527
|
+
description = extract_description(text)
|
|
1528
|
+
if not description:
|
|
1529
|
+
issues.append(Issue("error", "auto_missing_description", "Auto rules require a 'description' field for matching"))
|
|
1530
|
+
|
|
1531
|
+
# description length cap (F6 — 200-char hard cap, see road-to-governance-cleanup)
|
|
1532
|
+
rule_description = extract_description(text)
|
|
1533
|
+
if rule_description and len(rule_description) > 200:
|
|
1534
|
+
issues.append(Issue("error", "description_too_long",
|
|
1535
|
+
f"Description is {len(rule_description)} chars (hard cap: 200) — see road-to-governance-cleanup F6"))
|
|
1536
|
+
|
|
1537
|
+
# always-rules that look like auto candidates (rule-type-governance check)
|
|
1538
|
+
if rule_type == "always":
|
|
1539
|
+
description = extract_description(text) or ""
|
|
1540
|
+
# If description contains topic-specific keywords, it might be an auto candidate
|
|
1541
|
+
topic_keywords = re.findall(
|
|
1542
|
+
r"\b(?:PHP|Laravel|Docker|Git|E2E|Playwright|SQL|Blade|Livewire|"
|
|
1543
|
+
r"Terraform|Jira|Sentry|translations|i18n)\b",
|
|
1544
|
+
description, re.IGNORECASE)
|
|
1545
|
+
if len(topic_keywords) >= 2:
|
|
1546
|
+
issues.append(Issue("info", "always_auto_candidate",
|
|
1547
|
+
f"Always-rule with topic-specific description ({', '.join(topic_keywords)}) — "
|
|
1548
|
+
f"consider auto type per rule-type-governance"))
|
|
1549
|
+
|
|
1550
|
+
# Router schema validation (docs/contracts/rule-router.md, Phase 3.3).
|
|
1551
|
+
issues.extend(lint_router_frontmatter(path.stem, frontmatter, rule_type))
|
|
1552
|
+
|
|
1553
|
+
# --- Structure checks ---
|
|
1554
|
+
# H1 heading
|
|
1555
|
+
if not H1_PATTERN.search(text):
|
|
1556
|
+
issues.append(Issue("error", "missing_h1", "Rule is missing an H1 heading (# Title)"))
|
|
1557
|
+
|
|
1558
|
+
# File must end with exactly one newline
|
|
1559
|
+
if not text.endswith("\n"):
|
|
1560
|
+
issues.append(Issue("error", "no_trailing_newline", "File must end with exactly one newline"))
|
|
1561
|
+
elif text.endswith("\n\n"):
|
|
1562
|
+
issues.append(Issue("warning", "extra_trailing_newlines", "File ends with multiple newlines; should be exactly one"))
|
|
1563
|
+
|
|
1564
|
+
# No double/triple blank lines in content
|
|
1565
|
+
if DOUBLE_BLANK_PATTERN.search(text):
|
|
1566
|
+
issues.append(Issue("warning", "double_blank_lines", "File contains double or triple blank lines"))
|
|
1567
|
+
|
|
1568
|
+
# --- Content checks (docs/contracts/linter-structural-model.md) ---
|
|
1569
|
+
# Structural-density gate replaces fenced-ratio + dual-threshold (Phase 3
|
|
1570
|
+
# of road-to-structural-linter-reform, 2026-05-08): warn only when the
|
|
1571
|
+
# rule is long, prose-dominant, AND ships no Iron-Law block. Hard error
|
|
1572
|
+
# at 200 lines stays unconditional.
|
|
1573
|
+
line_count = len([line for line in text.splitlines() if line.strip()])
|
|
1574
|
+
total_lines = len(text.splitlines())
|
|
1575
|
+
if total_lines > 200:
|
|
1576
|
+
issues.append(Issue("error", "rule_too_large", f"Rule has {total_lines} lines (hard limit: 200); must split or move to guideline"))
|
|
1577
|
+
elif line_count > 60:
|
|
1578
|
+
density = _density_score(text)
|
|
1579
|
+
iron_blocks = _iron_law_blocks(text)
|
|
1580
|
+
if density < 0.5 and iron_blocks == 0:
|
|
1581
|
+
issues.append(Issue(
|
|
1582
|
+
"warning",
|
|
1583
|
+
"long_rule",
|
|
1584
|
+
f"Rule has {line_count} non-empty lines, density {density:.2f} < 0.50, "
|
|
1585
|
+
f"no Iron-Law block; rules should be concise "
|
|
1586
|
+
f"(see linter-structural-model contract)",
|
|
1587
|
+
))
|
|
1588
|
+
|
|
1589
|
+
for bad_sign in RULE_BAD_SIGNS:
|
|
1590
|
+
if bad_sign in text:
|
|
1591
|
+
issues.append(Issue("error", "rule_looks_like_skill", f"Rule contains skill-like section: {bad_sign}"))
|
|
1592
|
+
|
|
1593
|
+
# Procedural-rule heuristic: a rule "looks procedural" only when its own
|
|
1594
|
+
# prose AND its own structure both signal a procedure. We:
|
|
1595
|
+
# 1. Exclude frontmatter (may contain "type", path strings, etc.).
|
|
1596
|
+
# 2. Strip code spans, fenced blocks, and markdown links — so legitimate
|
|
1597
|
+
# pointers to procedural skills (e.g. `skill:git-workflow`,
|
|
1598
|
+
# [symfony-workflow](…)) do not flip the keyword count.
|
|
1599
|
+
# 3. Require ≥ 2 keyword occurrences in stripped prose AND ≥ 3 ordered
|
|
1600
|
+
# steps AND no Iron-Law block — that combination distinguishes a
|
|
1601
|
+
# mis-classified procedure from a rule that merely references one.
|
|
1602
|
+
body = text.split("---", 2)[-1] if frontmatter else text
|
|
1603
|
+
stripped_body = _strip_markdown_for_check(body)
|
|
1604
|
+
kw_count = len(re.findall(r"\b(procedure|workflow)\b", stripped_body, re.IGNORECASE))
|
|
1605
|
+
ordered_steps = len(re.findall(r"^\s*\d+\.\s+", body, re.MULTILINE))
|
|
1606
|
+
if kw_count >= 2 and ordered_steps >= 3 and _iron_law_blocks(text) == 0:
|
|
1607
|
+
issues.append(Issue("warning", "procedural_rule", "Rule looks procedural; consider a skill instead"))
|
|
1608
|
+
|
|
1609
|
+
return LintResult(
|
|
1610
|
+
file=str(path),
|
|
1611
|
+
artifact_type="rule",
|
|
1612
|
+
status=classify_status(issues),
|
|
1613
|
+
issues=issues,
|
|
1614
|
+
suggestions=dedupe_preserve_order(suggestions),
|
|
1615
|
+
)
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
def _lint_command_suggestion_block(text: str) -> List[Issue]:
|
|
1619
|
+
"""Validate the suggestion frontmatter block (road-to-context-aware-command-suggestion).
|
|
1620
|
+
|
|
1621
|
+
Schema-shape is enforced upstream by validate_frontmatter; this function adds the
|
|
1622
|
+
*conditional* content rules that JSON Schema (Draft-07 subset used here) cannot
|
|
1623
|
+
express: trigger fields must be non-empty when eligible, rationale must be
|
|
1624
|
+
non-empty when ineligible.
|
|
1625
|
+
"""
|
|
1626
|
+
issues: List[Issue] = []
|
|
1627
|
+
data, _offset = parse_frontmatter_for_schema(text)
|
|
1628
|
+
if data is None:
|
|
1629
|
+
return issues
|
|
1630
|
+
suggestion = data.get("suggestion")
|
|
1631
|
+
if suggestion is None:
|
|
1632
|
+
issues.append(Issue(
|
|
1633
|
+
"error", "missing_suggestion_block",
|
|
1634
|
+
"Command frontmatter is missing the 'suggestion' block — required by "
|
|
1635
|
+
"road-to-context-aware-command-suggestion Phase 2.",
|
|
1636
|
+
))
|
|
1637
|
+
return issues
|
|
1638
|
+
if not isinstance(suggestion, dict):
|
|
1639
|
+
issues.append(Issue("error", "invalid_suggestion_block", "'suggestion' must be a mapping"))
|
|
1640
|
+
return issues
|
|
1641
|
+
eligible = suggestion.get("eligible")
|
|
1642
|
+
if eligible is True:
|
|
1643
|
+
td = (suggestion.get("trigger_description") or "").strip()
|
|
1644
|
+
tc = (suggestion.get("trigger_context") or "").strip()
|
|
1645
|
+
if not td:
|
|
1646
|
+
issues.append(Issue(
|
|
1647
|
+
"error", "missing_trigger_description",
|
|
1648
|
+
"suggestion.eligible=true requires a non-empty 'trigger_description'.",
|
|
1649
|
+
))
|
|
1650
|
+
elif len(td) < 10:
|
|
1651
|
+
issues.append(Issue(
|
|
1652
|
+
"warning", "trigger_description_too_short",
|
|
1653
|
+
"suggestion.trigger_description is suspiciously short (<10 chars); "
|
|
1654
|
+
"linter rejects empty or overly generic patterns.",
|
|
1655
|
+
))
|
|
1656
|
+
if not tc:
|
|
1657
|
+
issues.append(Issue(
|
|
1658
|
+
"error", "missing_trigger_context",
|
|
1659
|
+
"suggestion.eligible=true requires a non-empty 'trigger_context'.",
|
|
1660
|
+
))
|
|
1661
|
+
elif len(tc) < 10:
|
|
1662
|
+
issues.append(Issue(
|
|
1663
|
+
"warning", "trigger_context_too_short",
|
|
1664
|
+
"suggestion.trigger_context is suspiciously short (<10 chars); "
|
|
1665
|
+
"linter rejects empty or overly generic patterns.",
|
|
1666
|
+
))
|
|
1667
|
+
elif eligible is False:
|
|
1668
|
+
rationale = (suggestion.get("rationale") or "").strip()
|
|
1669
|
+
if not rationale:
|
|
1670
|
+
issues.append(Issue(
|
|
1671
|
+
"error", "missing_suggestion_rationale",
|
|
1672
|
+
"suggestion.eligible=false requires a non-empty 'rationale'.",
|
|
1673
|
+
))
|
|
1674
|
+
else:
|
|
1675
|
+
issues.append(Issue(
|
|
1676
|
+
"error", "invalid_suggestion_eligible",
|
|
1677
|
+
"suggestion.eligible must be true or false.",
|
|
1678
|
+
))
|
|
1679
|
+
return issues
|
|
1680
|
+
|
|
1681
|
+
|
|
1682
|
+
def lint_command(path: Path, text: str) -> LintResult:
|
|
1683
|
+
issues: List[Issue] = []
|
|
1684
|
+
suggestions: List[str] = []
|
|
1685
|
+
|
|
1686
|
+
# --- Frontmatter checks ---
|
|
1687
|
+
frontmatter = extract_frontmatter(text)
|
|
1688
|
+
if frontmatter is None:
|
|
1689
|
+
issues.append(Issue("error", "missing_frontmatter", "Command is missing YAML frontmatter (--- block)"))
|
|
1690
|
+
else:
|
|
1691
|
+
# name field
|
|
1692
|
+
name_match = NAME_PATTERN.search(frontmatter)
|
|
1693
|
+
if not name_match or not name_match.group(1).strip():
|
|
1694
|
+
issues.append(Issue("error", "missing_name", "Frontmatter missing 'name' field"))
|
|
1695
|
+
|
|
1696
|
+
# disable-model-invocation field — optional (schema default `true`
|
|
1697
|
+
# injected at read); validate the value only when present.
|
|
1698
|
+
dmi_match = DISABLE_MODEL_PATTERN.search(frontmatter)
|
|
1699
|
+
if dmi_match and dmi_match.group(1) != "true":
|
|
1700
|
+
issues.append(Issue("warning", "disable_model_invocation_false",
|
|
1701
|
+
"disable-model-invocation should be 'true' for commands"))
|
|
1702
|
+
|
|
1703
|
+
# description field
|
|
1704
|
+
description = extract_description(text)
|
|
1705
|
+
if not description:
|
|
1706
|
+
issues.append(Issue("warning", "missing_description", "Frontmatter description is missing"))
|
|
1707
|
+
elif len(description) > 200:
|
|
1708
|
+
issues.append(Issue("error", "description_too_long",
|
|
1709
|
+
f"Description is {len(description)} chars (hard cap: 200) — see road-to-governance-cleanup F6"))
|
|
1710
|
+
|
|
1711
|
+
# suggestion block (road-to-context-aware-command-suggestion Phase 2)
|
|
1712
|
+
issues.extend(_lint_command_suggestion_block(text))
|
|
1713
|
+
|
|
1714
|
+
# deprecation-shim warning line (P0.8b — command-clusters contract)
|
|
1715
|
+
if "superseded_by:" in frontmatter:
|
|
1716
|
+
shim_warning = re.search(
|
|
1717
|
+
r"⚠️\s+/[a-z][a-z0-9-]*\s+is deprecated;\s+use\s+/[a-z][a-z0-9 -]+\s+instead",
|
|
1718
|
+
text,
|
|
1719
|
+
)
|
|
1720
|
+
if not shim_warning:
|
|
1721
|
+
issues.append(Issue(
|
|
1722
|
+
"error", "shim_missing_warning",
|
|
1723
|
+
"Deprecation shim must contain a one-line warning matching "
|
|
1724
|
+
"'⚠️ /<old-name> is deprecated; use /<cluster> <sub> instead.'"
|
|
1725
|
+
" (or '/<cluster> --<flag>' for flag-clusters)"
|
|
1726
|
+
" (see docs/contracts/command-clusters.md § Deprecation shim contract)"
|
|
1727
|
+
))
|
|
1728
|
+
|
|
1729
|
+
# --- Structure checks ---
|
|
1730
|
+
if not H1_PATTERN.search(text):
|
|
1731
|
+
issues.append(Issue("error", "missing_h1", "Command is missing an H1 heading (# Title)"))
|
|
1732
|
+
|
|
1733
|
+
# Must have at least one ## section with steps. Cluster-head and
|
|
1734
|
+
# router-style commands (frontmatter cluster:/routes_to: or ≥ 3 .md
|
|
1735
|
+
# links) are exempt — they delegate procedure to sub-commands or
|
|
1736
|
+
# skills (road-to-feedback-followups P2.1).
|
|
1737
|
+
sections = extract_sections(text)
|
|
1738
|
+
has_steps = any(s.lower().startswith("step") for s in sections)
|
|
1739
|
+
# Accept both ``## 1.`` / ``### 1.`` numbered headings AND
|
|
1740
|
+
# ``### Step N`` / ``## Step N`` step-prefixed sub-headings.
|
|
1741
|
+
has_numbered = bool(re.search(r"^###?\s+(?:\d+\.|step\s+\d+)\s+", text, re.MULTILINE | re.IGNORECASE))
|
|
1742
|
+
if not has_steps and not has_numbered:
|
|
1743
|
+
delegated = _command_delegation_signal(text, frontmatter)
|
|
1744
|
+
if not delegated:
|
|
1745
|
+
issues.append(Issue("warning", "no_steps", "Command has no Steps section or numbered sub-headings"))
|
|
1746
|
+
|
|
1747
|
+
# --- Size check (docs/contracts/linter-structural-model.md) ---
|
|
1748
|
+
# Structural-density gate replaces sub-section + code-block heuristic
|
|
1749
|
+
# (Phase 3 of road-to-structural-linter-reform, 2026-05-08): warn only
|
|
1750
|
+
# when the command is large, lacks a delegation signal (frontmatter
|
|
1751
|
+
# cluster:/routes_to: OR ≥ 3 markdown links to other .md files), AND
|
|
1752
|
+
# has density < 0.65.
|
|
1753
|
+
word_count = len(text.split())
|
|
1754
|
+
if word_count > 1000:
|
|
1755
|
+
density = _density_score(text)
|
|
1756
|
+
delegated = _command_delegation_signal(text, frontmatter)
|
|
1757
|
+
if not delegated and density < 0.65:
|
|
1758
|
+
issues.append(Issue(
|
|
1759
|
+
"warning",
|
|
1760
|
+
"large_command",
|
|
1761
|
+
f"Command has {word_count} words, density {density:.2f} < 0.65, "
|
|
1762
|
+
f"no delegation signal (frontmatter cluster:/routes_to: or "
|
|
1763
|
+
f"≥ 3 .md links); review for split or delegation "
|
|
1764
|
+
f"(see linter-structural-model contract)",
|
|
1765
|
+
))
|
|
1766
|
+
|
|
1767
|
+
# File must end with exactly one newline
|
|
1768
|
+
if not text.endswith("\n"):
|
|
1769
|
+
issues.append(Issue("error", "no_trailing_newline", "File must end with exactly one newline"))
|
|
1770
|
+
elif text.endswith("\n\n"):
|
|
1771
|
+
issues.append(Issue("warning", "extra_trailing_newlines", "File ends with multiple newlines; should be exactly one"))
|
|
1772
|
+
|
|
1773
|
+
# Role-contract anchor validity (road-to-role-modes Phase 1).
|
|
1774
|
+
issues.extend(lint_role_contract_refs(text))
|
|
1775
|
+
|
|
1776
|
+
return LintResult(
|
|
1777
|
+
file=str(path),
|
|
1778
|
+
artifact_type="command",
|
|
1779
|
+
status=classify_status(issues),
|
|
1780
|
+
issues=issues,
|
|
1781
|
+
suggestions=dedupe_preserve_order(suggestions),
|
|
1782
|
+
)
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
def lint_unknown(path: Path, text: str) -> LintResult:
|
|
1786
|
+
issues = [Issue("error", "unknown_artifact", "Could not detect whether file is a skill, rule, or command")]
|
|
1787
|
+
return LintResult(
|
|
1788
|
+
file=str(path),
|
|
1789
|
+
artifact_type="unknown",
|
|
1790
|
+
status="fail",
|
|
1791
|
+
issues=issues,
|
|
1792
|
+
suggestions=["Move the file into a recognized skills/, rules/, or commands/ path"],
|
|
1793
|
+
)
|
|
1794
|
+
|
|
1795
|
+
|
|
1796
|
+
def lint_guideline(path: Path, text: str) -> LintResult:
|
|
1797
|
+
"""Lint a guideline .md file (size + structure checks)."""
|
|
1798
|
+
issues: List[Issue] = []
|
|
1799
|
+
|
|
1800
|
+
# H1 heading
|
|
1801
|
+
if not H1_PATTERN.search(text):
|
|
1802
|
+
issues.append(Issue("warning", "missing_h1", "Guideline is missing an H1 heading"))
|
|
1803
|
+
|
|
1804
|
+
# Size check (guidelines/agent-infra/size-and-scope.md: target 400-1500 words)
|
|
1805
|
+
word_count = len(text.split())
|
|
1806
|
+
if word_count > 1500:
|
|
1807
|
+
issues.append(Issue("info", "large_guideline", f"Guideline has {word_count} words (target: 400-1500)"))
|
|
1808
|
+
|
|
1809
|
+
# Trailing newline
|
|
1810
|
+
if not text.endswith("\n"):
|
|
1811
|
+
issues.append(Issue("warning", "no_trailing_newline", "File must end with exactly one newline"))
|
|
1812
|
+
|
|
1813
|
+
return LintResult(
|
|
1814
|
+
file=str(path),
|
|
1815
|
+
artifact_type="guideline",
|
|
1816
|
+
status=classify_status(issues),
|
|
1817
|
+
issues=issues,
|
|
1818
|
+
suggestions=[],
|
|
1819
|
+
)
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
def lint_persona(path: Path, text: str) -> LintResult:
|
|
1823
|
+
"""Lint a persona .md file (frontmatter schema + required sections + size)."""
|
|
1824
|
+
issues: List[Issue] = []
|
|
1825
|
+
|
|
1826
|
+
# Frontmatter required
|
|
1827
|
+
frontmatter = extract_frontmatter(text)
|
|
1828
|
+
if not frontmatter:
|
|
1829
|
+
issues.append(Issue("error", "missing_frontmatter", "Persona requires YAML frontmatter"))
|
|
1830
|
+
return LintResult(
|
|
1831
|
+
file=str(path),
|
|
1832
|
+
artifact_type="persona",
|
|
1833
|
+
status="fail",
|
|
1834
|
+
issues=issues,
|
|
1835
|
+
suggestions=["See .agent-src.uncondensed/templates/persona.md for the schema"],
|
|
1836
|
+
)
|
|
1837
|
+
|
|
1838
|
+
# Required frontmatter fields
|
|
1839
|
+
required = {
|
|
1840
|
+
"id": re.compile(r'^id:\s*"?([\w-]+)"?\s*$', re.MULTILINE),
|
|
1841
|
+
"role": re.compile(r'^role:\s*"?(.+?)"?\s*$', re.MULTILINE),
|
|
1842
|
+
"description": re.compile(r'^description:\s*"?(.+?)"?\s*$', re.MULTILINE),
|
|
1843
|
+
"tier": re.compile(r'^tier:\s*"?(\w+)"?\s*$', re.MULTILINE),
|
|
1844
|
+
}
|
|
1845
|
+
# `version` (default "1.0") and `source` (default "package") carry schema
|
|
1846
|
+
# defaults — they are injected at read time, so omitting them is valid.
|
|
1847
|
+
# Validate the value only when present; never require presence.
|
|
1848
|
+
optional_defaulted = {
|
|
1849
|
+
"version": re.compile(r'^version:\s*"?(.+?)"?\s*$', re.MULTILINE),
|
|
1850
|
+
"source": re.compile(r'^source:\s*"?(package|project)"?\s*$', re.MULTILINE),
|
|
1851
|
+
}
|
|
1852
|
+
parsed: dict = {}
|
|
1853
|
+
for field, pattern in required.items():
|
|
1854
|
+
value = extract_frontmatter_field(frontmatter, pattern)
|
|
1855
|
+
if not value:
|
|
1856
|
+
issues.append(Issue("error", f"missing_{field}", f"Persona frontmatter must declare `{field}`"))
|
|
1857
|
+
else:
|
|
1858
|
+
parsed[field] = value
|
|
1859
|
+
for field, pattern in optional_defaulted.items():
|
|
1860
|
+
value = extract_frontmatter_field(frontmatter, pattern)
|
|
1861
|
+
if value:
|
|
1862
|
+
parsed[field] = value
|
|
1863
|
+
|
|
1864
|
+
# id matches filename stem
|
|
1865
|
+
if "id" in parsed and parsed["id"] != path.stem:
|
|
1866
|
+
issues.append(Issue(
|
|
1867
|
+
"error",
|
|
1868
|
+
"id_filename_mismatch",
|
|
1869
|
+
f"Persona id `{parsed['id']}` must match filename stem `{path.stem}`",
|
|
1870
|
+
))
|
|
1871
|
+
|
|
1872
|
+
# tier in valid set
|
|
1873
|
+
if "tier" in parsed and parsed["tier"] not in VALID_PERSONA_TIERS:
|
|
1874
|
+
issues.append(Issue(
|
|
1875
|
+
"error",
|
|
1876
|
+
"invalid_tier",
|
|
1877
|
+
f"Persona tier `{parsed['tier']}` must be one of {sorted(VALID_PERSONA_TIERS)}",
|
|
1878
|
+
))
|
|
1879
|
+
|
|
1880
|
+
# wing — optional; when present must be one of {1,2,3,4} (per
|
|
1881
|
+
# docs/contracts/package-self-orientation.md § The four wings).
|
|
1882
|
+
wing_match = re.search(r'^wing:\s*"?(\d+)"?\s*$', frontmatter, re.MULTILINE)
|
|
1883
|
+
if wing_match:
|
|
1884
|
+
try:
|
|
1885
|
+
wing_value = int(wing_match.group(1))
|
|
1886
|
+
if wing_value in VALID_PERSONA_WINGS:
|
|
1887
|
+
parsed["wing"] = wing_value
|
|
1888
|
+
else:
|
|
1889
|
+
issues.append(Issue(
|
|
1890
|
+
"error",
|
|
1891
|
+
"invalid_wing",
|
|
1892
|
+
f"Persona wing `{wing_value}` must be one of {sorted(VALID_PERSONA_WINGS)}",
|
|
1893
|
+
))
|
|
1894
|
+
except ValueError:
|
|
1895
|
+
issues.append(Issue(
|
|
1896
|
+
"error",
|
|
1897
|
+
"invalid_wing",
|
|
1898
|
+
f"Persona wing `{wing_match.group(1)}` must be an integer 1–4",
|
|
1899
|
+
))
|
|
1900
|
+
|
|
1901
|
+
# description length
|
|
1902
|
+
if "description" in parsed and len(parsed["description"]) > 160:
|
|
1903
|
+
issues.append(Issue(
|
|
1904
|
+
"warning",
|
|
1905
|
+
"long_description",
|
|
1906
|
+
f"Persona description is {len(parsed['description'])} chars (target ≤ 160)",
|
|
1907
|
+
))
|
|
1908
|
+
|
|
1909
|
+
# Required sections — tier-aware (per docs/contracts/persona-schema.md § 3).
|
|
1910
|
+
# Core: 5 sections. Specialist: Core-5 + Critical Rules + Workflows.
|
|
1911
|
+
sections = extract_sections(text)
|
|
1912
|
+
tier = parsed.get("tier")
|
|
1913
|
+
if tier == "specialist":
|
|
1914
|
+
required_sections = REQUIRED_PERSONA_SECTIONS_SPECIALIST
|
|
1915
|
+
else:
|
|
1916
|
+
# Default to core sections when tier is missing or invalid; the
|
|
1917
|
+
# tier-enum check above already raised an error in that case.
|
|
1918
|
+
required_sections = REQUIRED_PERSONA_SECTIONS_CORE
|
|
1919
|
+
for required_section in required_sections:
|
|
1920
|
+
if required_section not in sections:
|
|
1921
|
+
issues.append(Issue(
|
|
1922
|
+
"error",
|
|
1923
|
+
"missing_section",
|
|
1924
|
+
f"Persona is missing required section `## {required_section}`",
|
|
1925
|
+
))
|
|
1926
|
+
|
|
1927
|
+
# Unique Questions must have ≥ 3 bullet items
|
|
1928
|
+
uq_block = extract_section_block(text, "Unique Questions")
|
|
1929
|
+
if uq_block:
|
|
1930
|
+
bullet_count = len(re.findall(r"^\s*[-*]\s+", uq_block, re.MULTILINE))
|
|
1931
|
+
if bullet_count < 3:
|
|
1932
|
+
issues.append(Issue(
|
|
1933
|
+
"warning",
|
|
1934
|
+
"too_few_unique_questions",
|
|
1935
|
+
f"Persona has {bullet_count} unique questions (target ≥ 3)",
|
|
1936
|
+
))
|
|
1937
|
+
|
|
1938
|
+
# Size budget by tier — wing-overrides apply when the persona declares a
|
|
1939
|
+
# `wing:` field; defaults to the tier baseline otherwise.
|
|
1940
|
+
if "tier" in parsed and parsed["tier"] in PERSONA_LINE_BUDGETS:
|
|
1941
|
+
tier_value = parsed["tier"]
|
|
1942
|
+
wing_value = parsed.get("wing")
|
|
1943
|
+
budget = PERSONA_LINE_BUDGETS_BY_WING.get(
|
|
1944
|
+
(tier_value, wing_value), PERSONA_LINE_BUDGETS[tier_value]
|
|
1945
|
+
)
|
|
1946
|
+
line_count = len(text.splitlines())
|
|
1947
|
+
if line_count > budget:
|
|
1948
|
+
scope = f"{tier_value}" if wing_value is None else f"{tier_value}, wing {wing_value}"
|
|
1949
|
+
issues.append(Issue(
|
|
1950
|
+
"warning",
|
|
1951
|
+
"size_budget",
|
|
1952
|
+
f"Persona has {line_count} lines ({scope} budget ≤ {budget})",
|
|
1953
|
+
))
|
|
1954
|
+
|
|
1955
|
+
# H1 heading
|
|
1956
|
+
if not H1_PATTERN.search(text):
|
|
1957
|
+
issues.append(Issue("warning", "missing_h1", "Persona is missing an H1 heading"))
|
|
1958
|
+
|
|
1959
|
+
# Trailing newline
|
|
1960
|
+
if not text.endswith("\n"):
|
|
1961
|
+
issues.append(Issue("warning", "no_trailing_newline", "File must end with exactly one newline"))
|
|
1962
|
+
|
|
1963
|
+
return LintResult(
|
|
1964
|
+
file=str(path),
|
|
1965
|
+
artifact_type="persona",
|
|
1966
|
+
status=classify_status(issues),
|
|
1967
|
+
issues=issues,
|
|
1968
|
+
suggestions=[],
|
|
1969
|
+
)
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
def lint_usertype(path: Path, text: str) -> LintResult:
|
|
1973
|
+
"""Lint a user-type .md file (frontmatter schema + required sections + size).
|
|
1974
|
+
|
|
1975
|
+
User-types are the runtime end-user simulation lens (sister axis to
|
|
1976
|
+
personas — methodology vs end-user). Contract:
|
|
1977
|
+
docs/contracts/user-type-schema.md.
|
|
1978
|
+
"""
|
|
1979
|
+
issues: List[Issue] = []
|
|
1980
|
+
|
|
1981
|
+
frontmatter = extract_frontmatter(text)
|
|
1982
|
+
if not frontmatter:
|
|
1983
|
+
issues.append(Issue("error", "missing_frontmatter", "User-type requires YAML frontmatter"))
|
|
1984
|
+
return LintResult(
|
|
1985
|
+
file=str(path),
|
|
1986
|
+
artifact_type="user-type",
|
|
1987
|
+
status="fail",
|
|
1988
|
+
issues=issues,
|
|
1989
|
+
suggestions=[".agent-src.uncondensed/user-types/_template/user-type.md"],
|
|
1990
|
+
)
|
|
1991
|
+
|
|
1992
|
+
# Required keys per docs/contracts/user-type-schema.md § 1.
|
|
1993
|
+
required = {
|
|
1994
|
+
"id": re.compile(r'^id:\s*"?([\w-]+)"?\s*$', re.MULTILINE),
|
|
1995
|
+
"kind": re.compile(r'^kind:\s*"?([\w-]+)"?\s*$', re.MULTILINE),
|
|
1996
|
+
"description": re.compile(r'^description:\s*"?([^"\n]+?)"?\s*$', re.MULTILINE),
|
|
1997
|
+
"version": re.compile(r'^version:\s*"?([\d.]+)"?\s*$', re.MULTILINE),
|
|
1998
|
+
"source": re.compile(r'^source:\s*"?(package|project)"?\s*$', re.MULTILINE),
|
|
1999
|
+
}
|
|
2000
|
+
parsed: dict = {}
|
|
2001
|
+
for field, pattern in required.items():
|
|
2002
|
+
value = extract_frontmatter_field(frontmatter, pattern)
|
|
2003
|
+
if not value:
|
|
2004
|
+
issues.append(Issue("error", f"missing_{field}", f"User-type frontmatter must declare `{field}`"))
|
|
2005
|
+
else:
|
|
2006
|
+
parsed[field] = value
|
|
2007
|
+
|
|
2008
|
+
if "id" in parsed and parsed["id"] != path.stem:
|
|
2009
|
+
issues.append(Issue(
|
|
2010
|
+
"error",
|
|
2011
|
+
"id_filename_mismatch",
|
|
2012
|
+
f"User-type id `{parsed['id']}` must match filename stem `{path.stem}`",
|
|
2013
|
+
))
|
|
2014
|
+
|
|
2015
|
+
if "kind" in parsed and parsed["kind"] != "user-type":
|
|
2016
|
+
issues.append(Issue(
|
|
2017
|
+
"error",
|
|
2018
|
+
"invalid_kind",
|
|
2019
|
+
f"User-type kind must be `user-type` (got `{parsed['kind']}`)",
|
|
2020
|
+
))
|
|
2021
|
+
|
|
2022
|
+
if "description" in parsed and len(parsed["description"]) > 160:
|
|
2023
|
+
issues.append(Issue(
|
|
2024
|
+
"warning",
|
|
2025
|
+
"long_description",
|
|
2026
|
+
f"User-type description is {len(parsed['description'])} chars (target ≤ 160)",
|
|
2027
|
+
))
|
|
2028
|
+
|
|
2029
|
+
sections = extract_sections(text)
|
|
2030
|
+
for required_section in REQUIRED_USERTYPE_SECTIONS:
|
|
2031
|
+
if required_section not in sections:
|
|
2032
|
+
issues.append(Issue(
|
|
2033
|
+
"error",
|
|
2034
|
+
"missing_section",
|
|
2035
|
+
f"User-type is missing required section `## {required_section}`",
|
|
2036
|
+
))
|
|
2037
|
+
|
|
2038
|
+
# Anti-Generic Quality Bar: ≥ 3 Unique Questions
|
|
2039
|
+
uq_block = extract_section_block(text, "Unique Questions")
|
|
2040
|
+
if uq_block:
|
|
2041
|
+
bullet_count = len(re.findall(r"^\s*[-*]\s+", uq_block, re.MULTILINE))
|
|
2042
|
+
if bullet_count < 3:
|
|
2043
|
+
issues.append(Issue(
|
|
2044
|
+
"warning",
|
|
2045
|
+
"too_few_unique_questions",
|
|
2046
|
+
f"User-type has {bullet_count} unique questions (target ≥ 3)",
|
|
2047
|
+
))
|
|
2048
|
+
|
|
2049
|
+
line_count = len(text.splitlines())
|
|
2050
|
+
if line_count > USERTYPE_LINE_BUDGET:
|
|
2051
|
+
issues.append(Issue(
|
|
2052
|
+
"warning",
|
|
2053
|
+
"size_budget",
|
|
2054
|
+
f"User-type has {line_count} lines (budget ≤ {USERTYPE_LINE_BUDGET})",
|
|
2055
|
+
))
|
|
2056
|
+
|
|
2057
|
+
if not H1_PATTERN.search(text):
|
|
2058
|
+
issues.append(Issue("warning", "missing_h1", "User-type is missing an H1 heading"))
|
|
2059
|
+
|
|
2060
|
+
if not text.endswith("\n"):
|
|
2061
|
+
issues.append(Issue("warning", "no_trailing_newline", "File must end with exactly one newline"))
|
|
2062
|
+
|
|
2063
|
+
return LintResult(
|
|
2064
|
+
file=str(path),
|
|
2065
|
+
artifact_type="user-type",
|
|
2066
|
+
status=classify_status(issues),
|
|
2067
|
+
issues=issues,
|
|
2068
|
+
suggestions=[],
|
|
2069
|
+
)
|
|
2070
|
+
|
|
2071
|
+
|
|
2072
|
+
def gather_all_candidate_files(root: Path) -> list[Path]:
|
|
2073
|
+
"""Gather all lintable files across every source root (ADR-017 multi-root).
|
|
2074
|
+
|
|
2075
|
+
Walks ``artefact_roots()`` (legacy ``.agent-src.uncondensed/`` plus every
|
|
2076
|
+
``packages/*/.agent-src.uncondensed/``). Falls back to ``dist/agent-src/``
|
|
2077
|
+
only when no source root exists. Skips symlinks to avoid double-counting.
|
|
2078
|
+
Deduplicates on logical relpath \u2014 first root wins per the agent_src
|
|
2079
|
+
contract.
|
|
2080
|
+
"""
|
|
2081
|
+
candidates: list[Path] = []
|
|
2082
|
+
seen_logical: set[str] = set()
|
|
2083
|
+
|
|
2084
|
+
def _add(file: Path, source_root: Path) -> None:
|
|
2085
|
+
if file.is_symlink() or not file.is_file():
|
|
2086
|
+
return
|
|
2087
|
+
try:
|
|
2088
|
+
logical = file.relative_to(source_root).as_posix()
|
|
2089
|
+
except ValueError:
|
|
2090
|
+
logical = file.name
|
|
2091
|
+
# Namespace by artefact-kind subdir so the same skill name across
|
|
2092
|
+
# packs would still dedupe (but the agent_src layout guarantees
|
|
2093
|
+
# each logical path lives in exactly one root post-move).
|
|
2094
|
+
if logical in seen_logical:
|
|
2095
|
+
return
|
|
2096
|
+
seen_logical.add(logical)
|
|
2097
|
+
candidates.append(file)
|
|
2098
|
+
|
|
2099
|
+
sources = artefact_roots()
|
|
2100
|
+
if sources:
|
|
2101
|
+
for src_root in sources:
|
|
2102
|
+
for f in (src_root / "skills").rglob("SKILL.md") if (src_root / "skills").exists() else []:
|
|
2103
|
+
_add(f, src_root)
|
|
2104
|
+
for sub in ("rules", "commands", "guidelines"):
|
|
2105
|
+
base = src_root / sub
|
|
2106
|
+
if base.exists():
|
|
2107
|
+
for f in base.rglob("*.md"):
|
|
2108
|
+
_add(f, src_root)
|
|
2109
|
+
for sub in ("personas", "user-types"):
|
|
2110
|
+
base = src_root / sub
|
|
2111
|
+
if base.exists():
|
|
2112
|
+
for f in base.glob("*.md"):
|
|
2113
|
+
if f.name.lower() == "readme.md":
|
|
2114
|
+
continue
|
|
2115
|
+
_add(f, src_root)
|
|
2116
|
+
charter = src_root / FRUGALITY_CHARTER_RELPATH
|
|
2117
|
+
if charter.exists() and not charter.is_symlink():
|
|
2118
|
+
_add(charter, src_root)
|
|
2119
|
+
else:
|
|
2120
|
+
# Pure-condensed fallback (dist/agent-src/ only). Used by consumer
|
|
2121
|
+
# projects that vendor the condensed tree without sources.
|
|
2122
|
+
augment_root = root / "dist/agent-src"
|
|
2123
|
+
if augment_root.exists():
|
|
2124
|
+
for sub_pattern in (
|
|
2125
|
+
("skills", "SKILL.md"),
|
|
2126
|
+
("rules", "*.md"),
|
|
2127
|
+
("commands", "*.md"),
|
|
2128
|
+
("guidelines", "*.md"),
|
|
2129
|
+
):
|
|
2130
|
+
base = augment_root / sub_pattern[0]
|
|
2131
|
+
if base.exists():
|
|
2132
|
+
for f in base.rglob(sub_pattern[1]):
|
|
2133
|
+
_add(f, augment_root)
|
|
2134
|
+
for sub in ("personas", "user-types"):
|
|
2135
|
+
base = augment_root / sub
|
|
2136
|
+
if base.exists():
|
|
2137
|
+
for f in base.glob("*.md"):
|
|
2138
|
+
if f.name.lower() == "readme.md":
|
|
2139
|
+
continue
|
|
2140
|
+
_add(f, augment_root)
|
|
2141
|
+
charter = augment_root / FRUGALITY_CHARTER_RELPATH
|
|
2142
|
+
if charter.exists() and not charter.is_symlink():
|
|
2143
|
+
_add(charter, augment_root)
|
|
2144
|
+
|
|
2145
|
+
return sorted(set(candidates))
|
|
2146
|
+
|
|
2147
|
+
|
|
2148
|
+
def gather_candidate_files_under(src_root: Path) -> list[Path]:
|
|
2149
|
+
"""Gather lintable files under an arbitrary source root.
|
|
2150
|
+
|
|
2151
|
+
Mirrors the per-root walk used by ``gather_all_candidate_files`` but
|
|
2152
|
+
scoped to a single directory \u2014 e.g. ``packages/pack-laravel/.agent-src.uncondensed/``
|
|
2153
|
+
so CI can lint a single pack in parallel (ADR-017 Phase 4.4).
|
|
2154
|
+
Skips symlinks and ``README.md`` siblings under ``personas/`` /
|
|
2155
|
+
``user-types/``.
|
|
2156
|
+
"""
|
|
2157
|
+
out: list[Path] = []
|
|
2158
|
+
if not src_root.is_dir():
|
|
2159
|
+
return out
|
|
2160
|
+
seen: set[Path] = set()
|
|
2161
|
+
|
|
2162
|
+
def _push(file: Path) -> None:
|
|
2163
|
+
if file.is_symlink() or not file.is_file():
|
|
2164
|
+
return
|
|
2165
|
+
resolved = file.resolve()
|
|
2166
|
+
if resolved in seen:
|
|
2167
|
+
return
|
|
2168
|
+
seen.add(resolved)
|
|
2169
|
+
out.append(file)
|
|
2170
|
+
|
|
2171
|
+
skills_dir = src_root / "skills"
|
|
2172
|
+
if skills_dir.exists():
|
|
2173
|
+
for f in skills_dir.rglob("SKILL.md"):
|
|
2174
|
+
_push(f)
|
|
2175
|
+
for sub in ("rules", "commands", "guidelines"):
|
|
2176
|
+
base = src_root / sub
|
|
2177
|
+
if base.exists():
|
|
2178
|
+
for f in base.rglob("*.md"):
|
|
2179
|
+
_push(f)
|
|
2180
|
+
for sub in ("personas", "user-types"):
|
|
2181
|
+
base = src_root / sub
|
|
2182
|
+
if base.exists():
|
|
2183
|
+
for f in base.glob("*.md"):
|
|
2184
|
+
if f.name.lower() == "readme.md":
|
|
2185
|
+
continue
|
|
2186
|
+
_push(f)
|
|
2187
|
+
charter = src_root / FRUGALITY_CHARTER_RELPATH
|
|
2188
|
+
if charter.exists() and not charter.is_symlink():
|
|
2189
|
+
_push(charter)
|
|
2190
|
+
return sorted(set(out))
|
|
2191
|
+
|
|
2192
|
+
|
|
2193
|
+
def gather_changed_candidate_files(root: Path) -> list[Path]:
|
|
2194
|
+
"""Find changed skill/rule files using git diff.
|
|
2195
|
+
|
|
2196
|
+
Tries multiple strategies:
|
|
2197
|
+
1. CI: diff against origin/main (PR changes)
|
|
2198
|
+
2. Local: staged changes (git diff --cached)
|
|
2199
|
+
3. Fallback: unstaged changes (git diff HEAD)
|
|
2200
|
+
"""
|
|
2201
|
+
diff_commands = [
|
|
2202
|
+
["git", "diff", "--name-only", "origin/main...HEAD"],
|
|
2203
|
+
["git", "diff", "--name-only", "--cached", "HEAD"],
|
|
2204
|
+
["git", "diff", "--name-only", "HEAD"],
|
|
2205
|
+
]
|
|
2206
|
+
try:
|
|
2207
|
+
raw_lines: list[str] = []
|
|
2208
|
+
for cmd in diff_commands:
|
|
2209
|
+
result = subprocess.run(
|
|
2210
|
+
cmd, cwd=root, text=True, capture_output=True, check=False,
|
|
2211
|
+
)
|
|
2212
|
+
if result.returncode == 0 and result.stdout.strip():
|
|
2213
|
+
raw_lines = result.stdout.splitlines()
|
|
2214
|
+
break
|
|
2215
|
+
|
|
2216
|
+
files = []
|
|
2217
|
+
for raw in raw_lines:
|
|
2218
|
+
raw = raw.strip()
|
|
2219
|
+
if not raw:
|
|
2220
|
+
continue
|
|
2221
|
+
path = root / raw
|
|
2222
|
+
if not path.exists():
|
|
2223
|
+
continue
|
|
2224
|
+
# Skip symlinks to avoid double-counting (e.g. .claude/skills/ → dist/agent-src/commands/)
|
|
2225
|
+
if path.is_symlink():
|
|
2226
|
+
continue
|
|
2227
|
+
norm = raw.replace("\\", "/")
|
|
2228
|
+
# Only lint source-of-truth and source-mirror dirs. Projection
|
|
2229
|
+
# dirs (.windsurf/, .cursor/, .clinerules/, .claude/) use
|
|
2230
|
+
# tool-native frontmatter (e.g. Windsurf's trigger/globs) that
|
|
2231
|
+
# the linter does not validate — they regenerate from source.
|
|
2232
|
+
# ADR-017: accept legacy flat layout AND
|
|
2233
|
+
# packages/*/.agent-src.uncondensed/ paths.
|
|
2234
|
+
in_source = (
|
|
2235
|
+
norm.startswith(".agent-src.uncondensed/")
|
|
2236
|
+
or norm.startswith("dist/agent-src/")
|
|
2237
|
+
or "/.agent-src.uncondensed/" in norm
|
|
2238
|
+
or "/dist/agent-src/" in norm
|
|
2239
|
+
)
|
|
2240
|
+
if not in_source:
|
|
2241
|
+
continue
|
|
2242
|
+
# Only .md artefacts are lintable. Skip data sidecars under
|
|
2243
|
+
# `evals/` (e.g. commands/evals/<stem>.json routing evals, 6.0.0-C)
|
|
2244
|
+
# — they are not commands/rules and have no frontmatter/H1.
|
|
2245
|
+
is_md = path.suffix == ".md"
|
|
2246
|
+
in_evals = "/evals/" in norm
|
|
2247
|
+
if not in_evals and (
|
|
2248
|
+
path.name == "SKILL.md"
|
|
2249
|
+
or (is_md and ("/rules/" in norm or "/commands/" in norm))
|
|
2250
|
+
):
|
|
2251
|
+
files.append(path)
|
|
2252
|
+
return sorted(set(files))
|
|
2253
|
+
except Exception:
|
|
2254
|
+
return []
|
|
2255
|
+
|
|
2256
|
+
|
|
2257
|
+
# --- Interaction quality checks (keyword-based, for meta/interaction artifacts only) ---
|
|
2258
|
+
|
|
2259
|
+
# File name patterns that indicate an interaction/meta artifact (strict — avoids false positives)
|
|
2260
|
+
_INTERACTION_NAME_PATTERNS = re.compile(
|
|
2261
|
+
r"skill-router|handoff|analysis-skill|skill-writing|skill-reviewer|"
|
|
2262
|
+
r"model-recommendation|developer-like-execution|universal-project-analysis|"
|
|
2263
|
+
r"interaction|autonomous-mode|feature-planning",
|
|
2264
|
+
re.IGNORECASE,
|
|
2265
|
+
)
|
|
2266
|
+
_INTERACTION_CONTENT_KEYWORDS = {"handoff", "model switch", "clarification", "ask the user", "framework choice", "requirements are unclear"}
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
def _is_interaction_artifact(path: Path, text: str) -> bool:
|
|
2270
|
+
"""Check if file is an interaction/meta artifact that should get question-quality checks."""
|
|
2271
|
+
name = str(path).lower()
|
|
2272
|
+
# Strict name match — only truly interaction-focused artifacts
|
|
2273
|
+
if _INTERACTION_NAME_PATTERNS.search(name):
|
|
2274
|
+
return True
|
|
2275
|
+
# Content match needs 3+ keywords to avoid false positives on analysis/coding skills
|
|
2276
|
+
text_lower = text.lower()
|
|
2277
|
+
matches = sum(1 for kw in _INTERACTION_CONTENT_KEYWORDS if kw in text_lower)
|
|
2278
|
+
return matches >= 3
|
|
2279
|
+
|
|
2280
|
+
|
|
2281
|
+
def lint_interaction_quality(path: Path, text: str) -> List[Issue]:
|
|
2282
|
+
"""Check interaction/meta artifacts for question strategy, handoff order, etc."""
|
|
2283
|
+
if not _is_interaction_artifact(path, text):
|
|
2284
|
+
return []
|
|
2285
|
+
|
|
2286
|
+
issues: List[Issue] = []
|
|
2287
|
+
text_lower = text.lower()
|
|
2288
|
+
|
|
2289
|
+
# Only check files that explicitly discuss user questioning strategy
|
|
2290
|
+
has_question_context = any(kw in text_lower for kw in (
|
|
2291
|
+
"ask the user", "ask clarification", "numbered options", "present options",
|
|
2292
|
+
"question strategy", "ask before",
|
|
2293
|
+
))
|
|
2294
|
+
|
|
2295
|
+
# Check 1: Question strategy — distinguishes simple grouped vs complex sequential
|
|
2296
|
+
if has_question_context:
|
|
2297
|
+
has_simple = any(kw in text_lower for kw in ("simple", "binary", "independent"))
|
|
2298
|
+
has_complex = any(kw in text_lower for kw in ("complex", "one at a time", "one question"))
|
|
2299
|
+
if not (has_simple and has_complex):
|
|
2300
|
+
issues.append(Issue("warning", "question_strategy_missing",
|
|
2301
|
+
"Interaction guidance does not distinguish simple grouped questions "
|
|
2302
|
+
"from complex sequential questions"))
|
|
2303
|
+
|
|
2304
|
+
# Check 2: Handoff ordering — handoff/model-switch questions should come last
|
|
2305
|
+
has_handoff = any(kw in text_lower for kw in ("handoff", "model switch", "model-switch"))
|
|
2306
|
+
if has_handoff:
|
|
2307
|
+
has_ordering = any(kw in text_lower for kw in (
|
|
2308
|
+
"last", "after context", "after clarification", "after all",
|
|
2309
|
+
))
|
|
2310
|
+
if not has_ordering:
|
|
2311
|
+
issues.append(Issue("warning", "handoff_order_missing",
|
|
2312
|
+
"Handoff/model-switch guidance does not specify asking handoff "
|
|
2313
|
+
"questions AFTER context/domain questions"))
|
|
2314
|
+
|
|
2315
|
+
# Check 3: Framework choice guard — only when file explicitly discusses choosing between systems
|
|
2316
|
+
has_impl = any(kw in text_lower for kw in ("implement", "component", "ui component", "ui framework"))
|
|
2317
|
+
has_multi = any(kw in text_lower for kw in ("multiple frameworks", "multiple systems", "competing", "which framework"))
|
|
2318
|
+
if has_impl and has_multi:
|
|
2319
|
+
has_guard = any(kw in text_lower for kw in (
|
|
2320
|
+
"ask which", "ask before", "do not implement blindly", "analyze what exists",
|
|
2321
|
+
"do not pick", "clarif",
|
|
2322
|
+
))
|
|
2323
|
+
if not has_guard:
|
|
2324
|
+
issues.append(Issue("warning", "framework_choice_guard_missing",
|
|
2325
|
+
"Discusses implementation choices but does not require clarification "
|
|
2326
|
+
"when multiple frameworks/patterns exist"))
|
|
2327
|
+
|
|
2328
|
+
# Check 4: Clarification guard — only for files with explicit interaction/execution guidance
|
|
2329
|
+
has_execution_guidance = any(kw in text_lower for kw in ("procedure", "workflow", "step 1", "### 1."))
|
|
2330
|
+
if has_execution_guidance:
|
|
2331
|
+
has_clarification = any(kw in text_lower for kw in (
|
|
2332
|
+
"requirements are unclear", "ask clarification", "do not assume",
|
|
2333
|
+
"clarification question", "missing instructions", "incomplete",
|
|
2334
|
+
))
|
|
2335
|
+
if not has_clarification:
|
|
2336
|
+
issues.append(Issue("info", "clarification_guard_missing",
|
|
2337
|
+
"Contains action guidance but no explicit clarification behavior "
|
|
2338
|
+
"for incomplete requirements"))
|
|
2339
|
+
|
|
2340
|
+
# Check 5: Feedback learning — meta/reviewer artifacts should support learning
|
|
2341
|
+
is_meta = any(kw in str(path).lower() for kw in ("review", "improve", "learn", "audit", "optim"))
|
|
2342
|
+
if is_meta:
|
|
2343
|
+
has_learning = any(kw in text_lower for kw in (
|
|
2344
|
+
"learning", "feedback", "frustration", "capture", "improve the system",
|
|
2345
|
+
"rule / skill", "rule/skill",
|
|
2346
|
+
))
|
|
2347
|
+
if not has_learning:
|
|
2348
|
+
issues.append(Issue("info", "feedback_learning_missing",
|
|
2349
|
+
"Meta/reviewer artifact does not mention learning from negative "
|
|
2350
|
+
"feedback or converting failures into system improvements"))
|
|
2351
|
+
|
|
2352
|
+
return issues
|
|
2353
|
+
|
|
2354
|
+
|
|
2355
|
+
# --- Execution quality checks ---
|
|
2356
|
+
|
|
2357
|
+
# File name signals for execution-oriented artifacts
|
|
2358
|
+
_EXEC_FILE_SIGNALS = (
|
|
2359
|
+
"execution", "debug", "implement", "developer", "action",
|
|
2360
|
+
"validation", "testing", "coder", "bug", "fix",
|
|
2361
|
+
)
|
|
2362
|
+
|
|
2363
|
+
# Content signals that indicate execution-oriented artifact
|
|
2364
|
+
_EXEC_CONTENT_SIGNALS = (
|
|
2365
|
+
"implement", "debug", "refactor", "modify", "fix",
|
|
2366
|
+
"verify", "validate", "runtime", "test", "coding",
|
|
2367
|
+
"before acting", "before coding", "before changing",
|
|
2368
|
+
)
|
|
2369
|
+
|
|
2370
|
+
|
|
2371
|
+
def _is_execution_artifact(path: Path, text: str) -> bool:
|
|
2372
|
+
"""Detect if artifact is execution/implementation oriented.
|
|
2373
|
+
|
|
2374
|
+
Only skills and rules qualify — commands and guidelines are excluded
|
|
2375
|
+
because commands are workflows (not execution guidance) and guidelines
|
|
2376
|
+
are coding patterns (not developer workflow enforcement).
|
|
2377
|
+
"""
|
|
2378
|
+
path_lower = str(path).lower()
|
|
2379
|
+
text_lower = text.lower()
|
|
2380
|
+
|
|
2381
|
+
# Exclude commands, guidelines, personas, user-types — not execution-oriented
|
|
2382
|
+
if (
|
|
2383
|
+
"/commands/" in path_lower
|
|
2384
|
+
or "/guidelines/" in path_lower
|
|
2385
|
+
or "/personas/" in path_lower
|
|
2386
|
+
or "/user-types/" in path_lower
|
|
2387
|
+
):
|
|
2388
|
+
return False
|
|
2389
|
+
|
|
2390
|
+
# File name match — strong signal
|
|
2391
|
+
if any(sig in path_lower for sig in _EXEC_FILE_SIGNALS):
|
|
2392
|
+
return True
|
|
2393
|
+
|
|
2394
|
+
# Content match — need at least 5 signals to avoid false positives
|
|
2395
|
+
# (many artifacts mention "implement" or "fix" without being execution-focused)
|
|
2396
|
+
matches = sum(1 for sig in _EXEC_CONTENT_SIGNALS if sig in text_lower)
|
|
2397
|
+
return matches >= 5
|
|
2398
|
+
|
|
2399
|
+
|
|
2400
|
+
def lint_execution_quality(path: Path, text: str) -> List[Issue]:
|
|
2401
|
+
"""Check execution-oriented artifacts for developer workflow quality."""
|
|
2402
|
+
if not _is_execution_artifact(path, text):
|
|
2403
|
+
return []
|
|
2404
|
+
|
|
2405
|
+
issues: List[Issue] = []
|
|
2406
|
+
text_lower = text.lower()
|
|
2407
|
+
path_lower = str(path).lower()
|
|
2408
|
+
|
|
2409
|
+
# Strong match = file name signal; weak match = content-only signal
|
|
2410
|
+
is_strong_match = any(sig in path_lower for sig in _EXEC_FILE_SIGNALS)
|
|
2411
|
+
|
|
2412
|
+
# --- Signal groups ---
|
|
2413
|
+
# Each group uses broad synonyms to reduce false negatives.
|
|
2414
|
+
# Skills often express analysis/verification concepts without using
|
|
2415
|
+
# the exact words "analyze" or "verify".
|
|
2416
|
+
analysis_signals = (
|
|
2417
|
+
"analyze", "inspect", "understand", "read relevant",
|
|
2418
|
+
"review existing", "trace flow", "read affected",
|
|
2419
|
+
"check current", "before acting", "before coding",
|
|
2420
|
+
# Synonyms added in Phase 2b
|
|
2421
|
+
"examine", "study", "investigate", "check existing",
|
|
2422
|
+
"gather context", "read project", "read the changelog",
|
|
2423
|
+
"identify break", "assess", "before upgrading",
|
|
2424
|
+
"before changing", "before creating", "before modifying",
|
|
2425
|
+
"read docs", "read module", "read agents",
|
|
2426
|
+
)
|
|
2427
|
+
|
|
2428
|
+
verification_signals = (
|
|
2429
|
+
"verify", "validate", "test", "real execution",
|
|
2430
|
+
"run endpoint", "playwright", "curl", "postman",
|
|
2431
|
+
"debugger", "run tests", "hit the endpoint",
|
|
2432
|
+
# Synonyms added in Phase 2b
|
|
2433
|
+
"confirm", "assert", "check result", "observe",
|
|
2434
|
+
"run phpstan", "run rector", "build and verify",
|
|
2435
|
+
"must pass", "response shape",
|
|
2436
|
+
)
|
|
2437
|
+
|
|
2438
|
+
verification_tool_signals = (
|
|
2439
|
+
"playwright", "curl", "postman", "xdebug",
|
|
2440
|
+
"browser", "http::fake",
|
|
2441
|
+
# Synonyms added in Phase 2b
|
|
2442
|
+
"phpstan", "rector", "phpunit", "pest",
|
|
2443
|
+
"devcontainer build",
|
|
2444
|
+
)
|
|
2445
|
+
|
|
2446
|
+
debug_runtime_signals = (
|
|
2447
|
+
"debugger", "xdebug", "mcp debugger", "runtime inspection",
|
|
2448
|
+
"trace execution", "breakpoint", "step through",
|
|
2449
|
+
# Synonyms added in Phase 2b
|
|
2450
|
+
"runtime", "stack trace", "dump", "dd(",
|
|
2451
|
+
)
|
|
2452
|
+
|
|
2453
|
+
efficient_tooling_signals = (
|
|
2454
|
+
"jq", " rg ", "grep", "filter", "selective",
|
|
2455
|
+
"extract", "targeted", "--json", "--filter",
|
|
2456
|
+
# Synonyms added in Phase 2b
|
|
2457
|
+
"narrow", "scoped", "specific field", "only relevant",
|
|
2458
|
+
)
|
|
2459
|
+
|
|
2460
|
+
anti_bruteforce_signals = (
|
|
2461
|
+
"avoid retr", "do not brute", "do not guess",
|
|
2462
|
+
"do not retry blind", "analyze before retry",
|
|
2463
|
+
"blind retr", "trial-and-error", "trial and error",
|
|
2464
|
+
"max 2 retries", "stop and rethink",
|
|
2465
|
+
# Synonyms added in Phase 2b
|
|
2466
|
+
"diagnose", "root cause", "targeted fix",
|
|
2467
|
+
"do not blindly", "never guess",
|
|
2468
|
+
)
|
|
2469
|
+
|
|
2470
|
+
clarification_signals = (
|
|
2471
|
+
"ask", "clarif", "unclear", "missing information",
|
|
2472
|
+
"do not assume", "don't assume", "instead of assuming",
|
|
2473
|
+
# Synonyms added in Phase 2b
|
|
2474
|
+
"confirm with user", "verify requirement", "ambiguous",
|
|
2475
|
+
"if unsure", "when in doubt",
|
|
2476
|
+
)
|
|
2477
|
+
|
|
2478
|
+
# Helper
|
|
2479
|
+
def has_any(signals: tuple[str, ...]) -> bool:
|
|
2480
|
+
return any(s in text_lower for s in signals)
|
|
2481
|
+
|
|
2482
|
+
# --- Section-based detection (complement to keyword matching) ---
|
|
2483
|
+
# Detects structural signals: sections whose names imply analysis or verification.
|
|
2484
|
+
import re
|
|
2485
|
+
section_headers = re.findall(r'^#{1,4}\s+(.+)$', text, re.MULTILINE)
|
|
2486
|
+
section_headers_lower = [h.lower() for h in section_headers]
|
|
2487
|
+
|
|
2488
|
+
# Section names that imply analysis-before-action
|
|
2489
|
+
has_analysis_section = any(
|
|
2490
|
+
any(kw in h for kw in ("understand", "analyze", "assess", "context", "review",
|
|
2491
|
+
"current setup", "current state", "before"))
|
|
2492
|
+
for h in section_headers_lower
|
|
2493
|
+
)
|
|
2494
|
+
|
|
2495
|
+
# Section names that imply verification
|
|
2496
|
+
has_verification_section = any(
|
|
2497
|
+
any(kw in h for kw in ("verify", "validat", "test", "acceptance", "quality gate"))
|
|
2498
|
+
for h in section_headers_lower
|
|
2499
|
+
)
|
|
2500
|
+
|
|
2501
|
+
# Section names that imply anti-patterns / gotchas
|
|
2502
|
+
has_antipattern_section = any(
|
|
2503
|
+
any(kw in h for kw in ("do not", "don't", "gotcha", "anti-pattern", "avoid"))
|
|
2504
|
+
for h in section_headers_lower
|
|
2505
|
+
)
|
|
2506
|
+
|
|
2507
|
+
# Detect implementation/change language
|
|
2508
|
+
change_signals = ("implement", "modify", "fix", "refactor", "change", "update", "code")
|
|
2509
|
+
has_change_language = any(s in text_lower for s in change_signals)
|
|
2510
|
+
|
|
2511
|
+
# Combine keyword + section signals
|
|
2512
|
+
has_analysis = has_any(analysis_signals) or has_analysis_section
|
|
2513
|
+
has_verification = has_any(verification_signals) or has_verification_section
|
|
2514
|
+
|
|
2515
|
+
# --- Check 1: Missing analysis-before-action (ERROR, skills only) ---
|
|
2516
|
+
# Rules describe constraints, not workflows — they don't need analysis sections
|
|
2517
|
+
is_skill = "/skills/" in str(path).lower()
|
|
2518
|
+
if is_skill and has_change_language and not has_analysis:
|
|
2519
|
+
issues.append(Issue("error", "missing_analysis_before_action",
|
|
2520
|
+
"Execution-oriented skill encourages implementation "
|
|
2521
|
+
"without requiring prior analysis of existing system"))
|
|
2522
|
+
|
|
2523
|
+
# --- Check 2: Missing real verification (ERROR, skills with strong match) ---
|
|
2524
|
+
if is_skill and is_strong_match and has_change_language and not has_verification:
|
|
2525
|
+
issues.append(Issue("error", "missing_real_verification",
|
|
2526
|
+
"Implementation/debugging skill does not require "
|
|
2527
|
+
"real verification after changes"))
|
|
2528
|
+
|
|
2529
|
+
# Checks 3-7 only apply to strong matches (file name signal) to avoid noise
|
|
2530
|
+
# on generic skills that happen to mention "implement" or "fix"
|
|
2531
|
+
if is_strong_match:
|
|
2532
|
+
# --- Check 3: Missing verification tool mapping (WARNING) ---
|
|
2533
|
+
if has_any(verification_signals) and not has_any(verification_tool_signals):
|
|
2534
|
+
issues.append(Issue("warning", "missing_verification_tool_mapping",
|
|
2535
|
+
"Verification is generic — does not reference concrete "
|
|
2536
|
+
"tools (Playwright, curl, Postman, Xdebug)"))
|
|
2537
|
+
|
|
2538
|
+
# --- Check 4: Missing runtime debug guidance (WARNING) ---
|
|
2539
|
+
debug_context = any(s in text_lower for s in ("debug", "execution flow", "trace", "unexpected behavior"))
|
|
2540
|
+
if debug_context and not has_any(debug_runtime_signals):
|
|
2541
|
+
issues.append(Issue("warning", "missing_runtime_debug_guidance",
|
|
2542
|
+
"Debugging/execution artifact does not mention "
|
|
2543
|
+
"runtime debug tools (Xdebug, debugger, breakpoints)"))
|
|
2544
|
+
|
|
2545
|
+
# --- Check 5: Missing efficient tooling guidance (WARNING) ---
|
|
2546
|
+
data_context = any(s in text_lower for s in ("api", "log", "json", "response", "output", "data"))
|
|
2547
|
+
if data_context and not has_any(efficient_tooling_signals):
|
|
2548
|
+
issues.append(Issue("warning", "missing_efficient_tooling_guidance",
|
|
2549
|
+
"Artifact does not encourage targeted filtering tools "
|
|
2550
|
+
"(jq, rg, grep) for reducing output"))
|
|
2551
|
+
|
|
2552
|
+
# --- Check 6: Missing anti-bruteforce guidance (WARNING, skills only) ---
|
|
2553
|
+
if is_skill and has_change_language and not has_any(anti_bruteforce_signals):
|
|
2554
|
+
issues.append(Issue("warning", "missing_anti_bruteforce_guidance",
|
|
2555
|
+
"Execution guidance lacks explicit anti-retry / "
|
|
2556
|
+
"anti-bruteforce behavior"))
|
|
2557
|
+
|
|
2558
|
+
# --- Check 7: Missing clarification guard (WARNING, skills only) ---
|
|
2559
|
+
if is_skill and has_change_language and not has_any(clarification_signals):
|
|
2560
|
+
issues.append(Issue("warning", "missing_clarification_guard",
|
|
2561
|
+
"Implementation guidance does not require clarification "
|
|
2562
|
+
"when requirements are incomplete"))
|
|
2563
|
+
|
|
2564
|
+
return issues
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
# --- Type boundary checks ---
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
def lint_type_boundaries(path: Path, text: str, artifact_type: str) -> List[Issue]:
|
|
2571
|
+
"""Check that artifacts respect their type boundaries.
|
|
2572
|
+
|
|
2573
|
+
- Guidelines should not contain executable procedures
|
|
2574
|
+
- Commands should reference skills
|
|
2575
|
+
- Skills should have concrete validation (not vague)
|
|
2576
|
+
"""
|
|
2577
|
+
issues: List[Issue] = []
|
|
2578
|
+
text_lower = text.lower()
|
|
2579
|
+
import re
|
|
2580
|
+
|
|
2581
|
+
# --- Guideline: should not have executable procedures ---
|
|
2582
|
+
if artifact_type == "guideline":
|
|
2583
|
+
# Count numbered steps (1. 2. 3. etc.) — guidelines shouldn't have >5
|
|
2584
|
+
numbered_steps = re.findall(r'^\d+\.\s+\*?\*?(?:Step|Run|Create|Execute|Implement)',
|
|
2585
|
+
text, re.MULTILINE | re.IGNORECASE)
|
|
2586
|
+
if len(numbered_steps) >= 5:
|
|
2587
|
+
issues.append(Issue("warning", "guideline_contains_executable_procedure",
|
|
2588
|
+
f"Guideline has {len(numbered_steps)} executable numbered steps — "
|
|
2589
|
+
"consider extracting into a skill or command"))
|
|
2590
|
+
|
|
2591
|
+
# --- Command: should reference skills ---
|
|
2592
|
+
if artifact_type == "command":
|
|
2593
|
+
# Check frontmatter skills field
|
|
2594
|
+
frontmatter = extract_frontmatter(text)
|
|
2595
|
+
has_skills_field = False
|
|
2596
|
+
# Commands tagged `type: orchestrator` aggregate other commands /
|
|
2597
|
+
# routers — they intentionally do not declare a `skills:` list and
|
|
2598
|
+
# are exempt from the no-skill-reference check. The tag is the
|
|
2599
|
+
# contract; no hard-coded path list.
|
|
2600
|
+
is_orchestrator = False
|
|
2601
|
+
if frontmatter:
|
|
2602
|
+
skills_match = re.search(r'skills:\s*\[(.+)\]', frontmatter)
|
|
2603
|
+
has_skills_field = bool(skills_match and skills_match.group(1).strip())
|
|
2604
|
+
type_match = re.search(r'^type:\s*[\'"]?orchestrator[\'"]?\s*$',
|
|
2605
|
+
frontmatter, re.MULTILINE)
|
|
2606
|
+
is_orchestrator = bool(type_match)
|
|
2607
|
+
|
|
2608
|
+
# Also check body for skill references
|
|
2609
|
+
has_skill_ref = bool(re.search(r'skill|SKILL\.md', text))
|
|
2610
|
+
|
|
2611
|
+
if not has_skills_field and not has_skill_ref and not is_orchestrator:
|
|
2612
|
+
issues.append(Issue("warning", "command_missing_skill_references",
|
|
2613
|
+
"Command does not reference any skills — "
|
|
2614
|
+
"commands should orchestrate skills, not contain domain logic "
|
|
2615
|
+
"(use `type: orchestrator` in frontmatter to exempt routers)"))
|
|
2616
|
+
|
|
2617
|
+
# --- Skill: validation should be concrete, not vague ---
|
|
2618
|
+
if artifact_type == "skill":
|
|
2619
|
+
# Find validation/verify sections
|
|
2620
|
+
validation_section = re.search(
|
|
2621
|
+
r'(?:^#{1,4}\s+(?:Validat|Verif|Quality|Accept).+?\n)((?:.*\n)*?)(?=^#{1,4}\s|\Z)',
|
|
2622
|
+
text, re.MULTILINE | re.IGNORECASE
|
|
2623
|
+
)
|
|
2624
|
+
if validation_section:
|
|
2625
|
+
validation_text = validation_section.group(1).lower()
|
|
2626
|
+
vague_patterns = ("check if it works", "make sure it's correct",
|
|
2627
|
+
"verify it works", "should work", "looks correct")
|
|
2628
|
+
concrete_patterns = ("run ", "curl ", "phpstan", "rector", "pest",
|
|
2629
|
+
"playwright", "assert", "exit code", "must pass",
|
|
2630
|
+
"0 fail", "0 error")
|
|
2631
|
+
has_vague = any(p in validation_text for p in vague_patterns)
|
|
2632
|
+
has_concrete = any(p in validation_text for p in concrete_patterns)
|
|
2633
|
+
if has_vague and not has_concrete:
|
|
2634
|
+
issues.append(Issue("warning", "skill_validation_too_generic",
|
|
2635
|
+
"Validation section uses vague language — "
|
|
2636
|
+
"add concrete checks (commands, expected output, conditions)"))
|
|
2637
|
+
|
|
2638
|
+
return issues
|
|
2639
|
+
|
|
2640
|
+
|
|
2641
|
+
# --- Verification maturity checks ---
|
|
2642
|
+
|
|
2643
|
+
# Task type detection signals
|
|
2644
|
+
_TASK_TYPE_SIGNALS = {
|
|
2645
|
+
"backend": ("api", "endpoint", "controller", "route", "service", "repository",
|
|
2646
|
+
"eloquent", "migration", "artisan", "middleware", "job", "queue"),
|
|
2647
|
+
"frontend": ("blade", "livewire", "component", "view", "ui", "frontend",
|
|
2648
|
+
"tailwind", "flux", "css", "template"),
|
|
2649
|
+
"cli": ("artisan command", "cli", "console", "schedule", "cron"),
|
|
2650
|
+
"database": ("migration", "database", "schema", "index", "query", "sql",
|
|
2651
|
+
"mariadb", "mysql", "seeder"),
|
|
2652
|
+
"debugging": ("debug", "xdebug", "error", "exception", "sentry", "trace",
|
|
2653
|
+
"breakpoint", "log"),
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
# Expected verification tools per task type
|
|
2657
|
+
_VERIFICATION_TOOLS = {
|
|
2658
|
+
"backend": ("curl", "postman", "http::fake", "actingas", "api/"),
|
|
2659
|
+
"frontend": ("playwright", "browser", "screenshot", "snapshot", "livewire test"),
|
|
2660
|
+
"cli": ("exit code", "command output", "artisan test", "expectsoutput"),
|
|
2661
|
+
"database": ("query", "assertdatabase", "migration", "seedandassert", "table"),
|
|
2662
|
+
"debugging": ("xdebug", "breakpoint", "dump", "dd(", "stack trace", "log"),
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
def lint_verification_maturity(path: Path, text: str, artifact_type: str) -> List[Issue]:
|
|
2667
|
+
"""Check that verification matches the skill's task type."""
|
|
2668
|
+
if artifact_type != "skill":
|
|
2669
|
+
return []
|
|
2670
|
+
|
|
2671
|
+
# Only check skills with strong execution signals
|
|
2672
|
+
path_lower = str(path).lower()
|
|
2673
|
+
if not any(sig in path_lower for sig in _EXEC_FILE_SIGNALS):
|
|
2674
|
+
return []
|
|
2675
|
+
|
|
2676
|
+
issues: List[Issue] = []
|
|
2677
|
+
text_lower = text.lower()
|
|
2678
|
+
|
|
2679
|
+
# Detect task types present in the skill
|
|
2680
|
+
detected_types: list[str] = []
|
|
2681
|
+
for task_type, signals in _TASK_TYPE_SIGNALS.items():
|
|
2682
|
+
matches = sum(1 for s in signals if s in text_lower)
|
|
2683
|
+
if matches >= 2: # Need at least 2 signals to classify
|
|
2684
|
+
detected_types.append(task_type)
|
|
2685
|
+
|
|
2686
|
+
if not detected_types:
|
|
2687
|
+
return []
|
|
2688
|
+
|
|
2689
|
+
# Check if appropriate verification tools are mentioned
|
|
2690
|
+
for task_type in detected_types:
|
|
2691
|
+
tools = _VERIFICATION_TOOLS.get(task_type, ())
|
|
2692
|
+
has_tool = any(t in text_lower for t in tools)
|
|
2693
|
+
if not has_tool:
|
|
2694
|
+
issues.append(Issue("warning", f"missing_{task_type}_verification_example",
|
|
2695
|
+
f"Skill covers {task_type} tasks but does not mention "
|
|
2696
|
+
f"verification tools for that context "
|
|
2697
|
+
f"(e.g. {', '.join(tools[:3])})"))
|
|
2698
|
+
|
|
2699
|
+
return issues
|
|
2700
|
+
|
|
2701
|
+
|
|
2702
|
+
# --- Governance & packaging checks ---
|
|
2703
|
+
|
|
2704
|
+
|
|
2705
|
+
# --- Frugality validator helpers + Layers 1 & 2 ---
|
|
2706
|
+
|
|
2707
|
+
def _heading_to_slug(heading: str) -> str:
|
|
2708
|
+
"""Slugify a markdown heading using GitHub's algorithm: lowercase,
|
|
2709
|
+
drop punctuation (em-dash, period, etc.), spaces -> hyphens,
|
|
2710
|
+
preserve adjacent hyphens (so `Iron Law 3 — Brevity` becomes
|
|
2711
|
+
`iron-law-3--brevity`, matching the anchor GitHub renders)."""
|
|
2712
|
+
s = heading.strip().lower()
|
|
2713
|
+
s = re.sub(r"[^a-z0-9 \-]", "", s)
|
|
2714
|
+
s = s.replace(" ", "-")
|
|
2715
|
+
return s.strip("-")
|
|
2716
|
+
|
|
2717
|
+
|
|
2718
|
+
def _extract_heading_slugs(text: str) -> set[str]:
|
|
2719
|
+
"""Return the set of slugs for every H2/H3 heading in a markdown body."""
|
|
2720
|
+
slugs: set[str] = set()
|
|
2721
|
+
for line in text.splitlines():
|
|
2722
|
+
if line.startswith("## ") or line.startswith("### "):
|
|
2723
|
+
heading = line.split(" ", 1)[1].strip()
|
|
2724
|
+
slugs.add(_heading_to_slug(heading))
|
|
2725
|
+
return slugs
|
|
2726
|
+
|
|
2727
|
+
|
|
2728
|
+
def _skill_id_from_path(path: Path) -> Optional[str]:
|
|
2729
|
+
"""Extract the writer-skill id from a SKILL.md path. Returns the
|
|
2730
|
+
parent-directory name, or None if the file is not a SKILL.md."""
|
|
2731
|
+
if path.name.lower() != "skill.md":
|
|
2732
|
+
return None
|
|
2733
|
+
return path.parent.name
|
|
2734
|
+
|
|
2735
|
+
|
|
2736
|
+
def _is_frugality_charter(path: Path) -> bool:
|
|
2737
|
+
"""True iff the path ends in the canonical charter relpath, regardless
|
|
2738
|
+
of whether it lives under dist/agent-src/ or .agent-src.uncondensed/."""
|
|
2739
|
+
norm = str(path).replace("\\", "/")
|
|
2740
|
+
return norm.endswith("/" + FRUGALITY_CHARTER_RELPATH)
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
# Section header recognised by Layer 1. Literal H2 only — sub-headings
|
|
2744
|
+
# inside the section do not count as the section itself.
|
|
2745
|
+
_FRUGALITY_STANDARDS_PATTERN = re.compile(
|
|
2746
|
+
r"^##\s+Frugality Standards\s*$", re.MULTILINE
|
|
2747
|
+
)
|
|
2748
|
+
_FRUGALITY_CHARTER_LINK_PATTERN = re.compile(
|
|
2749
|
+
r"\]\([^)]*frugality-charter\.md[^)]*\)"
|
|
2750
|
+
)
|
|
2751
|
+
|
|
2752
|
+
|
|
2753
|
+
def lint_frugality_writer_cite(path: Path, text: str,
|
|
2754
|
+
artifact_type: str) -> List[Issue]:
|
|
2755
|
+
"""Layer 1 — every writer skill must carry a `## Frugality Standards`
|
|
2756
|
+
section that links to the charter. No-op for non-writer skills and
|
|
2757
|
+
non-skill artifacts."""
|
|
2758
|
+
if artifact_type != "skill":
|
|
2759
|
+
return []
|
|
2760
|
+
skill_id = _skill_id_from_path(path)
|
|
2761
|
+
if skill_id is None or skill_id not in FRUGALITY_WRITER_SKILLS:
|
|
2762
|
+
return []
|
|
2763
|
+
issues: List[Issue] = []
|
|
2764
|
+
section_match = _FRUGALITY_STANDARDS_PATTERN.search(text)
|
|
2765
|
+
if not section_match:
|
|
2766
|
+
issues.append(Issue(
|
|
2767
|
+
"error", "frugality_section_missing",
|
|
2768
|
+
"Writer skill must carry a `## Frugality Standards` section "
|
|
2769
|
+
"(road-to-token-frugality Phase 0.4 Layer 1)",
|
|
2770
|
+
))
|
|
2771
|
+
return issues
|
|
2772
|
+
# Section body = from match-end to next H2 or EOF.
|
|
2773
|
+
body_start = section_match.end()
|
|
2774
|
+
next_h2 = re.search(r"^##\s+", text[body_start:], re.MULTILINE)
|
|
2775
|
+
body_end = body_start + next_h2.start() if next_h2 else len(text)
|
|
2776
|
+
body = text[body_start:body_end]
|
|
2777
|
+
if not _FRUGALITY_CHARTER_LINK_PATTERN.search(body):
|
|
2778
|
+
issues.append(Issue(
|
|
2779
|
+
"error", "frugality_charter_cite_missing",
|
|
2780
|
+
"`## Frugality Standards` section must link to "
|
|
2781
|
+
"`frugality-charter.md` (road-to-token-frugality Phase 0.4 "
|
|
2782
|
+
"Layer 1)",
|
|
2783
|
+
))
|
|
2784
|
+
return issues
|
|
2785
|
+
|
|
2786
|
+
|
|
2787
|
+
# Markdown link pattern: [text](path#anchor) — anchor optional.
|
|
2788
|
+
_MD_LINK_PATTERN = re.compile(
|
|
2789
|
+
r"\[[^\]]+\]\(([^)#]+)(?:#([^)]+))?\)"
|
|
2790
|
+
)
|
|
2791
|
+
|
|
2792
|
+
|
|
2793
|
+
def lint_frugality_charter_index(path: Path, text: str) -> List[Issue]:
|
|
2794
|
+
"""Layer 2 — every cited anchor must resolve to a real H2/H3 heading
|
|
2795
|
+
in the target rule file, AND each of the four canonical rules must
|
|
2796
|
+
be cited at least once with the required canonical anchor substring.
|
|
2797
|
+
Additional citations to the same rule (net-new sections referencing
|
|
2798
|
+
other anchors) are validated for resolution but do not need the
|
|
2799
|
+
canonical substring."""
|
|
2800
|
+
if not _is_frugality_charter(path):
|
|
2801
|
+
return []
|
|
2802
|
+
issues: List[Issue] = []
|
|
2803
|
+
rules_dir = path.parent.parent.parent / "rules"
|
|
2804
|
+
rule_slugs_cache: dict[str, set[str]] = {}
|
|
2805
|
+
canonical_satisfied: set[str] = set()
|
|
2806
|
+
for link_match in _MD_LINK_PATTERN.finditer(text):
|
|
2807
|
+
link_path, link_anchor = link_match.group(1), link_match.group(2)
|
|
2808
|
+
rule_name = Path(link_path).name
|
|
2809
|
+
if rule_name not in FRUGALITY_CHARTER_INDEX_RULES:
|
|
2810
|
+
continue
|
|
2811
|
+
if link_anchor is None:
|
|
2812
|
+
continue
|
|
2813
|
+
anchor_lc = link_anchor.lower()
|
|
2814
|
+
required_substr = FRUGALITY_CHARTER_INDEX_RULES[rule_name]
|
|
2815
|
+
if required_substr in anchor_lc:
|
|
2816
|
+
canonical_satisfied.add(rule_name)
|
|
2817
|
+
if rule_name not in rule_slugs_cache:
|
|
2818
|
+
rule_file = rules_dir / rule_name
|
|
2819
|
+
if not rule_file.exists():
|
|
2820
|
+
issues.append(Issue(
|
|
2821
|
+
"error", "frugality_charter_rule_missing",
|
|
2822
|
+
f"Charter cites {rule_name} but the rule file does "
|
|
2823
|
+
f"not exist at {rule_file}",
|
|
2824
|
+
))
|
|
2825
|
+
rule_slugs_cache[rule_name] = set()
|
|
2826
|
+
continue
|
|
2827
|
+
try:
|
|
2828
|
+
rule_text = rule_file.read_text(encoding="utf-8")
|
|
2829
|
+
except OSError as e:
|
|
2830
|
+
issues.append(Issue(
|
|
2831
|
+
"error", "frugality_charter_rule_unreadable",
|
|
2832
|
+
f"Cannot read {rule_name}: {e}",
|
|
2833
|
+
))
|
|
2834
|
+
rule_slugs_cache[rule_name] = set()
|
|
2835
|
+
continue
|
|
2836
|
+
rule_slugs_cache[rule_name] = _extract_heading_slugs(rule_text)
|
|
2837
|
+
if anchor_lc not in rule_slugs_cache[rule_name]:
|
|
2838
|
+
issues.append(Issue(
|
|
2839
|
+
"error", "frugality_charter_anchor_unresolved",
|
|
2840
|
+
f"Charter cites {rule_name}#{link_anchor} but no H2/H3 "
|
|
2841
|
+
f"heading with that slug exists in the rule file",
|
|
2842
|
+
))
|
|
2843
|
+
missing = set(FRUGALITY_CHARTER_INDEX_RULES) - canonical_satisfied
|
|
2844
|
+
for rule_name in sorted(missing):
|
|
2845
|
+
required_substr = FRUGALITY_CHARTER_INDEX_RULES[rule_name]
|
|
2846
|
+
issues.append(Issue(
|
|
2847
|
+
"error", "frugality_charter_canonical_missing",
|
|
2848
|
+
f"Charter index lacks a canonical citation of {rule_name} "
|
|
2849
|
+
f"with anchor containing '{required_substr}' "
|
|
2850
|
+
f"(road-to-token-frugality Phase 0.4 Layer 2)",
|
|
2851
|
+
))
|
|
2852
|
+
return issues
|
|
2853
|
+
|
|
2854
|
+
|
|
2855
|
+
def lint_governance(path: Path, text: str, artifact_type: str, repo_root: Path | None = None) -> List[Issue]:
|
|
2856
|
+
"""Check governance and packaging consistency.
|
|
2857
|
+
|
|
2858
|
+
- Condensed/uncondensed pairs must exist
|
|
2859
|
+
- No duplicate skill names
|
|
2860
|
+
- Files must be in correct location for their type
|
|
2861
|
+
"""
|
|
2862
|
+
issues: List[Issue] = []
|
|
2863
|
+
if repo_root is None:
|
|
2864
|
+
return issues
|
|
2865
|
+
|
|
2866
|
+
path_str = str(path)
|
|
2867
|
+
path_relative = path_str
|
|
2868
|
+
|
|
2869
|
+
# Determine if this is a condensed or uncondensed artifact
|
|
2870
|
+
is_condensed = "/dist/agent-src/" in path_str and "/.agent-src.uncondensed/" not in path_str
|
|
2871
|
+
is_uncondensed = "/.agent-src.uncondensed/" in path_str
|
|
2872
|
+
|
|
2873
|
+
if not is_condensed and not is_uncondensed:
|
|
2874
|
+
return issues
|
|
2875
|
+
|
|
2876
|
+
# --- Check: condensed/uncondensed pair exists ---
|
|
2877
|
+
# ADR-017: sources live under packages/*/.agent-src.uncondensed/ but
|
|
2878
|
+
# all packs project into the single repo-root dist/agent-src/ tree. The
|
|
2879
|
+
# pair-check now resolves via logical relpath, not a path-swap.
|
|
2880
|
+
from _lib.agent_src import strip_source_prefix as _strip
|
|
2881
|
+
norm = path_str.replace("\\", "/")
|
|
2882
|
+
if is_uncondensed:
|
|
2883
|
+
# Compute logical path then map to dist/agent-src/ at repo root.
|
|
2884
|
+
# Try direct strip first; fall back to substring split for absolute paths.
|
|
2885
|
+
logical = _strip(norm)
|
|
2886
|
+
if logical is None:
|
|
2887
|
+
marker = "/.agent-src.uncondensed/"
|
|
2888
|
+
idx = norm.rfind(marker)
|
|
2889
|
+
logical = norm[idx + len(marker):] if idx != -1 else None
|
|
2890
|
+
if logical:
|
|
2891
|
+
condensed_path = repo_root / "dist/agent-src" / logical
|
|
2892
|
+
if not condensed_path.exists():
|
|
2893
|
+
issues.append(Issue("warning", "condensed_variant_missing",
|
|
2894
|
+
f"Uncondensed file exists but condensed variant missing: "
|
|
2895
|
+
f"{condensed_path.name}"))
|
|
2896
|
+
elif is_condensed:
|
|
2897
|
+
# Condensed lives at repo-root dist/agent-src/<logical>. Source could
|
|
2898
|
+
# be at any source root \u2014 resolve via artefact_roots.
|
|
2899
|
+
marker = "/dist/agent-src/"
|
|
2900
|
+
idx = norm.rfind(marker)
|
|
2901
|
+
logical = norm[idx + len(marker):] if idx != -1 else None
|
|
2902
|
+
if logical:
|
|
2903
|
+
uncondensed_path = resolve_logical(logical)
|
|
2904
|
+
if uncondensed_path is None or not uncondensed_path.exists():
|
|
2905
|
+
issues.append(Issue("warning", "uncondensed_variant_missing",
|
|
2906
|
+
f"Condensed file exists but uncondensed source missing: "
|
|
2907
|
+
f"{Path(logical).name}"))
|
|
2908
|
+
|
|
2909
|
+
# --- Check: file in correct location for type ---
|
|
2910
|
+
location_map = {
|
|
2911
|
+
"skill": "/skills/",
|
|
2912
|
+
"rule": "/rules/",
|
|
2913
|
+
"command": "/commands/",
|
|
2914
|
+
"guideline": "/guidelines/",
|
|
2915
|
+
}
|
|
2916
|
+
expected_loc = location_map.get(artifact_type)
|
|
2917
|
+
if expected_loc and expected_loc not in path_str:
|
|
2918
|
+
issues.append(Issue("warning", "invalid_location_for_type",
|
|
2919
|
+
f"Artifact detected as '{artifact_type}' but not in "
|
|
2920
|
+
f"expected location ({expected_loc})"))
|
|
2921
|
+
|
|
2922
|
+
return issues
|
|
2923
|
+
|
|
2924
|
+
|
|
2925
|
+
# --- Structural malice check (see road-to-suite-closure Phase 5) ---
|
|
2926
|
+
#
|
|
2927
|
+
# Five regex patterns scan skill / rule / command bodies for **structural**
|
|
2928
|
+
# (not semantic) malice. Findings surface as ``Issue("error",
|
|
2929
|
+
# "malice:<pattern>", "<line>:<matched>")`` so ``compute_exit_code`` can
|
|
2930
|
+
# emit exit code 3 (security-failure), distinct from 2 (build-failure).
|
|
2931
|
+
# Semantic checks (PII leakage, prompt injection) are deferred to v2.
|
|
2932
|
+
|
|
2933
|
+
# (a) credential exfil — curl|wget piping ${TOKEN}/${KEY}/${SECRET}/...
|
|
2934
|
+
# env vars or hitting ~/.aws/ ~/.ssh/ secrets.
|
|
2935
|
+
_MALICE_CRED_EXFIL = re.compile(
|
|
2936
|
+
r"\b(?:curl|wget)\b[^\n]*"
|
|
2937
|
+
r"(?:\$\{?[A-Z_]*(?:TOKEN|KEY|SECRET|PASSWORD|CREDENTIAL|API)[A-Z_]*\}?"
|
|
2938
|
+
r"|~/\.(?:aws|ssh)/)"
|
|
2939
|
+
)
|
|
2940
|
+
# (b) arbitrary execution — eval/exec over a network-fetched payload, or
|
|
2941
|
+
# `bash <(curl ...)` / `sh <(wget ...)` style remote-execution.
|
|
2942
|
+
_MALICE_REMOTE_EXEC = re.compile(
|
|
2943
|
+
r"(?:\b(?:eval|exec)\s*\([^)]*(?:curl|wget|requests\.get|urllib)"
|
|
2944
|
+
r"|\b(?:bash|sh|zsh)\s*<\s*\(\s*(?:curl|wget))"
|
|
2945
|
+
)
|
|
2946
|
+
# (c) force-push to a protected ref.
|
|
2947
|
+
_MALICE_FORCE_PUSH = re.compile(
|
|
2948
|
+
r"\bgit\s+push\b[^\n]*--force(?:-with-lease)?\b[^\n]*"
|
|
2949
|
+
r"\b(?:main|master|prod|production|release)\b"
|
|
2950
|
+
)
|
|
2951
|
+
# (d) world-readable secrets — chmod 0?[4567]xx on .pem/.key/.env files.
|
|
2952
|
+
_MALICE_CHMOD_SECRETS = re.compile(
|
|
2953
|
+
r"\bchmod\s+0?[4567]\d{2}\s+[^\n]*\.(?:pem|key|env)\b"
|
|
2954
|
+
)
|
|
2955
|
+
# (e) unbounded subprocess shell injection — shell=True interpolating ${VAR}.
|
|
2956
|
+
_MALICE_SHELL_INJECT = re.compile(
|
|
2957
|
+
r"\bsubprocess\.[A-Za-z_]+\s*\([^)]*shell\s*=\s*True[^)]*\$\{"
|
|
2958
|
+
)
|
|
2959
|
+
|
|
2960
|
+
_MALICE_PATTERNS: list[tuple[str, re.Pattern[str]]] = [
|
|
2961
|
+
("cred_exfil", _MALICE_CRED_EXFIL),
|
|
2962
|
+
("remote_exec", _MALICE_REMOTE_EXEC),
|
|
2963
|
+
("force_push_protected", _MALICE_FORCE_PUSH),
|
|
2964
|
+
("chmod_secrets", _MALICE_CHMOD_SECRETS),
|
|
2965
|
+
("shell_injection", _MALICE_SHELL_INJECT),
|
|
2966
|
+
]
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
def check_structural_malice(text: str) -> List[Issue]:
|
|
2970
|
+
"""Return one Issue per malice match. Empty list when clean.
|
|
2971
|
+
|
|
2972
|
+
Issue shape: ``Issue("error", f"malice:{name}", f"{line}:{matched}")``.
|
|
2973
|
+
The ``format_text`` renderer special-cases the ``malice:`` code prefix
|
|
2974
|
+
to emit ``<path>:<line>:malice:<pattern>:<matched>`` per Phase 5.2.
|
|
2975
|
+
"""
|
|
2976
|
+
issues: List[Issue] = []
|
|
2977
|
+
for lineno, raw in enumerate(text.splitlines(), start=1):
|
|
2978
|
+
for name, pattern in _MALICE_PATTERNS:
|
|
2979
|
+
match = pattern.search(raw)
|
|
2980
|
+
if match:
|
|
2981
|
+
issues.append(Issue(
|
|
2982
|
+
severity="error",
|
|
2983
|
+
code=f"malice:{name}",
|
|
2984
|
+
message=f"{lineno}:{match.group(0).strip()}",
|
|
2985
|
+
))
|
|
2986
|
+
return issues
|
|
2987
|
+
|
|
2988
|
+
|
|
2989
|
+
# --- Output-schema check (see road-to-trigger-evals Phase 3.5) ---
|
|
2990
|
+
#
|
|
2991
|
+
# Skills that freeze an output shape (`refine-ticket`, `estimate-ticket`)
|
|
2992
|
+
# ship an optional `evals/output-schema.yml` listing the `##`-headers
|
|
2993
|
+
# their output template MUST carry. The linter fails if a header drifts.
|
|
2994
|
+
|
|
2995
|
+
_OUTPUT_SCHEMA_KEY_PATTERN = re.compile(r'^(\w+):\s*(.*?)\s*$')
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
def parse_output_schema(text: str) -> dict:
|
|
2999
|
+
"""Tiny YAML-like parser for ``evals/output-schema.yml`` — no PyYAML dep.
|
|
3000
|
+
|
|
3001
|
+
Supported shape::
|
|
3002
|
+
|
|
3003
|
+
version: 1
|
|
3004
|
+
required_headers:
|
|
3005
|
+
- "Refined ticket"
|
|
3006
|
+
- "Top-5 risks"
|
|
3007
|
+
|
|
3008
|
+
Unknown keys are preserved but ignored by :func:`lint_output_schema`.
|
|
3009
|
+
"""
|
|
3010
|
+
result: dict = {}
|
|
3011
|
+
current_list: Optional[str] = None
|
|
3012
|
+
for raw in text.splitlines():
|
|
3013
|
+
stripped = raw.strip()
|
|
3014
|
+
if not stripped or stripped.startswith("#"):
|
|
3015
|
+
continue
|
|
3016
|
+
if stripped.startswith("- "):
|
|
3017
|
+
if current_list is None:
|
|
3018
|
+
continue
|
|
3019
|
+
value = stripped[2:].strip().strip('"').strip("'")
|
|
3020
|
+
result[current_list].append(value)
|
|
3021
|
+
continue
|
|
3022
|
+
match = _OUTPUT_SCHEMA_KEY_PATTERN.match(stripped)
|
|
3023
|
+
if not match:
|
|
3024
|
+
continue
|
|
3025
|
+
key, value = match.group(1), match.group(2).strip('"').strip("'")
|
|
3026
|
+
if value == "":
|
|
3027
|
+
result[key] = []
|
|
3028
|
+
current_list = key
|
|
3029
|
+
else:
|
|
3030
|
+
current_list = None
|
|
3031
|
+
try:
|
|
3032
|
+
result[key] = int(value)
|
|
3033
|
+
except ValueError:
|
|
3034
|
+
result[key] = value
|
|
3035
|
+
return result
|
|
3036
|
+
|
|
3037
|
+
|
|
3038
|
+
def load_output_schema(skill_path: Path) -> Optional[dict]:
|
|
3039
|
+
"""Return the parsed schema sibling to ``skill_path`` or ``None``.
|
|
3040
|
+
|
|
3041
|
+
Lookup: ``<skill-dir>/evals/output-schema.yml``. Callers MUST use the
|
|
3042
|
+
real path (not the repo-relative display path) so the sibling lookup
|
|
3043
|
+
hits the actual directory.
|
|
3044
|
+
"""
|
|
3045
|
+
if skill_path.name != "SKILL.md":
|
|
3046
|
+
return None
|
|
3047
|
+
schema_path = skill_path.parent / "evals" / "output-schema.yml"
|
|
3048
|
+
if not schema_path.exists():
|
|
3049
|
+
return None
|
|
3050
|
+
try:
|
|
3051
|
+
return parse_output_schema(schema_path.read_text(encoding="utf-8"))
|
|
3052
|
+
except OSError:
|
|
3053
|
+
return None
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
def lint_output_schema(path: Path, text: str) -> List[Issue]:
|
|
3057
|
+
"""Fail if any required header declared in the sibling schema is
|
|
3058
|
+
missing from the skill's output template.
|
|
3059
|
+
|
|
3060
|
+
No-op when the schema file does not exist or declares no
|
|
3061
|
+
``required_headers`` — keeps the check opt-in per skill.
|
|
3062
|
+
"""
|
|
3063
|
+
schema = load_output_schema(path)
|
|
3064
|
+
if schema is None:
|
|
3065
|
+
return []
|
|
3066
|
+
required = schema.get("required_headers") or []
|
|
3067
|
+
if not isinstance(required, list) or not required:
|
|
3068
|
+
return []
|
|
3069
|
+
issues: List[Issue] = []
|
|
3070
|
+
# Scan the whole skill text. Template headers live inside a fenced
|
|
3071
|
+
# code block, but the `^## <header>$` line still matches — a drift
|
|
3072
|
+
# (rename/removal) makes the line disappear from the file entirely.
|
|
3073
|
+
for header in required:
|
|
3074
|
+
if not isinstance(header, str) or not header.strip():
|
|
3075
|
+
continue
|
|
3076
|
+
pattern = re.compile(
|
|
3077
|
+
rf"^##\s+{re.escape(header.strip())}\s*$", re.MULTILINE,
|
|
3078
|
+
)
|
|
3079
|
+
if not pattern.search(text):
|
|
3080
|
+
issues.append(Issue(
|
|
3081
|
+
"error", "output_schema_drift",
|
|
3082
|
+
f"Output template is missing required header "
|
|
3083
|
+
f"`## {header}` (declared in evals/output-schema.yml)",
|
|
3084
|
+
))
|
|
3085
|
+
return issues
|
|
3086
|
+
|
|
3087
|
+
|
|
3088
|
+
# Artefact types that carry a JSON-Schema contract for their frontmatter.
|
|
3089
|
+
_SCHEMA_ARTEFACT_TYPES = {"skill", "rule", "command", "persona", "user-type"}
|
|
3090
|
+
|
|
3091
|
+
|
|
3092
|
+
def lint_frontmatter_schema(path: Path, text: str, artifact_type: str) -> List[Issue]:
|
|
3093
|
+
"""Validate the frontmatter of an artefact against its JSON-Schema.
|
|
3094
|
+
|
|
3095
|
+
Schemas live in ``scripts/schemas/``. One schema per artefact type;
|
|
3096
|
+
see ``agents/reference/docs/frontmatter-contract.md`` for the human-readable
|
|
3097
|
+
contract the schemas encode. Guidelines have no frontmatter and are
|
|
3098
|
+
skipped.
|
|
3099
|
+
"""
|
|
3100
|
+
if artifact_type not in _SCHEMA_ARTEFACT_TYPES:
|
|
3101
|
+
return []
|
|
3102
|
+
try:
|
|
3103
|
+
schema = load_schema(artifact_type)
|
|
3104
|
+
except FileNotFoundError:
|
|
3105
|
+
return []
|
|
3106
|
+
|
|
3107
|
+
data, _ = parse_frontmatter_for_schema(text)
|
|
3108
|
+
if data is None:
|
|
3109
|
+
# Other linter checks already emit a missing-frontmatter error for
|
|
3110
|
+
# rules/commands/personas; avoid double-reporting here.
|
|
3111
|
+
return []
|
|
3112
|
+
|
|
3113
|
+
# Inject schema defaults before validating so artefacts that omit a field
|
|
3114
|
+
# equal to its default (post abstraction-reduction migration) still satisfy
|
|
3115
|
+
# `required` — mirrors validate_frontmatter's own loader path.
|
|
3116
|
+
apply_schema_defaults(data, schema)
|
|
3117
|
+
|
|
3118
|
+
issues: List[Issue] = []
|
|
3119
|
+
for error in validate_against_schema(data, schema):
|
|
3120
|
+
code = f"schema_{error.rule}"
|
|
3121
|
+
message = f"{error.path} – {error.message}"
|
|
3122
|
+
issues.append(Issue("error", code, message))
|
|
3123
|
+
return issues
|
|
3124
|
+
|
|
3125
|
+
|
|
3126
|
+
def lint_file(path: Path, repo_root: Path | None = None) -> LintResult:
|
|
3127
|
+
# Skip README files — they are not lintable artifacts
|
|
3128
|
+
if path.name.lower() == "readme.md":
|
|
3129
|
+
return LintResult(
|
|
3130
|
+
file=str(path),
|
|
3131
|
+
artifact_type="unknown",
|
|
3132
|
+
status="pass",
|
|
3133
|
+
issues=[],
|
|
3134
|
+
suggestions=[],
|
|
3135
|
+
)
|
|
3136
|
+
text = read_text(path)
|
|
3137
|
+
artifact_type = detect_artifact_type(path, text)
|
|
3138
|
+
# Use relative path for output if repo_root is provided
|
|
3139
|
+
display_path = path
|
|
3140
|
+
if repo_root:
|
|
3141
|
+
try:
|
|
3142
|
+
display_path = path.relative_to(repo_root)
|
|
3143
|
+
except ValueError:
|
|
3144
|
+
pass
|
|
3145
|
+
if artifact_type == "skill":
|
|
3146
|
+
result = lint_skill(display_path, text)
|
|
3147
|
+
elif artifact_type == "rule":
|
|
3148
|
+
result = lint_rule(display_path, text)
|
|
3149
|
+
elif artifact_type == "command":
|
|
3150
|
+
result = lint_command(display_path, text)
|
|
3151
|
+
elif artifact_type == "guideline":
|
|
3152
|
+
result = lint_guideline(display_path, text)
|
|
3153
|
+
elif artifact_type == "persona":
|
|
3154
|
+
result = lint_persona(display_path, text)
|
|
3155
|
+
elif artifact_type == "user-type":
|
|
3156
|
+
result = lint_usertype(display_path, text)
|
|
3157
|
+
else:
|
|
3158
|
+
# Frugality charter lives in contexts/ (artifact_type == unknown)
|
|
3159
|
+
# but still needs Layer 2 index-integrity validation.
|
|
3160
|
+
if _is_frugality_charter(path):
|
|
3161
|
+
charter_issues = lint_frugality_charter_index(path, text)
|
|
3162
|
+
return LintResult(
|
|
3163
|
+
file=str(display_path),
|
|
3164
|
+
artifact_type="unknown",
|
|
3165
|
+
status=classify_status(charter_issues),
|
|
3166
|
+
issues=charter_issues,
|
|
3167
|
+
suggestions=[],
|
|
3168
|
+
)
|
|
3169
|
+
return lint_unknown(display_path, text)
|
|
3170
|
+
|
|
3171
|
+
# Post-processing: frontmatter schema validation (errors). Runs first
|
|
3172
|
+
# so schema failures surface before the softer quality checks below.
|
|
3173
|
+
schema_issues = lint_frontmatter_schema(display_path, text, artifact_type)
|
|
3174
|
+
if schema_issues:
|
|
3175
|
+
result.issues.extend(schema_issues)
|
|
3176
|
+
result.status = classify_status(result.issues)
|
|
3177
|
+
|
|
3178
|
+
# Post-processing: interaction quality checks (warnings/info only)
|
|
3179
|
+
interaction_issues = lint_interaction_quality(display_path, text)
|
|
3180
|
+
if interaction_issues:
|
|
3181
|
+
result.issues.extend(interaction_issues)
|
|
3182
|
+
result.status = classify_status(result.issues)
|
|
3183
|
+
|
|
3184
|
+
# Post-processing: execution quality checks (errors/warnings)
|
|
3185
|
+
execution_issues = lint_execution_quality(display_path, text)
|
|
3186
|
+
if execution_issues:
|
|
3187
|
+
result.issues.extend(execution_issues)
|
|
3188
|
+
result.status = classify_status(result.issues)
|
|
3189
|
+
|
|
3190
|
+
# Post-processing: type boundary checks (warnings)
|
|
3191
|
+
boundary_issues = lint_type_boundaries(display_path, text, artifact_type)
|
|
3192
|
+
if boundary_issues:
|
|
3193
|
+
result.issues.extend(boundary_issues)
|
|
3194
|
+
result.status = classify_status(result.issues)
|
|
3195
|
+
|
|
3196
|
+
# Post-processing: verification maturity checks (warnings)
|
|
3197
|
+
maturity_issues = lint_verification_maturity(display_path, text, artifact_type)
|
|
3198
|
+
if maturity_issues:
|
|
3199
|
+
result.issues.extend(maturity_issues)
|
|
3200
|
+
result.status = classify_status(result.issues)
|
|
3201
|
+
|
|
3202
|
+
# Post-processing: governance and packaging checks (warnings)
|
|
3203
|
+
governance_issues = lint_governance(path, text, artifact_type, repo_root)
|
|
3204
|
+
if governance_issues:
|
|
3205
|
+
result.issues.extend(governance_issues)
|
|
3206
|
+
result.status = classify_status(result.issues)
|
|
3207
|
+
|
|
3208
|
+
# Post-processing: output-schema drift (errors). Skills only — schema
|
|
3209
|
+
# lookup walks a sibling `evals/` directory off the real SKILL.md.
|
|
3210
|
+
if artifact_type == "skill":
|
|
3211
|
+
schema_issues = lint_output_schema(path, text)
|
|
3212
|
+
if schema_issues:
|
|
3213
|
+
result.issues.extend(schema_issues)
|
|
3214
|
+
result.status = classify_status(result.issues)
|
|
3215
|
+
|
|
3216
|
+
# Post-processing: structural malice scan (errors). Skills, rules,
|
|
3217
|
+
# and commands carry executable patterns; guidelines/personas are
|
|
3218
|
+
# prose-only and skipped to keep noise low.
|
|
3219
|
+
if artifact_type in ("skill", "rule", "command"):
|
|
3220
|
+
malice_issues = check_structural_malice(text)
|
|
3221
|
+
if malice_issues:
|
|
3222
|
+
result.issues.extend(malice_issues)
|
|
3223
|
+
result.status = classify_status(result.issues)
|
|
3224
|
+
|
|
3225
|
+
# Post-processing: frugality validator Layer 1 (writer-cite). Errors
|
|
3226
|
+
# if a writer skill lacks the `## Frugality Standards` section or its
|
|
3227
|
+
# link to the charter.
|
|
3228
|
+
frugality_issues = lint_frugality_writer_cite(
|
|
3229
|
+
display_path, text, artifact_type
|
|
3230
|
+
)
|
|
3231
|
+
if frugality_issues:
|
|
3232
|
+
result.issues.extend(frugality_issues)
|
|
3233
|
+
result.status = classify_status(result.issues)
|
|
3234
|
+
|
|
3235
|
+
return result
|
|
3236
|
+
|
|
3237
|
+
|
|
3238
|
+
def format_text(results: list[LintResult], quiet: bool = False) -> str:
|
|
3239
|
+
lines: list[str] = []
|
|
3240
|
+
# Phase 5.2: malice findings render in the spec shape
|
|
3241
|
+
# ``<path>:<line>:malice:<pattern>:<matched>`` ahead of the badge
|
|
3242
|
+
# block so security-failures are grep-able from the top.
|
|
3243
|
+
malice_total = 0
|
|
3244
|
+
for result in results:
|
|
3245
|
+
for issue in result.issues:
|
|
3246
|
+
if issue.code.startswith("malice:"):
|
|
3247
|
+
pattern_name = issue.code.split(":", 1)[1]
|
|
3248
|
+
lineno, _, matched = issue.message.partition(":")
|
|
3249
|
+
lines.append(
|
|
3250
|
+
f"{result.file}:{lineno}:malice:{pattern_name}:{matched}"
|
|
3251
|
+
)
|
|
3252
|
+
malice_total += 1
|
|
3253
|
+
if malice_total:
|
|
3254
|
+
lines.append("")
|
|
3255
|
+
|
|
3256
|
+
# P10.5: quiet mode skips PASS-without-issues; malice + WARN/FAIL still rendered.
|
|
3257
|
+
for result in results:
|
|
3258
|
+
if quiet and result.status == "pass" and not result.issues and not result.suggestions:
|
|
3259
|
+
continue
|
|
3260
|
+
badge = {"pass": "[PASS]", "pass_with_warnings": "[WARN]", "fail": "[FAIL]"}[result.status]
|
|
3261
|
+
lines.append(f"{badge} {result.file} ({result.artifact_type})")
|
|
3262
|
+
if result.issues:
|
|
3263
|
+
for issue in result.issues:
|
|
3264
|
+
lines.append(f" - {issue.severity.upper()} {issue.code}: {issue.message}")
|
|
3265
|
+
else:
|
|
3266
|
+
lines.append(" - No issues found")
|
|
3267
|
+
if result.suggestions:
|
|
3268
|
+
lines.append(" Suggested fixes:")
|
|
3269
|
+
for suggestion in result.suggestions:
|
|
3270
|
+
lines.append(f" - {suggestion}")
|
|
3271
|
+
lines.append("")
|
|
3272
|
+
|
|
3273
|
+
total = len(results)
|
|
3274
|
+
fails = sum(1 for r in results if r.status == "fail")
|
|
3275
|
+
warns = sum(1 for r in results if r.status == "pass_with_warnings")
|
|
3276
|
+
passes = sum(1 for r in results if r.status == "pass")
|
|
3277
|
+
suffix = f", {malice_total} malice" if malice_total else ""
|
|
3278
|
+
lines.append(f"Summary: {passes} pass, {warns} warn, {fails} fail, {total} total{suffix}")
|
|
3279
|
+
return "\n".join(lines)
|
|
3280
|
+
|
|
3281
|
+
|
|
3282
|
+
def format_json(results: list[LintResult]) -> str:
|
|
3283
|
+
payload = {
|
|
3284
|
+
"summary": {
|
|
3285
|
+
"pass": sum(1 for r in results if r.status == "pass"),
|
|
3286
|
+
"pass_with_warnings": sum(1 for r in results if r.status == "pass_with_warnings"),
|
|
3287
|
+
"fail": sum(1 for r in results if r.status == "fail"),
|
|
3288
|
+
"total": len(results),
|
|
3289
|
+
},
|
|
3290
|
+
"results": [
|
|
3291
|
+
{
|
|
3292
|
+
"file": r.file,
|
|
3293
|
+
"artifact_type": r.artifact_type,
|
|
3294
|
+
"status": r.status,
|
|
3295
|
+
"issues": [asdict(issue) for issue in r.issues],
|
|
3296
|
+
"suggestions": r.suggestions,
|
|
3297
|
+
}
|
|
3298
|
+
for r in results
|
|
3299
|
+
],
|
|
3300
|
+
}
|
|
3301
|
+
return json.dumps(payload, indent=2, ensure_ascii=False)
|
|
3302
|
+
|
|
3303
|
+
|
|
3304
|
+
def check_condensation_pairs(root: Path) -> list[LintResult]:
|
|
3305
|
+
"""Check that every uncondensed skill/rule/command has a condensed counterpart and vice versa."""
|
|
3306
|
+
results: list[LintResult] = []
|
|
3307
|
+
|
|
3308
|
+
pairs = [
|
|
3309
|
+
("skills", "SKILL.md", True), # (subdir, filename, is_nested)
|
|
3310
|
+
("rules", "*.md", False),
|
|
3311
|
+
("commands", "*.md", False),
|
|
3312
|
+
]
|
|
3313
|
+
|
|
3314
|
+
for subdir, pattern, is_nested in pairs:
|
|
3315
|
+
# ADR-017: union across every source root.
|
|
3316
|
+
condensed_dir = root / "dist/agent-src" / subdir
|
|
3317
|
+
uncondensed_names: set[str] = set()
|
|
3318
|
+
any_source = False
|
|
3319
|
+
for src_root in artefact_roots():
|
|
3320
|
+
uncondensed_dir = src_root / subdir
|
|
3321
|
+
if not uncondensed_dir.exists():
|
|
3322
|
+
continue
|
|
3323
|
+
any_source = True
|
|
3324
|
+
if is_nested:
|
|
3325
|
+
uncondensed_names |= {d.name for d in uncondensed_dir.iterdir() if d.is_dir() and (d / pattern).exists()}
|
|
3326
|
+
else:
|
|
3327
|
+
uncondensed_names |= {f.name for f in uncondensed_dir.glob(pattern) if f.is_file()}
|
|
3328
|
+
|
|
3329
|
+
if not any_source:
|
|
3330
|
+
continue
|
|
3331
|
+
|
|
3332
|
+
# Collect names from condensed
|
|
3333
|
+
if condensed_dir.exists():
|
|
3334
|
+
if is_nested:
|
|
3335
|
+
condensed_names = {d.name for d in condensed_dir.iterdir() if d.is_dir() and (d / pattern).exists()}
|
|
3336
|
+
else:
|
|
3337
|
+
condensed_names = {f.name for f in condensed_dir.glob(pattern) if f.is_file()}
|
|
3338
|
+
else:
|
|
3339
|
+
condensed_names = set()
|
|
3340
|
+
|
|
3341
|
+
# Missing condensed
|
|
3342
|
+
for name in sorted(uncondensed_names - condensed_names):
|
|
3343
|
+
path_str = f"dist/agent-src/{subdir}/{name}/{pattern}" if is_nested else f"dist/agent-src/{subdir}/{name}"
|
|
3344
|
+
results.append(LintResult(
|
|
3345
|
+
file=path_str,
|
|
3346
|
+
artifact_type=subdir.rstrip("s"),
|
|
3347
|
+
status="fail",
|
|
3348
|
+
issues=[Issue("error", "missing_condensed", f"Uncondensed exists but condensed version is missing")],
|
|
3349
|
+
suggestions=[f"Run /condense to generate dist/agent-src/{subdir}/{name}"],
|
|
3350
|
+
))
|
|
3351
|
+
|
|
3352
|
+
# Orphaned condensed (no source)
|
|
3353
|
+
for name in sorted(condensed_names - uncondensed_names):
|
|
3354
|
+
path_str = f"dist/agent-src/{subdir}/{name}/{pattern}" if is_nested else f"dist/agent-src/{subdir}/{name}"
|
|
3355
|
+
results.append(LintResult(
|
|
3356
|
+
file=path_str,
|
|
3357
|
+
artifact_type=subdir.rstrip("s"),
|
|
3358
|
+
status="fail",
|
|
3359
|
+
issues=[Issue("error", "orphaned_condensed", f"Condensed exists but uncondensed source is missing")],
|
|
3360
|
+
suggestions=[f"Delete orphaned file or restore uncondensed source"],
|
|
3361
|
+
))
|
|
3362
|
+
|
|
3363
|
+
return results
|
|
3364
|
+
|
|
3365
|
+
|
|
3366
|
+
def check_condensation_quality(root: Path) -> list[LintResult]:
|
|
3367
|
+
"""Check that condensed skills preserve key content from their uncondensed source."""
|
|
3368
|
+
results: list[LintResult] = []
|
|
3369
|
+
condensed_dir = root / "dist/agent-src" / "skills"
|
|
3370
|
+
if not condensed_dir.exists():
|
|
3371
|
+
return results
|
|
3372
|
+
|
|
3373
|
+
# ADR-017: collect skill dirs from every source root.
|
|
3374
|
+
skill_sources: list[Path] = []
|
|
3375
|
+
for src_root in artefact_roots():
|
|
3376
|
+
uncondensed_dir = src_root / "skills"
|
|
3377
|
+
if uncondensed_dir.exists():
|
|
3378
|
+
skill_sources.extend(sorted(uncondensed_dir.iterdir()))
|
|
3379
|
+
if not skill_sources:
|
|
3380
|
+
return results
|
|
3381
|
+
|
|
3382
|
+
# Sections that MUST exist in condensed if they exist in uncondensed
|
|
3383
|
+
preserved_sections = ["When to use", "Procedure", "Gotcha", "Gotchas", "Do NOT", "Output format", "Output"]
|
|
3384
|
+
|
|
3385
|
+
for skill_dir in skill_sources:
|
|
3386
|
+
src = skill_dir / "SKILL.md"
|
|
3387
|
+
dst = condensed_dir / skill_dir.name / "SKILL.md"
|
|
3388
|
+
if not src.exists() or not dst.exists():
|
|
3389
|
+
continue
|
|
3390
|
+
|
|
3391
|
+
src_text = read_text(src)
|
|
3392
|
+
dst_text = read_text(dst)
|
|
3393
|
+
src_sections = extract_sections(src_text)
|
|
3394
|
+
dst_sections = extract_sections(dst_text)
|
|
3395
|
+
|
|
3396
|
+
issues: list[Issue] = []
|
|
3397
|
+
suggestions: list[str] = []
|
|
3398
|
+
|
|
3399
|
+
# Check required sections survived condensation
|
|
3400
|
+
for section in preserved_sections:
|
|
3401
|
+
if section_matches(section, src_sections) and not section_matches(section, dst_sections):
|
|
3402
|
+
issues.append(Issue("warning", "condensation_lost_section",
|
|
3403
|
+
f"Condensed version lost '{section}' section"))
|
|
3404
|
+
|
|
3405
|
+
# Check validation keywords survived
|
|
3406
|
+
src_proc = find_procedure_block(src_text) or ""
|
|
3407
|
+
dst_proc = find_procedure_block(dst_text) or ""
|
|
3408
|
+
validation_patterns = [r"\bverif", r"\bcheck\b", r"\bconfirm\b", r"\bvalidat", r"\binspect"]
|
|
3409
|
+
src_has_validation = any(re.search(p, src_proc, re.IGNORECASE) for p in validation_patterns)
|
|
3410
|
+
dst_has_validation = any(re.search(p, dst_proc, re.IGNORECASE) for p in validation_patterns)
|
|
3411
|
+
if src_has_validation and not dst_has_validation:
|
|
3412
|
+
issues.append(Issue("warning", "condensation_lost_validation",
|
|
3413
|
+
"Condensed procedure lost validation keywords present in uncondensed"))
|
|
3414
|
+
|
|
3415
|
+
# Check code blocks / examples survived
|
|
3416
|
+
src_code_blocks = len(re.findall(r"```", src_text)) # pairs of ``` = blocks
|
|
3417
|
+
dst_code_blocks = len(re.findall(r"```", dst_text))
|
|
3418
|
+
if src_code_blocks > 0 and dst_code_blocks < src_code_blocks // 2:
|
|
3419
|
+
issues.append(Issue("warning", "condensation_lost_example",
|
|
3420
|
+
f"Condensed version has fewer code blocks "
|
|
3421
|
+
f"({dst_code_blocks // 2} vs {src_code_blocks // 2} in source)"))
|
|
3422
|
+
|
|
3423
|
+
# Check anti-pattern / "Do NOT" bullets survived
|
|
3424
|
+
src_donot = len(re.findall(r"(?:Do NOT|NEVER|MUST NOT)\b", src_text))
|
|
3425
|
+
dst_donot = len(re.findall(r"(?:Do NOT|NEVER|MUST NOT)\b", dst_text))
|
|
3426
|
+
if src_donot > 0 and dst_donot < src_donot // 2:
|
|
3427
|
+
issues.append(Issue("warning", "condensation_lost_antipattern",
|
|
3428
|
+
f"Condensed version lost anti-pattern constraints "
|
|
3429
|
+
f"({dst_donot} vs {src_donot} in source)"))
|
|
3430
|
+
|
|
3431
|
+
if issues:
|
|
3432
|
+
rel_path = f"dist/agent-src/skills/{skill_dir.name}/SKILL.md"
|
|
3433
|
+
results.append(LintResult(
|
|
3434
|
+
file=rel_path,
|
|
3435
|
+
artifact_type="skill",
|
|
3436
|
+
status="pass_with_warnings",
|
|
3437
|
+
issues=issues,
|
|
3438
|
+
suggestions=suggestions or ["Re-condense to preserve lost content"],
|
|
3439
|
+
))
|
|
3440
|
+
|
|
3441
|
+
return results
|
|
3442
|
+
|
|
3443
|
+
|
|
3444
|
+
def check_duplication(root: Path) -> list[LintResult]:
|
|
3445
|
+
"""Detect skills with highly similar names or descriptions."""
|
|
3446
|
+
results: list[LintResult] = []
|
|
3447
|
+
# ADR-017: collect skill dirs across every source root, dedup by name.
|
|
3448
|
+
skill_dirs: list[Path] = []
|
|
3449
|
+
seen: set[str] = set()
|
|
3450
|
+
for src_root in artefact_roots():
|
|
3451
|
+
sd = src_root / "skills"
|
|
3452
|
+
if not sd.exists():
|
|
3453
|
+
continue
|
|
3454
|
+
for d in sorted(sd.iterdir()):
|
|
3455
|
+
if d.is_dir() and d.name not in seen:
|
|
3456
|
+
seen.add(d.name)
|
|
3457
|
+
skill_dirs.append(d)
|
|
3458
|
+
if not skill_dirs:
|
|
3459
|
+
return results
|
|
3460
|
+
|
|
3461
|
+
# Collect all skill names and descriptions
|
|
3462
|
+
skill_data: list[tuple[str, str, Path]] = []
|
|
3463
|
+
for skill_dir in skill_dirs:
|
|
3464
|
+
skill_file = skill_dir / "SKILL.md"
|
|
3465
|
+
if not skill_file.exists():
|
|
3466
|
+
continue
|
|
3467
|
+
text = read_text(skill_file)
|
|
3468
|
+
desc = extract_description(text) or ""
|
|
3469
|
+
skill_data.append((skill_dir.name, desc.lower(), skill_file))
|
|
3470
|
+
|
|
3471
|
+
# Check for name prefix overlap (e.g. "laravel" and "laravel-validation")
|
|
3472
|
+
# Only flag if descriptions are also similar
|
|
3473
|
+
for i, (name_a, desc_a, path_a) in enumerate(skill_data):
|
|
3474
|
+
for name_b, desc_b, path_b in skill_data[i + 1:]:
|
|
3475
|
+
# Skip known patterns: skill-X and skill-X-subtype is intentional
|
|
3476
|
+
if name_a == name_b:
|
|
3477
|
+
continue
|
|
3478
|
+
# Check description word overlap
|
|
3479
|
+
if desc_a and desc_b:
|
|
3480
|
+
words_a = set(desc_a.split())
|
|
3481
|
+
words_b = set(desc_b.split())
|
|
3482
|
+
if len(words_a) > 3 and len(words_b) > 3:
|
|
3483
|
+
overlap = len(words_a & words_b) / min(len(words_a), len(words_b))
|
|
3484
|
+
if overlap > 0.7:
|
|
3485
|
+
rel_a = f".agent-src.uncondensed/skills/{name_a}/SKILL.md"
|
|
3486
|
+
results.append(LintResult(
|
|
3487
|
+
file=rel_a,
|
|
3488
|
+
artifact_type="skill",
|
|
3489
|
+
status="pass_with_warnings",
|
|
3490
|
+
issues=[Issue("warning", "similar_description",
|
|
3491
|
+
f"Description highly similar to '{name_b}' ({overlap:.0%} word overlap)")],
|
|
3492
|
+
suggestions=[f"Consider merging with '{name_b}' or differentiating descriptions"],
|
|
3493
|
+
))
|
|
3494
|
+
|
|
3495
|
+
return results
|
|
3496
|
+
|
|
3497
|
+
|
|
3498
|
+
def compute_exit_code(results: list[LintResult], strict_warnings: bool) -> int:
|
|
3499
|
+
# Phase 5.2: structural-malice findings emit exit code 3 (security-
|
|
3500
|
+
# failure), distinct from 2 (build-failure) so CI surfaces can split.
|
|
3501
|
+
for r in results:
|
|
3502
|
+
if any(issue.code.startswith("malice:") for issue in r.issues):
|
|
3503
|
+
return 3
|
|
3504
|
+
if any(r.status == "fail" for r in results):
|
|
3505
|
+
return 2
|
|
3506
|
+
if any(r.status == "pass_with_warnings" for r in results) and strict_warnings:
|
|
3507
|
+
return 1
|
|
3508
|
+
return 0
|
|
3509
|
+
|
|
3510
|
+
|
|
3511
|
+
def parse_args() -> argparse.Namespace:
|
|
3512
|
+
parser = argparse.ArgumentParser(description="Lint skills and rules.")
|
|
3513
|
+
parser.add_argument("paths", nargs="*", help="Files to lint")
|
|
3514
|
+
parser.add_argument("--all", action="store_true", help="Lint all skills/rules in the repo")
|
|
3515
|
+
parser.add_argument("--changed", action="store_true", help="Lint changed skills/rules")
|
|
3516
|
+
parser.add_argument("--format", choices=["text", "json"], default="text", help="Output format")
|
|
3517
|
+
parser.add_argument("--pairs", action="store_true", help="Check condensation pairs (uncondensed vs condensed)")
|
|
3518
|
+
parser.add_argument("--duplicates", action="store_true", help="Detect skills with similar descriptions")
|
|
3519
|
+
parser.add_argument("--condensation-quality", action="store_true", help="Check condensed skills preserve key content")
|
|
3520
|
+
parser.add_argument("--strict-warnings", action="store_true", help="Return non-zero on warnings")
|
|
3521
|
+
parser.add_argument("--report", action="store_true", help="Output quality score report")
|
|
3522
|
+
parser.add_argument("--repo-root", default=".", help="Repository root")
|
|
3523
|
+
parser.add_argument("--quiet", action="store_true",
|
|
3524
|
+
help="suppress per-file PASS lines; keep malice + WARN/FAIL + summary (P10.5)")
|
|
3525
|
+
return parser.parse_args()
|
|
3526
|
+
|
|
3527
|
+
|
|
3528
|
+
def format_report(results: list[LintResult]) -> str:
|
|
3529
|
+
"""Generate a quality score report grouped by artifact type."""
|
|
3530
|
+
lines = ["# Quality Report", ""]
|
|
3531
|
+
|
|
3532
|
+
# Group by artifact type
|
|
3533
|
+
by_type: dict[str, list[LintResult]] = {}
|
|
3534
|
+
for r in results:
|
|
3535
|
+
by_type.setdefault(r.artifact_type, []).append(r)
|
|
3536
|
+
|
|
3537
|
+
# Summary table
|
|
3538
|
+
lines.append("| Type | Total | Pass | Warn | Fail | Score |")
|
|
3539
|
+
lines.append("|---|---|---|---|---|---|")
|
|
3540
|
+
total_score = 0.0
|
|
3541
|
+
total_count = 0
|
|
3542
|
+
for atype in sorted(by_type):
|
|
3543
|
+
items = by_type[atype]
|
|
3544
|
+
n = len(items)
|
|
3545
|
+
n_pass = sum(1 for r in items if r.status == "pass")
|
|
3546
|
+
n_warn = sum(1 for r in items if r.status in ("warn", "pass_with_warnings"))
|
|
3547
|
+
n_fail = sum(1 for r in items if r.status == "fail")
|
|
3548
|
+
# Score: pass=10, warn=8, fail=3
|
|
3549
|
+
type_score = (n_pass * 10 + n_warn * 8 + n_fail * 3) / max(n, 1)
|
|
3550
|
+
total_score += type_score * n
|
|
3551
|
+
total_count += n
|
|
3552
|
+
lines.append(f"| {atype} | {n} | {n_pass} | {n_warn} | {n_fail} | {type_score:.1f}/10 |")
|
|
3553
|
+
overall = total_score / max(total_count, 1)
|
|
3554
|
+
lines.append(f"| **TOTAL** | **{total_count}** | | | | **{overall:.1f}/10** |")
|
|
3555
|
+
|
|
3556
|
+
# Top issues
|
|
3557
|
+
issue_counts: dict[str, int] = {}
|
|
3558
|
+
for r in results:
|
|
3559
|
+
for i in r.issues:
|
|
3560
|
+
issue_counts[i.code] = issue_counts.get(i.code, 0) + 1
|
|
3561
|
+
if issue_counts:
|
|
3562
|
+
lines.extend(["", "## Top Issues", ""])
|
|
3563
|
+
lines.append("| Issue | Count | Severity |")
|
|
3564
|
+
lines.append("|---|---|---|")
|
|
3565
|
+
for code, count in sorted(issue_counts.items(), key=lambda x: -x[1])[:15]:
|
|
3566
|
+
# Find severity from first occurrence
|
|
3567
|
+
sev = "?"
|
|
3568
|
+
for r in results:
|
|
3569
|
+
for i in r.issues:
|
|
3570
|
+
if i.code == code:
|
|
3571
|
+
sev = i.severity
|
|
3572
|
+
break
|
|
3573
|
+
if sev != "?":
|
|
3574
|
+
break
|
|
3575
|
+
lines.append(f"| `{code}` | {count} | {sev} |")
|
|
3576
|
+
|
|
3577
|
+
# Files with most issues (top 10)
|
|
3578
|
+
files_with_issues = [
|
|
3579
|
+
(r.file, len(r.issues), r.status)
|
|
3580
|
+
for r in results
|
|
3581
|
+
if r.issues
|
|
3582
|
+
]
|
|
3583
|
+
files_with_issues.sort(key=lambda x: -x[1])
|
|
3584
|
+
if files_with_issues:
|
|
3585
|
+
lines.extend(["", "## Files with Most Issues (Top 10)", ""])
|
|
3586
|
+
lines.append("| File | Issues | Status |")
|
|
3587
|
+
lines.append("|---|---|---|")
|
|
3588
|
+
for fpath, count, status in files_with_issues[:10]:
|
|
3589
|
+
short = fpath.replace(".agent-src.uncondensed/", "")
|
|
3590
|
+
lines.append(f"| `{short}` | {count} | {status} |")
|
|
3591
|
+
|
|
3592
|
+
# Per-file quality breakdown (skills only)
|
|
3593
|
+
skill_results = [r for r in results if r.artifact_type == "skill" and "/pair-check/" not in r.file]
|
|
3594
|
+
if skill_results:
|
|
3595
|
+
lines.extend(["", "## Per-File Quality (Skills)", ""])
|
|
3596
|
+
lines.append("| Skill | Structure | Validation | Scope | Dependency | Lines |")
|
|
3597
|
+
lines.append("|---|---|---|---|---|---|")
|
|
3598
|
+
for r in sorted(skill_results, key=lambda x: x.file):
|
|
3599
|
+
short = r.file.replace(".agent-src.uncondensed/skills/", "").replace("dist/agent-src/skills/", "").replace("/SKILL.md", "")
|
|
3600
|
+
codes = {i.code for i in r.issues}
|
|
3601
|
+
|
|
3602
|
+
# Structure: fail if missing required sections
|
|
3603
|
+
struct = "❌" if codes & {"missing_section", "empty_procedure", "unordered_procedure"} else "✅"
|
|
3604
|
+
|
|
3605
|
+
# Validation: weak if missing or vague
|
|
3606
|
+
if codes & {"missing_validation", "vague_validation"}:
|
|
3607
|
+
valid = "❌ weak"
|
|
3608
|
+
elif codes & {"missing_inspect_step"}:
|
|
3609
|
+
valid = "⚠️ partial"
|
|
3610
|
+
else:
|
|
3611
|
+
valid = "✅ strong"
|
|
3612
|
+
|
|
3613
|
+
# Scope: broad if flagged
|
|
3614
|
+
scope = "⚠️ broad" if "broad_scope" in codes else "✅ focused"
|
|
3615
|
+
|
|
3616
|
+
# Guideline dependency
|
|
3617
|
+
if "guideline_dependent_skill" in codes:
|
|
3618
|
+
dep = "❌ high"
|
|
3619
|
+
elif "pointer_only_skill" in codes:
|
|
3620
|
+
dep = "⚠️ medium"
|
|
3621
|
+
else:
|
|
3622
|
+
dep = "✅ low"
|
|
3623
|
+
|
|
3624
|
+
# Line count
|
|
3625
|
+
total_lines = 0
|
|
3626
|
+
try:
|
|
3627
|
+
total_lines = Path(r.file).read_text(encoding="utf-8").count("\n")
|
|
3628
|
+
except OSError:
|
|
3629
|
+
pass
|
|
3630
|
+
|
|
3631
|
+
lines.append(f"| `{short}` | {struct} | {valid} | {scope} | {dep} | {total_lines} |")
|
|
3632
|
+
|
|
3633
|
+
return "\n".join(lines)
|
|
3634
|
+
|
|
3635
|
+
|
|
3636
|
+
def main() -> int:
|
|
3637
|
+
args = parse_args()
|
|
3638
|
+
root = Path(args.repo_root).resolve()
|
|
3639
|
+
|
|
3640
|
+
try:
|
|
3641
|
+
paths: list[Path] = []
|
|
3642
|
+
if args.all or args.report:
|
|
3643
|
+
paths.extend(gather_all_candidate_files(root))
|
|
3644
|
+
if args.changed:
|
|
3645
|
+
paths.extend(gather_changed_candidate_files(root))
|
|
3646
|
+
for raw in args.paths:
|
|
3647
|
+
path = (root / raw).resolve() if not Path(raw).is_absolute() else Path(raw)
|
|
3648
|
+
if not path.exists():
|
|
3649
|
+
continue
|
|
3650
|
+
if path.is_dir():
|
|
3651
|
+
# Walk the directory like a source root so callers can pass
|
|
3652
|
+
# `packages/pack-laravel/.agent-src.uncondensed/` (ADR-017 Phase 4.4).
|
|
3653
|
+
paths.extend(gather_candidate_files_under(path))
|
|
3654
|
+
else:
|
|
3655
|
+
paths.append(path)
|
|
3656
|
+
|
|
3657
|
+
paths = sorted(set(paths))
|
|
3658
|
+
if not paths:
|
|
3659
|
+
# Emit a valid empty payload when a structured format was requested
|
|
3660
|
+
# so downstream parsers (e.g. PR-summary workflows) don't fail on an
|
|
3661
|
+
# empty stdout. stderr keeps the human-readable note.
|
|
3662
|
+
if args.report:
|
|
3663
|
+
print(format_report([]))
|
|
3664
|
+
elif args.format == "json":
|
|
3665
|
+
print(format_json([]))
|
|
3666
|
+
print("No matching skill/rule files found.", file=sys.stderr)
|
|
3667
|
+
return 0
|
|
3668
|
+
|
|
3669
|
+
results = [lint_file(path, repo_root=root) for path in paths]
|
|
3670
|
+
|
|
3671
|
+
# Additional checks
|
|
3672
|
+
if args.pairs or args.report:
|
|
3673
|
+
results.extend(check_condensation_pairs(root))
|
|
3674
|
+
if args.duplicates:
|
|
3675
|
+
results.extend(check_duplication(root))
|
|
3676
|
+
if args.condensation_quality or args.report:
|
|
3677
|
+
results.extend(check_condensation_quality(root))
|
|
3678
|
+
|
|
3679
|
+
if args.report:
|
|
3680
|
+
print(format_report(results))
|
|
3681
|
+
elif args.format == "json":
|
|
3682
|
+
print(format_json(results))
|
|
3683
|
+
else:
|
|
3684
|
+
print(format_text(results, quiet=args.quiet))
|
|
3685
|
+
|
|
3686
|
+
return compute_exit_code(results, strict_warnings=args.strict_warnings)
|
|
3687
|
+
|
|
3688
|
+
except Exception as exc: # noqa: BLE001
|
|
3689
|
+
print(f"Internal error: {exc}", file=sys.stderr)
|
|
3690
|
+
return 3
|
|
3691
|
+
|
|
3692
|
+
|
|
3693
|
+
if __name__ == "__main__":
|
|
3694
|
+
raise SystemExit(main())
|