scout-ai 2.0.0 → 2.2.0

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 (185) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +135 -55
  3. data/README.md +2 -1
  4. data/VERSION +1 -1
  5. data/doc/Improvements.md +490 -148
  6. data/doc/Model.md +53 -10
  7. data/doc/StartHere.md +44 -19
  8. data/doc/developer/Architecture.md +25 -6
  9. data/doc/developer/Backends.md +207 -48
  10. data/doc/developer/ChatLifecycle.md +121 -20
  11. data/doc/developer/DelegationInternals.md +320 -34
  12. data/doc/developer/DesignPrinciples.md +205 -16
  13. data/doc/developer/PathEngine.md +628 -0
  14. data/doc/developer/PromptProcessing.md +332 -82
  15. data/doc/developer/Provenance.md +402 -44
  16. data/doc/developer/Sandbox.md +213 -0
  17. data/doc/user/BuildingAgents.md +130 -18
  18. data/doc/user/Cookbook.md +29 -8
  19. data/doc/user/CoreConcepts.md +7 -6
  20. data/doc/user/Delegation.md +166 -15
  21. data/doc/user/GettingStarted.md +20 -16
  22. data/doc/user/ManagingContext.md +155 -17
  23. data/doc/user/MultiAgentWorkflows.md +105 -15
  24. data/doc/user/Python.md +11 -1
  25. data/doc/user/RunningInference.md +90 -47
  26. data/doc/user/ToolCalling.md +134 -29
  27. data/doc/user/WritingChats.md +56 -27
  28. data/lib/scout/llm/agent/attach.rb +64 -0
  29. data/lib/scout/llm/agent/chat.rb +32 -0
  30. data/lib/scout/llm/agent/construction.rb +64 -0
  31. data/lib/scout/llm/agent/conversation.rb +304 -0
  32. data/lib/scout/llm/agent/delegate.rb +56 -238
  33. data/lib/scout/llm/agent/path/edit.rb +230 -0
  34. data/lib/scout/llm/agent/path/patch.rb +252 -0
  35. data/lib/scout/llm/agent/path/workflow_kinds.rb +175 -0
  36. data/lib/scout/llm/agent/path.rb +1777 -0
  37. data/lib/scout/llm/agent/save.rb +11 -9
  38. data/lib/scout/llm/agent/workflow.rb +79 -17
  39. data/lib/scout/llm/agent.rb +151 -27
  40. data/lib/scout/llm/ask.rb +37 -27
  41. data/lib/scout/llm/backends/anthropic.rb +1 -1
  42. data/lib/scout/llm/backends/bedrock.rb +3 -2
  43. data/lib/scout/llm/backends/default.rb +131 -32
  44. data/lib/scout/llm/backends/glm.rb +28 -1
  45. data/lib/scout/llm/backends/huggingface.rb +1 -1
  46. data/lib/scout/llm/backends/ollama.rb +1 -1
  47. data/lib/scout/llm/backends/openai.rb +7 -6
  48. data/lib/scout/llm/backends/openwebui.rb +14 -7
  49. data/lib/scout/llm/backends/relay.rb +8 -2
  50. data/lib/scout/llm/chat/agent_meta.rb +24 -60
  51. data/lib/scout/llm/chat/parse.rb +1 -1
  52. data/lib/scout/llm/chat/process/files.rb +10 -0
  53. data/lib/scout/llm/chat/process/meta.rb +5 -7
  54. data/lib/scout/llm/chat/process/tools.rb +104 -52
  55. data/lib/scout/llm/chat/prompt/epoch_tool_compactation.rb +355 -0
  56. data/lib/scout/llm/chat/prompt/inbox.rb +188 -0
  57. data/lib/scout/llm/chat/prompt/shorten_tools.rb +797 -13
  58. data/lib/scout/llm/chat/prompt/shorten_tools_epoch.rb +1 -365
  59. data/lib/scout/llm/chat/prompt/shorten_tools_epoch_increment.rb +1 -0
  60. data/lib/scout/llm/chat/prompt.rb +24 -10
  61. data/lib/scout/llm/chat/provenance/live.rb +1080 -0
  62. data/lib/scout/llm/chat/provenance/tokens.rb +386 -0
  63. data/lib/scout/llm/chat/provenance.rb +352 -626
  64. data/lib/scout/llm/chat.rb +8 -2
  65. data/lib/scout/llm/embed.rb +15 -3
  66. data/lib/scout/llm/image.rb +4 -1
  67. data/lib/scout/llm/mcp.rb +4 -2
  68. data/lib/scout/llm/request_context.rb +234 -0
  69. data/lib/scout/llm/sandbox.rb +263 -0
  70. data/lib/scout/llm/tools/call.rb +163 -42
  71. data/lib/scout/llm/tools/definition.rb +48 -0
  72. data/lib/scout/llm/tools/knowledge_base.rb +1 -0
  73. data/lib/scout/llm/tools/mcp.rb +50 -43
  74. data/lib/scout/llm/tools/workflow.rb +90 -20
  75. data/lib/scout/llm/tools.rb +14 -41
  76. data/lib/scout/model/decision/base.rb +43 -0
  77. data/lib/scout/model/decision/jev.rb +161 -0
  78. data/lib/scout/model/python/torch.rb +1 -1
  79. data/research/clear-tools-inherit.md +171 -0
  80. data/research/path-engine-dc1-dc2-dc3-fixes.md +279 -0
  81. data/research/path-kind-chat-role.md +96 -0
  82. data/research/path-kind-contract-fixes-engine.md +307 -0
  83. data/research/scout-ai-runtime-availability.md +65 -0
  84. data/research/subsys/README.md +127 -0
  85. data/research/subsys/agent-delegation.md +201 -0
  86. data/research/subsys/agent-society.md +275 -0
  87. data/research/subsys/agentworkflow.md +233 -0
  88. data/research/subsys/backends.md +221 -0
  89. data/research/subsys/chat.md +314 -0
  90. data/research/subsys/embed-image.md +244 -0
  91. data/research/subsys/entry-cli.md +253 -0
  92. data/research/subsys/model-ml.md +326 -0
  93. data/research/subsys/provenance.md +290 -0
  94. data/research/subsys/tools.md +334 -0
  95. data/scout-ai.gemspec +72 -26
  96. data/scout_commands/agent/ask +8 -7
  97. data/scout_commands/llm/abridged +40 -0
  98. data/scout_commands/llm/ask +9 -9
  99. data/scout_commands/llm/md +2 -0
  100. data/scout_commands/llm/prov +845 -80
  101. data/scout_commands/llm/word +4 -0
  102. data/share/word/reference.docx +0 -0
  103. data/test/integration/scout/model/decision/test_jev.rb +144 -0
  104. data/test/scout/llm/agent/test_attach.rb +117 -0
  105. data/test/scout/llm/agent/test_conversation.rb +407 -0
  106. data/test/scout/llm/agent/test_delegate.rb +209 -0
  107. data/test/scout/llm/agent/test_path.rb +1812 -0
  108. data/test/scout/llm/agent/test_path_edit.rb +908 -0
  109. data/test/scout/llm/agent/test_path_errors.rb +390 -0
  110. data/test/scout/llm/agent/test_path_filesystem.rb +532 -0
  111. data/test/scout/llm/agent/test_path_patch.rb +233 -0
  112. data/test/scout/llm/agent/test_path_promotion.rb +386 -0
  113. data/test/scout/llm/agent/test_path_workflow_integration.rb +665 -0
  114. data/test/scout/llm/agent/test_save.rb +70 -15
  115. data/test/scout/llm/agent/test_workflow.rb +130 -4
  116. data/test/scout/llm/backends/test_anthropic.rb +4 -4
  117. data/test/scout/llm/backends/test_bedrock.rb +4 -4
  118. data/test/scout/llm/backends/test_format_other.rb +43 -0
  119. data/test/scout/llm/backends/test_ollama.rb +2 -2
  120. data/test/scout/llm/backends/test_openwebui.rb +12 -8
  121. data/test/scout/llm/backends/test_reasoning.rb +114 -0
  122. data/test/scout/llm/chat/agent_meta_fixtures.rb +109 -22
  123. data/test/scout/llm/chat/prompt/test_epoch_tool_compactation.rb +612 -0
  124. data/test/scout/llm/chat/prov_plot_fixtures.rb +131 -0
  125. data/test/scout/llm/chat/test_agent_meta.rb +40 -80
  126. data/test/scout/llm/chat/test_agent_meta_provenance.rb +200 -28
  127. data/test/scout/llm/chat/test_agent_meta_tokens.rb +112 -7
  128. data/test/scout/llm/chat/test_agent_view.rb +178 -0
  129. data/test/scout/llm/chat/test_live_report.rb +282 -0
  130. data/test/scout/llm/chat/test_live_workload.rb +193 -0
  131. data/test/scout/llm/chat/test_parse.rb +32 -2
  132. data/test/scout/llm/chat/test_prompt.rb +411 -0
  133. data/test/scout/llm/chat/test_prov_cli.rb +708 -13
  134. data/test/scout/llm/chat/test_prov_cli_live.rb +152 -0
  135. data/test/scout/llm/chat/test_prov_plot.rb +213 -0
  136. data/test/scout/llm/chat/test_prov_timeline.rb +355 -0
  137. data/test/scout/llm/chat/test_provenance.rb +67 -22
  138. data/test/scout/llm/chat/test_provenance_index.rb +479 -0
  139. data/test/scout/llm/chat/test_society_view.rb +159 -0
  140. data/test/scout/llm/test_agent.rb +1 -1
  141. data/test/scout/llm/test_embed.rb +103 -1
  142. data/test/scout/llm/test_request_context.rb +299 -0
  143. data/test/scout/llm/test_sandbox.rb +249 -0
  144. data/test/scout/llm/tools/test_agent_pairing.rb +150 -0
  145. data/test/scout/llm/tools/test_call_delegation_conflict.rb +316 -0
  146. data/test/scout/llm/tools/test_definition.rb +332 -0
  147. data/test/scout/llm/tools/test_jobs_file.rb +211 -0
  148. data/test/scout/llm/tools/test_mcp.rb +37 -8
  149. data/test/scout/llm/tools/test_workflow.rb +45 -1
  150. data/test/scout/model/decision/test_jev.rb +453 -0
  151. data/test/scout/model/python/huggingface/causal/test_next_token.rb +7 -10
  152. data/test/scout/model/python/huggingface/test_causal.rb +11 -2
  153. data/test/scout/model/python/huggingface/test_classification.rb +5 -3
  154. data/test/scout/model/python/test_availability.rb +116 -0
  155. data/test/scout/model/python/test_torch.rb +54 -2
  156. data/test/support/availability.rb +72 -174
  157. data/test/support/fake_clients.rb +18 -9
  158. data/test/support/fixtures.rb +75 -6
  159. data/test/support/mock_backend.rb +9 -1
  160. data/test/support/test_fixtures.rb +156 -0
  161. data/test/test_helper.rb +14 -4
  162. metadata +71 -25
  163. data/research/ChatAnalyst-required-changes.md +0 -167
  164. data/research/agent-delegation-analysis.md +0 -810
  165. data/research/agent-meta-provenance-integration-plan.md +0 -622
  166. data/research/agent-workflow-analysis.md +0 -1120
  167. data/research/backends-analysis.md +0 -836
  168. data/research/chat-core-analysis.md +0 -946
  169. data/research/chatanalyst-provenance/00-baseline.md +0 -30
  170. data/research/chatanalyst-provenance/01-repo-map.md +0 -60
  171. data/research/chatanalyst-provenance/02-event-reconstruction.md +0 -55
  172. data/research/chatanalyst-provenance/03-duplication-evidence.md +0 -45
  173. data/research/chatanalyst-provenance/04-tooling-root-cause.md +0 -57
  174. data/research/chatanalyst-provenance/05-fix-plan.md +0 -46
  175. data/research/chatanalyst-provenance/07-critic-review.md +0 -25
  176. data/research/chatanalyst-provenance/final-report.md +0 -45
  177. data/research/chatanalyst-provenance/resumption.md +0 -37
  178. data/research/coding-philosophy-analysis.md +0 -928
  179. data/research/commands-analysis.md +0 -947
  180. data/research/multi-agent-patterns-analysis.md +0 -853
  181. data/research/prompt-strategies-analysis.md +0 -630
  182. data/research/prov-verbosity-fix-notes.md +0 -77
  183. data/research/provenance-analysis.md +0 -469
  184. data/research/synthesis-report.md +0 -487
  185. data/research/tools-system-analysis.md +0 -779
