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/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# SwarmSDK &
|
|
1
|
+
# SwarmSDK, SwarmCLI & SwarmMemory Documentation
|
|
2
2
|
|
|
3
|
-
**Version 2.
|
|
3
|
+
**Version 2.1**
|
|
4
4
|
|
|
5
|
-
Welcome to the official documentation for SwarmSDK and
|
|
5
|
+
Welcome to the official documentation for SwarmSDK, SwarmCLI, and SwarmMemory - a Ruby framework for orchestrating multiple AI agents as a collaborative team with persistent memory.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -18,6 +18,10 @@ Welcome to the official documentation for SwarmSDK and SwarmCLI - a Ruby framewo
|
|
|
18
18
|
- **[Getting Started with SwarmCLI](guides/quick-start-cli.md)** ⭐ START HERE
|
|
19
19
|
Command-line interface: interactive REPL and automation modes
|
|
20
20
|
|
|
21
|
+
### For Advanced Features
|
|
22
|
+
- **[Composable Swarms Guide](guides/composable-swarms.md)** ⭐ NEW
|
|
23
|
+
Build reusable swarm components: file/YAML/inline registration, hierarchical composition, keep_context control
|
|
24
|
+
|
|
21
25
|
---
|
|
22
26
|
|
|
23
27
|
## 📖 Comprehensive Tutorial
|
|
@@ -41,21 +45,45 @@ Welcome to the official documentation for SwarmSDK and SwarmCLI - a Ruby framewo
|
|
|
41
45
|
|
|
42
46
|
**Quick lookups and complete API reference:**
|
|
43
47
|
|
|
48
|
+
### Architecture & Execution
|
|
49
|
+
- **[Architecture Flow Diagram](reference/architecture-flow.md)** ⭐ NEW
|
|
50
|
+
Complete system architecture: components, dependencies, and relationships across SwarmSDK, SwarmCLI, and SwarmMemory
|
|
51
|
+
|
|
52
|
+
- **[Execution Flow Diagram](reference/execution-flow.md)** ⭐ NEW
|
|
53
|
+
Runtime execution journey: what happens when you execute a prompt (21 detailed steps across 6 phases)
|
|
54
|
+
|
|
55
|
+
- **[Event Payload Structures](reference/event_payload_structures.md)**
|
|
56
|
+
Complete reference for all log event types and their payloads
|
|
57
|
+
|
|
44
58
|
### Command-Line Interface
|
|
45
59
|
- **[CLI Reference](reference/cli.md)**
|
|
46
60
|
Complete reference for all swarm commands: `run`, `migrate`, `mcp serve`, `mcp tools`
|
|
47
61
|
|
|
48
62
|
### Ruby DSL API
|
|
49
63
|
- **[Ruby DSL Reference](reference/ruby-dsl.md)**
|
|
50
|
-
Complete programmatic API: `SwarmSDK.build`, agent DSL, permissions DSL, node DSL, hooks
|
|
64
|
+
Complete programmatic API: `SwarmSDK.build`, `SwarmSDK.load`, agent DSL, permissions DSL, node DSL, hooks
|
|
51
65
|
|
|
52
66
|
### YAML Configuration
|
|
53
67
|
- **[YAML Configuration Reference](reference/yaml.md)**
|
|
54
|
-
Complete YAML structure: agents, tools, permissions, hooks, MCP servers
|
|
68
|
+
Complete YAML structure: agents, tools, permissions, hooks, nodes, MCP servers
|
|
69
|
+
|
|
70
|
+
### SwarmMemory
|
|
71
|
+
- **[SwarmMemory Technical Details](reference/swarm_memory_technical_details.md)**
|
|
72
|
+
Deep dive: storage architecture, semantic search, FAISS indexing, adapter interface
|
|
55
73
|
|
|
56
74
|
---
|
|
57
75
|
|
|
58
|
-
## 🛠️
|
|
76
|
+
## 🛠️ Feature Guides
|
|
77
|
+
|
|
78
|
+
### Composable Swarms
|
|
79
|
+
- **[Composable Swarms Guide](guides/composable-swarms.md)** ⭐ NEW
|
|
80
|
+
Build reusable swarm components that can be composed together:
|
|
81
|
+
- Three registration methods (file, YAML string, inline block)
|
|
82
|
+
- Hierarchical composition and deep nesting
|
|
83
|
+
- Context control (keep_context: true/false)
|
|
84
|
+
- Circular dependency detection
|
|
85
|
+
- Event tracking with swarm_id hierarchy
|
|
86
|
+
- Use cases: specialized teams, dynamic loading, gems, testing
|
|
59
87
|
|
|
60
88
|
### SwarmMemory
|
|
61
89
|
- **[SwarmMemory Guide](guides/swarm-memory.md)** ⭐ NEW
|
|
@@ -114,6 +142,7 @@ Welcome to the official documentation for SwarmSDK and SwarmCLI - a Ruby framewo
|
|
|
114
142
|
- **Agents**: [Getting Started](guides/getting-started.md#core-concepts) | [Tutorial Part 1](guides/complete-tutorial.md#part-1-fundamentals)
|
|
115
143
|
- **Tools**: [Tutorial Part 2](guides/complete-tutorial.md#part-2-tools-and-permissions)
|
|
116
144
|
- **Delegation**: [Tutorial Part 3](guides/complete-tutorial.md#part-3-agent-collaboration)
|
|
145
|
+
- **Composable Swarms**: [Ruby DSL Ref](reference/ruby-dsl.md#swarms) | [YAML Ref](reference/yaml.md#swarms) ⭐ NEW
|
|
117
146
|
- **Hooks**: [Tutorial Part 4](guides/complete-tutorial.md#part-4-hooks-system)
|
|
118
147
|
- **Node Workflows**: [Tutorial Part 5](guides/complete-tutorial.md#part-5-node-workflows)
|
|
119
148
|
|
|
@@ -131,6 +160,7 @@ Welcome to the official documentation for SwarmSDK and SwarmCLI - a Ruby framewo
|
|
|
131
160
|
- **Rate Limiting**: [Tutorial Part 6](guides/complete-tutorial.md#rate-limiting)
|
|
132
161
|
|
|
133
162
|
### Production
|
|
163
|
+
- **Security**: [Filesystem Tools Control](reference/ruby-dsl.md#swarmsdk.configure) | [Tutorial Part 8](guides/complete-tutorial.md#security-considerations)
|
|
134
164
|
- **Logging**: [Tutorial Part 7](guides/complete-tutorial.md#structured-logging)
|
|
135
165
|
- **Error Handling**: [Tutorial Part 7](guides/complete-tutorial.md#error-handling-and-recovery)
|
|
136
166
|
- **Testing**: [Tutorial Part 8](guides/complete-tutorial.md#testing-strategies) | [Rails Guide](guides/rails-integration.md#testing-strategies)
|
|
@@ -166,12 +196,24 @@ Welcome to the official documentation for SwarmSDK and SwarmCLI - a Ruby framewo
|
|
|
166
196
|
**Add persistent memory to agents**
|
|
167
197
|
→ [SwarmMemory Guide](guides/swarm-memory.md)
|
|
168
198
|
|
|
199
|
+
**Build composable/reusable swarm teams** ⭐ NEW
|
|
200
|
+
→ [Composable Swarms Guide](guides/composable-swarms.md)
|
|
201
|
+
|
|
169
202
|
**Build a SwarmSDK plugin**
|
|
170
203
|
→ [Plugin System Guide](guides/plugins.md)
|
|
171
204
|
|
|
172
205
|
**Build a custom storage adapter**
|
|
173
206
|
→ [Memory Adapter Guide](guides/memory-adapters.md)
|
|
174
207
|
|
|
208
|
+
**Secure swarms for production** ⭐ NEW
|
|
209
|
+
→ [Filesystem Tools Control](reference/ruby-dsl.md#swarmsdk.configure) | [Security Considerations](guides/complete-tutorial.md#security-considerations)
|
|
210
|
+
|
|
211
|
+
**Understand the system architecture**
|
|
212
|
+
→ [Architecture Flow Diagram](reference/architecture-flow.md)
|
|
213
|
+
|
|
214
|
+
**Understand how execution works**
|
|
215
|
+
→ [Execution Flow Diagram](reference/execution-flow.md)
|
|
216
|
+
|
|
175
217
|
---
|
|
176
218
|
|
|
177
219
|
## 📊 Documentation Structure
|
|
@@ -184,20 +226,26 @@ docs/v2/
|
|
|
184
226
|
│ ├── getting-started.md # SDK quick start (YAML + Ruby DSL)
|
|
185
227
|
│ ├── quick-start-cli.md # CLI quick start
|
|
186
228
|
│ ├── complete-tutorial.md # 100% feature coverage tutorial
|
|
187
|
-
│ ├──
|
|
188
|
-
│ ├──
|
|
189
|
-
│ ├──
|
|
229
|
+
│ ├── composable-swarms.md # Composable swarms guide ⭐ NEW
|
|
230
|
+
│ ├── swarm-memory.md # SwarmMemory guide ⭐
|
|
231
|
+
│ ├── plugins.md # Plugin system guide ⭐
|
|
232
|
+
│ ├── memory-adapters.md # Adapter development ⭐
|
|
190
233
|
│ ├── rails-integration.md # Rails integration guide
|
|
191
|
-
│
|
|
234
|
+
│ ├── claude-code-agents.md # Claude Code compatibility
|
|
235
|
+
│ └── MEMORY_DEFRAG_GUIDE.md # Memory defragmentation guide
|
|
192
236
|
│
|
|
193
237
|
├── reference/ # Complete API references
|
|
238
|
+
│ ├── architecture-flow.md # System architecture diagram ⭐ NEW
|
|
239
|
+
│ ├── execution-flow.md # Runtime execution flow ⭐ NEW
|
|
240
|
+
│ ├── event_payload_structures.md # Log event payloads
|
|
241
|
+
│ ├── swarm_memory_technical_details.md # SwarmMemory deep dive
|
|
194
242
|
│ ├── cli.md # CLI command reference
|
|
195
243
|
│ ├── ruby-dsl.md # Ruby DSL API reference
|
|
196
244
|
│ └── yaml.md # YAML configuration reference
|
|
197
245
|
│
|
|
198
246
|
└── CHANGELOG.swarm_sdk.md # SwarmSDK version history
|
|
199
247
|
CHANGELOG.swarm_cli.md # SwarmCLI version history
|
|
200
|
-
CHANGELOG.swarm_memory.md # SwarmMemory version history ⭐
|
|
248
|
+
CHANGELOG.swarm_memory.md # SwarmMemory version history ⭐
|
|
201
249
|
```
|
|
202
250
|
|
|
203
251
|
---
|
|
@@ -211,13 +259,22 @@ docs/v2/
|
|
|
211
259
|
|
|
212
260
|
### Path 2: Intermediate → Advanced
|
|
213
261
|
1. [Complete Tutorial Parts 4-6](guides/complete-tutorial.md) - Hooks, workflows, advanced config
|
|
214
|
-
2. [
|
|
215
|
-
3. [
|
|
262
|
+
2. [Composable Swarms Guide](guides/composable-swarms.md) ⭐ NEW - Build reusable swarm teams
|
|
263
|
+
3. [Rails Integration](guides/rails-integration.md) - Production integration patterns
|
|
264
|
+
4. [Complete Tutorial Parts 7-8](guides/complete-tutorial.md) - Production features and best practices
|
|
265
|
+
|
|
266
|
+
### Path 3: SwarmMemory Deep Dive
|
|
267
|
+
1. [SwarmMemory Guide](guides/swarm-memory.md) - Installation, memory tools, usage patterns
|
|
268
|
+
2. [Memory Defragmentation](guides/MEMORY_DEFRAG_GUIDE.md) - Relationship discovery and knowledge graphs
|
|
269
|
+
3. [SwarmMemory Technical Details](reference/swarm_memory_technical_details.md) - Architecture and internals
|
|
270
|
+
4. [Memory Adapter Development](guides/memory-adapters.md) - Build custom storage backends
|
|
216
271
|
|
|
217
|
-
### Path
|
|
272
|
+
### Path 4: Reference & API
|
|
218
273
|
1. [Ruby DSL Reference](reference/ruby-dsl.md) - Complete programmatic API
|
|
219
274
|
2. [YAML Reference](reference/yaml.md) - Complete configuration format
|
|
220
275
|
3. [CLI Reference](reference/cli.md) - All command-line options
|
|
276
|
+
4. [Architecture Flow](reference/architecture-flow.md) - System architecture diagram
|
|
277
|
+
5. [Execution Flow](reference/execution-flow.md) - Runtime execution journey
|
|
221
278
|
|
|
222
279
|
---
|
|
223
280
|
|
|
@@ -227,7 +284,8 @@ docs/v2/
|
|
|
227
284
|
A Ruby framework for orchestrating multiple AI agents that work together as a team. Each agent has:
|
|
228
285
|
- **Role**: Specialized expertise (backend developer, code reviewer, etc.)
|
|
229
286
|
- **Tools**: Capabilities (Read files, Write files, Run bash commands, etc.)
|
|
230
|
-
- **Delegation**: Ability to delegate subtasks to other agents
|
|
287
|
+
- **Delegation**: Ability to delegate subtasks to other agents or swarms
|
|
288
|
+
- **Composable Swarms**: Build hierarchies by delegating to reusable swarm components ⭐ NEW
|
|
231
289
|
- **Hooks**: Custom logic that runs at key points in execution
|
|
232
290
|
|
|
233
291
|
### SwarmCLI
|
|
@@ -235,6 +293,14 @@ A command-line interface for running SwarmSDK swarms with two modes:
|
|
|
235
293
|
- **Interactive (REPL)**: Conversational interface for exploration and iteration
|
|
236
294
|
- **Non-Interactive**: One-shot execution perfect for automation and scripting
|
|
237
295
|
|
|
296
|
+
### SwarmMemory
|
|
297
|
+
A persistent memory system for agents with semantic search capabilities:
|
|
298
|
+
- **Storage**: Hierarchical knowledge organization (concept, fact, skill, experience)
|
|
299
|
+
- **Semantic Search**: FAISS-based vector similarity with local ONNX embeddings
|
|
300
|
+
- **Memory Tools**: 9 tools for writing, reading, editing, and searching knowledge
|
|
301
|
+
- **LoadSkill**: Dynamic tool swapping based on semantic skill discovery
|
|
302
|
+
- **Plugin Architecture**: Integrates seamlessly via SwarmSDK plugin system
|
|
303
|
+
|
|
238
304
|
### Configuration Formats
|
|
239
305
|
- **YAML**: Declarative, easy to read, great for shell-based hooks
|
|
240
306
|
- **Ruby DSL**: Programmatic, dynamic, full Ruby power, IDE support
|
|
@@ -247,14 +313,20 @@ A command-line interface for running SwarmSDK swarms with two modes:
|
|
|
247
313
|
|-------|-------|-----------|
|
|
248
314
|
| **Installation** | [SDK Guide](guides/getting-started.md#installation) | - |
|
|
249
315
|
| **First Swarm** | [SDK Guide](guides/getting-started.md#your-first-swarm) | - |
|
|
316
|
+
| **Architecture** | - | [Architecture Flow](reference/architecture-flow.md) |
|
|
317
|
+
| **Execution Flow** | - | [Execution Flow](reference/execution-flow.md) |
|
|
250
318
|
| **CLI Commands** | [CLI Guide](guides/quick-start-cli.md#commands-overview) | [CLI Ref](reference/cli.md) |
|
|
251
319
|
| **REPL Mode** | [CLI Guide](guides/quick-start-cli.md#interactive-mode-repl) | [CLI Ref](reference/cli.md#interactive-mode) |
|
|
252
320
|
| **Tools** | [Tutorial Part 2](guides/complete-tutorial.md#part-2-tools-and-permissions) | [YAML Ref](reference/yaml.md#tools) |
|
|
253
321
|
| **Permissions** | [Tutorial Part 2](guides/complete-tutorial.md#permissions-system) | [YAML Ref](reference/yaml.md#permissions-configuration) |
|
|
254
322
|
| **Delegation** | [Tutorial Part 3](guides/complete-tutorial.md#part-3-agent-collaboration) | [Ruby DSL Ref](reference/ruby-dsl.md#delegates_to) |
|
|
323
|
+
| **Composable Swarms** ⭐ | [Composable Swarms Guide](guides/composable-swarms.md) | [Ruby DSL Ref](reference/ruby-dsl.md#swarms) · [YAML Ref](reference/yaml.md#swarms) |
|
|
255
324
|
| **Hooks** | [Tutorial Part 4](guides/complete-tutorial.md#part-4-hooks-system) | [YAML Ref](reference/yaml.md#hooks-configuration) |
|
|
256
|
-
| **Workflows** | [Tutorial Part 5](guides/complete-tutorial.md#part-5-node-workflows) | [Ruby DSL Ref](reference/ruby-dsl.md#node-builder-dsl) |
|
|
325
|
+
| **Workflows** | [Tutorial Part 5](guides/complete-tutorial.md#part-5-node-workflows) | [YAML Ref](reference/yaml.md#nodes) · [Ruby DSL Ref](reference/ruby-dsl.md#node-builder-dsl) |
|
|
257
326
|
| **MCP Servers** | [Tutorial Part 6](guides/complete-tutorial.md#mcp-server-integration) | [YAML Ref](reference/yaml.md#mcp_servers) |
|
|
327
|
+
| **Memory** | [SwarmMemory Guide](guides/swarm-memory.md) | [Technical Details](reference/swarm_memory_technical_details.md) |
|
|
328
|
+
| **Memory Adapters** | [Adapter Guide](guides/memory-adapters.md) | [Technical Details](reference/swarm_memory_technical_details.md) |
|
|
329
|
+
| **Plugins** | [Plugin Guide](guides/plugins.md) | - |
|
|
258
330
|
| **Rails** | [Rails Guide](guides/rails-integration.md) | - |
|
|
259
331
|
| **Testing** | [Tutorial Part 8](guides/complete-tutorial.md#testing-strategies) | - |
|
|
260
332
|
|
|
@@ -285,18 +357,6 @@ Found an issue or want to improve the documentation?
|
|
|
285
357
|
|
|
286
358
|
---
|
|
287
359
|
|
|
288
|
-
## 📄 Version History
|
|
289
|
-
|
|
290
|
-
### v2.0 (January 2025)
|
|
291
|
-
- Complete documentation rewrite
|
|
292
|
-
- Consolidated from 261 files to 7 focused documents
|
|
293
|
-
- 100% feature coverage
|
|
294
|
-
- Added Rails integration guide
|
|
295
|
-
- Added comprehensive tutorial
|
|
296
|
-
- Complete CLI, Ruby DSL, and YAML references
|
|
297
|
-
|
|
298
|
-
---
|
|
299
|
-
|
|
300
360
|
## 📚 Additional Resources
|
|
301
361
|
|
|
302
362
|
- **GitHub Repository**: [parruda/claude-swarm](https://github.com/parruda/claude-swarm)
|
|
@@ -395,7 +395,7 @@ agent :planner do
|
|
|
395
395
|
description "Task planner"
|
|
396
396
|
model "gpt-4"
|
|
397
397
|
system_prompt "Plan and track work"
|
|
398
|
-
|
|
398
|
+
tools :Read, :Grep, :Glob, :TodoWrite # Add TodoWrite explicitly
|
|
399
399
|
end
|
|
400
400
|
```
|
|
401
401
|
|
|
@@ -538,7 +538,7 @@ agent :problem_solver do
|
|
|
538
538
|
description "Problem solver"
|
|
539
539
|
model "gpt-4"
|
|
540
540
|
system_prompt "Use the Think tool frequently to reason through problems"
|
|
541
|
-
|
|
541
|
+
tools :Read, :Grep, :Glob, :Think # Add Think explicitly
|
|
542
542
|
end
|
|
543
543
|
```
|
|
544
544
|
|
|
@@ -585,7 +585,7 @@ agent :researcher do
|
|
|
585
585
|
description "Web researcher"
|
|
586
586
|
model "gpt-4"
|
|
587
587
|
system_prompt "Research information from web sources"
|
|
588
|
-
|
|
588
|
+
tools :Read, :Grep, :Glob, :WebFetch # Add WebFetch explicitly
|
|
589
589
|
end
|
|
590
590
|
```
|
|
591
591
|
|
|
@@ -631,8 +631,7 @@ WebFetch(url: "https://example.com/api-docs", prompt: "List all available API en
|
|
|
631
631
|
agent :agent_name do
|
|
632
632
|
description "..."
|
|
633
633
|
model "gpt-4"
|
|
634
|
-
disable_default_tools [:
|
|
635
|
-
# Or disable multiple: [:Think, :TodoWrite, :Grep]
|
|
634
|
+
disable_default_tools [:Read, :Grep] # Disable specific tools
|
|
636
635
|
end
|
|
637
636
|
```
|
|
638
637
|
|
|
@@ -678,8 +677,8 @@ end
|
|
|
678
677
|
agent :selective_agent do
|
|
679
678
|
description "Selective agent"
|
|
680
679
|
model "gpt-4"
|
|
681
|
-
disable_default_tools [:
|
|
682
|
-
# Still has:
|
|
680
|
+
disable_default_tools [:Read, :Grep] # Disable these
|
|
681
|
+
# Still has: Glob, Scratchpad tools
|
|
683
682
|
end
|
|
684
683
|
```
|
|
685
684
|
|
|
@@ -1084,6 +1083,67 @@ Lead ──┼──→ Security
|
|
|
1084
1083
|
- **Hub and Spoke**: Parallel tasks coordinated by lead
|
|
1085
1084
|
- **Specialist Pool**: Lead delegates to any specialist as needed
|
|
1086
1085
|
|
|
1086
|
+
#### Delegation Isolation Modes
|
|
1087
|
+
|
|
1088
|
+
When multiple agents delegate to the same target agent, you can control whether they share conversation history or get isolated instances.
|
|
1089
|
+
|
|
1090
|
+
**Problem this solves**: Without isolation, multiple agents delegating to the same target share conversation history, causing context mixing. For example, if both `frontend` and `backend` delegate to `tester`, the tester's conversation includes both delegations mixed together, making it confusing.
|
|
1091
|
+
|
|
1092
|
+
**Solution: Isolated Instances (Default)**
|
|
1093
|
+
|
|
1094
|
+
By default, each delegator gets its own isolated instance:
|
|
1095
|
+
|
|
1096
|
+
```yaml
|
|
1097
|
+
agents:
|
|
1098
|
+
tester:
|
|
1099
|
+
description: "Testing agent"
|
|
1100
|
+
# shared_across_delegations: false (default - isolated mode)
|
|
1101
|
+
|
|
1102
|
+
frontend:
|
|
1103
|
+
description: "Frontend developer"
|
|
1104
|
+
delegates_to: [tester] # Gets tester@frontend
|
|
1105
|
+
|
|
1106
|
+
backend:
|
|
1107
|
+
description: "Backend developer"
|
|
1108
|
+
delegates_to: [tester] # Gets tester@backend (separate instance)
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
**Result**:
|
|
1112
|
+
- `frontend` → `tester@frontend` (isolated conversation)
|
|
1113
|
+
- `backend` → `tester@backend` (separate isolated conversation)
|
|
1114
|
+
- No context mixing between frontend and backend's testing conversations
|
|
1115
|
+
|
|
1116
|
+
**When to Use Shared Mode**
|
|
1117
|
+
|
|
1118
|
+
For agents that benefit from seeing all delegation contexts:
|
|
1119
|
+
|
|
1120
|
+
```yaml
|
|
1121
|
+
agents:
|
|
1122
|
+
database:
|
|
1123
|
+
description: "Database coordination agent"
|
|
1124
|
+
shared_across_delegations: true # Shared mode
|
|
1125
|
+
|
|
1126
|
+
frontend:
|
|
1127
|
+
delegates_to: [database]
|
|
1128
|
+
|
|
1129
|
+
backend:
|
|
1130
|
+
delegates_to: [database]
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
Both frontend and backend share the same database agent instance and conversation history.
|
|
1134
|
+
|
|
1135
|
+
**Use shared mode for:**
|
|
1136
|
+
- Stateful coordination agents
|
|
1137
|
+
- Database agents maintaining transaction state
|
|
1138
|
+
- Agents that benefit from seeing all contexts
|
|
1139
|
+
|
|
1140
|
+
**Memory Sharing (Always Enabled)**
|
|
1141
|
+
|
|
1142
|
+
Regardless of isolation mode, **plugin storage is always shared** by base agent name:
|
|
1143
|
+
- `tester@frontend` and `tester@backend` share the same SwarmMemory storage
|
|
1144
|
+
- This allows delegation instances to share knowledge while maintaining separate conversations
|
|
1145
|
+
- Best of both worlds: isolated conversations + shared memory
|
|
1146
|
+
|
|
1087
1147
|
### 3.5 Markdown Agent Files
|
|
1088
1148
|
|
|
1089
1149
|
Define agents in separate markdown files for better organization:
|
|
@@ -1891,29 +1951,25 @@ end
|
|
|
1891
1951
|
|
|
1892
1952
|
**Control Flow Methods**:
|
|
1893
1953
|
|
|
1894
|
-
NodeContext provides three methods for dynamic workflow control
|
|
1954
|
+
NodeContext provides three methods for dynamic workflow control. Input and output blocks are automatically converted to lambdas, which means you can use `return` statements for clean early exits.
|
|
1895
1955
|
|
|
1896
1956
|
**1. goto_node - Jump to any node**:
|
|
1897
1957
|
```ruby
|
|
1898
1958
|
output do |ctx|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
ctx.content # Continue to next node normally
|
|
1904
|
-
end
|
|
1959
|
+
# Using return for early exit (clean and natural)
|
|
1960
|
+
return ctx.goto_node(:revision, content: ctx.content) if needs_revision?(ctx.content)
|
|
1961
|
+
|
|
1962
|
+
ctx.content # Continue to next node normally
|
|
1905
1963
|
end
|
|
1906
1964
|
```
|
|
1907
1965
|
|
|
1908
1966
|
**2. halt_workflow - Stop entire workflow**:
|
|
1909
1967
|
```ruby
|
|
1910
1968
|
output do |ctx|
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
ctx.content # Continue to next node
|
|
1916
|
-
end
|
|
1969
|
+
# Using return for early exit
|
|
1970
|
+
return ctx.halt_workflow(content: ctx.content) if converged?(ctx.content)
|
|
1971
|
+
|
|
1972
|
+
ctx.content # Continue to next node
|
|
1917
1973
|
end
|
|
1918
1974
|
```
|
|
1919
1975
|
|
|
@@ -1921,27 +1977,26 @@ end
|
|
|
1921
1977
|
```ruby
|
|
1922
1978
|
input do |ctx|
|
|
1923
1979
|
cached = check_cache(ctx.content)
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
end
|
|
1980
|
+
|
|
1981
|
+
# Using return for early exit when cached
|
|
1982
|
+
return ctx.skip_execution(content: cached) if cached
|
|
1983
|
+
|
|
1984
|
+
ctx.content # Execute node normally
|
|
1930
1985
|
end
|
|
1931
1986
|
```
|
|
1932
1987
|
|
|
1988
|
+
**Why `return` works safely**: Input and output blocks are automatically converted to lambdas, where `return` only exits the transformer block, not your entire program. This enables natural Ruby control flow patterns.
|
|
1989
|
+
|
|
1933
1990
|
**Creating loops with goto_node**:
|
|
1934
1991
|
```ruby
|
|
1935
1992
|
node :reasoning do
|
|
1936
1993
|
agent(:thinker, reset_context: false) # Preserve context across iterations
|
|
1937
1994
|
|
|
1938
1995
|
output do |ctx|
|
|
1939
|
-
#
|
|
1940
|
-
if ctx.all_results.size > 10
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
ctx.goto_node(:reflection, content: ctx.content)
|
|
1944
|
-
end
|
|
1996
|
+
# Using return for early exit when max iterations reached
|
|
1997
|
+
return ctx.halt_workflow(content: "Max iterations reached") if ctx.all_results.size > 10
|
|
1998
|
+
|
|
1999
|
+
ctx.goto_node(:reflection, content: ctx.content)
|
|
1945
2000
|
end
|
|
1946
2001
|
end
|
|
1947
2002
|
|
|
@@ -1961,11 +2016,10 @@ start_node :reasoning
|
|
|
1961
2016
|
|
|
1962
2017
|
```ruby
|
|
1963
2018
|
output do |ctx|
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
end
|
|
2019
|
+
# Using return for early exit on error
|
|
2020
|
+
return ctx.halt_workflow(content: "Error: #{ctx.error.message}") if ctx.error
|
|
2021
|
+
|
|
2022
|
+
ctx.goto_node(:next_node, content: ctx.content)
|
|
1969
2023
|
end
|
|
1970
2024
|
```
|
|
1971
2025
|
|
|
@@ -2635,7 +2689,7 @@ end
|
|
|
2635
2689
|
SwarmSDK validates configurations and emits warnings:
|
|
2636
2690
|
|
|
2637
2691
|
```ruby
|
|
2638
|
-
swarm = SwarmSDK
|
|
2692
|
+
swarm = SwarmSDK.load_file("config.yml")
|
|
2639
2693
|
|
|
2640
2694
|
# Check for warnings
|
|
2641
2695
|
warnings = swarm.validate
|
|
@@ -2835,7 +2889,7 @@ end
|
|
|
2835
2889
|
**Integration test workflows**:
|
|
2836
2890
|
```ruby
|
|
2837
2891
|
RSpec.describe "Development Pipeline" do
|
|
2838
|
-
let(:swarm) { SwarmSDK
|
|
2892
|
+
let(:swarm) { SwarmSDK.load_file("swarm.yml") }
|
|
2839
2893
|
|
|
2840
2894
|
it "completes full workflow" do
|
|
2841
2895
|
result = swarm.execute("Build auth system")
|
|
@@ -3003,6 +3057,48 @@ Staging: Restricted access, validated outputs
|
|
|
3003
3057
|
Production: Minimal access, extensive hooks
|
|
3004
3058
|
```
|
|
3005
3059
|
|
|
3060
|
+
**6. Disable filesystem tools globally (system-wide security)**:
|
|
3061
|
+
```ruby
|
|
3062
|
+
# For multi-tenant platforms or sandboxed environments
|
|
3063
|
+
SwarmSDK.configure do |config|
|
|
3064
|
+
config.allow_filesystem_tools = false
|
|
3065
|
+
end
|
|
3066
|
+
|
|
3067
|
+
# Or via environment variable (recommended for production)
|
|
3068
|
+
ENV['SWARM_SDK_ALLOW_FILESYSTEM_TOOLS'] = 'false'
|
|
3069
|
+
|
|
3070
|
+
# Agents can now only use non-filesystem tools
|
|
3071
|
+
swarm = SwarmSDK.build do
|
|
3072
|
+
name "API Analyst"
|
|
3073
|
+
lead :analyst
|
|
3074
|
+
|
|
3075
|
+
agent :analyst do
|
|
3076
|
+
description "Analyzes data via APIs only"
|
|
3077
|
+
model "gpt-5"
|
|
3078
|
+
# These work: Think, WebFetch, Clock, TodoWrite, Scratchpad*, Memory*
|
|
3079
|
+
tools :Think, :WebFetch
|
|
3080
|
+
# These are blocked: Read, Write, Edit, MultiEdit, Grep, Glob, Bash
|
|
3081
|
+
end
|
|
3082
|
+
end
|
|
3083
|
+
|
|
3084
|
+
# Override per-swarm if needed
|
|
3085
|
+
restricted_swarm = SwarmSDK.build(allow_filesystem_tools: false) do
|
|
3086
|
+
# ... specific swarm that needs extra restriction
|
|
3087
|
+
end
|
|
3088
|
+
```
|
|
3089
|
+
|
|
3090
|
+
**Use cases:**
|
|
3091
|
+
- **Multi-tenant platforms**: Prevent user-provided swarms from accessing filesystem
|
|
3092
|
+
- **Containerized deployments**: Read-only filesystems or restricted environments
|
|
3093
|
+
- **Compliance requirements**: Data analysis workloads that forbid file operations
|
|
3094
|
+
- **CI/CD pipelines**: Agents should only interact via APIs
|
|
3095
|
+
|
|
3096
|
+
**Key features:**
|
|
3097
|
+
- **Security boundary**: Cannot be overridden by swarm YAML/DSL configuration
|
|
3098
|
+
- **Validation**: Errors caught at build time with clear messages
|
|
3099
|
+
- **Priority**: Explicit parameter > Global setting > Environment variable > Default (true)
|
|
3100
|
+
- **Non-breaking**: Defaults to `true` for backward compatibility
|
|
3101
|
+
|
|
3006
3102
|
### 8.6 Cost Management
|
|
3007
3103
|
|
|
3008
3104
|
**Track costs in real-time**:
|