@bonesofspring/ai-rules 0.2.87 → 0.2.91
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/CHANGELOG.md +83 -0
- package/README.md +9 -1
- package/bin/lib/engine-scripts.js +7 -0
- package/bin/lib/seed-ai-local-team.js +40 -0
- package/bin/opencode-install.js +11 -10
- package/docs/OPENCODE-COMPATIBILITY.md +2 -1
- package/docs/OPENCODE.md +27 -5
- package/docs/openapi/team-db.v1.json +2 -2
- package/package.json +1 -1
- package/presets/_shared/ai-local/env.example +54 -0
- package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +34 -5
- package/presets/_shared/ai-local/scripts/check-task-repositories.mjs +25 -22
- package/presets/_shared/ai-local/scripts/process-lease.mjs +3 -2
- package/presets/_shared/ai-local/scripts/processes.mjs +52 -20
- package/presets/_shared/ai-local/scripts/run.mjs +38 -6
- package/presets/_shared/ai-local/scripts/settings.mjs +246 -0
- package/presets/_shared/ai-local/scripts/task-worktree.mjs +364 -0
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +2 -2
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +87 -14
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +102 -12
- package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +35 -0
- package/presets/_shared/ai-local/scripts/tracker-planned-drain.mjs +10 -1
- package/presets/_shared/ai-local/scripts/verification.mjs +106 -11
- package/presets/_shared/core/agent-team/agent-task-metrics.md +10 -2
- package/presets/_shared/core/agent-team/agent-team-intake.md +2 -0
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +2 -2
- package/presets/_shared/core/meta/preset-writing-style.md +8 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +541 -61
- package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +733 -9
- package/presets/_shared/hooks/prompt-autoroute.mjs.tmpl +153 -0
- package/presets/claude/android-kotlin/CLAUDE.md +2 -4
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/android-kotlin/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/android-kotlin/settings.json +15 -5
- package/presets/claude/go/CLAUDE.md +2 -4
- package/presets/claude/go/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/go/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/go/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/go/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/go/settings.json +15 -5
- package/presets/claude/ios-swift/CLAUDE.md +2 -4
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/ios-swift/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/ios-swift/settings.json +15 -5
- package/presets/claude/java/CLAUDE.md +2 -4
- package/presets/claude/java/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/java/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/java/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/java/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/java/settings.json +15 -5
- package/presets/claude/mcp-ts/CLAUDE.md +2 -4
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/mcp-ts/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/mcp-ts/settings.json +15 -5
- package/presets/claude/mol/CLAUDE.md +2 -4
- package/presets/claude/mol/agents/feature-developer.md +1 -1
- package/presets/claude/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/claude/mol/commands/task-evil.md +8 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/mol/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/mol/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/mol/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/mol/settings.json +15 -4
- package/presets/claude/next/CLAUDE.md +2 -4
- package/presets/claude/next/REPO_AGENTS.md +2 -0
- package/presets/claude/next/agents/feature-developer.md +1 -1
- package/presets/claude/next/agents/task-analyst.md +1 -7
- package/presets/claude/next/agents/task-router.md +1 -1
- package/presets/claude/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/claude/next/commands/spec-start.md +3 -4
- package/presets/claude/next/commands/task-continue.md +9 -8
- package/presets/claude/next/commands/task-evil.md +8 -0
- package/presets/claude/next/commands/task.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/next/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/next/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/next/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/next/settings.json +15 -4
- package/presets/claude/next/team/README.md +1 -1
- package/presets/claude/nuxt/CLAUDE.md +2 -4
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/nuxt/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/nuxt/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/nuxt/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/nuxt/settings.json +15 -4
- package/presets/claude/php-hexagonal/CLAUDE.md +2 -4
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/php-hexagonal/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/php-hexagonal/settings.json +15 -5
- package/presets/claude/php-laravel/CLAUDE.md +2 -4
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/php-laravel/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/php-laravel/settings.json +15 -5
- package/presets/claude/svelte/CLAUDE.md +2 -4
- package/presets/claude/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +733 -9
- package/presets/claude/svelte/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
- package/presets/claude/svelte/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/svelte/settings.json +15 -4
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/android-kotlin/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/go/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/go/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/java/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/java/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/java/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mcp-ts/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/mol/agents/feature-developer.md +1 -1
- package/presets/cursor/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/cursor/mol/commands/task-evil.md +8 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/mol/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/mol/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mol/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/next/REPO_AGENTS.md +2 -0
- package/presets/cursor/next/agents/feature-developer.md +1 -1
- package/presets/cursor/next/agents/task-analyst.md +1 -7
- package/presets/cursor/next/agents/task-router.md +1 -1
- package/presets/cursor/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/cursor/next/commands/spec-start.md +3 -4
- package/presets/cursor/next/commands/task-continue.md +9 -8
- package/presets/cursor/next/commands/task-evil.md +8 -0
- package/presets/cursor/next/commands/task.md +1 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/next/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/next/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/next/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/next/team/README.md +1 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/nuxt/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/nuxt/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-hexagonal/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-laravel/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +733 -9
- package/presets/cursor/svelte/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/rules/preset-writing-style.mdc +8 -0
- package/presets/mavis/android-kotlin/MAVIS.md +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/android-kotlin/rules/agent-team-intake.md +2 -0
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/android-kotlin/rules/preset-writing-style.md +8 -0
- package/presets/mavis/go/MAVIS.md +1 -1
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/go/rules/agent-team-intake.md +2 -0
- package/presets/mavis/go/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/go/rules/preset-writing-style.md +8 -0
- package/presets/mavis/ios-swift/MAVIS.md +1 -1
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/ios-swift/rules/agent-team-intake.md +2 -0
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/ios-swift/rules/preset-writing-style.md +8 -0
- package/presets/mavis/java/MAVIS.md +1 -1
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/java/rules/agent-team-intake.md +2 -0
- package/presets/mavis/java/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/java/rules/preset-writing-style.md +8 -0
- package/presets/mavis/mcp-ts/MAVIS.md +1 -1
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/mcp-ts/rules/agent-team-intake.md +2 -0
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/mcp-ts/rules/preset-writing-style.md +8 -0
- package/presets/mavis/mol/MAVIS.md +1 -1
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/agents/feature-developer.md +1 -1
- package/presets/mavis/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/mavis/mol/commands/task-evil.md +8 -0
- package/presets/mavis/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/mol/native-skills/task-evil/SKILL.md +8 -0
- package/presets/mavis/mol/rules/agent-team-intake.md +2 -0
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/mol/rules/preset-writing-style.md +8 -0
- package/presets/mavis/next/MAVIS.md +1 -1
- package/presets/mavis/next/REPO_AGENTS.md +2 -0
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/feature-developer.md +1 -1
- package/presets/mavis/next/agents/task-analyst.md +1 -7
- package/presets/mavis/next/agents/task-router.md +1 -1
- package/presets/mavis/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/mavis/next/commands/spec-start.md +3 -4
- package/presets/mavis/next/commands/task-continue.md +9 -8
- package/presets/mavis/next/commands/task-evil.md +8 -0
- package/presets/mavis/next/commands/task.md +1 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/next/native-skills/spec-start/SKILL.md +3 -4
- package/presets/mavis/next/native-skills/task/SKILL.md +1 -1
- package/presets/mavis/next/native-skills/task-continue/SKILL.md +9 -8
- package/presets/mavis/next/native-skills/task-evil/SKILL.md +8 -0
- package/presets/mavis/next/rules/agent-team-intake.md +2 -0
- package/presets/mavis/next/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/next/rules/preset-writing-style.md +8 -0
- package/presets/mavis/next/team/README.md +1 -1
- package/presets/mavis/nuxt/MAVIS.md +1 -1
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/nuxt/rules/agent-team-intake.md +2 -0
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/nuxt/rules/preset-writing-style.md +8 -0
- package/presets/mavis/php-hexagonal/MAVIS.md +1 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +2 -0
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/php-hexagonal/rules/preset-writing-style.md +8 -0
- package/presets/mavis/php-laravel/MAVIS.md +1 -1
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/php-laravel/rules/agent-team-intake.md +2 -0
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/php-laravel/rules/preset-writing-style.md +8 -0
- package/presets/mavis/svelte/MAVIS.md +1 -1
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/svelte/rules/agent-team-intake.md +2 -0
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/svelte/rules/preset-writing-style.md +8 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/hooks/README.md +6 -5
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/android-kotlin/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/android-kotlin/opencode.json +4 -4
- package/presets/opencode/android-kotlin/rules/agent-team-intake.md +2 -0
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/android-kotlin/rules/preset-writing-style.md +8 -0
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/hooks/README.md +6 -5
- package/presets/opencode/go/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/go/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/go/opencode.json +4 -4
- package/presets/opencode/go/rules/agent-team-intake.md +2 -0
- package/presets/opencode/go/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/go/rules/preset-writing-style.md +8 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/hooks/README.md +6 -5
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/ios-swift/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/ios-swift/opencode.json +4 -4
- package/presets/opencode/ios-swift/rules/agent-team-intake.md +2 -0
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/ios-swift/rules/preset-writing-style.md +8 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/hooks/README.md +6 -5
- package/presets/opencode/java/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/java/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/java/opencode.json +4 -4
- package/presets/opencode/java/rules/agent-team-intake.md +2 -0
- package/presets/opencode/java/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/java/rules/preset-writing-style.md +8 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/hooks/README.md +6 -5
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/mcp-ts/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/mcp-ts/opencode.json +4 -4
- package/presets/opencode/mcp-ts/rules/agent-team-intake.md +2 -0
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/mcp-ts/rules/preset-writing-style.md +8 -0
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/agents/feature-developer.md +1 -1
- package/presets/opencode/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/opencode/mol/commands/task-evil.md +8 -0
- package/presets/opencode/mol/hooks/README.md +6 -5
- package/presets/opencode/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/mol/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/mol/opencode.json +4 -4
- package/presets/opencode/mol/rules/agent-team-intake.md +2 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/mol/rules/preset-writing-style.md +8 -0
- package/presets/opencode/next/REPO_AGENTS.md +2 -0
- package/presets/opencode/next/adapter-map.json +1 -1
- package/presets/opencode/next/agents/feature-developer.md +1 -1
- package/presets/opencode/next/agents/task-analyst.md +1 -7
- package/presets/opencode/next/agents/task-router.md +1 -1
- package/presets/opencode/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/opencode/next/commands/spec-start.md +3 -4
- package/presets/opencode/next/commands/task-continue.md +9 -8
- package/presets/opencode/next/commands/task-evil.md +8 -0
- package/presets/opencode/next/commands/task.md +1 -1
- package/presets/opencode/next/hooks/README.md +6 -5
- package/presets/opencode/next/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/next/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/next/opencode.json +4 -4
- package/presets/opencode/next/rules/agent-team-intake.md +2 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/next/rules/preset-writing-style.md +8 -0
- package/presets/opencode/next/team/README.md +1 -1
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/hooks/README.md +6 -5
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/nuxt/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/nuxt/opencode.json +4 -4
- package/presets/opencode/nuxt/rules/agent-team-intake.md +2 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/nuxt/rules/preset-writing-style.md +8 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/hooks/README.md +6 -5
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/php-hexagonal/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/php-hexagonal/opencode.json +4 -4
- package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +2 -0
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/php-hexagonal/rules/preset-writing-style.md +8 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/hooks/README.md +6 -5
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/php-laravel/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/php-laravel/opencode.json +4 -4
- package/presets/opencode/php-laravel/rules/agent-team-intake.md +2 -0
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/php-laravel/rules/preset-writing-style.md +8 -0
- package/presets/opencode/plugins/output-guard/README.md +4 -3
- package/presets/opencode/plugins/output-guard/index.ts +4 -3
- package/presets/opencode/plugins/output-guard/rewrite.ts +1 -2
- package/presets/opencode/plugins/rule-attach/README.md +1 -1
- package/presets/opencode/plugins/rule-attach/index.ts +23 -4
- package/presets/opencode/plugins/settings-guard/README.md +28 -0
- package/presets/opencode/plugins/settings-guard/index.ts +114 -0
- package/presets/opencode/plugins/settings-guard/package.json +9 -0
- package/presets/opencode/plugins/settings-guard/policy.mjs +85 -0
- package/presets/opencode/plugins/settings-guard/prompt-face.mjs +153 -0
- package/presets/opencode/plugins/task-status/README.md +13 -8
- package/presets/opencode/plugins/task-status/deepseek.ts +23 -8
- package/presets/opencode/plugins/task-status/eta.ts +20 -7
- package/presets/opencode/plugins/task-status/index.ts +14 -1
- package/presets/opencode/plugins/task-status/task-view.ts +168 -9
- package/presets/opencode/plugins/task-status/timing.ts +244 -0
- package/presets/opencode/plugins/task-status/tui.tsx +12 -3
- package/presets/opencode/plugins/task-status/types.ts +6 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/hooks/README.md +6 -5
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/svelte/hooks/guard-shell-command.mjs +733 -9
- package/presets/opencode/svelte/opencode.json +4 -4
- package/presets/opencode/svelte/rules/agent-team-intake.md +2 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +2 -2
- package/presets/opencode/svelte/rules/preset-writing-style.md +8 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/android-kotlin/rules/agent-team-intake.md +2 -0
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/android-kotlin/rules/preset-writing-style.md +8 -0
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/go/rules/agent-team-intake.md +2 -0
- package/presets/zcode/go/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/go/rules/preset-writing-style.md +8 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/ios-swift/rules/agent-team-intake.md +2 -0
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/ios-swift/rules/preset-writing-style.md +8 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/java/rules/agent-team-intake.md +2 -0
- package/presets/zcode/java/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/java/rules/preset-writing-style.md +8 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/mcp-ts/rules/agent-team-intake.md +2 -0
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/mcp-ts/rules/preset-writing-style.md +8 -0
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/agents/feature-developer.md +1 -1
- package/presets/zcode/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/zcode/mol/commands/task-evil.md +8 -0
- package/presets/zcode/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/mol/rules/agent-team-intake.md +2 -0
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/mol/rules/preset-writing-style.md +8 -0
- package/presets/zcode/next/REPO_AGENTS.md +2 -0
- package/presets/zcode/next/adapter-map.json +1 -1
- package/presets/zcode/next/agents/feature-developer.md +1 -1
- package/presets/zcode/next/agents/task-analyst.md +1 -7
- package/presets/zcode/next/agents/task-router.md +1 -1
- package/presets/zcode/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/zcode/next/commands/spec-start.md +3 -4
- package/presets/zcode/next/commands/task-continue.md +9 -8
- package/presets/zcode/next/commands/task-evil.md +8 -0
- package/presets/zcode/next/commands/task.md +1 -1
- package/presets/zcode/next/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/next/rules/agent-team-intake.md +2 -0
- package/presets/zcode/next/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/next/rules/preset-writing-style.md +8 -0
- package/presets/zcode/next/team/README.md +1 -1
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/nuxt/rules/agent-team-intake.md +2 -0
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/nuxt/rules/preset-writing-style.md +8 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +2 -0
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/php-hexagonal/rules/preset-writing-style.md +8 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/php-laravel/rules/agent-team-intake.md +2 -0
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/php-laravel/rules/preset-writing-style.md +8 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/svelte/rules/agent-team-intake.md +2 -0
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +2 -2
- package/presets/zcode/svelte/rules/preset-writing-style.md +8 -0
|
@@ -32,7 +32,22 @@ export const SEARCH_MODE_FTS5 = 'fts5';
|
|
|
32
32
|
export const SEARCH_MODE_LIKE = 'like';
|
|
33
33
|
export const INDEX_UNAVAILABLE_LINE = `team-db: node:sqlite unavailable (requires Node >= ${MIN_NODE}); file-only mode`;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Team store path. `AI_RULES_TEAM_ROOT` wins, then the legacy
|
|
37
|
+
* `AI_RULES_TEAM_DB_ROOT`, then `<cwd>/.ai.local/team`. An empty string is unset.
|
|
38
|
+
* A worktree hook sets the first name so cwd does not open a second store.
|
|
39
|
+
*/
|
|
40
|
+
export const resolveTeamRoot = (env = process.env, cwd = process.cwd()) => {
|
|
41
|
+
const named =
|
|
42
|
+
env && typeof env.AI_RULES_TEAM_ROOT === 'string' && env.AI_RULES_TEAM_ROOT !== ''
|
|
43
|
+
? env.AI_RULES_TEAM_ROOT
|
|
44
|
+
: env && typeof env.AI_RULES_TEAM_DB_ROOT === 'string' && env.AI_RULES_TEAM_DB_ROOT !== ''
|
|
45
|
+
? env.AI_RULES_TEAM_DB_ROOT
|
|
46
|
+
: '';
|
|
47
|
+
return path.resolve(named || path.join(cwd, '.ai.local', 'team'));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const DEFAULT_TEAM_ROOT = resolveTeamRoot();
|
|
36
51
|
|
|
37
52
|
/**
|
|
38
53
|
* The released FTS layouts, oldest-first. The current shape is last.
|
|
@@ -1134,14 +1149,40 @@ export const pragmaValue = (db, pragma) => {
|
|
|
1134
1149
|
return values.length > 0 ? values[0] : null;
|
|
1135
1150
|
};
|
|
1136
1151
|
|
|
1152
|
+
export const DEFAULT_BUSY_TIMEOUT_MS = 5000;
|
|
1153
|
+
|
|
1154
|
+
let busyTimeoutWarned = false;
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* `AI_RULES_TEAM_DB_BUSY_MS` is a non-negative integer millisecond busy
|
|
1158
|
+
* timeout. Absent uses the default with no warning. Anything else warns once
|
|
1159
|
+
* per process and uses the default.
|
|
1160
|
+
*/
|
|
1161
|
+
export function readBusyTimeoutMs(env = process.env) {
|
|
1162
|
+
const raw = env?.AI_RULES_TEAM_DB_BUSY_MS;
|
|
1163
|
+
if (raw === undefined) return DEFAULT_BUSY_TIMEOUT_MS;
|
|
1164
|
+
const text = String(raw).trim();
|
|
1165
|
+
if (text === '' || !/^\d+$/.test(text) || !Number.isSafeInteger(Number(text))) {
|
|
1166
|
+
if (!busyTimeoutWarned) {
|
|
1167
|
+
busyTimeoutWarned = true;
|
|
1168
|
+
process.stderr.write(
|
|
1169
|
+
`warn: AI_RULES_TEAM_DB_BUSY_MS="${text}" is not a non-negative integer; using ${DEFAULT_BUSY_TIMEOUT_MS}\n`,
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
return DEFAULT_BUSY_TIMEOUT_MS;
|
|
1173
|
+
}
|
|
1174
|
+
return Number(text);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1137
1177
|
export function configureConnection(db, options = {}) {
|
|
1138
1178
|
// The busy timeout must be set before the first lock-taking pragma: two first
|
|
1139
1179
|
// projections both create the file, and a default 0 ms timeout turns the
|
|
1140
1180
|
// WAL switch on the loser into an immediate SQLITE_BUSY.
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
//
|
|
1144
|
-
//
|
|
1181
|
+
const busyTimeoutMs = options.busyTimeoutMs ?? readBusyTimeoutMs(options.env);
|
|
1182
|
+
db.exec(`PRAGMA busy_timeout=${busyTimeoutMs}`);
|
|
1183
|
+
// A fresh file switches here. An existing file is switched by `ensureWal`
|
|
1184
|
+
// after migrations, so a no-op re-issue does not take the exclusive lock
|
|
1185
|
+
// on every open.
|
|
1145
1186
|
if (options.setWal) db.exec('PRAGMA journal_mode=WAL');
|
|
1146
1187
|
db.exec('PRAGMA foreign_keys=ON');
|
|
1147
1188
|
db.exec('PRAGMA synchronous=NORMAL');
|
|
@@ -1411,13 +1452,61 @@ const sleepSync = (ms) => {
|
|
|
1411
1452
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
1412
1453
|
};
|
|
1413
1454
|
|
|
1455
|
+
const appendTeamDbError = (env, dbPath, code, message) => {
|
|
1456
|
+
try {
|
|
1457
|
+
const override = typeof env?.AI_RULES_TEAM_DB_LOG === 'string' ? env.AI_RULES_TEAM_DB_LOG.trim() : '';
|
|
1458
|
+
const target = override
|
|
1459
|
+
? path.resolve(override)
|
|
1460
|
+
: path.join(path.dirname(dbPath || DEFAULT_TEAM_ROOT), 'team-db-errors.log');
|
|
1461
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
1462
|
+
fs.appendFileSync(target, `${new Date().toISOString()} ${code} cli ${message}\n`);
|
|
1463
|
+
let lines = fs.readFileSync(target, 'utf8').split('\n').filter((entry) => entry.length > 0);
|
|
1464
|
+
if (lines.length > 200) lines = lines.slice(lines.length - 200);
|
|
1465
|
+
while (Buffer.byteLength(`${lines.join('\n')}\n`, 'utf8') > 65536 && lines.length > 1) lines.shift();
|
|
1466
|
+
fs.writeFileSync(target, lines.length > 0 ? `${lines.join('\n')}\n` : '');
|
|
1467
|
+
} catch {
|
|
1468
|
+
/* a log failure must not fail the open */
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* Switch an existing database to WAL after migrations, outside any transaction
|
|
1474
|
+
* (`PRAGMA journal_mode` is a no-op inside one). Already-WAL is a no-op.
|
|
1475
|
+
* `SQLITE_BUSY` retries once, then one `E_WAL_DEFERRED` line and the open
|
|
1476
|
+
* continues; the next open retries. The pragma does not rewrite tables.
|
|
1477
|
+
*/
|
|
1478
|
+
export function ensureWal(db, { dbPath, env = process.env } = {}) {
|
|
1479
|
+
const mode = () => String(pragmaValue(db, 'journal_mode') ?? '').toLowerCase();
|
|
1480
|
+
if (mode() === 'wal') return { switched: false, deferred: false };
|
|
1481
|
+
let lastError = null;
|
|
1482
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
1483
|
+
try {
|
|
1484
|
+
db.exec('PRAGMA journal_mode=WAL');
|
|
1485
|
+
if (mode() === 'wal') return { switched: true, deferred: false };
|
|
1486
|
+
lastError = null;
|
|
1487
|
+
break;
|
|
1488
|
+
} catch (error) {
|
|
1489
|
+
lastError = error;
|
|
1490
|
+
if (!isBusyError(error) || attempt === 1) break;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
if (lastError && !isBusyError(lastError)) throw lastError;
|
|
1494
|
+
appendTeamDbError(
|
|
1495
|
+
env,
|
|
1496
|
+
dbPath,
|
|
1497
|
+
'E_WAL_DEFERRED',
|
|
1498
|
+
`journal_mode stayed ${mode() || 'unknown'}; next open retries`,
|
|
1499
|
+
);
|
|
1500
|
+
return { switched: false, deferred: true };
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1414
1503
|
/**
|
|
1415
1504
|
* Open + configure with a bounded retry for the first-creation race. Two
|
|
1416
1505
|
* processes can both create the file; the loser's WAL switch or migration can
|
|
1417
1506
|
* return SQLITE_BUSY before the in-connection busy handler applies. Retry for
|
|
1418
|
-
* five seconds, matching `busy_timeout`, then surface `E_DB_BUSY`.
|
|
1507
|
+
* five seconds, matching the default `busy_timeout`, then surface `E_DB_BUSY`.
|
|
1419
1508
|
*/
|
|
1420
|
-
const openConfiguredDatabase = (sqlite, dbPath, readOnly, setWal = false) => {
|
|
1509
|
+
const openConfiguredDatabase = (sqlite, dbPath, readOnly, setWal = false, env = process.env) => {
|
|
1421
1510
|
let lastError = null;
|
|
1422
1511
|
const deadline = Date.now() + 5000;
|
|
1423
1512
|
let attempt = 0;
|
|
@@ -1426,7 +1515,7 @@ const openConfiguredDatabase = (sqlite, dbPath, readOnly, setWal = false) => {
|
|
|
1426
1515
|
let db;
|
|
1427
1516
|
try {
|
|
1428
1517
|
db = new sqlite.DatabaseSync(dbPath, readOnly ? { readOnly: true } : {});
|
|
1429
|
-
configureConnection(db, { setWal: setWal && !readOnly });
|
|
1518
|
+
configureConnection(db, { setWal: setWal && !readOnly, env });
|
|
1430
1519
|
return db;
|
|
1431
1520
|
} catch (error) {
|
|
1432
1521
|
lastError = error;
|
|
@@ -1512,9 +1601,7 @@ export function openTeamDb(options = {}) {
|
|
|
1512
1601
|
const sqlite = loadSqlite(options.env ?? process.env);
|
|
1513
1602
|
if (!sqlite) teamDbFail('E_SQLITE_UNAVAILABLE', `node:sqlite is unavailable; requires Node >= ${MIN_NODE}`, 0);
|
|
1514
1603
|
|
|
1515
|
-
const teamRoot = path.resolve(
|
|
1516
|
-
options.teamRoot || process.env.AI_RULES_TEAM_DB_ROOT || DEFAULT_TEAM_ROOT,
|
|
1517
|
-
);
|
|
1604
|
+
const teamRoot = path.resolve(options.teamRoot || resolveTeamRoot(options.env ?? process.env));
|
|
1518
1605
|
const dbPath = path.resolve(
|
|
1519
1606
|
options.dbPath ||
|
|
1520
1607
|
process.env.AI_RULES_TEAM_DB_PATH ||
|
|
@@ -1549,7 +1636,7 @@ export function openTeamDb(options = {}) {
|
|
|
1549
1636
|
if (!readOnly) ensureDatabaseFile(dbPath);
|
|
1550
1637
|
let db;
|
|
1551
1638
|
try {
|
|
1552
|
-
db = openConfiguredDatabase(sqlite, dbPath, readOnly, freshFile);
|
|
1639
|
+
db = openConfiguredDatabase(sqlite, dbPath, readOnly, freshFile, options.env ?? process.env);
|
|
1553
1640
|
} catch (error) {
|
|
1554
1641
|
if (isCorruptError(error) || error?.code === 'EISDIR') {
|
|
1555
1642
|
// Corruption is never repaired implicitly; `--rebuild` moves the file
|
|
@@ -1589,6 +1676,7 @@ export function openTeamDb(options = {}) {
|
|
|
1589
1676
|
) {
|
|
1590
1677
|
ensureSearchIndex(db, { searchMode: forceSearch });
|
|
1591
1678
|
}
|
|
1679
|
+
ensureWal(db, { dbPath, env: options.env ?? process.env });
|
|
1592
1680
|
} else if (current < SCHEMA_VERSION) {
|
|
1593
1681
|
teamDbFail('E_SCHEMA_OUTDATED', `database schema v${current} is older than code v${SCHEMA_VERSION}`, 2);
|
|
1594
1682
|
}
|
|
@@ -1647,6 +1735,7 @@ export function openTeamDb(options = {}) {
|
|
|
1647
1735
|
fingerprint,
|
|
1648
1736
|
searchMode,
|
|
1649
1737
|
searchShape: detectFtsShapeDrift(db),
|
|
1738
|
+
journalMode: pragmaValue(db, 'journal_mode'),
|
|
1650
1739
|
};
|
|
1651
1740
|
} catch (error) {
|
|
1652
1741
|
try {
|
|
@@ -1689,6 +1778,7 @@ export function describeHandle(handle) {
|
|
|
1689
1778
|
`fingerprint ${handle.fingerprint.slice(0, 12)}`,
|
|
1690
1779
|
`search ${handle.searchMode}`,
|
|
1691
1780
|
'integrity ok',
|
|
1781
|
+
`journal ${String(handle.journalMode ?? 'unknown').toLowerCase()}`,
|
|
1692
1782
|
];
|
|
1693
1783
|
// A drifted search layout is reported, never repaired: the state names what
|
|
1694
1784
|
// is installed, and the rebuild path stays the remedy.
|
|
@@ -1587,7 +1587,42 @@ export function recoverTrackerEntries(teamRoot, options = {}) {
|
|
|
1587
1587
|
return withTrackerLock(teamRoot, () => ({ recovered: releaseStaleClaims(teamRoot, options.actor ?? 'operator') }));
|
|
1588
1588
|
}
|
|
1589
1589
|
|
|
1590
|
+
const queueDirIsEmpty = (teamRoot) => {
|
|
1591
|
+
const dir = trackerPaths(teamRoot).queue;
|
|
1592
|
+
try {
|
|
1593
|
+
return fs.readdirSync(dir).length === 0;
|
|
1594
|
+
} catch (error) {
|
|
1595
|
+
if (error && error.code === 'ENOENT') return true;
|
|
1596
|
+
throw error;
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
/** Capacity of an empty queue, read-only. No entries means no claimed count and no stale release. */
|
|
1601
|
+
const emptyQueueDrain = (teamRoot) => {
|
|
1602
|
+
const taskStates = readTaskStates(teamRoot);
|
|
1603
|
+
const config = readTrackerConfig(teamRoot);
|
|
1604
|
+
const activeCount = countActiveTasks(taskStates);
|
|
1605
|
+
return {
|
|
1606
|
+
ok: true,
|
|
1607
|
+
claim: null,
|
|
1608
|
+
reason: 'queue empty (pre-check)',
|
|
1609
|
+
claimable: activeCount < config.maxActive,
|
|
1610
|
+
maxActive: config.maxActive,
|
|
1611
|
+
activeCount,
|
|
1612
|
+
ready: [],
|
|
1613
|
+
drainOrder: [],
|
|
1614
|
+
};
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Drain the launch queue.
|
|
1619
|
+
*
|
|
1620
|
+
* An empty queue returns before the tracker lock. An entry written between
|
|
1621
|
+
* this readdir and the lock waits for the next stop-seam drain — a drain
|
|
1622
|
+
* fires on every completed stop, so skip-on-loss is unchanged.
|
|
1623
|
+
*/
|
|
1590
1624
|
export function drainTracker(teamRoot, { claim = false, actor = 'operator' } = {}) {
|
|
1625
|
+
if (queueDirIsEmpty(teamRoot)) return emptyQueueDrain(teamRoot);
|
|
1591
1626
|
return withTrackerLock(teamRoot, () => {
|
|
1592
1627
|
releaseStaleClaims(teamRoot, actor);
|
|
1593
1628
|
const snapshot = {
|
|
@@ -250,7 +250,16 @@ export async function runPlannedDrain(teamRoot, options = {}) {
|
|
|
250
250
|
if (isKillSwitchSet(options.env ?? process.env)) return idle('disabled');
|
|
251
251
|
reconcilePlannedItems(teamRoot);
|
|
252
252
|
const preview = drainTracker(teamRoot, { claim: false, actor: ACTOR });
|
|
253
|
-
if (
|
|
253
|
+
if (preview.reason === 'queue empty (pre-check)') {
|
|
254
|
+
// The pre-check did not take the lock. A full slot still refuses before
|
|
255
|
+
// enqueue; an open slot falls through to the planned head.
|
|
256
|
+
if (!preview.claimable) {
|
|
257
|
+
const reason = preview.activeCount >= preview.maxActive
|
|
258
|
+
? 'capacity: active tasks'
|
|
259
|
+
: 'capacity: claimed or active entries';
|
|
260
|
+
return idle(reason);
|
|
261
|
+
}
|
|
262
|
+
} else if (!preview.claimable) {
|
|
254
263
|
// `claim: true` while the slot is full writes nothing; the reason is the
|
|
255
264
|
// capacity string the tracker already returns.
|
|
256
265
|
const refused = drainTracker(teamRoot, { claim: true, actor: ACTOR });
|
|
@@ -133,15 +133,75 @@ const git = (root, args) => {
|
|
|
133
133
|
return String(result.stdout ?? '');
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
+
const TERMINAL_STATES = new Set(['completed', 'blocked', 'changes_requested', 'validation_failed']);
|
|
137
|
+
|
|
138
|
+
/** Live slugs over the task store — the same canonical predicate the hook uses. */
|
|
139
|
+
const liveTaskSlugs = (teamRoot) => {
|
|
140
|
+
let entries;
|
|
141
|
+
try {
|
|
142
|
+
entries = fs.readdirSync(path.join(teamRoot, 'tasks'), { withFileTypes: true });
|
|
143
|
+
} catch {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
const live = [];
|
|
147
|
+
for (const entry of entries) {
|
|
148
|
+
if (!entry.isDirectory()) continue;
|
|
149
|
+
const status = readJson(path.join(teamRoot, 'tasks', entry.name, 'status.json'), null);
|
|
150
|
+
if (status && typeof status.state === 'string' && !TERMINAL_STATES.has(status.state)) live.push(entry.name);
|
|
151
|
+
}
|
|
152
|
+
return live.sort();
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Union of `Object.keys(baseline.paths)` across the slug's step baselines
|
|
157
|
+
* (tolerant reader: invalid files skipped). `null` when the slug has no
|
|
158
|
+
* readable baseline or the union is empty — the caller falls back per the
|
|
159
|
+
* basis rules, matching `check-preset-delta.mjs` `readTaskBaselines`.
|
|
160
|
+
*/
|
|
161
|
+
const writeScopeBaselinePaths = (teamRoot, slug) => {
|
|
162
|
+
if (!SLUG_RE.test(slug)) return null;
|
|
163
|
+
let entries;
|
|
164
|
+
try {
|
|
165
|
+
entries = fs.readdirSync(path.join(teamRoot, '.write-scope', slug));
|
|
166
|
+
} catch {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const paths = new Set();
|
|
170
|
+
for (const entry of entries) {
|
|
171
|
+
if (!entry.endsWith('.json')) continue;
|
|
172
|
+
const value = readJson(path.join(teamRoot, '.write-scope', slug, entry), null);
|
|
173
|
+
const record =
|
|
174
|
+
value && typeof value === 'object' && value.paths && typeof value.paths === 'object' && !Array.isArray(value.paths)
|
|
175
|
+
? value.paths
|
|
176
|
+
: null;
|
|
177
|
+
if (!record) continue;
|
|
178
|
+
for (const key of Object.keys(record)) {
|
|
179
|
+
if (typeof key === 'string' && key !== '') paths.add(key.split(path.sep).join('/'));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return paths.size > 0 ? [...paths].sort() : null;
|
|
183
|
+
};
|
|
184
|
+
|
|
136
185
|
/**
|
|
137
|
-
* Worktree snapshot. `head`
|
|
138
|
-
* covers
|
|
139
|
-
*
|
|
186
|
+
* Worktree snapshot. `head` plus the scope binding are the freshness keys:
|
|
187
|
+
* `scopeHash` covers the task's write-scope baseline path set (tracked
|
|
188
|
+
* modifications and the untracked-name set, not untracked file contents —
|
|
189
|
+
* which would make the check unbounded on a dirty tree), so another live
|
|
190
|
+
* slug's uncommitted work cannot stale this task's evidence. Known limit: a
|
|
191
|
+
* file created after baseline activation outside the claimed path set is
|
|
192
|
+
* invisible to `scopeHash`; the write-scope audit and `check:task` still
|
|
193
|
+
* attribute such files at gate time (content-hash delta) — the scoped hash is
|
|
194
|
+
* a change detector, not an attribution tool. `environmentHash` (renamed from
|
|
195
|
+
* `worktreeHash`) keeps the whole-tree capture as diagnostics only.
|
|
196
|
+
* Basis: `write-scope` (baselines exist), `whole-tree` (none, ≤1 live slug —
|
|
197
|
+
* solo-tree semantics preserved), `none` (none, >1 live slug — no hash,
|
|
198
|
+
* freshness reports `scope-unbound`). Must hash identically to the chain
|
|
199
|
+
* hook's `gitSnapshot()`; the parity fixture pins the formula.
|
|
140
200
|
*/
|
|
141
|
-
const captureSnapshot = (root) => {
|
|
201
|
+
const captureSnapshot = (root, teamRoot, slug) => {
|
|
142
202
|
const head = git(root, ['rev-parse', 'HEAD']);
|
|
143
203
|
if (head === null) {
|
|
144
|
-
return { head: null, branch: null, dirtyFiles: null,
|
|
204
|
+
return { head: null, branch: null, dirtyFiles: null, environmentHash: null, scopeBasis: 'none', scopePaths: 0, scopeHash: null, git: false, capturedAt: new Date().toISOString() };
|
|
145
205
|
}
|
|
146
206
|
const branch = git(root, ['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
147
207
|
// `.ai.local/` holds the evidence this module writes; including it would make
|
|
@@ -151,11 +211,27 @@ const captureSnapshot = (root) => {
|
|
|
151
211
|
const diffText = git(root, ['diff', '--binary', 'HEAD', ...exclude]) ?? '';
|
|
152
212
|
const untrackedText = git(root, ['ls-files', '--others', '--exclude-standard', ...exclude]) ?? '';
|
|
153
213
|
const dirtyFiles = statusText === '' ? 0 : statusText.split('\n').filter((line) => line !== '').length;
|
|
214
|
+
const baselinePaths = writeScopeBaselinePaths(teamRoot, typeof slug === 'string' ? slug : '');
|
|
215
|
+
let scopeBasis = 'none';
|
|
216
|
+
let scopeHash = null;
|
|
217
|
+
if (baselinePaths !== null) {
|
|
218
|
+
scopeBasis = 'write-scope';
|
|
219
|
+
const spec = ['--', ...baselinePaths];
|
|
220
|
+
const scopedStatus = git(root, ['status', '--porcelain=v1', ...spec]) ?? '';
|
|
221
|
+
const scopedDiff = git(root, ['diff', '--binary', 'HEAD', ...spec]) ?? '';
|
|
222
|
+
const scopedUntracked = git(root, ['ls-files', '--others', '--exclude-standard', ...spec]) ?? '';
|
|
223
|
+
scopeHash = sha256(`${scopedStatus}\u0000${scopedDiff}\u0000${scopedUntracked}`);
|
|
224
|
+
} else if (liveTaskSlugs(teamRoot).length <= 1) {
|
|
225
|
+
scopeBasis = 'whole-tree';
|
|
226
|
+
}
|
|
154
227
|
return {
|
|
155
228
|
head: head.trim(),
|
|
156
229
|
branch: branch === null ? null : branch.trim(),
|
|
157
230
|
dirtyFiles,
|
|
158
|
-
|
|
231
|
+
environmentHash: sha256(`${statusText}\u0000${diffText}\u0000${untrackedText}`),
|
|
232
|
+
scopeBasis,
|
|
233
|
+
scopePaths: baselinePaths === null ? 0 : baselinePaths.length,
|
|
234
|
+
scopeHash,
|
|
159
235
|
git: true,
|
|
160
236
|
capturedAt: new Date().toISOString(),
|
|
161
237
|
};
|
|
@@ -270,7 +346,7 @@ const actionRecord = (args) => {
|
|
|
270
346
|
};
|
|
271
347
|
verification.commands.push(entry);
|
|
272
348
|
verification.task = path.basename(taskDir);
|
|
273
|
-
verification.snapshot = captureSnapshot(path.resolve(teamRoot, '..', '..'));
|
|
349
|
+
verification.snapshot = captureSnapshot(path.resolve(teamRoot, '..', '..'), teamRoot, path.basename(taskDir));
|
|
274
350
|
verification.gate = { status: 'recorded', checkedAt: new Date().toISOString() };
|
|
275
351
|
writeJsonAtomic(file, verification);
|
|
276
352
|
} finally {
|
|
@@ -285,7 +361,7 @@ const actionRecord = (args) => {
|
|
|
285
361
|
agent: entry.agent,
|
|
286
362
|
attempt: entry.attempt,
|
|
287
363
|
head: verification.snapshot.head,
|
|
288
|
-
|
|
364
|
+
environmentHash: verification.snapshot.environmentHash,
|
|
289
365
|
});
|
|
290
366
|
|
|
291
367
|
if (args.json) {
|
|
@@ -309,7 +385,7 @@ const actionSnapshot = (args) => {
|
|
|
309
385
|
commands: [],
|
|
310
386
|
gate: { status: 'recorded', checkedAt: null },
|
|
311
387
|
};
|
|
312
|
-
verification.snapshot = captureSnapshot(path.resolve(teamRoot, '..', '..'));
|
|
388
|
+
verification.snapshot = captureSnapshot(path.resolve(teamRoot, '..', '..'), teamRoot, path.basename(taskDir));
|
|
313
389
|
writeJsonAtomic(file, verification);
|
|
314
390
|
} finally {
|
|
315
391
|
release();
|
|
@@ -330,12 +406,31 @@ const actionCheck = (args) => {
|
|
|
330
406
|
else process.stdout.write('verification: missing\n');
|
|
331
407
|
process.exit(args.strict ? 2 : 0);
|
|
332
408
|
}
|
|
333
|
-
const current = captureSnapshot(path.resolve(teamRoot, '..', '..'));
|
|
409
|
+
const current = captureSnapshot(path.resolve(teamRoot, '..', '..'), teamRoot, path.basename(taskDir));
|
|
334
410
|
const reasons = [];
|
|
335
411
|
if (!verification.snapshot) reasons.push('no-snapshot');
|
|
336
412
|
else {
|
|
337
413
|
if (verification.snapshot.head !== current.head) reasons.push('head-changed');
|
|
338
|
-
|
|
414
|
+
// The head comparison is global (HEAD is shared across live slugs); the
|
|
415
|
+
// dirty/hash dimension switches on the recorded `scopeBasis` the same way
|
|
416
|
+
// the chain hook's `verificationFreshness` does. `write-scope` binds to
|
|
417
|
+
// `scopeHash` (a scope that can no longer be recomputed reports
|
|
418
|
+
// `scope-unbound`); `none` is a loud not-fresh; legacy snapshots (no
|
|
419
|
+
// `scopeBasis`) and `whole-tree` keep the whole-tree comparison, reading
|
|
420
|
+
// the renamed field as `environmentHash ?? worktreeHash`.
|
|
421
|
+
const basis = typeof verification.snapshot.scopeBasis === 'string' ? verification.snapshot.scopeBasis : 'legacy';
|
|
422
|
+
if (basis === 'write-scope') {
|
|
423
|
+
if (current.scopeBasis !== 'write-scope') reasons.push('scope-unbound');
|
|
424
|
+
else if (current.scopeHash !== verification.snapshot.scopeHash) reasons.push('worktree-changed');
|
|
425
|
+
} else if (basis === 'none') {
|
|
426
|
+
reasons.push('scope-unbound');
|
|
427
|
+
} else {
|
|
428
|
+
const recorded =
|
|
429
|
+
typeof verification.snapshot.environmentHash === 'string'
|
|
430
|
+
? verification.snapshot.environmentHash
|
|
431
|
+
: verification.snapshot.worktreeHash;
|
|
432
|
+
if (current.environmentHash !== recorded) reasons.push('worktree-changed');
|
|
433
|
+
}
|
|
339
434
|
}
|
|
340
435
|
if (verification.commands.length === 0) reasons.push('no-command-evidence');
|
|
341
436
|
const fresh = reasons.length === 0;
|
|
@@ -132,10 +132,18 @@ node .ai.local/scripts/verification.mjs check --task <slug> [--strict]
|
|
|
132
132
|
- `record` appends one command entry (`id`, `command`, `exit`, `at`, optional
|
|
133
133
|
`logRef`/`logSha256`), stores a capped, secret-redacted log tail under
|
|
134
134
|
`evidence/`, and snapshots the git state (`head`, `branch`, `dirtyFiles`,
|
|
135
|
-
`
|
|
135
|
+
`environmentHash`) plus the task-scoped binding (`scopeHash`, `scopePaths`,
|
|
136
|
+
`scopeBasis`: `write-scope` | `whole-tree` | `none`). `.ai.local/**` is
|
|
137
|
+
excluded from the whole-tree capture. Gate freshness binds to `scopeHash` —
|
|
138
|
+
computed over the task's `.write-scope` baseline path set, so another live
|
|
139
|
+
slug's uncommitted work cannot stale this task's evidence; `environmentHash`
|
|
140
|
+
keeps the whole-tree capture as diagnostics only. A `none` basis (no
|
|
141
|
+
baselines, more than one slug live) is a loud not-fresh (`scope-unbound`).
|
|
136
142
|
- `check` compares the stored snapshot with the current worktree:
|
|
137
143
|
`head-changed` / `worktree-changed` mean the evidence belongs to an older
|
|
138
|
-
tree
|
|
144
|
+
tree, `scope-unbound` means the scoped binding cannot be recomputed. Snapshots
|
|
145
|
+
recorded before the rename keep comparing via the legacy `worktreeHash` field.
|
|
146
|
+
`--strict` exits `1` when stale and `2` when missing.
|
|
139
147
|
- When a `build-verifier` attempt finishes without an explicit `record`, the
|
|
140
148
|
chain hook seeds the file once (`gate.status: snapshot-only`): the git snapshot
|
|
141
149
|
plus a SHA-256 of `validation-report.md`, with `commands: []`. An existing file
|
|
@@ -10,4 +10,6 @@ When the user message looks like a **work request** (implement, add, fix, refact
|
|
|
10
10
|
6. **Reuse the dialogue language already resolved on this turn** (always-on `ai-local-overlay` / **language-policy**). A question and a message without a slash command still resolve before you speak. When this request writes `prompt.md`, persist that tag once in the header (`language: <BCP-47>`) + a `.memlog.md` `event:` line. Development, reasoning, and artifacts stay English. The setting wins over a mid-task prompt switch (surface it once, never ask). See **language-policy**.
|
|
11
11
|
7. **Project the intake write.** After `prompt.md` is written for an inline (non-`/task`) work request, run `node .ai.local/scripts/team-db.mjs sync --slug <slug> --deadline-ms 4500` once, so the new task row and its prompt reach the database. A projection failure is reported to the user, never blocks the request; the next full sync remains the convergence path. Do not run a full sync from intake.
|
|
12
12
|
|
|
13
|
+
On Cursor, Mavis, OpenCode and ZCode — the hosts without a verified prompt hook — run a request that is not already `/task` or `/task-continue` as `/task` when `node .ai.local/scripts/settings.mjs get AI_RULES_AUTOROUTE_UNCHAINED_PROMPTS` prints `true` and the live-slug count (every `.ai.local/team/tasks/*/status.json` whose `state` is not one of `completed`, `blocked`, `changes_requested`, `validation_failed`) is below the `node .ai.local/scripts/settings.mjs get AI_RULES_MAX_PARALLEL_TASKS` cap (`4` by default; `0` = unlimited). A prompt that names an existing slug or is a resume intent (`continue` / `resume` / `продолжай` family, `.ai.local/rules/task-resume.md`) routes to `/task-continue <slug>` regardless of the cap. <!-- i18n-keep: E4 -->
|
|
14
|
+
|
|
13
15
|
Exceptions: user explicitly says “no pipeline”, “just do it”, or continues an active slug.
|
|
@@ -237,7 +237,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
237
237
|
3. One role per Task call — **except** parallel steps: multiple Task calls in one message.
|
|
238
238
|
4. **Never** skip `humanGates` without `/task-continue` or explicit user approval.
|
|
239
239
|
5. Persist handoffs to disk (`brief.md`, `decomposition.md`, `debug-report.md`, `validation-report.md`, `architecture.md`, `migration-plan.md`, `ci-report.md`, `a11y-review.md`, `perf-report.md`, `security-review.md`, `api-contract-review.md`, `unit-test-plan.md`, `documentation.md`, `review.md`, `mockup-review.md`, `ux-design.md`) and update the producer-owned terminal receipt in `artifact-manifest.json`.
|
|
240
|
-
6. On `changes_requested` from reviewers: hook sets `retryAfterFix` → developer → `build-verifier` (delta) → same reviewer when the fix touches code/tests; a docs/artifacts-only fix returns to the same reviewer without a code gate. Exception: embedded `mockup-reviewer` FAIL (`changes_requested` while the completed/current agent is `mockup-reviewer`) → `awaiting_approval` / `/task-continue` only — do **not** `retryAfterFix` to developer. A `mockup-reviewer` verdict `mockup-change-requested` (a defect whose fix belongs in the design source, not the implementation) routes the same way — `awaiting_approval`, no developer retry.
|
|
240
|
+
6. On `changes_requested` from reviewers: the first time that agent returns it, the hook sets `retryAfterFix` → developer → `build-verifier` (delta) → same reviewer when the fix touches code/tests; a docs/artifacts-only fix returns to the same reviewer without a code gate. The second `changes_requested` from the same agent is a human gate (`awaitingHumanGate`, `designEscalation`): do not dispatch the developer. Append `decision: replan rev N → N+1` to `.memlog.md` (the decision changes the model), then `/task-continue`, which the hook accepts only when that line is new. Exception: embedded `mockup-reviewer` FAIL (`changes_requested` while the completed/current agent is `mockup-reviewer`) → `awaiting_approval` / `/task-continue` only — do **not** `retryAfterFix` to developer. A `mockup-reviewer` verdict `mockup-change-requested` (a defect whose fix belongs in the design source, not the implementation) routes the same way — `awaiting_approval`, no developer retry.
|
|
241
241
|
7. On `validation_failed` from `build-verifier`: hook sets `retryAfterFix: build-verifier` → developer → build-verifier (delta).
|
|
242
242
|
8. When all steps complete, suggest `/technical-retro <slug>`.
|
|
243
243
|
9. If `autoChain: false` in pipeline, do not rely on hook — manual step only.
|
|
@@ -281,7 +281,7 @@ node .ai.local/scripts/record-usage.mjs --task <slug> --attempt <attemptId> --in
|
|
|
281
281
|
|
|
282
282
|
The chain hook also forwards a `usage` object from its input into the `attempt_finished` event. Never estimate or invent token counts; a missing usage record stays missing.
|
|
283
283
|
|
|
284
|
-
After each agent completes, verify its terminal manifest receipt, then let the orchestration runtime/hook reconcile `status.json` (`completed`, a blocking outcome, or `awaiting_approval`) from that receipt.
|
|
284
|
+
After each agent completes, verify its terminal manifest receipt, then let the orchestration runtime/hook reconcile `status.json` (`completed`, a blocking outcome, or `awaiting_approval`) from that receipt. **MUST: pass `TEAM_TASK_SLUG=<slug>` on every hook call** — `TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh` (or the host's hook path). With more than one live slug, an omitted env is a hook refusal (`active-task-pointer-ambiguous`, `ok:false`), never a silent reroute: re-run with the env set. The OpenCode task-status plugin pins each tab in `.ai.local/team/.session-leases/<session>.json` and injects `AI_RULES_SESSION_ID` on `shell.env`, so a later hook call in that tab resolves through the lease when `TEAM_TASK_SLUG` is omitted. `active-task.json` is the live-slug list, not a tab binding. Do not ask the agent to mutate shared lifecycle fields, and do not invoke the next specialist until the hook has written the handoff / updated `status.json`.
|
|
285
285
|
|
|
286
286
|
## Legacy mode
|
|
287
287
|
|
|
@@ -23,6 +23,14 @@ Write for two readers at once: an **agent** loading one file out of context, and
|
|
|
23
23
|
- No scenario storytelling, rhetorical questions, or meta-narration ("this section explains…").
|
|
24
24
|
- No duplicated rule text across stems — link instead.
|
|
25
25
|
|
|
26
|
+
## Shell guards
|
|
27
|
+
|
|
28
|
+
A write or execute guard allowlists the benign shapes and answers `ask` on anything it cannot classify. `allow` on an unknown shape is a defect.
|
|
29
|
+
|
|
30
|
+
- Name the bypass class — abbreviations, aliases, quoting, shell wrappers, config-injection options (`-c`, `--exec`, `--receive-pack`), value-consumption mismatch — not a list of spellings.
|
|
31
|
+
- Probe each shape with the flag on, the flag off, a sentinel, and an unreadable config. Quote the tool output. A green gate set is not that evidence.
|
|
32
|
+
- Compare every probed shape with the previous answer. A shape that asked before and allows now is a blocker.
|
|
33
|
+
|
|
26
34
|
## Size
|
|
27
35
|
|
|
28
36
|
- Shortest form that still changes behavior: if a bullet fits as a clause, make it a clause.
|