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
data/doc/Improvements.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  This document catalogs known code issues, documentation gaps, architectural
4
4
  suggestions, and anti-patterns to avoid when contributing to Scout-AI. It is
5
- derived from the research artifacts in [../research/](../research/) and is
6
- intended as a living reference for maintainers and contributors.
5
+ derived from the research artifacts in [../research/](../research/) and from
6
+ the Cortex subsystem studies under `research/subsys/` (probed 2026-09-10/11),
7
+ and is intended as a living reference for maintainers and contributors.
7
8
 
8
9
  Each entry includes a priority to help triage effort:
9
10
 
@@ -28,7 +29,7 @@ Each entry includes a priority to help triage effort:
28
29
  > capabilities of `info` (imports, job deduplication, DOT, SVG/PNG/PDF) are
29
30
  > available via `scout-ai llm prov -f`, `--dot`, and `-p`/`--plot`.
30
31
 
31
- **Sources:** [../research/commands-analysis.md](../research/commands-analysis.md), [../research/provenance-analysis.md](../research/provenance-analysis.md).
32
+ **Sources:** retired `research/commands-analysis.md` and `research/provenance-analysis.md` (2026-09-12); the `prov` behaviour is documented in [developer/Provenance.md](developer/Provenance.md).
32
33
 
33
34
  ---
34
35
 
@@ -40,7 +41,155 @@ Each entry includes a priority to help triage effort:
40
41
  > `prov` command now raises `MissingParameterException` if no filename is
41
42
  > provided, matching the behavior of other CLI commands.
42
43
 
