robot_lab 0.3.0 → 0.3.1

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 (256) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +1 -1
  4. data/lib/robot_lab/mcp/transports/streamable_http.rb +1 -1
  5. data/lib/robot_lab/version.rb +1 -1
  6. metadata +3 -253
  7. data/.architecture/AGENTS.md +0 -32
  8. data/.architecture/config.yml +0 -8
  9. data/.architecture/members.yml +0 -60
  10. data/.architecture/reviews/feature-free-will.md +0 -490
  11. data/.architecture/reviews/overall-codebase.md +0 -427
  12. data/.claude/settings.local.json +0 -57
  13. data/.codex/config.toml +0 -2
  14. data/.envrc +0 -6
  15. data/.github/workflows/deploy-github-pages.yml +0 -52
  16. data/.irbrc +0 -6
  17. data/.loki +0 -65
  18. data/.quality/reek_baseline.txt +0 -43
  19. data/.rubocop.yml +0 -10
  20. data/Archspec.rb +0 -44
  21. data/CLAUDE.md +0 -141
  22. data/COMMITS.md +0 -196
  23. data/Rakefile +0 -193
  24. data/_typos.toml +0 -21
  25. data/agent2agent_review.md +0 -192
  26. data/agentf_improvements.md +0 -253
  27. data/agents.md +0 -14
  28. data/docs/api/core/index.md +0 -147
  29. data/docs/api/core/memory.md +0 -578
  30. data/docs/api/core/network.md +0 -553
  31. data/docs/api/core/result.md +0 -211
  32. data/docs/api/core/robot.md +0 -1667
  33. data/docs/api/core/state.md +0 -145
  34. data/docs/api/core/tool.md +0 -520
  35. data/docs/api/errors.md +0 -323
  36. data/docs/api/hooks.md +0 -469
  37. data/docs/api/index.md +0 -137
  38. data/docs/api/mcp/client.md +0 -387
  39. data/docs/api/mcp/index.md +0 -267
  40. data/docs/api/mcp/server.md +0 -252
  41. data/docs/api/mcp/transports.md +0 -339
  42. data/docs/api/messages/index.md +0 -126
  43. data/docs/api/messages/text-message.md +0 -170
  44. data/docs/api/messages/tool-call-message.md +0 -206
  45. data/docs/api/messages/tool-result-message.md +0 -242
  46. data/docs/api/messages/user-message.md +0 -232
  47. data/docs/api/skills.md +0 -423
  48. data/docs/api/streaming/context.md +0 -280
  49. data/docs/api/streaming/events.md +0 -185
  50. data/docs/api/streaming/index.md +0 -156
  51. data/docs/api/support.md +0 -846
  52. data/docs/architecture/core-concepts.md +0 -575
  53. data/docs/architecture/index.md +0 -252
  54. data/docs/architecture/message-flow.md +0 -366
  55. data/docs/architecture/network-orchestration.md +0 -478
  56. data/docs/architecture/robot-execution.md +0 -396
  57. data/docs/architecture/state-management.md +0 -410
  58. data/docs/assets/css/custom.css +0 -56
  59. data/docs/assets/images/robot_lab.jpg +0 -0
  60. data/docs/concepts.md +0 -641
  61. data/docs/examples/basic-chat.md +0 -258
  62. data/docs/examples/index.md +0 -425
  63. data/docs/examples/mcp-server.md +0 -403
  64. data/docs/examples/multi-robot-network.md +0 -476
  65. data/docs/examples/tool-usage.md +0 -468
  66. data/docs/getting-started/configuration.md +0 -645
  67. data/docs/getting-started/index.md +0 -56
  68. data/docs/getting-started/installation.md +0 -197
  69. data/docs/getting-started/quick-start.md +0 -293
  70. data/docs/guides/building-robots.md +0 -1187
  71. data/docs/guides/creating-networks.md +0 -736
  72. data/docs/guides/hooks.md +0 -1206
  73. data/docs/guides/index.md +0 -78
  74. data/docs/guides/knowledge.md +0 -219
  75. data/docs/guides/mcp-integration.md +0 -740
  76. data/docs/guides/memory.md +0 -458
  77. data/docs/guides/observability.md +0 -733
  78. data/docs/guides/streaming.md +0 -323
  79. data/docs/guides/using-tools.md +0 -780
  80. data/docs/index.md +0 -280
  81. data/docs/superpowers/plans/2026-05-06-agentskills.md +0 -1303
  82. data/docs/superpowers/specs/2026-05-06-agentskills-design.md +0 -247
  83. data/examples/.envrc +0 -3
  84. data/examples/01_simple_robot.rb +0 -31
  85. data/examples/02_tools.rb +0 -109
  86. data/examples/03_network.rb +0 -118
  87. data/examples/04_mcp.rb +0 -217
  88. data/examples/05_streaming.rb +0 -137
  89. data/examples/06_prompt_templates.rb +0 -325
  90. data/examples/07_network_memory.rb +0 -313
  91. data/examples/08_llm_config.rb +0 -162
  92. data/examples/09_chaining.rb +0 -251
  93. data/examples/10_memory.rb +0 -315
  94. data/examples/11_network_introspection.rb +0 -239
  95. data/examples/12_message_bus.rb +0 -67
  96. data/examples/13_spawn.rb +0 -85
  97. data/examples/14_rusty_circuit/.envrc +0 -1
  98. data/examples/14_rusty_circuit/.gitignore +0 -1
  99. data/examples/14_rusty_circuit/README.md +0 -1
  100. data/examples/14_rusty_circuit/comic.rb +0 -149
  101. data/examples/14_rusty_circuit/display.rb +0 -217
  102. data/examples/14_rusty_circuit/heckler.rb +0 -65
  103. data/examples/14_rusty_circuit/open_mic.rb +0 -132
  104. data/examples/14_rusty_circuit/prompts/open_mic_comic.md +0 -20
  105. data/examples/14_rusty_circuit/prompts/open_mic_heckler.md +0 -23
  106. data/examples/14_rusty_circuit/prompts/open_mic_scout.md +0 -20
  107. data/examples/14_rusty_circuit/scout.rb +0 -165
  108. data/examples/14_rusty_circuit/show.log +0 -234
  109. data/examples/15_memory_network_and_bus/.envrc +0 -1
  110. data/examples/15_memory_network_and_bus/README.md +0 -66
  111. data/examples/15_memory_network_and_bus/editor_in_chief.rb +0 -24
  112. data/examples/15_memory_network_and_bus/editorial_pipeline.rb +0 -213
  113. data/examples/15_memory_network_and_bus/linux_writer.rb +0 -80
  114. data/examples/15_memory_network_and_bus/os_editor.rb +0 -48
  115. data/examples/15_memory_network_and_bus/os_writer.rb +0 -49
  116. data/examples/15_memory_network_and_bus/output/combined_article.md +0 -11
  117. data/examples/15_memory_network_and_bus/output/final_article.md +0 -8
  118. data/examples/15_memory_network_and_bus/output/linux_draft.md +0 -7
  119. data/examples/15_memory_network_and_bus/output/mac_draft.md +0 -7
  120. data/examples/15_memory_network_and_bus/output/memory.json +0 -13
  121. data/examples/15_memory_network_and_bus/output/revision_1.md +0 -29
  122. data/examples/15_memory_network_and_bus/output/revision_2.md +0 -50
  123. data/examples/15_memory_network_and_bus/output/revision_3.md +0 -8
  124. data/examples/15_memory_network_and_bus/output/windows_draft.md +0 -7
  125. data/examples/15_memory_network_and_bus/prompts/os_advocate.md +0 -13
  126. data/examples/15_memory_network_and_bus/prompts/os_chief.md +0 -13
  127. data/examples/15_memory_network_and_bus/prompts/os_editor.md +0 -13
  128. data/examples/16_writers_room/.envrc +0 -1
  129. data/examples/16_writers_room/display.rb +0 -158
  130. data/examples/16_writers_room/output/.gitignore +0 -4
  131. data/examples/16_writers_room/output/README.md +0 -69
  132. data/examples/16_writers_room/output/opus_001.md +0 -263
  133. data/examples/16_writers_room/output/opus_001_notes.log +0 -470
  134. data/examples/16_writers_room/output/opus_002.md +0 -245
  135. data/examples/16_writers_room/output/opus_002_notes.log +0 -546
  136. data/examples/16_writers_room/output/opus_002_screenplay.md +0 -7989
  137. data/examples/16_writers_room/output/opus_002_screenplay_notes.md +0 -993
  138. data/examples/16_writers_room/prompts/screenplay_writer.md +0 -66
  139. data/examples/16_writers_room/prompts/writer.md +0 -37
  140. data/examples/16_writers_room/room.rb +0 -186
  141. data/examples/16_writers_room/tools.rb +0 -173
  142. data/examples/16_writers_room/writer.rb +0 -121
  143. data/examples/16_writers_room/writers_room.rb +0 -256
  144. data/examples/17_skills.rb +0 -234
  145. data/examples/18_rails/.envrc +0 -3
  146. data/examples/18_rails/.gitignore +0 -5
  147. data/examples/18_rails/Gemfile +0 -11
  148. data/examples/18_rails/README.md +0 -67
  149. data/examples/18_rails/Rakefile +0 -4
  150. data/examples/18_rails/app/controllers/application_controller.rb +0 -4
  151. data/examples/18_rails/app/controllers/chat_controller.rb +0 -50
  152. data/examples/18_rails/app/jobs/application_job.rb +0 -4
  153. data/examples/18_rails/app/jobs/robot_run_job.rb +0 -25
  154. data/examples/18_rails/app/models/application_record.rb +0 -5
  155. data/examples/18_rails/app/models/robot_lab_result.rb +0 -36
  156. data/examples/18_rails/app/models/robot_lab_thread.rb +0 -23
  157. data/examples/18_rails/app/robots/chat_robot.rb +0 -25
  158. data/examples/18_rails/app/tools/time_tool.rb +0 -9
  159. data/examples/18_rails/app/views/chat/_user_message.html.erb +0 -1
  160. data/examples/18_rails/app/views/chat/index.html.erb +0 -67
  161. data/examples/18_rails/app/views/layouts/application.html.erb +0 -49
  162. data/examples/18_rails/bin/dev +0 -7
  163. data/examples/18_rails/bin/rails +0 -6
  164. data/examples/18_rails/bin/setup +0 -15
  165. data/examples/18_rails/config/application.rb +0 -33
  166. data/examples/18_rails/config/cable.yml +0 -2
  167. data/examples/18_rails/config/database.yml +0 -5
  168. data/examples/18_rails/config/environment.rb +0 -4
  169. data/examples/18_rails/config/initializers/robot_lab.rb +0 -11
  170. data/examples/18_rails/config/routes.rb +0 -6
  171. data/examples/18_rails/config.ru +0 -4
  172. data/examples/18_rails/db/migrate/001_create_robot_lab_tables.rb +0 -32
  173. data/examples/19_token_tracking.rb +0 -138
  174. data/examples/20_circuit_breaker.rb +0 -147
  175. data/examples/21_learning_loop.rb +0 -181
  176. data/examples/22_context_compression.rb +0 -172
  177. data/examples/23_convergence.rb +0 -133
  178. data/examples/24_structured_delegation.rb +0 -151
  179. data/examples/25_history_search/conversation.jsonl +0 -30
  180. data/examples/25_history_search.rb +0 -133
  181. data/examples/26_document_store/api_versioning_adr.md +0 -52
  182. data/examples/26_document_store/incident_postmortem.md +0 -46
  183. data/examples/26_document_store/postgres_runbook.md +0 -49
  184. data/examples/26_document_store/redis_caching_guide.md +0 -48
  185. data/examples/26_document_store/sidekiq_guide.md +0 -51
  186. data/examples/26_document_store.rb +0 -140
  187. data/examples/27_incident_response/README.md +0 -65
  188. data/examples/27_incident_response/incident_response.rb +0 -261
  189. data/examples/28_mcp_discovery.rb +0 -113
  190. data/examples/29_ractor_tools.rb +0 -240
  191. data/examples/30_ractor_network.rb +0 -252
  192. data/examples/31_launch_assessment.rb +0 -246
  193. data/examples/32_newsletter_reader.rb +0 -193
  194. data/examples/33_stock_generator.rb +0 -80
  195. data/examples/33_stock_predictor.rb +0 -327
  196. data/examples/34_agentskills.rb +0 -76
  197. data/examples/35_hooks.rb +0 -266
  198. data/examples/README.md +0 -550
  199. data/examples/common.rb +0 -180
  200. data/examples/prompts/assistant.md +0 -5
  201. data/examples/prompts/audit_trail.md +0 -8
  202. data/examples/prompts/billing.md +0 -10
  203. data/examples/prompts/classifier.md +0 -7
  204. data/examples/prompts/comedian.md +0 -6
  205. data/examples/prompts/comedy_critic.md +0 -10
  206. data/examples/prompts/configurable.md +0 -9
  207. data/examples/prompts/dispatcher.md +0 -12
  208. data/examples/prompts/entity_extractor.md +0 -14
  209. data/examples/prompts/escalation.md +0 -42
  210. data/examples/prompts/frontmatter_mcp_test.md +0 -9
  211. data/examples/prompts/frontmatter_named_test.md +0 -5
  212. data/examples/prompts/frontmatter_tools_test.md +0 -6
  213. data/examples/prompts/general.md +0 -7
  214. data/examples/prompts/github_assistant.md +0 -14
  215. data/examples/prompts/helper.md +0 -4
  216. data/examples/prompts/incident_responder.md +0 -18
  217. data/examples/prompts/keyword_extractor.md +0 -11
  218. data/examples/prompts/llm_config_demo.md +0 -20
  219. data/examples/prompts/order_support.md +0 -35
  220. data/examples/prompts/os_advocate.md +0 -13
  221. data/examples/prompts/os_chief.md +0 -13
  222. data/examples/prompts/os_editor.md +0 -13
  223. data/examples/prompts/parameterized_main_test.md +0 -6
  224. data/examples/prompts/pii_redactor.md +0 -7
  225. data/examples/prompts/product_support.md +0 -37
  226. data/examples/prompts/runbook_protocol.md +0 -12
  227. data/examples/prompts/sentiment_analyzer.md +0 -12
  228. data/examples/prompts/skill_a_test.md +0 -4
  229. data/examples/prompts/skill_b_test.md +0 -4
  230. data/examples/prompts/skill_config_test.md +0 -5
  231. data/examples/prompts/skill_cycle_a_test.md +0 -6
  232. data/examples/prompts/skill_cycle_b_test.md +0 -6
  233. data/examples/prompts/skill_description_test.md +0 -4
  234. data/examples/prompts/skill_leaf_test.md +0 -4
  235. data/examples/prompts/skill_nested_test.md +0 -6
  236. data/examples/prompts/skill_refs_main_test.md +0 -6
  237. data/examples/prompts/skill_self_ref_test.md +0 -6
  238. data/examples/prompts/skill_with_mcp_test.md +0 -9
  239. data/examples/prompts/skill_with_params_test.md +0 -6
  240. data/examples/prompts/skill_with_robot_name_test.md +0 -5
  241. data/examples/prompts/skill_with_tools_test.md +0 -6
  242. data/examples/prompts/sre_compliance.md +0 -10
  243. data/examples/prompts/structured_output.md +0 -7
  244. data/examples/prompts/synthesizer.md +0 -17
  245. data/examples/prompts/technical.md +0 -10
  246. data/examples/prompts/template_with_skills_test.md +0 -6
  247. data/examples/prompts/triage.md +0 -22
  248. data/examples/ruboruby.md +0 -423
  249. data/examples/run_all.rb +0 -60
  250. data/examples/xyzzy.rb +0 -97
  251. data/logfile +0 -8
  252. data/mkdocs.yml +0 -209
  253. data/robot_concurrency.md +0 -38
  254. data/simple_acp_review.md +0 -298
  255. data/temp.md +0 -6
  256. data/tool_manifest_plan.md +0 -155
