claude_swarm 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +27 -0
- data/README.md +336 -1037
- data/docs/V1_TO_V2_MIGRATION_GUIDE.md +1120 -0
- data/docs/v1/README.md +1197 -0
- data/docs/v2/CHANGELOG.swarm_cli.md +22 -0
- data/docs/v2/CHANGELOG.swarm_memory.md +20 -0
- data/docs/v2/CHANGELOG.swarm_sdk.md +287 -10
- data/docs/v2/README.md +32 -6
- data/docs/v2/guides/complete-tutorial.md +133 -37
- data/docs/v2/guides/composable-swarms.md +1178 -0
- data/docs/v2/guides/getting-started.md +42 -1
- data/docs/v2/guides/snapshots.md +1498 -0
- data/docs/v2/reference/architecture-flow.md +5 -3
- data/docs/v2/reference/event_payload_structures.md +249 -12
- data/docs/v2/reference/execution-flow.md +1 -1
- data/docs/v2/reference/ruby-dsl.md +368 -22
- data/docs/v2/reference/yaml.md +314 -63
- data/examples/snapshot_demo.rb +119 -0
- data/examples/v2/dsl/01_basic.rb +0 -2
- data/examples/v2/dsl/02_core_parameters.rb +0 -2
- data/examples/v2/dsl/03_capabilities.rb +0 -2
- data/examples/v2/dsl/04_llm_parameters.rb +0 -2
- data/examples/v2/dsl/05_advanced_flags.rb +0 -3
- data/examples/v2/dsl/06_permissions.rb +0 -4
- data/examples/v2/dsl/07_mcp_server.rb +0 -2
- data/examples/v2/dsl/08_swarm_hooks.rb +0 -2
- data/examples/v2/dsl/09_agent_hooks.rb +0 -2
- data/examples/v2/dsl/10_all_agents_hooks.rb +0 -3
- data/examples/v2/dsl/11_delegation.rb +0 -2
- data/examples/v2/dsl/12_complete_integration.rb +2 -6
- data/examples/v2/node_context_demo.rb +1 -1
- data/examples/v2/node_workflow.rb +2 -4
- data/examples/v2/plan_and_execute.rb +157 -0
- data/lib/claude_swarm/cli.rb +0 -18
- data/lib/claude_swarm/configuration.rb +28 -18
- data/lib/claude_swarm/openai/chat_completion.rb +2 -11
- data/lib/claude_swarm/openai/responses.rb +2 -11
- data/lib/claude_swarm/version.rb +1 -1
- data/lib/swarm_cli/formatters/human_formatter.rb +103 -0
- data/lib/swarm_cli/interactive_repl.rb +9 -3
- data/lib/swarm_cli/version.rb +1 -1
- data/lib/swarm_memory/core/storage_read_tracker.rb +51 -14
- data/lib/swarm_memory/integration/cli_registration.rb +3 -2
- data/lib/swarm_memory/integration/sdk_plugin.rb +11 -5
- data/lib/swarm_memory/tools/memory_edit.rb +2 -2
- data/lib/swarm_memory/tools/memory_multi_edit.rb +2 -2
- data/lib/swarm_memory/tools/memory_read.rb +3 -3
- data/lib/swarm_memory/version.rb +1 -1
- data/lib/swarm_memory.rb +5 -0
- data/lib/swarm_sdk/agent/builder.rb +33 -0
- data/lib/swarm_sdk/agent/chat/context_tracker.rb +33 -0
- data/lib/swarm_sdk/agent/chat/hook_integration.rb +49 -3
- data/lib/swarm_sdk/agent/chat/system_reminder_injector.rb +11 -27
- data/lib/swarm_sdk/agent/chat.rb +200 -51
- data/lib/swarm_sdk/agent/context.rb +6 -2
- data/lib/swarm_sdk/agent/context_manager.rb +6 -0
- data/lib/swarm_sdk/agent/definition.rb +14 -2
- data/lib/swarm_sdk/agent/llm_instrumentation_middleware.rb +180 -0
- data/lib/swarm_sdk/configuration.rb +387 -94
- data/lib/swarm_sdk/events_to_messages.rb +181 -0
- data/lib/swarm_sdk/log_collector.rb +31 -5
- data/lib/swarm_sdk/log_stream.rb +37 -8
- data/lib/swarm_sdk/model_aliases.json +4 -1
- data/lib/swarm_sdk/node/agent_config.rb +33 -8
- data/lib/swarm_sdk/node/builder.rb +39 -18
- data/lib/swarm_sdk/node_orchestrator.rb +293 -26
- data/lib/swarm_sdk/proc_helpers.rb +53 -0
- data/lib/swarm_sdk/providers/openai_with_responses.rb +22 -15
- data/lib/swarm_sdk/restore_result.rb +65 -0
- data/lib/swarm_sdk/snapshot.rb +156 -0
- data/lib/swarm_sdk/snapshot_from_events.rb +386 -0
- data/lib/swarm_sdk/state_restorer.rb +491 -0
- data/lib/swarm_sdk/state_snapshot.rb +369 -0
- data/lib/swarm_sdk/swarm/agent_initializer.rb +360 -55
- data/lib/swarm_sdk/swarm/all_agents_builder.rb +28 -1
- data/lib/swarm_sdk/swarm/builder.rb +208 -12
- data/lib/swarm_sdk/swarm/swarm_registry_builder.rb +67 -0
- data/lib/swarm_sdk/swarm/tool_configurator.rb +46 -11
- data/lib/swarm_sdk/swarm.rb +338 -42
- data/lib/swarm_sdk/swarm_loader.rb +145 -0
- data/lib/swarm_sdk/swarm_registry.rb +136 -0
- data/lib/swarm_sdk/tools/delegate.rb +92 -7
- data/lib/swarm_sdk/tools/read.rb +17 -5
- data/lib/swarm_sdk/tools/stores/read_tracker.rb +47 -12
- data/lib/swarm_sdk/tools/stores/scratchpad_storage.rb +45 -0
- data/lib/swarm_sdk/utils.rb +18 -0
- data/lib/swarm_sdk/validation_result.rb +33 -0
- data/lib/swarm_sdk/version.rb +1 -1
- data/lib/swarm_sdk.rb +40 -8
- data/swarm_cli.gemspec +1 -1
- data/swarm_memory.gemspec +2 -2
- data/swarm_sdk.gemspec +2 -2
- metadata +21 -13
- data/examples/learning-assistant/assistant.md +0 -7
- data/examples/learning-assistant/example-memories/concept-example.md +0 -90
- data/examples/learning-assistant/example-memories/experience-example.md +0 -66
- data/examples/learning-assistant/example-memories/fact-example.md +0 -76
- data/examples/learning-assistant/example-memories/memory-index.md +0 -78
- data/examples/learning-assistant/example-memories/skill-example.md +0 -168
- data/examples/learning-assistant/learning_assistant.rb +0 -34
- data/examples/learning-assistant/learning_assistant.yml +0 -20
- data/lib/swarm_sdk/mcp.rb +0 -16
- data/llm.v2.txt +0 -13407
- /data/docs/v2/guides/{MEMORY_DEFRAG_GUIDE.md → memory-defrag-guide.md} +0 -0
- /data/{llms.txt → llms.claude-swarm.txt} +0 -0
|
@@ -1,168 +0,0 @@
|
|
|
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
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
data/lib/swarm_sdk/mcp.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module SwarmSDK
|
|
4
|
-
module MCP
|
|
5
|
-
class << self
|
|
6
|
-
# Lazy load ruby_llm-mcp only when MCP servers are used
|
|
7
|
-
def lazy_load
|
|
8
|
-
return if @loaded
|
|
9
|
-
|
|
10
|
-
require "ruby_llm/mcp"
|
|
11
|
-
|
|
12
|
-
@loaded = true
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|