scout-ai 2.1.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 (186) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +133 -58
  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 +319 -33
  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 +388 -40
  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 +13 -17
  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 +77 -16
  39. data/lib/scout/llm/agent.rb +147 -31
  40. data/lib/scout/llm/ask.rb +28 -17
  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 +127 -34
  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 -49
  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 +343 -676
  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 +71 -27
  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 +724 -59
  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 +28 -27
  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 +67 -28
  127. data/test/scout/llm/chat/test_agent_meta_tokens.rb +59 -8
  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 +310 -15
  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 +70 -26
  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/provenance-continuation-accounting.md +0 -255
  185. data/research/synthesis-report.md +0 -487
  186. data/research/tools-system-analysis.md +0 -779
@@ -0,0 +1,279 @@
1
+ # Path engine fixes DC-1 / DC-2 / DC-3 — consolidated report
2
+
3
+ Date: 2026-10-23. Checkout: scout-ai at `/bulk/mvazque2/git/scout-ai`
4
+ (same repository as `/home/mvazque2/git/scout-ai`), HEAD `37195515`,
5
+ nothing committed. All changes are uncommitted working-tree edits;
6
+ disposable evidence lives under `tmp/dc-fixes/` in this checkout.
7
+ Methodology follows `research/path-kind-contract-fixes-engine.md`
8
+ (probe scripts under `tmp/…/probes/`, before/after JSON logs under
9
+ `tmp/…/logs/`, suites run before and after, all in fresh processes).
10
+
11
+ ## Overview
12
+
13
+ Three defects in the Scout workflow Path kinds engine
14
+ (`lib/scout/llm/agent/path.rb`, `lib/scout/llm/agent/path/edit.rb`),
15
+ labeled DC-1/DC-2/DC-3, were identified during the ScoutCoder round-12
16
+ "auto-run on write" investigation in the ScoutCoder checkout and
17
+ source-confirmed in this checkout's HEAD during step 1 of this round.
18
+ The user explicitly authorized fixing them in this checkout. The
19
+ engagement ran as a 7-step plan (recon + red reproduction; DC-1 fix;
20
+ DC-2 fix; DC-3 doc amendment; full fresh-process validation; Critic
21
+ gate with two producer-defect repairs; consolidated report — this
22
+ file). The Critic gate returned NEEDS_WORK (86) on two producer
23
+ defects (one doc contradiction, one evidence-durability failure), both
24
+ were repaired, and the re-gate returned PASS (96) with no residual
25
+ defect and no next action.
26
+
27
+ Defect set, confirmed against HEAD `37195515` (line numbers as
28
+ measured then; step-1 anchor list in `tmp/dc-fixes/recon.md`):
29
+
30
+ - **DC-1** — operation overrides were accepted at registration for ANY
31
+ of the ten built-in operations, but only `edit` and `patch` ever
32
+ consulted the operation table. A `write` (and equally
33
+ `read`/`list`/`move`/`rename`/`delete`) override was stored and then
34
+ never dispatched: `path_write` never called
35
+ `path_operation_implementation`, so the engine default silently ran.
36
+ Anchors: `path_normalize_operation_overrides` (path.rb:630 at step 1,
37
+ discarding any declared `type`), `path_operation_table` (437,
38
+ hardcoding `"type" => :full` for override entries), `path_write`
39
+ (1357), `path_operation_implementation` (621).
40
+ - **DC-2** — edit overrides: the declared handler `type` was silently
41
+ dropped at normalization; `path_edit` (edit.rb:161, override consult
42
+ at 176) always routed through `path_apply_content_handler`
43
+ (path.rb:1242), which calls `handler.call(original, args)` — a
44
+ 3-arity `:full`-intended handler raised `ArgumentError` (given 2,
45
+ expected 3) — and then `result.end_with?("\n")`, so a Hash return
46
+ raised `NoMethodError` that ESCAPED `path_install_tool`'s
47
+ ScoutException-only rescue (~863) and left the agent tool boundary as
48
+ a raw exception. Side behavior: under a `:content` edit override,
49
+ `selector`/`replacement` were argument-validated but silently never
50
+ applied.
51
+ - **DC-3** — `doc/developer/PathEngine.md` §5 (~245, call-shape text
52
+ ~299), §6 (~310) and §9 (~421) read as if overrides were honored per
53
+ built-in operation, which the code did not do.
54
+
55
+ A consumer scan (step 1) found ZERO override declarations in any
56
+ installed scout gem (1.1.6–2.1.0, camp, essentials, gear, rig, web), in
57
+ sibling checkouts, or in this repository outside the engine itself —
58
+ so tightening the override surface could break no live consumer.
59
+
60
+ ## DC-1 — write overrides now dispatch, type-aware; dead overrides reject loudly
61
+
62
+ **Defect.** `path_write` never consulted the override table (DC-1 above).
63
+
64
+ **Decision.** Dispatch, not reject, for `write`: the override mechanism
65
+ is the engine's sanctioned way to replace a built-in implementation
66
+ without changing its public tool schema, and a working write override
67
+ is exactly what a workflow wants for mediated writes (the round-12
68
+ "auto-run on write" revisit path). Built-ins with no dispatch path —
69
+ `read`, `list`, `move`, `rename`, `delete`, `validate`, `promote`,
70
+ `smoke` — now REJECT loudly at registration with a `ParameterException`
71
+ naming the supported set (`write`, `edit`, `patch`) and pointing the
72
+ customizable ones at their existing hook mechanisms (`"list"` via the
73
+ `"list"` definition key; `"validate"`/`"smoke"` via the
74
+ `"validate"`/`"smoke"` definition keys dispatched by
75
+ `path_kind_operation`; `"promote"` via `"promotion_destination"` /
76
+ `"promotion_post_move"`). Hooks are a separate mechanism and keep
77
+ working — the rejection set was settled from the source dispatch graph,
78
+ not by disabling hooks.
79
+
80
+ **Implementation** (`lib/scout/llm/agent/path.rb`):
81
+ `path_normalize_operation_overrides` preserves and validates the
82
+ override's declared `type` against `PATH_HANDLER_TYPES`
83
+ (`:content`/`:full`), defaulting to `:content` when absent;
84
+ `path_operation_table` stores the declared per-override type (engine
85
+ defaults come from `BUILTIN_DEFAULT_HANDLER_TYPES`); per-operation
86
+ supported types live in `OVERRIDE_HANDLER_TYPES` (write and edit
87
+ `[:content, :full]`, patch `[:content]` only) with the overridable set
88
+ in `OVERRIDE_DISPATCH_OPERATIONS`. `path_write` dispatches AFTER
89
+ `path_authorize!`:
90
+
91
+ - `:content` — `handler(content, args)` returns a String (non-String →
92
+ `ParameterException` naming the contract); the engine writes that
93
+ string through the normal write path; result shape unchanged
94
+ (`{doc_id, kind, path, location, target_file, written}`).
95
+ - `:full` — `handler(agent, target, args)` with the resolved, authorized
96
+ target; the handler performs the write itself; returns a Hash payload
97
+ (non-Hash → `ParameterException`). Canonical keys
98
+ (`doc_id/kind/path/location/target_file/written`) are
99
+ engine-authoritative — a handler attempt to set one is ignored — and
100
+ other payload keys merge additively. `written`/`target_file` reflect
101
+ verified reality (existence at the authorized target), honoring the
102
+ sandbox pin that write success is at the authorized target.
103
+
104
+ Authorization failure invokes no handler, either type.
105
+
106
+ ## DC-2 — type-aware edit dispatch; return-shape guards; selector-bypass pinned
107
+
108
+ **Defect.** See DC-2 above.
109
+
110
+ **Decision.** Same type-aware dispatch for `path_edit`
111
+ (`lib/scout/llm/agent/path/edit.rb`), reusing the step-2 plumbing:
112
+
113
+ - `:content` stays today's `(content, args)` transform; its String
114
+ return contract is now enforced (the guard lives in
115
+ `path_apply_content_handler`, shared with write/patch), and the
116
+ returned content is written by the engine exactly as before.
117
+ - `:full` — `handler(agent, target, args)` returns a Hash payload
118
+ (non-Hash → `ParameterException` envelope); edit's canonical result
119
+ shape (`{doc_id, kind, path, changed, content}`) is preserved — no
120
+ shape normalization across operations — with engine-authoritative
121
+ canonical keys and additive payload merge, and `content`/`changed`
122
+ read back from the authorized target (verified reality) rather than
123
+ trusting the handler's claim.
124
+
125
+ The **selector-bypass semantics were kept and made explicit**: under a
126
+ `:content` edit override, `selector`/`replacement` remain validated
127
+ (the tool schema requires them) but are NOT applied; the handler's
128
+ returned content IS the edited file. This is pinned by a test and
129
+ stated in the doc, rather than changed — the alternative (applying a
130
+ selector to handler output) would give the handler two interacting
131
+ editing mechanisms and no way to opt out.
132
+
133
+ **Alternatives considered and rejected.** `patch :full` was rejected at
134
+ registration ("patch dispatches its override as a content transform"):
135
+ `patch` is a strict unified-diff applier whose engine loop reads,
136
+ applies hunks with strict context verification, and writes once at the
137
+ authorized target; a `:full` patch override would bypass exactly that
138
+ verification, so patch keeps `:content` only. Making `path_edit` shape
139
+ itself like `path_write`'s result was rejected: shapes are
140
+ operation-specific and pinned by existing tests.
141
+
142
+ ## DC-3 — documentation states the implemented contract
143
+
144
+ `doc/developer/PathEngine.md` §5 now states the overridable set
145
+ (write/edit/patch), the per-operation type table, the default type,
146
+ the loud rejection with hook pointers, the real call shapes (`:content`
147
+ `(content, args)` → String; `:full` `(agent, target, args)` → Hash
148
+ payload with engine-authoritative canonical keys, additive merge, and
149
+ verified-reality results), the authorization-before-handler ordering,
150
+ and the pinned selector-bypass semantics. §6's registration-validation
151
+ list gained the two new rejections. §9 scopes "handlers must normalize
152
+ their own failures" to custom-operation handlers and states the
153
+ engine's own guards (non-String `:content` / non-Hash `:full` →
154
+ `ParameterException` envelope, never a raw escape); its pin list was
155
+ extended. The Critic found one contradiction in the new §5 text
156
+ ("promote has no customization surface" vs the document's own hook
157
+ list) — corrected to name the `promotion_destination` /
158
+ `promotion_post_move` hooks before the re-gate. Every behavioral
159
+ sentence in the amended sections is backed by a named green test or a
160
+ probe log (the backing map is in the step-4 record inside
161
+ `tmp/dc-fixes/recon.md`'s history and the section text itself cites the
162
+ pin lists).
163
+
164
+ ## Changed files (measured `git diff --numstat` at close)
165
+
166
+ | file | + | − |
167
+ |---|---|---|
168
+ | `lib/scout/llm/agent/path.rb` | 130 | 6 |
169
+ | `lib/scout/llm/agent/path/edit.rb` | 43 | 11 |
170
+ | `test/scout/llm/agent/test_path.rb` | 176 | 0 |
171
+ | `test/scout/llm/agent/test_path_edit.rb` | 147 | 0 |
172
+ | `doc/developer/PathEngine.md` | 74 | 13 |
173
+
174
+ (`.vimproject` +2/−0 is a pre-existing local edit, not part of this
175
+ work.) Tests are purely additive; no existing test was modified.
176
+
177
+ ## Evidence
178
+
179
+ All disposable evidence is under `tmp/dc-fixes/` in this checkout:
180
+
181
+ - **Probes** (`probes/`, one fresh Ruby process each):
182
+ `dc_common.rb` (harness) plus `a1_write_override.rb` (write override
183
+ dead at HEAD), `a2_default_write.rb` (control), `b4_edit_full_type.rb`
184
+ (`:full` edit arity), `b3_edit_hash_return.rb` (Hash return escape),
185
+ and `step5_smoke_kinds.rb` (installed-kinds registration + round-trip
186
+ smoke). The harness selects the engine with `DC_ENGINE`
187
+ (`pristine` → `tmp/dc-fixes/pristine/lib`, a snapshot extracted with
188
+ `git archive HEAD lib` and byte-verified against
189
+ `git show HEAD:lib/scout/llm/agent/path.rb`; `checkout` → the
190
+ working tree) and the log mode with `DC_MODE` (`before`/`after`);
191
+ mode and engine are cross-checked and overwriting an existing
192
+ `before-` log is refused, so the step-6 evidence clobber cannot recur.
193
+ - **Logs** (`logs/`): `before-*.json` regenerated against the pristine
194
+ snapshot (step-6 repair) carrying genuine red outcomes
195
+ (`engine: pristine`; a1 handler never fires / `defect_reproduced:
196
+ true`; a2 `control_holds: true`; b4 `ArgumentError given 2 expected
197
+ 3`; b3 raw `NoMethodError` through the tool callable);
198
+ `after-*.json` re-run on the fixed tree (`engine: checkout`; a1
199
+ handler fires through engine and tool callable; a2 control holds; b4
200
+ 3-arity works, String-returning probe lambda now yields the proper
201
+ `ParameterException`; b3 Scout error envelope, no raw escape);
202
+ interim `step2-after-*` / `step3-after-*`; `step5-smoke-kinds.json`
203
+ (`ok: true`).
204
+ - **Recon** (`recon.md`): step-1 anchors and dispatch-set grep, consumer
205
+ scan, probe inventory; step-5 validation appendix (probe table, suite
206
+ counts, smoke outcomes, git delta); step-6 repairs appendix.
207
+
208
+ **Tests.** `test/scout/llm/agent/test_path.rb` (83 tests / 634
209
+ assertions, 0 failures / 0 errors; includes the 9-test "Step 2 (DC-1)"
210
+ block: `write_content_override_transforms_content_and_keeps_result_shape`,
211
+ `write_content_override_default_type_is_content`,
212
+ `write_full_override_fires_with_agent_target_and_args`,
213
+ `write_full_override_non_string_return_is_parameter_error`,
214
+ `write_full_override_non_string_return_serializes_through_tool`,
215
+ `write_override_invalid_type_rejected_at_registration`,
216
+ `patch_full_override_rejected_at_registration`,
217
+ `override_on_non_dispatching_builtin_rejected_at_registration`,
218
+ `write_override_authorization_failure_runs_no_handler`).
219
+ `test/scout/llm/agent/test_path_edit.rb` (46 / 133, 0 / 0; includes the
220
+ 5-test "Step 3 (DC-2)" block:
221
+ `full_edit_override_fires_with_agent_target_and_args`,
222
+ `full_edit_override_non_hash_return_is_parameter_error_envelope`,
223
+ `content_edit_override_receives_content_and_args_and_writes_string`,
224
+ `content_edit_override_selector_replacement_not_applied`,
225
+ `full_edit_override_authorization_failure_runs_no_handler`).
226
+ Unchanged and green: `test_path_errors.rb` 15/281,
227
+ `test_path_filesystem.rb` 33/68 (incl.
228
+ `test_path_write_success_is_at_the_authorized_target`),
229
+ `test_path_patch.rb` 11/32, `test_path_promotion.rb` 19/79,
230
+ `test_path_workflow_integration.rb` 21/68; neighbors
231
+ `test/scout/llm/test_sandbox.rb` 16/57 and `test_agent.rb` 1/2.
232
+ Pre-existing pins
233
+ (`test_dispatch_edit_override_authorization_failure_runs_no_override`)
234
+ remain green.
235
+
236
+ **Critic gates.** First gate: NEEDS_WORK (86) — engine changes
237
+ independently verified sound (pristine-HEAD red reproduction, full
238
+ suites, invariant and hygiene checks pass); two producer defects only:
239
+ (1) the §5 promote sentence contradicted the document's own hook list
240
+ and `path.rb`'s `definition["promotion_post_move"]`; (2) the
241
+ `before-*.json` logs had been clobbered by a post-fix rerun and were
242
+ byte-identical to their after twins (impossible content at HEAD). Both
243
+ repaired (sentence reworded; before-logs regenerated against the
244
+ byte-verified pristine snapshot; `DC_MODE`/`DC_ENGINE` clobber guards
245
+ added). Re-gate: PASS (96), no residual defect, no next action.
246
+
247
+ ## Verification status per claim
248
+
249
+ - Dispatch of write/edit overrides, both types, with the documented
250
+ call shapes and return contracts — **validated** (the 14 new tests,
251
+ all suites, and the after-probes) and **independently reviewed**
252
+ (Critic re-gate reran the suites and the pristine-HEAD red
253
+ reproduction).
254
+ - Loud rejection set and hook pointers — **validated**
255
+ (`test_override_on_non_dispatching_builtin_rejected_at_registration`,
256
+ message content) and **independently reviewed**.
257
+ - No live consumer broken — **validated** (consumer re-grep at step 5:
258
+ only engine sources declare `"overrides"`) and **independently
259
+ reviewed**.
260
+ - Documentation matches implementation — **validated** (doc-cites-green
261
+ pass at step 4; corrected sentence at step 6) and **independently
262
+ reviewed** (re-gate PASS).
263
+ - Evidence integrity (before/after provenance) — **validated** at step
264
+ 6 (regeneration method byte-verified) and **independently reviewed**;
265
+ the earlier clobber is recorded honestly in `tmp/dc-fixes/recon.md`.
266
+
267
+ ## Closing note
268
+
269
+ DC-1, DC-2 and DC-3 are resolved. The round-12/13 historical documents
270
+ and the ScoutCoder checkout were not touched (the original round-12
271
+ note and its evidence files were never reachable from this sandbox and
272
+ were re-derived here from source anchors). Nothing was committed,
273
+ pushed or merged: the work exists as local working-tree diffs on
274
+ branch `dc-fixes` (five files, measured numstat above), additive tests,
275
+ the amended doc, the disposable evidence tree under `tmp/dc-fixes/`,
276
+ and this report. Auto-run-on-write remains retired (round-12 outcome
277
+ C) and is now expressible as a `:full` write override should that
278
+ revisit path ever be taken — recorded here as a fact, not a design
279
+ commitment.
@@ -0,0 +1,96 @@
1
+ # `path_kind:` chat role — decision record
2
+
3
+ Feature: per-agent control over which Path-engine kinds are configured,
4
+ replacing the wholesale behavior where incorporating a workflow whole
5
+ (`tool: W`) auto-configured every kind it declared. Four steps landed in
6
+ /bulk/mvazque2/git/scout-ai (engine) and /home/mvazque2/git/AgentSuite
7
+ (suite wiring + docs). This note records the adopted semantics and the
8
+ interpretation decisions, not a behavior description — behavior is
9
+ documented in `doc/developer/PathEngine.md` §4/§4.1 and
10
+ `doc/user/WritingChats.md` ("Declaring tools").
11
+
12
+ ## Adopted semantics (rules 1-6)
13
+
14
+ 1. **Line syntax** `path_kind: <Workflow> [<kind>...]`: first token the
15
+ workflow (resolved via `Chat.load_workflow`), rest kind names.
16
+ Multiple kinds per line and multiple lines accumulate. An **empty**
17
+ kind list means *every* kind of that workflow.
18
+ 2. **Explicit lines honored anywhere** — start_chat file or live chat.
19
+ 3. **Agent with a start_chat file ⇒ strict-explicit**: no implicit kind
20
+ loading at all. A start_chat with no `path_kind:` lines loads zero
21
+ kinds; whole-workflow `tool: W` lines configure tools only, never
22
+ kinds, for such agents.
23
+ 4. **Agent without a start_chat file ⇒ load-all default**: all kinds of
24
+ the agent's own workflow (when it declares `PATH_KINDS` — the old
25
+ synthetic-`introduce` fallback loaded none) plus the whole-workflow
26
+ `tool:` incorporation retained as back-compat.
27
+ 5. **Loud failures**: unknown kind or unloadable workflow raises
28
+ `ParameterException` naming the workflow, the offending kind(s) and
29
+ the valid kind names; a failed selection registers nothing.
30
+ 6. **Never model-visible**: `path_kind:` lines are stripped from the
31
+ model view; registration happens from the full message list *before*
32
+ stripping, so `clear_tools` cannot bypass it.
33
+
34
+ ## Why these choices (resolved ambiguities)
35
+
36
+ - **Subset vs replacement semantics** — a selection *replaces* the
37
+ all-kinds default for that line; it does not intersect with other
38
+ lines. Accumulation is per workflow-kind registration.
39
+ - **Selection after normalization** — kind names are matched against the
40
+ workflow's own normalized kind names (so Array-form `PATH_KINDS`
41
+ names work), and the unknown-kind error lists the valid names, so a
42
+ typo cannot silently degrade into a no-op.
43
+ - **`start_chat_file?` signal** — `LLM::Agent.load_agent` explicitly
44
+ records whether a real start_chat *file* was found versus the
45
+ synthetic `{introduce: workflow.name}` fallback, and rule 4 gates on
46
+ that signal. The synthetic fallback is NOT deliberate preparation, so
47
+ it keeps the load-all default. Direct-construction agents (tests,
48
+ `LLM::Agent.new(start_chat: ...)`) treat any non-empty start_chat as
49
+ prepared unless the flag is set explicitly; `clone_agent` carries the
50
+ flag so delegation cannot flip a synthetic-fallback agent into
51
+ implicit loading.
52
+ - **Deliberate re-scope** of the pinned test
53
+ `test_whole_workflow_tool_line_registers_kinds_and_installs_tools`
54
+ (step 2): the old test used a bare `fresh_agent`, which under the new
55
+ rules is a *prepared* agent only by the start_chat-less default; it
56
+ now builds the agent with `workflow: TestPathKindWorkflowB` so
57
+ `start_chat_file?` is false — the rule-4 precondition the old test
58
+ implicitly relied on. The prepared-agent counterpart (tool line ⇒
59
+ zero kinds) is `test_start_chat_present_zero_kinds_from_tool_lines`.
60
+ - **Suite impact audit** (step 3): in AgentSuite only ScoutCoder and
61
+ Research declare `PATH_KINDS`. No start_chat carries `tool: Research`
62
+ (only task-level `tool: Research searxng/html2md`, which register
63
+ nothing), so only ScoutCoder's own start_chat needed the explicit
64
+ `path_kind: ScoutCoder` line. Research/README.md line 14 documented
65
+ the old whole-workflow rule; corrected to the explicit rule with the
66
+ start_chat-less default noted.
67
+
68
+ ## Verification evidence
69
+
70
+ - Engine tests: `test/scout/llm/agent/test_path_workflow_integration.rb`
71
+ (39 tests / 136 assertions, includes the path_kind subset,
72
+ accumulation, unknown-kind, start_chat gating, and model-visibility
73
+ tests), `test/scout/llm/agent/test_path.rb` (83/634),
74
+ `test/scout/llm/chat/test_parse.rb` (round-trip pin). Whole
75
+ `test/scout/llm/{agent,chat}` subtree green, 38 files, fresh
76
+ processes.
77
+ - Live checks (step 3, fresh probe children): (a) suite ScoutCoder
78
+ agent, one mock-backend ask ⇒ all six kinds, 13 path tools, no
79
+ `path_kind` content model-visible; (b) `path_kind: ScoutCoder probe`
80
+ ⇒ exactly `["probe"]` (both the literal start_chat-less variant and
81
+ the prepared-agent variant); (c) start_chat-less agent + whole-workflow
82
+ `tool: ScoutCoder` ⇒ all six (back-compat confirmed).
83
+
84
+ ## Changed files
85
+
86
+ - Engine (scout-ai): `lib/scout/llm/agent/path/workflow_kinds.rb`
87
+ (`only:` subset selection), `lib/scout/llm/agent.rb` (role
88
+ consumption, `start_chat_file` accessor, gating),
89
+ `lib/scout/llm/agent/construction.rb` (clone carries the signal),
90
+ `lib/scout/llm/chat/process/tools.rb` (strip from model view; role in
91
+ `tooling`), `doc/developer/PathEngine.md` (§4 rewrite, new §4.1),
92
+ `doc/user/WritingChats.md` (role in "Declaring tools"), plus the two
93
+ test files above.
94
+ - Suite (AgentSuite): `ScoutCoder/start_chat` (+`path_kind: ScoutCoder`),
95
+ `ScoutCoder/README.md` ("Agent path kinds" loading-rule rewrite),
96
+ `Research/README.md` (line-14 correction).