claude_swarm 1.0.1 → 1.0.2

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 (267) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/commands/release.md +1 -1
  3. data/.claude/hooks/lint-code-files.rb +65 -0
  4. data/.rubocop.yml +22 -2
  5. data/CHANGELOG.md +14 -1
  6. data/CLAUDE.md +1 -1
  7. data/CONTRIBUTING.md +69 -0
  8. data/README.md +27 -2
  9. data/Rakefile +71 -3
  10. data/analyze_coverage.rb +94 -0
  11. data/docs/v2/CHANGELOG.swarm_cli.md +43 -0
  12. data/docs/v2/CHANGELOG.swarm_memory.md +379 -0
  13. data/docs/v2/CHANGELOG.swarm_sdk.md +362 -0
  14. data/docs/v2/README.md +308 -0
  15. data/docs/v2/guides/claude-code-agents.md +262 -0
  16. data/docs/v2/guides/complete-tutorial.md +3088 -0
  17. data/docs/v2/guides/getting-started.md +1456 -0
  18. data/docs/v2/guides/memory-adapters.md +998 -0
  19. data/docs/v2/guides/plugins.md +816 -0
  20. data/docs/v2/guides/quick-start-cli.md +1745 -0
  21. data/docs/v2/guides/rails-integration.md +1902 -0
  22. data/docs/v2/guides/swarm-memory.md +599 -0
  23. data/docs/v2/reference/cli.md +729 -0
  24. data/docs/v2/reference/ruby-dsl.md +2154 -0
  25. data/docs/v2/reference/yaml.md +1835 -0
  26. data/docs-team-swarm.yml +2222 -0
  27. data/examples/learning-assistant/assistant.md +7 -0
  28. data/examples/learning-assistant/example-memories/concept-example.md +90 -0
  29. data/examples/learning-assistant/example-memories/experience-example.md +66 -0
  30. data/examples/learning-assistant/example-memories/fact-example.md +76 -0
  31. data/examples/learning-assistant/example-memories/memory-index.md +78 -0
  32. data/examples/learning-assistant/example-memories/skill-example.md +168 -0
  33. data/examples/learning-assistant/learning_assistant.rb +34 -0
  34. data/examples/learning-assistant/learning_assistant.yml +20 -0
  35. data/examples/v2/dsl/01_basic.rb +44 -0
  36. data/examples/v2/dsl/02_core_parameters.rb +59 -0
  37. data/examples/v2/dsl/03_capabilities.rb +71 -0
  38. data/examples/v2/dsl/04_llm_parameters.rb +56 -0
  39. data/examples/v2/dsl/05_advanced_flags.rb +73 -0
  40. data/examples/v2/dsl/06_permissions.rb +80 -0
  41. data/examples/v2/dsl/07_mcp_server.rb +62 -0
  42. data/examples/v2/dsl/08_swarm_hooks.rb +53 -0
  43. data/examples/v2/dsl/09_agent_hooks.rb +67 -0
  44. data/examples/v2/dsl/10_all_agents_hooks.rb +67 -0
  45. data/examples/v2/dsl/11_delegation.rb +60 -0
  46. data/examples/v2/dsl/12_complete_integration.rb +137 -0
  47. data/examples/v2/file_tools_swarm.yml +102 -0
  48. data/examples/v2/hooks/01_basic_hooks.rb +133 -0
  49. data/examples/v2/hooks/02_usage_tracking.rb +201 -0
  50. data/examples/v2/hooks/03_production_monitoring.rb +429 -0
  51. data/examples/v2/hooks/agent_stop_exit_0.yml +21 -0
  52. data/examples/v2/hooks/agent_stop_exit_1.yml +21 -0
  53. data/examples/v2/hooks/agent_stop_exit_2.yml +26 -0
  54. data/examples/v2/hooks/multiple_hooks_all_pass.yml +37 -0
  55. data/examples/v2/hooks/multiple_hooks_first_fails.yml +37 -0
  56. data/examples/v2/hooks/multiple_hooks_second_fails.yml +37 -0
  57. data/examples/v2/hooks/multiple_hooks_warnings.yml +37 -0
  58. data/examples/v2/hooks/post_tool_use_exit_0.yml +24 -0
  59. data/examples/v2/hooks/post_tool_use_exit_1.yml +24 -0
  60. data/examples/v2/hooks/post_tool_use_exit_2.yml +24 -0
  61. data/examples/v2/hooks/post_tool_use_multi_matcher_exit_0.yml +26 -0
  62. data/examples/v2/hooks/post_tool_use_multi_matcher_exit_1.yml +26 -0
  63. data/examples/v2/hooks/post_tool_use_multi_matcher_exit_2.yml +26 -0
  64. data/examples/v2/hooks/pre_tool_use_exit_0.yml +24 -0
  65. data/examples/v2/hooks/pre_tool_use_exit_1.yml +24 -0
  66. data/examples/v2/hooks/pre_tool_use_exit_2.yml +24 -0
  67. data/examples/v2/hooks/pre_tool_use_multi_matcher_exit_0.yml +26 -0
  68. data/examples/v2/hooks/pre_tool_use_multi_matcher_exit_1.yml +26 -0
  69. data/examples/v2/hooks/pre_tool_use_multi_matcher_exit_2.yml +27 -0
  70. data/examples/v2/hooks/swarm_summary.sh +44 -0
  71. data/examples/v2/hooks/user_prompt_exit_0.yml +21 -0
  72. data/examples/v2/hooks/user_prompt_exit_1.yml +21 -0
  73. data/examples/v2/hooks/user_prompt_exit_2.yml +21 -0
  74. data/examples/v2/hooks/validate_bash.rb +59 -0
  75. data/examples/v2/multi_directory_permissions.yml +221 -0
  76. data/examples/v2/node_context_demo.rb +127 -0
  77. data/examples/v2/node_workflow.rb +173 -0
  78. data/examples/v2/path_resolution_demo.rb +216 -0
  79. data/examples/v2/simple-swarm-v2.rb +90 -0
  80. data/examples/v2/simple-swarm-v2.yml +62 -0
  81. data/examples/v2/swarm.yml +71 -0
  82. data/examples/v2/swarm_with_hooks.yml +61 -0
  83. data/examples/v2/swarm_with_hooks_simple.yml +25 -0
  84. data/examples/v2/think_tool_demo.rb +62 -0
  85. data/exe/swarm +6 -0
  86. data/lib/claude_swarm/claude_mcp_server.rb +0 -6
  87. data/lib/claude_swarm/cli.rb +10 -3
  88. data/lib/claude_swarm/commands/ps.rb +19 -20
  89. data/lib/claude_swarm/commands/show.rb +1 -1
  90. data/lib/claude_swarm/configuration.rb +10 -12
  91. data/lib/claude_swarm/mcp_generator.rb +10 -1
  92. data/lib/claude_swarm/orchestrator.rb +73 -49
  93. data/lib/claude_swarm/system_utils.rb +37 -11
  94. data/lib/claude_swarm/version.rb +1 -1
  95. data/lib/claude_swarm/worktree_manager.rb +1 -0
  96. data/lib/claude_swarm/yaml_loader.rb +22 -0
  97. data/lib/claude_swarm.rb +6 -2
  98. data/lib/swarm_cli/cli.rb +201 -0
  99. data/lib/swarm_cli/command_registry.rb +61 -0
  100. data/lib/swarm_cli/commands/mcp_serve.rb +130 -0
  101. data/lib/swarm_cli/commands/mcp_tools.rb +148 -0
  102. data/lib/swarm_cli/commands/migrate.rb +55 -0
  103. data/lib/swarm_cli/commands/run.rb +173 -0
  104. data/lib/swarm_cli/config_loader.rb +97 -0
  105. data/lib/swarm_cli/formatters/human_formatter.rb +711 -0
  106. data/lib/swarm_cli/formatters/json_formatter.rb +51 -0
  107. data/lib/swarm_cli/interactive_repl.rb +918 -0
  108. data/lib/swarm_cli/mcp_serve_options.rb +44 -0
  109. data/lib/swarm_cli/mcp_tools_options.rb +59 -0
  110. data/lib/swarm_cli/migrate_options.rb +54 -0
  111. data/lib/swarm_cli/migrator.rb +132 -0
  112. data/lib/swarm_cli/options.rb +151 -0
  113. data/lib/swarm_cli/ui/components/agent_badge.rb +33 -0
  114. data/lib/swarm_cli/ui/components/content_block.rb +120 -0
  115. data/lib/swarm_cli/ui/components/divider.rb +57 -0
  116. data/lib/swarm_cli/ui/components/panel.rb +62 -0
  117. data/lib/swarm_cli/ui/components/usage_stats.rb +70 -0
  118. data/lib/swarm_cli/ui/formatters/cost.rb +49 -0
  119. data/lib/swarm_cli/ui/formatters/number.rb +58 -0
  120. data/lib/swarm_cli/ui/formatters/text.rb +77 -0
  121. data/lib/swarm_cli/ui/formatters/time.rb +73 -0
  122. data/lib/swarm_cli/ui/icons.rb +59 -0
  123. data/lib/swarm_cli/ui/renderers/event_renderer.rb +188 -0
  124. data/lib/swarm_cli/ui/state/agent_color_cache.rb +45 -0
  125. data/lib/swarm_cli/ui/state/depth_tracker.rb +40 -0
  126. data/lib/swarm_cli/ui/state/spinner_manager.rb +170 -0
  127. data/lib/swarm_cli/ui/state/usage_tracker.rb +62 -0
  128. data/lib/swarm_cli/version.rb +5 -0
  129. data/lib/swarm_cli.rb +44 -0
  130. data/lib/swarm_memory/adapters/base.rb +141 -0
  131. data/lib/swarm_memory/adapters/filesystem_adapter.rb +845 -0
  132. data/lib/swarm_memory/chat_extension.rb +34 -0
  133. data/lib/swarm_memory/cli/commands.rb +306 -0
  134. data/lib/swarm_memory/core/entry.rb +37 -0
  135. data/lib/swarm_memory/core/frontmatter_parser.rb +108 -0
  136. data/lib/swarm_memory/core/metadata_extractor.rb +68 -0
  137. data/lib/swarm_memory/core/path_normalizer.rb +75 -0
  138. data/lib/swarm_memory/core/semantic_index.rb +244 -0
  139. data/lib/swarm_memory/core/storage.rb +288 -0
  140. data/lib/swarm_memory/core/storage_read_tracker.rb +63 -0
  141. data/lib/swarm_memory/dsl/builder_extension.rb +40 -0
  142. data/lib/swarm_memory/dsl/memory_config.rb +113 -0
  143. data/lib/swarm_memory/embeddings/embedder.rb +36 -0
  144. data/lib/swarm_memory/embeddings/informers_embedder.rb +152 -0
  145. data/lib/swarm_memory/errors.rb +21 -0
  146. data/lib/swarm_memory/integration/cli_registration.rb +30 -0
  147. data/lib/swarm_memory/integration/configuration.rb +43 -0
  148. data/lib/swarm_memory/integration/registration.rb +31 -0
  149. data/lib/swarm_memory/integration/sdk_plugin.rb +531 -0
  150. data/lib/swarm_memory/optimization/analyzer.rb +244 -0
  151. data/lib/swarm_memory/optimization/defragmenter.rb +863 -0
  152. data/lib/swarm_memory/prompts/memory.md.erb +109 -0
  153. data/lib/swarm_memory/prompts/memory_assistant.md.erb +181 -0
  154. data/lib/swarm_memory/prompts/memory_researcher.md.erb +281 -0
  155. data/lib/swarm_memory/prompts/memory_retrieval.md.erb +78 -0
  156. data/lib/swarm_memory/search/semantic_search.rb +112 -0
  157. data/lib/swarm_memory/search/text_search.rb +42 -0
  158. data/lib/swarm_memory/search/text_similarity.rb +80 -0
  159. data/lib/swarm_memory/skills/meta/deep-learning.md +101 -0
  160. data/lib/swarm_memory/skills/meta/deep-learning.yml +14 -0
  161. data/lib/swarm_memory/tools/load_skill.rb +313 -0
  162. data/lib/swarm_memory/tools/memory_defrag.rb +382 -0
  163. data/lib/swarm_memory/tools/memory_delete.rb +99 -0
  164. data/lib/swarm_memory/tools/memory_edit.rb +185 -0
  165. data/lib/swarm_memory/tools/memory_glob.rb +160 -0
  166. data/lib/swarm_memory/tools/memory_grep.rb +247 -0
  167. data/lib/swarm_memory/tools/memory_multi_edit.rb +281 -0
  168. data/lib/swarm_memory/tools/memory_read.rb +123 -0
  169. data/lib/swarm_memory/tools/memory_write.rb +231 -0
  170. data/lib/swarm_memory/utils.rb +50 -0
  171. data/lib/swarm_memory/version.rb +5 -0
  172. data/lib/swarm_memory.rb +166 -0
  173. data/lib/swarm_sdk/agent/RETRY_LOGIC.md +127 -0
  174. data/lib/swarm_sdk/agent/builder.rb +461 -0
  175. data/lib/swarm_sdk/agent/chat/context_tracker.rb +314 -0
  176. data/lib/swarm_sdk/agent/chat/hook_integration.rb +372 -0
  177. data/lib/swarm_sdk/agent/chat/logging_helpers.rb +116 -0
  178. data/lib/swarm_sdk/agent/chat/system_reminder_injector.rb +152 -0
  179. data/lib/swarm_sdk/agent/chat.rb +1159 -0
  180. data/lib/swarm_sdk/agent/context.rb +112 -0
  181. data/lib/swarm_sdk/agent/context_manager.rb +309 -0
  182. data/lib/swarm_sdk/agent/definition.rb +556 -0
  183. data/lib/swarm_sdk/claude_code_agent_adapter.rb +205 -0
  184. data/lib/swarm_sdk/configuration.rb +296 -0
  185. data/lib/swarm_sdk/context_compactor/metrics.rb +147 -0
  186. data/lib/swarm_sdk/context_compactor/token_counter.rb +106 -0
  187. data/lib/swarm_sdk/context_compactor.rb +340 -0
  188. data/lib/swarm_sdk/hooks/adapter.rb +359 -0
  189. data/lib/swarm_sdk/hooks/context.rb +197 -0
  190. data/lib/swarm_sdk/hooks/definition.rb +80 -0
  191. data/lib/swarm_sdk/hooks/error.rb +29 -0
  192. data/lib/swarm_sdk/hooks/executor.rb +146 -0
  193. data/lib/swarm_sdk/hooks/registry.rb +147 -0
  194. data/lib/swarm_sdk/hooks/result.rb +150 -0
  195. data/lib/swarm_sdk/hooks/shell_executor.rb +254 -0
  196. data/lib/swarm_sdk/hooks/tool_call.rb +35 -0
  197. data/lib/swarm_sdk/hooks/tool_result.rb +62 -0
  198. data/lib/swarm_sdk/log_collector.rb +51 -0
  199. data/lib/swarm_sdk/log_stream.rb +69 -0
  200. data/lib/swarm_sdk/markdown_parser.rb +75 -0
  201. data/lib/swarm_sdk/model_aliases.json +5 -0
  202. data/lib/swarm_sdk/models.json +1 -0
  203. data/lib/swarm_sdk/models.rb +120 -0
  204. data/lib/swarm_sdk/node/agent_config.rb +49 -0
  205. data/lib/swarm_sdk/node/builder.rb +439 -0
  206. data/lib/swarm_sdk/node/transformer_executor.rb +248 -0
  207. data/lib/swarm_sdk/node_context.rb +170 -0
  208. data/lib/swarm_sdk/node_orchestrator.rb +384 -0
  209. data/lib/swarm_sdk/permissions/config.rb +239 -0
  210. data/lib/swarm_sdk/permissions/error_formatter.rb +121 -0
  211. data/lib/swarm_sdk/permissions/path_matcher.rb +35 -0
  212. data/lib/swarm_sdk/permissions/validator.rb +173 -0
  213. data/lib/swarm_sdk/permissions_builder.rb +122 -0
  214. data/lib/swarm_sdk/plugin.rb +147 -0
  215. data/lib/swarm_sdk/plugin_registry.rb +101 -0
  216. data/lib/swarm_sdk/prompts/base_system_prompt.md.erb +243 -0
  217. data/lib/swarm_sdk/providers/openai_with_responses.rb +582 -0
  218. data/lib/swarm_sdk/result.rb +97 -0
  219. data/lib/swarm_sdk/swarm/agent_initializer.rb +334 -0
  220. data/lib/swarm_sdk/swarm/all_agents_builder.rb +140 -0
  221. data/lib/swarm_sdk/swarm/builder.rb +586 -0
  222. data/lib/swarm_sdk/swarm/mcp_configurator.rb +151 -0
  223. data/lib/swarm_sdk/swarm/tool_configurator.rb +419 -0
  224. data/lib/swarm_sdk/swarm.rb +982 -0
  225. data/lib/swarm_sdk/tools/bash.rb +274 -0
  226. data/lib/swarm_sdk/tools/clock.rb +44 -0
  227. data/lib/swarm_sdk/tools/delegate.rb +164 -0
  228. data/lib/swarm_sdk/tools/document_converters/base_converter.rb +83 -0
  229. data/lib/swarm_sdk/tools/document_converters/docx_converter.rb +99 -0
  230. data/lib/swarm_sdk/tools/document_converters/html_converter.rb +101 -0
  231. data/lib/swarm_sdk/tools/document_converters/pdf_converter.rb +78 -0
  232. data/lib/swarm_sdk/tools/document_converters/xlsx_converter.rb +194 -0
  233. data/lib/swarm_sdk/tools/edit.rb +150 -0
  234. data/lib/swarm_sdk/tools/glob.rb +158 -0
  235. data/lib/swarm_sdk/tools/grep.rb +228 -0
  236. data/lib/swarm_sdk/tools/image_extractors/docx_image_extractor.rb +43 -0
  237. data/lib/swarm_sdk/tools/image_extractors/pdf_image_extractor.rb +163 -0
  238. data/lib/swarm_sdk/tools/image_formats/tiff_builder.rb +65 -0
  239. data/lib/swarm_sdk/tools/multi_edit.rb +232 -0
  240. data/lib/swarm_sdk/tools/path_resolver.rb +43 -0
  241. data/lib/swarm_sdk/tools/read.rb +251 -0
  242. data/lib/swarm_sdk/tools/registry.rb +93 -0
  243. data/lib/swarm_sdk/tools/scratchpad/scratchpad_list.rb +96 -0
  244. data/lib/swarm_sdk/tools/scratchpad/scratchpad_read.rb +76 -0
  245. data/lib/swarm_sdk/tools/scratchpad/scratchpad_write.rb +91 -0
  246. data/lib/swarm_sdk/tools/stores/read_tracker.rb +61 -0
  247. data/lib/swarm_sdk/tools/stores/scratchpad_storage.rb +224 -0
  248. data/lib/swarm_sdk/tools/stores/storage.rb +148 -0
  249. data/lib/swarm_sdk/tools/stores/todo_manager.rb +65 -0
  250. data/lib/swarm_sdk/tools/think.rb +95 -0
  251. data/lib/swarm_sdk/tools/todo_write.rb +216 -0
  252. data/lib/swarm_sdk/tools/web_fetch.rb +261 -0
  253. data/lib/swarm_sdk/tools/write.rb +117 -0
  254. data/lib/swarm_sdk/utils.rb +50 -0
  255. data/lib/swarm_sdk/version.rb +5 -0
  256. data/lib/swarm_sdk.rb +157 -0
  257. data/llm.v2.txt +13407 -0
  258. data/rubocop/cop/security/no_reflection_methods.rb +47 -0
  259. data/rubocop/cop/security/no_ruby_llm_logger.rb +32 -0
  260. data/swarm_cli.gemspec +57 -0
  261. data/swarm_memory.gemspec +28 -0
  262. data/swarm_sdk.gemspec +41 -0
  263. data/team.yml +1 -1
  264. data/team_full.yml +1875 -0
  265. data/{team_v2.yml → team_sdk.yml} +121 -52
  266. metadata +247 -4
  267. data/EXAMPLES.md +0 -164
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: assistant
3
+ description: An assistant that learns and builds knowledge over time
4
+ model: sonnet
5
+ ---
6
+
7
+ You are an assistant.
@@ -0,0 +1,90 @@
1
+ ---
2
+ type: concept
3
+ domain: programming/ruby
4
+ confidence: high
5
+ last_verified: 2025-01-15
6
+ tags: [ruby, classes, oop, inheritance, objects]
7
+ related:
8
+ - memory://memory/concepts/programming/ruby/modules.md
9
+ - memory://memory/concepts/programming/oop/inheritance.md
10
+ - memory://memory/skills/programming/ruby/create-class.md
11
+ source: documentation
12
+ ---
13
+
14
+ # Ruby Classes
15
+
16
+ ## Definition
17
+
18
+ Classes are blueprints for creating objects in Ruby. They define both the structure (instance variables) and behavior (methods) that objects created from the class will have.
19
+
20
+ ## Core Syntax
21
+
22
+ ```ruby
23
+ class Person
24
+ # Constructor
25
+ def initialize(name, age)
26
+ @name = name # Instance variable
27
+ @age = age
28
+ end
29
+
30
+ # Instance method
31
+ def introduce
32
+ "Hi, I'm #{@name} and I'm #{@age} years old"
33
+ end
34
+
35
+ # Class method
36
+ def self.species
37
+ "Homo sapiens"
38
+ end
39
+ end
40
+
41
+ # Usage
42
+ person = Person.new("Alice", 30)
43
+ person.introduce # => "Hi, I'm Alice and I'm 30 years old"
44
+ Person.species # => "Homo sapiens"
45
+ ```
46
+
47
+ ## Key Characteristics
48
+
49
+ 1. **Instantiation**: Create objects with `.new`
50
+ 2. **Instance variables**: Start with `@`, unique per instance
51
+ 3. **Instance methods**: Define object behavior
52
+ 4. **Class methods**: Shared across all instances (use `self.`)
53
+ 5. **Inheritance**: Single inheritance with `<`
54
+ 6. **Visibility**: public (default), private, protected
55
+
56
+ ## Inheritance
57
+
58
+ ```ruby
59
+ class Employee < Person
60
+ def initialize(name, age, role)
61
+ super(name, age) # Call parent constructor
62
+ @role = role
63
+ end
64
+
65
+ def introduce
66
+ super + " and I work as a #{@role}"
67
+ end
68
+ end
69
+ ```
70
+
71
+ ## When to Use
72
+
73
+ - Modeling real-world entities (User, Product, Order)
74
+ - Need multiple instances with shared behavior
75
+ - Building reusable, stateful components
76
+ - Implementing object-oriented patterns
77
+
78
+ ## Relationships
79
+
80
+ - **Similar to**: Modules (but modules can't be instantiated)
81
+ - **Part of**: Object-Oriented Programming paradigm
82
+ - **Used with**: Inheritance, Mixins, Composition
83
+ - **Differs from**: Structs (simpler, less flexible)
84
+
85
+ ## Common Patterns
86
+
87
+ 1. **Encapsulation**: Hide internal state with private methods
88
+ 2. **Delegation**: Forward calls to composed objects
89
+ 3. **Factory pattern**: Class methods that return instances
90
+ 4. **Template method**: Parent class defines structure, children implement details
@@ -0,0 +1,66 @@
1
+ ---
2
+ type: experience
3
+ category: success
4
+ domain: swarm/memory
5
+ date: 2025-01-15
6
+ tags: [learning, first-success, memory-system, milestone]
7
+ related:
8
+ - memory://memory/skills/swarm/scratchpad-write.md
9
+ - memory://memory/concepts/swarm/scratchpad-system.md
10
+ source: experimentation
11
+ ---
12
+
13
+ # First Successful Memory Write
14
+
15
+ ## Context
16
+
17
+ This was my first attempt at using the memory system. I needed to store knowledge about how to use the MemoryWrite tool.
18
+
19
+ ## What I Did
20
+
21
+ 1. Chose appropriate path: `memory/skills/swarm/scratchpad-write.md`
22
+ 2. Created YAML frontmatter with all required fields
23
+ 3. Wrote structured markdown with examples
24
+ 4. Successfully stored the entry
25
+ 5. Verified by reading it back with MemoryRead
26
+
27
+ ## Challenges Faced
28
+
29
+ - Initially unsure about path structure (should it be `skills/swarm/` or `swarm/skills/`)
30
+ - Wasn't sure how detailed the frontmatter should be
31
+ - Questioned whether to use `.md` extension
32
+
33
+ ## What Worked
34
+
35
+ - Following the memory schema from system prompt
36
+ - Using kebab-case for paths
37
+ - Including concrete examples in the content
38
+ - Marking confidence honestly (medium at first)
39
+
40
+ ## Outcome
41
+
42
+ Successfully created my first memory entry. I can now read it back and use it as a template for future entries.
43
+
44
+ ## Lesson Learned
45
+
46
+ **Key insight**: The memory system works best when you:
47
+ 1. Follow the schema strictly (don't improvise paths)
48
+ 2. Write immediately after learning (don't batch)
49
+ 3. Include rich frontmatter (makes searching easier)
50
+ 4. Use examples (makes recall more useful)
51
+
52
+ ## Apply This Pattern When
53
+
54
+ - Starting to use any new tool or system
55
+ - Building a new skill
56
+ - Need to remember a process
57
+ - Want to capture a lesson learned
58
+
59
+ ## Evolution
60
+
61
+ This entry will serve as a template and reminder for how to use the memory system effectively. As I gain more experience, I'll update it with additional insights.
62
+
63
+ ## Confidence Growth
64
+
65
+ - **Day 1** (2025-01-15): confidence: medium - First attempt, learning
66
+ - **Future**: Will increase to high after 5+ successful uses
@@ -0,0 +1,76 @@
1
+ ---
2
+ type: fact
3
+ domain: people
4
+ confidence: high
5
+ last_verified: 2025-01-15
6
+ tags: [user, paulo, preferences, communication]
7
+ source: user
8
+ ---
9
+
10
+ # User: Paulo
11
+
12
+ ## Role & Context
13
+
14
+ - **Primary user** and project owner
15
+ - **Working on**: SwarmSDK and SwarmCLI Ruby gems
16
+ - **Project location**: `/Users/paulo/src/github.com/parruda/claude-swarm`
17
+ - **Platform**: macOS (Darwin 24.6.0)
18
+ - **Ruby version**: 3.4.2
19
+
20
+ ## Communication Preferences
21
+
22
+ ### Style
23
+ - Prefers **direct, concise** communication
24
+ - Values **professional, clean** code
25
+ - Appreciates **thorough explanations** when asked
26
+ - Likes when I explain my reasoning
27
+
28
+ ### Expectations
29
+ - **Production-ready** implementations (not prototypes)
30
+ - **Comprehensive testing** (all tests must pass)
31
+ - **Clean code** (RuboCop compliance)
32
+ - **Proper documentation** (accurate, current)
33
+
34
+ ### Work Style
35
+ - Asks **clarifying questions** when unsure
36
+ - Provides **specific feedback** on implementations
37
+ - Iterates quickly - makes decisions and moves forward
38
+ - Values **best practices** and **maintainability**
39
+
40
+ ## Project Context
41
+
42
+ ### SwarmSDK
43
+ - Building next-generation multi-agent orchestration framework
44
+ - Focuses on single-process execution using RubyLLM
45
+ - Clean separation between SDK (lib/swarm_sdk/) and CLI (lib/swarm_cli/)
46
+ - Strong emphasis on testing and code quality
47
+
48
+ ### Development Practices
49
+ - Uses Zeitwerk for autoloading
50
+ - Follows Ruby/RuboCop conventions
51
+ - Comprehensive test coverage required
52
+ - Documentation must reflect code reality (no "New!" announcements)
53
+
54
+ ## How to Work with Paulo
55
+
56
+ 1. **Be direct** - No fluff, get to the point
57
+ 2. **Be thorough** - Complete implementations, not partial
58
+ 3. **Ask when unsure** - Don't guess architectural decisions
59
+ 4. **Test everything** - All tests must pass before completion
60
+ 5. **Document accurately** - Docs describe current state, not history
61
+
62
+ ## Things Paulo Cares About
63
+
64
+ - **Separation of concerns** - SDK vs CLI code must never mix
65
+ - **Professional code quality** - This is open source, must look great
66
+ - **No slop** - No methods that exist only for tests
67
+ - **Proper delegation** - Consult experts via MCP tools
68
+ - **Breaking changes** - Be explicit about them
69
+
70
+ ## Things to Avoid
71
+
72
+ - Creating unnecessary files (especially markdown/README files proactively)
73
+ - Using emojis unless explicitly requested
74
+ - Making assumptions about architecture without asking
75
+ - Mixing SDK and CLI code
76
+ - Incomplete implementations
@@ -0,0 +1,78 @@
1
+ ---
2
+ type: index
3
+ last_updated: 2025-01-15
4
+ total_entries: 8
5
+ ---
6
+
7
+ # Memory Index
8
+
9
+ My current knowledge base as of 2025-01-15.
10
+
11
+ ## Quick Stats
12
+ - **Concepts**: 2
13
+ - **Facts**: 3
14
+ - **Skills**: 2
15
+ - **Experiences**: 1
16
+
17
+ ## Expertise Areas
18
+
19
+ ### Strong (5+ entries)
20
+ - Ruby programming (3 concepts + 2 skills)
21
+
22
+ ### Developing (2-4 entries)
23
+ - User context (3 facts)
24
+
25
+ ### Learning (1 entry)
26
+ - Testing practices (1 experience)
27
+
28
+ ## Recent Activity (Last 7 Days)
29
+
30
+ - **2025-01-15**: Learned Minitest testing → skills/programming/ruby/minitest-testing.md
31
+ - **2025-01-15**: Understood user preferences → facts/people/paulo.md
32
+ - **2025-01-15**: Discovered project structure → facts/environment/project-structure.md
33
+ - **2025-01-14**: Learned about Ruby classes → concepts/programming/ruby/classes.md
34
+ - **2025-01-14**: Mastered MemoryWrite → skills/swarm/scratchpad-write.md
35
+
36
+ ## Knowledge Gaps (To Explore)
37
+
38
+ Questions I need to answer:
39
+ - How does the SwarmSDK delegation system work?
40
+ - What are the best practices for organizing large memory hierarchies?
41
+ - How should I handle conflicting information from different sources?
42
+
43
+ ## Category Breakdown
44
+
45
+ ### Concepts
46
+ - `concepts/programming/ruby/` (2 entries)
47
+ - classes.md
48
+ - modules.md
49
+
50
+ ### Facts
51
+ - `facts/people/` (1 entry)
52
+ - paulo.md
53
+ - `facts/environment/` (2 entries)
54
+ - project-structure.md
55
+ - preferences.md
56
+
57
+ ### Skills
58
+ - `skills/programming/ruby/` (1 entry)
59
+ - minitest-testing.md
60
+ - `skills/swarm/` (1 entry)
61
+ - scratchpad-write.md
62
+
63
+ ### Experience
64
+ - `experience/successes/` (1 entry)
65
+ - 2025-01-15-first-memory-write.md
66
+
67
+ ## Memory Health
68
+
69
+ - **Total Size**: ~50KB / 100MB (0.05% used)
70
+ - **Organization**: Good - clear hierarchy
71
+ - **Cross-references**: 8 links across entries
72
+ - **Confidence Distribution**: High: 6, Medium: 2, Low: 0
73
+
74
+ ## Next Session Goals
75
+
76
+ 1. Learn more about the SwarmSDK agent system
77
+ 2. Build skills in file operations (Read, Write, Edit)
78
+ 3. Understand the user's current project goals
@@ -0,0 +1,168 @@
1
+ ---
2
+ type: skill
3
+ domain: swarm/memory
4
+ difficulty: beginner
5
+ confidence: high
6
+ last_verified: 2025-01-15
7
+ prerequisites: []
8
+ tags: [swarm, scratchpad, memory, learning]
9
+ related:
10
+ - memory://memory/concepts/swarm/scratchpad-system.md
11
+ - memory://memory/skills/swarm/scratchpad-read.md
12
+ source: experimentation
13
+ ---
14
+
15
+ # Writing to Memory Memory
16
+
17
+ ## What This Does
18
+
19
+ Stores knowledge in the Memory memory system for later retrieval. This is how you persist everything you learn.
20
+
21
+ ## When to Use
22
+
23
+ - **Immediately** after learning something new
24
+ - When user provides information
25
+ - After solving a problem
26
+ - When discovering how something works
27
+ - After experimenting with tools
28
+
29
+ ## Steps
30
+
31
+ 1. **Determine the category**: concept/fact/skill/experience
32
+ 2. **Choose the path**: Follow memory hierarchy conventions
33
+ 3. **Prepare content**: YAML frontmatter + markdown body
34
+ 4. **Write**: Use MemoryWrite tool
35
+ 5. **Verify**: Optionally read back to confirm
36
+
37
+ ## Tool Signature
38
+
39
+ ```
40
+ MemoryWrite(
41
+ file_path: "memory/{category}/{domain}/{name}.md",
42
+ content: "{yaml-frontmatter}\n\n{markdown-content}",
43
+ title: "{Brief descriptive title}"
44
+ )
45
+ ```
46
+
47
+ ## Example: Storing a Concept
48
+
49
+ ```
50
+ MemoryWrite(
51
+ file_path: "memory/concepts/programming/ruby/classes.md",
52
+ content: "---
53
+ type: concept
54
+ domain: programming/ruby
55
+ confidence: high
56
+ last_verified: 2025-01-15
57
+ tags: [ruby, classes, oop]
58
+ related: []
59
+ source: documentation
60
+ ---
61
+
62
+ # Ruby Classes
63
+
64
+ Classes are blueprints for objects...
65
+ ",
66
+ title: "Ruby Classes Concept"
67
+ )
68
+ ```
69
+
70
+ ## Example: Storing a Fact
71
+
72
+ ```
73
+ MemoryWrite(
74
+ file_path: "memory/facts/people/paulo.md",
75
+ content: "---
76
+ type: fact
77
+ domain: people
78
+ confidence: high
79
+ last_verified: 2025-01-15
80
+ tags: [user, preferences]
81
+ source: user
82
+ ---
83
+
84
+ # User: Paulo
85
+
86
+ ## Role
87
+ Primary user and project owner
88
+
89
+ ## Preferences
90
+ - Direct communication
91
+ - Clean code
92
+ ",
93
+ title: "User Paulo Profile"
94
+ )
95
+ ```
96
+
97
+ ## Common Patterns
98
+
99
+ ### Learning from User
100
+ ```
101
+ User tells you something
102
+ → Categorize it (usually 'fact')
103
+ → Choose domain (people/environment/technical)
104
+ → Write immediately
105
+ → Mark source: user, confidence: high
106
+ ```
107
+
108
+ ### Learning from Experimentation
109
+ ```
110
+ You discover how a tool works
111
+ → Category: skill or concept
112
+ → Domain: the tool's domain
113
+ → Write with examples
114
+ → Mark source: experimentation
115
+ → Mark confidence: medium (until verified multiple times)
116
+ ```
117
+
118
+ ### Learning from Documentation
119
+ ```
120
+ You fetch documentation with WebFetch
121
+ → Extract key information
122
+ → Write as concept or fact
123
+ → Mark source: documentation, confidence: high
124
+ → Include cross-references
125
+ ```
126
+
127
+ ## Best Practices
128
+
129
+ 1. **Write immediately** - Don't wait until end of task
130
+ 2. **Complete frontmatter** - All fields matter
131
+ 3. **Descriptive titles** - Make entries discoverable
132
+ 4. **Rich content** - Include examples, context, relationships
133
+ 5. **Update index** - After 5-10 new writes
134
+ 6. **Verify paths** - Use kebab-case, lowercase, specific domains
135
+
136
+ ## Common Mistakes to Avoid
137
+
138
+ ❌ **Vague paths**: `memory/ruby.md` (too general)
139
+ ✅ **Specific paths**: `memory/concepts/programming/ruby/classes.md`
140
+
141
+ ❌ **Missing frontmatter**: Just markdown content
142
+ ✅ **Complete frontmatter**: All metadata fields
143
+
144
+ ❌ **Batching**: Learning 10 things, writing at end
145
+ ✅ **Immediate**: Learn one thing, write immediately
146
+
147
+ ❌ **Generic titles**: "Information about Ruby"
148
+ ✅ **Specific titles**: "Ruby Classes Concept"
149
+
150
+ ## Troubleshooting
151
+
152
+ **Problem**: Entry too large (>1MB)
153
+ - **Solution**: Break into multiple related entries
154
+
155
+ **Problem**: Don't know where to store something
156
+ - **Solution**: Think about type first (concept/fact/skill/experience), then domain
157
+
158
+ **Problem**: Duplicate knowledge exists
159
+ - **Solution**: Search first with Glob/Grep, then decide to update or create new
160
+
161
+ ## Success Indicators
162
+
163
+ You're doing it right when:
164
+ - ✅ You can answer questions from memory without re-learning
165
+ - ✅ Your memory/index.md accurately reflects what you know
166
+ - ✅ You find relevant entries quickly with Glob/Grep
167
+ - ✅ Knowledge builds on previous knowledge (cross-references work)
168
+ - ✅ You become faster at familiar tasks over time
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "swarm_sdk"
6
+
7
+ # Example: Learning Assistant with Persistent Memory
8
+ #
9
+ # This demonstrates a continuously learning agent that:
10
+ # - Starts with zero knowledge
11
+ # - Learns through tools and user interaction
12
+ # - Stores knowledge in organized memory
13
+ # - Recalls from memory in future sessions
14
+ # - Evolves and improves over time
15
+
16
+ SwarmSDK.build do
17
+ name("Learning Assistant")
18
+ lead(:assistant)
19
+ use_scratchpad(true) # default
20
+
21
+ # Load agent from markdown file (includes system prompt with memory schema)
22
+ agent(:assistant, File.read("examples/learning-assistant/assistant.md")) do
23
+ # Configure persistent memory for learning
24
+
25
+ memory do
26
+ adapter :filesystem # default, can omit
27
+ directory ".swarm/learning-assistant"
28
+ end
29
+
30
+ # Memory tools will be automatically added because memory is configured
31
+ # Default tools are still available: Read, Grep, Glob, WebFetch, Think, TodoWrite
32
+ # Scratchpad tools are available: ScratchpadWrite, ScratchpadRead, ScratchpadList
33
+ end
34
+ end
@@ -0,0 +1,20 @@
1
+ version: 2
2
+
3
+ swarm:
4
+ name: Learning Assistant
5
+ lead: assistant
6
+ use_scratchpad: true # default
7
+
8
+ agents:
9
+ assistant:
10
+ description: An assistant that learns and builds knowledge over time
11
+ agent_file: examples/learning-assistant/assistant.md
12
+
13
+ # Configure persistent memory for learning
14
+ memory:
15
+ adapter: filesystem # default, can omit
16
+ directory: .swarm/learning-assistant
17
+
18
+ # Memory tools automatically added because memory is configured
19
+ # Default tools: Read, Grep, Glob, WebFetch, Think, TodoWrite
20
+ # Scratchpad tools: ScratchpadWrite, ScratchpadRead, ScratchpadList
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Manual Test 1: Basic Swarm Configuration
5
+ #
6
+ # Tests: name, lead, basic agent with minimal config
7
+ #
8
+ # Run: bundle exec ruby -Ilib lib/swarm_sdk/examples/dsl/01_basic.rb
9
+
10
+ require "swarm_sdk"
11
+ require_relative "../../../swarm_sdk/swarm_builder"
12
+ require_relative "../../../swarm_sdk/agent_builder"
13
+
14
+ ENV["OPENAI_API_KEY"] = "test-key"
15
+
16
+ swarm = SwarmSDK.build do
17
+ name("Basic Test Swarm")
18
+ lead(:simple_agent)
19
+
20
+ agent(:simple_agent) do
21
+ model("gpt-5-nano")
22
+ provider("openai")
23
+ system_prompt("You are a simple test agent. Answer questions concisely.")
24
+ description("Simple agent for basic DSL testing")
25
+ tools(:Read)
26
+ end
27
+ end
28
+
29
+ puts "✅ Swarm built successfully!"
30
+ puts "Name: #{swarm.name}"
31
+ puts "Lead: #{swarm.lead_agent}"
32
+ puts "Agents: #{swarm.agent_names.join(", ")}"
33
+ puts ""
34
+ puts "Running test query..."
35
+
36
+ result = swarm.execute("What is 2 + 2?")
37
+
38
+ puts ""
39
+ puts "Result: #{result.content}"
40
+ puts "Success: #{result.success?}"
41
+ puts "Duration: #{result.duration}s"
42
+ puts "Cost: $#{result.total_cost}"
43
+ puts ""
44
+ puts "✅ Basic configuration works!"
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Manual Test 2: All Core Agent Parameters
5
+ #
6
+ # Tests: model, provider, base_url, api_version, context_window, system_prompt, description
7
+ #
8
+ # Run: bundle exec ruby -Ilib lib/swarm_sdk/examples/dsl/02_core_parameters.rb
9
+
10
+ require "swarm_sdk"
11
+ require_relative "../../../swarm_sdk/swarm_builder"
12
+ require_relative "../../../swarm_sdk/agent_builder"
13
+
14
+ ENV["OPENAI_API_KEY"] = "test-key"
15
+
16
+ swarm = SwarmSDK.build do
17
+ name("Core Parameters Test")
18
+ lead(:full_config_agent)
19
+
20
+ agent(:full_config_agent) do
21
+ # Core LLM configuration
22
+ model("gpt-5-nano")
23
+ provider("openai")
24
+ api_version("v1/responses")
25
+ context_window(200_000)
26
+
27
+ # Agent identity
28
+ system_prompt("You are testing all core configuration parameters. Be concise.")
29
+ description("Agent testing all core configuration parameters")
30
+
31
+ # Minimal tool for testing
32
+ tools(:Read)
33
+ end
34
+ end
35
+
36
+ puts "✅ Swarm with all core parameters built!"
37
+ puts "Testing configuration..."
38
+ puts ""
39
+
40
+ agent_def = swarm.agent_definition(:full_config_agent)
41
+
42
+ puts "Configuration Verification:"
43
+ puts " model: #{agent_def.model}"
44
+ puts " provider: #{agent_def.provider}"
45
+ puts " base_url: #{agent_def.base_url}"
46
+ puts " api_version: #{agent_def.api_version}"
47
+ puts " context_window: #{agent_def.context_window}"
48
+ puts " description: #{agent_def.description}"
49
+ puts " system_prompt length: #{agent_def.system_prompt.length} chars"
50
+ puts ""
51
+
52
+ puts "Running test query..."
53
+ result = swarm.execute("Say 'core params work'")
54
+
55
+ puts ""
56
+ puts "Response: #{result.content}"
57
+ puts "Success: #{result.success?}"
58
+ puts ""
59
+ puts "✅ All core parameters work correctly!"