aia 1.1.1 → 2.0.0.0.pre.beta2

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 (175) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +9 -1
  3. data/.loki +11 -0
  4. data/.reek.yml +160 -0
  5. data/.rubocop.yml +116 -0
  6. data/.rubocop_strict.yml +15 -0
  7. data/.version +1 -1
  8. data/CHANGELOG.md +269 -55
  9. data/IMPLEMENTATION_PLAN.md +506 -0
  10. data/README.md +267 -239
  11. data/Rakefile +5 -5
  12. data/_typos.toml +10 -0
  13. data/aia.gemspec +92 -0
  14. data/architecture_review.md +314 -0
  15. data/bin/aia +16 -0
  16. data/config/aia.yml +13 -0
  17. data/docs/AGENTS.md +40 -0
  18. data/docs/advanced-prompting.md +67 -3
  19. data/docs/cli-reference.md +312 -56
  20. data/docs/configuration.md +130 -19
  21. data/docs/contributing.md +56 -2
  22. data/docs/directives-reference.md +593 -78
  23. data/docs/faq.md +85 -3
  24. data/docs/guides/available-models.md +1 -1
  25. data/docs/guides/basic-usage.md +6 -6
  26. data/docs/guides/chat.md +40 -16
  27. data/docs/guides/crew.md +239 -0
  28. data/docs/guides/executable-prompts.md +1 -1
  29. data/docs/guides/index.md +1 -0
  30. data/docs/guides/models.md +15 -0
  31. data/docs/index.md +29 -2
  32. data/docs/installation.md +44 -17
  33. data/docs/mcp-integration.md +40 -0
  34. data/docs/prompt_management.md +85 -86
  35. data/docs/security.md +47 -0
  36. data/docs/special_projects_guide.md +386 -0
  37. data/docs/tools-and-mcp-examples.md +23 -0
  38. data/docs/workflows-and-pipelines.md +84 -7
  39. data/examples/.gitignore +1 -0
  40. data/examples/00_setup_aia.sh +27 -44
  41. data/examples/11_multi_model.sh +4 -14
  42. data/examples/12_token_usage.sh +3 -12
  43. data/examples/18_tools.sh +10 -2
  44. data/examples/22_chat_mode.sh +0 -10
  45. data/examples/23_verify.sh +139 -0
  46. data/examples/24_decompose.sh +139 -0
  47. data/examples/25_spawn.sh +139 -0
  48. data/examples/26_debate.sh +97 -0
  49. data/examples/27_mention_routing.sh +157 -0
  50. data/examples/28_model_switching.sh +106 -0
  51. data/examples/29_agent_harness.sh +177 -0
  52. data/examples/README.md +65 -0
  53. data/examples/advanced_multi_robot_capabilities_without_examples.md +106 -0
  54. data/examples/aia_config.yml +1 -1
  55. data/examples/aia_config_orchestrator.yml +45 -0
  56. data/examples/common.sh +18 -6
  57. data/examples/context/tech_stack.md +2 -2
  58. data/examples/prompts_dir/roles/orchestrator.md +21 -0
  59. data/examples/requirements/sinatra_taskflow_app.md +139 -0
  60. data/examples/rules/01_classify_ruby.rb +16 -0
  61. data/examples/rules/02_prefer_claude_for_code.rb +19 -0
  62. data/examples/rules/03_gate_prompt_length.rb +19 -0
  63. data/examples/rules/04_tool_selection.rb +41 -0
  64. data/examples/rules/README.md +30 -0
  65. data/examples/run_all.sh +48 -15
  66. data/examples/tools/word_count_tool.rb +1 -1
  67. data/lib/AGENTS.md +57 -0
  68. data/lib/aia/chat_loop.rb +263 -167
  69. data/lib/aia/config/cli_parser.rb +217 -145
  70. data/lib/aia/config/defaults.yml +62 -33
  71. data/lib/aia/config/mcp_parser.rb +52 -51
  72. data/lib/aia/config/model_spec.rb +34 -2
  73. data/lib/aia/config/validator.rb +171 -216
  74. data/lib/aia/config.rb +111 -145
  75. data/lib/aia/content_extractor.rb +155 -0
  76. data/lib/aia/cost_calculator.rb +39 -0
  77. data/lib/aia/crew.rb +164 -0
  78. data/lib/aia/debate_handler.rb +174 -0
  79. data/lib/aia/delegate_handler.rb +116 -0
  80. data/lib/aia/directive.rb +43 -26
  81. data/lib/aia/directive_processor.rb +16 -7
  82. data/lib/aia/directives/configuration_directives.rb +214 -60
  83. data/lib/aia/directives/context_directives.rb +67 -52
  84. data/lib/aia/directives/execution_directives.rb +141 -4
  85. data/lib/aia/directives/model_directives.rb +163 -141
  86. data/lib/aia/directives/trakflow_directives.rb +62 -0
  87. data/lib/aia/directives/utility_directives.rb +227 -30
  88. data/lib/aia/directives/web_and_file_directives.rb +126 -77
  89. data/lib/aia/errors.rb +15 -0
  90. data/lib/aia/fact_asserter.rb +27 -0
  91. data/lib/aia/fzf.rb +9 -31
  92. data/lib/aia/handler_context.rb +17 -0
  93. data/lib/aia/handler_protocol.rb +19 -0
  94. data/lib/aia/history_transfer.rb +55 -0
  95. data/lib/aia/input_collector.rb +3 -3
  96. data/lib/aia/layered_orchestrator.rb +471 -0
  97. data/lib/aia/logger.rb +45 -25
  98. data/lib/aia/mcp_config_normalizer.rb +35 -0
  99. data/lib/aia/mcp_connection_manager.rb +315 -0
  100. data/lib/aia/mcp_discovery.rb +44 -0
  101. data/lib/aia/mcp_grouper.rb +33 -0
  102. data/lib/aia/mcp_server_config.rb +30 -0
  103. data/lib/aia/mcp_utility.rb +60 -0
  104. data/lib/aia/mention_router.rb +217 -0
  105. data/lib/aia/model_alias_registry.rb +97 -0
  106. data/lib/aia/model_switch_handler.rb +100 -0
  107. data/lib/aia/network_builder.rb +160 -0
  108. data/lib/aia/network_memory_manager.rb +55 -0
  109. data/lib/aia/patches/ruby_llm_streaming_error.rb +43 -0
  110. data/lib/aia/patches/ruby_llm_tool_error.rb +96 -0
  111. data/lib/aia/pipeline_orchestrator.rb +272 -0
  112. data/lib/aia/plugin_loader.rb +170 -0
  113. data/lib/aia/plugin_monitor.rb +211 -0
  114. data/lib/aia/prompt_decomposer.rb +159 -0
  115. data/lib/aia/prompt_handler.rb +56 -82
  116. data/lib/aia/robot_builder.rb +51 -0
  117. data/lib/aia/robot_factory.rb +338 -0
  118. data/lib/aia/robot_namer.rb +110 -0
  119. data/lib/aia/session.rb +87 -17
  120. data/lib/aia/session_tracker.rb +207 -0
  121. data/lib/aia/similarity_scorer.rb +41 -0
  122. data/lib/aia/skill_utils.rb +105 -1
  123. data/lib/aia/spawn_handler.rb +129 -0
  124. data/lib/aia/spawn_spec_parser.rb +65 -0
  125. data/lib/aia/special_mode_handler.rb +322 -0
  126. data/lib/aia/speech.rb +67 -0
  127. data/lib/aia/startup_coordinator.rb +151 -0
  128. data/lib/aia/streaming_runner.rb +172 -0
  129. data/lib/aia/system_prompt_assembler.rb +92 -0
  130. data/lib/aia/task_coordinator.rb +207 -0
  131. data/lib/aia/task_decomposer.rb +57 -0
  132. data/lib/aia/task_executor.rb +51 -0
  133. data/lib/aia/tfidf_math.rb +27 -0
  134. data/lib/aia/timing.rb +15 -0
  135. data/lib/aia/tool_filter/tfidf.rb +116 -0
  136. data/lib/aia/tool_filter/wordnet_expander.rb +127 -0
  137. data/lib/aia/tool_filter.rb +83 -0
  138. data/lib/aia/tool_filter_registry.rb +30 -0
  139. data/lib/aia/tool_filter_strategy.rb +146 -0
  140. data/lib/aia/tool_introspection.rb +17 -0
  141. data/lib/aia/tool_loader.rb +216 -0
  142. data/lib/aia/tool_utility.rb +30 -0
  143. data/lib/aia/tools/delegate_to_foreman_tool.rb +70 -0
  144. data/lib/aia/tools/recruit_robot_tool.rb +60 -0
  145. data/lib/aia/tools/reskill_robot_tool.rb +44 -0
  146. data/lib/aia/tools/task_board_tool.rb +115 -0
  147. data/lib/aia/trakflow_bridge.rb +175 -0
  148. data/lib/aia/turn_state.rb +95 -0
  149. data/lib/aia/ui_presenter.rb +182 -206
  150. data/lib/aia/utility.rb +136 -87
  151. data/lib/aia/{history_manager.rb → variable_input_collector.rb} +9 -9
  152. data/lib/aia/verification_network.rb +57 -0
  153. data/lib/aia.rb +124 -63
  154. data/mkdocs.yml +1 -0
  155. metadata +187 -58
  156. data/justfile +0 -215
  157. data/lib/aia/adapter/chat_execution.rb +0 -242
  158. data/lib/aia/adapter/error_handler.rb +0 -68
  159. data/lib/aia/adapter/gem_activator.rb +0 -57
  160. data/lib/aia/adapter/mcp_connector.rb +0 -274
  161. data/lib/aia/adapter/modality_handlers.rb +0 -167
  162. data/lib/aia/adapter/model_registry.rb +0 -81
  163. data/lib/aia/adapter/multi_model_chat.rb +0 -218
  164. data/lib/aia/adapter/provider_configurator.rb +0 -59
  165. data/lib/aia/adapter/tool_filter.rb +0 -85
  166. data/lib/aia/adapter/tool_loader.rb +0 -90
  167. data/lib/aia/chat_processor_service.rb +0 -178
  168. data/lib/aia/prompt_pipeline.rb +0 -183
  169. data/lib/aia/ruby_llm_adapter.rb +0 -95
  170. data/lib/extensions/openstruct_merge.rb +0 -48
  171. data/lib/extensions/ruby_llm/.irbrc +0 -56
  172. data/lib/extensions/ruby_llm/modalities.rb +0 -36
  173. data/lib/extensions/ruby_llm/provider_fix.rb +0 -79
  174. data/lib/refinements/string.rb +0 -16
  175. data/main.just +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8f6a82b1c6cc29b4245e51ed43a325a835a921a0da5c2818dbdfbdeeeb97c40
