@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,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: building-with-deepagents
|
|
3
|
+
description: Use when building or refactoring an agent that imports OSS `deepagents` (`from deepagents import create_deep_agent`). Covers SubAgent API, middleware, tool scoping, streaming, checkpointing. Not for `.claude/agents/*.md`.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
8
|
+
|
|
9
|
+
# Building With DeepAgents (OSS)
|
|
10
|
+
|
|
11
|
+
This skill is for agents running on the open-source `deepagents` package (`pip install deepagents`) on top of LangChain / LangGraph, typically paired with a local model via `langchain-ollama`. It is **not** for the hosted LangChain/DeepAgents cloud product — if you find yourself reaching for LangSmith Platform or hosted subagents, stop: those features don't apply here. Prefer Arize Phoenix (self-hosted, OpenInference instrumentation) for observability in OSS deployments.
|
|
12
|
+
|
|
13
|
+
Read this skill **before** writing or modifying code that calls `create_deep_agent`, defines agent "roles", or streams LangGraph events.
|
|
14
|
+
|
|
15
|
+
## When this applies
|
|
16
|
+
|
|
17
|
+
Triggers (check any):
|
|
18
|
+
- Project imports `deepagents` (grep `from deepagents`)
|
|
19
|
+
- Project has a multi-role agent concept (planner / researcher / writer / etc.)
|
|
20
|
+
- Work touches tool binding, system prompts, focus/single-agent mode, or streaming of an existing DeepAgents app
|
|
21
|
+
- Pain report mentions: tool-call hallucinations, "silent thinking" gaps, focus-mode prompt injection, per-agent model routing
|
|
22
|
+
|
|
23
|
+
## Authoritative sources
|
|
24
|
+
|
|
25
|
+
Read these in order when you need more detail than this skill:
|
|
26
|
+
|
|
27
|
+
1. `references/api-quick-reference.md` — the `SubAgent` TypedDict, `create_deep_agent()` signature, middleware stack, cached on disk
|
|
28
|
+
2. `references/anti-patterns.md` — concrete bugs we've hit and what DeepAgents does / doesn't prevent
|
|
29
|
+
3. **Live source** — the installed package is always ground truth. Find it with:
|
|
30
|
+
```bash
|
|
31
|
+
python3 -c "import deepagents; print(deepagents.__file__)"
|
|
32
|
+
```
|
|
33
|
+
Read `graph.py` (the assembly logic) and `middleware/subagents.py` (the `SubAgent` TypedDict + dispatch).
|
|
34
|
+
4. **GitHub**: `https://github.com/langchain-ai/deepagents` — CHANGELOG for recent middleware additions
|
|
35
|
+
5. **LangGraph docs**: `https://langchain-ai.github.io/langgraph/` — streaming modes, checkpointing, interrupts. DeepAgents is a thin wrapper over LangGraph.
|
|
36
|
+
6. **Context7 MCP**: `mcp__plugin_context7_context7__resolve-library-id("deepagents")` for on-demand doc lookups during build.
|
|
37
|
+
|
|
38
|
+
## Core principles
|
|
39
|
+
|
|
40
|
+
### Principle 1 — Per-subagent tool scoping is the hallucination fix
|
|
41
|
+
|
|
42
|
+
Small local models (< 14B) emit fabricated tool-call namespaces when given a large flat tool set for a prompt that needs none (e.g. `repo_browser.write_todos` when only `write_todos` was requested). The canonical fix is **not** validation after the fact — it's restricting each subagent's tool surface so the model has fewer options to invent against.
|
|
43
|
+
|
|
44
|
+
**Do**: pass `subagents=[{"name": "planner", "tools": [], ...}]` so the Planner only sees DeepAgents' built-in middleware tools.
|
|
45
|
+
**Don't**: pass a single flat `tools=[...]` list and inject "You are the X agent" in the system prompt.
|
|
46
|
+
|
|
47
|
+
Evidence: `middleware/subagents.py:65` — the `SubAgent["tools"]` field; `middleware/subagents.py:347` — per-subagent tool resolution falling back to `default_tools` if unspecified.
|
|
48
|
+
|
|
49
|
+
### Principle 2 — The middleware stack is always-on; treat it as free
|
|
50
|
+
|
|
51
|
+
DeepAgents injects by default (see `graph.py:192-260`):
|
|
52
|
+
- `TodoListMiddleware` → provides `write_todos`
|
|
53
|
+
- `FilesystemMiddleware` → `ls`, `read_file`, `write_file`, `edit_file`, `glob`, `grep`
|
|
54
|
+
- `SummarizationMiddleware` → automatic context-window pruning
|
|
55
|
+
- `PatchToolCallsMiddleware` → cleans up orphaned tool calls (missing `ToolMessage`)
|
|
56
|
+
- `SubAgentMiddleware` → the `task` tool for main-agent delegation
|
|
57
|
+
|
|
58
|
+
You do NOT need to re-implement any of these. If you wrote your own summarization, thread-storage loader, or orphan-tool-call cleanup before finding this skill — delete it.
|
|
59
|
+
|
|
60
|
+
### Principle 3 — Focus mode = scoped main agent, NOT prompt injection
|
|
61
|
+
|
|
62
|
+
"Single-agent" or "focus" mode (user pins one role, skips delegation) should be implemented by:
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
# Focus mode: main agent IS the role.
|
|
66
|
+
agent = create_deep_agent(
|
|
67
|
+
model=role_model,
|
|
68
|
+
tools=scoped_tools, # only the role's allow-list
|
|
69
|
+
system_prompt=role_prompt, # the role's system_focus verbatim
|
|
70
|
+
subagents=[], # no delegation — no `task` tool
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Not by appending `"\n\n## Single-Agent Mode\n\nYou are the X agent..."` to a shared system prompt. The prompt-injection approach leaves the full flat tool surface accessible, which is exactly the hallucination failure mode Principle 1 addresses.
|
|
75
|
+
|
|
76
|
+
### Principle 4 — Keep local optimizations that DeepAgents doesn't cover
|
|
77
|
+
|
|
78
|
+
DeepAgents is agnostic to:
|
|
79
|
+
- Local-model cold-load (no Ollama awareness). Keep your warmup + heartbeat code.
|
|
80
|
+
- SSE transport to a UI. DeepAgents emits LangGraph events; you still wire the HTTP.
|
|
81
|
+
- Fast-path routing for trivial prompts. As of v0.4.x there is no "skip the graph" concept; future `middleware` additions could change this — re-check the changelog before removing a fast-path layer.
|
|
82
|
+
- Tool-name validation as a defensive layer. DeepAgents' `PatchToolCallsMiddleware` only handles orphaned `ToolMessage`, not invalid tool names.
|
|
83
|
+
|
|
84
|
+
Don't delete these when migrating to DeepAgents' native features. They solve different problems.
|
|
85
|
+
|
|
86
|
+
## The `SubAgent` spec — quick reference
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from deepagents import create_deep_agent
|
|
90
|
+
from deepagents.middleware.subagents import SubAgent # TypedDict
|
|
91
|
+
|
|
92
|
+
subagent: SubAgent = {
|
|
93
|
+
"name": "researcher", # required
|
|
94
|
+
"description": "Gathers web + file info",# required — main agent reads this to decide when to delegate
|
|
95
|
+
"system_prompt": "You are RESEARCHER...",# required
|
|
96
|
+
"tools": [web_search, scrape_url, ...], # optional — if omitted, inherits main agent's tools
|
|
97
|
+
"model": "provider:model-name", # optional — per-agent model routing
|
|
98
|
+
"skills": ["/path/to/skills/"], # optional — markdown skills injection
|
|
99
|
+
"interrupt_on": {"dangerous_tool": True},# optional — human-in-the-loop
|
|
100
|
+
"permissions": [...], # optional — FilesystemPermission rules
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
agent = create_deep_agent(
|
|
104
|
+
model=main_model,
|
|
105
|
+
tools=[...], # main agent's tools (subagents have their own)
|
|
106
|
+
system_prompt="...",
|
|
107
|
+
subagents=[subagent], # ONE or more; ordering matters for main-agent selection
|
|
108
|
+
checkpointer=..., # pass a real Checkpointer, not MemorySaver, for durable threads
|
|
109
|
+
)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Recommended checkpointer
|
|
113
|
+
|
|
114
|
+
`MemorySaver` is volatile — threads vanish on restart. Use `SqliteSaver` for local apps:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from langgraph.checkpoint.sqlite import SqliteSaver
|
|
118
|
+
checkpointer = SqliteSaver.from_conn_string(".app/checkpoints.db")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Durable threads + resume-from-checkpoint come for free. You do not need a custom `threads.py` loader.
|
|
122
|
+
|
|
123
|
+
## Streaming — match the UI's needs
|
|
124
|
+
|
|
125
|
+
DeepAgents exposes LangGraph's stream API verbatim. Pick the mode based on what the UI consumes:
|
|
126
|
+
|
|
127
|
+
| Mode | Emits | Good for |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `"updates"` | Node outputs (messages list) on each step | Tool-event-level UI (our current bridge) |
|
|
130
|
+
| `"messages"` | Token-by-token from the LLM node | Chat UI with per-token streaming |
|
|
131
|
+
| `["updates", "messages"]` | Both | The usual answer — tool events **and** tokens |
|
|
132
|
+
| `astream_events(version="v2")` | Typed `on_tool_start`, `on_chat_model_stream`, etc. | Clean disambiguation without message-sniffing |
|
|
133
|
+
|
|
134
|
+
If your current SSE loop does `hasattr(msg, "tool_calls")` or `msg.type == "tool"` branching, consider `astream_events` instead — cleaner event types, forward-compatible.
|
|
135
|
+
|
|
136
|
+
## Local model gotchas
|
|
137
|
+
|
|
138
|
+
When paired with `langchain-ollama`:
|
|
139
|
+
|
|
140
|
+
1. **Always set a read timeout** — default is infinite (`None`). A hung model blocks the UI forever:
|
|
141
|
+
```python
|
|
142
|
+
ChatOllama(model=..., client_kwargs={"timeout": httpx.Timeout(connect=5, read=600, write=30, pool=5)})
|
|
143
|
+
```
|
|
144
|
+
2. **Add `.with_retry()`** for transient `httpx.TransportError` — common when a model is hot-unloaded mid-turn:
|
|
145
|
+
```python
|
|
146
|
+
llm.with_retry(stop_after_attempt=2, wait_exponential_jitter=True,
|
|
147
|
+
retry_if_exception_type=(httpx.TransportError, httpx.TimeoutException))
|
|
148
|
+
```
|
|
149
|
+
3. **`num_ctx` is sticky** — changing it between calls triggers full KV-cache re-allocation in Ollama. Pick one per role, don't vary.
|
|
150
|
+
4. **Parallel tool calls are serialized** by Ollama's OpenAI-compat endpoint even when the flag is set. Don't prompt the model to "call tools in parallel."
|
|
151
|
+
5. **Structured output (`format: json`) conflicts with tool calling** — use one or the other per turn.
|
|
152
|
+
|
|
153
|
+
## Anti-patterns we've encountered
|
|
154
|
+
|
|
155
|
+
- **Flat tool list + prompt-injected focus mode** → tool-name hallucinations. See Principle 1.
|
|
156
|
+
- **Re-implementing summarization** → `SummarizationMiddleware` is already in the default stack.
|
|
157
|
+
- **Using `MemorySaver` in production** → threads vanish on restart. Swap to `SqliteSaver`.
|
|
158
|
+
- **Relying on `agent.stream("updates")` alone** → tokens are invisible until a tool boundary. UI appears frozen. Use multi-mode or events.
|
|
159
|
+
- **Per-call `num_ctx` tuning** → forces KV cache re-alloc. Fix `num_ctx` per role.
|
|
160
|
+
- **No `.with_retry()`** → a single `httpx.ReadError` kills the turn.
|
|
161
|
+
|
|
162
|
+
## Before you code
|
|
163
|
+
|
|
164
|
+
Run these checks:
|
|
165
|
+
|
|
166
|
+
1. **Read the installed source**. `cat $(python3 -c 'import deepagents, os; print(os.path.dirname(deepagents.__file__))')/middleware/subagents.py | head -100`
|
|
167
|
+
2. **Check the version**. `pip show deepagents` — know what API you have.
|
|
168
|
+
3. **Grep the repo for anti-patterns** before adding new code:
|
|
169
|
+
```bash
|
|
170
|
+
grep -rn "agent_focus_prompt\|## Single-Agent Mode\|flat tool" src/
|
|
171
|
+
grep -rn "MemorySaver" src/ # durable threads?
|
|
172
|
+
grep -rn "ChatOllama(" src/ | grep -v client_kwargs # missing timeout?
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Output (what "done" looks like)
|
|
176
|
+
|
|
177
|
+
A DeepAgents-based agent is well-built when:
|
|
178
|
+
|
|
179
|
+
- [ ] Each role that exists conceptually has its own `SubAgent` spec with a scoped `tools` list
|
|
180
|
+
- [ ] Focus/single-agent mode scopes the MAIN agent's tools — no prompt-level "You are the X agent" override
|
|
181
|
+
- [ ] `ChatOllama` instances have `client_kwargs={"timeout": ...}` and `.with_retry()`
|
|
182
|
+
- [ ] `checkpointer` is durable (SQLite/Postgres), not `MemorySaver`
|
|
183
|
+
- [ ] `astream_events(version="v2")` or multi-mode streaming is used if the UI needs per-token updates
|
|
184
|
+
- [ ] Local-only optimizations (warmup, heartbeat, fast-path, tool validator) are preserved — DeepAgents doesn't cover them
|
|
185
|
+
- [ ] The tool-name validator is still present as a belt-and-braces guard against small-model fabrication
|
|
186
|
+
|
|
187
|
+
## Related skills
|
|
188
|
+
|
|
189
|
+
- `build-loop:debug-loop` — for investigating agent behavior (tool hallucinations, stuck streams)
|
|
190
|
+
- `prompt-builder:prompt-builder` — for tightening per-role `system_prompt` text
|
|
191
|
+
- `calm-precision` — if you're also building the UI side of the agent
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
*Version 1.0 — 2026-04-13. Based on `deepagents` v0.4.x. Re-read the installed package source when the CHANGELOG mentions middleware or SubAgent changes.*
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
|
|
3
|
+
# DeepAgents Anti-Patterns
|
|
4
|
+
|
|
5
|
+
Concrete bugs from real projects, mapped to what DeepAgents does or does not cover.
|
|
6
|
+
|
|
7
|
+
## AP-1: Flat tool list + prompt-injected "focus mode"
|
|
8
|
+
|
|
9
|
+
**Symptom**: user pins a single agent role (e.g. Planner). Model emits `repo_browser.write_todos` or `mcp.execute` — fabricated namespaces that don't exist in the tool registry. Loop detection fires, turn limit eventually triggers, UI shows a wall of red `tool_error` events for a trivial prompt.
|
|
10
|
+
|
|
11
|
+
**Root cause**: the main agent had access to all tools (web_search, python_exec, ...). The "focus" was enforced via a `## Single-Agent Mode` system-prompt suffix saying "you are the Planner, use write_todos only." Small models (< 14B) don't reliably obey prompt-level constraints against an in-scope tool list. When the prompt needs no tool call (e.g. "capital of france"), the model invents plausible-looking namespaced tools from its training data.
|
|
12
|
+
|
|
13
|
+
**Fix**: scope tools at the SubAgent level (or at main-agent level in focus mode). Never rely on the prompt alone to restrict tool access.
|
|
14
|
+
|
|
15
|
+
**DeepAgents coverage**: ✅ supported via `SubAgent["tools"]`.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## AP-2: Re-implementing summarization middleware
|
|
20
|
+
|
|
21
|
+
**Symptom**: code grows a custom `_truncate_old_messages()` or `_summarize_if_long()` function. Duplicates what DeepAgents already provides.
|
|
22
|
+
|
|
23
|
+
**Root cause**: contributor didn't read the default middleware stack.
|
|
24
|
+
|
|
25
|
+
**Fix**: delete the custom summarizer. `create_summarization_middleware` is injected automatically in `graph.py`.
|
|
26
|
+
|
|
27
|
+
**DeepAgents coverage**: ✅ default stack.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## AP-3: `MemorySaver` in production
|
|
32
|
+
|
|
33
|
+
**Symptom**: user asks "continue our research from yesterday" — all prior context gone after a backend restart.
|
|
34
|
+
|
|
35
|
+
**Root cause**: `MemorySaver` is in-process; threads evaporate on process exit.
|
|
36
|
+
|
|
37
|
+
**Fix**: swap to `SqliteSaver.from_conn_string(".app/checkpoints.db")`. LangGraph handles resume automatically.
|
|
38
|
+
|
|
39
|
+
**DeepAgents coverage**: ✅ any LangGraph `Checkpointer` works.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## AP-4: UI looks frozen during LLM reasoning
|
|
44
|
+
|
|
45
|
+
**Symptom**: user sends "write a 5-page report". UI shows "Thinking…" for 30 seconds, no tokens stream, then a giant block appears at the end.
|
|
46
|
+
|
|
47
|
+
**Root cause**: stream loop uses `stream_mode="updates"` only. Updates fire on node boundaries (typically after an LLM call finishes). Per-token output is invisible.
|
|
48
|
+
|
|
49
|
+
**Fix**: either multi-mode `stream_mode=["updates", "messages"]` or switch to `astream_events(version="v2")` and handle `on_chat_model_stream`.
|
|
50
|
+
|
|
51
|
+
**DeepAgents coverage**: ✅ LangGraph's streaming API is exposed verbatim.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## AP-5: Cold-model load looks like a crash
|
|
56
|
+
|
|
57
|
+
**Symptom**: first query after app launch hangs for 30–60s with no UI signal, then suddenly works. Intermediaries drop the SSE connection during the silence.
|
|
58
|
+
|
|
59
|
+
**Root cause**: Ollama loads the model into VRAM on first request. DeepAgents doesn't know or care about this — it just hangs in the `ChatOllama.stream()` call.
|
|
60
|
+
|
|
61
|
+
**Fix**: warm the model explicitly before the first query. POST to `/api/generate` with empty prompt and `keep_alive: "30m"` at backend startup. Emit a "loading" SSE event from your bridge so the UI can show a loading overlay. Add a heartbeat pulse every 15s during silent agent-stream gaps.
|
|
62
|
+
|
|
63
|
+
**DeepAgents coverage**: ❌ — this is a local-model concern. Build it around DeepAgents, not into it.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## AP-6: Tool-name hallucinations still leak after scoping
|
|
68
|
+
|
|
69
|
+
**Symptom**: even with scoped tools, an 8B model occasionally emits `write_todos.plan` or `filesystem.read_file` — dotted variants of real tools.
|
|
70
|
+
|
|
71
|
+
**Root cause**: small model pulling patterns from training data. Scoping blocks the worst cases but doesn't eliminate fabrication.
|
|
72
|
+
|
|
73
|
+
**Fix**: belt-and-braces tool-name validator that rejects any name containing `.` or `/` before it reaches the UI, with a clean `tool_error` event. DeepAgents' `PatchToolCallsMiddleware` only handles *orphaned* tool calls (missing `ToolMessage`), not invalid names.
|
|
74
|
+
|
|
75
|
+
**DeepAgents coverage**: ⚠️ partial. Keep the validator.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## AP-7: `num_ctx` varying per request
|
|
80
|
+
|
|
81
|
+
**Symptom**: noticeable stall when the system prompt size changes between requests. Ollama logs show KV cache re-allocation.
|
|
82
|
+
|
|
83
|
+
**Root cause**: every unique `num_ctx` value triggers a full KV cache re-alloc in Ollama.
|
|
84
|
+
|
|
85
|
+
**Fix**: pin `num_ctx` per role (e.g. 4096 for full agent, 2048 for fast-path). Don't vary it based on prompt size.
|
|
86
|
+
|
|
87
|
+
**DeepAgents coverage**: ❌ Ollama-specific.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## AP-8: No retry on transient Ollama errors
|
|
92
|
+
|
|
93
|
+
**Symptom**: user query fails with `httpx.ReadError: Server disconnected` a few seconds in. Usually happens right after a model switch.
|
|
94
|
+
|
|
95
|
+
**Root cause**: Ollama hot-unloads the previous model when a new one is requested, and in-flight requests get dropped. No retry path.
|
|
96
|
+
|
|
97
|
+
**Fix**: wrap `ChatOllama` in `.with_retry()`:
|
|
98
|
+
```python
|
|
99
|
+
llm.with_retry(stop_after_attempt=2, wait_exponential_jitter=True,
|
|
100
|
+
retry_if_exception_type=(httpx.TransportError, httpx.TimeoutException))
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**DeepAgents coverage**: ❌ — LangChain core feature.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## AP-9: Stream cancellation doesn't stop the LLM (TAG:TIMEBOUND)
|
|
108
|
+
|
|
109
|
+
**Symptom**: user clicks Stop. UI updates, but GPU/CPU stays pegged for seconds or minutes. Ollama logs show the model still generating.
|
|
110
|
+
|
|
111
|
+
**Root cause**: `ThreadingHTTPServer` only detects client disconnect on the next `wfile.write`. And even then, cancelling the Python generator doesn't cancel the underlying `httpx` stream — `langchain-ollama` provides no abort token.
|
|
112
|
+
|
|
113
|
+
**Fix**: partial — migrate the SSE bridge to ASGI (Starlette + `uvicorn`). `await request.is_disconnected()` inside the generator gives clean cancellation. Then thread that through the `ChatOllama` stream (requires monkey-patching or waiting for langchain-ollama to expose an `abort` hook).
|
|
114
|
+
|
|
115
|
+
**TIMEBOUND**: the monkey-patch recommendation ages badly once `langchain-ollama` exposes a first-class abort. Re-check upstream before reaching for a patch — track the tracking issues in the langchain-ai/langchain-ollama repo.
|
|
116
|
+
|
|
117
|
+
**DeepAgents coverage**: ❌ — transport-layer concern.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## AP-10: `ChatOllama` default timeout = infinite
|
|
122
|
+
|
|
123
|
+
**Symptom**: a stuck or slow-loading model never returns. UI hangs forever.
|
|
124
|
+
|
|
125
|
+
**Root cause**: `ChatOllama` passes `None` as the httpx timeout by default.
|
|
126
|
+
|
|
127
|
+
**Fix**: always set `client_kwargs={"timeout": httpx.Timeout(connect=5, read=600, write=30, pool=5)}`.
|
|
128
|
+
|
|
129
|
+
**DeepAgents coverage**: ❌ — LangChain-Ollama config.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## AP-11: Subagents with no `tools` field inherit everything
|
|
134
|
+
|
|
135
|
+
**Symptom**: you define `{"name": "planner", "description": "..."}` without `tools`. The planner somehow calls `web_search`.
|
|
136
|
+
|
|
137
|
+
**Root cause**: if `tools` is not in the SubAgent spec, it inherits `default_tools` (the main agent's tool set). See `subagents.py:347`.
|
|
138
|
+
|
|
139
|
+
**Fix**: always set `tools=[]` explicitly for roles that should have no custom tools. An empty list is different from an omitted key.
|
|
140
|
+
|
|
141
|
+
**DeepAgents coverage**: ⚠️ be explicit — the default is permissive.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
|
|
3
|
+
# DeepAgents API Quick Reference
|
|
4
|
+
|
|
5
|
+
Live source paths and exact signatures. Always verify against the installed version (`pip show deepagents`) — these notes track v0.4.x.
|
|
6
|
+
|
|
7
|
+
## create_deep_agent signature
|
|
8
|
+
|
|
9
|
+
File: `deepagents/graph.py:217`
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
def create_deep_agent(
|
|
13
|
+
model: str | BaseChatModel | None = None,
|
|
14
|
+
tools: Sequence[BaseTool | Callable | dict] | None = None,
|
|
15
|
+
*,
|
|
16
|
+
system_prompt: str | SystemMessage | None = None,
|
|
17
|
+
middleware: Sequence[AgentMiddleware] = (),
|
|
18
|
+
subagents: Sequence[SubAgent | CompiledSubAgent | AsyncSubAgent] | None = None,
|
|
19
|
+
skills: list[str] | None = None,
|
|
20
|
+
memory: list[str] | None = None,
|
|
21
|
+
permissions: list[FilesystemPermission] | None = None,
|
|
22
|
+
response_format: ResponseFormat | type | dict | None = None,
|
|
23
|
+
context_schema: type | None = None,
|
|
24
|
+
checkpointer: Checkpointer | None = None,
|
|
25
|
+
store: BaseStore | None = None,
|
|
26
|
+
backend: BackendProtocol | BackendFactory | None = None,
|
|
27
|
+
interrupt_on: dict[str, bool | InterruptOnConfig] | None = None,
|
|
28
|
+
debug: bool = False,
|
|
29
|
+
name: str | None = None,
|
|
30
|
+
cache: BaseCache | None = None,
|
|
31
|
+
) -> CompiledStateGraph: ...
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Returns a LangGraph `CompiledStateGraph`. Stream/invoke it with standard LangGraph APIs.
|
|
35
|
+
|
|
36
|
+
## SubAgent TypedDict
|
|
37
|
+
|
|
38
|
+
File: `deepagents/middleware/subagents.py:22`
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
class SubAgent(TypedDict):
|
|
42
|
+
name: str # Required
|
|
43
|
+
description: str # Required
|
|
44
|
+
system_prompt: str # Required
|
|
45
|
+
|
|
46
|
+
tools: NotRequired[Sequence[...]] # Optional — inherits if omitted
|
|
47
|
+
model: NotRequired[str | BaseChatModel] # Optional — per-agent model
|
|
48
|
+
middleware: NotRequired[list[AgentMiddleware]] # Optional — extra middleware
|
|
49
|
+
interrupt_on: NotRequired[dict[str, ...]] # Optional — human-in-the-loop per tool
|
|
50
|
+
skills: NotRequired[list[str]] # Optional — paths to skill markdown
|
|
51
|
+
permissions: NotRequired[list[FilesystemPermission]] # Optional
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Important**: if you pass `tools=[]` (empty list), subagent still gets middleware-provided tools (`write_todos`, `ls`, `read_file`, `write_file`, `edit_file`, `glob`, `grep`). Only your custom tools are restricted.
|
|
55
|
+
|
|
56
|
+
## Kwargs worth knowing (often missed)
|
|
57
|
+
|
|
58
|
+
Not every arg to `create_deep_agent` is obvious at a glance. These four trip up new builders:
|
|
59
|
+
|
|
60
|
+
- **`backend`** — instance of `BackendProtocol` (usually `FilesystemBackend(root_dir=..., virtual_mode=True)`). Sandboxes the filesystem-middleware tools (`ls`/`read_file`/`write_file`/`edit_file`/`glob`/`grep`) so they operate inside `root_dir` instead of the whole disk. Always pass one in a local-app context — otherwise the agent can read/write anywhere the process can.
|
|
61
|
+
|
|
62
|
+
- **`store`** — a LangGraph `BaseStore` (distinct from `checkpointer`). Checkpointer = per-thread conversation state. Store = cross-thread long-term memory (facts, documents, user profile). Pair `SqliteSaver` (checkpointer) with an in-process or file-backed store if you want the agent to remember across threads.
|
|
63
|
+
|
|
64
|
+
- **`response_format`** — typed final output. Pass a Pydantic model, TypedDict, or JSON schema; the final assistant message is coerced to it and exposed via `agent.invoke(...)["response"]`. **Conflicts with `format: "json"`** at the model layer — don't combine the two. For an 8B local model, Pydantic-schema validation on structured output is flaky; consider using a larger model for that turn only.
|
|
65
|
+
|
|
66
|
+
- **`interrupt_on`** — dict mapping tool name → bool or config. Causes the graph to pause before the named tool fires; the caller then `Command(resume=...)` after human approval. Requires a checkpointer to save the paused state.
|
|
67
|
+
|
|
68
|
+
## Async vs sync
|
|
69
|
+
|
|
70
|
+
The returned graph is dual-API. SSE bridges on ASGI (Starlette, FastAPI) should prefer async:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
async for event in agent.astream_events(input, config=config, version="v2"):
|
|
74
|
+
...
|
|
75
|
+
result = await agent.ainvoke(input, config=config)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
On the subagent side, an `AsyncSubAgent` variant (see `deepagents/async_subagents.py`) exists for purely async subagent bodies. If your runtime mixes — sync HTTP server + async Ollama calls — LangChain's adapters handle the boundary, but you pay a thread-pool hop per LLM call. Match the transport to the agent code.
|
|
79
|
+
|
|
80
|
+
## Default middleware stack
|
|
81
|
+
|
|
82
|
+
File: `deepagents/graph.py:192-260` (build order). In order of injection for the main agent. **If this list disagrees with the installed source, trust the source** — this file is a snapshot; the middleware stack is the most volatile surface DeepAgents exposes.
|
|
83
|
+
|
|
84
|
+
1. `TodoListMiddleware` → exposes `write_todos`
|
|
85
|
+
2. `FilesystemMiddleware` (from `backend` arg) → `ls`, `read_file`, `write_file`, `edit_file`, `glob`, `grep`
|
|
86
|
+
3. `ShellCommandMiddleware` → `execute` (shell command runner)
|
|
87
|
+
4. `SkillsMiddleware` (if `skills=` passed) → loads markdown into system prompt
|
|
88
|
+
5. `MemoryMiddleware` (if `memory=` passed) → loads `AGENTS.md`
|
|
89
|
+
6. `SubAgentMiddleware` (if `subagents=` passed) → the `task` tool
|
|
90
|
+
7. `SummarizationMiddleware` → context-window pruning
|
|
91
|
+
8. `PatchToolCallsMiddleware` → cleans orphaned tool calls
|
|
92
|
+
9. Any `middleware=` arg (custom)
|
|
93
|
+
10. `_PermissionMiddleware` (appended last if `permissions=` passed)
|
|
94
|
+
|
|
95
|
+
Subagents get a subset of this stack — see `subagents.py:660-667` for per-subagent assembly.
|
|
96
|
+
|
|
97
|
+
## Streaming
|
|
98
|
+
|
|
99
|
+
DeepAgents returns a LangGraph graph. Stream APIs:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
# Node-level (default in most example code)
|
|
103
|
+
for chunk in agent.stream(input, config=config, stream_mode="updates"):
|
|
104
|
+
...
|
|
105
|
+
|
|
106
|
+
# Token-level (per-token from LLM)
|
|
107
|
+
for chunk in agent.stream(input, config=config, stream_mode="messages"):
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
# Multi-mode — most useful for SSE bridges
|
|
111
|
+
for mode, payload in agent.stream(input, config=config, stream_mode=["updates", "messages"]):
|
|
112
|
+
if mode == "updates": ...
|
|
113
|
+
elif mode == "messages": ...
|
|
114
|
+
|
|
115
|
+
# Typed events — v2
|
|
116
|
+
async for event in agent.astream_events(input, config=config, version="v2"):
|
|
117
|
+
kind = event["event"]
|
|
118
|
+
# on_chat_model_start / on_chat_model_stream / on_chat_model_end
|
|
119
|
+
# on_tool_start / on_tool_end / on_tool_error
|
|
120
|
+
# on_chain_start / on_chain_end
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`astream_events(include_types=["chat_model","tool"])` drops chain-level noise — ~5× fewer events.
|
|
124
|
+
|
|
125
|
+
## Checkpointing
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from langgraph.checkpoint.memory import MemorySaver # volatile
|
|
129
|
+
from langgraph.checkpoint.sqlite import SqliteSaver # local persistent
|
|
130
|
+
# pip install langgraph-checkpoint-sqlite
|
|
131
|
+
|
|
132
|
+
checkpointer = SqliteSaver.from_conn_string(".app/checkpoints.db")
|
|
133
|
+
agent = create_deep_agent(..., checkpointer=checkpointer)
|
|
134
|
+
|
|
135
|
+
# Resume a thread
|
|
136
|
+
config = {"configurable": {"thread_id": "research_001"}}
|
|
137
|
+
result = agent.invoke(input, config=config)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Postgres and async variants exist as separate packages (`langgraph-checkpoint-postgres`).
|
|
141
|
+
|
|
142
|
+
## Interrupts (human-in-the-loop)
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
subagent = {
|
|
146
|
+
"name": "executor",
|
|
147
|
+
...,
|
|
148
|
+
"interrupt_on": {"python_exec": True}, # pause before every python_exec call
|
|
149
|
+
}
|
|
150
|
+
# Or full InterruptOnConfig for per-arg rules.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
On interrupt, `astream` raises or yields an interrupt event. The UI approves/rejects, then:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from langgraph.types import Command
|
|
157
|
+
agent.invoke(Command(resume="approved"), config=config)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Per-agent model routing
|
|
161
|
+
|
|
162
|
+
`SubAgent["model"]` can be:
|
|
163
|
+
- `"openai:gpt-4o-mini"` → parsed as `provider:model-name`
|
|
164
|
+
- A `BaseChatModel` instance → used directly (e.g. a pre-configured `ChatOllama`)
|
|
165
|
+
|
|
166
|
+
If omitted, inherits the main agent's model.
|
|
167
|
+
|
|
168
|
+
## Common imports
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from deepagents import create_deep_agent
|
|
172
|
+
from deepagents.backends import FilesystemBackend
|
|
173
|
+
from deepagents.middleware.subagents import SubAgent, CompiledSubAgent
|
|
174
|
+
# Optional:
|
|
175
|
+
from deepagents.permissions import FilesystemPermission
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Verifying your version
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
python3 -c "import deepagents, os; print(deepagents.__version__ if hasattr(deepagents, '__version__') else 'unknown'); print(os.path.dirname(deepagents.__file__))"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Then read the actual `graph.py` and `middleware/subagents.py` — this reference may be stale.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-loop:capabilities
|
|
3
|
+
description: Invoked by Phase 1 Assess to populate `state.json.activeCapabilities[<phase>]` with ≤8 relevant entries via plugin-surface collapse + trigger-aware demotion. Keeps the orchestrator below the empirical tool-selection ceiling. Not user-callable; orchestrator-internal.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
model: sonnet
|
|
6
|
+
tools: ["Read", "Bash"]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
10
|
+
|
|
11
|
+
# Capability shortlist
|
|
12
|
+
|
|
13
|
+
Anthropic's Tool Search guidance recommends <=8 candidates per dispatch. The build-loop repo currently exposes ~112 surfaces (20 agents + 34 skills + 14 commands + 5 hooks + ~39 scripts) and no build-loop MCP server. Without filtering, the orchestrator chooses from a haystack on every phase.
|
|
14
|
+
|
|
15
|
+
This skill is a deterministic, structured matcher: **(phase, intent text) → ≤8 capability entries**, drawn from the registry written by `scripts/build_capability_registry.py`.
|
|
16
|
+
|
|
17
|
+
## Inputs
|
|
18
|
+
|
|
19
|
+
| Input | Type | Required | Notes |
|
|
20
|
+
|---|---|---|---|
|
|
21
|
+
| `phase` | int (1–6) | yes | Phase number from build-loop's 5-phase loop (+1 Learn). |
|
|
22
|
+
| `intent` | string | yes | Free-text description of the goal/task for this phase. |
|
|
23
|
+
| `kind` | optional list | no | Filter by `agent | skill | command | hook | mcp_tool | script`. |
|
|
24
|
+
| `workdir` | optional path | no | Repo root containing `.build-loop/capability-registry.json`. Defaults to `$PWD`. |
|
|
25
|
+
|
|
26
|
+
## Phase → category routing
|
|
27
|
+
|
|
28
|
+
Phases bias the shortlist toward categories the loop typically uses there:
|
|
29
|
+
|
|
30
|
+
| Phase | Primary categories | Secondary |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| 1 Assess | architecture, planning, memory, observability | meta |
|
|
33
|
+
| 2 Plan | planning, architecture, validation | meta |
|
|
34
|
+
| 3 Execute | execution, debugging, ux-ui, deployment | testing |
|
|
35
|
+
| 4 Review | validation, debugging, ux-ui, optimization | testing |
|
|
36
|
+
| 5 Iterate | debugging, execution, validation | architecture |
|
|
37
|
+
| 6 Learn | meta, memory, optimization | validation |
|
|
38
|
+
|
|
39
|
+
When `phase` is outside 1–6, fall back to scoring purely on intent keyword matches.
|
|
40
|
+
|
|
41
|
+
## Procedure
|
|
42
|
+
|
|
43
|
+
1. Read `<workdir>/.build-loop/capability-registry.json`. If it doesn't exist, run:
|
|
44
|
+
```bash
|
|
45
|
+
python3 <workdir>/scripts/build_capability_registry.py --workdir "<workdir>"
|
|
46
|
+
```
|
|
47
|
+
Then re-read.
|
|
48
|
+
2. Lowercase the `intent` string. Tokenize on whitespace and punctuation.
|
|
49
|
+
3. For each registry entry, compute a relevance score:
|
|
50
|
+
- **+5** for every intent token that appears in `name`, `description`, or `triggers[]`.
|
|
51
|
+
- **+3** if the entry's `category` is in the phase's primary list.
|
|
52
|
+
- **+1** if the entry's `category` is in the phase's secondary list.
|
|
53
|
+
- **+1** if the entry's `tier` is `sonnet` or `opus` (preferred over `n/a` for substantive work).
|
|
54
|
+
4. Apply optional `kind` filter.
|
|
55
|
+
5. Sort by score descending, then by `name` ascending for stable tie-breaks.
|
|
56
|
+
6. Return the top 8 with reason tokens (which intent words and which categories matched).
|
|
57
|
+
|
|
58
|
+
## Output shape
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"phase": 1,
|
|
63
|
+
"intent": "<echoed>",
|
|
64
|
+
"shortlist_size": 8,
|
|
65
|
+
"registry_total": 113,
|
|
66
|
+
"results": [
|
|
67
|
+
{
|
|
68
|
+
"name": "<capability name>",
|
|
69
|
+
"kind": "agent|skill|command|hook|mcp_tool|script",
|
|
70
|
+
"category": "<routing label>",
|
|
71
|
+
"score": 12,
|
|
72
|
+
"reasons": ["matched_intent_token: scan", "matched_category: architecture"],
|
|
73
|
+
"source_path": "agents/architecture-scout.md",
|
|
74
|
+
"description": "<truncated to 240 chars>"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`shortlist_size` is always ≤ 8 (the registry's own size cap matches Anthropic's Tool Search guidance). When fewer than 8 entries score above 0, return all that scored. When zero match, return the top 4 by phase-category match alone — the orchestrator should never receive an empty shortlist if the registry is non-empty.
|
|
81
|
+
|
|
82
|
+
## Caching
|
|
83
|
+
|
|
84
|
+
Write the result to `<workdir>/.build-loop/state.json.activeCapabilities[]` with `{phase, intent, shortlist: [...], generated_at}`. The orchestrator's Phase 1 Assess step reads this directly without re-running the skill if `intent` and `phase` haven't changed.
|
|
85
|
+
|
|
86
|
+
## What this skill does NOT do
|
|
87
|
+
|
|
88
|
+
- Execute any of the capabilities it surfaces. It returns a shortlist; the orchestrator dispatches.
|
|
89
|
+
- Mutate any source file. Read-only on the repo; write-only to `state.json` (single field).
|
|
90
|
+
- Network-call. Runs purely against the local registry.
|
|
91
|
+
- Disambiguate between two capabilities with the same name in different `kind` namespaces — both are surfaced and the orchestrator decides.
|