@chankov/agent-fleet 0.0.1
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/commands/build.md +44 -0
- package/.claude/commands/code-simplify.md +22 -0
- package/.claude/commands/design-agent.md +14 -0
- package/.claude/commands/doctor-agent-fleet.md +17 -0
- package/.claude/commands/orchestrate.md +112 -0
- package/.claude/commands/plan.md +16 -0
- package/.claude/commands/prime.md +22 -0
- package/.claude/commands/review.md +16 -0
- package/.claude/commands/setup-agent-fleet.md +25 -0
- package/.claude/commands/ship.md +72 -0
- package/.claude/commands/spec.md +15 -0
- package/.claude/commands/test.md +19 -0
- package/.claude/commands/webperf.md +32 -0
- package/.claude/orchestrate-teams.yaml +24 -0
- package/.opencode/commands/af-build.md +17 -0
- package/.opencode/commands/af-code-simplify.md +16 -0
- package/.opencode/commands/af-compound.md +16 -0
- package/.opencode/commands/af-design-agent.md +15 -0
- package/.opencode/commands/af-doctor-agent-fleet.md +15 -0
- package/.opencode/commands/af-orchestrate.md +112 -0
- package/.opencode/commands/af-plan.md +16 -0
- package/.opencode/commands/af-prime.md +22 -0
- package/.opencode/commands/af-review.md +15 -0
- package/.opencode/commands/af-setup-agent-fleet.md +15 -0
- package/.opencode/commands/af-ship.md +16 -0
- package/.opencode/commands/af-spec.md +16 -0
- package/.opencode/commands/af-test.md +21 -0
- package/.opencode/commands/af-webperf.md +32 -0
- package/.opencode/orchestrate-teams.yaml +24 -0
- package/.pi/agents/dispatch-policy.yaml +32 -0
- package/.pi/agents/model-profiles.yaml +20 -0
- package/.pi/agents/peers.yaml +142 -0
- package/.pi/agents/teams.yaml +39 -0
- package/.pi/damage-control-rules.yaml +297 -0
- package/.pi/extensions/agent-fleet-update-check/README.md +58 -0
- package/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.pi/extensions/btw/README.md +118 -0
- package/.pi/extensions/btw/index.ts +917 -0
- package/.pi/extensions/btw/package.json +6 -0
- package/.pi/extensions/btw/state.js +179 -0
- package/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
- package/.pi/extensions/chrome-devtools-mcp/index.ts +92 -0
- package/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.pi/extensions/package-lock.json +1143 -0
- package/.pi/extensions/package.json +9 -0
- package/.pi/extensions/pi-voice-stt/README.md +201 -0
- package/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.pi/harnesses/agent-hub/README.md +562 -0
- package/.pi/harnesses/agent-hub/artifacts.js +92 -0
- package/.pi/harnesses/agent-hub/backend-policy.js +153 -0
- package/.pi/harnesses/agent-hub/delegate.ts +363 -0
- package/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.pi/harnesses/agent-hub/helpers.ts +165 -0
- package/.pi/harnesses/agent-hub/index.ts +7098 -0
- package/.pi/harnesses/agent-hub/package.json +6 -0
- package/.pi/harnesses/agent-hub/return-contract.js +215 -0
- package/.pi/harnesses/agent-hub/scope-gate.js +103 -0
- package/.pi/harnesses/agent-hub/spawn.ts +179 -0
- package/.pi/harnesses/ask-user-remote/README.md +10 -0
- package/.pi/harnesses/ask-user-remote/index.ts +253 -0
- package/.pi/harnesses/ask-user-remote/race-core.js +106 -0
- package/.pi/harnesses/coms/README.md +71 -0
- package/.pi/harnesses/coms/index.ts +1743 -0
- package/.pi/harnesses/coms/package.json +6 -0
- package/.pi/harnesses/damage-control/README.md +65 -0
- package/.pi/harnesses/damage-control/index.ts +250 -0
- package/.pi/harnesses/damage-control/package.json +6 -0
- package/.pi/harnesses/damage-control/shared.ts +183 -0
- package/.pi/harnesses/damage-control-continue/README.md +116 -0
- package/.pi/harnesses/damage-control-continue/index.ts +522 -0
- package/.pi/harnesses/damage-control-continue/package.json +6 -0
- package/.pi/harnesses/lib/herdr-client.ts +458 -0
- package/.pi/harnesses/lib/herdr-presence.ts +288 -0
- package/.pi/harnesses/package-lock.json +35 -0
- package/.pi/harnesses/package.json +9 -0
- package/.pi/prompts/build.md +24 -0
- package/.pi/prompts/code-simplify.md +22 -0
- package/.pi/prompts/doctor-agent-fleet.md +15 -0
- package/.pi/prompts/plan.md +16 -0
- package/.pi/prompts/review.md +16 -0
- package/.pi/prompts/setup-agent-fleet.md +27 -0
- package/.pi/prompts/ship.md +17 -0
- package/.pi/prompts/spec.md +15 -0
- package/.pi/prompts/test.md +19 -0
- package/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/0.0.1/.claude/commands/build.md +44 -0
- package/.versions/0.0.1/.claude/commands/code-simplify.md +22 -0
- package/.versions/0.0.1/.claude/commands/design-agent.md +14 -0
- package/.versions/0.0.1/.claude/commands/doctor-agent-fleet.md +17 -0
- package/.versions/0.0.1/.claude/commands/orchestrate.md +112 -0
- package/.versions/0.0.1/.claude/commands/plan.md +16 -0
- package/.versions/0.0.1/.claude/commands/prime.md +22 -0
- package/.versions/0.0.1/.claude/commands/review.md +16 -0
- package/.versions/0.0.1/.claude/commands/setup-agent-fleet.md +25 -0
- package/.versions/0.0.1/.claude/commands/ship.md +72 -0
- package/.versions/0.0.1/.claude/commands/spec.md +15 -0
- package/.versions/0.0.1/.claude/commands/test.md +19 -0
- package/.versions/0.0.1/.claude/commands/webperf.md +32 -0
- package/.versions/0.0.1/.claude/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.1/.opencode/commands/af-build.md +17 -0
- package/.versions/0.0.1/.opencode/commands/af-code-simplify.md +16 -0
- package/.versions/0.0.1/.opencode/commands/af-compound.md +16 -0
- package/.versions/0.0.1/.opencode/commands/af-design-agent.md +15 -0
- package/.versions/0.0.1/.opencode/commands/af-doctor-agent-fleet.md +15 -0
- package/.versions/0.0.1/.opencode/commands/af-orchestrate.md +112 -0
- package/.versions/0.0.1/.opencode/commands/af-plan.md +16 -0
- package/.versions/0.0.1/.opencode/commands/af-prime.md +22 -0
- package/.versions/0.0.1/.opencode/commands/af-review.md +15 -0
- package/.versions/0.0.1/.opencode/commands/af-setup-agent-fleet.md +15 -0
- package/.versions/0.0.1/.opencode/commands/af-ship.md +16 -0
- package/.versions/0.0.1/.opencode/commands/af-spec.md +16 -0
- package/.versions/0.0.1/.opencode/commands/af-test.md +21 -0
- package/.versions/0.0.1/.opencode/commands/af-webperf.md +32 -0
- package/.versions/0.0.1/.opencode/orchestrate-teams.yaml +24 -0
- package/.versions/0.0.1/.pi/agents/dispatch-policy.yaml +32 -0
- package/.versions/0.0.1/.pi/agents/model-profiles.yaml +20 -0
- package/.versions/0.0.1/.pi/agents/peers.yaml +142 -0
- package/.versions/0.0.1/.pi/agents/teams.yaml +39 -0
- package/.versions/0.0.1/.pi/damage-control-rules.yaml +297 -0
- package/.versions/0.0.1/.pi/extensions/agent-fleet-update-check/README.md +58 -0
- package/.versions/0.0.1/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
- package/.versions/0.0.1/.pi/extensions/agent-fleet-update-check/package.json +6 -0
- package/.versions/0.0.1/.pi/extensions/btw/README.md +118 -0
- package/.versions/0.0.1/.pi/extensions/btw/index.ts +917 -0
- package/.versions/0.0.1/.pi/extensions/btw/package.json +6 -0
- package/.versions/0.0.1/.pi/extensions/btw/state.js +179 -0
- package/.versions/0.0.1/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
- package/.versions/0.0.1/.pi/extensions/chrome-devtools-mcp/index.ts +92 -0
- package/.versions/0.0.1/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
- package/.versions/0.0.1/.pi/extensions/compact-and-continue/README.md +42 -0
- package/.versions/0.0.1/.pi/extensions/compact-and-continue/index.ts +120 -0
- package/.versions/0.0.1/.pi/extensions/compact-and-continue/package.json +6 -0
- package/.versions/0.0.1/.pi/extensions/mcp-bridge/README.md +46 -0
- package/.versions/0.0.1/.pi/extensions/mcp-bridge/index.ts +206 -0
- package/.versions/0.0.1/.pi/extensions/mcp-bridge/package.json +6 -0
- package/.versions/0.0.1/.pi/extensions/package-lock.json +1143 -0
- package/.versions/0.0.1/.pi/extensions/package.json +9 -0
- package/.versions/0.0.1/.pi/extensions/pi-voice-stt/README.md +201 -0
- package/.versions/0.0.1/.pi/extensions/pi-voice-stt/config.ts +198 -0
- package/.versions/0.0.1/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
- package/.versions/0.0.1/.pi/extensions/pi-voice-stt/index.ts +248 -0
- package/.versions/0.0.1/.pi/extensions/pi-voice-stt/package.json +6 -0
- package/.versions/0.0.1/.pi/extensions/pi-voice-stt/providers.ts +214 -0
- package/.versions/0.0.1/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/README.md +562 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/artifacts.js +92 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/backend-policy.js +153 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/delegate.ts +363 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/helpers.ts +165 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/index.ts +7098 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/package.json +6 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/return-contract.js +215 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/scope-gate.js +103 -0
- package/.versions/0.0.1/.pi/harnesses/agent-hub/spawn.ts +179 -0
- package/.versions/0.0.1/.pi/harnesses/ask-user-remote/README.md +10 -0
- package/.versions/0.0.1/.pi/harnesses/ask-user-remote/index.ts +253 -0
- package/.versions/0.0.1/.pi/harnesses/ask-user-remote/race-core.js +106 -0
- package/.versions/0.0.1/.pi/harnesses/coms/README.md +71 -0
- package/.versions/0.0.1/.pi/harnesses/coms/index.ts +1743 -0
- package/.versions/0.0.1/.pi/harnesses/coms/package.json +6 -0
- package/.versions/0.0.1/.pi/harnesses/damage-control/README.md +65 -0
- package/.versions/0.0.1/.pi/harnesses/damage-control/index.ts +250 -0
- package/.versions/0.0.1/.pi/harnesses/damage-control/package.json +6 -0
- package/.versions/0.0.1/.pi/harnesses/damage-control/shared.ts +183 -0
- package/.versions/0.0.1/.pi/harnesses/damage-control-continue/README.md +116 -0
- package/.versions/0.0.1/.pi/harnesses/damage-control-continue/index.ts +522 -0
- package/.versions/0.0.1/.pi/harnesses/damage-control-continue/package.json +6 -0
- package/.versions/0.0.1/.pi/harnesses/lib/herdr-client.ts +458 -0
- package/.versions/0.0.1/.pi/harnesses/lib/herdr-presence.ts +288 -0
- package/.versions/0.0.1/.pi/harnesses/package-lock.json +35 -0
- package/.versions/0.0.1/.pi/harnesses/package.json +9 -0
- package/.versions/0.0.1/.pi/prompts/build.md +24 -0
- package/.versions/0.0.1/.pi/prompts/code-simplify.md +22 -0
- package/.versions/0.0.1/.pi/prompts/doctor-agent-fleet.md +15 -0
- package/.versions/0.0.1/.pi/prompts/plan.md +16 -0
- package/.versions/0.0.1/.pi/prompts/review.md +16 -0
- package/.versions/0.0.1/.pi/prompts/setup-agent-fleet.md +27 -0
- package/.versions/0.0.1/.pi/prompts/ship.md +17 -0
- package/.versions/0.0.1/.pi/prompts/spec.md +15 -0
- package/.versions/0.0.1/.pi/prompts/test.md +19 -0
- package/.versions/0.0.1/.pi/skills/bowser/SKILL.md +145 -0
- package/.versions/0.0.1/.version +1 -0
- package/.versions/0.0.1/agents/architect.md +21 -0
- package/.versions/0.0.1/agents/bowser.md +25 -0
- package/.versions/0.0.1/agents/builder.md +52 -0
- package/.versions/0.0.1/agents/code-reviewer.md +205 -0
- package/.versions/0.0.1/agents/deep-researcher.md +31 -0
- package/.versions/0.0.1/agents/documenter.md +16 -0
- package/.versions/0.0.1/agents/orchestrator.md +43 -0
- package/.versions/0.0.1/agents/plan-reviewer.md +60 -0
- package/.versions/0.0.1/agents/planner.md +69 -0
- package/.versions/0.0.1/agents/releaser.md +22 -0
- package/.versions/0.0.1/agents/researcher.md +28 -0
- package/.versions/0.0.1/agents/security-auditor.md +166 -0
- package/.versions/0.0.1/agents/test-engineer.md +144 -0
- package/.versions/0.0.1/agents/web-debugger.md +42 -0
- package/.versions/0.0.1/agents/web-performance-auditor.md +192 -0
- package/.versions/0.0.1/hooks/SIMPLIFY-IGNORE.md +90 -0
- package/.versions/0.0.1/hooks/coms-stop-hook.mjs +73 -0
- package/.versions/0.0.1/hooks/hooks.json +14 -0
- package/.versions/0.0.1/hooks/session-start.sh +74 -0
- package/.versions/0.0.1/hooks/simplify-ignore.sh +302 -0
- package/.versions/0.0.1/justfile +143 -0
- package/.versions/0.0.1/references/accessibility-checklist.md +160 -0
- package/.versions/0.0.1/references/definition-of-done.md +67 -0
- package/.versions/0.0.1/references/fleet-coordination-patterns.md +151 -0
- package/.versions/0.0.1/references/observability-checklist.md +91 -0
- package/.versions/0.0.1/references/orchestration-patterns.md +370 -0
- package/.versions/0.0.1/references/performance-checklist.md +153 -0
- package/.versions/0.0.1/references/prompting-patterns.md +380 -0
- package/.versions/0.0.1/references/security-checklist.md +179 -0
- package/.versions/0.0.1/references/testing-patterns.md +236 -0
- package/.versions/0.0.1/scripts/coms-claude-bridge.ts +286 -0
- package/.versions/0.0.1/scripts/coms-cli.ts +372 -0
- package/.versions/0.0.1/scripts/coms-hermes-bridge.ts +399 -0
- package/.versions/0.0.1/scripts/lib/claude-bridge-core.ts +100 -0
- package/.versions/0.0.1/scripts/lib/coms-envelope.ts +494 -0
- package/.versions/0.0.1/scripts/lib/herdr-layout.ts +235 -0
- package/.versions/0.0.1/scripts/lib/hermes-bridge-core.ts +238 -0
- package/.versions/0.0.1/scripts/lib/persona-banner.ts +62 -0
- package/.versions/0.0.1/scripts/lib/team-project.ts +75 -0
- package/.versions/0.0.1/scripts/lib/team-snapshot.ts +146 -0
- package/.versions/0.0.1/scripts/peer-banner.ts +40 -0
- package/.versions/0.0.1/scripts/team-snapshot.ts +221 -0
- package/.versions/0.0.1/scripts/team-up.ts +245 -0
- package/.versions/0.0.1/skills/_internal/grilling.md +11 -0
- package/.versions/0.0.1/skills/browser-testing-with-devtools/SKILL.md +352 -0
- package/.versions/0.0.1/skills/code-review-and-quality/SKILL.md +381 -0
- package/.versions/0.0.1/skills/compound-learning/SKILL.md +137 -0
- package/.versions/0.0.1/skills/context-engineering/SKILL.md +291 -0
- package/.versions/0.0.1/skills/deprecation-and-migration/SKILL.md +206 -0
- package/.versions/0.0.1/skills/designing-agents/SKILL.md +394 -0
- package/.versions/0.0.1/skills/designing-agents/pi-harness-authoring.md +209 -0
- package/.versions/0.0.1/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.1/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/.versions/0.0.1/skills/guided-workspace-setup/SKILL.md +506 -0
- package/.versions/0.0.1/skills/idea-refine/SKILL.md +182 -0
- package/.versions/0.0.1/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.1/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.1/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.1/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.1/skills/incremental-implementation/SKILL.md +287 -0
- package/.versions/0.0.1/skills/interview-me/SKILL.md +226 -0
- package/.versions/0.0.1/skills/orchestration-verification/SKILL.md +181 -0
- package/.versions/0.0.1/skills/peer-coms/SKILL.md +81 -0
- package/.versions/0.0.1/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.1/skills/planning-and-task-breakdown/SKILL.md +236 -0
- package/.versions/0.0.1/skills/security-and-hardening/SKILL.md +461 -0
- package/.versions/0.0.1/skills/spec-driven-development/SKILL.md +245 -0
- package/.versions/0.0.1/skills/using-agent-skills/SKILL.md +199 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/LICENSE +21 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/README.md +11 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/.versions/0.0.1/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
- package/CHANGELOG.md +65 -0
- package/LICENSE +21 -0
- package/README.md +458 -0
- package/agents/architect.md +21 -0
- package/agents/bowser.md +25 -0
- package/agents/builder.md +52 -0
- package/agents/code-reviewer.md +205 -0
- package/agents/deep-researcher.md +31 -0
- package/agents/documenter.md +16 -0
- package/agents/orchestrator.md +43 -0
- package/agents/plan-reviewer.md +60 -0
- package/agents/planner.md +69 -0
- package/agents/releaser.md +22 -0
- package/agents/researcher.md +28 -0
- package/agents/security-auditor.md +166 -0
- package/agents/test-engineer.md +144 -0
- package/agents/web-debugger.md +42 -0
- package/agents/web-performance-auditor.md +192 -0
- package/bin/cli.js +633 -0
- package/bin/force-patch-changesets.js +44 -0
- package/bin/lib/bootstrap.js +323 -0
- package/bin/lib/detect-agent.js +49 -0
- package/bin/lib/doctor.js +302 -0
- package/bin/lib/transform-persona.js +180 -0
- package/bin/lib/update-notifier.js +195 -0
- package/bin/lib/validate-overrides.js +229 -0
- package/bin/snapshot-version.js +91 -0
- package/docs/agent-fleet-setup.md +355 -0
- package/docs/claude-code-coms-bridge.md +93 -0
- package/docs/getting-started.md +169 -0
- package/docs/npm-install.md +335 -0
- package/docs/opencode-setup.md +248 -0
- package/docs/pi-extensions.md +237 -0
- package/docs/pi-setup.md +455 -0
- package/docs/skill-anatomy.md +150 -0
- package/hooks/SIMPLIFY-IGNORE.md +90 -0
- package/hooks/coms-stop-hook.mjs +73 -0
- package/hooks/hooks.json +14 -0
- package/hooks/session-start.sh +74 -0
- package/hooks/simplify-ignore.sh +302 -0
- package/justfile +143 -0
- package/node_modules/pi-ask-user/LICENSE +21 -0
- package/node_modules/pi-ask-user/README.md +156 -0
- package/node_modules/pi-ask-user/index.ts +1795 -0
- package/node_modules/pi-ask-user/package.json +51 -0
- package/node_modules/pi-ask-user/single-select-layout.ts +203 -0
- package/node_modules/pi-ask-user/skills/ask-user/SKILL.md +162 -0
- package/node_modules/pi-ask-user/skills/ask-user/references/ask-user-skill-extension-spec.md +96 -0
- package/package.json +121 -0
- package/references/accessibility-checklist.md +160 -0
- package/references/definition-of-done.md +67 -0
- package/references/fleet-coordination-patterns.md +151 -0
- package/references/observability-checklist.md +91 -0
- package/references/orchestration-patterns.md +370 -0
- package/references/performance-checklist.md +153 -0
- package/references/prompting-patterns.md +380 -0
- package/references/security-checklist.md +179 -0
- package/references/testing-patterns.md +236 -0
- package/scripts/coms-claude-bridge.ts +286 -0
- package/scripts/coms-cli.ts +372 -0
- package/scripts/coms-hermes-bridge.ts +399 -0
- package/scripts/lib/claude-bridge-core.ts +100 -0
- package/scripts/lib/coms-envelope.ts +494 -0
- package/scripts/lib/herdr-layout.ts +235 -0
- package/scripts/lib/hermes-bridge-core.ts +238 -0
- package/scripts/lib/persona-banner.ts +62 -0
- package/scripts/lib/team-project.ts +75 -0
- package/scripts/lib/team-snapshot.ts +146 -0
- package/scripts/peer-banner.ts +40 -0
- package/scripts/team-snapshot.ts +221 -0
- package/scripts/team-up.ts +245 -0
- package/skills/_internal/grilling.md +11 -0
- package/skills/browser-testing-with-devtools/SKILL.md +352 -0
- package/skills/code-review-and-quality/SKILL.md +381 -0
- package/skills/compound-learning/SKILL.md +137 -0
- package/skills/context-engineering/SKILL.md +291 -0
- package/skills/deprecation-and-migration/SKILL.md +206 -0
- package/skills/designing-agents/SKILL.md +394 -0
- package/skills/designing-agents/pi-harness-authoring.md +209 -0
- package/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/skills/git-workflow-and-versioning/SKILL.md +316 -0
- package/skills/guided-workspace-setup/SKILL.md +506 -0
- package/skills/idea-refine/SKILL.md +182 -0
- package/skills/idea-refine/examples.md +238 -0
- package/skills/idea-refine/frameworks.md +99 -0
- package/skills/idea-refine/refinement-criteria.md +113 -0
- package/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/skills/incremental-implementation/SKILL.md +287 -0
- package/skills/interview-me/SKILL.md +226 -0
- package/skills/orchestration-verification/SKILL.md +181 -0
- package/skills/peer-coms/SKILL.md +81 -0
- package/skills/performance-optimization/SKILL.md +350 -0
- package/skills/planning-and-task-breakdown/SKILL.md +236 -0
- package/skills/security-and-hardening/SKILL.md +461 -0
- package/skills/spec-driven-development/SKILL.md +245 -0
- package/skills/using-agent-skills/SKILL.md +199 -0
- package/vendor/agent-skills-upstream/LICENSE +21 -0
- package/vendor/agent-skills-upstream/README.md +11 -0
- package/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
- package/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
- package/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
- package/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
- package/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
- package/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
- package/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
- package/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
- package/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
- package/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
- package/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
- package/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
- package/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
- package/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
- package/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
- package/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
- package/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
- package/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
- package/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
- package/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
- package/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
- package/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
- package/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
- package/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
- package/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
- package/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
- package/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# damage-control
|
|
2
|
+
|
|
3
|
+
Safety auditing — blocks destructive tool calls.
|
|
4
|
+
|
|
5
|
+
> Ported from [`pi-vs-claude-code`](https://github.com/disler/pi-vs-claude-code) by [disler](https://github.com/disler) (MIT). See the [extension catalog](../../../docs/pi-extensions.md).
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
Intercepts every tool call and checks it against rules in `.pi/damage-control-rules.yaml`:
|
|
10
|
+
|
|
11
|
+
- `bashToolPatterns` — destructive shell commands (`rm -rf`, `git reset --hard`,
|
|
12
|
+
`DROP TABLE`, cloud-resource deletes, …); some are hard-blocked, some marked `ask`
|
|
13
|
+
- `zeroAccessPaths` — secrets and credentials that must never be read (`.env`, `*.pem`, …)
|
|
14
|
+
- `readOnlyPaths` — paths that may be read but not written (lockfiles, build output, …)
|
|
15
|
+
- `noDeletePaths` — paths that may be edited but not deleted (`README`, `.git/`, …)
|
|
16
|
+
|
|
17
|
+
On a match the tool result is replaced with a block message and the agent's turn is
|
|
18
|
+
aborted (`ctx.abort()`). For the softer variant that blocks but feeds back so the agent
|
|
19
|
+
adapts and keeps working, see [`damage-control-continue`](../damage-control-continue/README.md)
|
|
20
|
+
— the default guardrail for the `just hub` main session and spawned research helpers.
|
|
21
|
+
|
|
22
|
+
## Exemptions (pre-granted only)
|
|
23
|
+
|
|
24
|
+
The hard-stop variant honors **pre-granted exemptions** from the shared exemptions
|
|
25
|
+
file agent-hub passes down via `AGENT_HUB_EXEMPTIONS_FILE` (written by `/allow
|
|
26
|
+
<pattern> session` or an approved escalation in the dispatcher session). Exemptions
|
|
27
|
+
apply to the path categories only — `zeroAccessPaths`, `readOnlyPaths`,
|
|
28
|
+
`noDeletePaths` — never to the destructive `bashToolPatterns`. There is no
|
|
29
|
+
prompting and no escalation here by design: a specialist run never negotiates
|
|
30
|
+
access mid-flight; grants happen in the hub before or between dispatches.
|
|
31
|
+
Agent-scoped grants (`Allow for <agent>`) only reach the child whose
|
|
32
|
+
`AGENT_HUB_AGENT_ID` matches.
|
|
33
|
+
|
|
34
|
+
The exemption plumbing (file I/O + escalation protocol types) lives in
|
|
35
|
+
[`shared.ts`](./shared.ts), used by both variants and agent-hub.
|
|
36
|
+
|
|
37
|
+
## Commands & tools
|
|
38
|
+
|
|
39
|
+
None — it runs passively on the `tool_call` event.
|
|
40
|
+
|
|
41
|
+
## Requires
|
|
42
|
+
|
|
43
|
+
- `.pi/damage-control-rules.yaml` — the rule set (shipped in this repo)
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# standalone guardrail session
|
|
49
|
+
just ext-damage-control
|
|
50
|
+
pi -e .pi/harnesses/damage-control/index.ts
|
|
51
|
+
|
|
52
|
+
# the hub recipes load this harness first by default
|
|
53
|
+
just hub
|
|
54
|
+
just hub-solo
|
|
55
|
+
|
|
56
|
+
# direct guarded hub launch
|
|
57
|
+
pi -e .pi/harnesses/damage-control/index.ts -e .pi/harnesses/agent-hub/index.ts
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Upstream changes
|
|
61
|
+
|
|
62
|
+
- Theme integration removed — the `themeMap.ts` import and the `applyExtensionDefaults()`
|
|
63
|
+
call were stripped (this repo does not ship pi themes).
|
|
64
|
+
- Pre-granted exemptions from the hub session's shared file are honored (not in
|
|
65
|
+
upstream) — see the Exemptions section above.
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import type { ExtensionAPI, ToolCallEvent } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
import { isToolCallEventType } from "@mariozechner/pi-coding-agent";
|
|
3
|
+
import { parse as yamlParse } from "yaml";
|
|
4
|
+
import * as fs from "fs";
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
import * as os from "os";
|
|
7
|
+
import { AGENT_ID_ENV, EXEMPTIONS_FILE_ENV, fileExemptionsFor, type Exemption } from "./shared.ts";
|
|
8
|
+
|
|
9
|
+
interface Rule {
|
|
10
|
+
pattern: string;
|
|
11
|
+
reason: string;
|
|
12
|
+
ask?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Rules {
|
|
16
|
+
bashToolPatterns: Rule[];
|
|
17
|
+
zeroAccessPaths: string[];
|
|
18
|
+
readOnlyPaths: string[];
|
|
19
|
+
noDeletePaths: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function (pi: ExtensionAPI) {
|
|
23
|
+
let rules: Rules = {
|
|
24
|
+
bashToolPatterns: [],
|
|
25
|
+
zeroAccessPaths: [],
|
|
26
|
+
readOnlyPaths: [],
|
|
27
|
+
noDeletePaths: [],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function resolvePath(p: string, cwd: string): string {
|
|
31
|
+
if (p.startsWith("~")) {
|
|
32
|
+
p = path.join(os.homedir(), p.slice(1));
|
|
33
|
+
}
|
|
34
|
+
return path.resolve(cwd, p);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function isPathMatch(targetPath: string, pattern: string, cwd: string): boolean {
|
|
38
|
+
// Simple glob-to-regex or substring match
|
|
39
|
+
// Expand tilde in pattern if present
|
|
40
|
+
const resolvedPattern = pattern.startsWith("~") ? path.join(os.homedir(), pattern.slice(1)) : pattern;
|
|
41
|
+
|
|
42
|
+
// If pattern ends with /, it's a directory match
|
|
43
|
+
if (resolvedPattern.endsWith("/")) {
|
|
44
|
+
const absolutePattern = path.isAbsolute(resolvedPattern) ? resolvedPattern : path.resolve(cwd, resolvedPattern);
|
|
45
|
+
return targetPath.startsWith(absolutePattern);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Handle basic wildcards *
|
|
49
|
+
const regexPattern = resolvedPattern
|
|
50
|
+
.replace(/[.+^${}()|[\]\\]/g, "\\$&") // escape regex chars
|
|
51
|
+
.replace(/\*/g, ".*"); // convert * to .*
|
|
52
|
+
|
|
53
|
+
const regex = new RegExp(`^${regexPattern}$|^${regexPattern}/|/${regexPattern}$|/${regexPattern}/`);
|
|
54
|
+
|
|
55
|
+
// Match against absolute path and relative-to-cwd path
|
|
56
|
+
const relativePath = path.relative(cwd, targetPath);
|
|
57
|
+
|
|
58
|
+
return regex.test(targetPath) || regex.test(relativePath) || targetPath.includes(resolvedPattern) || relativePath.includes(resolvedPattern);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
62
|
+
const projectRulesPath = path.join(ctx.cwd, ".pi", "damage-control-rules.yaml");
|
|
63
|
+
const globalRulesPath = path.join(os.homedir(), ".pi", "damage-control-rules.yaml");
|
|
64
|
+
const rulesPath = fs.existsSync(projectRulesPath) ? projectRulesPath : fs.existsSync(globalRulesPath) ? globalRulesPath : null;
|
|
65
|
+
try {
|
|
66
|
+
if (rulesPath) {
|
|
67
|
+
const content = fs.readFileSync(rulesPath, "utf8");
|
|
68
|
+
const loaded = yamlParse(content) as Partial<Rules>;
|
|
69
|
+
rules = {
|
|
70
|
+
bashToolPatterns: loaded.bashToolPatterns || [],
|
|
71
|
+
zeroAccessPaths: loaded.zeroAccessPaths || [],
|
|
72
|
+
readOnlyPaths: loaded.readOnlyPaths || [],
|
|
73
|
+
noDeletePaths: loaded.noDeletePaths || [],
|
|
74
|
+
};
|
|
75
|
+
const source = rulesPath === projectRulesPath ? "project" : "global";
|
|
76
|
+
ctx.ui.notify(`🛡️ Damage-Control: Loaded ${rules.bashToolPatterns.length + rules.zeroAccessPaths.length + rules.readOnlyPaths.length + rules.noDeletePaths.length} rules (${source}).`);
|
|
77
|
+
} else {
|
|
78
|
+
ctx.ui.notify("🛡️ Damage-Control: No rules found at .pi/damage-control-rules.yaml (project or global)");
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
81
|
+
ctx.ui.notify(`🛡️ Damage-Control: Failed to load rules: ${err instanceof Error ? err.message : String(err)}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
ctx.ui.setStatus(`🛡️ Damage-Control Active: ${rules.bashToolPatterns.length + rules.zeroAccessPaths.length + rules.readOnlyPaths.length + rules.noDeletePaths.length} Rules`);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
pi.on("tool_call", async (event, ctx) => {
|
|
88
|
+
let violationReason: string | null = null;
|
|
89
|
+
let shouldAsk = false;
|
|
90
|
+
// The protected pattern that matched, set only for the path categories.
|
|
91
|
+
// Those can be pre-granted via the shared exemptions file agent-hub
|
|
92
|
+
// passes down (AGENT_HUB_EXEMPTIONS_FILE); destructive bashToolPatterns
|
|
93
|
+
// leave this null and are never exemptible.
|
|
94
|
+
let matchedPattern: string | null = null;
|
|
95
|
+
|
|
96
|
+
// 1. Check Zero Access Paths for all tools that use path or glob
|
|
97
|
+
const checkPaths = (pathsToCheck: string[]) => {
|
|
98
|
+
for (const p of pathsToCheck) {
|
|
99
|
+
const resolved = resolvePath(p, ctx.cwd);
|
|
100
|
+
for (const zap of rules.zeroAccessPaths) {
|
|
101
|
+
if (isPathMatch(resolved, zap, ctx.cwd)) {
|
|
102
|
+
matchedPattern = zap;
|
|
103
|
+
return `Access to zero-access path restricted: ${zap}`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Extract paths from tool input
|
|
111
|
+
const inputPaths: string[] = [];
|
|
112
|
+
if (isToolCallEventType("read", event) || isToolCallEventType("write", event) || isToolCallEventType("edit", event)) {
|
|
113
|
+
inputPaths.push(event.input.path);
|
|
114
|
+
} else if (isToolCallEventType("grep", event) || isToolCallEventType("find", event) || isToolCallEventType("ls", event)) {
|
|
115
|
+
inputPaths.push(event.input.path || ".");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (isToolCallEventType("grep", event) && event.input.glob) {
|
|
119
|
+
// Check glob field as well
|
|
120
|
+
for (const zap of rules.zeroAccessPaths) {
|
|
121
|
+
if (event.input.glob.includes(zap) || isPathMatch(event.input.glob, zap, ctx.cwd)) {
|
|
122
|
+
violationReason = `Glob matches zero-access path: ${zap}`;
|
|
123
|
+
matchedPattern = zap;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// find's required `pattern` is a filename glob (e.g. "*.env") — the `path` check
|
|
130
|
+
// above only sees the search root ("."), so check the pattern too, mirroring grep's glob.
|
|
131
|
+
if (!violationReason && isToolCallEventType("find", event) && event.input.pattern) {
|
|
132
|
+
for (const zap of rules.zeroAccessPaths) {
|
|
133
|
+
if (event.input.pattern.includes(zap) || isPathMatch(event.input.pattern, zap, ctx.cwd)) {
|
|
134
|
+
violationReason = `Find pattern matches zero-access path: ${zap}`;
|
|
135
|
+
matchedPattern = zap;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (!violationReason) {
|
|
142
|
+
violationReason = checkPaths(inputPaths);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 2. Tool-specific logic
|
|
146
|
+
if (!violationReason) {
|
|
147
|
+
if (isToolCallEventType("bash", event)) {
|
|
148
|
+
const command = event.input.command;
|
|
149
|
+
|
|
150
|
+
// Check bashToolPatterns
|
|
151
|
+
for (const rule of rules.bashToolPatterns) {
|
|
152
|
+
const regex = new RegExp(rule.pattern);
|
|
153
|
+
if (regex.test(command)) {
|
|
154
|
+
violationReason = rule.reason;
|
|
155
|
+
shouldAsk = !!rule.ask;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Check if bash command interacts with restricted paths
|
|
161
|
+
if (!violationReason) {
|
|
162
|
+
for (const zap of rules.zeroAccessPaths) {
|
|
163
|
+
if (command.includes(zap)) {
|
|
164
|
+
violationReason = `Bash command references zero-access path: ${zap}`;
|
|
165
|
+
matchedPattern = zap;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!violationReason) {
|
|
172
|
+
for (const rop of rules.readOnlyPaths) {
|
|
173
|
+
// Heuristic: check if command might modify a read-only path
|
|
174
|
+
// Redirects, sed -i, rm, mv to, etc.
|
|
175
|
+
if (command.includes(rop) && (/[\s>|]/.test(command) || command.includes("rm") || command.includes("mv") || command.includes("sed"))) {
|
|
176
|
+
violationReason = `Bash command may modify read-only path: ${rop}`;
|
|
177
|
+
matchedPattern = rop;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (!violationReason) {
|
|
184
|
+
for (const ndp of rules.noDeletePaths) {
|
|
185
|
+
if (command.includes(ndp) && (command.includes("rm") || command.includes("mv"))) {
|
|
186
|
+
violationReason = `Bash command attempts to delete/move protected path: ${ndp}`;
|
|
187
|
+
matchedPattern = ndp;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} else if (isToolCallEventType("write", event) || isToolCallEventType("edit", event)) {
|
|
193
|
+
// Check Read-Only paths
|
|
194
|
+
for (const p of inputPaths) {
|
|
195
|
+
const resolved = resolvePath(p, ctx.cwd);
|
|
196
|
+
for (const rop of rules.readOnlyPaths) {
|
|
197
|
+
if (isPathMatch(resolved, rop, ctx.cwd)) {
|
|
198
|
+
violationReason = `Modification of read-only path restricted: ${rop}`;
|
|
199
|
+
matchedPattern = rop;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (violationReason) {
|
|
208
|
+
// Pre-granted exemptions from the hub session's shared file
|
|
209
|
+
// (AGENT_HUB_EXEMPTIONS_FILE, written by /allow or an approved
|
|
210
|
+
// escalation in the dispatcher). This is the ONLY unlock the
|
|
211
|
+
// hard-stop variant honors — no prompting, no escalation — and it
|
|
212
|
+
// applies to path categories only, never to bashToolPatterns.
|
|
213
|
+
if (matchedPattern) {
|
|
214
|
+
const command = isToolCallEventType("bash", event) ? event.input.command : null;
|
|
215
|
+
const applies = (ex: Exemption) =>
|
|
216
|
+
ex.pattern === matchedPattern ||
|
|
217
|
+
(command !== null && command.includes(ex.pattern)) ||
|
|
218
|
+
inputPaths.some((p) => isPathMatch(resolvePath(p, ctx.cwd), ex.pattern, ctx.cwd));
|
|
219
|
+
const exempted = fileExemptionsFor(process.env[EXEMPTIONS_FILE_ENV], process.env[AGENT_ID_ENV]).find(applies);
|
|
220
|
+
if (exempted) {
|
|
221
|
+
pi.appendEntry("damage-control-log", { tool: event.toolName, input: event.input, rule: violationReason, action: "exempted", pattern: exempted.pattern, scope: exempted.scope });
|
|
222
|
+
ctx.ui.notify(`🛡️ Damage-Control: ${event.toolName} allowed by exemption ${exempted.pattern} (${exempted.scope})`);
|
|
223
|
+
return { block: false };
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (shouldAsk) {
|
|
228
|
+
const confirmed = await ctx.ui.confirm("🛡️ Damage-Control Confirmation", `Dangerous command detected: ${violationReason}\n\nCommand: ${isToolCallEventType("bash", event) ? event.input.command : JSON.stringify(event.input)}\n\nDo you want to proceed?`, { timeout: 30000 });
|
|
229
|
+
|
|
230
|
+
if (!confirmed) {
|
|
231
|
+
ctx.ui.setStatus(`⚠️ Last Violation Blocked: ${violationReason.slice(0, 30)}...`);
|
|
232
|
+
pi.appendEntry("damage-control-log", { tool: event.toolName, input: event.input, rule: violationReason, action: "blocked_by_user" });
|
|
233
|
+
ctx.abort();
|
|
234
|
+
return { block: true, reason: `🛑 BLOCKED by Damage-Control: ${violationReason} (User denied)\n\nDO NOT attempt to work around this restriction. DO NOT retry with alternative commands, paths, or approaches that achieve the same result. Report this block to the user exactly as stated and ask how they would like to proceed.` };
|
|
235
|
+
} else {
|
|
236
|
+
pi.appendEntry("damage-control-log", { tool: event.toolName, input: event.input, rule: violationReason, action: "confirmed_by_user" });
|
|
237
|
+
return { block: false };
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
ctx.ui.notify(`🛑 Damage-Control: Blocked ${event.toolName} due to ${violationReason}`);
|
|
241
|
+
ctx.ui.setStatus(`⚠️ Last Violation: ${violationReason.slice(0, 30)}...`);
|
|
242
|
+
pi.appendEntry("damage-control-log", { tool: event.toolName, input: event.input, rule: violationReason, action: "blocked" });
|
|
243
|
+
ctx.abort();
|
|
244
|
+
return { block: true, reason: `🛑 BLOCKED by Damage-Control: ${violationReason}\n\nDO NOT attempt to work around this restriction. DO NOT retry with alternative commands, paths, or approaches that achieve the same result. Report this block to the user exactly as stated and ask how they would like to proceed.` };
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return { block: false };
|
|
249
|
+
});
|
|
250
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared exemption + escalation plumbing for the damage-control harnesses.
|
|
3
|
+
*
|
|
4
|
+
* Exemptions are runtime, session-scoped allowances layered on top of
|
|
5
|
+
* `.pi/damage-control-rules.yaml` — they never edit the rules file and only
|
|
6
|
+
* ever apply to the path categories (zeroAccessPaths / readOnlyPaths /
|
|
7
|
+
* noDeletePaths), never to the destructive bashToolPatterns.
|
|
8
|
+
*
|
|
9
|
+
* Consumers:
|
|
10
|
+
* - damage-control-continue — full support: /allow command, block-time
|
|
11
|
+
* prompt in interactive sessions, escalation to the agent-hub dispatcher
|
|
12
|
+
* from headless children
|
|
13
|
+
* - damage-control (hard stop) — honors pre-granted exemptions from the
|
|
14
|
+
* shared file only; no prompting, no escalation
|
|
15
|
+
* - agent-hub — computes the shared file path, passes the env plumbing to
|
|
16
|
+
* spawned children, and answers access_request envelopes on its coms socket
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import * as fs from "fs";
|
|
20
|
+
import * as net from "net";
|
|
21
|
+
import * as os from "os";
|
|
22
|
+
import * as path from "path";
|
|
23
|
+
|
|
24
|
+
// Env plumbing agent-hub sets on spawned children. spawnPiAgent spreads
|
|
25
|
+
// process.env, so delegate grandchildren inherit these for free.
|
|
26
|
+
export const ASK_ENDPOINT_ENV = "AGENT_HUB_ASK_ENDPOINT";
|
|
27
|
+
export const EXEMPTIONS_FILE_ENV = "AGENT_HUB_EXEMPTIONS_FILE";
|
|
28
|
+
export const AGENT_ID_ENV = "AGENT_HUB_AGENT_ID";
|
|
29
|
+
|
|
30
|
+
export type ExemptionScope = "turn" | "session";
|
|
31
|
+
|
|
32
|
+
export interface Exemption {
|
|
33
|
+
/** The protected pattern being unlocked — same syntax as the rules file entries. */
|
|
34
|
+
pattern: string;
|
|
35
|
+
scope: ExemptionScope;
|
|
36
|
+
/** When set, the exemption applies only to the spawned agent with this id. */
|
|
37
|
+
agent?: string;
|
|
38
|
+
grantedVia: "command" | "prompt" | "escalation";
|
|
39
|
+
grantedAt: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ── shared exemptions file (one per hub session, read by spawned children) ──
|
|
43
|
+
|
|
44
|
+
export function exemptionsFilePath(sessionId: string): string {
|
|
45
|
+
const comsDir = process.env.PI_COMS_DIR || path.join(os.homedir(), ".pi", "coms");
|
|
46
|
+
return path.join(comsDir, "exemptions", `${sessionId}.json`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function readExemptionsFile(filePath: string | undefined): Exemption[] {
|
|
50
|
+
if (!filePath) return [];
|
|
51
|
+
try {
|
|
52
|
+
const parsed = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
53
|
+
if (!Array.isArray(parsed)) return [];
|
|
54
|
+
return parsed.filter((e): e is Exemption => !!e && typeof e.pattern === "string" && e.pattern.length > 0);
|
|
55
|
+
} catch {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Exemptions visible to one process: agent-agnostic entries plus those granted to `agentId`. */
|
|
61
|
+
export function fileExemptionsFor(filePath: string | undefined, agentId: string | undefined): Exemption[] {
|
|
62
|
+
return readExemptionsFile(filePath).filter((e) => !e.agent || e.agent === agentId);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function appendExemptionToFile(filePath: string, exemption: Exemption): void {
|
|
66
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
67
|
+
const existing = readExemptionsFile(filePath);
|
|
68
|
+
const dup = existing.some((e) => e.pattern === exemption.pattern && (e.agent ?? "") === (exemption.agent ?? ""));
|
|
69
|
+
if (!dup) existing.push(exemption);
|
|
70
|
+
const tmp = `${filePath}.tmp`;
|
|
71
|
+
fs.writeFileSync(tmp, JSON.stringify(existing, null, 2));
|
|
72
|
+
fs.renameSync(tmp, filePath);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Remove every entry for `pattern` (any agent). Returns true when something was removed. */
|
|
76
|
+
export function removeExemptionFromFile(filePath: string | undefined, pattern: string): boolean {
|
|
77
|
+
if (!filePath) return false;
|
|
78
|
+
const existing = readExemptionsFile(filePath);
|
|
79
|
+
const next = existing.filter((e) => e.pattern !== pattern);
|
|
80
|
+
if (next.length === existing.length) return false;
|
|
81
|
+
try {
|
|
82
|
+
const tmp = `${filePath}.tmp`;
|
|
83
|
+
fs.writeFileSync(tmp, JSON.stringify(next, null, 2));
|
|
84
|
+
fs.renameSync(tmp, filePath);
|
|
85
|
+
return true;
|
|
86
|
+
} catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// ── escalation protocol (headless child → hub dispatcher) ──
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Sent by a child's damage-control-continue to the hub's coms socket. Carries
|
|
95
|
+
* the Envelope base fields (sender_session = agent id, sender_endpoint = "")
|
|
96
|
+
* so the hub's isValidEnvelope accepts it.
|
|
97
|
+
*/
|
|
98
|
+
export interface AccessRequest {
|
|
99
|
+
type: "access_request";
|
|
100
|
+
msg_id: string;
|
|
101
|
+
sender_session: string;
|
|
102
|
+
sender_endpoint: string;
|
|
103
|
+
hops: number;
|
|
104
|
+
timestamp: string;
|
|
105
|
+
agent: string;
|
|
106
|
+
tool: string;
|
|
107
|
+
rule: string;
|
|
108
|
+
pattern: string;
|
|
109
|
+
invocation: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type AccessDecisionChoice = "deny" | "allow_once" | "allow_agent" | "allow_all";
|
|
113
|
+
|
|
114
|
+
export interface AccessDecision {
|
|
115
|
+
type: "access_decision";
|
|
116
|
+
msg_id: string;
|
|
117
|
+
decision: AccessDecisionChoice;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const ESCALATION_TIMEOUT_MS = Number(process.env.AGENT_HUB_ASK_TIMEOUT_MS) || 60_000;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Ask the hub to approve a blocked call. Synchronous over a single connection:
|
|
124
|
+
* the child has no socket server of its own, so the hub keeps this socket open
|
|
125
|
+
* and writes the decision line whenever the user answers. Resolves "timeout" /
|
|
126
|
+
* "error" instead of rejecting — callers always fail closed.
|
|
127
|
+
*/
|
|
128
|
+
export function requestAccessFromHub(
|
|
129
|
+
endpoint: string,
|
|
130
|
+
request: AccessRequest,
|
|
131
|
+
timeoutMs: number = ESCALATION_TIMEOUT_MS,
|
|
132
|
+
): Promise<AccessDecisionChoice | "timeout" | "error"> {
|
|
133
|
+
return new Promise((resolve) => {
|
|
134
|
+
let settled = false;
|
|
135
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
136
|
+
let sock: net.Socket;
|
|
137
|
+
const settle = (v: AccessDecisionChoice | "timeout" | "error") => {
|
|
138
|
+
if (settled) return;
|
|
139
|
+
settled = true;
|
|
140
|
+
if (timer) clearTimeout(timer);
|
|
141
|
+
try { sock.destroy(); } catch { /* ignore */ }
|
|
142
|
+
resolve(v);
|
|
143
|
+
};
|
|
144
|
+
try {
|
|
145
|
+
sock = net.createConnection({ path: endpoint });
|
|
146
|
+
} catch {
|
|
147
|
+
resolve("error");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
timer = setTimeout(() => settle("timeout"), timeoutMs);
|
|
151
|
+
let buf = "";
|
|
152
|
+
sock.on("connect", () => {
|
|
153
|
+
try {
|
|
154
|
+
sock.write(JSON.stringify(request) + "\n");
|
|
155
|
+
} catch {
|
|
156
|
+
settle("error");
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
sock.on("data", (chunk: Buffer) => {
|
|
160
|
+
buf += chunk.toString("utf-8");
|
|
161
|
+
const nl = buf.indexOf("\n");
|
|
162
|
+
if (nl < 0) return;
|
|
163
|
+
try {
|
|
164
|
+
const parsed = JSON.parse(buf.slice(0, nl));
|
|
165
|
+
if (
|
|
166
|
+
parsed &&
|
|
167
|
+
parsed.type === "access_decision" &&
|
|
168
|
+
(parsed.decision === "deny" || parsed.decision === "allow_once" ||
|
|
169
|
+
parsed.decision === "allow_agent" || parsed.decision === "allow_all")
|
|
170
|
+
) {
|
|
171
|
+
settle(parsed.decision);
|
|
172
|
+
} else {
|
|
173
|
+
// nack or unknown reply (e.g. an older hub without escalation support)
|
|
174
|
+
settle("error");
|
|
175
|
+
}
|
|
176
|
+
} catch {
|
|
177
|
+
settle("error");
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
sock.on("error", () => settle("error"));
|
|
181
|
+
sock.on("close", () => settle("error"));
|
|
182
|
+
});
|
|
183
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# damage-control-continue
|
|
2
|
+
|
|
3
|
+
Safety auditing — blocks destructive tool calls, but lets the agent **adapt and keep working**.
|
|
4
|
+
|
|
5
|
+
> Ported from [`pi-vs-claude-code`](https://github.com/disler/pi-vs-claude-code) by [disler](https://github.com/disler) (MIT). See the [extension catalog](../../../docs/pi-extensions.md).
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
Same rule engine as [`damage-control`](../damage-control/README.md) — it loads
|
|
10
|
+
`.pi/damage-control-rules.yaml` (`bashToolPatterns`, `zeroAccessPaths`,
|
|
11
|
+
`readOnlyPaths`, `noDeletePaths`) and checks every tool call against it.
|
|
12
|
+
|
|
13
|
+
The difference is what happens on a match:
|
|
14
|
+
|
|
15
|
+
- **`damage-control`** replaces the tool result with a block message **and calls
|
|
16
|
+
`ctx.abort()`**, ending the agent's turn (hard stop).
|
|
17
|
+
- **`damage-control-continue`** replaces the tool result with **actionable
|
|
18
|
+
feedback** that distinguishes destructive from non-destructive intent and tells
|
|
19
|
+
the agent how to adapt — and does **not** abort. The turn continues, so the
|
|
20
|
+
agent can recover (e.g. assume a `.env` key exists instead of reading it to
|
|
21
|
+
verify) instead of dead-ending.
|
|
22
|
+
|
|
23
|
+
By default both variants hard-block. The choice is whether the agent's turn dies
|
|
24
|
+
or keeps going — plus, in this variant, whether **you** let the call through via
|
|
25
|
+
exemptions (below).
|
|
26
|
+
|
|
27
|
+
## Exemptions — allow access per turn or per session
|
|
28
|
+
|
|
29
|
+
Runtime allowances layered on top of the rules file (which is never modified).
|
|
30
|
+
They apply to the **path categories only** — `zeroAccessPaths`, `readOnlyPaths`,
|
|
31
|
+
`noDeletePaths`. Destructive `bashToolPatterns` (`rm -rf`, `git push --force`,
|
|
32
|
+
`DROP TABLE`, …) can never be exempted.
|
|
33
|
+
|
|
34
|
+
**Pre-authorize** (when you know the agent will need it):
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
/allow .env # exempt for the rest of the session (default)
|
|
38
|
+
/allow .env turn # exempt until the end of the current/next turn
|
|
39
|
+
/allowed # list active exemptions
|
|
40
|
+
/revoke .env # remove an exemption
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Block-time dialog** (when you forgot): in an interactive session a path block
|
|
44
|
+
opens a selector — *Keep blocked / Allow once / Allow for this turn / Allow for
|
|
45
|
+
this session*. An approved call proceeds immediately (the agent never sees the
|
|
46
|
+
block); *Keep blocked* is remembered for the rest of the turn so the agent can't
|
|
47
|
+
re-prompt you; no answer within 60s fails closed.
|
|
48
|
+
|
|
49
|
+
**Escalation from headless children**: when this harness runs inside a subagent
|
|
50
|
+
spawned by agent-hub (no UI, `AGENT_HUB_ASK_ENDPOINT` set), a path block sends an
|
|
51
|
+
`access_request` to the hub's coms socket instead. The dispatcher session shows
|
|
52
|
+
who is asking, for what, and why it was blocked — *Deny / Allow once / Allow for
|
|
53
|
+
this agent / Allow for all agents (session)*. The child waits up to 60s and fails
|
|
54
|
+
closed on timeout; a late answer still lands in the shared exemptions file, so
|
|
55
|
+
the next attempt (from any child) passes. At most 3 escalations per child run;
|
|
56
|
+
denials are cached.
|
|
57
|
+
|
|
58
|
+
**Shared exemptions file**: agent-hub keeps one session-scoped file
|
|
59
|
+
(`~/.pi/coms/exemptions/<session>.json`, deleted on shutdown) and passes it to
|
|
60
|
+
every spawned child via `AGENT_HUB_EXEMPTIONS_FILE`. `/allow <pattern> session`
|
|
61
|
+
in the hub lands there, so it covers the whole team — including hard-stop
|
|
62
|
+
[`damage-control`](../damage-control/README.md) specialists, which honor the
|
|
63
|
+
file but never prompt or escalate. It is re-read on every block, so mid-session
|
|
64
|
+
grants reach already-running children. Everything (grants, revokes, escalation
|
|
65
|
+
outcomes) is logged to the `damage-control-log` session entries.
|
|
66
|
+
|
|
67
|
+
## When it's used (this repo)
|
|
68
|
+
|
|
69
|
+
`just hub` / `just hub-solo` load this variant for the **orchestrator/dispatcher
|
|
70
|
+
main session**, and the hub re-loads it into spawned **research helpers**
|
|
71
|
+
(`researcher` / `deep-researcher`) — both need to recover from a blocked read and
|
|
72
|
+
keep going rather than abort. Every other spawned specialist (builder,
|
|
73
|
+
test-engineer, …) keeps the hard-stop `damage-control` harness.
|
|
74
|
+
|
|
75
|
+
## Commands & tools
|
|
76
|
+
|
|
77
|
+
- `/allow <pattern> [turn|session]` — exempt a protected path pattern
|
|
78
|
+
- `/allowed` — list active exemptions
|
|
79
|
+
- `/revoke <pattern>` — remove an exemption
|
|
80
|
+
|
|
81
|
+
Blocking itself runs passively on the `tool_call` event.
|
|
82
|
+
|
|
83
|
+
## Requires
|
|
84
|
+
|
|
85
|
+
- `.pi/damage-control-rules.yaml` — the rule set (shipped in this repo)
|
|
86
|
+
- Optional, injected by agent-hub into spawned children: `AGENT_HUB_ASK_ENDPOINT`
|
|
87
|
+
(escalation socket), `AGENT_HUB_EXEMPTIONS_FILE` (shared grants),
|
|
88
|
+
`AGENT_HUB_AGENT_ID` (requester identity). Without them the harness behaves
|
|
89
|
+
standalone: dialog when a UI is present, plain block+feedback otherwise.
|
|
90
|
+
|
|
91
|
+
## Usage
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# standalone continue-mode guardrail session
|
|
95
|
+
just ext-damage-control-continue
|
|
96
|
+
pi -e .pi/harnesses/damage-control-continue/index.ts
|
|
97
|
+
|
|
98
|
+
# the hub recipes load this variant for the main agent by default
|
|
99
|
+
just hub
|
|
100
|
+
just hub-solo
|
|
101
|
+
|
|
102
|
+
# direct continue-guarded hub launch
|
|
103
|
+
pi -e .pi/harnesses/damage-control-continue/index.ts -e .pi/harnesses/agent-hub/index.ts
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Upstream changes
|
|
107
|
+
|
|
108
|
+
- Theme integration removed — the `themeMap.ts` import and the `applyExtensionDefaults()`
|
|
109
|
+
call were stripped (this repo does not ship pi themes).
|
|
110
|
+
- The `find` tool's `pattern` is matched against `zeroAccessPaths` (mirrors the
|
|
111
|
+
hardening in this repo's `damage-control`), closing a gap where `find` could
|
|
112
|
+
still locate secret files.
|
|
113
|
+
- Exemption layer added (not in upstream): `/allow`/`/allowed`/`/revoke`,
|
|
114
|
+
block-time approval dialog, and escalation from headless agent-hub children to
|
|
115
|
+
the dispatcher — see the Exemptions section above. Shared plumbing lives in
|
|
116
|
+
[`../damage-control/shared.ts`](../damage-control/shared.ts).
|