4
- data.tar.gz: ff0cff98ed30d391970a11a44519cb9ea95082bfae2a08e5ebf03b71eeefac15
3
+ metadata.gz: a4bbfc1e0e1f0e293c55ce308b069b4a36af679797fcdaa2daeb47f05211d31f
4
+ data.tar.gz: 2d358bec6a2dfd8e57c55266099dcbd5ab96c776532fd6829862df30cd668323
5
5
  SHA512:
6
- metadata.gz: ec35e9ae94d6c74ad6ecf87ad6a8511de29407d1bac99db1ff1266b7072ac078746bf9fcabb45f6aeed1858198b318ff2906e8858b74185de8107cfdcf48bfca
7
- data.tar.gz: 7ee21fda6bdf851e2418d739450f2b8d6ffd8580e5aaaef7b84e5c16c83ded0eefb83e6c8a943ffa5bbe09960463eb8617c44adf9a66f6ad87b460edc50ed6b7
6
+ metadata.gz: a62160a13b4b6827b837191a7b0001fe6d075cc3a3e628f1c943f82c970da7c22c6ed031e11792e0d43a188e2b5e2895994cfd5a5265309bbf81d849537be569
7
+ data.tar.gz: dae8328bdbc222221ac6380e71037d4ea0d32df2f6f04d091beac65632bc3c58e9b190735854440e71df20e1368509313c8b678d5f765870433ce2b0687ec43a
data/.envrc CHANGED
@@ -1,6 +1,11 @@
1
+ # robot_lab_project/aia/.envrc
2
+
1
3
  source_up