43
- **Sources:** [../research/commands-analysis.md](../research/commands-analysis.md).
44
+ **Sources:** retired `research/commands-analysis.md` (2026-09-12); the command inventory now lives in the [user/Cookbook.md](user/Cookbook.md) CLI quick reference.
45
+
46
+ ---
47
+
48
+ ### 3. Model restore precedence: saved `options.json` wins over constructor args
49
+
50
+ **Priority:** Medium
51
+
52
+ > **Finding: F6** (`research/subsys/model-ml.md`).
53
+
54
+ **Problem:**
55
+ `ScoutModel#load_options` merges the persisted `options.json` **over** the
56
+ options passed to the constructor, and `HuggingfaceModel#initialize` assigns
57
+ `checkpoint` after `super` runs, so the saved value overwrites a fresh
58
+ constructor argument. Reloading
59
+ `HuggingfaceModel.new("CausalLM", "NEW/ckpt", dir)` over a state dir saved
60
+ with `checkpoint: "saved/ckpt"` still reports `saved/ckpt`.
61
+
62
+ The same inversion makes a *fresh* `checkpoint` argument silently ignored
63
+ whenever a state directory exists: the intended override-on-restore flow
64
+ ("pass new values when resuming") cannot be expressed without deleting the
65
+ state dir or hand-editing `options.json`.
66
+
67
+ **Fix direction:** restore should treat saved options as defaults and
68
+ explicit constructor arguments as overrides, with the resolved set written
69
+ back only on `save`.
70
+
71
+ ---
72
+
73
+ ### 4. Dead and broken dispatch branches in embed + image
74
+
75
+ **Priority:** Low
76
+
77
+ > **Finding: F11** (`research/subsys/embed-image.md`, `backends.md` §1).
78
+
79
+ **Problem:**
80
+ - `LLM.embed`'s `case` accepts `:relay` and `:openwebui` branches that fail
81
+ with `NoMethodError` at runtime (the relay branch expects a real client;
82
+ the openwebui branch hashes a client object that is a plain Hash).
83
+ - `LLM.image`'s dispatch has the same shape: `:relay` and `:bedrock`
84
+ branches raise `NoMethodError`, and `:glm` is missing entirely although
85
+ `LLM::GLM.image` works when called directly.
86
+ - `LLM.embed` has no `:anthropic`, `:vllm`, `:bedrock`, `:glm` branch
87
+ (Anthropic raises `does not offer embeddings`; Bedrock embeddings must be
88
+ reached through `LLM::Bedrock.embed` directly, since no dispatch branch
89
+ reaches it).
90
+ - `Backend#encode_image` maps only `jpg`/`jpeg`/`png`; every other extension
91
+ gets the literal MIME string `image/extension`, producing a malformed data
92
+ URI (`data:image/extension;base64,...`) that providers reject.
93
+
94
+ **Fix direction:** generate the MIME from a real extension table, and either
95
+ implement or delete the unreachable branches rather than carrying both.
96
+
97
+ ---
98
+
99
+ ### 5. Symbol-named KB databases break the tool layer on reload
100
+
101
+ **Priority:** Low
102
+
103
+ > **Finding: F15** (`research/subsys/tools.md` §2.4).
104
+
105
+ **Problem:**
106
+ `KnowledgeBase#register(:name, ...)` + `save` round-trips the registry YAML
107
+ with symbol keys. On `KnowledgeBase.load`,
108
+ `knowledge_base_tool_definition` calls `get_database(database)` with a
109
+ **String**, and the plain `Hash#[]` lookup misses symbol keys, raising
110
+ `RuntimeError: Repo <name> not found and not registered`. Registering the
111
+ same database with a String name works.
112
+
113
+ This is a scout-gear/scout-ai boundary trap: the scout-ai tool layer assumes
114
+ String-keyed registries.
115
+
116
+ **Fix direction:** normalize keys on one side (stringify in
117
+ `get_database`, or document that `register` must receive String names).
118
+
119
+ ---
120
+
121
+ ### 6. Agent KB root and `Chat.load_workflow` diverge
122
+
123
+ **Priority:** Low
124
+
125
+ > **Finding: F16** (`research/subsys/agent-society.md`, `tools.md` §2.8).
126
+
127
+ **Problem:**
128
+ Two divergent lookup roots for agent resources:
129
+
130
+ - `Chat.load_workflow` (the loader behind `tool:`/`introduce:` chat roles)
131
+ resolves agent names against `Scout.chats.Agent` only (falling back to
132
+ `Workflow.require_workflow`), while `LLM.load_agent` uses five roots
133
+ (filename path, `Scout.workflows[name]`, `Scout.Agent[name]`,
134
+ `Scout.var.Agent[name]`, `Scout.chats.Agent[name]`, `Scout.chats[name]`),
135
+ so the same name can load in one entry point and not the other.
136
+ - `scout agent kb` hard-codes `Scout.var.Agent[agent]` — just one of the
137
+ five — leaving agents living in `Scout.Agent` or `Scout.chats.Agent`
138
+ unreachable from the CLI.
139
+
140
+ A chat that mixes `tool:` and `kb:` declarations against the same project can
141
+ therefore resolve them against different directories depending on the entry
142
+ point (workflow job vs CLI chat vs agent society).
143
+
144
+ **Fix direction:** one resolution helper for "project-relative resource used
145
+ by a chat message", used by both paths.
146
+
147
+ ---
148
+
149
+ ### 7. `start_chat.chat` is silently ignored and agent workflows are never reloaded
150
+
151
+ **Priority:** Medium
152
+
153
+ > **Finding: F19** (`research/subsys/agent-society.md`).
154
+
155
+ **Problem:**
156
+ Two related behaviors surprise anyone building agent societies:
157
+
158
+ 1. Naming the seed file `start_chat.chat` (instead of `start_chat`) is
159
+ silently mishandled. When a literal `start_chat` file exists, the `.chat`
160
+ variant is skipped entirely; used alone,
161
+ `find_with_extension` returns the missing literal path, the read fails, and
162
+ the seed comes out **empty** — the agent starts with no system prompt and
163
+ no tools, with nothing reported. A silent empty seed is a misconfiguration
164
+ trap, not a feature.
165
+ 2. The agent workflow module cache (`@@agent_workflow`) is process-global
166
+ and never invalidated: the first `Workflow.require_workflow` of a session
167
+ wins, and later edits to `Agent/<Name>/workflow.rb` are invisible until
168
+ the process restarts.
169
+
170
+ **Fix direction:** raise when a directory offers both `start_chat` and
171
+ `start_chat.chat`, and raise (or fall back to the directory-assembly seed)
172
+ when only the `.chat` variant exists; and key the workflow cache on the
173
+ file's mtime/digest.
174
+
175
+ ---
176
+
177
+ ### 8. OpenAI `defaults` stripping is dead code
178
+
179
+ **Priority:** Low
180
+
181
+ > **Finding: F21** (`research/subsys/backends.md` §7.8).
182
+
183
+ **Problem:**
184
+ `openai.rb` deletes `:defaults` at the wrapper level, where `:parameters` is
185
+ always `nil` (parameters live under `function:` after wrapping), so the
186
+ `defaults` subschema survives in the OpenAI payload. `huggingface.rb` digs
187
+ correctly (`definition.dig(:function, :parameters).delete(:defaults)`) and is
188
+ the only adapter that actually strips it; ollama/anthropic never do.
189
+
190
+ **Fix direction:** either strip it consistently for every Chat-Completions
191
+ family adapter (and drop the dead line), or stop pretending the field is
192
+ provider-private and keep it everywhere.
44
193
 
45
194
  ---
46
195
 
@@ -52,7 +201,7 @@ Each entry includes a priority to help triage effort:
52
201
 
53
202
  > **Status: Resolved.** See [user/Python.md](user/Python.md).
54
203
 
55
- **Sources:** [../research/synthesis-report.md](../research/synthesis-report.md).
204
+ **Sources:** retired `research/synthesis-report.md` (2026-09-12); gap items D1–D3 above.
56
205
 
57
206
  ---
58
207
 