@@ -0,0 +1,156 @@
1
+ require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
2
+ require 'tmpdir'
3
+ require 'fileutils'
4
+
5
+ # Focused tests for the recorded-payload fixture loader itself
6
+ # (TestFixtures.fixture / TestFixtures.fixture_path in
7
+ # test/support/fixtures.rb), covering the loader contract that the
8
+ # provider backend tests rely on:
9
+ #
10
+ # * nested relative resolution rooted at test/fixtures
11
+ # * traversal rejection (`../`, absolute references, symlink escapes)
12
+ # * honest errors for missing files and invalid JSON
13
+ #
14
+ # The traversal cases run against a temporary root injected through the
15
+ # `root:` argument so no symlink or junk file is ever created inside
16
+ # test/fixtures; the real root is only read.
17
+ class TestFixturesLoader < Test::Unit::TestCase
18
+ def write_fixture(root, rel, content)
19
+ path = File.join(root, rel)
20
+ FileUtils.mkdir_p(File.dirname(path))
21
+ File.write(path, content)
22
+ path
23
+ end
24
+
25
+ def with_fixture_root(&block)
26
+ TmpFile.with_dir do |dir|
27
+ block.yield File.join(dir, 'fixtures')
28
+ end
29
+ end
30
+
31
+ # The real recorded payloads resolve through the shipped root.
32
+ def test_real_root_is_test_fixtures
33
+ assert_equal File.expand_path('test/fixtures', repo_root),
34
+ File.expand_path(TestFixtures::FIXTURES_DIR)
35
+ end
36
+
37
+ def test_loads_real_recorded_payload
38
+ payload = TestFixtures.fixture('backends/openai_chat')
39
+ assert_equal 'Mock answer from Chat Completions',
40
+ payload.dig('choices', 0, 'message', 'content')
41
+ end
42
+
43
+ def test_nested_relative_resolution
44
+ with_fixture_root do |root|
45
+ write_fixture(root, 'deep/nested/payload.json', '{"ok": true}')
46
+ assert_equal({'ok' => true}, TestFixtures.fixture('deep/nested/payload', root: root))
47
+ assert_equal File.join(root, 'deep', 'nested', 'payload.json'),
48
+ TestFixtures.fixture_path('deep/nested/payload', root: root)
49
+ end
50
+ end
51
+
52
+ def test_fixture_path_appends_json_and_normalizes
53
+ with_fixture_root do |root|
54
+ assert_equal File.join(root, 'a', 'b.json'),
55
+ TestFixtures.fixture_path('a/b', root: root)
56
+ # redundant-but-inside segments stay inside the root
57
+ assert_equal File.join(root, 'a', 'b.json'),
58
+ TestFixtures.fixture_path('./a/b', root: root)
59
+ end
60
+ end
61
+
62
+ def test_missing_file_raises_fixture_error_naming_the_path
63
+ with_fixture_root do |root|
64
+ e = assert_raise(TestFixtures::FixtureError) do
65
+ TestFixtures.fixture('backends/no_such_fixture', root: root)
66
+ end
67
+ assert_include e.message, 'backends/no_such_fixture'
68
+ assert_include e.message, File.join(root, 'backends', 'no_such_fixture.json')
69
+ end
70
+ end
71
+
72
+ def test_invalid_json_raises_fixture_error_naming_the_path
73
+ with_fixture_root do |root|
74
+ write_fixture(root, 'broken.json', '{"a": [1, 2')
75
+ e = assert_raise(TestFixtures::FixtureError) do
76
+ TestFixtures.fixture('broken', root: root)
77
+ end
78
+ assert_include e.message, 'invalid JSON'
79
+ assert_include e.message, File.join(root, 'broken.json')
80
+ end
81
+ end
82
+
83
+ def test_empty_reference_rejected
84
+ with_fixture_root do |root|
85
+ e = assert_raise(TestFixtures::FixtureError) { TestFixtures.fixture_path('', root: root) }
86
+ assert_include e.message, 'invalid fixture reference'
87
+ end
88
+ end
89
+
90
+ def test_dot_dot_traversal_rejected
91
+ with_fixture_root do |root|
92
+ %w[../secret ../secret.json a/../.. backends/../../secret].each do |ref|
93
+ e = assert_raise(TestFixtures::FixtureError) { TestFixtures.fixture_path(ref, root: root) }
94
+ assert_include e.message, 'escapes the fixtures root'
95
+ end
96
+ end
97
+ end
98
+
99
+ def test_absolute_reference_rejected
100
+ with_fixture_root do |root|
101
+ [File.join(root, 'absolute'), '/etc/passwd'].each do |ref|
102
+ e = assert_raise(TestFixtures::FixtureError) { TestFixtures.fixture_path(ref, root: root) }
103
+ assert_include e.message, 'absolute fixture reference rejected'
104
+ end
105
+ end
106
+ end
107
+
108
+ # A `..` segment alone must be refused even when lexical normalization
109
+ # would land back inside the root (e.g. `a/../b`): the loader's rule is
110
+ # "no `..` segments at all", which is stricter and simpler to reason
111
+ # about than tracking normalized escapes only.
112
+ def test_dot_dot_segment_rejected_even_when_it_stays_inside
113
+ with_fixture_root do |root|
114
+ write_fixture(root, 'a/b.json', '{"ok": true}')
115
+ assert_raise(TestFixtures::FixtureError) do
116
+ TestFixtures.fixture('a/../a/b', root: root)
117
+ end
118
+ end
119
+ end
120
+
121
+ def test_symlink_escape_rejected
122
+ with_fixture_root do |root|
123
+ TmpFile.with_file do |outside|
124
+ File.write(outside, '{"leaked": true}')
125
+ FileUtils.mkdir_p(root)
126
+ File.symlink(outside, File.join(root, 'leak.json'))
127
+ e = assert_raise(TestFixtures::FixtureError) do
128
+ TestFixtures.fixture('leak', root: root)
129
+ end
130
+ assert_include e.message, 'symlink'
131
+ end
132
+ end
133
+ end
134
+
135
+ def test_symlink_inside_the_root_is_allowed
136
+ with_fixture_root do |root|
137
+ write_fixture(root, 'real.json', '{"ok": true}')
138
+ File.symlink('real.json', File.join(root, 'alias.json'))
139
+ assert_equal({'ok' => true}, TestFixtures.fixture('alias', root: root))
140
+ end
141
+ end
142
+
143
+ def test_directory_target_reports_missing_file
144
+ with_fixture_root do |root|
145
+ FileUtils.mkdir_p(File.join(root, 'dir.json'))
146
+ e = assert_raise(TestFixtures::FixtureError) do
147
+ TestFixtures.fixture('dir', root: root)
148
+ end
149
+ assert_include e.message, 'not found'
150
+ end
151
+ end
152
+
153
+ def repo_root
154
+ File.expand_path('../..', __dir__)
155
+ end
156
+ end
data/test/test_helper.rb CHANGED
@@ -11,6 +11,11 @@ require File.join(File.dirname(__FILE__), 'support', 'fixtures')
11
11
  require File.join(File.dirname(__FILE__), 'support', 'mock_backend')
