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.
- checksums.yaml +4 -4
- data/.claude/commands/release.md +1 -1
- data/.claude/hooks/lint-code-files.rb +65 -0
- data/.rubocop.yml +22 -2
- data/CHANGELOG.md +14 -1
- data/CLAUDE.md +1 -1
- data/CONTRIBUTING.md +69 -0
- data/README.md +27 -2
- data/Rakefile +71 -3
- data/analyze_coverage.rb +94 -0
- data/docs/v2/CHANGELOG.swarm_cli.md +43 -0
- data/docs/v2/CHANGELOG.swarm_memory.md +379 -0
- data/docs/v2/CHANGELOG.swarm_sdk.md +362 -0
- data/docs/v2/README.md +308 -0
- data/docs/v2/guides/claude-code-agents.md +262 -0
- data/docs/v2/guides/complete-tutorial.md +3088 -0
- data/docs/v2/guides/getting-started.md +1456 -0
- data/docs/v2/guides/memory-adapters.md +998 -0
- data/docs/v2/guides/plugins.md +816 -0
- data/docs/v2/guides/quick-start-cli.md +1745 -0
- data/docs/v2/guides/rails-integration.md +1902 -0
- data/docs/v2/guides/swarm-memory.md +599 -0
- data/docs/v2/reference/cli.md +729 -0
- data/docs/v2/reference/ruby-dsl.md +2154 -0
- data/docs/v2/reference/yaml.md +1835 -0
- data/docs-team-swarm.yml +2222 -0
- data/examples/learning-assistant/assistant.md +7 -0
- data/examples/learning-assistant/example-memories/concept-example.md +90 -0
- data/examples/learning-assistant/example-memories/experience-example.md +66 -0
- data/examples/learning-assistant/example-memories/fact-example.md +76 -0
- data/examples/learning-assistant/example-memories/memory-index.md +78 -0
- data/examples/learning-assistant/example-memories/skill-example.md +168 -0
- data/examples/learning-assistant/learning_assistant.rb +34 -0
- data/examples/learning-assistant/learning_assistant.yml +20 -0
- data/examples/v2/dsl/01_basic.rb +44 -0
- data/examples/v2/dsl/02_core_parameters.rb +59 -0
- data/examples/v2/dsl/03_capabilities.rb +71 -0
- data/examples/v2/dsl/04_llm_parameters.rb +56 -0
- data/examples/v2/dsl/05_advanced_flags.rb +73 -0
- data/examples/v2/dsl/06_permissions.rb +80 -0
- data/examples/v2/dsl/07_mcp_server.rb +62 -0
- data/examples/v2/dsl/08_swarm_hooks.rb +53 -0
- data/examples/v2/dsl/09_agent_hooks.rb +67 -0
- data/examples/v2/dsl/10_all_agents_hooks.rb +67 -0
- data/examples/v2/dsl/11_delegation.rb +60 -0
- data/examples/v2/dsl/12_complete_integration.rb +137 -0
- data/examples/v2/file_tools_swarm.yml +102 -0
- data/examples/v2/hooks/01_basic_hooks.rb +133 -0
- data/examples/v2/hooks/02_usage_tracking.rb +201 -0
- data/examples/v2/hooks/03_production_monitoring.rb +429 -0
- data/examples/v2/hooks/agent_stop_exit_0.yml +21 -0
- data/examples/v2/hooks/agent_stop_exit_1.yml +21 -0
- data/examples/v2/hooks/agent_stop_exit_2.yml +26 -0
- data/examples/v2/hooks/multiple_hooks_all_pass.yml +37 -0
- data/examples/v2/hooks/multiple_hooks_first_fails.yml +37 -0
- data/examples/v2/hooks/multiple_hooks_second_fails.yml +37 -0
- data/examples/v2/hooks/multiple_hooks_warnings.yml +37 -0
- data/examples/v2/hooks/post_tool_use_exit_0.yml +24 -0
- data/examples/v2/hooks/post_tool_use_exit_1.yml +24 -0
- data/examples/v2/hooks/post_tool_use_exit_2.yml +24 -0
- data/examples/v2/hooks/post_tool_use_multi_matcher_exit_0.yml +26 -0
- data/examples/v2/hooks/post_tool_use_multi_matcher_exit_1.yml +26 -0
- data/examples/v2/hooks/post_tool_use_multi_matcher_exit_2.yml +26 -0
- data/examples/v2/hooks/pre_tool_use_exit_0.yml +24 -0
- data/examples/v2/hooks/pre_tool_use_exit_1.yml +24 -0
- data/examples/v2/hooks/pre_tool_use_exit_2.yml +24 -0
- data/examples/v2/hooks/pre_tool_use_multi_matcher_exit_0.yml +26 -0
- data/examples/v2/hooks/pre_tool_use_multi_matcher_exit_1.yml +26 -0
- data/examples/v2/hooks/pre_tool_use_multi_matcher_exit_2.yml +27 -0
- data/examples/v2/hooks/swarm_summary.sh +44 -0
- data/examples/v2/hooks/user_prompt_exit_0.yml +21 -0
- data/examples/v2/hooks/user_prompt_exit_1.yml +21 -0
- data/examples/v2/hooks/user_prompt_exit_2.yml +21 -0
- data/examples/v2/hooks/validate_bash.rb +59 -0
- data/examples/v2/multi_directory_permissions.yml +221 -0
- data/examples/v2/node_context_demo.rb +127 -0
- data/examples/v2/node_workflow.rb +173 -0
- data/examples/v2/path_resolution_demo.rb +216 -0
- data/examples/v2/simple-swarm-v2.rb +90 -0
- data/examples/v2/simple-swarm-v2.yml +62 -0
- data/examples/v2/swarm.yml +71 -0
- data/examples/v2/swarm_with_hooks.yml +61 -0
- data/examples/v2/swarm_with_hooks_simple.yml +25 -0
- data/examples/v2/think_tool_demo.rb +62 -0
- data/exe/swarm +6 -0
- data/lib/claude_swarm/claude_mcp_server.rb +0 -6
- data/lib/claude_swarm/cli.rb +10 -3
- data/lib/claude_swarm/commands/ps.rb +19 -20
- data/lib/claude_swarm/commands/show.rb +1 -1
- data/lib/claude_swarm/configuration.rb +10 -12
- data/lib/claude_swarm/mcp_generator.rb +10 -1
- data/lib/claude_swarm/orchestrator.rb +73 -49
- data/lib/claude_swarm/system_utils.rb +37 -11
- data/lib/claude_swarm/version.rb +1 -1
- data/lib/claude_swarm/worktree_manager.rb +1 -0
- data/lib/claude_swarm/yaml_loader.rb +22 -0
- data/lib/claude_swarm.rb +6 -2
- data/lib/swarm_cli/cli.rb +201 -0
- data/lib/swarm_cli/command_registry.rb +61 -0
- data/lib/swarm_cli/commands/mcp_serve.rb +130 -0
- data/lib/swarm_cli/commands/mcp_tools.rb +148 -0
- data/lib/swarm_cli/commands/migrate.rb +55 -0
- data/lib/swarm_cli/commands/run.rb +173 -0
- data/lib/swarm_cli/config_loader.rb +97 -0
- data/lib/swarm_cli/formatters/human_formatter.rb +711 -0
- data/lib/swarm_cli/formatters/json_formatter.rb +51 -0
- data/lib/swarm_cli/interactive_repl.rb +918 -0
- data/lib/swarm_cli/mcp_serve_options.rb +44 -0
- data/lib/swarm_cli/mcp_tools_options.rb +59 -0
- data/lib/swarm_cli/migrate_options.rb +54 -0
- data/lib/swarm_cli/migrator.rb +132 -0
- data/lib/swarm_cli/options.rb +151 -0
- data/lib/swarm_cli/ui/components/agent_badge.rb +33 -0
- data/lib/swarm_cli/ui/components/content_block.rb +120 -0
- data/lib/swarm_cli/ui/components/divider.rb +57 -0
- data/lib/swarm_cli/ui/components/panel.rb +62 -0
- data/lib/swarm_cli/ui/components/usage_stats.rb +70 -0
- data/lib/swarm_cli/ui/formatters/cost.rb +49 -0
- data/lib/swarm_cli/ui/formatters/number.rb +58 -0
- data/lib/swarm_cli/ui/formatters/text.rb +77 -0
- data/lib/swarm_cli/ui/formatters/time.rb +73 -0
- data/lib/swarm_cli/ui/icons.rb +59 -0
- data/lib/swarm_cli/ui/renderers/event_renderer.rb +188 -0
- data/lib/swarm_cli/ui/state/agent_color_cache.rb +45 -0
- data/lib/swarm_cli/ui/state/depth_tracker.rb +40 -0
- data/lib/swarm_cli/ui/state/spinner_manager.rb +170 -0
- data/lib/swarm_cli/ui/state/usage_tracker.rb +62 -0
- data/lib/swarm_cli/version.rb +5 -0
- data/lib/swarm_cli.rb +44 -0
- data/lib/swarm_memory/adapters/base.rb +141 -0
- data/lib/swarm_memory/adapters/filesystem_adapter.rb +845 -0
- data/lib/swarm_memory/chat_extension.rb +34 -0
- data/lib/swarm_memory/cli/commands.rb +306 -0
- data/lib/swarm_memory/core/entry.rb +37 -0
- data/lib/swarm_memory/core/frontmatter_parser.rb +108 -0
- data/lib/swarm_memory/core/metadata_extractor.rb +68 -0
- data/lib/swarm_memory/core/path_normalizer.rb +75 -0
- data/lib/swarm_memory/core/semantic_index.rb +244 -0
- data/lib/swarm_memory/core/storage.rb +288 -0
- data/lib/swarm_memory/core/storage_read_tracker.rb +63 -0
- data/lib/swarm_memory/dsl/builder_extension.rb +40 -0
- data/lib/swarm_memory/dsl/memory_config.rb +113 -0
- data/lib/swarm_memory/embeddings/embedder.rb +36 -0
- data/lib/swarm_memory/embeddings/informers_embedder.rb +152 -0
- data/lib/swarm_memory/errors.rb +21 -0
- data/lib/swarm_memory/integration/cli_registration.rb +30 -0
- data/lib/swarm_memory/integration/configuration.rb +43 -0
- data/lib/swarm_memory/integration/registration.rb +31 -0
- data/lib/swarm_memory/integration/sdk_plugin.rb +531 -0
- data/lib/swarm_memory/optimization/analyzer.rb +244 -0
- data/lib/swarm_memory/optimization/defragmenter.rb +863 -0
- data/lib/swarm_memory/prompts/memory.md.erb +109 -0
- data/lib/swarm_memory/prompts/memory_assistant.md.erb +181 -0
- data/lib/swarm_memory/prompts/memory_researcher.md.erb +281 -0
- data/lib/swarm_memory/prompts/memory_retrieval.md.erb +78 -0
- data/lib/swarm_memory/search/semantic_search.rb +112 -0
- data/lib/swarm_memory/search/text_search.rb +42 -0
- data/lib/swarm_memory/search/text_similarity.rb +80 -0
- data/lib/swarm_memory/skills/meta/deep-learning.md +101 -0
- data/lib/swarm_memory/skills/meta/deep-learning.yml +14 -0
- data/lib/swarm_memory/tools/load_skill.rb +313 -0
- data/lib/swarm_memory/tools/memory_defrag.rb +382 -0
- data/lib/swarm_memory/tools/memory_delete.rb +99 -0
- data/lib/swarm_memory/tools/memory_edit.rb +185 -0
- data/lib/swarm_memory/tools/memory_glob.rb +160 -0
- data/lib/swarm_memory/tools/memory_grep.rb +247 -0
- data/lib/swarm_memory/tools/memory_multi_edit.rb +281 -0
- data/lib/swarm_memory/tools/memory_read.rb +123 -0
- data/lib/swarm_memory/tools/memory_write.rb +231 -0
- data/lib/swarm_memory/utils.rb +50 -0
- data/lib/swarm_memory/version.rb +5 -0
- data/lib/swarm_memory.rb +166 -0
- data/lib/swarm_sdk/agent/RETRY_LOGIC.md +127 -0
- data/lib/swarm_sdk/agent/builder.rb +461 -0
- data/lib/swarm_sdk/agent/chat/context_tracker.rb +314 -0
- data/lib/swarm_sdk/agent/chat/hook_integration.rb +372 -0
- data/lib/swarm_sdk/agent/chat/logging_helpers.rb +116 -0
- data/lib/swarm_sdk/agent/chat/system_reminder_injector.rb +152 -0
- data/lib/swarm_sdk/agent/chat.rb +1159 -0
- data/lib/swarm_sdk/agent/context.rb +112 -0
- data/lib/swarm_sdk/agent/context_manager.rb +309 -0
- data/lib/swarm_sdk/agent/definition.rb +556 -0
- data/lib/swarm_sdk/claude_code_agent_adapter.rb +205 -0
- data/lib/swarm_sdk/configuration.rb +296 -0
- data/lib/swarm_sdk/context_compactor/metrics.rb +147 -0
- data/lib/swarm_sdk/context_compactor/token_counter.rb +106 -0
- data/lib/swarm_sdk/context_compactor.rb +340 -0
- data/lib/swarm_sdk/hooks/adapter.rb +359 -0
- data/lib/swarm_sdk/hooks/context.rb +197 -0
- data/lib/swarm_sdk/hooks/definition.rb +80 -0
- data/lib/swarm_sdk/hooks/error.rb +29 -0
- data/lib/swarm_sdk/hooks/executor.rb +146 -0
- data/lib/swarm_sdk/hooks/registry.rb +147 -0
- data/lib/swarm_sdk/hooks/result.rb +150 -0
- data/lib/swarm_sdk/hooks/shell_executor.rb +254 -0
- data/lib/swarm_sdk/hooks/tool_call.rb +35 -0
- data/lib/swarm_sdk/hooks/tool_result.rb +62 -0
- data/lib/swarm_sdk/log_collector.rb +51 -0
- data/lib/swarm_sdk/log_stream.rb +69 -0
- data/lib/swarm_sdk/markdown_parser.rb +75 -0
- data/lib/swarm_sdk/model_aliases.json +5 -0
- data/lib/swarm_sdk/models.json +1 -0
- data/lib/swarm_sdk/models.rb +120 -0
- data/lib/swarm_sdk/node/agent_config.rb +49 -0
- data/lib/swarm_sdk/node/builder.rb +439 -0
- data/lib/swarm_sdk/node/transformer_executor.rb +248 -0
- data/lib/swarm_sdk/node_context.rb +170 -0
- data/lib/swarm_sdk/node_orchestrator.rb +384 -0
- data/lib/swarm_sdk/permissions/config.rb +239 -0
- data/lib/swarm_sdk/permissions/error_formatter.rb +121 -0
- data/lib/swarm_sdk/permissions/path_matcher.rb +35 -0
- data/lib/swarm_sdk/permissions/validator.rb +173 -0
- data/lib/swarm_sdk/permissions_builder.rb +122 -0
- data/lib/swarm_sdk/plugin.rb +147 -0
- data/lib/swarm_sdk/plugin_registry.rb +101 -0
- data/lib/swarm_sdk/prompts/base_system_prompt.md.erb +243 -0
- data/lib/swarm_sdk/providers/openai_with_responses.rb +582 -0
- data/lib/swarm_sdk/result.rb +97 -0
- data/lib/swarm_sdk/swarm/agent_initializer.rb +334 -0
- data/lib/swarm_sdk/swarm/all_agents_builder.rb +140 -0
- data/lib/swarm_sdk/swarm/builder.rb +586 -0
- data/lib/swarm_sdk/swarm/mcp_configurator.rb +151 -0
- data/lib/swarm_sdk/swarm/tool_configurator.rb +419 -0
- data/lib/swarm_sdk/swarm.rb +982 -0
- data/lib/swarm_sdk/tools/bash.rb +274 -0
- data/lib/swarm_sdk/tools/clock.rb +44 -0
- data/lib/swarm_sdk/tools/delegate.rb +164 -0
- data/lib/swarm_sdk/tools/document_converters/base_converter.rb +83 -0
- data/lib/swarm_sdk/tools/document_converters/docx_converter.rb +99 -0
- data/lib/swarm_sdk/tools/document_converters/html_converter.rb +101 -0
- data/lib/swarm_sdk/tools/document_converters/pdf_converter.rb +78 -0
- data/lib/swarm_sdk/tools/document_converters/xlsx_converter.rb +194 -0
- data/lib/swarm_sdk/tools/edit.rb +150 -0
- data/lib/swarm_sdk/tools/glob.rb +158 -0
- data/lib/swarm_sdk/tools/grep.rb +228 -0
- data/lib/swarm_sdk/tools/image_extractors/docx_image_extractor.rb +43 -0
- data/lib/swarm_sdk/tools/image_extractors/pdf_image_extractor.rb +163 -0
- data/lib/swarm_sdk/tools/image_formats/tiff_builder.rb +65 -0
- data/lib/swarm_sdk/tools/multi_edit.rb +232 -0
- data/lib/swarm_sdk/tools/path_resolver.rb +43 -0
- data/lib/swarm_sdk/tools/read.rb +251 -0
- data/lib/swarm_sdk/tools/registry.rb +93 -0
- data/lib/swarm_sdk/tools/scratchpad/scratchpad_list.rb +96 -0
- data/lib/swarm_sdk/tools/scratchpad/scratchpad_read.rb +76 -0
- data/lib/swarm_sdk/tools/scratchpad/scratchpad_write.rb +91 -0
- data/lib/swarm_sdk/tools/stores/read_tracker.rb +61 -0
- data/lib/swarm_sdk/tools/stores/scratchpad_storage.rb +224 -0
- data/lib/swarm_sdk/tools/stores/storage.rb +148 -0
- data/lib/swarm_sdk/tools/stores/todo_manager.rb +65 -0
- data/lib/swarm_sdk/tools/think.rb +95 -0
- data/lib/swarm_sdk/tools/todo_write.rb +216 -0
- data/lib/swarm_sdk/tools/web_fetch.rb +261 -0
- data/lib/swarm_sdk/tools/write.rb +117 -0
- data/lib/swarm_sdk/utils.rb +50 -0
- data/lib/swarm_sdk/version.rb +5 -0
- data/lib/swarm_sdk.rb +157 -0
- data/llm.v2.txt +13407 -0
- data/rubocop/cop/security/no_reflection_methods.rb +47 -0
- data/rubocop/cop/security/no_ruby_llm_logger.rb +32 -0
- data/swarm_cli.gemspec +57 -0
- data/swarm_memory.gemspec +28 -0
- data/swarm_sdk.gemspec +41 -0
- data/team.yml +1 -1
- data/team_full.yml +1875 -0
- data/{team_v2.yml → team_sdk.yml} +121 -52
- metadata +247 -4
- data/EXAMPLES.md +0 -164
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to SwarmMemory will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.1.1]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **250-word content limit**: MemoryWrite now validates content length
|
|
12
|
+
- Enforces 250-word maximum per memory entry
|
|
13
|
+
- Encourages focused, searchable entries instead of large documents
|
|
14
|
+
- Helpful error message guides users to split large content into multiple linked memories
|
|
15
|
+
- Promotes better organization through multiple focused entries with `related` field links
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **Memory Assistant prompt improvements**: Updated examples and guidance
|
|
19
|
+
- Updated examples from 5000-word to 250-word entries
|
|
20
|
+
- Better illustrates recommended memory organization patterns
|
|
21
|
+
- Shows proper use of `related` field for linking split content
|
|
22
|
+
|
|
23
|
+
- **Memory Researcher prompt enhancements**: Comprehensive updates for better knowledge extraction
|
|
24
|
+
- Clarified "learning" workflow: gather information → store thoroughly in memory
|
|
25
|
+
- Added CRITICAL reminders about available memory tools (only Memory* tools, no "MemorySearch")
|
|
26
|
+
- Emphasized mandatory `type` parameter in all MemoryWrite calls
|
|
27
|
+
- Expanded guidance on when to create skills vs concepts/facts/experiences
|
|
28
|
+
- Reinforced thoroughness: capture ALL details, don't summarize away important information
|
|
29
|
+
- Better guidance on splitting large content into multiple focused, linked memories (each <250 words)
|
|
30
|
+
- Clarified LoadSkill vs MemoryRead: LoadSkill for DOING tasks, MemoryRead for explaining
|
|
31
|
+
- Enhanced research-specific workflows and extraction patterns
|
|
32
|
+
- Improved quality standards and verification guidelines
|
|
33
|
+
- Stronger emphasis on building a knowledge graph through comprehensive tagging and linking
|
|
34
|
+
|
|
35
|
+
## [2.1.0] - 2025-10-27
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- **BREAKING CHANGE: Hierarchical directory storage**
|
|
39
|
+
- Memory entries are now stored in actual directories instead of flattened paths with `--` separators
|
|
40
|
+
- **Before**: `concept--ruby--classes.md` (flattened with `--` separators)
|
|
41
|
+
- **After**: `concept/ruby/classes.md` (hierarchical directories)
|
|
42
|
+
- **Impact**: Existing memory storage will NOT be automatically migrated
|
|
43
|
+
- **Migration**: Clear existing memory or manually reorganize files into directory structure
|
|
44
|
+
- **Benefits**:
|
|
45
|
+
- Native Dir.glob works efficiently (no need to simulate directory semantics)
|
|
46
|
+
- Glob patterns like `fact/*` now correctly match only direct children, not nested paths
|
|
47
|
+
- Better filesystem semantics - paths behave like real directories
|
|
48
|
+
- Improved performance for glob operations
|
|
49
|
+
- More intuitive file browsing in file managers
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
- **Path parameter for MemoryGrep**: Limit grep searches to specific paths
|
|
53
|
+
- Example: `MemoryGrep(pattern: "TODO", path: "concept/")` searches only concepts
|
|
54
|
+
- Supports directory paths (`fact/api/`), subdirectories, and specific files
|
|
55
|
+
- Works with all output modes (files_with_matches, content, count)
|
|
56
|
+
- Directory-style filtering: `fact/api` matches `fact/api/...` but not `fact/api-design/...`
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
- **MemoryGlob path matching**: Fixed bug where single-level wildcards matched nested paths
|
|
60
|
+
- `fact/*` now correctly matches only `fact/api.md`, not `fact/people/john.md`
|
|
61
|
+
- `fact/**` correctly matches all nested entries recursively
|
|
62
|
+
- Glob semantics now match standard filesystem glob behavior
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
|
|
66
|
+
#### Core Architecture
|
|
67
|
+
|
|
68
|
+
- **Complete Filesystem Memory System** - Real files for agent memory
|
|
69
|
+
- 4 fixed categories: `concept/`, `fact/`, `skill/`, `experience/`
|
|
70
|
+
- Split storage: `.md` (content), `.yml` (metadata), `.emb` (embeddings)
|
|
71
|
+
- Flattened paths with `--` separator for Git-friendly structure
|
|
72
|
+
- Hit tracking in metadata for archival candidate detection
|
|
73
|
+
- Stubs and redirects for merged/moved entries (`# merged →`, `# moved →`)
|
|
74
|
+
|
|
75
|
+
- **Plugin System Integration** - SwarmMemory integrates with SwarmSDK via plugin architecture
|
|
76
|
+
- `SwarmMemory::Integration::SDKPlugin` implements `SwarmSDK::Plugin` interface
|
|
77
|
+
- Auto-registers with SwarmSDK when loaded via `require "swarm_memory"`
|
|
78
|
+
- Provides tools, storage, and system prompt contributions
|
|
79
|
+
- Zero coupling: SwarmSDK works standalone without SwarmMemory
|
|
80
|
+
- Lifecycle hooks: `on_agent_initialized`, `on_swarm_started`, `on_user_message`
|
|
81
|
+
|
|
82
|
+
- **Adapter Plugin Registry** - Pluggable storage backends
|
|
83
|
+
- `SwarmMemory::Adapters::Base.register_adapter()` for custom adapters
|
|
84
|
+
- Third-party gems can register custom storage implementations
|
|
85
|
+
- Adapter pattern decouples storage from interface
|
|
86
|
+
- Current implementation: `FilesystemAdapter` (real .md/.yml/.emb files)
|
|
87
|
+
|
|
88
|
+
#### Memory Modes System
|
|
89
|
+
|
|
90
|
+
- **Three Operational Modes** - Mode-specific prompts and tools
|
|
91
|
+
- **Retrieval Mode** - Read-only (MemoryRead, MemoryGlob, MemoryGrep)
|
|
92
|
+
- 88-line prompt focused on search strategies
|
|
93
|
+
- Q&A agents accessing knowledge without modification
|
|
94
|
+
- **Assistant Mode** - Read + Write + Edit + LoadSkill
|
|
95
|
+
- 139-line prompt with writing guidelines and quality standards
|
|
96
|
+
- Learning assistants that correct/update knowledge
|
|
97
|
+
- Dynamic tool adaptation via LoadSkill
|
|
98
|
+
- **Researcher Mode** - Full access (all 9 tools)
|
|
99
|
+
- 201-line prompt with optimization strategies
|
|
100
|
+
- Knowledge extraction, deep optimization, graph building
|
|
101
|
+
- Includes MemoryMultiEdit, MemoryDelete, MemoryDefrag
|
|
102
|
+
- Configure via `memory.mode` in agent config
|
|
103
|
+
|
|
104
|
+
#### Semantic Search
|
|
105
|
+
|
|
106
|
+
- **Hybrid Semantic Search** - Combined semantic + keyword matching
|
|
107
|
+
- **SemanticIndex** - Adapter-agnostic semantic search abstraction
|
|
108
|
+
- **Hybrid Scoring**: 50% semantic similarity + 50% keyword tag matching
|
|
109
|
+
- Improved recall accuracy from 43.8% → 78.8% for skill discovery
|
|
110
|
+
- Configurable weights via `SWARM_MEMORY_SEMANTIC_WEIGHT` / `SWARM_MEMORY_KEYWORD_WEIGHT`
|
|
111
|
+
- Pure semantic mode for relationship detection (no keyword pollution)
|
|
112
|
+
- Works with any storage adapter
|
|
113
|
+
|
|
114
|
+
- **Adaptive Discovery Thresholds** - Query-length based thresholds
|
|
115
|
+
- Short queries (< 10 words): Lower threshold (0.25 default) for broader matching
|
|
116
|
+
- Normal queries (≥ 10 words): Higher threshold (0.35 default) for precision
|
|
117
|
+
- Configurable via environment variables:
|
|
118
|
+
- `SWARM_MEMORY_DISCOVERY_THRESHOLD` (normal queries)
|
|
119
|
+
- `SWARM_MEMORY_DISCOVERY_THRESHOLD_SHORT` (short queries)
|
|
120
|
+
- `SWARM_MEMORY_ADAPTIVE_WORD_CUTOFF` (word count cutoff)
|
|
121
|
+
|
|
122
|
+
- **Improved Embeddings** - Optimized for search
|
|
123
|
+
- Embeds title (highest weight) + tags + domain + first paragraph
|
|
124
|
+
- Searchable text limit: 1200 chars (configurable via `SWARM_MEMORY_EMBEDDING_MAX_CHARS`)
|
|
125
|
+
- 384-dimensional vectors via Informers gem
|
|
126
|
+
- Model: sentence-transformers/multi-qa-MiniLM-L6-cos-v1 (~90MB ONNX)
|
|
127
|
+
- Cached locally in `~/.informers/`
|
|
128
|
+
- Binary packed `.emb` files for fast loading
|
|
129
|
+
|
|
130
|
+
#### Dual Discovery System
|
|
131
|
+
|
|
132
|
+
- **Automatic Skill Discovery** - Searches skills on every user message
|
|
133
|
+
- Hybrid semantic+keyword search for relevant skills
|
|
134
|
+
- System reminders with LoadSkill instructions
|
|
135
|
+
- Parallel execution with Async
|
|
136
|
+
- Top 3 results with match percentages
|
|
137
|
+
- Structured logging for observability
|
|
138
|
+
|
|
139
|
+
- **Automatic Memory Discovery** - Searches concepts/facts/experiences
|
|
140
|
+
- Hybrid semantic+keyword search for context
|
|
141
|
+
- System reminders with MemoryRead suggestions
|
|
142
|
+
- Runs in parallel with skill discovery
|
|
143
|
+
- Separate reminders for skills vs knowledge
|
|
144
|
+
|
|
145
|
+
#### Tools
|
|
146
|
+
|
|
147
|
+
- **9 Memory Tools** - Complete CRUD + optimization
|
|
148
|
+
- **MemoryWrite** - Store with 8 required metadata parameters
|
|
149
|
+
- **MemoryRead** - Retrieve with JSON output, tracks reads
|
|
150
|
+
- **MemoryEdit** - Exact string replacement (enforces read-before-edit)
|
|
151
|
+
- **MemoryMultiEdit** - Sequential edits (all-or-nothing atomic)
|
|
152
|
+
- **MemoryGlob** - Find by path pattern with sizes and titles
|
|
153
|
+
- **MemoryGrep** - Search content (3 modes: files, content, count)
|
|
154
|
+
- **MemoryDelete** - Remove entries with warnings
|
|
155
|
+
- **MemoryDefrag** - 10 comprehensive optimization actions
|
|
156
|
+
- **LoadSkill** - Dynamic tool swapping from skill entries
|
|
157
|
+
|
|
158
|
+
- **LoadSkill Tool** - Dynamic tool adaptation
|
|
159
|
+
- Removes mutable tools (Read, Write, Edit, Bash, etc.)
|
|
160
|
+
- Preserves immutable tools (Memory*, Think, Clock, LoadSkill, TodoWrite)
|
|
161
|
+
- Adds skill's tools from metadata
|
|
162
|
+
- Applies skill's permissions to new tools
|
|
163
|
+
- Returns skill content with system reminder of new toolset
|
|
164
|
+
- `ChatExtension` adds `remove_tool(name)` to `Agent::Chat`
|
|
165
|
+
|
|
166
|
+
- **MemoryDefrag Actions** - 10 comprehensive actions
|
|
167
|
+
- **Read-Only Analysis:**
|
|
168
|
+
- `analyze` - Health report (quality score 0-100)
|
|
169
|
+
- `find_duplicates` - Text + semantic similarity (threshold: 0.85)
|
|
170
|
+
- `find_low_quality` - Missing metadata, low confidence (quality < 50)
|
|
171
|
+
- `find_archival_candidates` - Old, unused entries (age_days: 90)
|
|
172
|
+
- `find_related` - Discover relationships (60-85% similarity range)
|
|
173
|
+
- **Active Optimization (with dry_run support):**
|
|
174
|
+
- `merge_duplicates` - Combine entries, create redirect stubs
|
|
175
|
+
- `cleanup_stubs` - Remove old redirect files
|
|
176
|
+
- `compact` - Delete low-value entries (quality < 20)
|
|
177
|
+
- `link_related` - Create bidirectional links
|
|
178
|
+
- `full` - Complete workflow with health tracking
|
|
179
|
+
|
|
180
|
+
- **Tool Description Enhancements** - Comprehensive, self-documenting
|
|
181
|
+
- All tools have detailed descriptions with examples
|
|
182
|
+
- Explicit "REQUIRED: Provide ALL X parameters" statements
|
|
183
|
+
- Path structure enforcement (4 fixed categories only)
|
|
184
|
+
- Usage examples, common mistakes, best practices
|
|
185
|
+
- Parameter details moved from prompts to tool descriptions
|
|
186
|
+
|
|
187
|
+
#### Data Integrity
|
|
188
|
+
|
|
189
|
+
- **Cross-Process File Locking** - Prevents corruption
|
|
190
|
+
- **Async::Semaphore** - Fiber-aware local concurrency control
|
|
191
|
+
- **File.flock** - Cross-process exclusive write locks
|
|
192
|
+
- Prevents corruption when defrag runs while agents write
|
|
193
|
+
- Lock acquisition/release logged for debugging
|
|
194
|
+
- Replaced Mutex with Async::Semaphore for fiber safety
|
|
195
|
+
|
|
196
|
+
- **Read-Before-Edit Enforcement** - Prevents blind overwrites
|
|
197
|
+
- **StorageReadTracker** - Global registry of read files
|
|
198
|
+
- MemoryEdit verifies MemoryRead was called first
|
|
199
|
+
- Prevents modifications without context
|
|
200
|
+
- Thread-safe with Mutex synchronization
|
|
201
|
+
- Helpful error messages with instructions
|
|
202
|
+
|
|
203
|
+
- **Stubs & Redirects** - Non-destructive merging
|
|
204
|
+
- Entries marked with `# merged →` or `# moved →` create auto-redirects
|
|
205
|
+
- Automatic follow-redirects in read operations
|
|
206
|
+
- Preserves old paths after merging/moving
|
|
207
|
+
- Cleanup via `MemoryDefrag(action: "cleanup_stubs")`
|
|
208
|
+
|
|
209
|
+
#### CLI Integration
|
|
210
|
+
|
|
211
|
+
- **CLI Command Registry** - Third-party command registration
|
|
212
|
+
- `SwarmCLI::CommandRegistry` for plugin commands
|
|
213
|
+
- SwarmMemory registers `memory` command automatically
|
|
214
|
+
- Seamless integration with swarm CLI
|
|
215
|
+
|
|
216
|
+
- **CLI Commands** - 5 memory management commands
|
|
217
|
+
- `swarm memory setup` - Download embedding model (~90MB, one-time)
|
|
218
|
+
- `swarm memory status` - Check if embeddings ready
|
|
219
|
+
- `swarm memory model-path` - Show cache location
|
|
220
|
+
- `swarm memory defrag DIRECTORY` - Optimize memory at directory
|
|
221
|
+
- `swarm memory rebuild DIRECTORY` - Regenerate all embeddings
|
|
222
|
+
- LLM retry logic (10 retries, 10-second delays)
|
|
223
|
+
- Batch processing for efficiency
|
|
224
|
+
|
|
225
|
+
- **REPL Command** - Interactive defragmentation
|
|
226
|
+
- `/defrag` - Discovers relationships and creates links
|
|
227
|
+
- Automatic workflow: find_related → agent reviews → link_related
|
|
228
|
+
|
|
229
|
+
#### Skills System
|
|
230
|
+
|
|
231
|
+
- **Virtual Meta-Skills** - Built-in skills
|
|
232
|
+
- Packaged with SwarmMemory gem (e.g., `skill/meta/deep-learning.md`)
|
|
233
|
+
- No user storage cost
|
|
234
|
+
- Act as templates and examples
|
|
235
|
+
- Virtual entries in adapter (no disk files)
|
|
236
|
+
|
|
237
|
+
- **Skill Metadata Structure** - Complete skill definition
|
|
238
|
+
- `type: skill` - Required for LoadSkill
|
|
239
|
+
- `tools: [...]` - Required tools array
|
|
240
|
+
- `permissions: {...}` - Tool-specific permissions
|
|
241
|
+
- Standard memory metadata (tags, confidence, domain, etc.)
|
|
242
|
+
|
|
243
|
+
#### Search & Analysis
|
|
244
|
+
|
|
245
|
+
- **Relationship Discovery** - Automatic knowledge graph building
|
|
246
|
+
- `find_related` - Discover entries with 60-85% semantic similarity
|
|
247
|
+
- `link_related` - Create bidirectional links automatically
|
|
248
|
+
- Pure semantic similarity (no keyword boost) for relationships
|
|
249
|
+
- Skips already-linked pairs
|
|
250
|
+
- Dry-run mode for preview
|
|
251
|
+
|
|
252
|
+
- **Quality Scoring** - Metadata completeness assessment
|
|
253
|
+
- Type present: +20
|
|
254
|
+
- Confidence set: +20
|
|
255
|
+
- Tags present: +15
|
|
256
|
+
- Related links: +15
|
|
257
|
+
- Domain set: +10
|
|
258
|
+
- Last verified: +10
|
|
259
|
+
- High confidence bonus: +10
|
|
260
|
+
- Max score: 100
|
|
261
|
+
|
|
262
|
+
- **Text Similarity Utilities**
|
|
263
|
+
- Jaccard similarity for keyword overlap
|
|
264
|
+
- Cosine similarity for embedding distance
|
|
265
|
+
- Used in duplicate/relationship detection
|
|
266
|
+
|
|
267
|
+
#### Configuration
|
|
268
|
+
|
|
269
|
+
- **DSL Integration** - Ruby DSL support
|
|
270
|
+
- `memory { mode :researcher; directory ".swarm/memory" }` syntax
|
|
271
|
+
- `SwarmMemory::DSL::BuilderExtension` for Agent::Builder
|
|
272
|
+
- `SwarmMemory::DSL::MemoryConfig` for configuration parsing
|
|
273
|
+
|
|
274
|
+
- **YAML Configuration** - Declarative config
|
|
275
|
+
- `memory.mode` - retrieval | assistant | researcher
|
|
276
|
+
- `memory.directory` - Storage location
|
|
277
|
+
- `memory.adapter` - Storage backend (default: filesystem)
|
|
278
|
+
- Parsed via `SwarmMemory::Integration::Configuration`
|
|
279
|
+
|
|
280
|
+
#### Observability
|
|
281
|
+
|
|
282
|
+
- **Logging & Events** - Structured logging
|
|
283
|
+
- `semantic_skill_search` - Logs skill discovery results
|
|
284
|
+
- `semantic_memory_search` - Logs memory discovery results
|
|
285
|
+
- `memory_embedding_generated` - Logs searchable text
|
|
286
|
+
- Shows hybrid scores (semantic + keyword breakdown)
|
|
287
|
+
- Includes debug info (top results, tags, similarity scores)
|
|
288
|
+
|
|
289
|
+
### Changed
|
|
290
|
+
|
|
291
|
+
- **Storage Architecture** - Embeddings enabled by default
|
|
292
|
+
- `Storage.new(adapter:, embedder:)` with InformersEmbedder
|
|
293
|
+
- Exposes `storage.semantic_index` for semantic search
|
|
294
|
+
- `build_searchable_text()` creates optimized embedding input
|
|
295
|
+
- `extract_first_paragraph()` for content summarization
|
|
296
|
+
|
|
297
|
+
- **FilesystemAdapter** - Enhanced with semantic search
|
|
298
|
+
- `semantic_search(embedding:, top_k:, threshold:)` method
|
|
299
|
+
- `cosine_similarity()` calculation
|
|
300
|
+
- Returns results with similarity scores and metadata
|
|
301
|
+
- Uses in-memory embedding index for fast lookups
|
|
302
|
+
- File locking for cross-process safety
|
|
303
|
+
|
|
304
|
+
- **Tool Parameter Handling** - Flexible input formats
|
|
305
|
+
- MemoryWrite accepts both JSON strings (from LLMs) and Ruby arrays/hashes (from tests)
|
|
306
|
+
- `parse_array_param()` and `parse_object_param()` helpers
|
|
307
|
+
- Backward compatible with test suite
|
|
308
|
+
|
|
309
|
+
- **Memory Categories Enforcement** - Strict validation
|
|
310
|
+
- All tools enforce 4 fixed categories in descriptions
|
|
311
|
+
- All examples use only valid paths
|
|
312
|
+
- INVALID examples listed to prevent creation
|
|
313
|
+
- Path validation in parameter descriptions
|
|
314
|
+
|
|
315
|
+
- **Memory Prompts** - Mode-specific optimization
|
|
316
|
+
- Base prompt: 845 → 88 lines (90% reduction)
|
|
317
|
+
- Retrieval: 88 lines (search strategies)
|
|
318
|
+
- Assistant: 139 lines (writing guidelines)
|
|
319
|
+
- Researcher: 201 lines (optimization strategies)
|
|
320
|
+
- Details moved to tool descriptions
|
|
321
|
+
- Memory-first protocol prominently placed
|
|
322
|
+
|
|
323
|
+
### Removed
|
|
324
|
+
|
|
325
|
+
- **Old Registration System** - Replaced by plugin
|
|
326
|
+
- `Tools::Registry.register_extension()` calls removed
|
|
327
|
+
- Now uses `SwarmSDK::PluginRegistry.register()`
|
|
328
|
+
|
|
329
|
+
### Breaking Changes
|
|
330
|
+
|
|
331
|
+
⚠️ **Major breaking changes:**
|
|
332
|
+
|
|
333
|
+
1. **Plugin-based integration required**
|
|
334
|
+
- SwarmMemory MUST be loaded after SwarmSDK
|
|
335
|
+
- Auto-registration happens on require
|
|
336
|
+
- No manual registration needed
|
|
337
|
+
|
|
338
|
+
2. **Embeddings enabled by default**
|
|
339
|
+
- Storage now creates embeddings for all entries
|
|
340
|
+
- Requires Informers gem for semantic search
|
|
341
|
+
- `.emb` files created alongside `.md` and `.yml` files
|
|
342
|
+
- Run `swarm memory setup` to download model (~90MB)
|
|
343
|
+
|
|
344
|
+
3. **Memory prompt location changed**
|
|
345
|
+
- **Was**: Hardcoded path in SwarmSDK
|
|
346
|
+
- **Now**: Plugin provides prompt via `system_prompt_contribution()`
|
|
347
|
+
|
|
348
|
+
4. **Memory modes required**
|
|
349
|
+
- Must specify mode: retrieval | assistant | researcher
|
|
350
|
+
- Different tools available per mode
|
|
351
|
+
- Mode-specific prompts loaded dynamically
|
|
352
|
+
|
|
353
|
+
5. **MemoryWrite requires 8 parameters**
|
|
354
|
+
- All parameters mandatory (no defaults)
|
|
355
|
+
- file_path, content, title, type, confidence, tags, related, domain
|
|
356
|
+
- Enforces metadata discipline
|
|
357
|
+
|
|
358
|
+
6. **MemoryEdit requires read-before-edit**
|
|
359
|
+
- Must call MemoryRead before MemoryEdit
|
|
360
|
+
- Tracked globally via StorageReadTracker
|
|
361
|
+
- Error if attempting to edit unread file
|
|
362
|
+
|
|
363
|
+
## [2.0.0] - 2025-10-26
|
|
364
|
+
|
|
365
|
+
Initial release of SwarmMemory as separate gem.
|
|
366
|
+
|
|
367
|
+
Complete persistent memory system with:
|
|
368
|
+
- 4 fixed categories (concept, fact, skill, experience)
|
|
369
|
+
- 9 memory tools (Write, Read, Edit, MultiEdit, Delete, Glob, Grep, Defrag, LoadSkill)
|
|
370
|
+
- Hybrid semantic search (50% semantic + 50% keyword)
|
|
371
|
+
- 3 memory modes (retrieval, assistant, researcher)
|
|
372
|
+
- Cross-process file locking
|
|
373
|
+
- Automatic skill/memory discovery
|
|
374
|
+
- CLI commands for setup and management
|
|
375
|
+
- Plugin architecture for SwarmSDK integration
|
|
376
|
+
- Virtual meta-skills
|
|
377
|
+
- Relationship discovery and knowledge graph building
|
|
378
|
+
|
|
379
|
+
See SwarmSDK CHANGELOG for prior memory system history (was part of SwarmSDK v1).
|