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,307 @@
1
+ # Path-kind contract fixes 3 and 5 — engine round (scout-ai)
2
+
3
+ Date: 2026-10-22. Checkout: scout-ai at
4
+ `/bulk/mvazque2/git/scout-ai` (same repository as
5
+ `/home/mvazque2/git/scout-ai`), HEAD
6
+ `ee9c90c0752d7ada7f715313f3e762bc8ffca117`, nothing committed. All
7
+ changes of this round are uncommitted working-tree edits; evidence lives
8
+ under `tmp/path-kind-fix35/` in this checkout.
9
+
10
+ This is the engine-side half of the path-kind contract line. It
11
+ implements and pins two fixes that a client checkout reported out as
12
+ engine-side frictions: root-selector grammar (fix 3) and `path_kinds`
13
+ honoring its `kind` input (fix 5). The client round that reported them
14
+ is recorded in the ScoutCoder checkout
15
+ `research/path-kind-contract-fixes.md` (round 11 of that suite; not
16
+ reproduced or modified here).
17
+
18
+ ## What changed and why
19
+
20
+ The two frictions were first observed in a recorded AGS agent session and
21
+ consolidated in the Cortex review artifact
22
+ `reports/ags-path-kind-contract-friction.md` (Cortex store of the
23
+ scout-gear/AgentSuite workspace; session evidence `main.chat#37-42`,
24
+ `#44-48`, `#113-117` per the client round note). The ScoutCoder round 11
25
+ fixed its four client-side items and REPORTED the two engine-side ones
26
+ out with fresh-process reproductions; this round is that report's
27
+ discharge.
28
+
29
+ ### Fix 3 — root selectors address the kind root, never a file
30
+
31
+ Contract. The empty string, `"."` and `"./"` are ENUMERATION selectors
32
+ that address a kind's root as a whole; they are never a path to one file
33
+ inside it. The ten file-shaped built-in operations — `path_read`,
34
+ `path_write`, `path_patch`, `path_edit`, `path_move`, `path_rename`,
35
+ `path_delete`, `path_validate`, `path_smoke`, `path_promote` — reject all
36
+ three spellings at argument validation, before resolution and before
37
+ authorization, with:
38
+
39
+ ```
40
+ ParameterException: Invalid path for <operation>: "<value>" addresses
41
+ the kind root; use a path relative to the root, or path_list to
42
+ enumerate the root
43
+ ```
44
+
45
+ `path_list` is the enumeration surface and is NOT guarded: it normalizes
46
+ `""`, `"."` and `"./"` to the empty prefix and lists the kind root, exactly
47
+ like an omitted path. `path_dispatch` is NOT guarded either: custom
48
+ operations own their path grammar and may legitimately receive `"."`
49
+ (an enumeration client's suite scope does exactly that), so the raw value
50
+ passes through untouched.
51
+
52
+ Why the rejection must precede resolution: on an extension-bearing kind a
53
+ `"."` path previously resolved through `set_extension` to the junk target
54
+ `<root>/..rb`. Pre-fix behavior (from `logs/red.log`): `path_write` with
55
+ `"."` SILENTLY CREATED `<root>/..rb` (`"written"=>true`); `path_read` of
56
+ `"."` reported `Path does not exist or is not readable: <root>/..rb`;
57
+ `path_list` of `"."` returned an EMPTY list; `path_move`/`path_rename`
58
+ with `""` reported `moved=>true` or leaked raw `Errno::ENOENT` mentioning
59
+ the junk target. The guard removes the whole class of behavior, and its
60
+ message never contains the resolved junk target.
61
+
62
+ Code points (`lib/scout/llm/agent/path.rb`, current working tree):
63
+
64
+ - `ROOT_SELECTOR_PATHS = ["", ".", "./"].freeze` (line 1198);
65
+ - `path_reject_root_selector!(operation, path)` (line 1200) — raises the
66
+ ParameterException above, naming the operation that received the value;
67
+ - `path_root_selector_normalize(path)` (line 1213) — path_list's
68
+ counterpart, maps a root selector to the empty prefix;
69
+ - guard call at the top of `path_read` / `path_write` / `path_patch` /
70
+ `path_move` / `path_rename` / `path_delete` / `path_promote`
71
+ (in `path.rb`), `path_edit` (`lib/scout/llm/agent/path/edit.rb`,
72
+ `path_edit` line ~163), and `path_kind_operation` (line 1615, which
73
+ backs `path_validate` and `path_smoke`); `path_dispatch` (line 915) and
74
+ `path_list` (line 1423) are deliberately unguarded, and `path_list`
75
+ calls the normalizer instead.
76
+
77
+ ### Fix 5 — path_kinds honors its kind input
78
+
79
+ Contract. `path_kinds` takes an optional `kind`. With no `kind`, or an
80
+ empty string, it returns one entry per registered kind (the full map, as
81
+ before). With a `kind` it returns EXACTLY that kind's entry, in the same
82
+ per-kind shape as a full-map entry (`description`, `locations`,
83
+ `default_location`, `sandbox`, `capabilities`). An unknown `kind` raises
84
+ `ParameterException: Unknown path kind: <kind> (available: <sorted kind
85
+ names>)`. The tool description was updated to say "Supply kind to return
86
+ only that kind's entry", and the tool schema exposes `kind` as an
87
+ optional enum of the registered kinds.
88
+
89
+ Pre-fix, the handler signature was `def path_kinds(_args = {})` — the
90
+ argument was discarded by the signature itself, so every call returned
91
+ the full map regardless of `kind` (client reproduction: with
92
+ `kind=entity|entity_property|test_file` and no kind, all four calls
93
+ returned `count: 4`).
94
+
95
+ Code points: `path_kinds(args = {})` and the extracted
96
+ `path_kind_registry_entry(definition)` helper (lines 1314/1330).
97
+
98
+ ## Red-to-green evidence
99
+
100
+ All logs under `tmp/path-kind-fix35/logs/` in this checkout; the probe
101
+ itself is `tmp/path-kind-fix35/probe.rb` (fresh-process, explicit inputs;
102
+ it registers an extension-bearing kind, an extension-free kind, and a
103
+ kind with a custom `peek` operation that records the raw path it
104
+ receives).
105
+
106
+ - Pre-fix (red): `logs/red.log` — 42 CHECK lines. Key failures quoted
107
+ above: `path_write ext_kind path="."` returns `NO-ERROR ... written=true`
108
+ with `target_file=<root>/..rb`; `B3` shows the junk file `..rb` now on
109
+ disk; `path_list path="."` returns `[]`; `D1` shows
110
+ `path_kinds kind=ext_kind` returning ALL THREE kinds (filter ignored);
111
+ `D2` shows `kind=missing` NOT raising.
112
+ - Post-fix (green): `logs/green.log` — every file-shaped op rejects every
113
+ root selector with the message naming the operation and `path_list`;
114
+ zero occurrences of `..rb` anywhere in the log; `B3`/`Z1` show the kind
115
+ root still contains only `alpha.rb` and `sub/beta.rb` (no junk file);
116
+ `C1`/`I1` show `path_list` of `"."`/`"./"` listing the root;
117
+ `D1` returns exactly `["ext_kind"]`; `D2` raises the unknown-kind
118
+ ParameterException; `E1`/`E2` show the custom operation receiving `"."`
119
+ as given.
120
+ - Independent re-run (this verification pass): `logs/verify-green.log` —
121
+ byte-identical to `green.log` modulo the tmpdir path prefix (diff of
122
+ both with the prefix normalized is empty). The suite confirms it is
123
+ reproducible in a fresh process, not a warm-state artifact.
124
+ - Unit suites: `logs/test_path_errors.log` (15 tests, 281 assertions, 0
125
+ failures, 0 errors), `logs/test_path.rb.log` (74 tests, 599 assertions,
126
+ 0F 0E), `logs/test_path_edit.sanity.log` (41 tests, 113 assertions, 0F
127
+ 0E, untouched-by-this-round edit suite), and `logs/rake-test.log`
128
+ (full repo suite: 695 tests, 3480 assertions, 0 failures, 0 errors,
129
+ 7 omissions — all environmental, Python/Torch modules absent; identical
130
+ omission set in the fresh verification re-run
131
+ `logs/verify-rake.log`).
132
+ - Doc round did not touch code; `logs/doc-verify.log` re-ran the two
133
+ touched suites (both green) and grepped the doc.
134
+
135
+ ## Test coverage — the seven new tests and what each pins
136
+
137
+ `test/scout/llm/agent/test_path_errors.rb` (4 new):
138
+
139
+ 1. `test_error_matrix_root_selector_rejected_by_every_file_shaped_operation`
140
+ — the full matrix: two kind shapes (extension-bearing and
141
+ extension-free) x ten file-shaped operations x the `""` and `"."`
142
+ spellings (plus `"./"` pinned on one operation per kind), asserting
143
+ the ParameterException names the operation, matches "addresses the
144
+ kind root", mentions `path_list`, and never matches `\.\.rb` (the
145
+ resolved junk target must not leak).
146
+ 2. `test_path_write_root_selector_creates_no_file` — a rejected
147
+ `path_write` with `"."` leaves the kind root empty: no `..rb`, no
148
+ `.rb`, `Dir.children` empty.
149
+ 3. `test_error_matrix_path_kinds_unknown_kind_lists_available_kinds` —
150
+ unknown kind raises `Unknown path kind: nope` and the message names an
151
+ available kind.
152
+ 4. `test_error_matrix_path_kinds_empty_kind_returns_full_map` — `kind:
153
+ ""` and `kind: nil` both enumerate everything (the filter is opt-in).
154
+
155
+ `test/scout/llm/agent/test_path.rb` (3 new):
156
+
157
+ 5. `test_path_kinds_kind_input_returns_only_that_kind` — with two kinds
158
+ registered, `kind: "other"` returns exactly `["other"]`, in the same
159
+ per-kind shape (same keys, same capabilities) as the full map's entry.
160
+ 6. `test_path_list_root_selector_lists_the_kind_root` — on a populated
161
+ extension-bearing kind, omitted path, `""`, `"."` and `"./"` all list
162
+ exactly `["alpha.rb", "sub/beta.rb"]`.
163
+ 7. `test_path_dispatch_passes_root_selector_to_custom_operation` — a
164
+ kind-defined `peek` operation receives `"."` verbatim (`["."]`
165
+ recorded) and returns `PEEK .`; the engine applies no grammar of its
166
+ own on dispatch.
167
+
168
+ ## Client regression (read-only): the ScoutCoder checkout
169
+
170
+ The AgentSuite/ScoutCoder checkout (`/bulk/mvazque2/git/AgentSuite/ScoutCoder`,
171
+ mounted read-only at `/home/mvazque2/git/AgentSuite/ScoutCoder` for this
172
+ round) loads THIS engine checkout — its before-run log carries the
173
+ evidence line
174
+ `engine path_kinds source: /home/mvazque2/git/scout-ai/lib/scout/llm/agent/path.rb:1285`,
175
+ and `/home/mvazque2/git/scout-ai` and `/bulk/mvazque2/git/scout-ai` are
176
+ the same repository. Its suite was run before and after the engine
177
+ change, read-only, from its own tree (`logs/scoutcoder-before.log`,
178
+ `logs/scoutcoder-before-full.log`, `logs/scoutcoder-after.log`,
179
+ `logs/scoutcoder-after-full.log`).
180
+
181
+ Regression statement. Both runs report IDENTICAL totals —
182
+ `test_path_kinds.rb`: 29 tests, 429 assertions; `test_path_kinds.rb` +
183
+ `test_path_kinds_roundtrip.rb`: 11 tests, 18 assertions, 0F 0E — and
184
+ IDENTICAL failure signature sets (5 signatures, names + exception
185
+ classes, compared mechanically in
186
+ `tmp/path-kind-fix35/signatures-before.txt` / `signatures-after.txt`;
187
+ md5-identical):
188
+
189
+ 1. `Failure: test_engine_authorized_set_excludes_paired_test_destination(TestPathKinds): ParameterException(<Path access denied by sandbox (outside_grants)>)` — environmental sandbox grant failure;
190
+ 2. `Failure: test_run_test_suite_scope_discovers_both_sides_and_empty_is_error(TestPathKinds)` — expects an empty-discovery error, gets the sandbox denial instead;
191
+ 3. `Failure: test_task_smoke_constructs_job_without_executing(TestPathKinds)` — `<true> expected but was <nil>`;
192
+ 4. `Error: test_test_file_list_honors_prefixes(TestPathKinds): ParameterException: Path access denied by sandbox (outside_grants)`;
193
+ 5. `Error: test_test_file_list_round_trips_virtual_paths(TestPathKinds): ParameterException: Path access denied by sandbox (outside_grants)`.
194
+
195
+ All five PREDATE this change (they are environmental: the client tests
196
+ provoke paths that fall outside the sandbox grants of the environment the
197
+ suite ran in). No signature appeared, disappeared, or changed class. The
198
+ textual differences between the full logs are: three backtrace line
199
+ shifts inside this engine file — `path.rb:1174` -> `:1175` in
200
+ `path_authorize!` (three occurrences, one per outside_grants backtrace)
201
+ and `path.rb:1387` -> `:1433` in `path_list` (two occurrences) — caused
202
+ by the new guard methods and the `path_kinds`/`path_kind_registry_entry`
203
+ restructure moving code down; the after log's additional
204
+ `test_path_kinds_roundtrip.rb` section (11 tests, 18 assertions, 0F 0E;
205
+ the summary logs already counted it), which the before run of the same
206
+ commands did not produce; and the before-log's two header comment lines.
207
+ None is a behavioral change.
208
+
209
+ The checkout was not modified by this round: `git status --porcelain`
210
+ there is unchanged relative to its own round (uncommitted client-round
211
+ edits at HEAD `bab41ebfd8eeb1d68c538e9569f0f1c01d1e2c77`, latest mtimes
212
+ 18:35 today, before this round's first artifact at 18:56), and the
213
+ engine-side evidence directory
214
+ (`/bulk/mvazque2/git/scout-ai/tmp/path-kind-fix35/`) is in THIS
215
+ repository, not that one. Note the initial probe attempt through the
216
+ `/bulk/...` spelling failed (`No such file or directory`) because the
217
+ bwrap sandbox mounts that checkout only at the `/home/...` spelling; the
218
+ read-only check succeeded through `/home/mvazque2/git/AgentSuite/ScoutCoder`.
219
+
220
+ ## Documentation changes
221
+
222
+ `doc/developer/PathEngine.md`:
223
+
224
+ - new section 8 "Root selectors address the kind root, never a file" —
225
+ the full contract, the junk-target rationale, the path_list
226
+ normalization and the path_dispatch exemption, plus the pinning tests;
227
+ - a `path_kinds` filter paragraph in section 7 (the installed tool
228
+ surface): filter, full-map on omission/empty, unknown-kind error;
229
+ - the pinned-test inventory in section 9 extended with the root-selector
230
+ rejections (section 8) and the `path_kinds` unknown-kind error
231
+ (section 7);
232
+ - the pre-existing duplicated paragraph in section 9 ("Errors follow the
233
+ engine contract: ... handlers must normalize their own failures." was
234
+ present twice back-to-back) removed in passing — one copy deleted, the
235
+ other kept verbatim. Disclosed drive-by, not part of either fix;
236
+ - sections renumbered: old 8 -> 9, old 9 -> 10, old 10 -> 11, and the
237
+ intro paragraph plus the in-file cross-reference in section 5 updated;
238
+ - `doc/Improvements.md` R16 cross-reference updated from §8 to §9.
239
+
240
+ ## Deviations from the delivered-plan-as-written
241
+
242
+ None in scope or content. Two disclosed incidental changes inside the
243
+ planned file set, both recorded by the implementing agent and confirmed
244
+ here against the diff:
245
+
246
+ - `test/scout/llm/agent/test_path_filesystem.rb`
247
+ `test_path_write_filesystem_failure_does_not_return_success` was
248
+ re-pointed: it used `path: "."` to provoke `Errno::EISDIR` from
249
+ `File.write`; the new guard rejects `"."` earlier, so the test now
250
+ creates an explicit `directory_target` directory and writes to it —
251
+ the same real write-failure path, no stubbing.
252
+ - the PathEngine.md duplicated-paragraph removal described above.
253
+
254
+ One more incidental, engine-internal: in `path_kind_operation` the guard
255
+ runs AFTER the capability check and the "has no validate/smoke
256
+ implementation" check, exactly where path resolution sat before the round
257
+ (HEAD `ee9c90c…`: capability -> implementation -> resolve -> authorize;
258
+ working tree: capability -> implementation -> guard -> resolve ->
259
+ authorize). On kinds without those implementations a root selector
260
+ therefore raises the missing-implementation error, not the root-selector
261
+ error — which is what the probe's validate/smoke lines in
262
+ `verify-green.log` show ("Path kind ext_kind has no validate/smoke
263
+ implementation", six lines), because the probe kinds genuinely lack
264
+ implementations; the matrix tests register real implementations precisely
265
+ so the guard is what their assertions observe. The guard's position
266
+ relative to the implementation check is unchanged from pre-round; this
267
+ ordering is incidental and deliberately unpinned; see open items.
268
+
269
+ ## Lineage
270
+
271
+ - Motivating review: Cortex artifact `reports/ags-path-kind-contract-friction.md`
272
+ (AgentSuite/scout-gear Cortex store) — six tool-contract frictions
273
+ observed in a recorded AGS agent session; two were engine-side.
274
+ - Reporting round: ScoutCoder checkout
275
+ `research/path-kind-contract-fixes.md` (round 11, 2026-10-22) — fixed
276
+ its four client-side items, REPORTED fixes 3 and 5 out with
277
+ fresh-process reproductions (`tmp/path-kinds-contract-fixes/logs/...`
278
+ in that checkout). This engine round discharges exactly those two
279
+ reported items, with the same contracts the report stated.
280
+ - Earlier rounds of the client line are named in that note (rounds 8/9,
281
+ 9, 10) and are not engine-side.
282
+
283
+ ## Open items
284
+
285
+ 1. The five pre-existing ScoutCoder failures/errors deserve re-baselining
286
+ by that checkout's owner: three are sandbox-grant environmental
287
+ (outside_grants), two follow from them or from that suite's
288
+ expectations (`test_task_smoke_constructs_job_without_executing`,
289
+ `test_run_test_suite_discovers_both_sides_and_empty_is_error`). They
290
+ predate this round and are unchanged by it, but they mask any future
291
+ client regression signal in `test_path_kinds.rb`.
292
+ 2. The guard-versus-missing-implementation ordering in
293
+ `path_kind_operation` (the root-selector rejection sits after the
294
+ "no validate/smoke implementation" raise, where path resolution always
295
+ was) is incidental and deliberately unpinned; if anyone wants the
296
+ opposite precedence, that is a deliberate contract decision to make
297
+ explicitly, not a bug.
298
+ 3. The drive-by paragraph deduplication in PathEngine.md section 9 could
299
+ be split out into its own change if a reviewer prefers a pure
300
+ fixes-only diff.
301
+ 4. Nothing is committed anywhere: the engine changes live as working-tree
302
+ edits at HEAD `ee9c90c0752d7ada7f715313f3e762bc8ffca117` (plus three
303
+ pre-existing uncommitted edits from earlier rounds in
304
+ `lib/scout/llm/agent.rb`, `lib/scout/llm/agent/delegate.rb`,
305
+ `lib/scout/llm/chat/process/tools.rb`, untouched by and unrelated to
306
+ this round), and the ScoutCoder checkout keeps its own uncommitted
307
+ client-round state at HEAD `bab41ebfd8eeb1d68c538e9569f0f1c01d1e2c77`.
@@ -0,0 +1,65 @@
1
+ # Scout-AI runtime availability — status note (research layer)
2
+
3
+ **Scope:** what the runtime-availability workstream investigated, what is
4
+ now established in the committed tree, and what remains open. This is the
5
+ research-layer rationale and open-question record; operational contracts
6
+ live in `doc/`, not here.
7
+
8
+ **Status:** ESTABLISHED (committed). `test/support/availability.rb` now
9
+ delegates Python/R probes to Scout-Rig (`ScoutRig::Testing::Availability`,
10
+ `scout-rig` >= 0.2.6) which itself requires Scout-Essentials
11
+ `scout/testing/availability` — commit `2ef066c` ("Delegate test
12
+ availability probes to scout-rig and scout-essentials", 2026-10-18).
13
+ Scout-AI retains its own `cuda?` (torch + usable CUDA device via
14
+ Scout-Rig's embedded-interpreter selection) and `hf_model_cached?`
15
+ (cache-only HF checks honoring `HF_HOME`/`HF_HUB_CACHE`, no HTTP); endpoint
16
+ reachability stays a TCP-only check and endpoint configuration stays
17
+ local. The original probe plan this note supersedes is
18
+ `research/scout-ai-runtime-availability-handoff.md` (Cortex, 2026-10-11) —
19
+ see "Provenance" below; the durable facts from it are restated here rather
20
+ than referenced.
21
+
22
+ ## Transitive Scout-Essentials require — current truth
23
+
24
+ The old framing ("don't claim installed-consumer support until the
25
+ transitive Scout-Essentials require is available in a reproducible package
26
+ setup") is now **largely satisfied**: `scout-ai.gemspec` depends on
27
+ `scout-rig` (>= 0), and `scout-rig` 0.2.6's own gemspec lists
28
+ `scout-essentials (> 0)` as a runtime dependency, so `gem install scout-ai`
29
+ resolves both transitively. Verified against installed gem specifications,
30
+ not just source checkouts.
31
+
32
+ Remaining caveat (the residual truth of the warning): the local test setup
33
+ also relies on `RUBYOPT` carrying `-I` paths into the `~/git` checkouts
34
+ (see `tmp/notes/availability-workstream.md`, gitignored — see "Provenance"
35
+ below), so **checkout-based runs may still load a different
36
+ scout-essentials than the installed 1.9.1 the code was verified against**.
37
+ A clean-environment (`gem-installed-only`) run has not been executed; until
38
+ one is, treat "transitive require works in a bare install" as strongly
39
+ evidenced but not directly exercised.
40
+
41
+ ## Open questions
42
+
43
+ 1. Does the full suite pass in a clean environment with only the installed
44
+ gems (no `RUBYOPT` checkout overrides)? Record counts vs the baseline in
45
+ `tmp/notes/cleanup/disposition.md` §7.
46
+ 2. `hf_model_cached?` honoring of `HF_HUB_CACHE` vs `HF_HOME` precedence —
47
+ unit-tested locally, but no probe against a real populated cache has
48
+ been recorded.
49
+ 3. R-runtime probes are Scout-Rig-delegated only; no scout-ai test
50
+ exercises an R route (acknowledged no-implied-coverage in
51
+ `test/support/availability.rb`'s header comment).
52
+
53
+ ## Provenance
54
+
55
+ - Cortex handoff (pre-implementation): `research/scout-ai-runtime-availability-handoff.md`
56
+ (Cortex store map `current`, 2026-10-11) — investigated only; it must not
57
+ be cited as implementation evidence (its own header says so).
58
+ - Implementation: commit `2ef066c` (files: `test/support/availability.rb`,
59
+ test files updated in the same commit), building on the earlier
60
+ mock-isolation groundwork `71c9df6` (2026-08-21, two months before).
61
+ - Ephemeral probe scratch: `tmp/notes/availability-workstream.md`,
62
+ `tmp/notes/availability_probe.{rb,out}`, `tmp/notes/python-prereq-audit.md`
63
+ — **`tmp/` is gitignored ephemeral scratch**; this note carries the
64
+ durable facts itself precisely so they do not depend on those files
65
+ surviving. Do not cite `tmp/notes/*` as durable evidence.
@@ -0,0 +1,127 @@
1
+ # scout-ai subsystem studies
2
+
3
+ Ten curated subsystem studies of the scout-ai repository, promoted from the
4
+ 2026-09-10/11 Cortex subsystem studies. Each file records **verified
5
+ behavior** (data model, invariants, APIs, flows, exact semantics), the
6
+ **still-open sharp edges**, open questions, and the evidence anchors
7
+ (file:line references against this checkout plus probe receipts).
8
+
9
+ The studies complement `doc/`, they do not replace it: `doc/` is normative
10
+ and describes intended use, while these files go deeper into internals,
11
+ invariants and traps, and cross-reference doc pages by path instead of
12
+ restating them.
13
+
14
+ ## Reading order
15
+
16
+ `entry-cli` (how you get in) -> `chat` (the data model) -> `backends` +
17
+ `tools` (inference and tool dispatch) -> `agent-delegation` +
18
+ `agentworkflow` + `agent-society` (the agent layer) -> `provenance` (what it
19
+ all left behind). `embed-image` and `model-ml` are self-contained side
20
+ layers.
21
+
22
+ ## Studies
23
+
24
+ | file | subsystem |
25
+ |---|---|
26
+ | [chat.md](chat.md) | Chat data model and compilation pipeline |
27
+ | [provenance.md](provenance.md) | Provenance, receipts, token accounting |
28
+ | [agent-delegation.md](agent-delegation.md) | Agent class and delegation semantics |
29
+ | [backends.md](backends.md) | LLM backend layer and inference loop |
30
+ | [tools.md](tools.md) | Tool definitions, dispatch, MCP |
31
+ | [agentworkflow.md](agentworkflow.md) | AgentWorkflow mixin and job binding |
32
+ | [embed-image.md](embed-image.md) | Embeddings, RAG, images, multimodal input |
33
+ | [model-ml.md](model-ml.md) | ScoutModel / Torch / HuggingFace ML layer |
34
+ | [entry-cli.md](entry-cli.md) | Entry points, CLI, config surface |
35
+ | [agent-society.md](agent-society.md) | Agent directories and society harness |
36
+
37
+ ## Findings index
38
+
39
+ Cross-subsystem findings, numbered as in the source studies. Only## Findings index
40
+
41
+ > **Status (2026-10-19, re-verified at HEAD a2e3f6f):** the four fixed rows
42
+ > below landed in commit 838586a (tests green then and in the 2026-10-18
43
+ > 688/3255 suite baseline). The open table was spot-checked this date: F10
44
+ > (tools/call.rb:67 `function_arguments.merge(defaults)` still overrides
45
+ > model arguments), F13 (registry-only backend resolution), F16
46
+ > (`Scout.var.Agent` fallback vs `Chat.load_workflow`'s `Scout.chats.Agent`
47
+ > only, agent.rb:252-256 / chat/process/tools.rb:27), and F17
48
+ > (`inherit: 'tools'` still copies the whole current chat's tooling,
49
+ > agent/conversation.rb:246-249) all remain open as described.
50
+
51
+ Cross-subsystem findings, numbered as in the source studies. Only
52
+ **still-open** items are described here; fixed ones are listed in one line
53
+ each.
54
+
55
+ ### Fixed (2026-09-11 fix sweep, committed in 838586a)
56
+
57
+ | # | finding | where |
58
+ |---|---|---|
59
+ | F1 | `attach` tool never attached PDFs (normalization overwrite + bare-`case` dispatcher); now `auto`-only normalization with a subject-form dispatcher, unknown types raise. `test/scout/llm/agent/test_attach.rb` 8/0. | [embed-image.md](embed-image.md) |
60
+ | F2 | MCP server serving broken against `mcp` gem 1.1.0 (keyword invocation, lost `self` binding, non-`Response` return, Symbol tool names); fixed in `lib/scout/llm/mcp.rb`, `test/scout/llm/tools/test_mcp.rb` 3/0, re-verified on `mcp` 1.5.1. | [tools.md](tools.md) |
61
+ | F5 | `LLM.embed` never merged endpoint YAML (extensionless `exists?`) and failed silently on a missing endpoint; now matches the ask/image contract. `test/scout/llm/test_embed.rb` 6/0. | [embed-image.md](embed-image.md) |
62
+ | F7 | Default TorchModel train block assigned an SGD optimizer to `@criterion`, breaking default training; one-line fix plus a gated regression test (2/0). | [model-ml.md](model-ml.md) |
63
+
64
+ ### Still open
65
+
66
+ | # | finding | owner |
67
+ |---|---|---|
68
+ | F3 | `scout-ai config set ...` does not exist although two maintained user docs instruct it; workaround is hand-writing `~/.scout/etc/AI/<endpoint>.yaml` or `-ck key=value`. | [entry-cli.md](entry-cli.md) |
69
+ | F4 | `introduce:` generates zero tools - documentation injection only, despite ToolCalling.md's claim. Whole-workflow tooling needs a bare `tool: MyWorkflow`. | [tools.md](tools.md) |
70
+ | F6 | Model restore precedence inversion: `load_options` merges the saved `options.json` over constructor options, so a reloaded model ignores a fresh `checkpoint` argument. | [model-ml.md](model-ml.md) |
71
+ | F8 | No retry/backoff at the backend layer despite Backends.md's claim; a `query` raise propagates raw (only OpenWebUI's `Misc.insist` and the optional `Agent#process_exception` hook exist). | [backends.md](backends.md) |
72
+ | F9 | No streaming anywhere (`stream_results` does not exist); the only stream token is ollama's `stream: false`. | [backends.md](backends.md) |
73
+ | F10 | Tool-definition `defaults` **override** model arguments and hide the input from the visible schema (`function_arguments.merge(defaults)`). | [tools.md](tools.md) |
74
+ | F11 | Dead/broken dispatch branches: embed `:relay`/`:openwebui`, image `:relay`/`:bedrock`, `:glm` missing from image dispatch, bedrock embed unreachable. | [embed-image.md](embed-image.md) |
75
+ | F12 | Chat comments do not exist in the format; a `#` line becomes a user message. | [chat.md](chat.md) |
76
+ | F13 | No dynamic backend module resolution (registry only), incomplete documented backend list, and model config leaks across backends via the shared `key:model` token. | [backends.md](backends.md) |
77
+ | F14 | Stale context-strategy bounds in docs (the default is `shorten_tools_epoch_increment`, threshold 50 / keep 20 / cap 80, not `shorten_tools` MAX_TOOL_CALLS 40). | [chat.md](chat.md), [backends.md](backends.md) |
78
+ | F15 | Symbol-named KB databases break the tool layer on reload (registry YAML round-trips symbol keys; `get_database('name')` string lookup misses). | [tools.md](tools.md) |
79
+ | F16 | `scout agent kb` hard-codes `Scout.var.Agent[agent]`; `Chat.load_workflow` (`tool:` roles) uses only `Scout.chats.Agent`, diverging from `load_agent`'s five roots. | [agent-society.md](agent-society.md) |
80
+ | F17 | `inherit: 'tools'` scope drift: docs say caller *task* tooling, code copies the whole *current chat's* tooling. | [agent-delegation.md](agent-delegation.md) |
81
+ | F18 | Anthropic image support does not exist despite Backends.md's description (inherits the default `input_image` shape; only GLM uses a nested `image_url`), and `encode_image` maps only jpg/jpeg/png - other extensions become `data:image/extension;base64,...`. | [embed-image.md](embed-image.md) |
82
+ | F19 | `start_chat.chat` silently ignored / empty seed; `@@agent_workflow` cache never invalidated and process-global. | [agent-society.md](agent-society.md) |
83
+ | F20 | MultiAgentWorkflows.md's first snippet would fail; `tooling` destructively mutates the job chat; the shipped "depencencies" misspelling is load-bearing (the recycle filter matches it); no dedicated AgentWorkflow developer doc; `include_workflow` required, not `include`. | [agentworkflow.md](agentworkflow.md) |
84
+ | F21 | `openai.rb`'s `defaults` stripping is dead code (deletes at the wrapper level where `:parameters` is nil); only huggingface digs correctly. | [backends.md](backends.md) |
85
+ | F22 | Provenance doc drift: two log globs not three; `resets/` invisible to traversal; the optional 7th `detail` yield undocumented but load-bearing; checkout-vs-gem `Chat.live_report` trap. | [provenance.md](provenance.md) |
86
+
87
+ ### Open decisions that span subsystems
88
+
89
+ - Whether tool-definition defaults should apply only when the model omits the
90
+ input (F10) - it affects every `tool: WF task name=value` user and any
91
+ brief tool-provisioning grammar built on it.
92
+ - `inherit: 'tools'` scope (F17): caller-task-scoped or whole-current-chat
93
+ scoped; a regression test pinning whichever is intended would help.
94
+ - `Chat.load_workflow` vs `load_agent` lookup divergence (F16): can the same
95
+ `tool: Name` and `agent: Name` resolve to different directories, and does
96
+ anything depend on it?
97
+ - Model config cross-talk (F13): intended isolation mechanism or config
98
+ hazard?
99
+ - Whether retry/backoff and streaming (F8/F9) should be implemented or the
100
+ docs corrected.
101
+ - Whether `LLM.embed` should cache (ask and image both do).
102
+ - The dead-but-implemented branches (bedrock embed, glm image): remove,
103
+ implement dispatch, or document as unreachable.
104
+ - The supported `mcp` gem version range (server side) - the fixed handler
105
+ contract is stable across 1.1.0-1.5.1 but `mcp` is not a declared runtime
106
+ dependency.
107
+
108
+ ## Provenance
109
+
110
+ All ten studies derive from the 2026-09-10/11 Cortex subsystem studies,
111
+ probed against this checkout at HEAD `a992a33` plus the uncommitted
112
+ 2026-09-11 fix sweep (attach, MCP serving, embed endpoint YAML, TorchModel
113
+ criterion, each with regression tests). Probing was offline throughout: fake
114
+ clients, local HTTP stubs, the test mock backend, synthetic fixtures under
115
+ `Dir.mktmpdir`, and code reading. No paid API calls, no network LLM usage,
116
+ no HuggingFace downloads (the repo's own
117
+ `test/support/availability.rb` gates those), and no live running workflows -
118
+ provider-rejection questions and live `.info` latency measurements remain
119
+ open for that reason. Reusable probes are versioned Cortex artifacts under
120
+ `probe/` executed through the `Observation/probe` property (for example
121
+ `probe/mcp_serving_dispatch.rb`, `probe/scout_agent_delegation_api.rb`,
122
+ `probe/model_ml.rb`, `probe/agentworkflow_*.rb`); each study's Evidence
123
+ section names its own probes.
124
+
125
+ When reproducing: the installed gem may differ from this checkout (2.0.0 vs
126
+ 2.1.0 at study time), so pin `-I<checkout>/lib` or `RUBYOPT` when probing
127
+ from the checkout.