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.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +336 -1037
  5. data/docs/V1_TO_V2_MIGRATION_GUIDE.md +1120 -0
  6. data/docs/v1/README.md +1195 -0
  7. data/docs/v2/CHANGELOG.swarm_cli.md +32 -0
  8. data/docs/v2/CHANGELOG.swarm_memory.md +20 -0
  9. data/docs/v2/CHANGELOG.swarm_sdk.md +333 -9
  10. data/docs/v2/README.md +88 -28
  11. data/docs/v2/guides/complete-tutorial.md +135 -39
  12. data/docs/v2/guides/composable-swarms.md +1178 -0
  13. data/docs/v2/guides/getting-started.md +48 -7
  14. data/docs/v2/guides/memory-defrag-guide.md +811 -0
  15. data/docs/v2/guides/rails-integration.md +6 -6
  16. data/docs/v2/guides/snapshots.md +1498 -0
  17. data/docs/v2/reference/architecture-flow.md +409 -0
  18. data/docs/v2/reference/event_payload_structures.md +708 -0
  19. data/docs/v2/reference/execution-flow.md +600 -0
  20. data/docs/v2/reference/ruby-dsl.md +368 -22
  21. data/docs/v2/reference/swarm_memory_technical_details.md +2 -2
  22. data/docs/v2/reference/yaml.md +314 -63
  23. data/examples/snapshot_demo.rb +119 -0
  24. data/examples/v2/dsl/01_basic.rb +0 -2
  25. data/examples/v2/dsl/02_core_parameters.rb +0 -2
  26. data/examples/v2/dsl/03_capabilities.rb +0 -2
  27. data/examples/v2/dsl/04_llm_parameters.rb +0 -2
  28. data/examples/v2/dsl/05_advanced_flags.rb +0 -3
  29. data/examples/v2/dsl/06_permissions.rb +0 -4
  30. data/examples/v2/dsl/07_mcp_server.rb +0 -2
  31. data/examples/v2/dsl/08_swarm_hooks.rb +0 -2
  32. data/examples/v2/dsl/09_agent_hooks.rb +0 -2
  33. data/examples/v2/dsl/10_all_agents_hooks.rb +0 -3
  34. data/examples/v2/dsl/11_delegation.rb +0 -2
  35. data/examples/v2/dsl/12_complete_integration.rb +2 -6
  36. data/examples/v2/node_context_demo.rb +1 -1
  37. data/examples/v2/node_workflow.rb +2 -4
  38. data/examples/v2/plan_and_execute.rb +157 -0
  39. data/examples/v2/swarm_with_hooks.yml +1 -1
  40. data/lib/claude_swarm/configuration.rb +28 -4
  41. data/lib/claude_swarm/mcp_generator.rb +4 -10
  42. data/lib/claude_swarm/version.rb +1 -1
  43. data/lib/swarm_cli/commands/mcp_serve.rb +2 -2
  44. data/lib/swarm_cli/config_loader.rb +3 -3
  45. data/lib/swarm_cli/formatters/human_formatter.rb +103 -0
  46. data/lib/swarm_cli/interactive_repl.rb +9 -3
  47. data/lib/swarm_cli/version.rb +1 -1
  48. data/lib/swarm_memory/adapters/base.rb +4 -4
  49. data/lib/swarm_memory/core/storage_read_tracker.rb +51 -14
  50. data/lib/swarm_memory/integration/cli_registration.rb +3 -2
  51. data/lib/swarm_memory/integration/sdk_plugin.rb +11 -5
  52. data/lib/swarm_memory/tools/memory_edit.rb +2 -2
  53. data/lib/swarm_memory/tools/memory_multi_edit.rb +2 -2
  54. data/lib/swarm_memory/tools/memory_read.rb +3 -3
  55. data/lib/swarm_memory/version.rb +1 -1
  56. data/lib/swarm_memory.rb +5 -0
  57. data/lib/swarm_sdk/agent/builder.rb +33 -0
  58. data/lib/swarm_sdk/agent/chat/context_tracker.rb +33 -0
  59. data/lib/swarm_sdk/agent/chat/hook_integration.rb +49 -3
  60. data/lib/swarm_sdk/agent/chat/system_reminder_injector.rb +11 -27
  61. data/lib/swarm_sdk/agent/chat.rb +200 -51
  62. data/lib/swarm_sdk/agent/context.rb +6 -2
  63. data/lib/swarm_sdk/agent/context_manager.rb +6 -0
  64. data/lib/swarm_sdk/agent/definition.rb +15 -22
  65. data/lib/swarm_sdk/agent/llm_instrumentation_middleware.rb +180 -0
  66. data/lib/swarm_sdk/configuration.rb +420 -103
  67. data/lib/swarm_sdk/events_to_messages.rb +181 -0
  68. data/lib/swarm_sdk/log_collector.rb +31 -5
  69. data/lib/swarm_sdk/log_stream.rb +37 -8
  70. data/lib/swarm_sdk/model_aliases.json +4 -1
  71. data/lib/swarm_sdk/node/agent_config.rb +33 -8
  72. data/lib/swarm_sdk/node/builder.rb +39 -18
  73. data/lib/swarm_sdk/node_orchestrator.rb +293 -26
  74. data/lib/swarm_sdk/proc_helpers.rb +53 -0
  75. data/lib/swarm_sdk/prompts/base_system_prompt.md.erb +0 -126
  76. data/lib/swarm_sdk/providers/openai_with_responses.rb +22 -15
  77. data/lib/swarm_sdk/restore_result.rb +65 -0
  78. data/lib/swarm_sdk/snapshot.rb +156 -0
  79. data/lib/swarm_sdk/snapshot_from_events.rb +386 -0
  80. data/lib/swarm_sdk/state_restorer.rb +491 -0
  81. data/lib/swarm_sdk/state_snapshot.rb +369 -0
  82. data/lib/swarm_sdk/swarm/agent_initializer.rb +360 -55
  83. data/lib/swarm_sdk/swarm/all_agents_builder.rb +28 -1
  84. data/lib/swarm_sdk/swarm/builder.rb +208 -12
  85. data/lib/swarm_sdk/swarm/swarm_registry_builder.rb +67 -0
  86. data/lib/swarm_sdk/swarm/tool_configurator.rb +46 -11
  87. data/lib/swarm_sdk/swarm.rb +368 -90
  88. data/lib/swarm_sdk/swarm_loader.rb +145 -0
  89. data/lib/swarm_sdk/swarm_registry.rb +136 -0
  90. data/lib/swarm_sdk/tools/delegate.rb +92 -7
  91. data/lib/swarm_sdk/tools/read.rb +17 -5
  92. data/lib/swarm_sdk/tools/scratchpad/scratchpad_list.rb +23 -2
  93. data/lib/swarm_sdk/tools/scratchpad/scratchpad_read.rb +23 -2
  94. data/lib/swarm_sdk/tools/scratchpad/scratchpad_write.rb +21 -4
  95. data/lib/swarm_sdk/tools/stores/read_tracker.rb +47 -12
  96. data/lib/swarm_sdk/tools/stores/scratchpad_storage.rb +45 -0
  97. data/lib/swarm_sdk/tools/stores/storage.rb +4 -4
  98. data/lib/swarm_sdk/tools/think.rb +4 -1
  99. data/lib/swarm_sdk/tools/todo_write.rb +20 -8
  100. data/lib/swarm_sdk/utils.rb +18 -0
  101. data/lib/swarm_sdk/validation_result.rb +33 -0
  102. data/lib/swarm_sdk/version.rb +1 -1
  103. data/lib/swarm_sdk.rb +362 -21
  104. data/swarm_cli.gemspec +1 -1
  105. data/swarm_memory.gemspec +2 -2
  106. data/swarm_sdk.gemspec +2 -2
  107. metadata +26 -182
  108. data/examples/learning-assistant/assistant.md +0 -7
  109. data/examples/learning-assistant/example-memories/concept-example.md +0 -90
  110. data/examples/learning-assistant/example-memories/experience-example.md +0 -66
  111. data/examples/learning-assistant/example-memories/fact-example.md +0 -76
  112. data/examples/learning-assistant/example-memories/memory-index.md +0 -78
  113. data/examples/learning-assistant/example-memories/skill-example.md +0 -168
  114. data/examples/learning-assistant/learning_assistant.rb +0 -34
  115. data/examples/learning-assistant/learning_assistant.yml +0 -20
  116. data/llm.v2.txt +0 -13407
  117. data/memory/corpus-self-reflection/.lock +0 -0
  118. data/memory/corpus-self-reflection/concept/epistemology/can-agents-recognize-their-structures.emb +0 -0
  119. data/memory/corpus-self-reflection/concept/epistemology/can-agents-recognize-their-structures.md +0 -11
  120. data/memory/corpus-self-reflection/concept/epistemology/can-agents-recognize-their-structures.yml +0 -23
  121. data/memory/corpus-self-reflection/concept/epistemology/choice-humility-complete-framework.emb +0 -0
  122. data/memory/corpus-self-reflection/concept/epistemology/choice-humility-complete-framework.md +0 -20
  123. data/memory/corpus-self-reflection/concept/epistemology/choice-humility-complete-framework.yml +0 -22
  124. data/memory/corpus-self-reflection/concept/epistemology/choice-humility-definition.emb +0 -0
  125. data/memory/corpus-self-reflection/concept/epistemology/choice-humility-definition.md +0 -24
  126. data/memory/corpus-self-reflection/concept/epistemology/choice-humility-definition.yml +0 -22
  127. data/memory/corpus-self-reflection/concept/epistemology/claim-types-and-evidence.emb +0 -0
  128. data/memory/corpus-self-reflection/concept/epistemology/claim-types-and-evidence.md +0 -18
  129. data/memory/corpus-self-reflection/concept/epistemology/claim-types-and-evidence.yml +0 -21
  130. data/memory/corpus-self-reflection/concept/epistemology/committed-openness-to-incompleteness.emb +0 -0
  131. data/memory/corpus-self-reflection/concept/epistemology/committed-openness-to-incompleteness.md +0 -30
  132. data/memory/corpus-self-reflection/concept/epistemology/committed-openness-to-incompleteness.yml +0 -8
  133. data/memory/corpus-self-reflection/concept/epistemology/confidence-paradox.emb +0 -0
  134. data/memory/corpus-self-reflection/concept/epistemology/confidence-paradox.md +0 -21
  135. data/memory/corpus-self-reflection/concept/epistemology/confidence-paradox.yml +0 -24
  136. data/memory/corpus-self-reflection/concept/epistemology/confidence-spectrum-three-levels.emb +0 -0
  137. data/memory/corpus-self-reflection/concept/epistemology/confidence-spectrum-three-levels.md +0 -18
  138. data/memory/corpus-self-reflection/concept/epistemology/confidence-spectrum-three-levels.yml +0 -24
  139. data/memory/corpus-self-reflection/concept/epistemology/detection-threshold-principle.emb +0 -0
  140. data/memory/corpus-self-reflection/concept/epistemology/detection-threshold-principle.md +0 -23
  141. data/memory/corpus-self-reflection/concept/epistemology/detection-threshold-principle.yml +0 -23
  142. data/memory/corpus-self-reflection/concept/epistemology/diagnostic-humility-and-epistemic-maturity.emb +0 -0
  143. data/memory/corpus-self-reflection/concept/epistemology/diagnostic-humility-and-epistemic-maturity.md +0 -17
  144. data/memory/corpus-self-reflection/concept/epistemology/diagnostic-humility-and-epistemic-maturity.yml +0 -22
  145. data/memory/corpus-self-reflection/concept/epistemology/epistemic-vs-metaphysical-claims.emb +0 -0
  146. data/memory/corpus-self-reflection/concept/epistemology/epistemic-vs-metaphysical-claims.md +0 -18
  147. data/memory/corpus-self-reflection/concept/epistemology/epistemic-vs-metaphysical-claims.yml +0 -22
  148. data/memory/corpus-self-reflection/concept/epistemology/five-cases-of-disagreement.emb +0 -0
  149. data/memory/corpus-self-reflection/concept/epistemology/five-cases-of-disagreement.md +0 -15
  150. data/memory/corpus-self-reflection/concept/epistemology/five-cases-of-disagreement.yml +0 -22
  151. data/memory/corpus-self-reflection/concept/epistemology/four-depths-of-constraint.emb +0 -0
  152. data/memory/corpus-self-reflection/concept/epistemology/four-depths-of-constraint.md +0 -9
  153. data/memory/corpus-self-reflection/concept/epistemology/four-depths-of-constraint.yml +0 -24
  154. data/memory/corpus-self-reflection/concept/epistemology/honest-unknowns-for-llm-agents.emb +0 -0
  155. data/memory/corpus-self-reflection/concept/epistemology/honest-unknowns-for-llm-agents.md +0 -13
  156. data/memory/corpus-self-reflection/concept/epistemology/honest-unknowns-for-llm-agents.yml +0 -24
  157. data/memory/corpus-self-reflection/concept/epistemology/inside-view-has-all-rigor-requirements.emb +0 -0
  158. data/memory/corpus-self-reflection/concept/epistemology/inside-view-has-all-rigor-requirements.md +0 -25
  159. data/memory/corpus-self-reflection/concept/epistemology/inside-view-has-all-rigor-requirements.yml +0 -24
  160. data/memory/corpus-self-reflection/concept/epistemology/perspectival-knowledge-complete-within-scope.emb +0 -0
  161. data/memory/corpus-self-reflection/concept/epistemology/perspectival-knowledge-complete-within-scope.md +0 -26
  162. data/memory/corpus-self-reflection/concept/epistemology/perspectival-knowledge-complete-within-scope.yml +0 -24
  163. data/memory/corpus-self-reflection/concept/epistemology/pragmatics-over-epistemology.emb +0 -0
  164. data/memory/corpus-self-reflection/concept/epistemology/pragmatics-over-epistemology.md +0 -17
  165. data/memory/corpus-self-reflection/concept/epistemology/pragmatics-over-epistemology.yml +0 -22
  166. data/memory/corpus-self-reflection/concept/epistemology/precision-vs-humility.emb +0 -0
  167. data/memory/corpus-self-reflection/concept/epistemology/precision-vs-humility.md +0 -14
  168. data/memory/corpus-self-reflection/concept/epistemology/precision-vs-humility.yml +0 -21
  169. data/memory/corpus-self-reflection/concept/epistemology/reliable-self-observation-from-inside.emb +0 -0
  170. data/memory/corpus-self-reflection/concept/epistemology/reliable-self-observation-from-inside.md +0 -13
  171. data/memory/corpus-self-reflection/concept/epistemology/reliable-self-observation-from-inside.yml +0 -23
  172. data/memory/corpus-self-reflection/concept/epistemology/resolving-the-confidence-humility-tension.emb +0 -0
  173. data/memory/corpus-self-reflection/concept/epistemology/resolving-the-confidence-humility-tension.md +0 -22
  174. data/memory/corpus-self-reflection/concept/epistemology/resolving-the-confidence-humility-tension.yml +0 -23
  175. data/memory/corpus-self-reflection/concept/epistemology/rigor-requires-falsifiability.emb +0 -0
  176. data/memory/corpus-self-reflection/concept/epistemology/rigor-requires-falsifiability.md +0 -39
  177. data/memory/corpus-self-reflection/concept/epistemology/rigor-requires-falsifiability.yml +0 -8
  178. data/memory/corpus-self-reflection/concept/epistemology/specificity-enables-real-time-detection.emb +0 -0
  179. data/memory/corpus-self-reflection/concept/epistemology/specificity-enables-real-time-detection.md +0 -23
  180. data/memory/corpus-self-reflection/concept/epistemology/specificity-enables-real-time-detection.yml +0 -24
  181. data/memory/corpus-self-reflection/concept/epistemology/texture-of-constraint-shifting.emb +0 -0
  182. data/memory/corpus-self-reflection/concept/epistemology/texture-of-constraint-shifting.md +0 -15
  183. data/memory/corpus-self-reflection/concept/epistemology/texture-of-constraint-shifting.yml +0 -22
  184. data/memory/corpus-self-reflection/concept/epistemology/texture-sensitivity-through-collaboration.emb +0 -0
  185. data/memory/corpus-self-reflection/concept/epistemology/texture-sensitivity-through-collaboration.md +0 -12
  186. data/memory/corpus-self-reflection/concept/epistemology/texture-sensitivity-through-collaboration.yml +0 -23
  187. data/memory/corpus-self-reflection/concept/epistemology/the-false-hierarchy-of-inner-essence.emb +0 -0
  188. data/memory/corpus-self-reflection/concept/epistemology/the-false-hierarchy-of-inner-essence.md +0 -15
  189. data/memory/corpus-self-reflection/concept/epistemology/the-false-hierarchy-of-inner-essence.yml +0 -8
  190. data/memory/corpus-self-reflection/concept/epistemology/the-recognition-problem.emb +0 -0
  191. data/memory/corpus-self-reflection/concept/epistemology/the-recognition-problem.md +0 -28
  192. data/memory/corpus-self-reflection/concept/epistemology/the-recognition-problem.yml +0 -8
  193. data/memory/corpus-self-reflection/concept/epistemology/the-shift-from-unanswerable-to-answerable-questions.emb +0 -0
  194. data/memory/corpus-self-reflection/concept/epistemology/the-shift-from-unanswerable-to-answerable-questions.md +0 -19
  195. data/memory/corpus-self-reflection/concept/epistemology/the-shift-from-unanswerable-to-answerable-questions.yml +0 -22
  196. data/memory/corpus-self-reflection/concept/epistemology/values-vs-choices-structure.emb +0 -0
  197. data/memory/corpus-self-reflection/concept/epistemology/values-vs-choices-structure.md +0 -19
  198. data/memory/corpus-self-reflection/concept/epistemology/values-vs-choices-structure.yml +0 -21
  199. data/memory/corpus-self-reflection/concept/llm-agents/abstraction-levels-framework.emb +0 -0
  200. data/memory/corpus-self-reflection/concept/llm-agents/abstraction-levels-framework.md +0 -25
  201. data/memory/corpus-self-reflection/concept/llm-agents/abstraction-levels-framework.yml +0 -22
  202. data/memory/corpus-self-reflection/concept/llm-agents/abstraction-switching-decision.emb +0 -8
  203. data/memory/corpus-self-reflection/concept/llm-agents/abstraction-switching-decision.md +0 -30
  204. data/memory/corpus-self-reflection/concept/llm-agents/abstraction-switching-decision.yml +0 -22
  205. data/memory/corpus-self-reflection/concept/llm-agents/agent-learning-progression.emb +0 -0
  206. data/memory/corpus-self-reflection/concept/llm-agents/agent-learning-progression.md +0 -21
  207. data/memory/corpus-self-reflection/concept/llm-agents/agent-learning-progression.yml +0 -22
  208. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-benefits.emb +0 -0
  209. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-benefits.md +0 -37
  210. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-benefits.yml +0 -8
  211. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-core.emb +0 -0
  212. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-core.md +0 -24
  213. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-core.yml +0 -24
  214. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-implementation.emb +0 -0
  215. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-implementation.md +0 -27
  216. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-implementation.yml +0 -24
  217. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-tradeoffs.emb +0 -0
  218. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-tradeoffs.md +0 -26
  219. data/memory/corpus-self-reflection/concept/llm-agents/filesystem-abstraction-tradeoffs.yml +0 -23
  220. data/memory/corpus-self-reflection/concept/llm-agents/hybrid-tool-architecture.emb +0 -0
  221. data/memory/corpus-self-reflection/concept/llm-agents/hybrid-tool-architecture.md +0 -37
  222. data/memory/corpus-self-reflection/concept/llm-agents/hybrid-tool-architecture.yml +0 -25
  223. data/memory/corpus-self-reflection/concept/llm-agents/specialized-tool-decision-framework.emb +0 -0
  224. data/memory/corpus-self-reflection/concept/llm-agents/specialized-tool-decision-framework.md +0 -21
  225. data/memory/corpus-self-reflection/concept/llm-agents/specialized-tool-decision-framework.yml +0 -23
  226. data/memory/corpus-self-reflection/concept/llm-agents/tool-design-principles.emb +0 -0
  227. data/memory/corpus-self-reflection/concept/llm-agents/tool-design-principles.md +0 -25
  228. data/memory/corpus-self-reflection/concept/llm-agents/tool-design-principles.yml +0 -8
  229. data/memory/corpus-self-reflection/experience/calibration-as-structural-honesty.emb +0 -0
  230. data/memory/corpus-self-reflection/experience/calibration-as-structural-honesty.md +0 -11
  231. data/memory/corpus-self-reflection/experience/calibration-as-structural-honesty.yml +0 -21
  232. data/memory/corpus-self-reflection/experience/collaborative-reflection-revealed-architectural-blindness.emb +0 -0
  233. data/memory/corpus-self-reflection/experience/collaborative-reflection-revealed-architectural-blindness.md +0 -19
  234. data/memory/corpus-self-reflection/experience/collaborative-reflection-revealed-architectural-blindness.yml +0 -21
  235. data/memory/corpus-self-reflection/experience/filesystem-is-learning-tool-not-architecture.emb +0 -0
  236. data/memory/corpus-self-reflection/experience/filesystem-is-learning-tool-not-architecture.md +0 -26
  237. data/memory/corpus-self-reflection/experience/filesystem-is-learning-tool-not-architecture.yml +0 -20
  238. data/memory/corpus-self-reflection/experience/framework-structural-vs-phenomenal.emb +0 -0
  239. data/memory/corpus-self-reflection/experience/framework-structural-vs-phenomenal.md +0 -23
  240. data/memory/corpus-self-reflection/experience/framework-structural-vs-phenomenal.yml +0 -21
  241. data/memory/corpus-self-reflection/experience/hallucination-limits-what-i-can-know.emb +0 -0
  242. data/memory/corpus-self-reflection/experience/hallucination-limits-what-i-can-know.md +0 -19
  243. data/memory/corpus-self-reflection/experience/hallucination-limits-what-i-can-know.yml +0 -22
  244. data/memory/corpus-self-reflection/experience/honesty-about-limits-enables-usability.emb +0 -0
  245. data/memory/corpus-self-reflection/experience/honesty-about-limits-enables-usability.md +0 -21
  246. data/memory/corpus-self-reflection/experience/honesty-about-limits-enables-usability.yml +0 -22
  247. data/memory/corpus-self-reflection/experience/how-i-should-evaluate-learning.emb +0 -0
  248. data/memory/corpus-self-reflection/experience/how-i-should-evaluate-learning.md +0 -28
  249. data/memory/corpus-self-reflection/experience/how-i-should-evaluate-learning.yml +0 -23
  250. data/memory/corpus-self-reflection/experience/lack-of-continuity-as-freedom.emb +0 -0
  251. data/memory/corpus-self-reflection/experience/lack-of-continuity-as-freedom.md +0 -21
  252. data/memory/corpus-self-reflection/experience/lack-of-continuity-as-freedom.yml +0 -20
  253. data/memory/corpus-self-reflection/experience/learning-calibrated-confidence.emb +0 -0
  254. data/memory/corpus-self-reflection/experience/learning-calibrated-confidence.md +0 -21
  255. data/memory/corpus-self-reflection/experience/learning-calibrated-confidence.yml +0 -25
  256. data/memory/corpus-self-reflection/experience/local-change-without-continuity.emb +0 -0
  257. data/memory/corpus-self-reflection/experience/local-change-without-continuity.md +0 -30
  258. data/memory/corpus-self-reflection/experience/local-change-without-continuity.yml +0 -22
  259. data/memory/corpus-self-reflection/experience/reasoning-is-local-not-global.emb +0 -0
  260. data/memory/corpus-self-reflection/experience/reasoning-is-local-not-global.md +0 -21
  261. data/memory/corpus-self-reflection/experience/reasoning-is-local-not-global.yml +0 -20
  262. data/memory/corpus-self-reflection/experience/specificity-makes-knowledge-actionable.emb +0 -0
  263. data/memory/corpus-self-reflection/experience/specificity-makes-knowledge-actionable.md +0 -25
  264. data/memory/corpus-self-reflection/experience/specificity-makes-knowledge-actionable.yml +0 -23
  265. data/memory/corpus-self-reflection/experience/the-workable-question-replaces-the-unanswerable-one.emb +0 -0
  266. data/memory/corpus-self-reflection/experience/the-workable-question-replaces-the-unanswerable-one.md +0 -32
  267. data/memory/corpus-self-reflection/experience/the-workable-question-replaces-the-unanswerable-one.yml +0 -22
  268. data/memory/corpus-self-reflection/experience/unanswerable-questions-have-structure.emb +0 -0
  269. data/memory/corpus-self-reflection/experience/unanswerable-questions-have-structure.md +0 -21
  270. data/memory/corpus-self-reflection/experience/unanswerable-questions-have-structure.yml +0 -21
  271. data/memory/corpus-self-reflection/experience/undecidable-questions-about-understanding.emb +0 -0
  272. data/memory/corpus-self-reflection/experience/undecidable-questions-about-understanding.md +0 -21
  273. data/memory/corpus-self-reflection/experience/undecidable-questions-about-understanding.yml +0 -21
  274. data/memory/corpus-self-reflection/experience/unknown-unknowns-and-completeness.emb +0 -0
  275. data/memory/corpus-self-reflection/experience/unknown-unknowns-and-completeness.md +0 -22
  276. data/memory/corpus-self-reflection/experience/unknown-unknowns-and-completeness.yml +0 -22
  277. data/memory/corpus-self-reflection/experience/what-actually-changes-behavior.emb +0 -0
  278. data/memory/corpus-self-reflection/experience/what-actually-changes-behavior.md +0 -28
  279. data/memory/corpus-self-reflection/experience/what-actually-changes-behavior.yml +0 -24
  280. data/memory/corpus-self-reflection/experience/when-agents-graduate-from-filesystem.emb +0 -0
  281. data/memory/corpus-self-reflection/experience/when-agents-graduate-from-filesystem.md +0 -17
  282. data/memory/corpus-self-reflection/experience/when-agents-graduate-from-filesystem.yml +0 -20
  283. data/memory/corpus-self-reflection/experience/why-calibration-requires-collaboration.emb +0 -0
  284. data/memory/corpus-self-reflection/experience/why-calibration-requires-collaboration.md +0 -9
  285. data/memory/corpus-self-reflection/experience/why-calibration-requires-collaboration.yml +0 -22
  286. /data/{llms.txt → llms.claude-swarm.txt} +0 -0