@@ -71,7 +220,7 @@ Keep `Model.md` as a standalone reference. Add a note in [StartHere.md](StartHer
71
220
  pointing to it. Optionally move it to `doc/developer/Model.md` for structural
72
221
  consistency. Do not merge into the LLM docs unless explicitly requested.
73
222
 
74
- **Sources:** [../research/synthesis-report.md](../research/synthesis-report.md).
223
+ **Sources:** retired `research/synthesis-report.md` (2026-09-12); gap items D1–D3 above.
75
224
 
76
225
  ---
77
226
 
@@ -89,7 +238,30 @@ Consider expanding the Getting Started guide with a more linear tutorial (instal
89
238
  configure endpoint → first `ask` → first chat file → first agent → first
90
239
  workflow). Low priority since the current guide covers the essentials.
91
240
 
92
- **Sources:** [../research/synthesis-report.md](../research/synthesis-report.md).
241
+ **Sources:** retired `research/synthesis-report.md` (2026-09-12); gap items D1–D3 above.
242
+
243
+ ---
244
+
245
+ ### D4. Documentation vs. verified code behavior (2026-09-11 promotion)
246
+
247
+ **Priority:** Medium
248
+
249
+ **Problem:**
250
+ The Cortex subsystem studies (`research/subsys/`, probed 2026-09-10/11) found
251
+ eleven places where maintained docs described behavior that does not exist or
252
+ has since changed: the nonexistent `scout-ai config set` (F3), `introduce:`
253
+ generating tools (F4), backend retry/backoff and streaming (F8/F9), dynamic
254
+ backend name resolution (F13), context-strategy bounds (F14), `#` chat
255
+ comments (F12), the incomplete chat compilation pipeline listing and key-file
256
+ table, the `inherit: 'tools'` scope (F17), Anthropic image blocks (F18), the
257
+ MultiAgentWorkflows first snippet (F20), and the `agent.rb` require tree /
258
+ `start_chat.chat` seed handling (F19).
259
+
260
+ **Status: Resolved (committed in 838586a).** `doc/` has been corrected against the
261
+ owning artifacts (`research/subsys/README.md` is the F1–F22 index); each fix
262
+ is described in the corresponding page. The code half lives in issues 3–8
263
+ above, tagged with their finding numbers; R9–R13 in the Refactor Log record
264
+ the fixes that landed in the same sweep.
93
265
 
94
266
  ---
95
267
 
@@ -117,7 +289,16 @@ Update ChatAnalyst's `Session` class to delegate to the shared `Chat`
117
289
  provenance primitives (`Chat.traverse_provenance`, `Chat.agent_meta_evidence`,
118
290
  `Chat.provenance_token_events`) instead of maintaining its own BFS traversal.
119
291
 
120
- **Sources:** [../research/provenance-analysis.md](../research/provenance-analysis.md), [../research/multi-agent-patterns-analysis.md](../research/multi-agent-patterns-analysis.md).
292
+ > **Record (2026-09-12):** `research/provenance-navigation-design.md` is
293
+ > retained pending the A1 decision; it stays linked from
294
+ > [developer/Provenance.md](developer/Provenance.md) as the design rationale
295
+ > this item would consume.
296
+
297
+ **Sources:** retired `research/provenance-analysis.md` and
298
+ `research/multi-agent-patterns-analysis.md` (2026-09-12); the ChatAnalyst
299
+ session-traversal findings are preserved in
300
+ [developer/Provenance.md](developer/Provenance.md) and
301
+ [developer/Architecture.md](developer/Architecture.md).
121
302
 
122
303
  ---
123
304
 
@@ -135,7 +316,8 @@ Implement the registry: define `REGISTERED_STRATEGIES = {}` and add a
135
316
  `Chat.register_prompt_strategy(name, &block)` class method. Document the
136
317
  extension point in [developer/PromptProcessing.md](developer/PromptProcessing.md).
137
318
 
138
- **Sources:** [../research/prompt-strategies-analysis.md](../research/prompt-strategies-analysis.md).
319
+ **Sources:** retired `research/prompt-strategies-analysis.md` (2026-09-12);
320
+ its facts now live in [developer/PromptProcessing.md](developer/PromptProcessing.md).
139
321
 
140
322
  ---
141
323
 
@@ -150,7 +332,9 @@ extension point in [developer/PromptProcessing.md](developer/PromptProcessing.md
150
332
  > text-tree report and the flow/DOT/SVG capabilities that were formerly in
151
333
  > `info`. `prov` is the sole provenance CLI command.
152
334
 
153
- **Sources:** [../research/commands-analysis.md](../research/commands-analysis.md), [../research/provenance-analysis.md](../research/provenance-analysis.md).
335
+ **Sources:** retired `research/commands-analysis.md` and
336
+ `research/provenance-analysis.md` (2026-09-12); `prov` behaviour is
337
+ documented in [developer/Provenance.md](developer/Provenance.md).
154
338
 
155
339
  ---
156
340
 
@@ -170,156 +354,314 @@ Review both documents to ensure the endpoint YAML examples, key names, and
170
354
  configuration precedence are identical. Cross-link them so readers can find
171
355
  the canonical reference.
172
356
 
173
- **Sources:** [../research/synthesis-report.md](../research/synthesis-report.md).
174
-
175
- ---
176
-
177
- ## Anti-patterns to Watch For
357
+ **Status: Resolved (committed in 838586a).** [user/RunningInference.md](user/RunningInference.md)
358
+ is now the single canonical endpoint reference (hand-written
359
+ `~/.scout/etc/AI/<name>.yaml`, recognized keys, `-ck key=value`, provider
360
+ table, `Endpoint not found` semantics); GettingStarted and Backends
361
+ cross-reference it instead of restating the details.
178
362
 
179
- These anti-patterns are drawn from the Scout-AI coding philosophy
180
- ([../research/coding-philosophy-analysis.md](../research/coding-philosophy-analysis.md)).
181
- They are the most common ways that well-intentioned code fights the library
182
- instead of composing with it.
363
+ **Sources:** retired `research/synthesis-report.md` (2026-09-12); gap item 2.4
364
+ (endpoint configuration).
183
365
 
184
366
  ---
185
367
 
186
- ### AP1. Don't create wrapper classes for Chat
187
-
188
- **❌ Non-idiomatic:**
189
- ```ruby
190
- class MyConversation
191
- def initialize
192
- @messages = []
193
- end
194
- def add_user(text)
195
- @messages << { role: 'user', content: text }
196
- end
197
- end
198
- ```
199
-
200
- **✅ Idiomatic:**
201
- ```ruby
202
- chat = Chat.setup([])
203
- chat.user("Hello")
204
- ```
205
-
206
- **Why:** `Chat` is an annotation on a plain `Array`. Wrapping it in a custom
207
- class breaks serialization, composition, caching, and every helper that
208
- expects an Array. Use `Chat.setup(any_array)` and the DSL methods.
368
+ ## Refactor Log
369
+
370
+ Resolved entries from the delegation-machinery refactor (steps tracked in the
371
+ Cortex artifacts `refactor/delegation-conversation-pipeline.md` and
372
+ `refactor/delegation-execution-reference.md`):
373
+
374
+ ### R1. Shared tool-definition builder and strict schemas
375
+
376
+ The four hand-built JSON-schema tool definition sites (delegate `hand_off_to_*`,
377
+ `ask`, `attach`, workflow tasks) now build through one helper,
378
+ `LLM.tool_definition` in `lib/scout/llm/tools/definition.rb` (envelope/strict/
379
+ defaults aware). All four sites emit strict schemas
380
+ (`additionalProperties: false`); previously only two did. The `defaults`
381
+ replay side-channel (`parameters[:defaults]`, consumed by
382
+ `LLM.process_calls`) is preserved.
383
+
384
+ ### R2. Conversation-open pipeline
385
+
386
+ The specialist setup sequence that lived inline in `delegate.rb`
387
+ (template resolve, seed, anchor, register, restart) is now
388
+ `Agent#open_conversation` in `lib/scout/llm/agent/conversation.rb`, with
389
+ `ask_conversation` as the prompt-appending companion and `load_agent`/
390
+ `load_chat`/`ask_agent` as thin wrappers. New kwargs: `preamble:`, `anchor:`,
391
+ `restart:`, `template:`, `adopt: :current` (folds a template's own progress
392
+ into the seed), `job:` (reserved).
393
+
394
+ ### R3. Delegate default hand-off block rebuilt on the pipeline
395
+
396
+ The default `delegate` block no longer mutates the passed agent. It runs
397
+ `ask_conversation` with a sanitized conversation slot (the delegated name),
398
+ `inherit: 'none'`, `template:` the passed agent, `adopt: :current`, and
399
+ `restart:` from `new_conversation`. Hand-off children persist under
400
+ `<save>.society/<Agent>/<slot>/agent.chat` and are swept by the parent save;
401
+ the live conversation is reachable with `conversation_agent("<name>/<slot>")`.
402
+ Custom blocks and non-Agent objects keep the direct-mutation contract; the
403
+ passed Agent is pre-registered as the `@society` template for its name. A
404
+ failed hand-off now returns the exception instead of aborting the tool round.
405
+
406
+ ### R4. First-round anchoring for workflow agents
407
+
408
+ `AgentWorkflow#agent` (chat_task agents) assigns the agent's canonical
409
+ `<files_dir>/<name>.chat` save file at creation via
410
+ `Agent.canonical_chat_file`, so autosave and restart snapshots apply from the
411
+ first round; mid-round socialized children get a real parent anchor. The
412
+ `scout-ai agent ask` and `scout-ai llm ask` CLIs route through the same
413
+ helper; `LLM.ask`'s `agent_save_file` option stays a caller-supplied explicit
414
+ path (deliberately unconverted).
415
+
416
+ ### R5. Duplicate-agent answer attribution fixed
417
+
418
+ `LLM.process_calls` paired tool outputs with agent answers via
419
+ `agents.index(content)` (object identity); when the same Agent object answered
420
+ two calls in one round (two `ask` calls to the same conversation, or two
421
+ hand-offs to the same specialist), both outputs embedded the first answer.
422
+ Pairing is now by tool-call position. Regression test:
423
+ `test/scout/llm/tools/test_agent_pairing.rb`.
424
+
425
+ ### R6. Legacy `.files/log` layouts dropped (breaking)
426
+
427
+ Reader-side support for the legacy `log/` subtree inside the chat files dir
428
+ (`<files_dir>/log/agent.chat` and
429
+ `<files_dir>/log/chats/<Agent>/<conversation>.chat`, plus the
430
+ `log/society/...` variant) is removed: provenance traversal, meta sidecar
431
+ sweep, the `prov` CLI, and `Agent.legacy_society_dir_for` no longer see that
432
+ tree. Nothing wrote it anymore; old trees are not migrated and are now
433
+ invisible to provenance. Canonical layouts unchanged:
434
+ `<files_dir>/<name>.chat` and `<save>.society/<Agent>/<conversation>/agent.chat`
435
+ (and, since the inbox feature, `<save>.inbox` / `<save>.inbox_removed`).
436
+
437
+ ### R7. Receipt field `agent_meta` renamed to `meta` (breaking)
438
+
439
+ `function_call_output` receipts carry agent evidence under `meta` (an Array
440
+ of already-deserialized field Hashes); the legacy serialized `agent_meta`
441
+ key is no longer read, so legacy envelopes contribute no receipt evidence
442
+ (and no warnings). Ruby identifiers (`agent_meta.rb`, `Chat.agent_meta_evidence`,
443
+ `agent_meta_index`, the `:agent_meta` origin symbol) are unchanged — they
444
+ name the machinery, not the persisted field.
445
+
446
+ ### R8. Live workload: one sibling sidecar, all jobs, consumer-side classification
447
+
448
+ Three design decisions turned the live view from an idea into a small,
449
+ verifiable contract:
450
+
451
+ 1. **Sibling-state unification** — every piece of derived agent state is now
452
+ a sibling of the save_file (`<base>.society/`, `<base>.inbox/`,
453
+ `<base>.inbox_removed/`, `<base>.jobs`), derived by stripping only a
454
+ trailing `.chat`. This replaces both the legacy nested
455
+ `<save_file>.files/...` derivations and the historical unanchored
456
+ `sub(/\.chat/)` that mangled paths such as
457
+ `Default.chat.files/agent.chat`. One derivation rule
458
+ (`Chat.inbox_stem` + suffix) backs all four helpers.
459
+ 2. **Flat transient `.jobs`, not a pointer directory** — an earlier design
460
+ sketched a `<save_file>.files/jobs/` directory of per-dispatch pointer
461
+ JSON files annotated in place. It was deliberately **not** built that way:
462
+ the sidecar is a single flat file, rewritten per tool round as a snapshot
463
+ of the current in-flight set (newline-joined short paths) and removed in
464
+ an `ensure` when `Workflow.produce` returns. Snapshot semantics beat an
465
+ append log here: no orphaned pointer files to GC, no partial writes to
466
+ reconcile, and the absent file is unambiguously "nothing in flight".
467
+ 3. **List all jobs; classify in the consumer** — `.jobs` deliberately lists
468
+ *every* in-flight workflow job, not only chat_tasks. The writer stays
469
+ dumb (short paths only); `Chat.live_workload` owns the discriminators:
470
+ live chat_task = `step.type.to_s == 'chat'`, reconciliation through
471
+ `.info` status plus `/proc/<pid>` liveness (with the `kill -9` and
472
+ LocalExecutor-retry caveats documented at the consumer, where they can
473
+ actually be acted on).
474
+
475
+ The consumer is rendered by `scout-ai llm prov --live`; the forensic
476
+ behaviour of the command is untouched.
209
477
 
210
478
  ---
211
479
 
212
- ### AP2. Don't hardcode provider logic in `LLM.ask`
213
-
214
- **❌ Non-idiomatic:**
215
- ```ruby
216
- def self.ask(question, options = {})
217
- if options[:provider] == 'openai'
218
- # 50 lines of OpenAI-specific code inline
219
- end
220
- end
221
- ```
222
-
223
- **✅ Idiomatic:**
224
- ```ruby
225
- def self.ask(question, options = {})
226
- options = IndiferentHash.setup(options)
227
- backend = LLM.resolve_backend(options)
228
- backend.ask(messages, options, &block)
229
- end
230
- ```
231
-
232
- **Why:** Provider logic belongs in backend modules (composed via
233
- `prepend`/`include`). `LLM.ask` should dispatch, not implement.
234
-
235
- ---
480
+ ### R9–R13. The 2026-09-11 fix sweep (committed in 838586a)
481
+
482
+ R9–R13 below record the 2026-09-11 fix sweep verified by the Cortex subsystem
483
+ studies (`research/subsys/`). All changes landed in commit `838586a`
484
+ (2026-09-11, "Fix sweep (F1/F2/F5/F7 + R13) with regression tests; F1-F22
485
+ doc corrections; D4 promotion") together with their tests; findings F1, F2,
486
+ F5, F7 and the `ask.rb` `persist:false` fix are resolved by them.
487
+
488
+ The findings identified by the same studies but **not** covered by the sweep
489
+ (F6, F11, F15, F16, F19, F21) correspond to code issues 3, 4, 5, 6, 7 and 8
490
+ above; they remain open.
491
+
492
+ ### R9. `attach` tool can attach PDFs again
493
+
494
+ Normalization used to overwrite an explicit `file_type: 'pdf'` to `'image'`,
495
+ and the dispatcher's bare `case` matched its first branch unconditionally, so
496
+ `when 'pdf'` was unreachable and every attach routed to
497
+ `Agent#image(path)`. Fixed by matching on the subject form and normalizing
498
+ only on `auto`; the `ATACH_TYPES` typo and the schema/code default divergence
499
+ (auto vs image) went with it. `lib/scout/llm/agent/attach.rb` +
500
+ `test/scout/llm/agent/test_attach.rb` (8 tests, 0 failures). Committed in 838586a.
501
+
502
+ ### R10. MCP serving works against the `mcp` gem
503
+
504
+ `Workflow#mcp`'s tool block declared two positional parameters while the
505
+ `mcp` gem (1.1.0) invokes `tool.call(**args)` with keywords, and `self`
506
+ inside `MCP::Tool.define`'s anonymous class was not the Workflow module, so
507
+ every served tool call failed with `Internal error`. The block now takes
508
+ `|server_context: nil, **parameters|`, captures the workflow module in a
509
+ local, returns a real `MCP::Tool::Response`, and registers tools under the
510
+ String name the JSON-RPC lookup expects. `lib/scout/llm/mcp.rb` +
511
+ `test/scout/llm/tools/test_mcp.rb` (3 tests, 0 failures). Committed in 838586a; the
512
+ supported `mcp` gem version range is still undecided.
513
+
514
+ ### R11. `LLM.embed` reads endpoint YAML
515
+
516
+ `embed.rb` used the extensionless `Scout.etc.AI[endpoint].exists?`, unlike
517
+ `ask`/image which use `find_with_extension(:yaml)`, so `<endpoint>.yaml`
518
+ could not configure embeddings and a missing endpoint failed silently
519
+ instead of raising. `lib/scout/llm/embed.rb` +
520
+ `test/scout/llm/test_embed.rb` (6 tests, 0 failures). Committed in 838586a.
521
+
522
+ ### R12. TorchModel trains with a real criterion by default
523
+
524
+ `@criterion ||= TorchModel.optimizer(...)` assigned an **SGD optimizer** to
525
+ the criterion slot (copy-paste), so default training computed the loss on an
526
+ optimizer object unless the user set `model.criterion` manually — which the
527
+ documented example did, masking the bug. Now builds a proper default
528
+ criterion. `lib/scout/model/python/torch.rb`; covered by
529
+ `test/scout/model/python/test_torch.rb` (torch-gated). Committed in 838586a.
530
+
531
+ ### R13. `ask` honors an explicit `persist: false`
532
+
533
+ `ask.rb` read `persist` as `persist ||= config_lookup`, which is falsy for
534
+ `false`: an explicit opt-out was silently discarded and the round persisted
535
+ anyway into the shared `Scout.var.cache.ask` store. The config lookup now
536
+ runs only when the caller said nothing (`persist.nil?`), so `persist: false`
537
+ genuinely bypasses the cache. `lib/scout/llm/ask.rb`; covered by
538
+ `test/scout/llm/test_ask.rb`. Committed in 838586a.
539
+
540
+ ### R14 (open). Workspace `test_tsv` harness assertion failure
541
+
542
+ `Workspace` suite: `test_read_returns_scout_tsv_text_and_supports_csv_empty_header_hash`
543
+ fails at `test/Workspace/tasks/test_tsv.rb:97`. Root cause is a harness
544
+ mismatch (the test compares `return_path` bytes while the task returns
545
+ `job.path`-shaped TSV text), not a tsv logic regression; the failure
546
+ predates the sandbox refactor (present on the parent commit too — the
547
+ facts sheet labeled it `[unverified: would require checking out the parent
548
+ commit]`, and the retired `research/sandbox-docs-facts.md` recorded the
549
+ same reading; the durable statement now lives in
550
+ [developer/Sandbox.md](developer/Sandbox.md) Layer-1 and this ledger).
551
+ Open decision: whether `tsv.rb` should adopt the sandbox-path check or
552
+ the harness assertion should be re-targeted; the facts sheet's §5
553
+ Workspace-suite table was its evidence, retired with it on 2026-10-19
554
+ (no in-repo copy survives).
555
+
556
+ ### R15 (open, review gap). sandbox-grant-sources round lacks independent review
557
+
558
+ The grant-source layer move from `Workspace` into `LLM::Sandbox`
559
+ (commit c5cc5cb) was validated by tests and equivalence probes
560
+ (`writable identical: true`, `readable identical: true` across working
561
+ directories) but **independent review was never performed** — recorded in
562
+ the closing line of the producing artifact (since retired; no in-repo copy).
563
+ The verified content itself
564
+ is already promoted into [developer/Sandbox.md](developer/Sandbox.md)
565
+ Layer-1; the residual gap is the review, not the content. Note: the
566
+ equivalence probes depended on `RUBYOPT` checkout overrides; see
567
+ `research/scout-ai-runtime-availability.md` for the clean-environment
568
+ caveat.
569
+
570
+ ### R16 (open). ScoutException recoverability semantics not documented in doc/
571
+
572
+ `doc/` documents `ParameterException` as the error contract (e.g.
573
+ [developer/PathEngine.md](developer/PathEngine.md) §9) but nowhere states
574
+ the recoverability semantics of Scout exceptions. The durable statement
575
+ lives in the scout-gear Cortex store as
576
+ `claims/scout-exception-recoverability-contract.md` (map `scout_gear_lib`):
577
+ ScoutException subclasses are for non-recoverable, reproducible input
578
+ failures; scout-ai's engine usage matches it. That claim is outside this
579
+ repository's purge scope and survives it; the open item is whether to
580
+ surface a short contract statement in scout-ai's own developer docs.
581
+
582
+ ### R17 (open). Test-suite residuals from the 2026-10 finalize round
583
+
584
+ Small leftovers recorded by the finalize/test-repair outcome artifacts,
585
+ none blocking, all still present in the tree: (a) unused `expanded`
586
+ variable at `test/scout/llm/test_sandbox.rb:199` (assigned, never read);
587
+ (b) `test/scout/llm/chat/agent_meta_fixtures.rb` still returns positional
588
+ arrays from its helper tuples (explicitly deferred in the repair round —
589
+ convert to named Hashes when next touched); (c) tooling anomaly observed
590
+ twice (not a product defect): the agent `Workspace write` tool once
591
+ reported success for checkout paths while bash saw no files — worth a
592
+ sandbox/path-map diagnosis by the runtime owner; (d) a transient
593
+ graphviz-tmpdir race in `TestProvTimeline` T12 that never reproduced.
594
+ Evidence: the finalize outcome record (Cortex, 2026-10-18) and
595
+ `research/sandbox-docs-facts.md` §5 — the facts sheet itself was retired
596
+ 2026-10-19 with its four `[unverified]` residues recorded here and in
597
+ `doc/developer/Sandbox.md`. The settle-with-author question on
598
+ commit `4680bd9`'s `path_list` `path` parameter was resolved in favor of
599
+ retention and is pinned by nine tests in
600
+ `test/scout/llm/agent/test_path_filesystem.rb` (commit `eaa55db`) —
601
+ closed, recorded here so the history survives the Cortex purge.
602
+
603
+ ### R18 (closed, provenance record). Suite baseline history 656 → 679 → 688
604
+
605
+ For anyone chasing count drift later: the ordinary suite baseline moved
606
+ 656 tests/3178 assertions (after availability integration) → 679/3238
607
+ (test-repair round, three identical runs + Critic confirmation) →
608
+ 688/3255 (finalize round, +9 `path_list` tests) — the count still standing
609
+ at the 2026-10-18 baseline commit (`a2e3f6f`) and unchanged at the current
610
+ HEAD. All runs used `cd <checkout> &&
611
+ BWRAP_PATH=false rake test` — the env var placement matters (a leading
612
+ token is intercepted by the bash wrapper and silently dropped).
613
+ Omissions throughout: 3 HF-cache, 1 transformers/datasets, 2 torch, 1
614
+ CUDA — all genuinely optional prerequisites. Source: the finalize and
615
+ test-repair outcome records (Cortex, 2026-10-17/18), restated here
616
+ because those artifacts are scheduled for removal.
236
617
 
237
- ### AP3. Don't use plain `Hash` for options that come from user input
238
-
239
- **❌ Non-idiomatic:**
240
- ```ruby
241
- def ask(question, options = {})
242
- model = options[:model] # fails if user passed 'model' as a string key
243
- end
244
- ```
245
-
246
- **✅ Idiomatic:**
247
- ```ruby
248
- def ask(question, options = {})
249
- options = IndiferentHash.setup(options)
250
- model = options[:model] # works for both :model and 'model'
251
- end
252
- ```
253
-
254
- **Why:** Options arrive from YAML files, CLI flags, and Ruby hashes with
255
- inconsistent key types. `IndiferentHash` normalizes access. Always call
256
- `IndiferentHash.setup` on any options hash at the entry point.
257
618
 
258
619
  ---
259
620
 
260
- ### AP4. Don't subclass to add behavior
261
-
262
- **❌ Non-idiomatic:**
263
- ```ruby
264
- class SpecialChat < Array
265
- def user(content)
266
- self << { role: 'user', content: content }
267
- end
268
- end
269
- ```
270
-
271
- **✅ Idiomatic:**
272
- ```ruby
273
- module Chat
274
- extend Annotation
275
- def user(content)
276
- message(:user, content)
277
- end
278
- end
279
- # Then: Chat.setup(any_array)
280
- ```
281
-
282
- **Why:** Subclassing creates a rigid hierarchy and breaks the "plain Array"
283
- contract. Annotation and module composition add behavior non-invasively.
621
+ ## Documentation promotion ledger (2026-09-11)
622
+
623
+ This ledger records promotions into doc/, not every deletion: per-file
624
+ retirement provenance for the ~17 research files retired in 2026-09-12
625
+ (batches B1–B7) lives in the individual commit messages, not here (noted
626
+ 2026-09-12).
627
+
628
+ The research file `research/coding-philosophy-analysis.md` is superseded by
629
+ [developer/DesignPrinciples.md](developer/DesignPrinciples.md). What was
630
+ promoted, and where it landed:
631
+
632
+ - **Annotation mechanics** (`Annotation.purge`, singleton-class installation,
633
+ `annotation_types`) — *Chat-as-data (annotate, don't wrap)*.
634
+ - **The four executor kinds of the tool registry** (`Proc`, workflow
635
+ name/module, `KnowledgeBase`, plus the bare-Hash degenerate case) and
636
+ "prefer Proc blocks for tools" — *Idiomatic patterns to follow*.
637
+ - **Proc/block-based DSLs** (task blocks run only on cache miss,
638
+ `Persist.persist` as compute-once) — *Idiomatic patterns to follow*.
639
+ - **`include_workflow` over plain `include`** for mixins carrying class-level
640
+ state such as `AgentWorkflow` — *Module composition over inheritance* and
641
+ the anti-pattern list.
642
+ - **Configuration cascade** (`Scout::Config.get` precedence: options →
643
+ env → config file → default) — *IndiferentHash everywhere*.
644
+ - **Environment keys are `<TAG>_KEY`, not `<PROVIDER>_API_KEY`** —
645
+ *IndiferentHash everywhere*.
646
+ - **Adding a role by extending the Chat annotation module** rather than
647
+ post-processing parsed messages — *Idiomatic patterns to follow* /
648
+ anti-pattern list.
649
+ - **Naming conventions** (file paths mirror module nesting; DSL verbs,
650
+ predicate `?` suffixes, `setup` class methods, `options`/`path`/`agent`
651
+ variables) — *File and method naming*.
652
+
653
+ Everything else in the file was either already covered by DesignPrinciples.md
654
+ or was example-flavored duplication of the rules above, so the file can be
655
+ deleted without loss. Its remaining references were removed from
656
+ [StartHere.md](StartHere.md) (reading-path row and the research/ tree
657
+ listing).
284
658
 
285
659
  ---
286
660
 
287
- ### AP5. Don't scatter file I/O without `Path` / `Open`
288
-
289
- **❌ Non-idiomatic:**
290
- ```ruby
291
- File.read("/hardcoded/path/#{name}")
292
- ```
293
-
294
- **✅ Idiomatic:**
295
- ```ruby
296
- path = Scout.var.Agent[name].start_chat
297
- content = Open.read(path.find) if path.exists?
298
- ```
299
-
300
- **Why:** Scout's `Path` API handles convention-based resolution, annotation,
301
- and existence checks. `Open` provides atomic writes and encoding safety.
302
- Hardcoded paths break portability and testability.
303
-
304
- ---
661
+ ## Anti-patterns to Watch For
305
662
 
306
- ### AP6. Don't define methods on `Agent` that duplicate `Chat`
307
-
308
- **❌ Non-idiomatic:**
309
- ```ruby
310
- class Agent
311
- def add_user_message(text)
312
- current_chat << { role: 'user', content: text }
313
- end
314
- end
315
- ```
316
-
317
- **✅ Idiomatic:**
318
- ```ruby
319
- agent.user(text) # works automatically via method_missing → current_chat
320
- ```
321
-
322
- **Why:** `Agent` already delegates unknown methods to `current_chat` via
323
- `method_missing`. Defining wrapper methods on `Agent` creates redundancy and
324
- maintenance overhead. If the method exists on `Chat`, it already works on
325
- `Agent`.
663
+ The catalogue has moved: these are now maintained in
664
+ [developer/DesignPrinciples.md](developer/DesignPrinciples.md)
665
+ ("Anti-patterns to avoid"), which is the single normative source. The AP1–AP6
666
+ entries that used to live here were deleted in the 2026-09-11 documentation
667
+ promotion once their content was fully covered there.