data/.rubocop.yml DELETED
@@ -1,10 +0,0 @@
1
- inherit_from: ../.rubocop-base.yml
2
-
3
- # Core-only overrides. Exclude patterns here are relative to this repo and
4
- # merge with the shared base's excludes.
5
- AllCops:
6
- Exclude:
7
- - '_notes/**/*'
8
-
9
- Metrics/ClassLength:
10
- Max: 650 # Robot is the central class; a future refactor could split it further
data/Archspec.rb DELETED
@@ -1,44 +0,0 @@
1
- component :robot, in: "lib/robot_lab/robot.rb"
2
- component :robot_support, in: "lib/robot_lab/robot/**/*.rb"
3
- component :network, in: ["lib/robot_lab/network.rb", "lib/robot_lab/bus_poller.rb"]
4
- component :memory, in: ["lib/robot_lab/memory.rb", "lib/robot_lab/memory_change.rb"]
5
- component :mcp, in: "lib/robot_lab/mcp/**/*.rb"
6
- component :sandbox, in: ["lib/robot_lab/sandbox.rb", "lib/robot_lab/sandbox/**/*.rb"]
7
- component :streaming, in: "lib/robot_lab/streaming/**/*.rb"
8
- component :budget, in: "lib/robot_lab/budget/**/*.rb"
9
- component :hooks, in: %w[
10
- lib/robot_lab/hook.rb
11
- lib/robot_lab/hook_context.rb
12
- lib/robot_lab/hook_registry.rb
13
- lib/robot_lab/hooks.rb
14
- ]
15
- component :tools, in: %w[
16
- lib/robot_lab/tool.rb
17
- lib/robot_lab/tool_config.rb
18
- lib/robot_lab/tool_manifest.rb
19
- lib/robot_lab/script_tool.rb
20
- ]
21
- component :config, in: ["lib/robot_lab/config.rb", "lib/robot_lab/run_config.rb"]
22
-
23
- # NOTE: every file here reopens `module RobotLab`, so a `dependencies.forbid`
24
- # rule keyed on components (e.g. `memory.cannot_use :robot`) treats a plain
25
- # `RobotLab.config` call as "depends on every component" — every file
26
- # "defines" the bare RobotLab constant. Naming the actual target constants
27
- # instead of components sidesteps that ambiguity.
28
-
29
- # Memory is a low-level primitive shared by Robot and Network; it must not
30
- # depend back on the things that depend on it.
31
- memory.cannot_reference_constants "RobotLab::Robot", "RobotLab::Network"
32
-
33
- # MCP is an external-tool integration layer that Robot/Network consume; it
34
- # must not reach back into the objects that use it.
35
- mcp.cannot_reference_constants "RobotLab::Robot", "RobotLab::Network"
36
-
37
- # Sandbox runs untrusted/generated code paths and should have the smallest
38
- # possible surface area — no reaching into orchestration or memory internals.
39
- sandbox.cannot_reference_constants "RobotLab::Robot", "RobotLab::Network", "RobotLab::Memory"
40
-
41
- # Config/RunConfig sits at the bottom of the configuration cascade
42
- # (RobotLab.config -> Network -> Robot -> template -> task -> runtime) and
43
- # must not depend upward on the objects it configures.
44
- config.cannot_reference_constants "RobotLab::Robot", "RobotLab::Network"
data/CLAUDE.md DELETED
@@ -1,141 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Project Overview
6
-
7
- RobotLab is a Ruby framework for building and orchestrating multi-robot LLM workflows. It provides:
8
- - **Robots**: LLM agents with tools, templates, and memory
9
- - **Networks**: Orchestration of multiple robots with routing logic
10
- - **MCP Integration**: Model Context Protocol for external tool servers
11
- - **Rails Integration**: Generators and ActiveRecord support for conversation history
12
-
13
- Built on top of [ruby_llm](https://rubyllm.com) and uses Zeitwerk for autoloading.
14
-
15
- ## Commands
16
-
17
- ```bash
18
- # Run all tests
19
- bundle exec rake test
20
-
21
- # Run a single test file
22
- bundle exec rake test_file[robot_lab/robot_test.rb]
23
-
24
- # Run tests with verbose output
25
- bundle exec rake test_verbose
26
-
27
- # Run integration tests only
28
- bundle exec rake integration
29
-
30
- # Lint with RuboCop
31
- bundle exec rubocop
32
-
33
- # Auto-fix RuboCop offenses
34
- bundle exec rubocop -a
35
-
36
- # Run all examples
37
- bundle exec rake examples:all
38
-
39
- # Run specific example by number (e.g., 01, 02)
40
- bundle exec rake examples:run[1]
41
- ```
42
-
43
- ## Architecture
44
-
45
- ### Core Classes
46
-
47
- - **`RobotLab`** (`lib/robot_lab.rb`): Module entry point with factory methods `build()` for robots and `create_network()` for networks
48
- - **`Robot`** (`lib/robot_lab/robot.rb`): Subclass of `RubyLLM::Agent` with template-based prompts, tools, MCP clients, and memory. Creates a persistent chat on initialization. Use `robot.run("...")` to interact. When standalone uses its own memory; when in a network uses shared network memory
49
- - **`Network`** (`lib/robot_lab/network.rb`): Orchestrates multiple robots with routing logic. Robots execute sequentially sharing memory. Router is a lambda that returns robot names
50
- - **`NetworkRun`** (`lib/robot_lab/network_run.rb`): Stateful execution of a network run with isolated memory clone
51
-
52
- ### RunConfig
53
-
54
- - **`RunConfig`** (`lib/robot_lab/run_config.rb`): Shared configuration object for LLM, tools, callbacks, and infrastructure settings. Flows through the hierarchy: `RobotLab.config -> Network -> Robot -> Template front matter -> Task -> Runtime`. Supports keyword construction, block DSL, merge semantics (more-specific wins), and `apply_to(chat)` for LLM field application. Both Robot and Network accept `config:` parameter. Infrastructure fields include: `bus`, `enable_cache`, `max_tool_rounds`, `token_budget`, `ractor_pool_size`, `max_concurrent_robots`, `doom_loop_threshold`, `auto_compact`, `compact_threshold`.
55
-
56
- ### Memory System
57
-
58
- - **`Memory`** (`lib/robot_lab/memory.rb`): Key-value store with reserved keys (`:data`, `:results`, `:messages`, `:session_id`, `:cache`). Supports Redis backend. Semantic caching via RubyLLM::SemanticCache when the optional ruby_llm-semantic_cache gem is installed (`memory.cache` is nil otherwise)
59
-
60
- ### MCP (Model Context Protocol)
61
-
62
- - **`MCP::Client`** (`lib/robot_lab/mcp/client.rb`): Connects to MCP servers
63
- - **Transports** (`lib/robot_lab/mcp/transports/`): stdio, websocket, SSE, streamable HTTP
64
-
65
- ### Built-in Tools
66
-
67
- - **`AskUser`** (`lib/robot_lab/ask_user.rb`): Tool that lets a robot ask the user a question via the terminal. Supports open-ended text, multiple choice, and default values. IO sourced from `robot.input`/`robot.output` (defaults to `$stdin`/`$stdout`)
68
-
69
- ### Adapters
70
-
71
- Provider adapters in `lib/robot_lab/adapters/`: Anthropic, OpenAI, Gemini (for provider-specific formatting)
72
-
73
- ### Configuration Hierarchy
74
-
75
- Tools and MCP servers use hierarchical configuration: `runtime > robot > network > global config`. Values can be `:none`, `:inherit`, or explicit arrays.
76
-
77
- ## Key Patterns
78
-
79
- ### Creating Robots
80
-
81
- ```ruby
82
- # Bare robot (no template or prompt)
83
- robot = RobotLab.build
84
- robot.with_instructions("You are helpful.").run("Hello!")
85
-
86
- # With template (.md file in prompts directory with YAML front matter)
87
- robot = RobotLab.build(name: "helper", template: :helper, context: { key: "value" })
88
- result = robot.run("Hello!")
89
-
90
- # With inline system prompt
91
- robot = RobotLab.build(name: "bot", system_prompt: "You are helpful.")
92
- result = robot.run("What can you do?")
93
-
94
- # With tools
95
- robot = RobotLab.build(name: "bot", system_prompt: "...", local_tools: [my_tool])
96
-
97
- # Chaining with_* methods
98
- robot.with_temperature(0.9).with_model("claude-sonnet-4").run("Be creative!")
99
- ```
100
-
101
- ### Creating Networks
102
-
103
- ```ruby
104
- router = ->(args) { args.call_count.zero? ? ["classifier"] : nil }
105
- network = RobotLab.create_network(name: "support", robots: [robot1, robot2], router: router)
106
- result = network.run(message: "Hello")
107
- ```
108
-
109
- ### Router Args
110
-
111
- Router receives `Router::Args` with: `context`, `network`, `stack`, `call_count`, `last_result`
112
-
113
- ## Testing
114
-
115
- - Uses Minitest with SimpleCov for coverage
116
- - Test helper at `test/test_helper.rb` provides `build_robot`, `build_network`, `build_tool` helpers
117
- - Templates for tests are in `examples/prompts/`
118
- - VCR and WebMock for HTTP stubbing
119
-
120
- ## Dependencies
121
-
122
- Core: zeitwerk, ruby_llm (~> 2.0.0.rc3), prompt_manager, async, simple_flow, state_machines
123
-
124
- Optional: ruby_llm-semantic_cache (Memory#cache; no ruby_llm 2.0-compatible release yet — Memory runs with caching disabled when absent), classifier (compress_history), ruby_llm-providers-lms (local LM Studio provider used by the examples: qwen/qwen3.8-27b for complex work, openai/gpt-oss-20b for simple demos)
125
-
126
- ### Templates
127
-
128
- Templates use prompt_manager format: single `.md` files with YAML front matter in the configured prompts directory.
129
-
130
- ```markdown
131
- ---
132
- description: A helpful assistant
133
- parameters:
134
- company_name: null
135
- tone: friendly
136
- ---
137
- You are a helpful assistant for <%= company_name %>.
138
- Respond in a <%= tone %> manner.
139
- ```
140
-
141
- Front matter supports: `description`, `parameters` (null = required), LLM config keys (`model`, `temperature`, `top_p`, `top_k`, `max_tokens`, etc.), and robot extras (`robot_name`, `tools`, `mcp`). Constructor-provided values always override front matter.
data/COMMITS.md DELETED
@@ -1,196 +0,0 @@
1
- ---
2
- url: https://www.conventionalcommits.org/en/v1.0.0/
3
- title: Conventional Commits
4
- description: A specification for adding human and machine readable meaning to commit messages
5
- access_date: 2025-07-31T20:51:29.000Z
6
- current_date: 2025-07-31T20:51:29.601Z
7
- ---
8
-
9
- # Conventional Commits
10
-
11
- A specification for adding human and machine readable meaning to commit messages
12
-
13
- Quick Summary Full Specification Contribute
14
-
15
- # Conventional Commits 1.0.0
16
-
17
- ## Summary
18
-
19
- The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
20
-
21
- The commit message should be structured as follows:
22
-
23
- ---
24
-
25
- ```
26
- <type>[optional scope]: <description>
27
-
28
- [optional body]
29
-
30
- [optional footer(s)]
31
-
32
- ```
33
-
34
- ---
35
-
36
- The commit contains the following structural elements, to communicate intent to the consumers of your library:
37
-
38
- 1. **fix:** a commit of the _type_ `fix` patches a bug in your codebase (this correlates with `PATCH` in Semantic Versioning).
39
- 2. **feat:** a commit of the _type_ `feat` introduces a new feature to the codebase (this correlates with `MINOR` in Semantic Versioning).
40
- 3. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:`, or appends a `!` after the type/scope, introduces a breaking API change (correlating with `MAJOR` in Semantic Versioning). A BREAKING CHANGE can be part of commits of any _type_.
41
- 4. _types_ other than `fix:` and `feat:` are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommends `build:`, `chore:`,`ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others.
42
- 5. _footers_ other than `BREAKING CHANGE: <description>` may be provided and follow a convention similar to git trailer format.
43
-
44
- Additional types are not mandated by the Conventional Commits specification, and have no implicit effect in Semantic Versioning (unless they include a BREAKING CHANGE). A scope may be provided to a commit’s type, to provide additional contextual information and is contained within parenthesis, e.g., `feat(parser): add ability to parse arrays`.
45
-
46
- ## Examples
47
-
48
- ### Commit message with description and breaking change footer
49
-
50
- ```
51
- feat: allow provided config object to extend other configs
52
-
53
- BREAKING CHANGE: `extends` key in config file is now used for extending other config files
54
-
55
- ```
56
-
57
- ### Commit message with `!` to draw attention to breaking change
58
-
59
- ```
60
- feat!: send an email to the customer when a product is shipped
61
-
62
- ```
63
-
64
- ### Commit message with scope and `!` to draw attention to breaking change
65
-
66
- ```
67
- feat(api)!: send an email to the customer when a product is shipped
68
-
69
- ```
70
-
71
- ### Commit message with both `!` and BREAKING CHANGE footer
72
-
73
- ```
74
- chore!: drop support for Node 6
75
-
76
- BREAKING CHANGE: use JavaScript features not available in Node 6.
77
-
78
- ```
79
-
80
- ### Commit message with no body
81
-
82
- ```
83
- docs: correct spelling of CHANGELOG
84
-
85
- ```
86
-
87
- ### Commit message with scope
88
-
89
- ```
90
- feat(lang): add Polish language
91
-
92
- ```
93
-
94
- ### Commit message with multi-paragraph body and multiple footers
95
-
96
- ```
97
- fix: prevent racing of requests
98
-
99
- Introduce a request id and a reference to latest request. Dismiss
100
- incoming responses other than from latest request.
101
-
102
- Remove timeouts which were used to mitigate the racing issue but are
103
- obsolete now.
104
-
105
- Reviewed-by: Z
106
- Refs: #123
107
-
108
- ```
109
-
110
- ## Specification
111
-
112
- The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
113
-
114
- 1. Commits MUST be prefixed with a type, which consists of a noun, `feat`, `fix`, etc., followed by the OPTIONAL scope, OPTIONAL `!`, and REQUIRED terminal colon and space.
115
- 2. The type `feat` MUST be used when a commit adds a new feature to your application or library.
116
- 3. The type `fix` MUST be used when a commit represents a bug fix for your application.
117
- 4. A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., `fix(parser):`
118
- 5. A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., _fix: array parsing issue when multiple spaces were contained in string_.
119
- 6. A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description.
120
- 7. A commit body is free-form and MAY consist of any number of newline separated paragraphs.
121
- 8. One or more footers MAY be provided one blank line after the body. Each footer MUST consist of a word token, followed by either a `:<space>` or `<space>#` separator, followed by a string value (this is inspired by the git trailer convention).
122
- 9. A footer’s token MUST use `-` in place of whitespace characters, e.g., `Acked-by` (this helps differentiate the footer section from a multi-paragraph body). An exception is made for `BREAKING CHANGE`, which MAY also be used as a token.
123
- 10. A footer’s value MAY contain spaces and newlines, and parsing MUST terminate when the next valid footer token/separator pair is observed.
124
- 11. Breaking changes MUST be indicated in the type/scope prefix of a commit, or as an entry in the footer.
125
- 12. If included as a footer, a breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon, space, and description, e.g.,_BREAKING CHANGE: environment variables now take precedence over config files_.
126
- 13. If included in the type/scope prefix, breaking changes MUST be indicated by a`!` immediately before the `:`. If `!` is used, `BREAKING CHANGE:` MAY be omitted from the footer section, and the commit description SHALL be used to describe the breaking change.
127
- 14. Types other than `feat` and `fix` MAY be used in your commit messages, e.g., _docs: update ref docs._
128
- 15. The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase.
129
- 16. BREAKING-CHANGE MUST be synonymous with BREAKING CHANGE, when used as a token in a footer.
130
-
131
- ## Why Use Conventional Commits
132
-
133
- * Automatically generating CHANGELOGs.
134
- * Automatically determining a semantic version bump (based on the types of commits landed).
135
- * Communicating the nature of changes to teammates, the public, and other stakeholders.
136
- * Triggering build and publish processes.
137
- * Making it easier for people to contribute to your projects, by allowing them to explore a more structured commit history.
138
-
139
- ## FAQ
140
-
141
- ### How should I deal with commit messages in the initial development phase?
142
-
143
- We recommend that you proceed as if you’ve already released the product. Typically _somebody_, even if it’s your fellow software developers, is using your software. They’ll want to know what’s fixed, what breaks etc.
144
-
145
- ### Are the types in the commit title uppercase or lowercase?
146
-
147
- Any casing may be used, but it’s best to be consistent.
148
-
149
- ### What do I do if the commit conforms to more than one of the commit types?
150
-
151
- Go back and make multiple commits whenever possible. Part of the benefit of Conventional Commits is its ability to drive us to make more organized commits and PRs.
152
-
153
- ### Doesn’t this discourage rapid development and fast iteration?
154
-
155
- It discourages moving fast in a disorganized way. It helps you be able to move fast long term across multiple projects with varied contributors.
156
-
157
- ### Might Conventional Commits lead developers to limit the type of commits they make because they’ll be thinking in the types provided?
158
-
159
- Conventional Commits encourages us to make more of certain types of commits such as fixes. Other than that, the flexibility of Conventional Commits allows your team to come up with their own types and change those types over time.
160
-
161
- ### How does this relate to SemVer?
162
-
163
- `fix` type commits should be translated to `PATCH` releases. `feat` type commits should be translated to `MINOR` releases. Commits with `BREAKING CHANGE` in the commits, regardless of type, should be translated to `MAJOR` releases.
164
-
165
- ### How should I version my extensions to the Conventional Commits Specification, e.g. `@jameswomack/conventional-commit-spec`?
166
-
167
- We recommend using SemVer to release your own extensions to this specification (and encourage you to make these extensions!)
168
-
169
- ### What do I do if I accidentally use the wrong commit type?
170
-
171
- #### When you used a type that’s of the spec but not the correct type, e.g. `fix` instead of `feat`
172
-
173
- Prior to merging or releasing the mistake, we recommend using `git rebase -i` to edit the commit history. After release, the cleanup will be different according to what tools and processes you use.
174
-
175
- #### When you used a type _not_ of the spec, e.g. `feet` instead of `feat`
176
-
177
- In a worst case scenario, it’s not the end of the world if a commit lands that does not meet the Conventional Commits specification. It simply means that commit will be missed by tools that are based on the spec.
178
-
179
- ### Do all my contributors need to use the Conventional Commits specification?
180
-
181
- No! If you use a squash based workflow on Git lead maintainers can clean up the commit messages as they’re merged—adding no workload to casual committers. A common workflow for this is to have your git system automatically squash commits from a pull request and present a form for the lead maintainer to enter the proper git commit message for the merge.
182
-
183
- ### How does Conventional Commits handle revert commits?
184
-
185
- Reverting code can be complicated: are you reverting multiple commits? if you revert a feature, should the next release instead be a patch?
186
-
187
- Conventional Commits does not make an explicit effort to define revert behavior. Instead we leave it to tooling authors to use the flexibility of _types_ and _footers_ to develop their logic for handling reverts.
188
-
189
- One recommendation is to use the `revert` type, and a footer that references the commit SHAs that are being reverted:
190
-
191
- ```
192
- revert: let us never again speak of the noodle incident
193
-
194
- Refs: 676104e, a215868
195
-
196
- ```
data/Rakefile DELETED
@@ -1,193 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Quality gates (quality, rubocop_check, flog_check, flay_check,
4
- # archspec_check, ...), doc *serving*, and the gem lifecycle (build, install,
5
- # release) live in asgard — see .loki and the shared dev/*.loki files it
6
- # imports. This Rakefile keeps the tasks asgard delegates to (tests,
7
- # integration, examples, docs:build).
8
-
9
- require "rake/testtask"
10
-
11
- Rake::TestTask.new(:test) do |t|
12
- t.libs << "test"
13
- t.libs << "lib"
14
- t.test_files = FileList["test/**/*_test.rb"]
15
- t.verbose = true
16
- # Load test_helper before any tests run to ensure SimpleCov starts first
17
- t.ruby_opts << "-rtest_helper"
18
- end
19
-
20
- task default: :test
21
-
22
- desc "Run tests with verbose output"
23
- task :test_verbose do
24
- ENV["TESTOPTS"] = "--verbose"
25
- Rake::Task[:test].invoke
26
- end
27
-
28
- desc "Run a single test file"
29
- task :test_file, [:file] do |_t, args|
30
- ruby "test/#{args[:file]}"
31
- end
32
-
33
- desc "Run integration tests only"
34
- Rake::TestTask.new(:integration) do |t|
35
- t.libs << "test"
36
- t.libs << "lib"
37
- t.test_files = FileList["test/integration/**/*_test.rb"]
38
- t.verbose = true
39
- t.ruby_opts << "-rtest_helper"
40
- end
41
-
42
- namespace :examples do
43
- # Map of subdirectory-based demos to their entry point scripts
44
- SUBDIR_ENTRY_POINTS = {
45
- "14_rusty_circuit" => "open_mic.rb",
46
- "15_memory_network_and_bus" => "editorial_pipeline.rb",
47
- "16_writers_room" => "writers_room.rb",
48
- "27_incident_response" => "incident_response.rb"
49
- }.freeze
50
-
51
- # Subdirectory demos that are standalone apps (not run via `ruby`)
52
- STANDALONE_APPS = {
53
- "18_rails" => { setup: "bin/setup", run: "bin/dev" }
54
- }.freeze
55
-
56
- # Examples that require external services or user setup not guaranteed to be present
57
- EXTERNAL_SERVICE_EXAMPLES = {
58
- "33_stock_generator.rb" => "Redis server on localhost:6379",
59
- "33_stock_predictor.rb" => "Redis server on localhost:6379 + running 33_stock_generator",
60
- "34_agentskills.rb" => "AgentSkills skill file at ~/.prompts/skills/code_reviewer/SKILL.md"
61
- }.freeze
62
-
63
- desc "Run all examples (excludes standalone apps like 18_rails)"
64
- task :all do
65
- failed = []
66
-
67
- # Single-file examples
68
- Dir.glob("examples/*.rb").each do |example|
69
- base = File.basename(example)
70
-
71
- if EXTERNAL_SERVICE_EXAMPLES.key?(base)
72
- puts "\n#{'=' * 60}"
73
- puts "Skipped: #{example} (requires #{EXTERNAL_SERVICE_EXAMPLES[base]})"
74
- puts '=' * 60
75
- next
76
- end
77
-
78
- puts "\n#{'=' * 60}"
79
- puts "Running: #{example}"
80
- puts '=' * 60
81
- begin
82
- ruby example
83
- rescue RuntimeError => e
84
- puts "FAILED: #{example} — #{e.message}"
85
- failed << example
86
- end
87
- end
88
-
89
- # Subdirectory-based demos
90
- SUBDIR_ENTRY_POINTS.each do |dir, entry|
91
- path = "examples/#{dir}/#{entry}"
92
- next unless File.exist?(path)
93
-
94
- puts "\n#{'=' * 60}"
95
- puts "Running: #{path}"
96
- puts '=' * 60
97
- begin
98
- ruby path
99
- rescue RuntimeError => e
100
- puts "FAILED: #{path} — #{e.message}"
101
- failed << path
102
- end
103
- end
104
-
105
- # Remind about standalone apps
106
- STANDALONE_APPS.each do |dir, commands|
107
- puts "\n#{'=' * 60}"
108
- puts "Skipped: examples/#{dir} (standalone app)"
109
- puts " Setup: cd examples/#{dir} && #{commands[:setup]}"
110
- puts " Run: cd examples/#{dir} && #{commands[:run]}"
111
- puts '=' * 60
112
- end
113
-
114
- if failed.any?
115
- puts "\n#{'=' * 60}"
116
- puts "#{failed.size} example(s) failed:"
117
- failed.each { |f| puts " #{f}" }
118
- puts '=' * 60
119
- exit 1
120
- end
121
- end
122
-
123
- desc "Run a specific example by number (e.g., rake examples:run[1])"
124
- task :run, [:num] do |_t, args|
125
- padded = args[:num].rjust(2, '0')
126
-
127
- # Try single-file example first
128
- example = Dir.glob("examples/#{padded}_*.rb").first
129
- if example
130
- ruby example
131
- next
132
- end
133
-
134
- # Try subdirectory-based demo
135
- dir = Dir.glob("examples/#{padded}_*/").first
136
- if dir
137
- dir_name = File.basename(dir)
138
-
139
- # Check if it's a standalone app
140
- if STANDALONE_APPS.key?(dir_name)
141
- commands = STANDALONE_APPS[dir_name]
142
- puts "Example #{args[:num]} is a standalone app (#{dir_name})."
143
- puts " Setup: cd examples/#{dir_name} && #{commands[:setup]}"
144
- puts " Run: cd examples/#{dir_name} && #{commands[:run]}"
145
- next
146
- end
147
-
148
- entry = SUBDIR_ENTRY_POINTS[dir_name]
149
- if entry && File.exist?(File.join(dir, entry))
150
- ruby File.join(dir, entry)
151
- else
152
- puts "Example #{args[:num]} directory found (#{dir_name}) but no entry point configured"
153
- end
154
- else
155
- puts "Example #{args[:num]} not found"
156
- end
157
- end
158
-
159
- desc "Setup the Rails demo app (example 18)"
160
- task :rails_setup do
161
- Dir.chdir("examples/18_rails") do
162
- sh "bin/setup"
163
- end
164
- end
165
-
166
- desc "Start the Rails demo app (example 18)"
167
- task :rails do
168
- Dir.chdir("examples/18_rails") do
169
- sh "bin/dev"
170
- end
171
- end
172
- end
173
-
174
- namespace :docs do
175
- desc "Build all documentation (YARD and MkDocs)"
176
- task build: %i[yard mkdocs]
177
-
178
- desc "Clean generated documentation"
179
- task :clean do
180
- rm_rf "doc"
181
- rm_rf "site"
182
- end
183
-
184
- desc "Build YARD API documentation"
185
- task :yard do
186
- sh "yard doc"
187
- end
188
-
189
- desc "Build MkDocs documentation"
190
- task :mkdocs do
191
- sh "mkdocs build"
192
- end
193
- end
data/_typos.toml DELETED
@@ -1,21 +0,0 @@
1
- # False-positive suppressions for the typos quality gate (asgard).
2
- # Everything here was reviewed by hand — see git history for context.
3
-
4
- [files]
5
- extend-exclude = [
6
- # Example transcripts / articles: prose quotes real names ("Damon Clark")
7
- # and SQL-ish plurals ("SELECTs") that typos mis-parses.
8
- "examples/ruboruby.md",
9
- "examples/25_history_search/conversation.jsonl",
10
- ]
11
-
12
- [default.extend-identifiers]
13
- # Robot names in lib/robot_lab/names.rb
14
- BATs = "BATs"
15
- Damon = "Damon"
16
- Mata_Nui = "Mata_Nui"
17
- Pris = "Pris"
18
- S1MONE = "S1MONE"
19
- # Test-local variable names
20
- ba = "ba" # b→a similarity (convergence_test.rb)
21
- thr = "thr" # thread handle (connection_poller_test.rb)