2
4
 
3
- export RR=`pwd`
5
+ export RR=$(pwd)
6
+
7
+ export AIA_PLUGINS_DIR=$RR/plugins
8
+
4
9
  # PATH_add $RR/bin
5
10
 
6
11
  # see aia --help for --model option
@@ -9,3 +14,6 @@ export RR=`pwd`
9
14
  # Use a comma to seperate the models in a multi-model setup
10
15
  #
11
16
  # export AIA_MODEL=claude-haiku-4-5,gpt-4o-mini
17
+ export AIA_MODEL=lms/qwen3.8
18
+
19
+ export BUNDLE_GEMFILE=Gemfile
data/.loki ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ # aia/.loki — asgard task runner for the aia gem
3
+
4
+ import_up "repo_dev.loki"
5
+
6
+ class Tasks
7
+ @@gem_name ||= "aia".freeze
8
+
9
+ header "aia — AI Assistant CLI gem"
10
+ footer "Run `asgard help TASK` for details on any task"
11
+ end
data/.reek.yml ADDED
@@ -0,0 +1,160 @@
1
+ ---
2
+ detectors:
3
+
4
+ # Disabled: conflicts with project no-comment coding style.
5
+ IrresponsibleModule:
6
+ enabled: false
7
+
8
+ # Disabled: private helpers that don't reference self are fine where they are.
9
+ UtilityFunction:
10
+ enabled: false
11
+
12
+ # Disabled: respond_to? duck-typing is intentional in this codebase.
13
+ ManualDispatch:
14
+ enabled: false
15
+
16
+ # Disabled: attr_accessor is standard Ruby; public attributes are a design choice.
17
+ Attribute:
18
+ enabled: false
19
+
20
+ # Disabled: bang methods without non-bang counterparts are common in internal APIs.
21
+ MissingSafeMethod:
22
+ enabled: false
23
+
24
+ # Disabled: explicit nil checks are idiomatic Ruby (nil? / unless nil, etc.).
25
+ NilCheck:
26
+ enabled: false
27
+
28
+ # Disabled: handler/directive protocol methods must accept the full interface
29
+ # signature even when individual implementations don't use every parameter.
30
+ UnusedParameters:
31
+ enabled: false
32
+
33
+ # Disabled: same trade-off as UtilityFunction above — private formatting and
34
+ # extraction helpers deliberately operate on a passed-in value (result, tool,
35
+ # robot_result, raw metrics hash) next to their single caller; most of those
36
+ # values are Hashes or third-party objects we can't (and shouldn't) add
37
+ # methods to.
38
+ FeatureEnvy:
39
+ enabled: false
40
+
41
+ # Disabled: the detector fires on the codebase's configuration-cascade style —
42
+ # `arg || default` dependency-injection fallbacks in constructors and CLI
43
+ # override-precedence checks (e.g. LoggerManager#effective_log_file). Those
44
+ # conditionals ARE the method's purpose, not hidden polymorphism.
45
+ ControlParameter:
46
+ enabled: false
47
+
48
+ # Disabled: guard-clause style (see disabled IfUnlessModifier in rubocop) —
49
+ # cheap predicates like `available?`, `tracking`, `show_cost` guard each
50
+ # public method independently. Extracting a null-object/state machine for a
51
+ # CLI would be over-engineering; every flagged condition was a guard.
52
+ RepeatedConditional:
53
+ enabled: false
54
+
55
+ # Disabled: the detector doesn't follow initialize's delegation to reset
56
+ # helpers (Session#initialize_components, TurnState#clear!,
57
+ # ContextDirectives#reset!, Fzf#build_command) and flags `||=` memoization
58
+ # and class-level singleton caches. All 21 flagged ivars were audited
59
+ # (2026-09): every one is assigned before first read; zero nil-read risks.
60
+ InstanceVariableAssumption:
61
+ enabled: false
62
+
63
+ # 2-deep iteration (rendering a collection of collections, grouped output)
64
+ # is idiomatic Ruby; 30 of the 31 flagged sites were simple 2-deep
65
+ # each/map display or grouping loops.
66
+ NestedIterators:
67
+ max_allowed_nesting: 2
68
+
69
+ # Default is 1 — fires whenever a method is called even twice. Raise to 2.
70
+ DuplicateMethodCall:
71
+ max_calls: 2
72
+
73
+ # Default is 5; was 8. Raised to 12 with data (2026-09): 84 of the 166
74
+ # flagged methods sat at 9-12 statements — linear OptionParser registrations
75
+ # (CLIParser#setup_*), sequential display/formatting output, and step-wise
76
+ # orchestration with no added branching. Real complexity stays bounded by
77
+ # flog (warn >=20 / fail >=50) and rubocop Metrics (MethodLength 35, AbcSize
78
+ # 40). Methods above 12 are fixed or justified per site, not by threshold.
79
+ TooManyStatements:
80
+ max_statements: 12
81
+
82
+ # Default is 3 — extreme for this codebase.
83
+ LongParameterList:
84
+ max_params: 5
85
+ overrides:
86
+ initialize:
87
+ max_params: 7
88
+
89
+ # Default is 15; several AIA coordinator/handler classes legitimately exceed this.
90
+ TooManyMethods:
91
+ max_methods: 20
92
+
93
+ # Default is 4 — far too low for config and session classes with many fields.
94
+ TooManyInstanceVariables:
95
+ max_instance_variables: 8
96
+
97
+ # Default is 5; some modules carry more constants by design.
98
+ TooManyConstants:
99
+ max_constants: 8
100
+
101
+ # Raise min_clump_size so only truly repeated parameter groups are flagged.
102
+ DataClump:
103
+ max_copies: 2
104
+ min_clump_size: 3
105
+
106
+ # Accept standard Ruby short-name conventions for limited-scope variables.
107
+ UncommunicativeVariableName:
108
+ accept:
109
+ - _ # intentionally ignored
110
+ - a # array / argument
111
+ - b # body / block
112
+ - c # char / count / config
113
+ - d # data / dir
114
+ - e # rescue => e
115
+ - f # file / format / flag
116
+ - h # hash
117
+ - i # index
118
+ - k # key
119
+ - l # line / list
120
+ - m # match / message
121
+ - n # number / name
122
+ - p # path / param
123
+ - q # query
124
+ - r # result / response
125
+ - s # string / source
126
+ - t # time / token / type
127
+ - v # value
128
+ - w # word / width
129
+
130
+ UncommunicativeParameterName:
131
+ accept:
132
+ - a # vector math pairs (cosine_similarity(a, b))
133
+ - e
134
+ - i
135
+ - f
136
+ - k
137
+ - v
138
+ - t
139
+ - r
140
+ - s
141
+ - m
142
+ - n
143
+ - q
144
+ - b
145
+
146
+ directories:
147
+ # plugins/ — standalone LLM tool wrappers; execute() keyword arg lists map
148
+ # directly to LLM-visible parameters and are intentionally wide.
149
+ "plugins":
150
+ LongParameterList:
151
+ max_params: 20
152
+ TooManyMethods:
153
+ max_methods: 25
154
+
155
+ exclude_paths:
156
+ - test
157
+ - examples
158
+ - docs
159
+ - coverage
160
+ - pkg
data/.rubocop.yml ADDED
@@ -0,0 +1,116 @@
1
+ inherit_from:
2
+ - .rubocop_todo.yml
3
+ - ../.rubocop-base.yml
4
+ - .rubocop_strict.yml
5
+
6
+ inherit_mode:
7
+ merge:
8
+ - Exclude
9
+
10
+ AllCops:
11
+ Exclude:
12
+ - 'examples/**/*'
13
+ - 'site/**/*'
14
+ - 'notes/**/*'
15
+ - 'docs/**/*'
16
+ - 'coverage/**/*'
17
+ - 'pkg/**/*'
18
+ - 'orchestrated_build_*/**/*'
19
+ - 'rubyllm_with_schema_test.rb'
20
+ - 'with_schema_test.rb'
21
+
22
+ # ── Gemspec: dev deps in gemspec for publisher convenience ───────────────────
23
+ Gemspec/DevelopmentDependencies:
24
+ EnforcedStyle: gemspec
25
+ Exclude:
26
+ - 'Gemfile'
27
+ - 'Gemfile.local'
28
+
29
+ # ── Style: intentional lib patterns ─────────────────────────────────────────
30
+ # extend self used in skill_utils.rb so methods are public when included
31
+ Style/ModuleFunction:
32
+ Exclude:
33
+ - 'lib/aia/skill_utils.rb'
34
+
35
+ # $DEBUG_ME is an intentional global for CLI debug toggle
36
+ Style/GlobalVars:
37
+ Exclude:
38
+ - 'lib/aia.rb'
39
+ - 'lib/aia/config/cli_parser.rb'
40
+
41
+ # %{key} Ruby format tokens are intentional for LLM prompt template interpolation
42
+ Style/FormatStringToken:
43
+ Enabled: false
44
+
45
+ # Safe navigation chains > 2 are intentional in this codebase
46
+ Style/SafeNavigationChainLength:
47
+ Enabled: false
48
+
49
+ # Duplicate branch bodies are intentional in several dispatch patterns
50
+ Lint/DuplicateBranch:
51
+ Enabled: false
52
+
53
+ # ── Test files: relax cops that fire on intentional test patterns ─────────────
54
+ Style/OpenStructUse:
55
+ Exclude:
56
+ - 'test/**/*'
57
+
58
+ Lint/MissingSuper:
59
+ Exclude:
60
+ - 'test/**/*'
61
+
62
+ Lint/FloatComparison:
63
+ Exclude:
64
+ - 'test/**/*'
65
+
66
+ Style/MixinUsage:
67
+ Exclude:
68
+ - 'test/test_helper.rb'
69
+
70
+ Style/OptionalBooleanParameter:
71
+ Exclude:
72
+ - 'test/test_helper.rb'
73
+
74
+ Naming/VariableNumber:
75
+ Exclude:
76
+ - 'test/**/*'
77
+
78
+ Lint/ConstantDefinitionInBlock:
79
+ Exclude:
80
+ - 'Rakefile'
81
+ - 'test/**/*'
82
+
83
+ Metrics/AbcSize:
84
+ Max: 40
85
+ Exclude:
86
+ - 'test/**/*'
87
+
88
+ Metrics/MethodLength:
89
+ Max: 35
90
+ CountAsOne:
91
+ - heredoc
92
+ - array
93
+ - hash
94
+ Exclude:
95
+ - 'test/**/*'
96
+
97
+ Metrics/BlockLength:
98
+ Exclude:
99
+ - 'Rakefile'
100
+ - '*.gemspec'
101
+ - 'test/**/*'
102
+
103
+ Metrics/CyclomaticComplexity:
104
+ Max: 20
105
+ Exclude:
106
+ - 'test/**/*'
107
+
108
+ Metrics/PerceivedComplexity:
109
+ Max: 20
110
+ Exclude:
111
+ - 'test/**/*'
112
+
113
+ Metrics/ModuleLength:
114
+ Max: 200
115
+ Exclude:
116
+ - 'test/**/*'
@@ -0,0 +1,15 @@
1
+ # Cops that must always fire, regardless of .rubocop_todo.yml or inline directives.
2
+ # Listed LAST in inherit_from to override any Exclude entries from todo files.
3
+
4
+ Lint/Debugger:
5
+ Enabled: true
6
+ Exclude: []
7
+
8
+ Security/Eval:
9
+ Enabled: true
10
+ Exclude: []
11
+
12
+ Lint/SuppressedException:
13
+ Enabled: true
14
+ Exclude: []
15
+
data/.version CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 2.0.0.0-beta2