@event4u/agent-config 7.4.0 → 8.0.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 +11 -1
- package/AGENTS.md +9 -9
- package/CHANGELOG.md +373 -0
- package/README.md +35 -5
- package/dist/agent-src/commands/analytics/prune.md +1 -1
- package/dist/agent-src/commands/analytics/show.md +1 -1
- package/dist/agent-src/commands/analyze/decision.md +2 -2
- package/dist/agent-src/commands/analyze/incident.md +2 -2
- package/dist/agent-src/commands/analyze/near-miss.md +2 -2
- package/dist/agent-src/commands/analyze/postmortem.md +2 -2
- package/dist/agent-src/commands/analyze/premortem.md +2 -2
- package/dist/agent-src/commands/cost-report.md +25 -0
- package/dist/agent-src/commands/evals/analyze.json +30 -0
- package/dist/agent-src/commands/evals/mission-upgrade.json +30 -0
- package/dist/agent-src/commands/implement-ticket.md +1 -1
- package/dist/agent-src/commands/knowledge/forget.md +1 -1
- package/dist/agent-src/commands/knowledge/ingest.md +1 -1
- package/dist/agent-src/commands/knowledge/list.md +1 -1
- package/dist/agent-src/commands/memory/load.md +12 -11
- package/dist/agent-src/commands/memory/promote.md +30 -0
- package/dist/agent-src/commands/memory/propose.md +16 -2
- package/dist/agent-src/commands/mission/upgrade.md +1 -1
- package/dist/agent-src/commands/module/explore.md +11 -7
- package/dist/agent-src/commands/optimize-project.md +243 -0
- package/dist/agent-src/commands/optimize.md +5 -0
- package/dist/agent-src/commands/pr/create.md +37 -8
- package/dist/agent-src/commands/prediction-pool.md +2 -2
- package/dist/agent-src/commands/profile/activate.md +3 -3
- package/dist/agent-src/commands/profile/deactivate.md +2 -2
- package/dist/agent-src/commands/profile/show.md +3 -3
- package/dist/agent-src/commands/research/deep.md +5 -0
- package/dist/agent-src/commands/research/report.md +2 -1
- package/dist/agent-src/commands/review-changes.md +14 -7
- package/dist/agent-src/commands/roadmap/create.md +88 -10
- package/dist/agent-src/commands/roadmap/materialize.md +1 -1
- package/dist/agent-src/commands/roadmap/process-full.md +15 -2
- package/dist/agent-src/commands/roadmap/process-phase.md +18 -6
- package/dist/agent-src/commands/roadmap/process-step.md +4 -0
- package/dist/agent-src/commands/roadmap.md +1 -1
- package/dist/agent-src/commands/security-audit-config.md +1 -1
- package/dist/agent-src/commands/sync-agent-settings.md +1 -1
- package/dist/agent-src/commands/sync-gitignore/fix.md +42 -6
- package/dist/agent-src/commands/team-knowledge/bootstrap.md +106 -0
- package/dist/agent-src/commands/team-knowledge/consolidate.md +105 -0
- package/dist/agent-src/commands/team-knowledge.md +64 -0
- package/dist/agent-src/contexts/authority/commit-mechanics.md +8 -0
- package/dist/agent-src/contexts/authority/destructive-mechanics.md +11 -0
- package/dist/agent-src/contexts/authority/scope-mechanics.md +25 -0
- package/dist/agent-src/contexts/communication/rules-auto/reply-close-mechanics.md +43 -0
- package/dist/agent-src/contexts/contracts/agents-md-anatomy.md +1 -1
- package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +2 -2
- package/dist/agent-src/contexts/contracts/frugality-charter.md +1 -0
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +14 -4
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +11 -0
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +32 -8
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +107 -0
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +71 -15
- package/dist/agent-src/contexts/execution/subagent-steering.md +41 -1
- package/dist/agent-src/contexts/override-system.md +1 -1
- package/dist/agent-src/personas/brand-strategist.md +0 -1
- package/dist/agent-src/personas/data-integrity.md +66 -0
- package/dist/agent-src/personas/design-director.md +0 -1
- package/dist/agent-src/personas/performance-engineer.md +66 -0
- package/dist/agent-src/personas/production-validator.md +73 -0
- package/dist/agent-src/rules/agent-authority.md +3 -4
- package/dist/agent-src/rules/analysis-skill-routing.md +3 -5
- package/dist/agent-src/rules/architecture.md +2 -4
- package/dist/agent-src/rules/artifact-drafting-protocol.md +35 -6
- package/dist/agent-src/rules/artifact-engagement-recording.md +11 -4
- package/dist/agent-src/rules/ask-when-uncertain.md +10 -14
- package/dist/agent-src/rules/augment-edit-discipline.md +3 -5
- package/dist/agent-src/rules/autonomous-execution.md +3 -5
- package/dist/agent-src/rules/brand-consistency.md +3 -5
- package/dist/agent-src/rules/brand-source-of-truth.md +3 -5
- package/dist/agent-src/rules/cli-output-handling.md +4 -6
- package/dist/agent-src/rules/command-suggestion-policy.md +3 -5
- package/dist/agent-src/rules/commit-conventions.md +3 -5
- package/dist/agent-src/rules/commit-policy.md +8 -10
- package/dist/agent-src/rules/content-quoting-floor.md +88 -0
- package/dist/agent-src/rules/context-hygiene.md +3 -5
- package/dist/agent-src/rules/copilot-routing.md +4 -6
- package/dist/agent-src/rules/decision-revisit-gate.md +120 -0
- package/dist/agent-src/rules/delegation-policy.md +10 -6
- package/dist/agent-src/rules/design-fidelity.md +3 -5
- package/dist/agent-src/rules/devcontainer-routing.md +4 -6
- package/dist/agent-src/rules/direct-answers.md +13 -17
- package/dist/agent-src/rules/docker-commands.md +3 -5
- package/dist/agent-src/rules/domain-adoption-policy.md +3 -5
- package/dist/agent-src/rules/domain-safety-disclaimer.md +3 -5
- package/dist/agent-src/rules/domain-safety-pii.md +7 -8
- package/dist/agent-src/rules/domain-safety-retention.md +3 -5
- package/dist/agent-src/rules/downstream-changes.md +3 -4
- package/dist/agent-src/rules/engineering-safety-floor.md +3 -5
- package/dist/agent-src/rules/external-reference-deep-dive.md +3 -5
- package/dist/agent-src/rules/fast-path-marker-visibility.md +3 -5
- package/dist/agent-src/rules/finance-safety-floor.md +3 -6
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +3 -5
- package/dist/agent-src/rules/git-history-discipline.md +3 -5
- package/dist/agent-src/rules/guidelines.md +2 -4
- package/dist/agent-src/rules/icon-consistency.md +4 -5
- package/dist/agent-src/rules/image-likeness-and-rights.md +3 -5
- package/dist/agent-src/rules/improve-before-implement.md +5 -5
- package/dist/agent-src/rules/invite-challenge.md +3 -5
- package/dist/agent-src/rules/language-and-tone.md +13 -15
- package/dist/agent-src/rules/laravel-routing.md +3 -5
- package/dist/agent-src/rules/laravel-translations.md +3 -5
- package/dist/agent-src/rules/legal-safety-floor.md +5 -7
- package/dist/agent-src/rules/lethal-trifecta-guard.md +3 -5
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +4 -7
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +3 -5
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +2 -4
- package/dist/agent-src/rules/media-governance-routing.md +3 -5
- package/dist/agent-src/rules/media-sync-ground-truth.md +3 -5
- package/dist/agent-src/rules/minimal-safe-diff.md +5 -5
- package/dist/agent-src/rules/missing-tool-handling.md +3 -5
- package/dist/agent-src/rules/model-recommendation.md +4 -6
- package/dist/agent-src/rules/no-attribution-footers.md +3 -5
- package/dist/agent-src/rules/no-cheap-questions.md +5 -8
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +3 -6
- package/dist/agent-src/rules/no-pr-progress-comments.md +3 -6
- package/dist/agent-src/rules/no-roadmap-references.md +3 -5
- package/dist/agent-src/rules/non-destructive-by-default.md +11 -13
- package/dist/agent-src/rules/notes-first-reasoning.md +3 -5
- package/dist/agent-src/rules/onboarding-gate.md +4 -6
- package/dist/agent-src/rules/output-discipline.md +3 -5
- package/dist/agent-src/rules/package-ci-checks.md +3 -5
- package/dist/agent-src/rules/persona-governance.md +2 -4
- package/dist/agent-src/rules/php-coding.md +3 -5
- package/dist/agent-src/rules/preservation-guard.md +2 -4
- package/dist/agent-src/rules/provider-lifecycle-discipline.md +3 -5
- package/dist/agent-src/rules/reviewer-awareness.md +5 -6
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +3 -5
- package/dist/agent-src/rules/roadmap-progress-sync.md +5 -5
- package/dist/agent-src/rules/role-mode-adherence.md +2 -4
- package/dist/agent-src/rules/rule-type-governance.md +3 -5
- package/dist/agent-src/rules/runtime-safety.md +2 -4
- package/dist/agent-src/rules/scope-control.md +10 -11
- package/dist/agent-src/rules/security-sensitive-stop.md +4 -5
- package/dist/agent-src/rules/size-enforcement.md +2 -4
- package/dist/agent-src/rules/skill-improvement-trigger.md +3 -5
- package/dist/agent-src/rules/skill-quality.md +3 -5
- package/dist/agent-src/rules/slash-command-routing-policy.md +3 -5
- package/dist/agent-src/rules/source-confidentiality.md +3 -5
- package/dist/agent-src/rules/source-discovery-gate.md +3 -5
- package/dist/agent-src/rules/source-of-truth.md +3 -5
- package/dist/agent-src/rules/strategy-safety-floor.md +3 -5
- package/dist/agent-src/rules/symfony-routing.md +4 -6
- package/dist/agent-src/rules/telegraph-speak.md +4 -5
- package/dist/agent-src/rules/think-before-action.md +7 -4
- package/dist/agent-src/rules/token-budget-discipline.md +29 -5
- package/dist/agent-src/rules/token-efficiency.md +3 -5
- package/dist/agent-src/rules/token-optimizer-maintenance.md +3 -5
- package/dist/agent-src/rules/tool-safety.md +2 -4
- package/dist/agent-src/rules/ui-audit-gate.md +3 -6
- package/dist/agent-src/rules/untrusted-input-defense.md +11 -10
- package/dist/agent-src/rules/upstream-proposal.md +4 -6
- package/dist/agent-src/rules/user-interaction.md +7 -5
- package/dist/agent-src/rules/user-interrupt-priority.md +17 -8
- package/dist/agent-src/rules/verify-before-complete.md +12 -22
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +3 -3
- package/dist/agent-src/scripts/update_roadmap_progress.ts +197 -7
- package/dist/agent-src/skills/adr-create/SKILL.md +52 -42
- package/dist/agent-src/skills/adversarial-review/SKILL.md +1 -1
- package/dist/agent-src/skills/agent-docs-writing/SKILL.md +18 -0
- package/dist/agent-src/skills/agent-security-review/SKILL.md +1 -1
- package/dist/agent-src/skills/ai-council/SKILL.md +14 -1
- package/dist/agent-src/skills/blade-ui/SKILL.md +4 -0
- package/dist/agent-src/skills/blameless-post-mortem/SKILL.md +0 -3
- package/dist/agent-src/skills/brand/SKILL.md +1 -1
- package/dist/agent-src/skills/brand-identity/SKILL.md +3 -3
- package/dist/agent-src/skills/brand-strategy/SKILL.md +1 -1
- package/dist/agent-src/skills/brand-to-tokens/SKILL.md +5 -4
- package/dist/agent-src/skills/canvas-design/SKILL.md +6 -0
- package/dist/agent-src/skills/check-refs/SKILL.md +7 -4
- package/dist/agent-src/skills/code-review/SKILL.md +5 -0
- package/dist/agent-src/skills/complexity-first-planning/SKILL.md +6 -5
- package/dist/agent-src/skills/condense-memory/SKILL.md +11 -11
- package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
- package/dist/agent-src/skills/context-document/SKILL.md +17 -0
- package/dist/agent-src/skills/corpus-grounding/SKILL.md +3 -3
- package/dist/agent-src/skills/decision-record/SKILL.md +6 -0
- package/dist/agent-src/skills/decision-review/SKILL.md +5 -3
- package/dist/agent-src/skills/deep-reading-analyst/SKILL.md +6 -1
- package/dist/agent-src/skills/design-intelligence/SKILL.md +45 -2
- package/dist/agent-src/skills/design-intelligence/references/design-languages.md +1 -1
- package/dist/agent-src/skills/design-review/SKILL.md +23 -11
- package/dist/agent-src/skills/design-system-capture/SKILL.md +41 -0
- package/dist/agent-src/skills/design-system-capture/reference/design-system-json.md +62 -0
- package/dist/agent-src/skills/design-tokens/SKILL.md +11 -4
- package/dist/agent-src/skills/design-variations/SKILL.md +127 -0
- package/dist/agent-src/skills/design-variations/evals/triggers.json +17 -0
- package/dist/agent-src/skills/emit-tickets/SKILL.md +4 -4
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +6 -0
- package/dist/agent-src/skills/fe-design/SKILL.md +20 -0
- package/dist/agent-src/skills/flux/SKILL.md +4 -0
- package/dist/agent-src/skills/html-deck/SKILL.md +123 -0
- package/dist/agent-src/skills/html-deck/evals/triggers.json +17 -0
- package/dist/agent-src/skills/html-deck/templates/deck-shell.html +77 -0
- package/dist/agent-src/skills/iconography/SKILL.md +1 -0
- package/dist/agent-src/skills/image-editing/evals/triggers.json +13 -13
- package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +136 -0
- package/dist/agent-src/skills/judge-artifact-completeness/calibration/fixtures.json +149 -0
- package/dist/agent-src/skills/judge-artifact-completeness/evals/triggers.json +17 -0
- package/dist/agent-src/skills/judge-artifact-completeness/rubrics/architecture-score.json +73 -0
- package/dist/agent-src/skills/judge-artifact-completeness/rubrics/pr-review-score.json +65 -0
- package/dist/agent-src/skills/judge-artifact-completeness/rubrics/roadmap-score.json +73 -0
- package/dist/agent-src/skills/judge-artifact-completeness/rubrics/ticket-quality-score.json +73 -0
- package/dist/agent-src/skills/judge-code-quality/SKILL.md +1 -0
- package/dist/agent-src/skills/judge-injection-defense/SKILL.md +99 -0
- package/dist/agent-src/skills/judge-injection-defense/calibration/fixtures.json +24 -0
- package/dist/agent-src/skills/judge-injection-defense/evals/triggers.json +17 -0
- package/dist/agent-src/skills/judge-injection-defense/fixtures/behavioral-fixtures.json +63 -0
- package/dist/agent-src/skills/judge-injection-defense/fixtures/coverage-report.md +53 -0
- package/dist/agent-src/skills/judge-injection-defense/fixtures/perturbation-taxonomy.json +110 -0
- package/dist/agent-src/skills/judge-synthesis/SKILL.md +134 -0
- package/dist/agent-src/skills/judge-synthesis/evals/triggers.json +17 -0
- package/dist/agent-src/skills/laravel/SKILL.md +0 -1
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +46 -0
- package/dist/agent-src/skills/lint-skills/SKILL.md +6 -6
- package/dist/agent-src/skills/logo-generation/SKILL.md +1 -1
- package/dist/agent-src/skills/markitdown/SKILL.md +1 -1
- package/dist/agent-src/skills/md-language-check/SKILL.md +3 -3
- package/dist/agent-src/skills/memory-consolidation/SKILL.md +66 -1
- package/dist/agent-src/skills/migration-architect/SKILL.md +1 -0
- package/dist/agent-src/skills/module-detect-on-the-fly/SKILL.md +2 -2
- package/dist/agent-src/skills/performance-analysis/SKILL.md +2 -0
- package/dist/agent-src/skills/prediction-pool-optimizer/SKILL.md +4 -4
- package/dist/agent-src/skills/premortem/SKILL.md +0 -3
- package/dist/agent-src/skills/project-analysis-core/SKILL.md +16 -0
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +18 -0
- package/dist/agent-src/skills/react-shadcn-ui/reference/registry.md +59 -0
- package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +3 -1
- package/dist/agent-src/skills/refine-ticket/SKILL.md +5 -1
- package/dist/agent-src/skills/release-comms/SKILL.md +47 -46
- package/dist/agent-src/skills/roadmap-management/SKILL.md +25 -0
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +33 -3
- package/dist/agent-src/skills/root-cause-frameworks/SKILL.md +0 -3
- package/dist/agent-src/skills/script-writing/SKILL.md +1 -1
- package/dist/agent-src/skills/security-audit/SKILL.md +1 -0
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +4 -0
- package/dist/agent-src/skills/source-discovery/SKILL.md +22 -3
- package/dist/agent-src/skills/sql-writing/SKILL.md +1 -1
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +33 -14
- package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +11 -0
- package/dist/agent-src/skills/subagent-orchestration/prompts/do-in-steps.md +8 -0
- package/dist/agent-src/skills/systematic-debugging/SKILL.md +30 -1
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +4 -0
- package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/threat-modeling/SKILL.md +2 -2
- package/dist/agent-src/skills/token-optimizer/SKILL.md +1 -1
- package/dist/agent-src/skills/typography-system/SKILL.md +4 -3
- package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +2 -0
- package/dist/agent-src/skills/wireframe/SKILL.md +118 -0
- package/dist/agent-src/skills/wireframe/evals/triggers.json +17 -0
- package/dist/agent-src/templates/agent-settings.md +22 -1
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/command.md +2 -2
- package/dist/agent-src/templates/contexts/knowledge-pages.md +116 -0
- package/dist/agent-src/templates/hooks/pre-commit-frontmatter +1 -1
- package/dist/agent-src/templates/roadmaps.md +70 -2
- package/dist/agent-src/templates/rule.md +1 -1
- package/dist/agent-src/templates/scripts/README.md +3 -3
- package/dist/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +109 -0
- package/dist/agent-src/templates/tickets.md +8 -8
- package/dist/cli/commands/recordTriggerEval.test.js +1 -1
- package/dist/cli/commands/recordTriggerEval.test.js.map +1 -1
- package/dist/cli/initRouting.js +4 -2
- package/dist/cli/initRouting.js.map +1 -1
- package/dist/cli/registry.js +1 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +802 -258
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +8 -8
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +46 -28
- package/dist/discovery/trust-report.md +12 -11
- package/dist/discovery/workspaces.json +32 -18
- package/dist/install/preflight.js +173 -0
- package/dist/install/preflight.js.map +1 -0
- package/dist/mcp/registry-manifest.json +4 -4
- package/dist/router.json +1 -1
- package/dist/server/routes/settings.js +4 -0
- package/dist/server/routes/settings.js.map +1 -1
- package/dist/server/schemas/settings.js +6 -1
- package/dist/server/schemas/settings.js.map +1 -1
- package/docs/CLAIMS.md +108 -0
- package/docs/MIGRATION.md +3 -3
- package/docs/architecture.md +6 -6
- package/docs/benchmark.md +133 -2
- package/docs/benchmark.pinned.yml +31 -0
- package/docs/capability-matrix.md +1 -0
- package/docs/catalog.md +92 -74
- package/docs/command-flows.md +16 -4
- package/docs/comparison.yaml +35 -0
- package/docs/contracts/agents-layout.md +148 -0
- package/docs/contracts/brand-token-consumption.md +5 -0
- package/docs/contracts/capability-boundary.md +5 -0
- package/docs/contracts/command-category-governance.md +5 -0
- package/docs/contracts/command-clusters.md +1 -0
- package/docs/contracts/command-surface-tiers.md +1 -1
- package/docs/contracts/conformance.md +84 -0
- package/docs/contracts/creative-pack-boundary.md +5 -0
- package/docs/contracts/discovery-manifest.schema.json +5 -4
- package/docs/contracts/file-ownership-matrix.json +4605 -985
- package/docs/contracts/governance-enforcement-projection.md +5 -0
- package/docs/contracts/gui-wizard.md +1 -1
- package/docs/contracts/hook-architecture-v1.md +2 -2
- package/docs/contracts/implement-ticket-flow.md +1 -1
- package/docs/contracts/kernel-membership.md +13 -0
- package/docs/contracts/mcp-tool-inventory.md +23 -23
- package/docs/contracts/no-runtime-boundary.md +6 -1
- package/docs/contracts/review-lens-schema.md +5 -0
- package/docs/contracts/rule-router.md +102 -8
- package/docs/contracts/skill-bundled-assets.md +1 -1
- package/docs/contracts/skill-dry-run.md +1 -1
- package/docs/contracts/subagent-boundary.md +5 -0
- package/docs/contracts/ticket-bundle-format.md +9 -4
- package/docs/contracts/tier-3-contrib-plugin.md +2 -2
- package/docs/contracts/write-engine.md +3 -0
- package/docs/customization.md +87 -15
- package/docs/decisions/ADR-107-legal-domain-pack-adoption.md +1 -1
- package/docs/decisions/ADR-109-subagent-v1-contract.md +246 -0
- package/docs/decisions/ADR-110-discipline-profile-resolution-locus.md +105 -0
- package/docs/decisions/INDEX.md +2 -0
- package/docs/distribution/awesome-list-submission.md +46 -0
- package/docs/distribution/launch-story-draft.md +58 -0
- package/docs/end-to-end-walkthroughs.md +2 -2
- package/docs/getting-started.md +2 -2
- package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +24 -0
- package/docs/guidelines/agent-infra/corpus-grounding-authoring.md +1 -1
- package/docs/guidelines/agent-infra/linked-projects-onboarding-gate.md +2 -2
- package/docs/guidelines/agent-infra/missing-tool-handling.md +3 -3
- package/docs/guidelines/agent-infra/verify-before-complete-demos.md +2 -2
- package/docs/guidelines/augment-portability-patterns.md +1 -1
- package/docs/guidelines/code-clarity.md +19 -0
- package/docs/guidelines/design-antipatterns-triggers.json +2 -1
- package/docs/guidelines/design-antipatterns.md +35 -0
- package/docs/guidelines/design-canon.md +62 -0
- package/docs/guidelines/design-modes.md +6 -0
- package/docs/guidelines/php/general.md +9 -1
- package/docs/guidelines/php/php-coding-patterns.md +7 -0
- package/docs/guides/cross-repo-retrieval.md +1 -1
- package/docs/guides/frontend-design-corpus-refresh.md +2 -2
- package/docs/guides/local-analytics.md +4 -4
- package/docs/guides/skill-discovery.md +1 -1
- package/docs/guides/skill-preview.md +1 -1
- package/docs/hook-payload-capture.md +6 -6
- package/docs/install-friction-report.md +66 -0
- package/docs/installation.md +1 -1
- package/docs/maintainers/optional-media-deps.md +50 -0
- package/docs/mcp-server.md +11 -12
- package/docs/media/proof-demo.cast +14 -0
- package/docs/media/proof-demo.gif +0 -0
- package/docs/migration/consumer-template-consumption-model.md +1 -1
- package/docs/migration/divergences/bench-stats-float-precision.md +1 -1
- package/docs/migration/node-floor.md +1 -1
- package/docs/migration/yaml-roundtrip-spike.md +1 -1
- package/docs/personas.md +16 -5
- package/docs/positioning-evidence.md +86 -0
- package/docs/proof.md +86 -0
- package/docs/skills-catalog.md +1 -1
- package/docs/troubleshooting.md +8 -8
- package/docs/wedge/production-validator/README.md +57 -0
- package/docs/wedge/production-validator/production-validator.md +56 -0
- package/docs/wizard.md +2 -2
- package/package.json +1 -1
- package/src/config/agent-settings.template.yml +71 -4
- package/src/config/agents-paths.yml +254 -0
- package/src/config/budgets.yml +16 -0
- package/src/config/discovery/packs.yml +1 -0
- package/src/config/discovery/unassigned-artefacts.yml +2 -0
- package/src/config/gitignore-block.txt +25 -0
- package/src/config/host-capabilities.yml +31 -0
- package/src/config/profiles/balanced.ini +4 -0
- package/src/config/profiles/full.ini +4 -0
- package/src/config/profiles/minimal.ini +4 -0
- package/src/scripts/_cli/cmd_conformance.ts +716 -0
- package/src/scripts/_cli/cmd_doctor.ts +23 -2
- package/src/scripts/_cli/cmd_fleet.ts +401 -0
- package/src/scripts/_cli/cmd_preflight.ts +159 -0
- package/src/scripts/_dispatch.bash +10 -0
- package/src/scripts/_lib/knowledge_events.ts +193 -0
- package/src/scripts/_lib/subagent_steering.ts +115 -3
- package/src/scripts/_lib/text_similarity.ts +75 -0
- package/src/scripts/ai-video/test-pipeline.sh +1 -1
- package/src/scripts/ai_council/clients.ts +19 -3
- package/src/scripts/append_contested.ts +112 -0
- package/src/scripts/audit_auto_rules.ts +11 -1
- package/src/scripts/audit_mcp_tools.ts +25 -11
- package/src/scripts/bench_ab_v2_run.ts +527 -40
- package/src/scripts/bench_ab_v2_stats.ts +6 -0
- package/src/scripts/bench_matrix.ts +266 -0
- package/src/scripts/bootstrap_knowledge.ts +267 -0
- package/src/scripts/build_discovery_manifest.ts +42 -2
- package/src/scripts/build_proof.ts +214 -0
- package/src/scripts/check_always_budget.ts +3 -0
- package/src/scripts/check_augment_description_cap.ts +2 -2
- package/src/scripts/check_claims.ts +270 -0
- package/src/scripts/check_comparison.ts +79 -0
- package/src/scripts/check_generated_artefact_headers.ts +109 -0
- package/src/scripts/check_generator_output_coverage.ts +142 -0
- package/src/scripts/check_gitignore_freshness.ts +127 -0
- package/src/scripts/check_knowledge_pages.ts +210 -0
- package/src/scripts/check_knowledge_sharing.ts +162 -0
- package/src/scripts/check_media_deps.ts +91 -0
- package/src/scripts/check_memory_contradiction.ts +280 -0
- package/src/scripts/check_memory_similarity.ts +134 -0
- package/src/scripts/check_quality_regression.ts +56 -10
- package/src/scripts/check_references.ts +3 -1
- package/src/scripts/check_release_pr_shape.ts +4 -0
- package/src/scripts/check_site_links.ts +135 -0
- package/src/scripts/check_skill_gaps.ts +99 -0
- package/src/scripts/check_token_quality_golden.ts +197 -11
- package/src/scripts/check_tracked_but_ignored.ts +67 -0
- package/src/scripts/cluster_near_miss_patterns.ts +0 -0
- package/src/scripts/compile_router.ts +30 -3
- package/src/scripts/condense.ts +350 -14
- package/src/scripts/consolidate_knowledge_events.ts +192 -0
- package/src/scripts/degrade_to_pointer.ts +136 -0
- package/src/scripts/design_slop_rules.test.ts +208 -0
- package/src/scripts/design_slop_rules.ts +530 -0
- package/src/scripts/emit_knowledge_event.ts +158 -0
- package/src/scripts/export_replay_corpus.ts +187 -0
- package/src/scripts/external_sources_denylist.json +14 -3
- package/src/scripts/fold_intake.ts +281 -0
- package/src/scripts/generate_capability_matrix.ts +9 -1
- package/src/scripts/generate_knowledge_index.ts +222 -0
- package/src/scripts/hook_manifest.yaml +40 -17
- package/src/scripts/hooks/design_slop_hook.ts +181 -0
- package/src/scripts/hooks/dispatch_hook.ts +18 -0
- package/src/scripts/hot_context_hook.ts +372 -0
- package/src/scripts/install +47 -0
- package/src/scripts/install-hooks.sh +17 -0
- package/src/scripts/inventory_meta_layers.ts +11 -0
- package/src/scripts/janitor.ts +258 -0
- package/src/scripts/lint_agent_security.ts +1 -0
- package/src/scripts/lint_agents_layout.ts +74 -15
- package/src/scripts/lint_bench_ab.ts +4 -1
- package/src/scripts/lint_confusables.ts +197 -0
- package/src/scripts/lint_design_slop.ts +245 -0
- package/src/scripts/lint_featured_skills.ts +0 -0
- package/src/scripts/lint_framework_leakage_allowlist.json +26 -3
- package/src/scripts/lint_knowledge_scale.ts +250 -0
- package/src/scripts/lint_legal_pack.ts +67 -0
- package/src/scripts/lint_persona_governance.ts +8 -3
- package/src/scripts/lint_regression.ts +15 -0
- package/src/scripts/lint_roadmap_blockers.ts +202 -0
- package/src/scripts/lint_roadmap_complexity.ts +81 -2
- package/src/scripts/lint_subagent_determinism.ts +125 -0
- package/src/scripts/measure_augment_budget.ts +46 -6
- package/src/scripts/measure_patterns.ts +4 -3
- package/src/scripts/measure_skill_reduction.ts +6 -6
- package/src/scripts/migration_status.ts +6 -2
- package/src/scripts/mine_missing_guardrails.ts +189 -0
- package/src/scripts/parity/phase_gate.ts +1 -1
- package/src/scripts/parity/replay.ts +21 -0
- package/src/scripts/project_thin_rules.ts +120 -16
- package/src/scripts/release.ts +39 -1
- package/src/scripts/render_benchmark_composite.ts +378 -0
- package/src/scripts/roadmap_progress_hook.ts +101 -43
- package/src/scripts/schemas/skill.schema.json +27 -0
- package/src/scripts/schemas/subagent.schema.json +106 -0
- package/src/scripts/skill_linter.ts +1 -0
- package/src/scripts/smoke/kernel.sh +5 -4
- package/src/scripts/surface-tiers.yml +1 -0
- package/src/scripts/sync_gitignore.ts +4 -0
- package/src/scripts/update_skill_candidates.ts +172 -0
- package/src/scripts/validate_frontmatter.ts +1 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Generate `agents/knowledge/INDEX.md` — the one-line catalog over every
|
|
4
|
+
* knowledge surface: the flat anti-hallucination cards (ADR-100) plus the
|
|
5
|
+
* lifecycle-typed sibling directories (`sessions/`, `concepts/`,
|
|
6
|
+
* `procedures/`, `decisions/`) added by road-to-knowledge-system.
|
|
7
|
+
*
|
|
8
|
+
* Design per the 2026-07-05 council verdict (Option C — extend
|
|
9
|
+
* `agents/knowledge/` in place): ONE index, index-first + grep retrieval,
|
|
10
|
+
* no search infrastructure. This script is the deterministic backstop —
|
|
11
|
+
* agents read INDEX.md first, grep second, read specific files third.
|
|
12
|
+
*
|
|
13
|
+
* Deterministic and idempotent: same inputs always produce byte-identical
|
|
14
|
+
* output. No network, no LLM calls.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* generate_knowledge_index.ts [--dir <repo-root>] [--check] [--quiet]
|
|
18
|
+
*
|
|
19
|
+
* Exit codes: 0 = written / no drift, 1 = drift found (--check) or usage
|
|
20
|
+
* error, 3 = internal error.
|
|
21
|
+
*/
|
|
22
|
+
import * as fs from 'node:fs';
|
|
23
|
+
import * as path from 'node:path';
|
|
24
|
+
import process from 'node:process';
|
|
25
|
+
import { fileURLToPath } from 'node:url';
|
|
26
|
+
import YAML from 'yaml';
|
|
27
|
+
|
|
28
|
+
const _HERE = fileURLToPath(import.meta.url);
|
|
29
|
+
const PROG = 'generate_knowledge_index.ts';
|
|
30
|
+
|
|
31
|
+
const FRONTMATTER_RE = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n/;
|
|
32
|
+
|
|
33
|
+
// Section order is fixed — cards first (the pre-existing anti-hallucination
|
|
34
|
+
// store), then the lifecycle-typed dirs in capture-order (episodic → semantic
|
|
35
|
+
// → procedural → decisions).
|
|
36
|
+
const SECTIONS: ReadonlyArray<{ heading: string; dir: string | null }> = [
|
|
37
|
+
{ heading: 'Knowledge Cards', dir: null }, // flat *.md directly under agents/knowledge/
|
|
38
|
+
{ heading: 'Sessions', dir: 'sessions' },
|
|
39
|
+
{ heading: 'Concepts', dir: 'concepts' },
|
|
40
|
+
{ heading: 'Procedures', dir: 'procedures' },
|
|
41
|
+
{ heading: 'Decisions', dir: 'decisions' },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
const SKIP_FILES = new Set(['README.md', 'INDEX.md']);
|
|
45
|
+
const MAX_SUMMARY_CHARS = 140;
|
|
46
|
+
|
|
47
|
+
interface Entry {
|
|
48
|
+
file: string; // basename, e.g. "stripe-webhooks.md"
|
|
49
|
+
relPath: string; // path relative to agents/knowledge/, POSIX separators
|
|
50
|
+
summary: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function readFrontmatter(body: string): Record<string, unknown> {
|
|
54
|
+
const m = FRONTMATTER_RE.exec(body);
|
|
55
|
+
if (m?.[1] === undefined) return {};
|
|
56
|
+
try {
|
|
57
|
+
const parsed = YAML.parse(m[1]);
|
|
58
|
+
return parsed && typeof parsed === 'object' ? (parsed as Record<string, unknown>) : {};
|
|
59
|
+
} catch {
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function stripFrontmatter(body: string): string {
|
|
65
|
+
return body.replace(FRONTMATTER_RE, '');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function firstHeadingOrLine(body: string): string {
|
|
69
|
+
for (const line of body.split(/\r?\n/)) {
|
|
70
|
+
const trimmed = line.trim();
|
|
71
|
+
if (!trimmed) continue;
|
|
72
|
+
return trimmed.replace(/^#+\s*/, '');
|
|
73
|
+
}
|
|
74
|
+
return '';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function truncate(s: string, max: number): string {
|
|
78
|
+
if (s.length <= max) return s;
|
|
79
|
+
return s.slice(0, max - 1).trimEnd() + '…';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Derive a one-line summary: frontmatter `description`/`summary` wins; else the first heading/line after frontmatter. */
|
|
83
|
+
function summarize(body: string): string {
|
|
84
|
+
const fm = readFrontmatter(body);
|
|
85
|
+
const fromFrontmatter = (fm.description ?? fm.summary) as unknown;
|
|
86
|
+
if (typeof fromFrontmatter === 'string' && fromFrontmatter.trim()) {
|
|
87
|
+
return truncate(fromFrontmatter.trim(), MAX_SUMMARY_CHARS);
|
|
88
|
+
}
|
|
89
|
+
const rest = stripFrontmatter(body);
|
|
90
|
+
return truncate(firstHeadingOrLine(rest), MAX_SUMMARY_CHARS);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function listMarkdownFiles(dirPath: string): string[] {
|
|
94
|
+
let entries: fs.Dirent[];
|
|
95
|
+
try {
|
|
96
|
+
entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
97
|
+
} catch {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
return entries
|
|
101
|
+
.filter((e) => e.isFile() && e.name.toLowerCase().endsWith('.md') && !SKIP_FILES.has(e.name))
|
|
102
|
+
.map((e) => e.name)
|
|
103
|
+
.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function collectSection(knowledgeRoot: string, dir: string | null): Entry[] {
|
|
107
|
+
const scanDir = dir ? path.join(knowledgeRoot, dir) : knowledgeRoot;
|
|
108
|
+
const files = listMarkdownFiles(scanDir);
|
|
109
|
+
const out: Entry[] = [];
|
|
110
|
+
for (const file of files) {
|
|
111
|
+
const abs = path.join(scanDir, file);
|
|
112
|
+
let body = '';
|
|
113
|
+
try {
|
|
114
|
+
body = fs.readFileSync(abs, 'utf8');
|
|
115
|
+
} catch {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const relPath = dir ? `${dir}/${file}` : file;
|
|
119
|
+
out.push({ file, relPath, summary: summarize(body) });
|
|
120
|
+
}
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function renderIndex(knowledgeRoot: string): string {
|
|
125
|
+
const lines: string[] = [];
|
|
126
|
+
lines.push('# Knowledge Index');
|
|
127
|
+
lines.push('');
|
|
128
|
+
lines.push(
|
|
129
|
+
'_Auto-generated by `src/scripts/generate_knowledge_index.ts` — do not edit by hand. Regenerate with `task generate-knowledge-index`._',
|
|
130
|
+
);
|
|
131
|
+
lines.push('');
|
|
132
|
+
lines.push(
|
|
133
|
+
'_Retrieval protocol: read this index first, `grep` for keywords second, read the specific file third. Never enumerate every knowledge file directly._',
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
for (const section of SECTIONS) {
|
|
137
|
+
const entries = collectSection(knowledgeRoot, section.dir);
|
|
138
|
+
if (entries.length === 0) continue;
|
|
139
|
+
lines.push('');
|
|
140
|
+
// Entry count in the heading — cheap human scannability
|
|
141
|
+
// (road-to-second-brain Phase 4: the council-endorsed browsability
|
|
142
|
+
// alternative to a vault view).
|
|
143
|
+
lines.push(`## ${section.heading} (${entries.length})`);
|
|
144
|
+
lines.push('');
|
|
145
|
+
for (const e of entries) {
|
|
146
|
+
const title = e.file.replace(/\.md$/, '');
|
|
147
|
+
const suffix = e.summary ? ` — ${e.summary}` : '';
|
|
148
|
+
lines.push(`- [${title}](${e.relPath})${suffix}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
lines.push('');
|
|
152
|
+
return lines.join('\n');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function printUsage(): void {
|
|
156
|
+
process.stdout.write(`usage: ${PROG} [--dir DIR] [--check] [--quiet]\n`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function main(argv: string[]): number {
|
|
160
|
+
let dir = process.cwd();
|
|
161
|
+
let check = false;
|
|
162
|
+
let quiet = false;
|
|
163
|
+
|
|
164
|
+
for (let i = 0; i < argv.length; i++) {
|
|
165
|
+
const arg = argv[i];
|
|
166
|
+
if (arg === '-h' || arg === '--help') {
|
|
167
|
+
printUsage();
|
|
168
|
+
return 0;
|
|
169
|
+
} else if (arg === '--dir') {
|
|
170
|
+
const value = argv[++i];
|
|
171
|
+
if (!value) {
|
|
172
|
+
process.stderr.write(`${PROG}: error: --dir requires a value\n`);
|
|
173
|
+
return 1;
|
|
174
|
+
}
|
|
175
|
+
dir = value;
|
|
176
|
+
} else if (arg === '--check') {
|
|
177
|
+
check = true;
|
|
178
|
+
} else if (arg === '--quiet') {
|
|
179
|
+
quiet = true;
|
|
180
|
+
} else {
|
|
181
|
+
process.stderr.write(`${PROG}: error: unrecognized argument: ${arg}\n`);
|
|
182
|
+
printUsage();
|
|
183
|
+
return 1;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const knowledgeRoot = path.join(dir, 'agents', 'knowledge');
|
|
188
|
+
if (!fs.existsSync(knowledgeRoot)) {
|
|
189
|
+
if (!quiet) {
|
|
190
|
+
process.stdout.write(`${PROG}: ${knowledgeRoot} does not exist — nothing to index.\n`);
|
|
191
|
+
}
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const rendered = renderIndex(knowledgeRoot);
|
|
196
|
+
const indexPath = path.join(knowledgeRoot, 'INDEX.md');
|
|
197
|
+
const existing = fs.existsSync(indexPath) ? fs.readFileSync(indexPath, 'utf8') : null;
|
|
198
|
+
|
|
199
|
+
if (check) {
|
|
200
|
+
if (existing === rendered) {
|
|
201
|
+
if (!quiet) process.stdout.write(`${PROG}: agents/knowledge/INDEX.md is up to date.\n`);
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
process.stderr.write(
|
|
205
|
+
`${PROG}: agents/knowledge/INDEX.md is stale — run without --check to regenerate.\n`,
|
|
206
|
+
);
|
|
207
|
+
return 1;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (existing === rendered) {
|
|
211
|
+
if (!quiet) process.stdout.write(`${PROG}: agents/knowledge/INDEX.md already up to date.\n`);
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
fs.writeFileSync(indexPath, rendered, 'utf8');
|
|
216
|
+
if (!quiet) process.stdout.write(`${PROG}: wrote agents/knowledge/INDEX.md\n`);
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1] ?? '')) {
|
|
221
|
+
process.exit(main(process.argv.slice(2)));
|
|
222
|
+
}
|
|
@@ -18,6 +18,18 @@ concerns:
|
|
|
18
18
|
script: src/scripts/chat_history.ts
|
|
19
19
|
args: [hook-dispatch]
|
|
20
20
|
fail_closed: false
|
|
21
|
+
# Hot-context working-memory cache (road-to-second-brain Phase 1).
|
|
22
|
+
# stop: deterministic, redacted 400-word overwrite of
|
|
23
|
+
# agents/runtime/state/hot-context.md from the chat-history JSONL.
|
|
24
|
+
# session_start: staleness-checked restore; the dispatcher forwards the
|
|
25
|
+
# returned `context` block to its own stdout (Claude Code SessionStart
|
|
26
|
+
# injection; on Claude, source=compact re-injects after compaction).
|
|
27
|
+
# Runs AFTER chat-history in both slots so the stop-write sees the final
|
|
28
|
+
# session entries. Never blocks.
|
|
29
|
+
hot-context:
|
|
30
|
+
script: src/scripts/hot_context_hook.ts
|
|
31
|
+
args: []
|
|
32
|
+
fail_closed: false
|
|
21
33
|
roadmap-progress:
|
|
22
34
|
script: src/scripts/roadmap_progress_hook.ts
|
|
23
35
|
args: []
|
|
@@ -76,6 +88,17 @@ concerns:
|
|
|
76
88
|
script: src/scripts/hooks/rtk_wrap_hook.ts
|
|
77
89
|
args: []
|
|
78
90
|
fail_closed: false
|
|
91
|
+
# road-to-anti-slop-detector Phase 3 — OPTIONAL PreToolUse anti-slop nudge.
|
|
92
|
+
# Runs the lint_design_slop registry against about-to-be-written UI content
|
|
93
|
+
# and WARNS (exit 2) on P0/P1 aesthetic tells. Never blocks (flags, not
|
|
94
|
+
# blocks). Default-OFF (hooks.design_slop.enabled). Anti-loop degradation: a
|
|
95
|
+
# file::rule signature surfaced >=3x goes silent so it never traps the agent.
|
|
96
|
+
# The universal source of truth is the lint_design_slop linter/CI; this hook
|
|
97
|
+
# is a host-limited convenience layer. fail_closed: false.
|
|
98
|
+
design-slop:
|
|
99
|
+
script: src/scripts/hooks/design_slop_hook.ts
|
|
100
|
+
args: []
|
|
101
|
+
fail_closed: false
|
|
79
102
|
# Phase 2 of road-to-hooks-actually-fire-in-consumers — session_start
|
|
80
103
|
# gate that surfaces the marketplace-install-but-unscaffolded shape.
|
|
81
104
|
# Writes .augment/.first-run-action-needed.md + one stderr line so
|
|
@@ -105,18 +128,18 @@ concerns:
|
|
|
105
128
|
|
|
106
129
|
platforms:
|
|
107
130
|
augment:
|
|
108
|
-
session_start: [chat-history, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
131
|
+
session_start: [chat-history, hot-context, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
109
132
|
session_end: [chat-history]
|
|
110
|
-
stop: [chat-history, verify-before-complete]
|
|
111
|
-
pre_tool_use: [block-no-verify, rtk-wrap]
|
|
133
|
+
stop: [chat-history, hot-context, verify-before-complete]
|
|
134
|
+
pre_tool_use: [block-no-verify, rtk-wrap, design-slop]
|
|
112
135
|
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff, injection-scan]
|
|
113
136
|
|
|
114
137
|
claude:
|
|
115
|
-
session_start: [chat-history, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
138
|
+
session_start: [chat-history, hot-context, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
116
139
|
session_end: [chat-history]
|
|
117
|
-
stop: [chat-history, verify-before-complete]
|
|
140
|
+
stop: [chat-history, hot-context, verify-before-complete]
|
|
118
141
|
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
119
|
-
pre_tool_use: [block-no-verify, rtk-wrap]
|
|
142
|
+
pre_tool_use: [block-no-verify, rtk-wrap, design-slop]
|
|
120
143
|
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff, injection-scan]
|
|
121
144
|
|
|
122
145
|
# Cowork — the Claude desktop app's local-agent-mode runtime, built
|
|
@@ -134,11 +157,11 @@ platforms:
|
|
|
134
157
|
# Decision matrix + upstream blockers tracked in
|
|
135
158
|
# agents/settings/contexts/chat-history-platform-hooks.md § Cowork.
|
|
136
159
|
cowork:
|
|
137
|
-
session_start: [chat-history, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
160
|
+
session_start: [chat-history, hot-context, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
138
161
|
session_end: [chat-history]
|
|
139
|
-
stop: [chat-history, verify-before-complete]
|
|
162
|
+
stop: [chat-history, hot-context, verify-before-complete]
|
|
140
163
|
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
141
|
-
pre_tool_use: [block-no-verify, rtk-wrap]
|
|
164
|
+
pre_tool_use: [block-no-verify, rtk-wrap, design-slop]
|
|
142
165
|
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff, injection-scan]
|
|
143
166
|
|
|
144
167
|
# Phase 7.5 — Cursor. `.cursor/hooks.json` (project) is read by the
|
|
@@ -149,9 +172,9 @@ platforms:
|
|
|
149
172
|
# IDE-only — CLI-only users fall back to /checkpoint per
|
|
150
173
|
# agents/settings/contexts/chat-history-platform-hooks.md.
|
|
151
174
|
cursor:
|
|
152
|
-
session_start: [chat-history, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
175
|
+
session_start: [chat-history, hot-context, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
153
176
|
session_end: [chat-history]
|
|
154
|
-
stop: [chat-history, verify-before-complete]
|
|
177
|
+
stop: [chat-history, hot-context, verify-before-complete]
|
|
155
178
|
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
156
179
|
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff, injection-scan]
|
|
157
180
|
|
|
@@ -164,9 +187,9 @@ platforms:
|
|
|
164
187
|
# both map to session_start. TaskCancel maps to stop because the
|
|
165
188
|
# session is interrupted with partial state (mirrors Augment Stop).
|
|
166
189
|
cline:
|
|
167
|
-
session_start: [chat-history, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
190
|
+
session_start: [chat-history, hot-context, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
168
191
|
session_end: [chat-history]
|
|
169
|
-
stop: [chat-history, verify-before-complete]
|
|
192
|
+
stop: [chat-history, hot-context, verify-before-complete]
|
|
170
193
|
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
171
194
|
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff, injection-scan]
|
|
172
195
|
|
|
@@ -183,8 +206,8 @@ platforms:
|
|
|
183
206
|
# surface to record verification commands; documented limitation).
|
|
184
207
|
# minimal-safe-diff is omitted entirely on Windsurf for the same reason.
|
|
185
208
|
windsurf:
|
|
186
|
-
session_start: [chat-history, first-run-gate, onboarding-gate, verify-before-complete, profile-staleness, wrapper-freshness]
|
|
187
|
-
stop: [chat-history, verify-before-complete]
|
|
209
|
+
session_start: [chat-history, hot-context, first-run-gate, onboarding-gate, verify-before-complete, profile-staleness, wrapper-freshness]
|
|
210
|
+
stop: [chat-history, hot-context, verify-before-complete]
|
|
188
211
|
user_prompt_submit: [chat-history, verify-before-complete]
|
|
189
212
|
|
|
190
213
|
# Phase 7.8 — Gemini CLI. Hooks live at `.gemini/settings.json`
|
|
@@ -198,9 +221,9 @@ platforms:
|
|
|
198
221
|
# turn-check semantics. AfterAgent fires when the agent loop ends
|
|
199
222
|
# — this is our `stop` slot.
|
|
200
223
|
gemini:
|
|
201
|
-
session_start: [chat-history, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
224
|
+
session_start: [chat-history, hot-context, first-run-gate, onboarding-gate, verify-before-complete, minimal-safe-diff, profile-staleness, wrapper-freshness]
|
|
202
225
|
session_end: [chat-history]
|
|
203
|
-
stop: [chat-history, verify-before-complete]
|
|
226
|
+
stop: [chat-history, hot-context, verify-before-complete]
|
|
204
227
|
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
205
228
|
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff, injection-scan]
|
|
206
229
|
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PreToolUse anti-slop nudge — surfaces high-severity aesthetic tells in
|
|
4
|
+
* proposed UI content BEFORE the write (road-to-anti-slop-detector Phase 3).
|
|
5
|
+
*
|
|
6
|
+
* OPTIONAL, host-limited (pre_tool_use fires on ~2–3 hosts). The universal
|
|
7
|
+
* source of truth is the `lint_design_slop` linter / CI gate; this hook is a
|
|
8
|
+
* convenience layer that runs the same registry against the about-to-be-written
|
|
9
|
+
* content. Default-OFF: no-ops unless `hooks.design_slop.enabled: true` in
|
|
10
|
+
* `.agent-settings.yml`. fail_closed: false (never break a write for a flag).
|
|
11
|
+
*
|
|
12
|
+
* FLAGS, NEVER A BLOCK. On a P0/P1 finding it WARNS (exit 2 + reason); it never
|
|
13
|
+
* returns block (exit 1). Mirrors the injection-scan "warn, don't block" shape.
|
|
14
|
+
*
|
|
15
|
+
* Anti-loop degradation (council-required safety valve): a `file::rule`
|
|
16
|
+
* signature surfaced ≥ DEGRADE_AFTER times is downgraded to silent, so a
|
|
17
|
+
* deliberate-but-undeclared pattern the agent keeps re-writing never traps it.
|
|
18
|
+
* State: <root>/agents/runtime/state/design-slop-hook.json.
|
|
19
|
+
*
|
|
20
|
+
* Exit codes (dispatcher contract): 0 allow · 2 warn (+ JSON reason on stdout).
|
|
21
|
+
*/
|
|
22
|
+
import fs from "node:fs";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
import { pathToFileURL } from "node:url";
|
|
25
|
+
import { type DesignContext } from "../design_slop_rules.js";
|
|
26
|
+
import { loadDesignContext, scanFile } from "../lint_design_slop.js";
|
|
27
|
+
|
|
28
|
+
const SETTINGS_FILE = ".agent-settings.yml";
|
|
29
|
+
const EXIT_ALLOW = 0;
|
|
30
|
+
const EXIT_WARN = 2;
|
|
31
|
+
const DEGRADE_AFTER = 3; // surfaces of the same file::rule signature before going silent
|
|
32
|
+
const UI_EXT = /\.(html|htm|css|scss|sass|less|vue|svelte|astro|jsx|tsx)$/i;
|
|
33
|
+
|
|
34
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | { [k: string]: JsonValue };
|
|
35
|
+
type JsonObject = { [k: string]: JsonValue };
|
|
36
|
+
|
|
37
|
+
function isObject(v: unknown): v is JsonObject {
|
|
38
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Minimal `.agent-settings.yml` reader for hooks.design_slop.enabled (mirrors injection-scan). */
|
|
42
|
+
function enabled(root: string): boolean {
|
|
43
|
+
const f = path.join(root, SETTINGS_FILE);
|
|
44
|
+
let text: string;
|
|
45
|
+
try {
|
|
46
|
+
if (!fs.statSync(f).isFile()) return false;
|
|
47
|
+
text = fs.readFileSync(f, "utf-8");
|
|
48
|
+
} catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
let inHooks = false;
|
|
52
|
+
let inDs = false;
|
|
53
|
+
for (const raw of text.split(/\r\n|\r|\n/)) {
|
|
54
|
+
const line = raw.replace(/\s+$/, "");
|
|
55
|
+
if (!line || line.replace(/^\s+/, "").startsWith("#")) continue;
|
|
56
|
+
if (!(line.startsWith(" ") || line.startsWith("\t"))) {
|
|
57
|
+
inHooks = /^hooks\s*:\s*$/.test(line);
|
|
58
|
+
inDs = false;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (inHooks) {
|
|
62
|
+
if (/^\s+design_slop\s*:\s*$/.test(line)) {
|
|
63
|
+
inDs = true;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (inDs && /^\s{0,3}\S/.test(line)) inDs = false;
|
|
67
|
+
}
|
|
68
|
+
if (inDs && /^\s+enabled\s*:\s*true\b/.test(line)) return true;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Best-effort: pull (toolName, filePath, proposedContent) from the PreToolUse envelope. */
|
|
74
|
+
function extract(envelope: JsonObject): { file: string; content: string } | null {
|
|
75
|
+
const ti = envelope["tool_input"] ?? envelope["toolInput"] ?? envelope["input"];
|
|
76
|
+
if (!isObject(ti)) return null;
|
|
77
|
+
const fileVal = ti["file_path"] ?? ti["path"] ?? ti["filePath"];
|
|
78
|
+
const file = typeof fileVal === "string" ? fileVal : "";
|
|
79
|
+
// Edit → new_string/new_str; Write → content; some hosts → text
|
|
80
|
+
for (const key of ["content", "new_string", "new_str", "text", "newText"]) {
|
|
81
|
+
const v = ti[key];
|
|
82
|
+
if (typeof v === "string" && v.length > 0) return { file, content: v };
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function stateFile(root: string): string {
|
|
88
|
+
return path.join(root, "agents", "runtime", "state", "design-slop-hook.json");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function readState(root: string): Record<string, number> {
|
|
92
|
+
try {
|
|
93
|
+
const t = fs.readFileSync(stateFile(root), "utf-8");
|
|
94
|
+
const parsed = JSON.parse(t);
|
|
95
|
+
return isObject(parsed) ? (parsed as Record<string, number>) : {};
|
|
96
|
+
} catch {
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function writeState(root: string, state: Record<string, number>): void {
|
|
102
|
+
try {
|
|
103
|
+
const sf = stateFile(root);
|
|
104
|
+
fs.mkdirSync(path.dirname(sf), { recursive: true });
|
|
105
|
+
fs.writeFileSync(sf, JSON.stringify(state, null, 2) + "\n");
|
|
106
|
+
} catch {
|
|
107
|
+
/* fail-open: never break a write because state could not persist */
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function readStdin(): string {
|
|
112
|
+
try {
|
|
113
|
+
return fs.readFileSync(0, "utf-8");
|
|
114
|
+
} catch {
|
|
115
|
+
return "";
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function main(): number {
|
|
120
|
+
let envelope: JsonValue;
|
|
121
|
+
try {
|
|
122
|
+
const raw = readStdin();
|
|
123
|
+
envelope = raw.trim() ? (JSON.parse(raw) as JsonValue) : {};
|
|
124
|
+
} catch {
|
|
125
|
+
return EXIT_ALLOW;
|
|
126
|
+
}
|
|
127
|
+
if (!isObject(envelope)) return EXIT_ALLOW;
|
|
128
|
+
|
|
129
|
+
const rootVal = envelope["cwd"] ?? envelope["project_root"] ?? ".";
|
|
130
|
+
const root = typeof rootVal === "string" && rootVal ? rootVal : ".";
|
|
131
|
+
if (!enabled(root)) return EXIT_ALLOW;
|
|
132
|
+
|
|
133
|
+
const ex = extract(envelope);
|
|
134
|
+
if (!ex || !ex.file || !UI_EXT.test(ex.file)) return EXIT_ALLOW;
|
|
135
|
+
|
|
136
|
+
let ctx: DesignContext;
|
|
137
|
+
try {
|
|
138
|
+
ctx = loadDesignContext(path.dirname(path.resolve(root, ex.file)));
|
|
139
|
+
} catch {
|
|
140
|
+
ctx = { raw: "", has: () => false };
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let findings;
|
|
144
|
+
try {
|
|
145
|
+
findings = scanFile(ex.content, ex.file, ctx).filter(
|
|
146
|
+
(f) => f.severity === "P0" || f.severity === "P1",
|
|
147
|
+
);
|
|
148
|
+
} catch {
|
|
149
|
+
return EXIT_ALLOW;
|
|
150
|
+
}
|
|
151
|
+
if (findings.length === 0) return EXIT_ALLOW;
|
|
152
|
+
|
|
153
|
+
// Anti-loop degradation: drop any signature already surfaced DEGRADE_AFTER times.
|
|
154
|
+
const state = readState(root);
|
|
155
|
+
const surfaced = findings.filter((f) => {
|
|
156
|
+
const sig = `${ex.file}::${f.rule}`;
|
|
157
|
+
const seen = state[sig] ?? 0;
|
|
158
|
+
if (seen >= DEGRADE_AFTER) return false; // gone silent — never trap the agent
|
|
159
|
+
state[sig] = seen + 1;
|
|
160
|
+
return true;
|
|
161
|
+
});
|
|
162
|
+
writeState(root, state);
|
|
163
|
+
|
|
164
|
+
if (surfaced.length === 0) return EXIT_ALLOW;
|
|
165
|
+
|
|
166
|
+
const lines = surfaced
|
|
167
|
+
.map((f) => `${f.catalogId} (${f.rule}) ${f.file}:${f.line} — ${f.message}`)
|
|
168
|
+
.join("; ");
|
|
169
|
+
const reason =
|
|
170
|
+
"⚠️ Anti-slop: high-severity aesthetic tell(s) in the proposed UI — " +
|
|
171
|
+
lines +
|
|
172
|
+
". Rebuttable: declare intent in DESIGN.md, add design-slop-disable-next-line, " +
|
|
173
|
+
"or proceed if deliberate (this is a flag, not a block).";
|
|
174
|
+
process.stdout.write(JSON.stringify({ decision: "warn", reason }) + "\n");
|
|
175
|
+
return EXIT_WARN;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const isCliEntry =
|
|
179
|
+
process.argv[1] !== undefined &&
|
|
180
|
+
import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href;
|
|
181
|
+
if (isCliEntry) process.exit(main());
|
|
@@ -786,6 +786,13 @@ export function main(argv?: string[]): number {
|
|
|
786
786
|
const started_at = _now_iso();
|
|
787
787
|
const rcs: number[] = [];
|
|
788
788
|
const feedback_entries: FeedbackEntry[] = [];
|
|
789
|
+
// session_start context forwarding (road-to-second-brain Phase 1): a
|
|
790
|
+
// concern may return {"context": "<string>"} in its stdout JSON; on
|
|
791
|
+
// session_start the dispatcher forwards those blocks to its OWN stdout so
|
|
792
|
+
// the host adds them to the session context (Claude Code SessionStart
|
|
793
|
+
// stdout-injection; harmless surfacing elsewhere). All other events keep
|
|
794
|
+
// the swallow-stdout contract unchanged.
|
|
795
|
+
const context_blocks: string[] = [];
|
|
789
796
|
for (const concern of concerns) {
|
|
790
797
|
const concern_started = _now_iso();
|
|
791
798
|
const { rc: rawRcResult, stderr: stderr_text, stdout: stdout_text, duration_ms } =
|
|
@@ -804,6 +811,14 @@ export function main(argv?: string[]): number {
|
|
|
804
811
|
}
|
|
805
812
|
rcs.push(rc);
|
|
806
813
|
const reply = _parse_concern_stdout(stdout_text);
|
|
814
|
+
if (
|
|
815
|
+
args.event === "session_start" &&
|
|
816
|
+
rc === EXIT_ALLOW &&
|
|
817
|
+
typeof reply["context"] === "string" &&
|
|
818
|
+
(reply["context"] as string).trim()
|
|
819
|
+
) {
|
|
820
|
+
context_blocks.push((reply["context"] as string).trim());
|
|
821
|
+
}
|
|
807
822
|
feedback_entries.push({
|
|
808
823
|
concern: String(concern["name"]),
|
|
809
824
|
exit_code: rc,
|
|
@@ -819,6 +834,9 @@ export function main(argv?: string[]): number {
|
|
|
819
834
|
}
|
|
820
835
|
const final_rc = _reduce(rcs);
|
|
821
836
|
_write_feedback(envelope, session_id, feedback_entries, final_rc, started_at);
|
|
837
|
+
if (context_blocks.length > 0 && final_rc === EXIT_ALLOW) {
|
|
838
|
+
process.stdout.write(context_blocks.join("\n\n") + "\n");
|
|
839
|
+
}
|
|
822
840
|
return final_rc;
|
|
823
841
|
}
|
|
824
842
|
|