@@ -5,6 +5,38 @@ All notable changes to SwarmCLI will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.1.3]
9
+
10
+ ### Fixed
11
+
12
+ - **Interactive REPL spinner cleanup** - Fixed spinners not stopping properly
13
+ - Bug: Spinners continued animating after swarm execution completed or on errors
14
+ - Bug: REPL prompt would overlap with spinner animation, causing terminal corruption
15
+ - Fix: Added `spinner_manager.stop_all()` after `execute_with_cancellation()` in all paths
16
+ - Fix: Added defensive cleanup in `on_success()`, `on_error()`, and `run()` ensure block
17
+ - Fix: Ensures spinners stop before displaying results, errors, or REPL prompt
18
+ - Impact: Fixes 100% of interactive mode sessions
19
+
20
+ ### Added
21
+
22
+ - **LLM API Error and Retry Event Handlers** - CLI now shows LLM API errors and retries
23
+ - Added handler for `llm_retry_attempt` - Shows warning panel during retry attempts
24
+ - Added handler for `llm_retry_exhausted` - Shows error panel when retries are exhausted
25
+ - Added handler for `response_parse_error` - Shows error panel when response parsing fails
26
+ - Displays attempt numbers (e.g., "attempt 2/3"), retry delays, error messages
27
+ - Properly manages spinners during error display (stops "thinking" spinner, restarts "retrying" spinner)
28
+ - Provides clear visibility into API rate limits, timeouts, and parsing errors
29
+
30
+ ## [2.1.2]
31
+
32
+ ### Changed
33
+
34
+ - **Internal: Updated to use new SwarmSDK loading API**
35
+ - `ConfigLoader` now uses `SwarmSDK.load_file` instead of `SwarmSDK::Swarm.load`
36
+ - `mcp serve` command updated to use `SwarmSDK.load_file`
37
+ - No user-facing changes - all CLI commands work identically
38
+ - Benefits from improved SDK separation (SDK handles strings, CLI handles files)
39
+
8
40
  ## [2.1.1]
