@tyroneross/build-loop 0.30.3
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/.agents/plugins/marketplace.json +10 -0
- package/.claude-plugin/marketplace.json +38 -0
- package/.claude-plugin/plugin.json +30 -0
- package/.codex-plugin/plugin.json +41 -0
- package/.cursor/rules/build-loop-surface.mdc +22 -0
- package/AGENTS.md +498 -0
- package/LICENSE +202 -0
- package/README.md +403 -0
- package/agents/alignment-checker.md +124 -0
- package/agents/api-assessor.md +136 -0
- package/agents/architecture-scout.md +185 -0
- package/agents/assessment-orchestrator.md +163 -0
- package/agents/build-orchestrator.md +198 -0
- package/agents/database-assessor.md +133 -0
- package/agents/design-contract-specialist.md +239 -0
- package/agents/fact-checker.md +69 -0
- package/agents/fix-critique.md +161 -0
- package/agents/frontend-assessor.md +136 -0
- package/agents/implementer.md +185 -0
- package/agents/independent-auditor.md +143 -0
- package/agents/mock-scanner.md +78 -0
- package/agents/optimize-runner.md +112 -0
- package/agents/overfitting-reviewer.md +96 -0
- package/agents/performance-assessor.md +159 -0
- package/agents/plan-critic.md +85 -0
- package/agents/promotion-reviewer.md +121 -0
- package/agents/recurring-pattern-detector.md +248 -0
- package/agents/retrospective-synthesizer.md +109 -0
- package/agents/root-cause-investigator.md +285 -0
- package/agents/scope-auditor.md +121 -0
- package/agents/security-reviewer.md +151 -0
- package/agents/self-improvement-architect.md +125 -0
- package/agents/synthesis-critic.md +99 -0
- package/agents/transcript-pattern-miner.md +165 -0
- package/agents/ui-validator.md +193 -0
- package/codex-skills/build-loop/SKILL.md +20 -0
- package/codex-skills/debug-loop/SKILL.md +18 -0
- package/codex-skills/handoff/SKILL.md +22 -0
- package/codex-skills/knowledge/SKILL.md +21 -0
- package/codex-skills/optimize/SKILL.md +18 -0
- package/codex-skills/research/SKILL.md +18 -0
- package/commands/agent-rally-point.md +301 -0
- package/commands/assess.md +41 -0
- package/commands/debug.md +20 -0
- package/commands/debugger-detail.md +34 -0
- package/commands/debugger-scan.md +15 -0
- package/commands/debugger-status.md +20 -0
- package/commands/debugger.md +32 -0
- package/commands/handoff.md +113 -0
- package/commands/knowledge-review.md +16 -0
- package/commands/optimize.md +31 -0
- package/commands/plan-verify.md +39 -0
- package/commands/promote-experiment.md +129 -0
- package/commands/research.md +22 -0
- package/commands/run.md +12 -0
- package/commands/self-review.md +51 -0
- package/commands/start-prd.md +57 -0
- package/commands/test.md +34 -0
- package/dist/src/assessment-orchestrator.d.ts +78 -0
- package/dist/src/assessment-orchestrator.d.ts.map +1 -0
- package/dist/src/assessment-orchestrator.js +304 -0
- package/dist/src/assessment-orchestrator.js.map +1 -0
- package/dist/src/audit-miner.d.ts +21 -0
- package/dist/src/audit-miner.d.ts.map +1 -0
- package/dist/src/audit-miner.js +421 -0
- package/dist/src/audit-miner.js.map +1 -0
- package/dist/src/batch-operations.d.ts +30 -0
- package/dist/src/batch-operations.d.ts.map +1 -0
- package/dist/src/batch-operations.js +339 -0
- package/dist/src/batch-operations.js.map +1 -0
- package/dist/src/config.d.ts +83 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +176 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context-engine.d.ts +45 -0
- package/dist/src/context-engine.d.ts.map +1 -0
- package/dist/src/context-engine.js +135 -0
- package/dist/src/context-engine.js.map +1 -0
- package/dist/src/debug-wrapper.d.ts +58 -0
- package/dist/src/debug-wrapper.d.ts.map +1 -0
- package/dist/src/debug-wrapper.js +285 -0
- package/dist/src/debug-wrapper.js.map +1 -0
- package/dist/src/index.d.ts +31 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +149 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interactive-verifier.d.ts +26 -0
- package/dist/src/interactive-verifier.d.ts.map +1 -0
- package/dist/src/interactive-verifier.js +435 -0
- package/dist/src/interactive-verifier.js.map +1 -0
- package/dist/src/lessons.d.ts +59 -0
- package/dist/src/lessons.d.ts.map +1 -0
- package/dist/src/lessons.js +172 -0
- package/dist/src/lessons.js.map +1 -0
- package/dist/src/log-reader.d.ts +39 -0
- package/dist/src/log-reader.d.ts.map +1 -0
- package/dist/src/log-reader.js +291 -0
- package/dist/src/log-reader.js.map +1 -0
- package/dist/src/logger.d.ts +59 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/logger.js +328 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/parallel-retrieval.d.ts +52 -0
- package/dist/src/parallel-retrieval.d.ts.map +1 -0
- package/dist/src/parallel-retrieval.js +309 -0
- package/dist/src/parallel-retrieval.js.map +1 -0
- package/dist/src/pattern-extractor.d.ts +30 -0
- package/dist/src/pattern-extractor.d.ts.map +1 -0
- package/dist/src/pattern-extractor.js +386 -0
- package/dist/src/pattern-extractor.js.map +1 -0
- package/dist/src/result-aggregator.d.ts +44 -0
- package/dist/src/result-aggregator.d.ts.map +1 -0
- package/dist/src/result-aggregator.js +315 -0
- package/dist/src/result-aggregator.js.map +1 -0
- package/dist/src/retrieval.d.ts +139 -0
- package/dist/src/retrieval.d.ts.map +1 -0
- package/dist/src/retrieval.js +724 -0
- package/dist/src/retrieval.js.map +1 -0
- package/dist/src/setup/auto-setup.d.ts +15 -0
- package/dist/src/setup/auto-setup.d.ts.map +1 -0
- package/dist/src/setup/auto-setup.js +157 -0
- package/dist/src/setup/auto-setup.js.map +1 -0
- package/dist/src/setup/configure-hooks.d.ts +8 -0
- package/dist/src/setup/configure-hooks.d.ts.map +1 -0
- package/dist/src/setup/configure-hooks.js +16 -0
- package/dist/src/setup/configure-hooks.js.map +1 -0
- package/dist/src/setup/create-slash-commands.d.ts +8 -0
- package/dist/src/setup/create-slash-commands.d.ts.map +1 -0
- package/dist/src/setup/create-slash-commands.js +101 -0
- package/dist/src/setup/create-slash-commands.js.map +1 -0
- package/dist/src/setup/index.d.ts +8 -0
- package/dist/src/setup/index.d.ts.map +1 -0
- package/dist/src/setup/index.js +17 -0
- package/dist/src/setup/index.js.map +1 -0
- package/dist/src/setup/inject-claude-md.d.ts +10 -0
- package/dist/src/setup/inject-claude-md.d.ts.map +1 -0
- package/dist/src/setup/inject-claude-md.js +150 -0
- package/dist/src/setup/inject-claude-md.js.map +1 -0
- package/dist/src/setup/uninstall.d.ts +22 -0
- package/dist/src/setup/uninstall.d.ts.map +1 -0
- package/dist/src/setup/uninstall.js +235 -0
- package/dist/src/setup/uninstall.js.map +1 -0
- package/dist/src/storage.d.ts +192 -0
- package/dist/src/storage.d.ts.map +1 -0
- package/dist/src/storage.js +1037 -0
- package/dist/src/storage.js.map +1 -0
- package/dist/src/string-similarity.d.ts +8 -0
- package/dist/src/string-similarity.d.ts.map +1 -0
- package/dist/src/string-similarity.js +57 -0
- package/dist/src/string-similarity.js.map +1 -0
- package/dist/src/traces/adapters/browser.d.ts +69 -0
- package/dist/src/traces/adapters/browser.d.ts.map +1 -0
- package/dist/src/traces/adapters/browser.js +280 -0
- package/dist/src/traces/adapters/browser.js.map +1 -0
- package/dist/src/traces/adapters/index.d.ts +23 -0
- package/dist/src/traces/adapters/index.d.ts.map +1 -0
- package/dist/src/traces/adapters/index.js +67 -0
- package/dist/src/traces/adapters/index.js.map +1 -0
- package/dist/src/traces/adapters/langchain.d.ts +42 -0
- package/dist/src/traces/adapters/langchain.d.ts.map +1 -0
- package/dist/src/traces/adapters/langchain.js +151 -0
- package/dist/src/traces/adapters/langchain.js.map +1 -0
- package/dist/src/traces/adapters/opentelemetry.d.ts +46 -0
- package/dist/src/traces/adapters/opentelemetry.d.ts.map +1 -0
- package/dist/src/traces/adapters/opentelemetry.js +164 -0
- package/dist/src/traces/adapters/opentelemetry.js.map +1 -0
- package/dist/src/traces/adapters/sentry.d.ts +58 -0
- package/dist/src/traces/adapters/sentry.d.ts.map +1 -0
- package/dist/src/traces/adapters/sentry.js +212 -0
- package/dist/src/traces/adapters/sentry.js.map +1 -0
- package/dist/src/traces/index.d.ts +10 -0
- package/dist/src/traces/index.d.ts.map +1 -0
- package/dist/src/traces/index.js +45 -0
- package/dist/src/traces/index.js.map +1 -0
- package/dist/src/traces/storage.d.ts +78 -0
- package/dist/src/traces/storage.d.ts.map +1 -0
- package/dist/src/traces/storage.js +399 -0
- package/dist/src/traces/storage.js.map +1 -0
- package/dist/src/traces/summarizer.d.ts +83 -0
- package/dist/src/traces/summarizer.d.ts.map +1 -0
- package/dist/src/traces/summarizer.js +247 -0
- package/dist/src/traces/summarizer.js.map +1 -0
- package/dist/src/traces/types.d.ts +365 -0
- package/dist/src/traces/types.d.ts.map +1 -0
- package/dist/src/traces/types.js +14 -0
- package/dist/src/traces/types.js.map +1 -0
- package/dist/src/types.d.ts +495 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +27 -0
- package/dist/src/types.js.map +1 -0
- package/docs/agent-surface-policy.md +45 -0
- package/docs/memory-setup.md +226 -0
- package/hooks/_arch_scan_bg.py +88 -0
- package/hooks/_plugin_drift_check_bg.py +85 -0
- package/hooks/_session_start_lib.sh +42 -0
- package/hooks/git/pre-push +141 -0
- package/hooks/hooks.json +126 -0
- package/hooks/post-commit +30 -0
- package/hooks/pre-commit +29 -0
- package/hooks/pre-edit-apppulse.sh +6 -0
- package/hooks/pre-edit-architecture.sh +106 -0
- package/hooks/pre-edit-rally-point.sh +92 -0
- package/hooks/session-start-apppulse.sh +6 -0
- package/hooks/session-start-architecture.sh +10 -0
- package/hooks/session-start-git-hooks.sh +12 -0
- package/hooks/session-start-plugin-drift.sh +27 -0
- package/hooks/session-start-rally-point.sh +44 -0
- package/hooks/session-start-retrieval.sh +24 -0
- package/hooks/session-start-worktree-gc.sh +105 -0
- package/hooks/test_apppulse_hooks.sh +6 -0
- package/hooks/test_rally_point_hooks.sh +388 -0
- package/hooks/test_sec008_hooks.sh +66 -0
- package/package.json +111 -0
- package/scripts/README.md +301 -0
- package/scripts/_db_url.py +61 -0
- package/scripts/_paths.py +445 -0
- package/scripts/blm.py +162 -0
- package/scripts/blm_api.py +263 -0
- package/scripts/check_cache_sync.py +490 -0
- package/scripts/embed_backend.py +475 -0
- package/scripts/install_memory.py +556 -0
- package/scripts/lessons_index/__init__.py +77 -0
- package/scripts/lessons_index/__main__.py +135 -0
- package/scripts/lessons_index/ingest.py +288 -0
- package/scripts/lessons_index/query.py +285 -0
- package/scripts/lessons_index/schema.py +114 -0
- package/scripts/memory_context/__init__.py +610 -0
- package/scripts/memory_graph/__init__.py +393 -0
- package/scripts/project_resolver.py +172 -0
- package/scripts/prune_codex_plugin_cache.py +23 -0
- package/scripts/prune_plugin_cache.py +359 -0
- package/scripts/semantic_index/__init__.py +482 -0
- package/scripts/semantic_index/_bench_hybrid.py +175 -0
- package/scripts/semantic_index/backfill.py +263 -0
- package/scripts/semantic_index/hybrid.py +174 -0
- package/scripts/semantic_index/test_backfill.py +292 -0
- package/scripts/semantic_index/test_hybrid.py +541 -0
- package/scripts/sync_navgator_lessons.py +666 -0
- package/scripts/sync_plugin_cache.py +388 -0
- package/skills/agent-rally-point/SKILL.md +165 -0
- package/skills/agent-rally-watcher/SKILL.md +83 -0
- package/skills/api-registry-bridge/SKILL.md +59 -0
- package/skills/architecture/dead/SKILL.md +56 -0
- package/skills/architecture/impact/SKILL.md +88 -0
- package/skills/architecture/review/SKILL.md +227 -0
- package/skills/architecture/rules/SKILL.md +72 -0
- package/skills/architecture/scan/SKILL.md +79 -0
- package/skills/architecture/trace/SKILL.md +65 -0
- package/skills/attribution-standard/SKILL.md +122 -0
- package/skills/authentication/SKILL.md +81 -0
- package/skills/authentication/references/better-auth-magic-link.md +135 -0
- package/skills/authentication/references/better-auth-setup.md +224 -0
- package/skills/authentication/references/google-calendar-sync.md +278 -0
- package/skills/authentication/references/google-cloud-console.md +159 -0
- package/skills/authentication/references/google-geocoding-directions.md +126 -0
- package/skills/authentication/references/google-lessons-example-web-app.md +177 -0
- package/skills/authentication/references/google-maps.md +162 -0
- package/skills/authentication/references/google-oauth-setup.md +343 -0
- package/skills/authentication/references/google-places.md +173 -0
- package/skills/authentication/references/lessons-example-web-app-better-auth.md +126 -0
- package/skills/authentication/references/resend-email.md +227 -0
- package/skills/authentication/references/resend-otp-magic-link.md +153 -0
- package/skills/authentication/references/supabase-auth.md +172 -0
- package/skills/auto-decision-capture/SKILL.md +419 -0
- package/skills/build-loop/SKILL.md +516 -0
- package/skills/build-loop/detect-plugins.mjs +82 -0
- package/skills/build-loop/eval-guide.md +65 -0
- package/skills/build-loop/fallbacks.md +549 -0
- package/skills/build-loop/phases/fact-check.md +42 -0
- package/skills/build-loop/phases/ui-validation.md +267 -0
- package/skills/build-loop/references/apple-native-planning.md +439 -0
- package/skills/build-loop/references/capability-routing.md +181 -0
- package/skills/build-loop/references/codex-subagents.md +98 -0
- package/skills/build-loop/references/coordination.md +161 -0
- package/skills/build-loop/references/correction-aware-capture.md +177 -0
- package/skills/build-loop/references/independent-auditor.md +72 -0
- package/skills/build-loop/references/intent-capability-pack.md +170 -0
- package/skills/build-loop/references/intent-exploration-prompts.md +96 -0
- package/skills/build-loop/references/leadership.md +72 -0
- package/skills/build-loop/references/memory.md +284 -0
- package/skills/build-loop/references/modular-systems-pack.md +96 -0
- package/skills/build-loop/references/output-style.md +129 -0
- package/skills/build-loop/references/pay-it-forward-arch.md +98 -0
- package/skills/build-loop/references/phase-1-assess.md +218 -0
- package/skills/build-loop/references/phase-2-plan.md +77 -0
- package/skills/build-loop/references/phase-3-execute.md +47 -0
- package/skills/build-loop/references/phase-4-review.md +310 -0
- package/skills/build-loop/references/phase-5-iterate.md +71 -0
- package/skills/build-loop/references/phase-6-learn.md +56 -0
- package/skills/build-loop/references/recent-design-structures.md +274 -0
- package/skills/build-loop/references/refactor-history/ASSESSMENT.md +85 -0
- package/skills/build-loop/references/refactor-history/STANDALONE_TEST_RUN.md +149 -0
- package/skills/build-loop/references/refactor-history/scenarios/01-simple-bugfix.md +32 -0
- package/skills/build-loop/references/refactor-history/scenarios/02-ui-build-with-iteration.md +48 -0
- package/skills/build-loop/references/refactor-history/scenarios/03-multi-failure-escalation.md +60 -0
- package/skills/build-loop/references/refactor-history/scenarios/04-ui-build-ibr-absent.md +51 -0
- package/skills/build-loop/references/refactor-history/scenarios/05-refactor-navgator-absent.md +71 -0
- package/skills/build-loop/references/refactor-history/scenarios/06-recurring-bug-debugger-absent.md +52 -0
- package/skills/build-loop/references/refactor-history/trace-comparison.md +202 -0
- package/skills/build-loop/references/self-recursive-dev.md +77 -0
- package/skills/build-loop/references/self-review.md +232 -0
- package/skills/build-loop/references/ui-io-contract.md +116 -0
- package/skills/build-loop/scanners/audit-design-rules.mjs +476 -0
- package/skills/build-loop/scanners/require-visual-evidence.mjs +239 -0
- package/skills/build-loop/templates/backlog-item.md +35 -0
- package/skills/build-loop/templates/codex-worker-prompt.md +89 -0
- package/skills/build-loop/templates/ui-subagent-prompt.md +179 -0
- package/skills/build-loop/templates/ux-fix-plan.md +40 -0
- package/skills/building-with-deepagents/SKILL.md +195 -0
- package/skills/building-with-deepagents/references/anti-patterns.md +141 -0
- package/skills/building-with-deepagents/references/api-quick-reference.md +184 -0
- package/skills/capabilities/SKILL.md +91 -0
- package/skills/debug-loop/SKILL.md +278 -0
- package/skills/debug-loop/references/convergence-rules.md +145 -0
- package/skills/debug-loop/references/swiftui-macos-clunky-ui-debugger.html +823 -0
- package/skills/debugging/assess/SKILL.md +111 -0
- package/skills/debugging/debug-loop/SKILL.md +231 -0
- package/skills/debugging/memory/SKILL.md +147 -0
- package/skills/debugging/store/SKILL.md +153 -0
- package/skills/debugging-memory/SKILL.md +440 -0
- package/skills/debugging-memory/examples/incident-example.json +67 -0
- package/skills/debugging-memory/references/incident-documentation.md +280 -0
- package/skills/debugging-memory/references/ios-notification-alarm-playbook.md +300 -0
- package/skills/debugging-memory/references/pattern-extraction.md +163 -0
- package/skills/debugging-memory/references/subagent-integration.md +312 -0
- package/skills/defenseclaw-bridge/SKILL.md +156 -0
- package/skills/defenseclaw-bridge/references/dc-config-mapping.md +162 -0
- package/skills/defenseclaw-bridge/references/output-format.md +108 -0
- package/skills/handoff/SKILL.md +94 -0
- package/skills/ibr-bridge/SKILL.md +68 -0
- package/skills/knowledge/SKILL.md +127 -0
- package/skills/knowledge/references/recall-integration.md +83 -0
- package/skills/knowledge/templates/madr-minimal.md +56 -0
- package/skills/knowledge-review/SKILL.md +112 -0
- package/skills/logging-tracer/SKILL.md +202 -0
- package/skills/logging-tracer/references/log-analysis.md +128 -0
- package/skills/logging-tracer/references/stack-templates.md +274 -0
- package/skills/logging-tracer-bridge/SKILL.md +70 -0
- package/skills/mcp-builder/SKILL.md +278 -0
- package/skills/mcp-builder/references/mcp-security.md +106 -0
- package/skills/model-tiering/SKILL.md +216 -0
- package/skills/native-ax-driver/SKILL.md +220 -0
- package/skills/native-ax-driver/scripts/layout_fill.py +222 -0
- package/skills/native-ax-driver/scripts/native_driver.py +495 -0
- package/skills/native-ax-driver/swift/bl-ax-driver/Package.swift +20 -0
- package/skills/native-ax-driver/swift/bl-ax-driver/Sources/main.swift +542 -0
- package/skills/optimize/SKILL.md +202 -0
- package/skills/optimize/profiles.md +61 -0
- package/skills/plan-verify/SKILL.md +115 -0
- package/skills/plan-verify/test-fixtures/example-app-v20-findings.json +27 -0
- package/skills/plan-verify/test-fixtures/example-app-v20.md +42 -0
- package/skills/plan-verify/test-fixtures/example-app-v22-findings.json +15 -0
- package/skills/plan-verify/test-fixtures/example-app-v22.md +1608 -0
- package/skills/plan-verify/test-fixtures/unrelated-good-plan-findings.json +15 -0
- package/skills/plan-verify/test-fixtures/unrelated-good-plan.md +55 -0
- package/skills/plugin-builder/SKILL.md +329 -0
- package/skills/plugin-builder/references/authoritative-sources.md +104 -0
- package/skills/plugin-builder/references/build-loop-phase-guidance.md +94 -0
- package/skills/plugin-builder/references/components-guide.md +221 -0
- package/skills/plugin-builder/references/distribution.md +317 -0
- package/skills/plugin-builder/references/dual-host-claude-codex.md +220 -0
- package/skills/plugin-builder/references/hooks-reference.md +210 -0
- package/skills/plugin-builder/references/manifest-schema.md +111 -0
- package/skills/plugin-builder/references/plugin-hygiene-lessons.md +307 -0
- package/skills/plugin-tests/SKILL.md +94 -0
- package/skills/prd-bridge/SKILL.md +135 -0
- package/skills/research/SKILL.md +80 -0
- package/skills/security-methodology/SKILL.md +105 -0
- package/skills/security-methodology/references/cross-source-matrix.md +77 -0
- package/skills/security-methodology/references/mitre-atlas-starter.md +83 -0
- package/skills/security-methodology/references/nist-600-1-mapping.md +119 -0
- package/skills/security-methodology/references/owasp-agentic-top-10.md +157 -0
- package/skills/security-methodology/references/owasp-llm-top-10.md +144 -0
- package/skills/security-methodology/references/owasp-web-top-10.md +65 -0
- package/skills/self-improve/SKILL.md +298 -0
- package/skills/spec-writing/SKILL.md +548 -0
- package/skills/spec-writing/scripts/check_checklist.py +478 -0
- package/skills/sync-skills/SKILL.md +132 -0
- package/skills/telemetry/SKILL.md +66 -0
- package/skills/ui-design/SKILL.md +75 -0
- package/skills/ui-design/references/design-patterns-multi.md +165 -0
- package/skills/ui-design/references/design-preferences-from-owned-apps.md +150 -0
- package/skills/ui-design/references/evidence-capture-policy.md +55 -0
- package/skills/ui-design/references/ui-guidance-sources.md +330 -0
- package/skills/ui-design/references/universal-design-principles.alt.md +182 -0
- package/skills/ui-design/references/universal-design-principles.md +419 -0
- package/templates/memory/MEMORY.md.template +55 -0
- package/templates/memory/constitution.md.template +64 -0
- package/templates/memory/manifest.json +47 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
|
|
3
|
+
# Pattern Extraction Guide
|
|
4
|
+
|
|
5
|
+
Patterns are reusable solution templates automatically extracted from similar incidents.
|
|
6
|
+
|
|
7
|
+
## What Are Patterns?
|
|
8
|
+
|
|
9
|
+
When 3+ incidents share similar symptoms and fixes, the memory system can extract a pattern. Patterns represent proven solutions with higher confidence than individual incidents.
|
|
10
|
+
|
|
11
|
+
**Pattern vs Incident:**
|
|
12
|
+
| Aspect | Incident | Pattern |
|
|
13
|
+
|--------|----------|---------|
|
|
14
|
+
| Source | Single debugging session | Multiple similar incidents |
|
|
15
|
+
| Confidence | Variable (0.5-0.95) | High (0.9+) |
|
|
16
|
+
| Reusability | Context-specific | Generalized |
|
|
17
|
+
| Priority | Lower in search | First checked |
|
|
18
|
+
|
|
19
|
+
## Pattern Structure
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"pattern_id": "PTN_REACT_HOOKS_DEPENDENCY",
|
|
24
|
+
"name": "React Hook Dependency Array Fix",
|
|
25
|
+
"description": "Fixes issues caused by unstable references in React hook dependency arrays",
|
|
26
|
+
"detection_signature": [
|
|
27
|
+
"infinite render",
|
|
28
|
+
"useEffect loop",
|
|
29
|
+
"useMemo dependency",
|
|
30
|
+
"useCallback",
|
|
31
|
+
"re-render",
|
|
32
|
+
"reference unstable"
|
|
33
|
+
],
|
|
34
|
+
"applicable_to": ["coder", "refactorer"],
|
|
35
|
+
"solution_template": "1. Identify the hook with unstable dependencies\n2. Wrap callbacks in useCallback\n3. Wrap computed values in useMemo\n4. Update dependency arrays with stable references",
|
|
36
|
+
"code_example": "// Before: unstable callback\nuseEffect(() => {...}, [callback]);\n\n// After: stable callback\nconst stableCallback = useCallback(callback, [deps]);\nuseEffect(() => {...}, [stableCallback]);",
|
|
37
|
+
"tags": ["react", "hooks", "performance", "useEffect", "useMemo", "useCallback"],
|
|
38
|
+
"related_patterns": ["PTN_REACT_STATE_BATCHING"],
|
|
39
|
+
"success_rate": 0.92,
|
|
40
|
+
"usage_history": {
|
|
41
|
+
"total_uses": 15,
|
|
42
|
+
"successful_uses": 14,
|
|
43
|
+
"by_agent": {"coder": 12, "refactorer": 3},
|
|
44
|
+
"recent_incidents": ["INC_20241220_...", "INC_20241218_..."]
|
|
45
|
+
},
|
|
46
|
+
"caveats": [
|
|
47
|
+
"May not apply if the callback intentionally needs fresh closure",
|
|
48
|
+
"Consider whether memoization overhead is worth it for simple callbacks"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Automatic Extraction
|
|
54
|
+
|
|
55
|
+
Patterns are extracted automatically when conditions are met:
|
|
56
|
+
|
|
57
|
+
### Extraction Criteria
|
|
58
|
+
|
|
59
|
+
1. **Minimum incidents**: 3+ similar incidents required
|
|
60
|
+
2. **Similarity threshold**: 70%+ symptom similarity
|
|
61
|
+
3. **Fix consistency**: Similar approaches across incidents
|
|
62
|
+
4. **Success rate**: Fixes verified as working
|
|
63
|
+
|
|
64
|
+
### Triggering Extraction
|
|
65
|
+
|
|
66
|
+
Use build-loop's native incident notes to preview and extract patterns.
|
|
67
|
+
|
|
68
|
+
Local workflow:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
find .build-loop/issues -type f -name '*.md' 2>/dev/null
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Standalone Coding Debugger can provide richer pattern APIs when explicitly installed and requested. Programmatic examples should import that package from the standalone repo, not from build-loop.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { extractPatterns } from '<coding-debugger-package>';
|
|
78
|
+
|
|
79
|
+
const patterns = await extractPatterns({
|
|
80
|
+
min_incidents: 3,
|
|
81
|
+
min_similarity: 0.7,
|
|
82
|
+
auto_store: true
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Pattern Matching
|
|
87
|
+
|
|
88
|
+
During debugging, patterns are checked first:
|
|
89
|
+
|
|
90
|
+
1. System extracts keywords from symptom
|
|
91
|
+
2. Matches against `detection_signature` of all patterns
|
|
92
|
+
3. Patterns with 90%+ match are presented first
|
|
93
|
+
4. If no pattern matches, falls back to incident search
|
|
94
|
+
|
|
95
|
+
## Using Patterns
|
|
96
|
+
|
|
97
|
+
When a pattern matches your bug:
|
|
98
|
+
|
|
99
|
+
### 1. Review the Pattern
|
|
100
|
+
|
|
101
|
+
Check:
|
|
102
|
+
- `description`: Does it match your situation?
|
|
103
|
+
- `solution_template`: Understand the approach
|
|
104
|
+
- `caveats`: Note any limitations
|
|
105
|
+
|
|
106
|
+
### 2. Apply the Solution
|
|
107
|
+
|
|
108
|
+
Follow the `solution_template` steps:
|
|
109
|
+
- Adapt for your specific codebase
|
|
110
|
+
- Use `code_example` as reference
|
|
111
|
+
- Check `related_patterns` for additional context
|
|
112
|
+
|
|
113
|
+
### 3. Verify
|
|
114
|
+
|
|
115
|
+
- Confirm the fix works
|
|
116
|
+
- Run relevant tests
|
|
117
|
+
- The incident still gets stored, linked to the pattern
|
|
118
|
+
|
|
119
|
+
## Pattern Quality
|
|
120
|
+
|
|
121
|
+
Patterns track their own reliability:
|
|
122
|
+
|
|
123
|
+
- **success_rate**: Percentage of successful applications
|
|
124
|
+
- **usage_history**: How often used, by which agents
|
|
125
|
+
- **recent_incidents**: Links to incidents that used this pattern
|
|
126
|
+
|
|
127
|
+
Low success rate patterns may indicate:
|
|
128
|
+
- Over-generalized pattern
|
|
129
|
+
- Context-dependent solution
|
|
130
|
+
- Need for refinement or splitting
|
|
131
|
+
|
|
132
|
+
## Creating Patterns Manually
|
|
133
|
+
|
|
134
|
+
While automatic extraction is preferred, create patterns manually for well-understood solutions:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { storePattern } from '<coding-debugger-package>';
|
|
138
|
+
|
|
139
|
+
await storePattern({
|
|
140
|
+
pattern_id: 'PTN_CATEGORY_NAME',
|
|
141
|
+
name: 'Human Readable Name',
|
|
142
|
+
description: 'What this pattern solves',
|
|
143
|
+
detection_signature: ['keyword1', 'keyword2'],
|
|
144
|
+
applicable_to: ['coder'],
|
|
145
|
+
solution_template: 'Step-by-step approach',
|
|
146
|
+
tags: ['tag1', 'tag2'],
|
|
147
|
+
success_rate: 1.0,
|
|
148
|
+
usage_history: {
|
|
149
|
+
total_uses: 0,
|
|
150
|
+
successful_uses: 0,
|
|
151
|
+
by_agent: {},
|
|
152
|
+
recent_incidents: []
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Best Practices
|
|
158
|
+
|
|
159
|
+
1. **Let extraction happen naturally** - Don't force patterns from few incidents
|
|
160
|
+
2. **Review extracted patterns** - Ensure they generalize well
|
|
161
|
+
3. **Update caveats** - Add warnings when patterns fail
|
|
162
|
+
4. **Monitor success rates** - Refine patterns with low success
|
|
163
|
+
5. **Split over-broad patterns** - If a pattern covers too many cases, split it
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
|
|
3
|
+
# Subagent Integration Guide
|
|
4
|
+
|
|
5
|
+
This guide explains how to integrate build-loop native debugging memory with custom subagents, third-party agents, and multi-agent workflows.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
The debugging memory system works best when all agents in a workflow can access it. However, not all subagents have the necessary tool access. This guide covers:
|
|
10
|
+
|
|
11
|
+
1. How to give subagents direct access
|
|
12
|
+
2. How to proxy debugging memory for restricted agents
|
|
13
|
+
3. How to coordinate multiple debugging agents
|
|
14
|
+
4. How to handle limitations transparently
|
|
15
|
+
|
|
16
|
+
## Direct Integration
|
|
17
|
+
|
|
18
|
+
### Requirements
|
|
19
|
+
|
|
20
|
+
For a subagent to directly access debugging memory, it needs **one of**:
|
|
21
|
+
|
|
22
|
+
| Access Method | When to Use | Tools Needed |
|
|
23
|
+
|---------------|-------------|--------------|
|
|
24
|
+
| **MCP tools** (preferred) | Agent runs within Claude Code plugin context | MCP tool access |
|
|
25
|
+
| **CLI fallback** | Agent only has Bash, no MCP access | `Bash` |
|
|
26
|
+
| **Proxy** | Agent has no direct access | None (parent pre-queries) |
|
|
27
|
+
|
|
28
|
+
### Direct Integration via MCP (Preferred)
|
|
29
|
+
|
|
30
|
+
When the debugger plugin is installed, agents can call MCP tools directly:
|
|
31
|
+
|
|
32
|
+
- `debugger search` — search past incidents by symptom
|
|
33
|
+
- `debugger detail` — get full incident details
|
|
34
|
+
- `debugger store` — store new incidents
|
|
35
|
+
- `debugger patterns` — view extracted patterns
|
|
36
|
+
|
|
37
|
+
### CLI Fallback for Restricted Agents
|
|
38
|
+
|
|
39
|
+
For agents that only have Bash access (no MCP), use CLI commands:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
---
|
|
43
|
+
name: my-debugging-agent
|
|
44
|
+
description: Custom debugging agent with memory access
|
|
45
|
+
tools: ["Bash", "Read", "Grep"]
|
|
46
|
+
---
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Add this to the agent's system prompt:
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
## Debugging Memory
|
|
53
|
+
|
|
54
|
+
This project uses build-loop native debugging memory.
|
|
55
|
+
|
|
56
|
+
**Before investigating any bug:**
|
|
57
|
+
\`\`\`
|
|
58
|
+
Skill("build-loop:debugging-memory-search") with input { symptom: "<symptom description>" }
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
**Interpret results:**
|
|
62
|
+
- High confidence (>70%): Apply documented fix directly
|
|
63
|
+
- Medium confidence (40-70%): Use as investigation starting point
|
|
64
|
+
- Low/no match (<40%): Investigate fresh, document afterward
|
|
65
|
+
|
|
66
|
+
**After fixing a bug:**
|
|
67
|
+
Write an incident note to `.build-loop/issues/INC_YYYYMMDD_HHMMSS_xxxx.md`
|
|
68
|
+
|
|
69
|
+
This ensures fixes are remembered for future similar issues.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
> Note: pass memory context from the parent when the subagent lacks direct skill or filesystem access.
|
|
73
|
+
|
|
74
|
+
## Proxy Integration
|
|
75
|
+
|
|
76
|
+
When subagents cannot directly access debugging memory (no Bash tool, sandboxed, external MCP), use proxy integration.
|
|
77
|
+
|
|
78
|
+
### Pre-Query Pattern
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
1. Parent agent searches memory
|
|
82
|
+
2. Parent includes results in subagent prompt
|
|
83
|
+
3. Subagent investigates with context
|
|
84
|
+
4. Parent stores any new findings
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Implementation
|
|
88
|
+
|
|
89
|
+
**Step 1: Search before spawning**
|
|
90
|
+
|
|
91
|
+
Use `build-loop:debugging-memory-search` with the symptom description. If the subagent cannot invoke skills, the parent reads `.build-loop/issues/` and passes compact matches:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Skill("build-loop:debugging-memory-search") with input { symptom: "user login failing with 401" }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Step 2: Format context for subagent**
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
DEBUGGING MEMORY CONTEXT:
|
|
101
|
+
|
|
102
|
+
Similar incidents found (2):
|
|
103
|
+
1. INC_20241215_auth_401 (confidence: 0.82)
|
|
104
|
+
- Symptom: 401 errors after token refresh
|
|
105
|
+
- Root cause: Token expiry check using wrong timezone
|
|
106
|
+
- Fix: Use UTC for all token comparisons
|
|
107
|
+
|
|
108
|
+
2. INC_20241201_login_fail (confidence: 0.65)
|
|
109
|
+
- Symptom: Intermittent login failures
|
|
110
|
+
- Root cause: Race condition in session creation
|
|
111
|
+
- Fix: Add mutex lock around session write
|
|
112
|
+
|
|
113
|
+
Relevant pattern: PTN_auth_token_issues
|
|
114
|
+
- Common causes: timezone mismatch, clock skew, token format changes
|
|
115
|
+
- Recommended: Check token generation and validation code paths
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Step 3: Include in subagent prompt**
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Investigate the 401 error on user login.
|
|
122
|
+
|
|
123
|
+
[DEBUGGING MEMORY CONTEXT from above]
|
|
124
|
+
|
|
125
|
+
Given this prior knowledge, focus your investigation on:
|
|
126
|
+
1. Token handling differences from past incidents
|
|
127
|
+
2. Any recent changes to auth code
|
|
128
|
+
3. New causes not covered by past incidents
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Step 4: Store new findings**
|
|
132
|
+
|
|
133
|
+
After subagent completes, if new root cause discovered, write incident JSON:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
mkdir -p .claude/memory/incidents
|
|
137
|
+
# Then write JSON file: .claude/memory/incidents/INC_YYYYMMDD_HHMMSS_xxxx.json
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
See `skills/debugging-memory/examples/incident-example.json` for full schema.
|
|
141
|
+
|
|
142
|
+
## Multi-Agent Coordination
|
|
143
|
+
|
|
144
|
+
### Parallel Assessment Pattern
|
|
145
|
+
|
|
146
|
+
When multiple domain-specific agents investigate simultaneously:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
┌─────────────────────────────────────────────────────┐
|
|
150
|
+
│ Parent Agent │
|
|
151
|
+
│ 1. Search memory once │
|
|
152
|
+
│ 2. Spawn assessors with relevant context │
|
|
153
|
+
└──────────┬──────────┬──────────┬──────────┬────────┘
|
|
154
|
+
│ │ │ │
|
|
155
|
+
▼ ▼ ▼ ▼
|
|
156
|
+
┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐
|
|
157
|
+
│Database│ │Frontend│ │ API │ │ Perf │
|
|
158
|
+
│Assessor│ │Assessor│ │Assessor│ │Assessor│
|
|
159
|
+
└────┬───┘ └────┬───┘ └────┬───┘ └────┬───┘
|
|
160
|
+
│ │ │ │
|
|
161
|
+
└──────────┴──────────┴──────────┘
|
|
162
|
+
│
|
|
163
|
+
▼
|
|
164
|
+
┌───────────────────────┐
|
|
165
|
+
│ Aggregate Results │
|
|
166
|
+
│ Store Unified Fix │
|
|
167
|
+
└───────────────────────┘
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Context Distribution
|
|
171
|
+
|
|
172
|
+
Give each assessor only relevant context:
|
|
173
|
+
|
|
174
|
+
```javascript
|
|
175
|
+
// Pseudo-code for context distribution
|
|
176
|
+
const memoryResults = searchMemory(symptom);
|
|
177
|
+
|
|
178
|
+
const dbContext = memoryResults.filter(i =>
|
|
179
|
+
i.tags.some(t => ['database', 'prisma', 'sql', 'query'].includes(t))
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
const apiContext = memoryResults.filter(i =>
|
|
183
|
+
i.tags.some(t => ['api', 'endpoint', 'auth', 'middleware'].includes(t))
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
// Spawn with filtered context
|
|
187
|
+
spawnAgent('database-assessor', { context: dbContext });
|
|
188
|
+
spawnAgent('api-assessor', { context: apiContext });
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Result Aggregation
|
|
192
|
+
|
|
193
|
+
After all assessors complete:
|
|
194
|
+
|
|
195
|
+
1. Rank by confidence score
|
|
196
|
+
2. Identify consensus (multiple agents pointing to same area)
|
|
197
|
+
3. Note conflicts for user decision
|
|
198
|
+
4. Store unified incident with attribution
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"symptom": "App slow and returning wrong search results",
|
|
203
|
+
"diagnosis": {
|
|
204
|
+
"primary": {
|
|
205
|
+
"domain": "database",
|
|
206
|
+
"confidence": 0.85,
|
|
207
|
+
"assessor": "database-assessor",
|
|
208
|
+
"cause": "Missing index on search column"
|
|
209
|
+
},
|
|
210
|
+
"secondary": {
|
|
211
|
+
"domain": "api",
|
|
212
|
+
"confidence": 0.45,
|
|
213
|
+
"assessor": "api-assessor",
|
|
214
|
+
"cause": "Possible caching issue"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"recommended_sequence": [
|
|
218
|
+
"Add index to search column",
|
|
219
|
+
"Monitor performance",
|
|
220
|
+
"Investigate caching if still slow"
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Handling Limitations
|
|
226
|
+
|
|
227
|
+
### Detection
|
|
228
|
+
|
|
229
|
+
Identify when debugging memory cannot be fully utilized:
|
|
230
|
+
|
|
231
|
+
| Scenario | Detection | Action |
|
|
232
|
+
|----------|-----------|--------|
|
|
233
|
+
| No Bash tool | Check agent tool list | Use proxy pattern |
|
|
234
|
+
| External MCP | Agent uses MCP tools | Pre-query and inject |
|
|
235
|
+
| Third-party agent | Not in project agents/ | Inform user |
|
|
236
|
+
| Sandboxed | Environment restrictions | Pre-query and inject |
|
|
237
|
+
|
|
238
|
+
### User Communication Templates
|
|
239
|
+
|
|
240
|
+
**When using proxy integration:**
|
|
241
|
+
```
|
|
242
|
+
Note: I'm searching debugging memory before spawning the subagent,
|
|
243
|
+
as it doesn't have direct access. Found [X] relevant incidents
|
|
244
|
+
that I'll include in its investigation context.
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**When no integration possible:**
|
|
248
|
+
```
|
|
249
|
+
Note: The [agent-name] agent cannot access this project's debugging
|
|
250
|
+
memory. I recommend running `/debugger "<symptom>"` first to check
|
|
251
|
+
for similar past issues before proceeding.
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**When third-party agent used:**
|
|
255
|
+
```
|
|
256
|
+
Note: This third-party debugging tool operates independently of your
|
|
257
|
+
project's debugging memory. After it completes, consider documenting
|
|
258
|
+
any new findings with `/debugger-scan` to capture this session.
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Best Practices
|
|
262
|
+
|
|
263
|
+
1. **Always pre-query for restricted agents** - Don't let knowledge gaps form
|
|
264
|
+
|
|
265
|
+
2. **Include confidence scores** - Help subagents calibrate their investigation depth
|
|
266
|
+
|
|
267
|
+
3. **Attribute findings** - Track which agent discovered what for learning
|
|
268
|
+
|
|
269
|
+
4. **Store unified incidents** - One incident per bug, not one per agent
|
|
270
|
+
|
|
271
|
+
5. **Be transparent** - Always inform users when memory access is limited
|
|
272
|
+
|
|
273
|
+
6. **Use tags consistently** - Enable effective context filtering
|
|
274
|
+
|
|
275
|
+
7. **Document proxy patterns** - Note in incidents when proxy integration was used
|
|
276
|
+
|
|
277
|
+
## Example: Complete Multi-Agent Flow
|
|
278
|
+
|
|
279
|
+
```markdown
|
|
280
|
+
User: "The checkout is broken - showing wrong totals and timing out"
|
|
281
|
+
|
|
282
|
+
Claude Code:
|
|
283
|
+
1. Searches memory via `debugger search` MCP tool: "checkout wrong totals timeout"
|
|
284
|
+
- Found: INC_20241210_checkout_math (confidence: 0.72)
|
|
285
|
+
- Found: PTN_timeout_database (confidence: 0.58)
|
|
286
|
+
|
|
287
|
+
2. Spawns parallel assessors:
|
|
288
|
+
- database-assessor: receives timeout pattern context
|
|
289
|
+
- api-assessor: receives both contexts
|
|
290
|
+
- frontend-assessor: receives math incident context
|
|
291
|
+
|
|
292
|
+
3. Informs user:
|
|
293
|
+
"Checking debugging memory... Found 1 similar incident and 1 relevant pattern.
|
|
294
|
+
Running parallel assessment across database, API, and frontend domains."
|
|
295
|
+
|
|
296
|
+
4. Aggregates results:
|
|
297
|
+
- database-assessor: 0.80 confidence - slow cart total query
|
|
298
|
+
- api-assessor: 0.45 confidence - possible middleware timeout
|
|
299
|
+
- frontend-assessor: 0.70 confidence - floating point rounding
|
|
300
|
+
|
|
301
|
+
5. Reports:
|
|
302
|
+
"Assessment complete. Primary issue: database query for cart totals
|
|
303
|
+
(0.80 confidence). Secondary: frontend rounding display (0.70).
|
|
304
|
+
This matches past incident INC_20241210_checkout_math.
|
|
305
|
+
|
|
306
|
+
Recommended fix sequence:
|
|
307
|
+
1. Optimize cart total query (add index)
|
|
308
|
+
2. Fix frontend decimal display
|
|
309
|
+
3. Increase API timeout as buffer"
|
|
310
|
+
|
|
311
|
+
6. After fix, stores unified incident with all findings
|
|
312
|
+
```
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-loop:defenseclaw-bridge
|
|
3
|
+
description: Use when the user is working on the defenseclaw project and build-loop's Phase 1 detects defenseclaw-specific files (CLAUDE.md indicates the bridge target). Bridges build-loop's orchestrator to defenseclaw's eval/test conventions; otherwise no-op.
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
user-invocable: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
9
|
+
|
|
10
|
+
# DefenseClaw Bridge
|
|
11
|
+
|
|
12
|
+
Lets build-loop emit a runtime-security spec that downstream operators can hand to Cisco DefenseClaw (`github.com/cisco-ai-defense/defenseclaw`) — Apache 2.0, the cleanest production-shape implementation of the **Govern / Inspect / Prove** operational pattern. This bridge **only writes spec**; it does not run scanners, does not install the gateway sidecar, does not produce TypeScript plugins.
|
|
13
|
+
|
|
14
|
+
## Cherry-pick principle
|
|
15
|
+
|
|
16
|
+
**DefenseClaw remains an independent tool and repository.** This bridge does not embed, install, or run DefenseClaw — it only writes config files DefenseClaw consumes:
|
|
17
|
+
|
|
18
|
+
- Reads the project's `tool-contract.md`, `agent-manifest.md`, `guardrail.md`, `system-boundary.md`, `flow-topology.md`, `role-card.md` artifacts (when present).
|
|
19
|
+
- Reads the build-loop security canon — `skills/security-methodology/references/cross-source-matrix.md`.
|
|
20
|
+
- Writes to `<project>/.defenseclaw/generated/` — bridge's own namespace; never touches DefenseClaw runtime state if DefenseClaw is also installed in the project.
|
|
21
|
+
|
|
22
|
+
What this bridge does NOT do:
|
|
23
|
+
|
|
24
|
+
- Run DefenseClaw scanners, gateway, sandbox, or any other DefenseClaw component.
|
|
25
|
+
- Install DefenseClaw or its dependencies.
|
|
26
|
+
- Test the generated config end-to-end.
|
|
27
|
+
- Block the build if DefenseClaw is not installed — this skill only writes spec; whether the project adopts DefenseClaw is a separate decision.
|
|
28
|
+
- Generate a working enforcement layer. The output is a spec skeleton with placeholder rule-pack entries; production use requires the project's security team to fill in concrete patterns and policies.
|
|
29
|
+
|
|
30
|
+
## When to load
|
|
31
|
+
|
|
32
|
+
- **Auto-loaded** by the build-orchestrator after Phase 3 Execute when *any* of the following artifacts exist or were modified during the build:
|
|
33
|
+
- `*tool-contract*.md`
|
|
34
|
+
- `*agent-manifest*.md`
|
|
35
|
+
- `*guardrail*.md`
|
|
36
|
+
- `*system-boundary*.md`
|
|
37
|
+
- `*flow-topology*.md`
|
|
38
|
+
- `*role-card*.md`
|
|
39
|
+
(Filename-glob match; the artifacts come from the agent-builder template set.)
|
|
40
|
+
- **User-invocable** standalone: ask "generate the DefenseClaw spec from this manifest", "what runtime guardrails would map to these tool contracts", or invoke `Skill("build-loop:defenseclaw-bridge")` directly.
|
|
41
|
+
|
|
42
|
+
## Inputs
|
|
43
|
+
|
|
44
|
+
| Input | Source | Used for |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `tool-contract.md` (one or more) | project filesystem | Per-tool scanner profile + permission-tier policy + Rego rule stub |
|
|
47
|
+
| `agent-manifest.md` | project filesystem | Top-level dc-config sinks, modes, audit retention; risk-coverage attestation block |
|
|
48
|
+
| `guardrail.md` (one or more) | project filesystem | Inspect rule-pack entries — pre-call / post-call / in-tool gates |
|
|
49
|
+
| `system-boundary.md` | project filesystem | OpenShell sandbox profile (in-scope vs out-of-scope tasks → allowed vs blocked surfaces) |
|
|
50
|
+
| `flow-topology.md` | project filesystem | A2A trust map (which agent can hand off to which); flagged when ASI07 row is hit |
|
|
51
|
+
| `role-card.md` (one or more) | project filesystem | Per-role admission-control config (which scanners apply to which agent's allowed tools) |
|
|
52
|
+
| `cross-source-matrix.md` | `skills/security-methodology/references/` | Risk → DefenseClaw control column lookup |
|
|
53
|
+
| `dc-config-mapping.md` | `references/` (this skill) | Field-by-field mapping from each agent-builder template to DefenseClaw config |
|
|
54
|
+
| `output-format.md` | `references/` (this skill) | Output file layout, naming, where each artifact lands |
|
|
55
|
+
|
|
56
|
+
If the agent-builder plugin is not installed, the skill still works as long as the project's filesystem has files matching the glob patterns above. Filename matching (not plugin presence) is the trigger.
|
|
57
|
+
|
|
58
|
+
## Outputs
|
|
59
|
+
|
|
60
|
+
Written to `<project>/.defenseclaw/generated/`:
|
|
61
|
+
|
|
62
|
+
| File | Purpose |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `dc-config.yaml` | Top-level DefenseClaw config skeleton: sinks (audit, OTLP, SQLite path), modes (observe vs action), retention. |
|
|
65
|
+
| `scanner-profile.yaml` | Govern pillar — admission scanner profiles, one per tool / MCP server / skill listed in the agent manifest. |
|
|
66
|
+
| `policies/<name>.rego` (multiple) | OPA Rego policy stubs, one per tool contract, encoding the permission-tier and approval rules. |
|
|
67
|
+
| `rule-packs/inspect.yaml` | Inspect pillar — pre-call and post-call rule-pack entries, one per guardrail in `guardrail.md`. |
|
|
68
|
+
| `suppressions.yaml` | Template suppression list — empty by default, with comments explaining when to add entries. |
|
|
69
|
+
| `README.md` | Generated explanation of which artifacts produced which config rows, plus open-questions/limitations. |
|
|
70
|
+
|
|
71
|
+
The generated files are skeletons: structurally valid, with placeholder rule patterns and explicit `TODO:` markers where project-specific policy must be filled in by the security team.
|
|
72
|
+
|
|
73
|
+
## Pre-flight
|
|
74
|
+
|
|
75
|
+
Before generating, this skill checks:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Look for any agent-builder-style artifact in the project
|
|
79
|
+
find . -maxdepth 4 -type f \( \
|
|
80
|
+
-iname '*tool-contract*.md' -o \
|
|
81
|
+
-iname '*agent-manifest*.md' -o \
|
|
82
|
+
-iname '*guardrail*.md' -o \
|
|
83
|
+
-iname '*system-boundary*.md' -o \
|
|
84
|
+
-iname '*flow-topology*.md' -o \
|
|
85
|
+
-iname '*role-card*.md' \
|
|
86
|
+
\) 2>/dev/null | head -20
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If no artifacts are found, this skill emits a one-line note and exits cleanly — generating an empty DefenseClaw spec is worse than not generating one.
|
|
90
|
+
|
|
91
|
+
If artifacts exist, read each, then walk `references/dc-config-mapping.md` row by row to populate the output files.
|
|
92
|
+
|
|
93
|
+
## Steps
|
|
94
|
+
|
|
95
|
+
1. **Load** `references/dc-config-mapping.md` and `references/output-format.md`. Also load `skills/security-methodology/references/cross-source-matrix.md` from the sibling skill.
|
|
96
|
+
2. **Inventory** the project's agent-builder artifacts (filenames matched by the glob above). Group by template type: tool-contracts, manifests, guardrails, system-boundary, flow-topology, role-cards.
|
|
97
|
+
3. **Parse each artifact**. Use a minimal YAML parser for the `yaml` blocks; for narrative-only artifacts, fall back to grep against the documented section headers (Risk control matrix, Permission tier reference, etc.).
|
|
98
|
+
4. **Generate top-level `dc-config.yaml`** from the agent-manifest's `observability:`, `deployment:`, and (if present) `security_posture:` blocks. Default sinks: SQLite at `.defenseclaw/audit.sqlite`, JSONL at `.defenseclaw/audit.jsonl`. Default mode: `observe` (log only) — operators flip to `action` (block) only after tuning.
|
|
99
|
+
5. **Generate `scanner-profile.yaml`** by walking each tool in the manifest's `tools:` block, looking up its `permission_tier` from the matching tool-contract, and mapping to the Govern column of the cross-source matrix. T0–T2 tools get a minimal scanner profile (read-only checks); T3–T5 get the full CodeGuard-equivalent set (secrets, dangerous exec, unsafe deserialization, weak crypto, injection patterns, risky file access).
|
|
100
|
+
6. **Generate one `policies/<tool-name>.rego` per tool contract**. Each Rego stub encodes: who is allowed to call (`allowed_agents`), what arguments are accepted (input schema), what's forbidden (`forbidden_actions`), and the approval gate (`requires_human_approval`). Stubs are syntactically valid OPA but contain `TODO:` markers where the project must add concrete predicates (e.g., "what counts as a high-impact write to this resource").
|
|
101
|
+
7. **Generate `rule-packs/inspect.yaml`** by walking each guardrail. Each guardrail's `trigger`, `check`, `action`, `severity` → an Inspect rule entry with `lifecycle_phase` (pre-call / post-call / in-tool / post-handoff) inferred from the guardrail's `applies_to` and `mode` (observe / action) inherited from the top-level config.
|
|
102
|
+
8. **Generate `suppressions.yaml`** as an empty stub with documentation comments.
|
|
103
|
+
9. **Generate `README.md`** that lists which input artifact produced which output row, names the open questions and `TODO:` markers, and points operators at the source matrix.
|
|
104
|
+
10. **Write everything to `<project>/.defenseclaw/generated/`**, creating the directory if needed. Never overwrite a non-`generated/` path. Never touch any existing `.defenseclaw/audit.sqlite` or other DefenseClaw runtime state.
|
|
105
|
+
|
|
106
|
+
## Generated YAML / JSON validity
|
|
107
|
+
|
|
108
|
+
All generated YAML files must:
|
|
109
|
+
|
|
110
|
+
- Parse with `python3 -c "import yaml; yaml.safe_load(open(path))"` (assuming PyYAML is available; otherwise use any YAML 1.1 parser).
|
|
111
|
+
- Validate against DefenseClaw's documented config schema where applicable (DefenseClaw publishes JSON Schema for `dc-config.yaml`; check `https://github.com/cisco-ai-defense/defenseclaw` for the current schema URL — version drift is real, prefer the schema URL pinned at canon-write time over training-data assumption).
|
|
112
|
+
- Open with a `# Generated by build-loop:defenseclaw-bridge` comment naming the input artifacts.
|
|
113
|
+
|
|
114
|
+
OPA Rego stubs must:
|
|
115
|
+
|
|
116
|
+
- Parse with `opa parse` (when OPA is available locally; not required for the spec to be valid, only nice-to-have).
|
|
117
|
+
- Use the package convention `defenseclaw.tools.<tool_name>`.
|
|
118
|
+
- Include explicit `default allow = false` so a missing rule denies rather than allows.
|
|
119
|
+
|
|
120
|
+
## What this bridge does NOT generate
|
|
121
|
+
|
|
122
|
+
- Working rule patterns. Every Rego rule and every Inspect rule-pack entry has `TODO:` placeholders where the project's security team fills in concrete predicates.
|
|
123
|
+
- Sandbox configuration for OpenShell (DefenseClaw's Linux sandbox). The system-boundary template is too coarse to drive sandbox config; the bridge writes a TODO pointing at the relevant DefenseClaw doc.
|
|
124
|
+
- Provider auth headers (`X-DC-Target-URL`, `X-AI-Auth`, `X-DC-Auth`). Those are runtime config, not spec; the bridge writes a `TODO:` block with placeholders.
|
|
125
|
+
- LLM-judge configuration. DefenseClaw supports an optional LLM-as-judge layer on top of regex rule packs; whether to enable it is a project decision, not a spec generation.
|
|
126
|
+
|
|
127
|
+
## Coverage gaps (spec-level)
|
|
128
|
+
|
|
129
|
+
The bridge does not fully cover:
|
|
130
|
+
|
|
131
|
+
- **ASI07 (Insecure Inter-Agent Communication)**. The cross-source matrix marks this row `(gap)`; no clean DefenseClaw control. The bridge surfaces this as a `TODO: ASI07 — A2A trust model is project-specific; consider message signing + nonces; DefenseClaw does not provide a built-in solution.` in the generated `README.md`.
|
|
132
|
+
- **NIST policy-level risk areas (CBRN, Environmental, IP, Obscene, Violent)**. These are not engineering surfaces; bridge does not generate config for them.
|
|
133
|
+
- **Bias / homogenization**. Project-specific eval; no DefenseClaw analog.
|
|
134
|
+
|
|
135
|
+
## Standalone fallback
|
|
136
|
+
|
|
137
|
+
If `references/dc-config-mapping.md` or the security-methodology cross-source matrix are missing (skill installed corrupt or partially), the bridge does not silently degrade. It emits:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
defenseclaw-bridge: missing reference file <path>. Cannot generate DefenseClaw spec without the mapping. Reinstall the security-methodology skill or fall back to writing the DefenseClaw config by hand from `https://github.com/cisco-ai-defense/defenseclaw`.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
…and exits without writing partial output.
|
|
144
|
+
|
|
145
|
+
## Limitations
|
|
146
|
+
|
|
147
|
+
- ⚠️ DefenseClaw config schema evolves. The mapping file in `references/dc-config-mapping.md` is pinned to the schema as of canon-write time. Operators deploying to a newer DefenseClaw should validate the generated spec against the current schema before running.
|
|
148
|
+
- ⚠️ The bridge's input is template-shaped; if a project uses a different agent-spec format (e.g., raw YAML in a single file, custom agent registry), the bridge will not match. Custom-format support is out of scope; reformat to agent-builder templates first.
|
|
149
|
+
- ⚠️ The mapping is **lossy**. Some agent-builder fields don't have a DefenseClaw analog (autonomy_level, north_star_metric, deactivation procedure); those fields are referenced in the generated `README.md` for context but don't drive any config row.
|
|
150
|
+
- ❓ The "DefenseClaw publishes JSON Schema for dc-config.yaml" claim in the validity section is based on the repo at canon-write time; if the schema has been removed or relocated upstream, the bridge will fail validity checks gracefully (warn, don't error) and let operators inspect.
|
|
151
|
+
|
|
152
|
+
## Related references
|
|
153
|
+
|
|
154
|
+
- `~/dev/research/topics/product-dev/product-dev.agentic-systems-security-references.md` — the security canon citing DefenseClaw as a T1 reference implementation, plus the three-pillar Govern / Inspect / Prove model.
|
|
155
|
+
- `~/dev/research/topics/product-dev/product-dev.agentic-systems-original-synthesis.md` — recommends adding DefenseClaw to the agent-builder catalog as the security-governance reference architecture.
|
|
156
|
+
- `https://github.com/cisco-ai-defense/defenseclaw` — DefenseClaw repo. Apache 2.0. Cisco-backed.
|