12
12
  require File.join(File.dirname(__FILE__), 'support', 'fake_clients')
13
13
  require File.join(File.dirname(__FILE__), 'support', 'availability')
14
+ # Opt-in scout-essentials shared test helpers (Assertions module). The
15
+ # availability support above pulls only 'scout/testing/availability'
16
+ # (the generic primitives) through scout-rig; 'scout/testing' itself is
17
+ # required here for Scout::Testing::Assertions.
18
+ require 'scout/testing'
14
19
 
15
20
  # ScoutCoder: Scout.etc.AI['name'] resolves through the Scout path maps, and
16
21
  # the first map in Scout.map_order wins. Scout.prepend_path(:name, map) adds
@@ -32,15 +37,20 @@ Scout.prepend_path :test_etc, File.join(File.expand_path(File.dirname(__FILE__))
32
37
  # inference service can be reached from `rake test`.
33
38
  Scout::Config.set({backend: :mock}, :ask, :llm)
34
39
  Scout::Config.set({backend: :mock}, :embed, :llm)
40
+ Scout::Config.set({intent: :false}, :tool, :agent, :tools)
35
41
 
36
42
  class Test::Unit::TestCase
37
43
 
38
- def assert_equal_path(path1, path2)
39
- assert_equal File.expand_path(path1), File.expand_path(path2)
40
- end
44
+ # Scout::Testing::Assertions (scout-essentials, opt-in via the require
45
+ # above) provides assert_equal_path - replacing the former hand-rolled,
46
+ # byte-equivalent copy that lived here - plus assert_path_exists.
47
+ # The tmpdir / fixture_path / with_isolated_state helpers are NOT adopted:
48
+ # they would restructure this bootstrap rather than replace duplication
49
+ # (see tmp/notes/availability-workstream.md).
50
+ include Scout::Testing::Assertions
41
51
 
42
52
  def self.tmpdir
43
- @@tmpdir ||= Path.setup('tmp/test_tmpdir').find
53
+ @@tmpdir ||= Path.setup('tmp/test_tmpdir_scout_ai').find
44
54
  end
45
55
 
46
56
  def tmpdir
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
@@ -105,8 +105,10 @@ files:
105
105
  - doc/developer/ChatLifecycle.md
106
106
  - doc/developer/DelegationInternals.md
107
107
  - doc/developer/DesignPrinciples.md
108
+ - doc/developer/PathEngine.md
108
109
  - doc/developer/PromptProcessing.md
109
110
  - doc/developer/Provenance.md
111
+ - doc/developer/Sandbox.md
110
112
  - doc/user/BuildingAgents.md
111
113
  - doc/user/Cookbook.md
112
114
  - doc/user/CoreConcepts.md
@@ -120,9 +122,16 @@ files:
120
122
  - doc/user/WritingChats.md
121
123
  - lib/scout-ai.rb
122
124
  - lib/scout/llm/agent.rb
125
+ - lib/scout/llm/agent/attach.rb
123
126
  - lib/scout/llm/agent/chat.rb
127
+ - lib/scout/llm/agent/construction.rb
128
+ - lib/scout/llm/agent/conversation.rb
124
129
  - lib/scout/llm/agent/delegate.rb
125
130
  - lib/scout/llm/agent/iterate.rb
131
+ - lib/scout/llm/agent/path.rb
132
+ - lib/scout/llm/agent/path/edit.rb
133
+ - lib/scout/llm/agent/path/patch.rb
134
+ - lib/scout/llm/agent/path/workflow_kinds.rb
126
135
  - lib/scout/llm/agent/save.rb
127
136
  - lib/scout/llm/agent/workflow.rb
128
137
  - lib/scout/llm/ask.rb
@@ -149,21 +158,31 @@ files:
149
158
  - lib/scout/llm/chat/process/options.rb
150
159
  - lib/scout/llm/chat/process/tools.rb
151
160
  - lib/scout/llm/chat/prompt.rb
161
+ - lib/scout/llm/chat/prompt/epoch_tool_compactation.rb
162
+ - lib/scout/llm/chat/prompt/inbox.rb
152
163
  - lib/scout/llm/chat/prompt/shorten_tools.rb
153
164
  - lib/scout/llm/chat/prompt/shorten_tools_epoch.rb
165
+ - lib/scout/llm/chat/prompt/shorten_tools_epoch_increment.rb
154
166
  - lib/scout/llm/chat/provenance.rb
167
+ - lib/scout/llm/chat/provenance/live.rb
168
+ - lib/scout/llm/chat/provenance/tokens.rb
155
169
  - lib/scout/llm/chat/tool_calls.rb
156
170
  - lib/scout/llm/embed.rb
157
171
  - lib/scout/llm/image.rb
158
172
  - lib/scout/llm/mcp.rb
159
173
  - lib/scout/llm/rag.rb
174
+ - lib/scout/llm/request_context.rb
175
+ - lib/scout/llm/sandbox.rb
160
176
  - lib/scout/llm/tools.rb
161
177
  - lib/scout/llm/tools/call.rb
178
+ - lib/scout/llm/tools/definition.rb
162
179
  - lib/scout/llm/tools/knowledge_base.rb
163
180
  - lib/scout/llm/tools/mcp.rb
164
181
  - lib/scout/llm/tools/workflow.rb
165
182
  - lib/scout/llm/utils.rb
166
183
  - lib/scout/model/base.rb
184
+ - lib/scout/model/decision/base.rb
185
+ - lib/scout/model/decision/jev.rb
167
186
  - lib/scout/model/python/base.rb
168
187
  - lib/scout/model/python/huggingface.rb
169
188
  - lib/scout/model/python/huggingface/causal.rb
@@ -199,34 +218,28 @@ files:
199
218
  - python/tests/test_chat_agent.py
200
219
  - python/tests/test_huggingface_eval.py
201
220
  - python/tests/test_runner.py
202
- - research/ChatAnalyst-required-changes.md
203
- - research/agent-delegation-analysis.md
204
- - research/agent-meta-provenance-integration-plan.md
205
- - research/agent-workflow-analysis.md
206
- - research/backends-analysis.md
207
- - research/chat-core-analysis.md
208
- - research/chatanalyst-provenance/00-baseline.md
209
- - research/chatanalyst-provenance/01-repo-map.md
210
- - research/chatanalyst-provenance/02-event-reconstruction.md
211
- - research/chatanalyst-provenance/03-duplication-evidence.md
212
- - research/chatanalyst-provenance/04-tooling-root-cause.md
213
- - research/chatanalyst-provenance/05-fix-plan.md
214
- - research/chatanalyst-provenance/07-critic-review.md
215
- - research/chatanalyst-provenance/final-report.md
216
- - research/chatanalyst-provenance/resumption.md
217
- - research/coding-philosophy-analysis.md
218
- - research/commands-analysis.md
219
- - research/multi-agent-patterns-analysis.md
220
- - research/prompt-strategies-analysis.md
221
- - research/prov-verbosity-fix-notes.md
222
- - research/provenance-analysis.md
221
+ - research/clear-tools-inherit.md
222
+ - research/path-engine-dc1-dc2-dc3-fixes.md
223
+ - research/path-kind-chat-role.md
224
+ - research/path-kind-contract-fixes-engine.md
223
225
  - research/provenance-navigation-design.md
224
- - research/synthesis-report.md
225
- - research/tools-system-analysis.md
226
+ - research/scout-ai-runtime-availability.md
227
+ - research/subsys/README.md
228
+ - research/subsys/agent-delegation.md
229
+ - research/subsys/agent-society.md
230
+ - research/subsys/agentworkflow.md
231
+ - research/subsys/backends.md
232
+ - research/subsys/chat.md
233
+ - research/subsys/embed-image.md
234
+ - research/subsys/entry-cli.md
235
+ - research/subsys/model-ml.md
236
+ - research/subsys/provenance.md
237
+ - research/subsys/tools.md
226
238
  - scout-ai.gemspec
227
239
  - scout_commands/agent/ask
228
240
  - scout_commands/agent/find
229
241
  - scout_commands/agent/kb
242
+ - scout_commands/llm/abridged
230
243
  - scout_commands/llm/ask
231
244
  - scout_commands/llm/json
232
245
  - scout_commands/llm/md
@@ -264,41 +277,73 @@ files:
264
277
  - test/integration/scout/llm/test_infrastructure.rb
265
278
  - test/integration/scout/llm/test_mcp.rb
266
279
  - test/integration/scout/llm/tools/test_mcp.rb
280
+ - test/integration/scout/model/decision/test_jev.rb
267
281
  - test/integration/scout/model/test_base.rb
282
+ - test/scout/llm/agent/test_attach.rb
268
283
  - test/scout/llm/agent/test_chat.rb
284
+ - test/scout/llm/agent/test_conversation.rb
285
+ - test/scout/llm/agent/test_delegate.rb
286
+ - test/scout/llm/agent/test_path.rb
287
+ - test/scout/llm/agent/test_path_edit.rb
288
+ - test/scout/llm/agent/test_path_errors.rb
289
+ - test/scout/llm/agent/test_path_filesystem.rb
290
+ - test/scout/llm/agent/test_path_patch.rb
291
+ - test/scout/llm/agent/test_path_promotion.rb
292
+ - test/scout/llm/agent/test_path_workflow_integration.rb
269
293
  - test/scout/llm/agent/test_save.rb
270
294
  - test/scout/llm/agent/test_workflow.rb
271
295
  - test/scout/llm/backends/test_anthropic.rb
272
296
  - test/scout/llm/backends/test_bedrock.rb
297
+ - test/scout/llm/backends/test_format_other.rb
273
298
  - test/scout/llm/backends/test_huggingface.rb
274
299
  - test/scout/llm/backends/test_ollama.rb
275
300
  - test/scout/llm/backends/test_openwebui.rb
301
+ - test/scout/llm/backends/test_reasoning.rb
276
302
  - test/scout/llm/backends/test_relay.rb
277
303
  - test/scout/llm/chat/agent_meta_fixtures.rb
278
304
  - test/scout/llm/chat/process/test_meta.rb
279
305
  - test/scout/llm/chat/process/test_normalize_usage.rb
306
+ - test/scout/llm/chat/prompt/test_epoch_tool_compactation.rb
307
+ - test/scout/llm/chat/prov_plot_fixtures.rb
280
308
  - test/scout/llm/chat/test_agent_meta.rb
281
309
  - test/scout/llm/chat/test_agent_meta_provenance.rb
282
310
  - test/scout/llm/chat/test_agent_meta_tokens.rb
311
+ - test/scout/llm/chat/test_agent_view.rb
312
+ - test/scout/llm/chat/test_live_report.rb
313
+ - test/scout/llm/chat/test_live_workload.rb
283
314
  - test/scout/llm/chat/test_parse.rb
284
315
  - test/scout/llm/chat/test_process.rb
316
+ - test/scout/llm/chat/test_prompt.rb
285
317
  - test/scout/llm/chat/test_prov_cli.rb
318
+ - test/scout/llm/chat/test_prov_cli_live.rb
319
+ - test/scout/llm/chat/test_prov_plot.rb
320
+ - test/scout/llm/chat/test_prov_timeline.rb
286
321
  - test/scout/llm/chat/test_provenance.rb
322
+ - test/scout/llm/chat/test_provenance_index.rb
323
+ - test/scout/llm/chat/test_society_view.rb
287
324
  - test/scout/llm/chat/test_tool_calls.rb
288
325
  - test/scout/llm/test_agent.rb
289
326
  - test/scout/llm/test_ask.rb
290
327
  - test/scout/llm/test_chat.rb
291
328
  - test/scout/llm/test_embed.rb
292
329
  - test/scout/llm/test_rag.rb
330
+ - test/scout/llm/test_request_context.rb
331
+ - test/scout/llm/test_sandbox.rb
293
332
  - test/scout/llm/test_tools.rb
294
333
  - test/scout/llm/test_utils.rb
334
+ - test/scout/llm/tools/test_agent_pairing.rb
295
335
  - test/scout/llm/tools/test_call.rb
336
+ - test/scout/llm/tools/test_call_delegation_conflict.rb
337
+ - test/scout/llm/tools/test_definition.rb
338
+ - test/scout/llm/tools/test_jobs_file.rb
296
339
  - test/scout/llm/tools/test_knowledge_base.rb
297
340
  - test/scout/llm/tools/test_mcp.rb
298
341
  - test/scout/llm/tools/test_workflow.rb
342
+ - test/scout/model/decision/test_jev.rb
299
343
  - test/scout/model/python/huggingface/causal/test_next_token.rb
300
344
  - test/scout/model/python/huggingface/test_causal.rb
301
345
  - test/scout/model/python/huggingface/test_classification.rb
346
+ - test/scout/model/python/test_availability.rb
302
347
  - test/scout/model/python/test_base.rb
303
348
  - test/scout/model/python/test_huggingface.rb
304
349
  - test/scout/model/python/test_torch.rb
@@ -313,6 +358,7 @@ files:
313
358
  - test/support/fixtures.rb
314
359
  - test/support/infrastructure_probes.rb
315
360
  - test/support/mock_backend.rb
361
+ - test/support/test_fixtures.rb
316
362
  - test/test_helper.rb
317
363
  homepage: http://github.com/mikisvaz/scout-ai
318
364
  licenses:
@@ -332,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
378
  - !ruby/object:Gem::Version
333
379
  version: '0'
334
380
  requirements: []
335
- rubygems_version: 3.7.2
381
+ rubygems_version: 4.0.23
336
382
  specification_version: 4
337
383
  summary: AI gear for scouts
338
384
  test_files: []
@@ -1,167 +0,0 @@
1
- # ChatAnalyst — required changes for the new scout-ai save layout
2
-
3
- Commentary only (NOT an implementation plan executed here). Grounded in the
4
- actual files of `/home/mvazque2/git/workflows/ChatAnalyst` (workflow.rb,
5
- README.md, test/, tmp/ verify scripts) and in the scout-ai changes of steps
6
- 1-3b (artifacts `var/cortex/artifacts/society-save/*.md`).
7
-
8
- New layout recap: `<chat>.files/<name>.chat` (`agent.chat` default,
9
- `worker.chat` for named), society tree `<name>.society/<Agent>/<conv>/agent.chat`
10
- (plain `society` sibling at depth >= 1). Legacy `.files/log/**` stays readable,
11
- never written, never migrated.
12
-
13
- ## 1. What already works for free (no change needed)
14
-
15
- `workflow.rb` contains **no layout hardcoding at all**. Its only `.files`
16
- mention is a comment in `helper :resolve_root` ("a `.files` directory alone is
17
- not evidence: saved agent chats carry one too. Only the `.info` test decides,
18
- and the chat branch then relies on scout-ai provenance to scan the sidecar"),
19
- and that reasoning is layout-independent and still correct: the new layout
20
- also gives saved chats a `.files` dir without `.info`, while jobs keep `.info`.
21
-
22
- All discovery goes through the shared scout-ai APIs, which are now
23
- dual-layout:
24
-
25
- - `Chat.provenance_token_events` / `Chat.provenance_edges` /
26
- `Chat.provenance_chat_files` / `Chat.provenance_jobs` (called in
27
- `helper :provenance_data`, lines ~194-228) all wrap
28
- `Chat.traverse_provenance`, which now globs `*.files/*.chat`,
29
- `*.files/*.society/**/*.chat` and the legacy `*.files/log/**/*.chat`,
30
- de-duplicated and sorted;
31
- - job-vs-chat classification, the root-copy exclusion
32
- (`Chat.direct_chat_sidecar_files`) and the `:log` relation semantics live in
33
- scout-ai (`lib/scout/llm/chat/provenance.rb`), not here;
34
- - no task input consumes a log path, no task globs `.files` itself
35
- (`grep -n "task :"` shows only `file/ids/role/…` inputs; the only path
36
- computation is `resolve_root`, which resolves a *chat or job path*, never a
37
- log path);
38
- - `short_path` only collapses `$HOME`, so the longer
39
- `<name>.society/<Agent>/<conv>/agent.chat` paths just render fully — no
40
- truncation or matching by suffix anywhere.
41
-
42
- Consequence: every task that takes a chat or job root (message_index,
43
- message_content, chat_overview, chat_tool_calls, chat_tokens, chat_agents,
44
- meta_evidence, chat_reasoning, chat_report, provenance_relationships,
45
- chat_accounting) keeps working on chats produced by the new layout, and on
46
- mixed old+new trees, with zero code change.
47
-
48
- ## 2. What WOULD break (if scout-ai had not been dual-layout)
49
-
50
- Nothing in ChatAnalyst hardcodes `log/`, so nothing breaks outright. The
51
- failure mode the scout-ai change guards against — and which ChatAnalyst would
52
- have inherited if it had hardcoded anything — is:
53
-
54
- - assuming society chats live under `.files/log/society/...`: a glob or
55
- regex pinned to that prefix would silently find nothing in new trees;
56
- - assuming a chat's own copy is exactly `<chat>.files/log/agent.chat`: the
57
- new equivalent is any top-level `<chat>.files/<name>.chat` (and named agents
58
- write `<name>.chat`);
59
- - assuming `resets/` is the only sibling of `log/`: in the new layout the
60
- society dir is `<name>.society`, so any "everything under `.files` except
61
- `resets`" sweep would now also pick up society trees twice.
62
-
63
- ## 3. README is outdated (real gap)
64
-
65
- `README.md` states the OLD layout as current:
66
-
67
- - line 5: "all `.files/log/**/*.chat` files — including the regular
68
- `log/agent.chat` logs";
69
- - lines 9-11: "`<chat>.files/log/society/<agent>/<conversation>/agent.chat`
70
- appear as chats (the chat's own root copy at `log/agent.chat` is skipped)";
71
- - line 70: `<caller_job>.files/log/chats/<AgentName>/<conversation_name>.chat`
72
- for socialized chat *projections* (this is a different, older projection
73
- mechanism that predates the society tree; it should be described as
74
- historical/legacy).
75
-
76
- Needed: describe the three glob families (`*.files/*.chat`,
77
- `*.files/*.society/**/*.chat`, legacy `*.files/log/**/*.chat` read-only), the
78
- named-file rule (`agent.chat` default, `worker.chat` for named agents), the
79
- nested plain-`society` sibling rule, and label `log/chats/…` projections and
80
- the whole `log/` layout as legacy. Recommended wording for the projection
81
- path: keep the `<caller_job>.files/log/chats/...` line but prefix it with
82
- "(legacy mechanism)" and add the current society path
83
- `<caller_job>.files/<name>.society/<AgentName>/<conversation>/agent.chat`.
84
-
85
- ## 4. Tests: keep the legacy fixtures, they are on purpose
86
-
87
- `test/scout/agent_meta_fixtures.rb` builds the OLD layout deliberately:
88
-
89
- - `make_job(..., logs: {...})` writes `<job>.files/log/<name>` — this is the
90
- **legacy job-log emulation** and must keep working: traversal stays
91
- dual-layout, so these fixtures keep passing unchanged. This is exactly the
92
- read-only compatibility guarantee step 3 added tests for
93
- (`test/scout/llm/chat/test_new_layout_provenance.rb` in scout-ai).
94
- - `make_saved_chat(...)` writes the root copy at `log/agent.chat` plus society
95
- under `log/society/<agent>/<conv>/agent.chat` — again the legacy chat
96
- sidecar shape.
97
- - `test/test_agent_meta_tasks.rb` line ~193 asserts
98
- `%r{files/log/society/Worker/default/agent\.chat}` and line ~199 counts
99
- copies matching `%r{\.files/log/agent\.chat\z}`; both still pass because
100
- the fixtures are legacy and the traversal reads legacy.
101
-
102
- What to do if new-layout coverage is ever wanted (commentary, not done here):
103
-
104
- - add `make_job`/`make_saved_chat` keyword variants (e.g. `layout: :new`) or
105
- two new builders writing `<job>.files/agent.chat` +
106
- `<job>.files/agent.society/...`, rather than changing the existing ones —
107
- the existing ones ARE the legacy coverage;
108
- - keep the regexes layout-agnostic where the intent is layout-independent,
109
- e.g. `%r{\.files/(?:agent\.society|log/society)/Worker/default/agent\.chat}`
110
- and `%r{\.files/(?:agent|log/agent)\.chat\z}`;
111
- - add one fixture where both layouts coexist in one `.files` dir to cover the
112
- de-duplication guarantee (a chat must be counted once).
113
-
114
- ## 5. tmp/ verify scripts use old-layout fixtures (scratch only)
115
-
116
- All five are one-off scratch scripts, not part of any suite:
117
-
118
- - `tmp/verify_society_dedupe.rb` — builds `base + '.files/log/society/Worker/default/agent.chat'`;
119
- - `tmp/verify_root_sidecar.rb` — root chat + `log/agent.chat` + legacy society;
120
- - `tmp/check_current_format.rb` — `job + '.files/log/agent.chat'`;
121
- - `tmp/check_resets_visibility.rb` — `root_save = job + '.files/log/agent.chat'`;
122
- - `tmp/verify_resets2.rb` — `base + '.files/log/agent.chat'` and a deliberately
123
- mis-placed `log/resets/…` snapshot to prove `resets/` under `log/` IS swept.
124
-
125
- None of them needs a fix to keep running (they still exercise the legacy
126
- read path), but note for `verify_resets2.rb`: the "hypothetical wrong
127
- placement" it tests is now doubly legacy — in the new layout a wrongly placed
128
- reset would be `<name>.society/resets/…` or a top-level `<name>.chat`-adjacent
129
- path, so if the script is ever refreshed, add the new-layout equivalents
130
- (resets next to `agent.society/`, resets next to top-level `agent.chat`) to
131
- keep the "resets are invisible" guarantee meaningful.
132
-
133
- ## 6. Task-input / tooling implications
134
-
135
- - **Inputs are unaffected.** Every task takes a chat file or job path as
136
- `file`; the new layout only changes what is *inside* `<that path>.files`.
137
- - **Consuming new-layout chats is automatic.** A chat saved by the new
138
- `scout-ai llm ask -c` / `agent ask -c` (root copy at
139
- `<chat>.files/agent.chat`, society under `<chat>.files/agent.society/…`) is
140
- resolved by `resolve_root` exactly like before, and its society
141
- conversations appear in `:chats` via the shared traversal.
142
- - **The hidden top-level `agent.chat` rule affects tooling that assumes job
143
- log visibility.** `scout-ai llm prov` hides a basename `agent.chat` whose
144
- parent is `<something>.files` or a legacy `.../log` dir, because it
145
- duplicates the job node. ChatAnalyst does NOT apply that rule — it reports
146
- every chat `provenance_chat_files` returns, including a job's own
147
- `<job>.files/agent.chat` — which is intentional there (the analyst is
148
- supposed to show the full conversation per file), but any tooling copied
149
- from `prov`'s tree renderer must replicate the hiding rule or it will show a
150
- job twice. Conversely, any tooling that assumed "a job always has a visible
151
- `log/agent.chat` child" now sees nothing under `log/` for new jobs and must
152
- look at top-level `agent.chat` / `<name>.society/` instead.
153
- - **Mixed trees are the norm during rollout.** Old `.files/log/**` next to new
154
- `*.files/*.chat` in the same dir yields a single de-duplicated visit per
155
- chat (scout-ai guarantee), so reports do not double count; ChatAnalyst's own
156
- `warning_key` deduplication of warnings is unaffected.
157
-
158
- ## 7. Summary of concrete actions (for the ChatAnalyst owner)
159
-
160
- 1. Update `README.md` sections quoted in §3 to the new layout, labeling
161
- `log/**` (and `log/chats/…` projections) as legacy/read-only. **Only real
162
- change needed.**
163
- 2. Optionally add new-layout fixtures + assertions to
164
- `test/test_agent_meta_tasks.rb` following §4 (add, do not rewrite).
165
- 3. Optionally refresh the five `tmp/verify_*` scripts per §5.
166
- 4. No `workflow.rb` change required: it is fully layout-agnostic through the
167
- shared `Chat.traverse_provenance` / `Chat.provenance_*` APIs.