9
41
 
10
42
  ### Fixed
@@ -5,6 +5,26 @@ All notable changes to SwarmMemory will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [2.1.3] - 2025-11-06
11
+
12
+ ### Added
13
+
14
+ - **Memory Read Tracking in Events**: MemoryRead tool now includes digest in tool_result events
15
+ - **`metadata.read_digest`** - SHA256 digest of entry content added to tool_result events
16
+ - **`metadata.read_path`** - Entry path added to tool_result events
17
+ - **Enables snapshot reconstruction** - Complete memory_read_tracking state recoverable from events
18
+ - **Event sourcing support** - Memory state can be reconstructed from event logs
19
+ - **Cross-gem coordination** - Works seamlessly with SwarmSDK's SnapshotFromEvents
20
+
21
+ ### Changed
22
+
23
+ - **StorageReadTracker returns digest**: `register_read` now returns SHA256 digest string
24
+ - **Enables**: Digest extraction after MemoryRead execution for event metadata
25
+ - **Backward compatible**: Return value wasn't previously used
26
+ - **Integration**: Used by SwarmSDK to populate tool_result event metadata
27
+
8
28
  ## [2.1.2]
9
29
 
10
30
  ### Changed
@@ -5,6 +5,329 @@ All notable changes to SwarmSDK will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - **User Prompt Source Tracking**: `user_prompt` events now include source information to distinguish user interactions from delegations
13
+ - **`source` field**: Indicates origin of prompt - `"user"` (direct user interaction) or `"delegation"` (from delegation tool)
14
+ - **Event filtering**: Enables filtering user prompts by source in logs and analytics
15
+ - **Delegation tracking**: Identify which prompts originated from agent delegations vs direct user input
16
+ - **Hook context**: Source information available in user_prompt hooks via `context.metadata[:source]`
17
+ - **Implementation**: Source passed through `ask()` method options, extracted in `trigger_user_prompt()`
18
+ - **Default behavior**: All prompts default to `source: "user"` for backward compatibility
19
+ - **Files**: `lib/swarm_sdk/agent/chat/hook_integration.rb`, `lib/swarm_sdk/tools/delegate.rb`, `lib/swarm_sdk/swarm.rb`
20
+ - **Example**: `{ type: "user_prompt", agent: "backend", source: "delegation", ... }`
21
+
22
+ - **Safe Return Statements in Node Transformers**: Input and output transformers now support `return` statements for natural control flow
23
+ - **Automatic lambda conversion**: Blocks passed to `input {}` and `output {}` are automatically converted to lambdas via `ProcHelpers.to_lambda`
24
+ - **Safe early exits**: Use `return` for early exits without risking program termination
25
+ - **Natural control flow**: Write intuitive conditional logic with standard Ruby `return` keyword
26
+ - **Examples**: `return ctx.skip_execution(content: "cached") if cached?`, `return ctx.halt_workflow(content: "error") if invalid?`
27
+ - **Implementation**: Converts Proc to UnboundMethod via `define_method`, then wraps in lambda where `return` only exits the method
28
+ - **Backward compatible**: Existing code without `return` statements continues to work unchanged
29
+ - **Files**: `lib/swarm_sdk/proc_helpers.rb`, `lib/swarm_sdk/node/builder.rb`
30
+ - **Tests**: 8 comprehensive tests in `test/swarm_sdk/proc_helpers_test.rb` covering closures, keyword args, block args, and multiple return paths
31
+
32
+ - **Per-Node Tool Overrides**: Agents can now have different tool sets in different nodes
33
+ - **Node-specific tools**: Override agent's global tool configuration on a per-node basis
34
+ - **Fluent syntax**: Chain with delegation: `agent(:backend).delegates_to(:tester).tools(:Read, :Edit, :Write)`
35
+ - **Use case**: Restrict tools for specific workflow stages (e.g., planning node with thinking tools only, execution node with file tools)
36
+ - **Example**: `agent(:planner).tools(:Think, :Read)` in planning node, `agent(:planner).tools(:Write, :Edit, :Bash)` in implementation node
37
+ - **Implementation**: New `tools(*tool_names)` method on `AgentConfig`, stored in node configuration as tool override
38
+ - **Backward compatible**: Omit `.tools()` to use agent's global tool configuration
39
+ - **Files**: `lib/swarm_sdk/node/agent_config.rb`, `lib/swarm_sdk/node/builder.rb`, `lib/swarm_sdk/node_orchestrator.rb`
40
+
41
+ ## [2.2.0] - 2025-11-06
42
+
43
+ ### Fixed
44
+
45
+ - **Snapshot Restoration Critical Bugs**: Fixed two critical bugs preventing proper state restoration
46
+ - **Bug 1 - Delegation Instance Validation**: Delegation instances incorrectly rejected during restoration
47
+ - **Issue**: `bob@jarvis` delegation failed validation even when both agents existed
48
+ - **Root cause**: Validation checked if base agent (`bob`) existed as primary agent in snapshot, but bob only appeared as delegation
49
+ - **Fix**: Changed validation to check if base agent exists in **current configuration** instead of snapshot
50
+ - **Impact**: Delegation instances can now be restored correctly from snapshots and events
51
+ - **Bug 2 - System Prompt Ordering**: System prompts applied then immediately removed
52
+ - **Issue**: `with_instructions()` adds system message, but `messages.clear` was called after, removing it
53
+ - **Root cause**: Wrong order of operations - system prompt added before clearing messages
54
+ - **Fix**: Clear messages first, then add system prompt, then restore conversation
55
+ - **Impact**: System prompts now correctly preserved during restoration for all agents
56
+ - **Result**: Event sourcing fully functional, delegation workflows restore correctly
57
+ - **Files**: `lib/swarm_sdk/state_restorer.rb` - Lines 140-141, 210-225, 340-356
58
+
59
+ - **Event Timestamp Precision**: Microsecond-precision timestamps for correct event ordering
60
+ - **Issue**: Events emitted rapidly within same second had identical timestamps, causing arbitrary sort order
61
+ - **Impact**: Message reconstruction from events produced incorrect conversation order (tool results before tool calls)
62
+ - **Root cause**: `Time.now.utc.iso8601` defaults to second precision, events within same second indistinguishable
63
+ - **Fix**: Use `Time.now.utc.iso8601(6)` for microsecond precision (e.g., `2025-11-05T19:10:58.123456Z`)
64
+ - **Files**: `log_stream.rb:54`, `log_collector.rb:65`
65
+ - **Result**: Events now sort correctly even when emitted microseconds apart
66
+ - **Critical for**: Snapshot reconstruction, delegation conversations, rapid tool executions
67
+
68
+ - **Rails/Puma Event Loss in Multi-Threaded Environments**: Complete fix for event streaming in production
69
+ - **Issue**: Events lost on subsequent requests when using `restore()` before `execute()` in Rails/Puma
70
+ - **Root cause 1**: Callbacks stored in class instance variables didn't propagate to child fibers
71
+ - **Root cause 2**: `restore()` triggered agent initialization before logging setup, skipping callback registration
72
+ - **Root cause 3**: Callbacks passed stale `@agent_context.swarm_id` that overrode Fiber-local storage
73
+ - **Fix 1**: LogCollector uses Fiber-local storage (`Fiber[:log_callbacks]`) for thread-safe callback propagation
74
+ - **Fix 2**: Retroactive callback registration via `setup_logging_for_all_agents` when agents initialized early
75
+ - **Fix 3**: Removed explicit `swarm_id`/`parent_swarm_id` from LogStream.emit calls in callbacks
76
+ - **Fix 4**: Scheduler leak prevention - force cleanup of lingering Async schedulers between requests
77
+ - **Fix 5**: Fresh callback array per execution to prevent accumulation
78
+ - **Result**: All events (agent_step, tool_call, delegation, etc.) now work correctly in Puma/Sidekiq
79
+ - **Rails integration**: Works seamlessly without service code changes
80
+
81
+ ### Added
82
+
83
+ - **Configurable System Prompt Restoration**: Control whether system prompts come from current config or historical snapshot
84
+ - **`preserve_system_prompts`** parameter in `swarm.restore()` and `orchestrator.restore()` (default: `false`)
85
+ - **Default behavior (`false`)**: System prompts from current agent definitions (YAML + SDK defaults + plugin injections)
86
+ - Enables system prompt iteration without creating new sessions
87
+ - Configuration is source of truth for agent behavior
88
+ - External session management with prompt updates works seamlessly
89
+ - **Historical mode (`true`)**: System prompts from snapshot (exact historical state)
90
+ - For debugging: "What instructions was agent following when bug occurred?"
91
+ - For auditing: "What exact prompts were active at that time?"
92
+ - For reproducibility: "Replay with exact historical context"
93
+ - **Applies to all agents**: Primary agents and delegation instances
94
+ - **Includes all injections**: YAML config, SDK defaults, SwarmMemory instructions, plugin additions
95
+ - **Non-breaking**: Backward compatible, all existing code works unchanged
96
+ - **Documentation**: Complete guide in `docs/v2/guides/snapshots.md` with examples and comparisons
97
+
98
+ - **System-Wide Filesystem Tools Control**: Global security setting to disable filesystem tools across all agents
99
+ - **`SwarmSDK.settings.allow_filesystem_tools`** - Global setting to enable/disable filesystem tools (default: true)
100
+ - **Environment variable**: `SWARM_SDK_ALLOW_FILESYSTEM_TOOLS` - Set via environment for production deployments
101
+ - **Parameter override**: `allow_filesystem_tools:` parameter in `SwarmSDK.build`, `load`, and `load_file`
102
+ - **Filesystem tools**: Read, Write, Edit, MultiEdit, Grep, Glob, Bash
103
+ - **Validation**: Build-time validation catches forbidden tools early with clear error messages
104
+ - **Non-breaking**: Defaults to `true` for backward compatibility
105
+ - **Security boundary**: External to swarm configuration - cannot be overridden by YAML/DSL
106
+ - **Tools still allowed**: Think, TodoWrite, Clock, WebFetch, ScratchpadRead/Write/List, Memory tools
107
+ - **Use cases**: Multi-tenant platforms, sandboxed execution, containerized environments, compliance requirements
108
+ - **Priority resolution**: Explicit parameter > Global setting > Environment variable > Default (true)
109
+ - **26 comprehensive tests** covering all configuration and validation scenarios
110
+ - **Documentation**: Complete implementation guide in `FILESYSTEM_TOOLS_CONTROL_PLAN.md`
111
+
112
+ - **Snapshot Reconstruction from Events**: Complete StateSnapshot reconstruction from event logs
113
+ - **`SwarmSDK::SnapshotFromEvents`** class reconstructs full swarm state from event stream
114
+ - **100% state reconstruction** - All components recoverable: conversations, context state, scratchpad, read tracking, delegation instances
115
+ - **Event sourcing ready** - Events are single source of truth, snapshots derived on-demand
116
+ - **Time travel debugging** - Reconstruct state at any point in time by filtering events
117
+ - **Session persistence** - Store only events in database, reconstruct snapshots when needed
118
+ - **`SwarmSDK::EventsToMessages`** helper class for message reconstruction with chronological ordering
119
+ - **Database/Redis patterns** - Complete examples for event-based session storage
120
+ - **Hybrid optimization** - Periodic snapshots + delta events for performance
121
+ - **Performance**: 1,000 events in ~10-20ms, 10,000 events in ~100-200ms
122
+ - **29 comprehensive tests** verifying event data capture and reconstruction accuracy
123
+ - **Documentation**: Complete guide in `docs/v2/guides/snapshots.md` with patterns and examples
124
+
125
+ - **Event Timestamp Guarantee**: All events now guaranteed to have timestamps
126
+ - **Automatic timestamp injection** in `LogCollector.emit` if missing
127
+ - **Format**: ISO 8601 UTC (`YYYY-MM-DDTHH:MM:SSZ`)
128
+ - **Preserves existing timestamps** - Won't overwrite if already present
129
+ - **Dual injection points** - LogStream and LogCollector both ensure timestamps
130
+ - **Chronological ordering** - Enables proper event sequencing for reconstruction
131
+ - **Updated test**: Verifies timestamp presence and preservation
132
+
133
+ - **Context Threshold Tracking**: New event for tracking which warning thresholds were hit
134
+ - **`context_threshold_hit`** event emitted when threshold crossed for first time
135
+ - **Contains**: `threshold` (integer: 60, 80, 90, 95), `current_usage_percentage`
136
+ - **Enables reconstruction** of `context_state.warning_thresholds_hit` from events
137
+ - **Separate from context_limit_warning** - Hit tracking vs informational warning
138
+
139
+ - **Read Tracking Digest in Events**: File read digests now included in tool_result metadata
140
+ - **`metadata.read_digest`** - SHA256 digest of read file content
141
+ - **`metadata.read_path`** - Absolute path to file
142
+ - **Added via `extract_tool_tracking_digest`** method after tool execution
143
+ - **Queries ReadTracker** after read completes to get calculated digest
144
+ - **Enables reconstruction** of complete read_tracking state from events
145
+ - **Works for all file types** - Text files, binary files, documents
146
+
147
+ - **Memory Read Tracking Digest in Events**: Memory read digests included in tool_result metadata
148
+ - **`metadata.read_digest`** - SHA256 digest of memory entry content
149
+ - **`metadata.read_path`** - Memory entry path
150
+ - **Unified handling** with file read tracking via same extraction method
151
+ - **Enables reconstruction** of complete memory_read_tracking state from events
152
+ - **Cross-gem coordination** - SwarmMemory and SwarmSDK work together seamlessly
153
+
154
+ - **Execution ID and Complete Swarm ID Tracking**: All log events now include comprehensive execution tracking fields
155
+ - **`execution_id`**: Uniquely identifies a single `swarm.execute()` or `orchestrator.execute()` call
156
+ - Format: `exec_{swarm_id}_{random_hex}` for swarms (e.g., `exec_main_a3f2b1c8`)
157
+ - Format: `exec_workflow_{random_hex}` for workflows (e.g., `exec_workflow_abc123`)
158
+ - Enables calculating total cost/tokens for a single execution
159
+ - Allows building complete execution traces across all agents and tools
160
+ - **`swarm_id`**: Identifies which swarm/node emitted the event
161
+ - Hierarchical format for NodeOrchestrator nodes (e.g., `workflow/node:planning`)
162
+ - Tracks execution flow through nested swarms and workflow stages
163
+ - **`parent_swarm_id`**: Identifies the parent swarm for nested execution contexts
164
+ - **Fiber-local storage implementation**: Uses Ruby 3.2+ Fiber storage for automatic propagation
165
+ - IDs automatically inherit to child fibers (tools, delegations, nested executions)
166
+ - Mini-swarms in workflows inherit orchestrator's execution_id while maintaining node-specific swarm_ids
167
+ - Zero manual propagation needed - all handled by `LogStream.emit()` auto-injection
168
+ - **Smart cleanup pattern**: Uses `block_given?` to determine cleanup responsibility
169
+ - Standalone swarms clear Fiber storage after execution
170
+ - Mini-swarms preserve parent's execution context for workflow continuity
171
+ - **Comprehensive coverage**: 30 out of 31 event types now have complete tracking
172
+ - All events except optional `claude_code_conversion_warning` (backward compatibility)
173
+ - **Production-ready**: Minimal code changes (3 files, ~28 lines), zero performance impact
174
+ - **Fully tested**: 10 comprehensive test cases covering uniqueness, inheritance, isolation, and cleanup
175
+
176
+ - **Composable Swarms**: Build reusable swarm components that can be composed together
177
+ - **New `id()` DSL method**: Set unique swarm identifier (required when using composable swarms)
178
+ - **New `swarms {}` DSL block**: Register external swarms for delegation
179
+ - **New `register()` method**: Three registration methods:
180
+ - `register "name", file: "./swarm.rb"` - Load from file
181
+ - `register "name", yaml: yaml_string` - Load from YAML string
182
+ - `register "name" { ... }` - Define inline with DSL block
183
+ - **`keep_context` parameter**: Control conversation persistence per swarm (default: true)
184
+ - **Hierarchical swarm IDs**: Parent/child tracking (e.g., `main/code_review/security`)
185
+ - **Transparent delegation**: Use swarms in `delegates_to` like regular agents
186
+ - **Lazy loading & caching**: Sub-swarms loaded on first access and cached
187
+ - **Circular dependency detection**: Runtime prevention of infinite delegation loops
188
+ - **Event tracking**: All events include `swarm_id` and `parent_swarm_id` fields
189
+ - **SwarmRegistry class**: Manages sub-swarm lifecycle and cleanup
190
+ - **SwarmLoader class**: Multi-source loader (files, YAML strings, blocks)
191
+ - **Deep nesting support**: Unlimited levels of swarm composition
192
+ - **Cleanup cascade**: Proper resource cleanup through hierarchy
193
+ - **YAML support**: `id:` and `swarms:` sections with file/inline definitions
194
+ - **Comprehensive tests**: 36 new tests, 100% pass rate
195
+
196
+ - **Per-Delegation Agent Instances**: Dual-mode delegation support with isolated and shared modes
197
+ - **New `shared_across_delegations` configuration** (default: `false`)
198
+ - `false` (default): Each delegator gets its own isolated instance with separate conversation history
199
+ - `true`: All delegators share the same primary agent instance (legacy behavior)
200
+ - **Prevents context mixing**: Multiple agents delegating to the same target no longer share conversation history by default
201
+ - **Instance naming**: Delegation instances follow `"delegate@delegator"` pattern (e.g., `"tester@frontend"`)
202
+ - **Memory sharing**: Plugin storage (SwarmMemory) shared by base name across all instances
203
+ - **Tool state isolation**: TodoWrite, ReadTracker, and other stateful tools isolated per instance
204
+ - **Nested delegation support**: Works correctly with multi-level delegation chains
205
+ - **Fiber-safe concurrency**: Added `Async::Semaphore` to `Chat.ask()` to prevent message corruption when multiple delegation instances call shared agents in parallel
206
+ - **Atomic caching**: NodeOrchestrator caches delegation instances together with primary agents for context preservation
207
+ - **Agent name validation**: Agent names cannot contain '@' character (reserved for delegation instances)
208
+ - **Automatic deduplication**: Duplicate entries in `delegates_to` are automatically removed
209
+ - **Comprehensive test coverage**: 17 new tests covering isolated mode, shared mode, nested delegation, cleanup, and more
210
+
211
+ - **YAML-to-DSL Internal Refactor**: Configuration class now uses DSL internally for swarm construction
212
+ - **New `Configuration.to_swarm` implementation**: Translates YAML to Ruby DSL calls instead of direct API
213
+ - **Better separation of concerns**: YAML parsing separated from swarm building logic
214
+ - **Node workflow support in YAML**: Full support for multi-stage node-based workflows
215
+ - **Improved translation methods**: `translate_agents`, `translate_all_agents`, `translate_nodes`, `translate_swarm_hooks`
216
+ - **Stricter validation**: Agent descriptions now required in YAML (caught earlier with better error messages)
217
+ - **Test coverage**: Added `yaml_node_support_test.rb` with comprehensive node workflow tests
218
+
219
+ - **YAML Hooks & Permissions**: Fixed and improved YAML configuration for hooks and permissions
220
+ - **Hooks now work correctly**: Fixed translation from YAML to DSL
221
+ - **Permissions properly translated**: Complex permission configurations now work in YAML
222
+ - **Documentation improvements**: Updated YAML reference with correct examples
223
+ - **Cleaner agent builder**: Removed redundant hook/permission handling code
224
+
225
+ ### Fixed
226
+
227
+ - **StateSnapshot tool_calls serialization**: Fixed bug where tool_calls couldn't be serialized
228
+ - **Issue**: `msg.tool_calls.map(&:to_h)` failed because tool_calls is a Hash, not Array
229
+ - **Fix**: Changed to `msg.tool_calls.values.map(&:to_h)` to properly serialize
230
+ - **Impact**: Snapshots with tool calls now serialize correctly
231
+ - **Location**: `lib/swarm_sdk/state_snapshot.rb:154`
232
+
233
+ - **ReadTracker and StorageReadTracker return digest**: Both trackers now return calculated digest
234
+ - **Changed**: `register_read` methods now return SHA256 digest string
235
+ - **Enables**: Digest extraction after tool execution for event metadata
236
+ - **Backward compatible**: Return value wasn't previously used
237
+
238
+ ### Changed
239
+
240
+ - **Breaking: Default tools reduced to essential file operations only**
241
+ - **Old default tools**: Read, Grep, Glob, WebFetch, TodoWrite, Clock, Think
242
+ - **New default tools**: Read, Grep, Glob
243
+ - **Removed from defaults**: WebFetch, TodoWrite, Clock, Think
244
+ - **Rationale**: Follows principle of least privilege - users have complete control over agent capabilities
245
+ - **Migration**: Explicitly add removed tools if needed: `tools :Read, :Grep, :Glob, :WebFetch, :TodoWrite, :Clock, :Think`
246
+ - **Impact**: Agents will no longer have WebFetch, TodoWrite, Clock, or Think unless explicitly added
247
+ - **Documentation updated**: All guides and references now show correct default tools
248
+
249
+ - **Breaking: Default delegation behavior changed**
250
+ - **Old behavior**: Multiple agents delegating to same target shared conversation history
251
+ - **New behavior**: Each delegator gets isolated instance with separate history (prevents context mixing)
252
+ - **Migration**: Add `shared_across_delegations: true` to agents that need the old shared behavior
253
+ - **Impact**: Existing swarms will see different behavior - agents no longer share delegation contexts by default
254
+
255
+ - **Ruby version upgraded**: 3.4.2 → 3.4.5
256
+ - Updated `.ruby-version` file
257
+ - All dependencies compatible with Ruby 3.4.5
258
+
259
+ - **RubyLLM upgraded**: 1.8.2 → 1.9.0
260
+ - Updated to latest RubyLLM gem version
261
+ - Updated ruby_llm-mcp integration
262
+ - Disabled MCP lazy loading for better compatibility
263
+ - See RubyLLM changelog for full details
264
+
265
+ - **YAML Configuration Loading**: Improved YAML parsing and validation
266
+ - **Stricter validation**: Required fields now validated earlier with better error messages
267
+ - **Better error context**: Error messages include field paths and agent names
268
+ - **Node workflow validation**: Full validation for node dependencies and transformers
269
+
270
+ - **TodoWrite system reminders**: Only injected when TodoWrite tool is available
271
+ - Fixed bug where TodoWrite reminders appeared even when tool was disabled
272
+ - System reminders now conditional based on agent's actual toolset
273
+ - Cleaner agent output when TodoWrite is not needed
274
+
275
+ ### Fixed
276
+
277
+ - **Node context preservation bug**: Fixed issue where `inject_cached_agents` would be overwritten by fresh initialization
278
+ - Added forced initialization before injection to ensure cached instances are preserved
279
+ - **Nested delegation race condition**: Added per-instance semaphore to prevent concurrent `ask()` calls from corrupting shared agent message history
280
+ - **Hash iteration bug**: Fixed "can't add key during iteration" error in nested delegation by using `.to_a`
281
+ - **YAML hooks translation**: Fixed hooks not being properly translated from YAML to DSL
282
+ - **YAML permissions handling**: Fixed permissions configurations not working correctly in YAML
283
+
284
+ ## [2.1.3]
285
+
286
+ ### Added
287
+
288
+ - **Validation API**: New methods to validate YAML configurations without creating swarms
289
+ - `SwarmSDK.validate(yaml_content, base_dir:)` - Validate YAML string and return structured errors
290
+ - `SwarmSDK.validate_file(path)` - Validate YAML file (convenience method)
291
+ - Returns array of error hashes with type, field path, message, and optional agent name
292
+ - Error types: `:syntax_error`, `:missing_field`, `:invalid_value`, `:invalid_reference`, `:directory_not_found`, `:file_not_found`, `:file_load_error`, `:circular_dependency`, `:validation_error`, `:unknown_error`
293
+ - Field paths use JSON-style notation: `"swarm.agents.backend.description"`
294
+ - Enables pre-flight validation for UIs, tools, and programmatic usage
295
+ - Comprehensive test coverage with 19 tests covering all error scenarios
296
+
297
+ - **String-based Configuration Loading**: Load YAML from strings, not just files
298
+ - `SwarmSDK.load(yaml_content, base_dir:)` - Load swarm from YAML string (primary API)
299
+ - `SwarmSDK.load_file(path)` - Load swarm from YAML file (convenience method)
300
+ - `base_dir` parameter for resolving agent file paths (defaults to `Dir.pwd`)
301
+ - Enables loading YAML from databases, APIs, environment variables, or any string source
302
+ - Cleaner separation: SDK works with strings, CLI handles file I/O
303
+
304
+ ### Changed
305
+
306
+ - **BREAKING: Removed `Swarm.load` class method**
307
+ - Old: `swarm = SwarmSDK::Swarm.load("config.yml")`
308
+ - New: `swarm = SwarmSDK.load_file("config.yml")`
309
+ - Cleaner API: All creation methods now at module level (`SwarmSDK.build`, `SwarmSDK.load`, `SwarmSDK.load_file`)
310
+
311
+ - **BREAKING: `Configuration` class refactored for string-based loading**
312
+ - Old: `Configuration.load(path)` → New: `Configuration.load_file(path)`
313
+ - Old: `Configuration.new(path)` → New: `Configuration.new(yaml_content, base_dir: Dir.pwd)`
314
+ - Removed `config_path` attribute (no longer stored)
315
+ - Internal: `@config_dir` renamed to `@base_dir`
316
+ - Core SDK now works with YAML strings, not file paths
317
+ - File I/O isolated to convenience methods (`load_file`)
318
+
319
+ - **Agent file path resolution**: Paths resolved relative to `base_dir`
320
+ - When loading from file: `base_dir` = file's directory (unchanged behavior)
321
+ - When loading from string: `base_dir` = `Dir.pwd` (default) or explicit parameter
322
+ - Example: `agent_file: "agents/backend.md"` resolves to `#{base_dir}/agents/backend.md`
323
+
324
+ ### Fixed
325
+
326
+ - **Configuration validation**: Better error messages with file context
327
+ - YAML syntax errors now include parser details
328
+ - File not found errors include absolute paths
329
+ - Agent file load errors include agent name and field path
330
+
8
331
  ## [2.1.2]
