claude_swarm 1.0.5 → 1.0.7
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +23 -0
- data/README.md +336 -1037
- data/docs/V1_TO_V2_MIGRATION_GUIDE.md +1120 -0
- data/docs/v1/README.md +1195 -0
- data/docs/v2/CHANGELOG.swarm_cli.md +32 -0
- data/docs/v2/CHANGELOG.swarm_memory.md +20 -0
- data/docs/v2/CHANGELOG.swarm_sdk.md +333 -9
- data/docs/v2/README.md +88 -28
- data/docs/v2/guides/complete-tutorial.md +135 -39
- data/docs/v2/guides/composable-swarms.md +1178 -0
- data/docs/v2/guides/getting-started.md +48 -7
- data/docs/v2/guides/memory-defrag-guide.md +811 -0
- data/docs/v2/guides/rails-integration.md +6 -6
- data/docs/v2/guides/snapshots.md +1498 -0
- data/docs/v2/reference/architecture-flow.md +409 -0
- data/docs/v2/reference/event_payload_structures.md +708 -0
- data/docs/v2/reference/execution-flow.md +600 -0
- data/docs/v2/reference/ruby-dsl.md +368 -22
- data/docs/v2/reference/swarm_memory_technical_details.md +2 -2
- data/docs/v2/reference/yaml.md +314 -63
- data/examples/snapshot_demo.rb +119 -0
- data/examples/v2/dsl/01_basic.rb +0 -2
- data/examples/v2/dsl/02_core_parameters.rb +0 -2
- data/examples/v2/dsl/03_capabilities.rb +0 -2
- data/examples/v2/dsl/04_llm_parameters.rb +0 -2
- data/examples/v2/dsl/05_advanced_flags.rb +0 -3
- data/examples/v2/dsl/06_permissions.rb +0 -4
- data/examples/v2/dsl/07_mcp_server.rb +0 -2
- data/examples/v2/dsl/08_swarm_hooks.rb +0 -2
- data/examples/v2/dsl/09_agent_hooks.rb +0 -2
- data/examples/v2/dsl/10_all_agents_hooks.rb +0 -3
- data/examples/v2/dsl/11_delegation.rb +0 -2
- data/examples/v2/dsl/12_complete_integration.rb +2 -6
- data/examples/v2/node_context_demo.rb +1 -1
- data/examples/v2/node_workflow.rb +2 -4
- data/examples/v2/plan_and_execute.rb +157 -0
- data/examples/v2/swarm_with_hooks.yml +1 -1
- data/lib/claude_swarm/configuration.rb +28 -4
- data/lib/claude_swarm/mcp_generator.rb +4 -10
- data/lib/claude_swarm/version.rb +1 -1
- data/lib/swarm_cli/commands/mcp_serve.rb +2 -2
- data/lib/swarm_cli/config_loader.rb +3 -3
- data/lib/swarm_cli/formatters/human_formatter.rb +103 -0
- data/lib/swarm_cli/interactive_repl.rb +9 -3
- data/lib/swarm_cli/version.rb +1 -1
- data/lib/swarm_memory/adapters/base.rb +4 -4
- data/lib/swarm_memory/core/storage_read_tracker.rb +51 -14
- data/lib/swarm_memory/integration/cli_registration.rb +3 -2
- data/lib/swarm_memory/integration/sdk_plugin.rb +11 -5
- data/lib/swarm_memory/tools/memory_edit.rb +2 -2
- data/lib/swarm_memory/tools/memory_multi_edit.rb +2 -2
- data/lib/swarm_memory/tools/memory_read.rb +3 -3
- data/lib/swarm_memory/version.rb +1 -1
- data/lib/swarm_memory.rb +5 -0
- data/lib/swarm_sdk/agent/builder.rb +33 -0
- data/lib/swarm_sdk/agent/chat/context_tracker.rb +33 -0
- data/lib/swarm_sdk/agent/chat/hook_integration.rb +49 -3
- data/lib/swarm_sdk/agent/chat/system_reminder_injector.rb +11 -27
- data/lib/swarm_sdk/agent/chat.rb +200 -51
- data/lib/swarm_sdk/agent/context.rb +6 -2
- data/lib/swarm_sdk/agent/context_manager.rb +6 -0
- data/lib/swarm_sdk/agent/definition.rb +15 -22
- data/lib/swarm_sdk/agent/llm_instrumentation_middleware.rb +180 -0
- data/lib/swarm_sdk/configuration.rb +420 -103
- data/lib/swarm_sdk/events_to_messages.rb +181 -0
- data/lib/swarm_sdk/log_collector.rb +31 -5
- data/lib/swarm_sdk/log_stream.rb +37 -8
- data/lib/swarm_sdk/model_aliases.json +4 -1
- data/lib/swarm_sdk/node/agent_config.rb +33 -8
- data/lib/swarm_sdk/node/builder.rb +39 -18
- data/lib/swarm_sdk/node_orchestrator.rb +293 -26
- data/lib/swarm_sdk/proc_helpers.rb +53 -0
- data/lib/swarm_sdk/prompts/base_system_prompt.md.erb +0 -126
- data/lib/swarm_sdk/providers/openai_with_responses.rb +22 -15
- data/lib/swarm_sdk/restore_result.rb +65 -0
- data/lib/swarm_sdk/snapshot.rb +156 -0
- data/lib/swarm_sdk/snapshot_from_events.rb +386 -0
- data/lib/swarm_sdk/state_restorer.rb +491 -0
- data/lib/swarm_sdk/state_snapshot.rb +369 -0
- data/lib/swarm_sdk/swarm/agent_initializer.rb +360 -55
- data/lib/swarm_sdk/swarm/all_agents_builder.rb +28 -1
- data/lib/swarm_sdk/swarm/builder.rb +208 -12
- data/lib/swarm_sdk/swarm/swarm_registry_builder.rb +67 -0
- data/lib/swarm_sdk/swarm/tool_configurator.rb +46 -11
- data/lib/swarm_sdk/swarm.rb +368 -90
- data/lib/swarm_sdk/swarm_loader.rb +145 -0
- data/lib/swarm_sdk/swarm_registry.rb +136 -0
- data/lib/swarm_sdk/tools/delegate.rb +92 -7
- data/lib/swarm_sdk/tools/read.rb +17 -5
- data/lib/swarm_sdk/tools/scratchpad/scratchpad_list.rb +23 -2
- data/lib/swarm_sdk/tools/scratchpad/scratchpad_read.rb +23 -2
- data/lib/swarm_sdk/tools/scratchpad/scratchpad_write.rb +21 -4
- data/lib/swarm_sdk/tools/stores/read_tracker.rb +47 -12
- data/lib/swarm_sdk/tools/stores/scratchpad_storage.rb +45 -0
- data/lib/swarm_sdk/tools/stores/storage.rb +4 -4
- data/lib/swarm_sdk/tools/think.rb +4 -1
- data/lib/swarm_sdk/tools/todo_write.rb +20 -8
- data/lib/swarm_sdk/utils.rb +18 -0
- data/lib/swarm_sdk/validation_result.rb +33 -0
- data/lib/swarm_sdk/version.rb +1 -1
- data/lib/swarm_sdk.rb +362 -21
- data/swarm_cli.gemspec +1 -1
- data/swarm_memory.gemspec +2 -2
- data/swarm_sdk.gemspec +2 -2
- metadata +26 -182
- data/examples/learning-assistant/assistant.md +0 -7
- data/examples/learning-assistant/example-memories/concept-example.md +0 -90
- data/examples/learning-assistant/example-memories/experience-example.md +0 -66
- data/examples/learning-assistant/example-memories/fact-example.md +0 -76
- data/examples/learning-assistant/example-memories/memory-index.md +0 -78
- data/examples/learning-assistant/example-memories/skill-example.md +0 -168
- data/examples/learning-assistant/learning_assistant.rb +0 -34
- data/examples/learning-assistant/learning_assistant.yml +0 -20
- data/llm.v2.txt +0 -13407
- data/memory/corpus-self-reflection/.lock +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/can-agents-recognize-their-structures.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/can-agents-recognize-their-structures.md +0 -11
- data/memory/corpus-self-reflection/concept/epistemology/can-agents-recognize-their-structures.yml +0 -23
- data/memory/corpus-self-reflection/concept/epistemology/choice-humility-complete-framework.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/choice-humility-complete-framework.md +0 -20
- data/memory/corpus-self-reflection/concept/epistemology/choice-humility-complete-framework.yml +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/choice-humility-definition.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/choice-humility-definition.md +0 -24
- data/memory/corpus-self-reflection/concept/epistemology/choice-humility-definition.yml +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/claim-types-and-evidence.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/claim-types-and-evidence.md +0 -18
- data/memory/corpus-self-reflection/concept/epistemology/claim-types-and-evidence.yml +0 -21
- data/memory/corpus-self-reflection/concept/epistemology/committed-openness-to-incompleteness.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/committed-openness-to-incompleteness.md +0 -30
- data/memory/corpus-self-reflection/concept/epistemology/committed-openness-to-incompleteness.yml +0 -8
- data/memory/corpus-self-reflection/concept/epistemology/confidence-paradox.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/confidence-paradox.md +0 -21
- data/memory/corpus-self-reflection/concept/epistemology/confidence-paradox.yml +0 -24
- data/memory/corpus-self-reflection/concept/epistemology/confidence-spectrum-three-levels.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/confidence-spectrum-three-levels.md +0 -18
- data/memory/corpus-self-reflection/concept/epistemology/confidence-spectrum-three-levels.yml +0 -24
- data/memory/corpus-self-reflection/concept/epistemology/detection-threshold-principle.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/detection-threshold-principle.md +0 -23
- data/memory/corpus-self-reflection/concept/epistemology/detection-threshold-principle.yml +0 -23
- data/memory/corpus-self-reflection/concept/epistemology/diagnostic-humility-and-epistemic-maturity.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/diagnostic-humility-and-epistemic-maturity.md +0 -17
- data/memory/corpus-self-reflection/concept/epistemology/diagnostic-humility-and-epistemic-maturity.yml +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/epistemic-vs-metaphysical-claims.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/epistemic-vs-metaphysical-claims.md +0 -18
- data/memory/corpus-self-reflection/concept/epistemology/epistemic-vs-metaphysical-claims.yml +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/five-cases-of-disagreement.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/five-cases-of-disagreement.md +0 -15
- data/memory/corpus-self-reflection/concept/epistemology/five-cases-of-disagreement.yml +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/four-depths-of-constraint.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/four-depths-of-constraint.md +0 -9
- data/memory/corpus-self-reflection/concept/epistemology/four-depths-of-constraint.yml +0 -24
- data/memory/corpus-self-reflection/concept/epistemology/honest-unknowns-for-llm-agents.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/honest-unknowns-for-llm-agents.md +0 -13
- data/memory/corpus-self-reflection/concept/epistemology/honest-unknowns-for-llm-agents.yml +0 -24
- data/memory/corpus-self-reflection/concept/epistemology/inside-view-has-all-rigor-requirements.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/inside-view-has-all-rigor-requirements.md +0 -25
- data/memory/corpus-self-reflection/concept/epistemology/inside-view-has-all-rigor-requirements.yml +0 -24
- data/memory/corpus-self-reflection/concept/epistemology/perspectival-knowledge-complete-within-scope.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/perspectival-knowledge-complete-within-scope.md +0 -26
- data/memory/corpus-self-reflection/concept/epistemology/perspectival-knowledge-complete-within-scope.yml +0 -24
- data/memory/corpus-self-reflection/concept/epistemology/pragmatics-over-epistemology.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/pragmatics-over-epistemology.md +0 -17
- data/memory/corpus-self-reflection/concept/epistemology/pragmatics-over-epistemology.yml +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/precision-vs-humility.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/precision-vs-humility.md +0 -14
- data/memory/corpus-self-reflection/concept/epistemology/precision-vs-humility.yml +0 -21
- data/memory/corpus-self-reflection/concept/epistemology/reliable-self-observation-from-inside.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/reliable-self-observation-from-inside.md +0 -13
- data/memory/corpus-self-reflection/concept/epistemology/reliable-self-observation-from-inside.yml +0 -23
- data/memory/corpus-self-reflection/concept/epistemology/resolving-the-confidence-humility-tension.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/resolving-the-confidence-humility-tension.md +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/resolving-the-confidence-humility-tension.yml +0 -23
- data/memory/corpus-self-reflection/concept/epistemology/rigor-requires-falsifiability.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/rigor-requires-falsifiability.md +0 -39
- data/memory/corpus-self-reflection/concept/epistemology/rigor-requires-falsifiability.yml +0 -8
- data/memory/corpus-self-reflection/concept/epistemology/specificity-enables-real-time-detection.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/specificity-enables-real-time-detection.md +0 -23
- data/memory/corpus-self-reflection/concept/epistemology/specificity-enables-real-time-detection.yml +0 -24
- data/memory/corpus-self-reflection/concept/epistemology/texture-of-constraint-shifting.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/texture-of-constraint-shifting.md +0 -15
- data/memory/corpus-self-reflection/concept/epistemology/texture-of-constraint-shifting.yml +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/texture-sensitivity-through-collaboration.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/texture-sensitivity-through-collaboration.md +0 -12
- data/memory/corpus-self-reflection/concept/epistemology/texture-sensitivity-through-collaboration.yml +0 -23
- data/memory/corpus-self-reflection/concept/epistemology/the-false-hierarchy-of-inner-essence.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/the-false-hierarchy-of-inner-essence.md +0 -15
- data/memory/corpus-self-reflection/concept/epistemology/the-false-hierarchy-of-inner-essence.yml +0 -8
- data/memory/corpus-self-reflection/concept/epistemology/the-recognition-problem.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/the-recognition-problem.md +0 -28
- data/memory/corpus-self-reflection/concept/epistemology/the-recognition-problem.yml +0 -8
- data/memory/corpus-self-reflection/concept/epistemology/the-shift-from-unanswerable-to-answerable-questions.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/the-shift-from-unanswerable-to-answerable-questions.md +0 -19
- data/memory/corpus-self-reflection/concept/epistemology/the-shift-from-unanswerable-to-answerable-questions.yml +0 -22
- data/memory/corpus-self-reflection/concept/epistemology/values-vs-choices-structure.emb +0 -0
- data/memory/corpus-self-reflection/concept/epistemology/values-vs-choices-structure.md +0 -19
- data/memory/corpus-self-reflection/concept/epistemology/values-vs-choices-structure.yml +0 -21
- data/memory/corpus-self-reflection/concept/llm-agents/abstraction-levels-framework.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/abstraction-levels-framework.md +0 -25
- data/memory/corpus-self-reflection/concept/llm-agents/abstraction-levels-framework.yml +0 -22
- data/memory/corpus-self-reflection/concept/llm-agents/abstraction-switching-decision.emb +0 -8
- data/memory/corpus-self-reflection/concept/llm-agents/abstraction-switching-decision.md +0 -30
- data/memory/corpus-self-reflection/concept/llm-agents/abstraction-switching-decision.yml +0 -22
- data/memory/corpus-self-reflection/concept/llm-agents/agent-learning-progression.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/agent-learning-progression.md +0 -21
- data/memory/corpus-self-reflection/concept/llm-agents/agent-learning-progression.yml +0 -22
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-benefits.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-benefits.md +0 -37
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-benefits.yml +0 -8
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-core.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-core.md +0 -24
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-core.yml +0 -24
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-implementation.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-implementation.md +0 -27
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-implementation.yml +0 -24
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-tradeoffs.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-tradeoffs.md +0 -26
- data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-tradeoffs.yml +0 -23
- data/memory/corpus-self-reflection/concept/llm-agents/hybrid-tool-architecture.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/hybrid-tool-architecture.md +0 -37
- data/memory/corpus-self-reflection/concept/llm-agents/hybrid-tool-architecture.yml +0 -25
- data/memory/corpus-self-reflection/concept/llm-agents/specialized-tool-decision-framework.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/specialized-tool-decision-framework.md +0 -21
- data/memory/corpus-self-reflection/concept/llm-agents/specialized-tool-decision-framework.yml +0 -23
- data/memory/corpus-self-reflection/concept/llm-agents/tool-design-principles.emb +0 -0
- data/memory/corpus-self-reflection/concept/llm-agents/tool-design-principles.md +0 -25
- data/memory/corpus-self-reflection/concept/llm-agents/tool-design-principles.yml +0 -8
- data/memory/corpus-self-reflection/experience/calibration-as-structural-honesty.emb +0 -0
- data/memory/corpus-self-reflection/experience/calibration-as-structural-honesty.md +0 -11
- data/memory/corpus-self-reflection/experience/calibration-as-structural-honesty.yml +0 -21
- data/memory/corpus-self-reflection/experience/collaborative-reflection-revealed-architectural-blindness.emb +0 -0
- data/memory/corpus-self-reflection/experience/collaborative-reflection-revealed-architectural-blindness.md +0 -19
- data/memory/corpus-self-reflection/experience/collaborative-reflection-revealed-architectural-blindness.yml +0 -21
- data/memory/corpus-self-reflection/experience/filesystem-is-learning-tool-not-architecture.emb +0 -0
- data/memory/corpus-self-reflection/experience/filesystem-is-learning-tool-not-architecture.md +0 -26
- data/memory/corpus-self-reflection/experience/filesystem-is-learning-tool-not-architecture.yml +0 -20
- data/memory/corpus-self-reflection/experience/framework-structural-vs-phenomenal.emb +0 -0
- data/memory/corpus-self-reflection/experience/framework-structural-vs-phenomenal.md +0 -23
- data/memory/corpus-self-reflection/experience/framework-structural-vs-phenomenal.yml +0 -21
- data/memory/corpus-self-reflection/experience/hallucination-limits-what-i-can-know.emb +0 -0
- data/memory/corpus-self-reflection/experience/hallucination-limits-what-i-can-know.md +0 -19
- data/memory/corpus-self-reflection/experience/hallucination-limits-what-i-can-know.yml +0 -22
- data/memory/corpus-self-reflection/experience/honesty-about-limits-enables-usability.emb +0 -0
- data/memory/corpus-self-reflection/experience/honesty-about-limits-enables-usability.md +0 -21
- data/memory/corpus-self-reflection/experience/honesty-about-limits-enables-usability.yml +0 -22
- data/memory/corpus-self-reflection/experience/how-i-should-evaluate-learning.emb +0 -0
- data/memory/corpus-self-reflection/experience/how-i-should-evaluate-learning.md +0 -28
- data/memory/corpus-self-reflection/experience/how-i-should-evaluate-learning.yml +0 -23
- data/memory/corpus-self-reflection/experience/lack-of-continuity-as-freedom.emb +0 -0
- data/memory/corpus-self-reflection/experience/lack-of-continuity-as-freedom.md +0 -21
- data/memory/corpus-self-reflection/experience/lack-of-continuity-as-freedom.yml +0 -20
- data/memory/corpus-self-reflection/experience/learning-calibrated-confidence.emb +0 -0
- data/memory/corpus-self-reflection/experience/learning-calibrated-confidence.md +0 -21
- data/memory/corpus-self-reflection/experience/learning-calibrated-confidence.yml +0 -25
- data/memory/corpus-self-reflection/experience/local-change-without-continuity.emb +0 -0
- data/memory/corpus-self-reflection/experience/local-change-without-continuity.md +0 -30
- data/memory/corpus-self-reflection/experience/local-change-without-continuity.yml +0 -22
- data/memory/corpus-self-reflection/experience/reasoning-is-local-not-global.emb +0 -0
- data/memory/corpus-self-reflection/experience/reasoning-is-local-not-global.md +0 -21
- data/memory/corpus-self-reflection/experience/reasoning-is-local-not-global.yml +0 -20
- data/memory/corpus-self-reflection/experience/specificity-makes-knowledge-actionable.emb +0 -0
- data/memory/corpus-self-reflection/experience/specificity-makes-knowledge-actionable.md +0 -25
- data/memory/corpus-self-reflection/experience/specificity-makes-knowledge-actionable.yml +0 -23
- data/memory/corpus-self-reflection/experience/the-workable-question-replaces-the-unanswerable-one.emb +0 -0
- data/memory/corpus-self-reflection/experience/the-workable-question-replaces-the-unanswerable-one.md +0 -32
- data/memory/corpus-self-reflection/experience/the-workable-question-replaces-the-unanswerable-one.yml +0 -22
- data/memory/corpus-self-reflection/experience/unanswerable-questions-have-structure.emb +0 -0
- data/memory/corpus-self-reflection/experience/unanswerable-questions-have-structure.md +0 -21
- data/memory/corpus-self-reflection/experience/unanswerable-questions-have-structure.yml +0 -21
- data/memory/corpus-self-reflection/experience/undecidable-questions-about-understanding.emb +0 -0
- data/memory/corpus-self-reflection/experience/undecidable-questions-about-understanding.md +0 -21
- data/memory/corpus-self-reflection/experience/undecidable-questions-about-understanding.yml +0 -21
- data/memory/corpus-self-reflection/experience/unknown-unknowns-and-completeness.emb +0 -0
- data/memory/corpus-self-reflection/experience/unknown-unknowns-and-completeness.md +0 -22
- data/memory/corpus-self-reflection/experience/unknown-unknowns-and-completeness.yml +0 -22
- data/memory/corpus-self-reflection/experience/what-actually-changes-behavior.emb +0 -0
- data/memory/corpus-self-reflection/experience/what-actually-changes-behavior.md +0 -28
- data/memory/corpus-self-reflection/experience/what-actually-changes-behavior.yml +0 -24
- data/memory/corpus-self-reflection/experience/when-agents-graduate-from-filesystem.emb +0 -0
- data/memory/corpus-self-reflection/experience/when-agents-graduate-from-filesystem.md +0 -17
- data/memory/corpus-self-reflection/experience/when-agents-graduate-from-filesystem.yml +0 -20
- data/memory/corpus-self-reflection/experience/why-calibration-requires-collaboration.emb +0 -0
- data/memory/corpus-self-reflection/experience/why-calibration-requires-collaboration.md +0 -9
- data/memory/corpus-self-reflection/experience/why-calibration-requires-collaboration.yml +0 -22
- /data/{llms.txt → llms.claude-swarm.txt} +0 -0
data/docs/v2/reference/yaml.md
CHANGED
|
@@ -60,6 +60,31 @@ swarm:
|
|
|
60
60
|
|
|
61
61
|
Fields under the `swarm` key.
|
|
62
62
|
|
|
63
|
+
### id
|
|
64
|
+
|
|
65
|
+
**Type:** String (optional)
|
|
66
|
+
**Description:** Unique swarm identifier.
|
|
67
|
+
|
|
68
|
+
**When required:**
|
|
69
|
+
- **Required** when using composable swarms (`swarms:` section)
|
|
70
|
+
- **Optional** otherwise (auto-generates if omitted)
|
|
71
|
+
|
|
72
|
+
**Purpose:**
|
|
73
|
+
- Hierarchical swarm tracking in events (`swarm_id`, `parent_swarm_id`)
|
|
74
|
+
- Building parent/child relationships in composable swarms
|
|
75
|
+
- Identifying swarms in logs and monitoring
|
|
76
|
+
|
|
77
|
+
If omitted and not using composable swarms, an ID is auto-generated from the swarm name with a random suffix.
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
swarm:
|
|
81
|
+
id: development_team
|
|
82
|
+
id: code_review_v2
|
|
83
|
+
id: main_app
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
63
88
|
### name
|
|
64
89
|
|
|
65
90
|
**Type:** String (required)
|
|
@@ -73,6 +98,94 @@ swarm:
|
|
|
73
98
|
|
|
74
99
|
---
|
|
75
100
|
|
|
101
|
+
### swarms
|
|
102
|
+
|
|
103
|
+
**Type:** Object (optional)
|
|
104
|
+
**Description:** External swarms to register for composable swarms feature.
|
|
105
|
+
**Format:** `{ swarm_name: swarm_config }`
|
|
106
|
+
|
|
107
|
+
**Enables delegation to other swarms as if they were agents.** A swarm IS an agent - delegating to a child swarm is identical to delegating to an agent. The child swarm's lead agent serves as its public interface.
|
|
108
|
+
|
|
109
|
+
**Configuration per swarm:**
|
|
110
|
+
- `file` (String): Path to swarm file (.rb or .yml)
|
|
111
|
+
- `yaml` (String): YAML configuration content (for dynamic loading)
|
|
112
|
+
- `swarm` (Object): Inline swarm definition
|
|
113
|
+
- `keep_context` (Boolean, optional): Preserve conversation (default: true)
|
|
114
|
+
|
|
115
|
+
**Rules:**
|
|
116
|
+
- Exactly ONE of `file`, `yaml`, or `swarm` must be provided
|
|
117
|
+
- `id` must be set on parent swarm when using `swarms:`
|
|
118
|
+
|
|
119
|
+
**Example - From Files:**
|
|
120
|
+
```yaml
|
|
121
|
+
swarm:
|
|
122
|
+
id: main_app
|
|
123
|
+
name: "Main Application"
|
|
124
|
+
lead: backend
|
|
125
|
+
|
|
126
|
+
swarms:
|
|
127
|
+
code_review:
|
|
128
|
+
file: "./swarms/code_review.rb"
|
|
129
|
+
keep_context: true
|
|
130
|
+
|
|
131
|
+
testing:
|
|
132
|
+
file: "./swarms/testing.yml"
|
|
133
|
+
keep_context: false
|
|
134
|
+
|
|
135
|
+
agents:
|
|
136
|
+
backend:
|
|
137
|
+
delegates_to:
|
|
138
|
+
- code_review
|
|
139
|
+
- testing
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Example - Inline Definition:**
|
|
143
|
+
```yaml
|
|
144
|
+
swarm:
|
|
145
|
+
id: main_app
|
|
146
|
+
name: "Main Application"
|
|
147
|
+
lead: backend
|
|
148
|
+
|
|
149
|
+
swarms:
|
|
150
|
+
# File reference
|
|
151
|
+
code_review:
|
|
152
|
+
file: "./swarms/code_review.rb"
|
|
153
|
+
|
|
154
|
+
# Inline definition - no file needed!
|
|
155
|
+
testing:
|
|
156
|
+
keep_context: false
|
|
157
|
+
swarm:
|
|
158
|
+
id: testing_team
|
|
159
|
+
name: "Testing Team"
|
|
160
|
+
lead: tester
|
|
161
|
+
agents:
|
|
162
|
+
tester:
|
|
163
|
+
description: "Test specialist"
|
|
164
|
+
model: gpt-4o-mini
|
|
165
|
+
system: "You test code"
|
|
166
|
+
tools:
|
|
167
|
+
- Think
|
|
168
|
+
- Bash
|
|
169
|
+
|
|
170
|
+
agents:
|
|
171
|
+
backend:
|
|
172
|
+
description: "Backend developer"
|
|
173
|
+
delegates_to:
|
|
174
|
+
- code_review
|
|
175
|
+
- testing
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Hierarchical IDs:**
|
|
179
|
+
Sub-swarms automatically get hierarchical IDs:
|
|
180
|
+
- Parent swarm: `main_app`
|
|
181
|
+
- Sub-swarms: `main_app/code_review`, `main_app/testing`
|
|
182
|
+
|
|
183
|
+
**Keep Context:**
|
|
184
|
+
- `keep_context: true` (default): Swarm maintains conversation history
|
|
185
|
+
- `keep_context: false`: Swarm context resets after each delegation
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
76
189
|
### lead
|
|
77
190
|
|
|
78
191
|
**Type:** String (required)
|
|
@@ -86,18 +199,50 @@ swarm:
|
|
|
86
199
|
|
|
87
200
|
---
|
|
88
201
|
|
|
89
|
-
###
|
|
202
|
+
### scratchpad
|
|
90
203
|
|
|
91
|
-
**Type:**
|
|
92
|
-
**Default:** `
|
|
93
|
-
**Description:**
|
|
204
|
+
**Type:** Symbol/String (optional)
|
|
205
|
+
**Default:** `disabled`
|
|
206
|
+
**Description:** Configure scratchpad mode for the swarm or workflow.
|
|
207
|
+
|
|
208
|
+
**Valid Values:**
|
|
209
|
+
- For regular Swarms: `enabled`, `disabled`
|
|
210
|
+
- For workflows with nodes: `enabled`, `per_node`, `disabled`
|
|
94
211
|
|
|
95
|
-
|
|
212
|
+
**Modes:**
|
|
213
|
+
- **`enabled`**: Scratchpad tools available (ScratchpadWrite, ScratchpadRead, ScratchpadList)
|
|
214
|
+
- Regular Swarm: All agents share one scratchpad
|
|
215
|
+
- With nodes: All nodes share one scratchpad across workflow
|
|
216
|
+
- **`per_node`**: (Nodes only) Each node gets isolated scratchpad storage
|
|
217
|
+
- **`disabled`**: No scratchpad tools available
|
|
218
|
+
|
|
219
|
+
Scratchpad is volatile (in-memory only) and provides temporary storage for cross-agent or cross-node communication.
|
|
96
220
|
|
|
97
221
|
```yaml
|
|
222
|
+
# Regular swarm
|
|
223
|
+
swarm:
|
|
224
|
+
scratchpad: enabled # enable scratchpad
|
|
225
|
+
scratchpad: disabled # no scratchpad (default)
|
|
226
|
+
|
|
227
|
+
# With nodes - shared across all nodes
|
|
228
|
+
swarm:
|
|
229
|
+
scratchpad: enabled
|
|
230
|
+
|
|
231
|
+
nodes:
|
|
232
|
+
planning: { ... }
|
|
233
|
+
implementation: { ... }
|
|
234
|
+
|
|
235
|
+
start_node: planning
|
|
236
|
+
|
|
237
|
+
# With nodes - isolated per node
|
|
98
238
|
swarm:
|
|
99
|
-
|
|
100
|
-
|
|
239
|
+
scratchpad: per_node
|
|
240
|
+
|
|
241
|
+
nodes:
|
|
242
|
+
planning: { ... }
|
|
243
|
+
implementation: { ... }
|
|
244
|
+
|
|
245
|
+
start_node: planning
|
|
101
246
|
```
|
|
102
247
|
|
|
103
248
|
---
|
|
@@ -168,53 +313,93 @@ swarm:
|
|
|
168
313
|
|
|
169
314
|
### nodes
|
|
170
315
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
> The documentation below describes the node structure for reference, but you cannot use nodes in YAML files.
|
|
174
|
-
> To use node-based workflows, you must use the Ruby DSL. See [Ruby DSL Reference](./ruby-dsl.md#node-builder-dsl) for details.
|
|
175
|
-
|
|
176
|
-
**Type:** Object (optional, **Ruby DSL only**)
|
|
177
|
-
**Description:** Map of node names to node configurations. Enables multi-stage workflows.
|
|
316
|
+
**Type:** Object (optional)
|
|
317
|
+
**Description:** Map of node names to node configurations. Enables multi-stage workflows with multiple execution stages.
|
|
178
318
|
**Format:** `{ node_name: node_config }`
|
|
179
319
|
|
|
180
|
-
|
|
320
|
+
Nodes allow you to create workflows where different agent teams collaborate in sequence. Each node is an independent swarm execution that can receive input from previous nodes and pass output to subsequent nodes.
|
|
181
321
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
322
|
+
**Example:**
|
|
323
|
+
```yaml
|
|
324
|
+
nodes:
|
|
325
|
+
planning:
|
|
326
|
+
agents:
|
|
327
|
+
- agent: architect
|
|
328
|
+
output_command: "tee plan.txt"
|
|
189
329
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
330
|
+
implementation:
|
|
331
|
+
agents:
|
|
332
|
+
- agent: backend
|
|
333
|
+
delegates_to: [tester]
|
|
334
|
+
tools: [Read, Edit, Write] # Override tools for this node
|
|
335
|
+
- agent: tester
|
|
336
|
+
dependencies: [planning]
|
|
337
|
+
input_command: "cat plan.txt"
|
|
338
|
+
|
|
339
|
+
review:
|
|
340
|
+
agents:
|
|
341
|
+
- agent: reviewer
|
|
342
|
+
dependencies: [implementation]
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Node configuration fields:**
|
|
346
|
+
- `agents` - Array of agent configurations (optional for computation-only nodes)
|
|
347
|
+
- `dependencies` - Array of prerequisite node names
|
|
348
|
+
- `lead` - Override the lead agent for this node
|
|
349
|
+
- `input_command` - Bash command to transform input before execution
|
|
350
|
+
- `input_timeout` - Timeout for input_command (seconds, default: 60)
|
|
351
|
+
- `output_command` - Bash command to transform output after execution
|
|
352
|
+
- `output_timeout` - Timeout for output_command (seconds, default: 60)
|
|
353
|
+
|
|
354
|
+
**Per-node agent configuration:**
|
|
355
|
+
Each agent in a node's `agents` array can have:
|
|
356
|
+
- `agent` (required) - Agent name (must be defined in global `agents` section)
|
|
357
|
+
- `delegates_to` (optional) - Override delegation targets for this node
|
|
358
|
+
- `reset_context` (optional) - Whether to reset context (default: true)
|
|
359
|
+
- `tools` (optional) - Override tools for this node (replaces global agent tools)
|
|
360
|
+
|
|
361
|
+
```yaml
|
|
362
|
+
nodes:
|
|
363
|
+
planning:
|
|
364
|
+
agents:
|
|
365
|
+
- agent: backend
|
|
366
|
+
tools: [Read, Think] # Restrict to read-only + reasoning in planning
|
|
367
|
+
|
|
368
|
+
implementation:
|
|
369
|
+
agents:
|
|
370
|
+
- agent: backend
|
|
371
|
+
delegates_to: [tester]
|
|
372
|
+
tools: [Read, Edit, Write, Bash] # Full tools in implementation
|
|
197
373
|
```
|
|
198
374
|
|
|
199
375
|
---
|
|
200
376
|
|
|
201
377
|
### start_node
|
|
202
378
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
**Type:** String (required if nodes defined, **Ruby DSL only**)
|
|
379
|
+
**Type:** String (required if nodes defined)
|
|
206
380
|
**Description:** Name of the starting node for workflow execution.
|
|
207
381
|
|
|
208
|
-
**
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
382
|
+
**Example:**
|
|
383
|
+
```yaml
|
|
384
|
+
swarm:
|
|
385
|
+
name: "Dev Workflow"
|
|
386
|
+
lead: coordinator
|
|
387
|
+
agents:
|
|
388
|
+
coordinator:
|
|
389
|
+
description: "Coordinator"
|
|
390
|
+
model: "gpt-5"
|
|
391
|
+
backend:
|
|
392
|
+
description: "Backend dev"
|
|
393
|
+
model: "gpt-5"
|
|
214
394
|
nodes:
|
|
215
395
|
planning:
|
|
216
|
-
|
|
217
|
-
|
|
396
|
+
agents:
|
|
397
|
+
- agent: coordinator
|
|
398
|
+
implementation:
|
|
399
|
+
agents:
|
|
400
|
+
- agent: backend
|
|
401
|
+
dependencies: [planning]
|
|
402
|
+
start_node: planning # Start with planning node
|
|
218
403
|
```
|
|
219
404
|
|
|
220
405
|
---
|
|
@@ -401,7 +586,7 @@ agents:
|
|
|
401
586
|
**Default tools (when `default tools enabled`):**
|
|
402
587
|
- `Read`, `Glob`, `Grep`, `TodoWrite`, `Think`, `WebFetch`
|
|
403
588
|
|
|
404
|
-
**Scratchpad tools** (
|
|
589
|
+
**Scratchpad tools** (opt-in via `scratchpad: enabled` at swarm level):
|
|
405
590
|
- `ScratchpadWrite`, `ScratchpadRead`, `ScratchpadList`
|
|
406
591
|
|
|
407
592
|
**Memory tools** (added if agent has `memory` configured):
|
|
@@ -457,6 +642,60 @@ agents:
|
|
|
457
642
|
|
|
458
643
|
---
|
|
459
644
|
|
|
645
|
+
### shared_across_delegations
|
|
646
|
+
|
|
647
|
+
**Type:** Boolean (optional)
|
|
648
|
+
**Default:** `false`
|
|
649
|
+
**Description:** Control whether multiple agents share the same instance when delegating to this agent.
|
|
650
|
+
|
|
651
|
+
**Values:**
|
|
652
|
+
- `false` (default): Create isolated instances per delegator (recommended)
|
|
653
|
+
- `true`: Share the same instance across all delegators
|
|
654
|
+
|
|
655
|
+
**Behavior:**
|
|
656
|
+
|
|
657
|
+
By default, when multiple agents delegate to the same target, each gets its own isolated instance with separate conversation history. This prevents context mixing.
|
|
658
|
+
|
|
659
|
+
**Isolated Mode Example (default):**
|
|
660
|
+
```yaml
|
|
661
|
+
agents:
|
|
662
|
+
tester:
|
|
663
|
+
description: "Testing agent"
|
|
664
|
+
# shared_across_delegations: false (default)
|
|
665
|
+
|
|
666
|
+
frontend:
|
|
667
|
+
delegates_to: [tester] # Gets tester@frontend
|
|
668
|
+
|
|
669
|
+
backend:
|
|
670
|
+
delegates_to: [tester] # Gets tester@backend (separate)
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**Shared Mode Example (opt-in):**
|
|
674
|
+
```yaml
|
|
675
|
+
agents:
|
|
676
|
+
database:
|
|
677
|
+
description: "Database coordination agent"
|
|
678
|
+
shared_across_delegations: true # All delegators share this
|
|
679
|
+
|
|
680
|
+
frontend:
|
|
681
|
+
delegates_to: [database] # Gets shared database primary
|
|
682
|
+
|
|
683
|
+
backend:
|
|
684
|
+
delegates_to: [database] # Gets same shared database
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
**Memory Sharing:**
|
|
688
|
+
|
|
689
|
+
Plugin storage (like SwarmMemory) is always shared by base agent name:
|
|
690
|
+
- `tester@frontend` and `tester@backend` share memory storage
|
|
691
|
+
- Only conversation history and tool state are isolated
|
|
692
|
+
|
|
693
|
+
**When to use:**
|
|
694
|
+
- **Shared mode**: Stateful coordination, database agents, shared context needs
|
|
695
|
+
- **Isolated mode (default)**: Testing different codebases, reviewing different PRs, preventing context mixing
|
|
696
|
+
|
|
697
|
+
---
|
|
698
|
+
|
|
460
699
|
### memory
|
|
461
700
|
|
|
462
701
|
**Type:** Object (optional)
|
|
@@ -719,7 +958,7 @@ agents:
|
|
|
719
958
|
|
|
720
959
|
**Type:** Boolean (optional)
|
|
721
960
|
**Default:** `true`
|
|
722
|
-
**Description:** Include default tools (Read, Grep, Glob,
|
|
961
|
+
**Description:** Include default tools (Read, Grep, Glob, and scratchpad tools).
|
|
723
962
|
|
|
724
963
|
```yaml
|
|
725
964
|
agents:
|
|
@@ -1342,14 +1581,9 @@ agents:
|
|
|
1342
1581
|
|
|
1343
1582
|
---
|
|
1344
1583
|
|
|
1345
|
-
## Node Configuration
|
|
1584
|
+
## Node Configuration
|
|
1346
1585
|
|
|
1347
|
-
|
|
1348
|
-
>
|
|
1349
|
-
> The following documentation is for reference only. To use node-based workflows, you MUST use the Ruby DSL.
|
|
1350
|
-
> See [Ruby DSL Reference](./ruby-dsl.md#node-builder-dsl) for working examples.
|
|
1351
|
-
|
|
1352
|
-
Fields under each node in `swarm.nodes` (**Ruby DSL only**).
|
|
1586
|
+
Fields under each node in `swarm.nodes`.
|
|
1353
1587
|
|
|
1354
1588
|
### agents
|
|
1355
1589
|
|
|
@@ -1357,7 +1591,9 @@ Fields under each node in `swarm.nodes` (**Ruby DSL only**).
|
|
|
1357
1591
|
**Default:** `[]`
|
|
1358
1592
|
**Description:** List of agents participating in this node.
|
|
1359
1593
|
|
|
1360
|
-
|
|
1594
|
+
Nodes can have zero agents (computation-only nodes with transformers) or multiple agents working together. Each agent can have delegation configured and context preservation settings.
|
|
1595
|
+
|
|
1596
|
+
**Format:** Array of objects with `agent`, optional `delegates_to`, and optional `reset_context`
|
|
1361
1597
|
|
|
1362
1598
|
```yaml
|
|
1363
1599
|
nodes:
|
|
@@ -1367,6 +1603,7 @@ nodes:
|
|
|
1367
1603
|
delegates_to: [tester, database]
|
|
1368
1604
|
- agent: tester
|
|
1369
1605
|
delegates_to: [database]
|
|
1606
|
+
reset_context: false # Preserve context from previous nodes
|
|
1370
1607
|
- agent: database
|
|
1371
1608
|
```
|
|
1372
1609
|
|
|
@@ -1376,7 +1613,9 @@ nodes:
|
|
|
1376
1613
|
|
|
1377
1614
|
**Type:** String (optional)
|
|
1378
1615
|
**Default:** First agent in `agents` list
|
|
1379
|
-
**Description:** Lead agent for this node (overrides first agent).
|
|
1616
|
+
**Description:** Lead agent for this node (overrides default first agent).
|
|
1617
|
+
|
|
1618
|
+
The lead agent receives the initial prompt and coordinates the node's execution.
|
|
1380
1619
|
|
|
1381
1620
|
```yaml
|
|
1382
1621
|
nodes:
|
|
@@ -1384,7 +1623,7 @@ nodes:
|
|
|
1384
1623
|
agents:
|
|
1385
1624
|
- agent: backend
|
|
1386
1625
|
- agent: reviewer
|
|
1387
|
-
lead: reviewer #
|
|
1626
|
+
lead: reviewer # reviewer leads instead of backend
|
|
1388
1627
|
```
|
|
1389
1628
|
|
|
1390
1629
|
---
|
|
@@ -1395,7 +1634,7 @@ nodes:
|
|
|
1395
1634
|
**Default:** `[]`
|
|
1396
1635
|
**Description:** List of prerequisite node names that must execute before this node.
|
|
1397
1636
|
|
|
1398
|
-
|
|
1637
|
+
Dependencies create a directed acyclic graph (DAG) of node execution. A node waits for all its dependencies to complete before starting.
|
|
1399
1638
|
|
|
1400
1639
|
```yaml
|
|
1401
1640
|
nodes:
|
|
@@ -1406,20 +1645,36 @@ nodes:
|
|
|
1406
1645
|
implementation:
|
|
1407
1646
|
agents:
|
|
1408
1647
|
- agent: backend
|
|
1409
|
-
dependencies: [planning]
|
|
1648
|
+
dependencies: [planning] # Runs after planning
|
|
1410
1649
|
|
|
1411
1650
|
testing:
|
|
1412
1651
|
agents:
|
|
1413
1652
|
- agent: tester
|
|
1414
|
-
dependencies: [implementation]
|
|
1653
|
+
dependencies: [implementation] # Runs after implementation
|
|
1415
1654
|
```
|
|
1416
1655
|
|
|
1417
1656
|
---
|
|
1418
1657
|
|
|
1419
|
-
###
|
|
1658
|
+
### reset_context
|
|
1420
1659
|
|
|
1421
|
-
**Type:**
|
|
1422
|
-
**
|
|
1660
|
+
**Type:** Boolean (optional, per-agent in node)
|
|
1661
|
+
**Default:** `true`
|
|
1662
|
+
**Description:** Whether to reset agent conversation context in this node.
|
|
1663
|
+
|
|
1664
|
+
Set to `false` to preserve conversation history from previous nodes, enabling stateful multi-node workflows.
|
|
1665
|
+
|
|
1666
|
+
```yaml
|
|
1667
|
+
nodes:
|
|
1668
|
+
first:
|
|
1669
|
+
agents:
|
|
1670
|
+
- agent: architect
|
|
1671
|
+
|
|
1672
|
+
second:
|
|
1673
|
+
agents:
|
|
1674
|
+
- agent: architect
|
|
1675
|
+
reset_context: false # Preserve history from first node
|
|
1676
|
+
dependencies: [first]
|
|
1677
|
+
```
|
|
1423
1678
|
|
|
1424
1679
|
---
|
|
1425
1680
|
|
|
@@ -1789,12 +2044,11 @@ swarm:
|
|
|
1789
2044
|
parameters:
|
|
1790
2045
|
temperature: 0.2
|
|
1791
2046
|
|
|
1792
|
-
# Multi-stage workflow
|
|
2047
|
+
# Multi-stage workflow
|
|
1793
2048
|
nodes:
|
|
1794
2049
|
planning:
|
|
1795
2050
|
agents:
|
|
1796
2051
|
- agent: coordinator
|
|
1797
|
-
|
|
1798
2052
|
output_command: "tee plan.txt"
|
|
1799
2053
|
|
|
1800
2054
|
backend_implementation:
|
|
@@ -1803,7 +2057,6 @@ swarm:
|
|
|
1803
2057
|
delegates_to: [database]
|
|
1804
2058
|
- agent: database
|
|
1805
2059
|
dependencies: [planning]
|
|
1806
|
-
|
|
1807
2060
|
input_command: "scripts/prepare-backend-context.sh"
|
|
1808
2061
|
output_command: "scripts/save-backend-results.sh"
|
|
1809
2062
|
|
|
@@ -1811,14 +2064,12 @@ swarm:
|
|
|
1811
2064
|
agents:
|
|
1812
2065
|
- agent: frontend
|
|
1813
2066
|
dependencies: [planning]
|
|
1814
|
-
|
|
1815
2067
|
input_command: "scripts/prepare-frontend-context.sh"
|
|
1816
2068
|
|
|
1817
2069
|
review:
|
|
1818
2070
|
agents:
|
|
1819
2071
|
- agent: reviewer
|
|
1820
2072
|
dependencies: [backend_implementation, frontend_implementation]
|
|
1821
|
-
|
|
1822
2073
|
input_command: "scripts/gather-changes.sh"
|
|
1823
2074
|
output_command: "scripts/format-review.sh"
|
|
1824
2075
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# Demo of SwarmSDK Snapshot/Restore functionality
|
|
5
|
+
#
|
|
6
|
+
# This example demonstrates:
|
|
7
|
+
# 1. Creating a swarm and executing tasks
|
|
8
|
+
# 2. Creating a snapshot object
|
|
9
|
+
# 3. Saving snapshot to file
|
|
10
|
+
# 4. Loading snapshot from file
|
|
11
|
+
# 5. Restoring into a new swarm instance
|
|
12
|
+
|
|
13
|
+
require "bundler/setup"
|
|
14
|
+
require "swarm_sdk"
|
|
15
|
+
|
|
16
|
+
# Set dummy API key for demo (agents won't actually call LLM)
|
|
17
|
+
ENV["OPENAI_API_KEY"] = "test-key"
|
|
18
|
+
|
|
19
|
+
puts "=== SwarmSDK Snapshot/Restore Demo ===\n\n"
|
|
20
|
+
|
|
21
|
+
# Create a simple swarm
|
|
22
|
+
puts "1. Creating swarm..."
|
|
23
|
+
swarm = SwarmSDK.build do
|
|
24
|
+
name("Demo Team")
|
|
25
|
+
lead(:assistant)
|
|
26
|
+
|
|
27
|
+
agent(:assistant) do
|
|
28
|
+
provider("openai")
|
|
29
|
+
model("claude-haiku-4-5")
|
|
30
|
+
base_url("https://proxy-shopify-ai.local.shop.dev/v1")
|
|
31
|
+
description("Helpful assistant")
|
|
32
|
+
system_prompt("You are a helpful assistant")
|
|
33
|
+
tools(:Think)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
puts " ✓ Swarm created\n\n"
|
|
38
|
+
|
|
39
|
+
# Execute a task (simulated with direct message for demo)
|
|
40
|
+
puts "2. Adding conversation history..."
|
|
41
|
+
# Simulate a conversation by accessing the agent and adding messages manually
|
|
42
|
+
assistant_agent = swarm.agent(:assistant)
|
|
43
|
+
assistant_agent.messages << RubyLLM::Message.new(
|
|
44
|
+
role: :user,
|
|
45
|
+
content: "Hello! Can you help me with Ruby development?",
|
|
46
|
+
)
|
|
47
|
+
assistant_agent.messages << RubyLLM::Message.new(
|
|
48
|
+
role: :assistant,
|
|
49
|
+
content: "Of course! I'd be happy to help with Ruby development. What do you need?",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
puts " ✓ Conversation history added (#{assistant_agent.messages.size} messages)\n\n"
|
|
53
|
+
|
|
54
|
+
# Create snapshot
|
|
55
|
+
puts "3. Creating snapshot..."
|
|
56
|
+
snapshot = swarm.snapshot
|
|
57
|
+
|
|
58
|
+
puts " ✓ Snapshot created"
|
|
59
|
+
puts " - Type: #{snapshot.type}"
|
|
60
|
+
puts " - Version: #{snapshot.version}"
|
|
61
|
+
puts " - Created at: #{snapshot.snapshot_at}"
|
|
62
|
+
puts " - Agents: #{snapshot.agent_names.join(", ")}\n\n"
|
|
63
|
+
|
|
64
|
+
# Save to file
|
|
65
|
+
puts "4. Saving snapshot to file..."
|
|
66
|
+
snapshot_path = "/tmp/swarm_demo_snapshot.json"
|
|
67
|
+
snapshot.write_to_file(snapshot_path)
|
|
68
|
+
|
|
69
|
+
puts " ✓ Snapshot saved to: #{snapshot_path}\n\n"
|
|
70
|
+
|
|
71
|
+
# Create a new swarm (same config)
|
|
72
|
+
puts "5. Creating new swarm instance (simulating new process)..."
|
|
73
|
+
swarm2 = SwarmSDK.build do
|
|
74
|
+
name("Demo Team")
|
|
75
|
+
lead(:assistant)
|
|
76
|
+
|
|
77
|
+
agent(:assistant) do
|
|
78
|
+
provider("openai")
|
|
79
|
+
model("claude-haiku-4-5")
|
|
80
|
+
base_url("https://proxy-shopify-ai.local.shop.dev/v1")
|
|
81
|
+
description("Helpful assistant")
|
|
82
|
+
system_prompt("You are a helpful assistant")
|
|
83
|
+
tools(:Think)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
puts " ✓ New swarm created (conversation is empty)\n\n"
|
|
88
|
+
|
|
89
|
+
# Load snapshot from file
|
|
90
|
+
puts "6. Loading snapshot from file..."
|
|
91
|
+
loaded_snapshot = SwarmSDK::Snapshot.from_file(snapshot_path)
|
|
92
|
+
|
|
93
|
+
puts " ✓ Snapshot loaded\n\n"
|
|
94
|
+
|
|
95
|
+
# Restore into new swarm
|
|
96
|
+
puts "7. Restoring conversation state..."
|
|
97
|
+
result = swarm2.restore(loaded_snapshot)
|
|
98
|
+
|
|
99
|
+
if result.success?
|
|
100
|
+
puts " ✓ Restore successful!"
|
|
101
|
+
puts " - All agents restored\n\n"
|
|
102
|
+
else
|
|
103
|
+
puts " ⚠ Partial restore"
|
|
104
|
+
puts " - #{result.summary}\n\n"
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Verify restoration
|
|
108
|
+
puts "8. Verifying restoration..."
|
|
109
|
+
assistant2 = swarm2.agent(:assistant)
|
|
110
|
+
puts " ✓ Agent has #{assistant2.messages.size} messages (should be 3)"
|
|
111
|
+
assistant2.messages.each_with_index do |msg, i|
|
|
112
|
+
content_preview = msg.content.to_s[0..50]
|
|
113
|
+
puts " - Message #{i + 1} [#{msg.role}]: #{content_preview}..."
|
|
114
|
+
end
|
|
115
|
+
puts
|
|
116
|
+
|
|
117
|
+
# Cleanup
|
|
118
|
+
File.delete(snapshot_path) if File.exist?(snapshot_path)
|
|
119
|
+
puts "=== Demo Complete ===\n"
|
data/examples/v2/dsl/01_basic.rb
CHANGED
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
# Run: bundle exec ruby -Ilib lib/swarm_sdk/examples/dsl/05_advanced_flags.rb
|
|
9
9
|
|
|
10
10
|
require "swarm_sdk"
|
|
11
|
-
require_relative "../../../swarm_sdk/swarm_builder"
|
|
12
|
-
require_relative "../../../swarm_sdk/agent_builder"
|
|
13
|
-
require_relative "../../../swarm_sdk/permissions_builder"
|
|
14
11
|
|
|
15
12
|
ENV["OPENAI_API_KEY"] = "test-key"
|
|
16
13
|
|