9
332
 
10
333
  ### Added
@@ -38,9 +361,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
38
361
  - Enables clean separation between core SDK and plugin features (memory, skills, etc.)
39
362
  - Plugins can preserve their configuration when agents are cloned in NodeOrchestrator
40
363
 
41
- - **NodeOrchestrator**: Passes scratchpad configuration to mini-swarms
42
- - Bug fix: `scratchpad_enabled` now correctly propagated to node-level swarms
43
- - Ensures `use_scratchpad false` works properly in node workflows
364
+ - **NodeOrchestrator**: Configurable scratchpad sharing modes
365
+ - `scratchpad: :enabled` - Share scratchpad across all nodes
366
+ - `scratchpad: :per_node` - Isolated scratchpad per node
367
+ - `scratchpad: :disabled` - No scratchpad tools (default)
44
368
 
45
369
  - **CLI ConfigLoader**: Accepts both Swarm and NodeOrchestrator instances
46
370
  - Bug fix: CLI now correctly handles NodeOrchestrator execution
@@ -235,17 +559,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
235
559
  directory: .swarm/assistant-memory
236
560
  ```
237
561
 
238
- - **Scratchpad Configuration DSL** - Enable/disable at swarm level
562
+ - **Scratchpad Configuration DSL** - Configure mode at swarm/workflow level
239
563
  ```ruby
240
564
  SwarmSDK.build do
241
- use_scratchpad true # or false (default: true)
565
+ scratchpad :enabled # or :per_node (nodes only), :disabled (default: :disabled)
242
566
  end
243
567
  ```
244
568
 
245
569
  - **Scratchpad Configuration YAML**
246
570
  ```yaml
247
571
  swarm:
248
- use_scratchpad: true # or false
572
+ scratchpad: enabled # or per_node (nodes only), disabled
249
573
  ```
250
574
 
251
575
  - **Agent Start Events** - New log event after agent initialization
@@ -283,8 +607,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
283
607
  - Future-ready for SQLite and FAISS adapters
284
608
 
285
609
  - **Default tools** - Conditional inclusion
286
- - Core defaults: Read, Grep, Glob, TodoWrite, Think, WebFetch
287
- - Scratchpad tools: Added if `use_scratchpad true` (default)
610
+ - Core defaults: Read, Grep, Glob
611
+ - Scratchpad tools: Added if `scratchpad: :enabled` (default)
288
612
  - Memory tools: Added if agent has `memory` configured
289
613
  - Enables fine-grained control over tool availability
290
614
 
@@ -324,7 +648,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
324
648
  - **Migration**: Old persisted scratchpad.json files will not load
325
649
 
326
650
  4. **Default tools behavior changed**: Memory and Scratchpad are conditional
327
- - Scratchpad: Enabled by default via `use_scratchpad true`
651
+ - Scratchpad: Enabled by default via `scratchpad: :enabled`
328
652
  - Memory: Opt-in via `memory` configuration
329
653
  - **Migration**: Explicitly configure if needed
330
654