@lazyingart/agintiflow 0.12.9 → 0.12.11

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.
package/README.md CHANGED
@@ -67,7 +67,7 @@ aginti
67
67
  aginti chat
68
68
  ```
69
69
 
70
- Inside chat, type normal requests such as `write a small Python CLI app with tests`. The default is Docker workspace mode with approved package installs, so coding, plotting, and LaTeX tasks can set up project-local tools without touching the host. Use `/help` for commands, `/login` or `/auth` to paste a provider key, `/instructions` to inspect `AGINTI.md`, `/latex on` for PDF work, `/docker off` only when you intentionally want host mode, `/sessions` to list project runs, and `/resume latest` or `/resume <session-id>` to continue work. Type `/` then Tab for command completion. `Ctrl+J` inserts a new line in the colored input panel, Enter sends, arrow keys move through wrapped multiline input, and `Ctrl+A`/`Ctrl+E` jump to the current line start/end. During an active run, Enter sends the draft as an ASAP pipe message (`→`) and Tab queues it for after the run (`↳`); ASAP messages are consumed first, Alt+Up edits the last piped message, and Shift+Left edits the last after-finish queued message. The input panel always shows the current `cwd` footer and a single live status row, so long goals and tool updates are compacted instead of flooding the transcript. Assistant responses start on a fresh line after the `aginti>` header with a colored response gutter and render common Markdown, including headings, inline code, bold text, lists, quotes, code fences, tables, and red/green patch diff lines. Resuming a session prints a compact recent-chat preview before the prompt. Esc or Ctrl+C stops the active run cleanly and prints the resume command.
70
+ Inside chat, type normal requests such as `write a small Python CLI app with tests`. The default is Docker workspace mode with approved package installs, so coding, plotting, and LaTeX tasks can set up project-local tools without touching the host. Use `/help` for commands, `/login` or `/auth` to paste a provider key, `/instructions` to inspect `AGINTI.md`, `/latex on` for PDF work, `/docker off` only when you intentionally want host mode, `/sessions` to list project runs, and `/resume latest` or `/resume <session-id>` to continue work. Type `/` then Tab for command completion. `Ctrl+J` inserts a new line in the colored input panel, Enter sends, arrow keys move through wrapped multiline input, and `Ctrl+A`/`Ctrl+E` jump to the current line start/end. During an active run, Enter sends the draft as an ASAP pipe message (`→`) and Tab queues it for after the run (`↳`); ASAP messages are consumed first, Alt+Up edits the last piped message, and Shift+Left edits the last after-finish queued message. The input panel always shows the current `cwd` footer and a single live status row, so long goals and tool updates are compacted instead of flooding the transcript. Assistant responses start on a fresh line after the `aginti>` header with a colored response gutter and render common Markdown, including headings, inline code, bold text, lists, quotes, code fences, tables, and red/green patch diff lines. Resuming a session prints the full saved chat history with wrapped messages before the prompt. Esc or Ctrl+C stops the active run cleanly and prints the resume command.
71
71
 
72
72
  `aginti init` creates `AGINTI.md` at the project root. This is the editable project-instruction file for both CLI and web runs, similar to `AGENTS.md` or project memory in other agents. Keep durable preferences, commands, and constraints there, but never secrets. You can edit it manually or ask in chat, for example: `update AGINTI.md to remember that this project uses pytest and npm run check`.
73
73
 
@@ -75,7 +75,9 @@ For code edits, AgInTiFlow routes patch/refactor/database-style tasks to DeepSee
75
75
 
76
76
  For larger repositories, use `--profile large-codebase` or choose **Large codebase engineering** in the web UI. The web default stays **Auto**, and Auto now escalates codebase/system/debugging prompts to the same engineering loop when needed. Complex work routes to DeepSeek v4 pro, starts with `inspect_project`, then uses search/read/patch/check loops inspired by Codex, Copilot SDK, Claude Code, Gemini CLI, Qwen, and Claw Code. See [docs/large-codebase-engineering.md](docs/large-codebase-engineering.md).
77
77
 
78
- AgInTiFlow can also spend cheap DeepSeek calls on parallel scout notes before the main executor starts a complicated task. Scouts run independently for architecture, implementation, review, research, context mapping, tests, git workflow, and integration risks, then a coordinator synthesis is injected for the main agent. The executor still does the real file/shell/browser work itself. Disable with `--no-parallel-scouts` or set `--scout-count 1..8`.
78
+ AgInTiFlow can also spend cheap DeepSeek calls on parallel scout notes before the main executor starts a complicated task. It first builds a bounded `inspect_project` context pack, then runs scouts for architecture, implementation, review, research, context mapping, tests, git workflow, integration, symbol tracing, and dependency risks. A coordinator Swarm Board is injected for the main agent. The executor still does the real file/shell/browser work itself. Disable with `--no-parallel-scouts` or set `--scout-count 1..10`.
79
+
80
+ The next productive-agent roadmap is tracked in [docs/productive-agent-roadmap.md](docs/productive-agent-roadmap.md): durable codebase maps, stronger scout blackboards, long-run checkpoints, LSP/symbol tools, test triage, and release automation.
79
81
 
80
82
  For current docs, install errors, package/toolchain setup, and source discovery, the agent has a guarded `web_search` tool. It returns compact search results without browser search-engine loops and respects configured domain allowlists. Disable with `--no-web-search`.
81
83
 
@@ -13,6 +13,8 @@ Local agent references informed the design:
13
13
  - Claw-style `doctor` discipline: check health and environment before treating system symptoms as code bugs.
14
14
  - Claude/Codex-style context discipline: read project instructions, manifests, entry points, and failing tests before touching broad files.
15
15
 
16
+ The shared pattern is not “put the whole repo in context.” It is: build a cheap map, choose the next exact evidence, edit with deterministic patches, verify, then compact what changed. AgInTiFlow uses cheap DeepSeek calls to add more independent eyes around that loop, not to replace it.
17
+
16
18
  ## Skill vs Tool
17
19
 
18
20
  The `large-codebase` profile is a skill: it changes the model’s engineering behavior. It tells DeepSeek v4 pro to orient first, plan minimally, patch incrementally, and verify.
@@ -94,11 +96,15 @@ DeepSeek calls are cheap enough that complex tasks can use several short advisor
94
96
  - Tester: finds the narrowest useful checks and setup blockers.
95
97
  - Git operator: keeps status/diff/commit/pull/push workflows disciplined.
96
98
  - Integrator: looks for cross-stream conflicts and ordering constraints.
99
+ - Symbol tracer: predicts names, APIs, routes, schemas, and searches that connect the change.
100
+ - Dependency doctor: checks package managers, Docker/toolchain setup, generated artifacts, and install risks.
101
+
102
+ Before scouts run, AgInTiFlow builds a bounded shared context pack with `inspect_project`: manifests, top-level files, source/test directories, package scripts, language counts, git status hints, and recommended reads. This avoids the weak pattern of each scout rediscovering the repo differently or flooding the main context with an infinite tree.
97
103
 
98
- Scout output is synthesized by a coordinator note and injected as advisory context only. The main agent still owns execution and must use real tools to inspect, edit, run commands, and finish. CLI flags:
104
+ Scout output is synthesized by a coordinator Swarm Board and injected as advisory context only. The board records shared context, execution order, conflicts/unknowns, must-read files/checks, and stop conditions. The main agent still owns execution and must use real tools to inspect, edit, run commands, and finish. CLI flags:
99
105
 
100
106
  ```bash
101
- aginti --parallel-scouts --scout-count 8 "fix this complicated repo bug"
107
+ aginti --parallel-scouts --scout-count 10 "fix this complicated repo bug"
102
108
  aginti --no-parallel-scouts "run a cheap short task"
103
109
  ```
104
110
 
@@ -0,0 +1,35 @@
1
+ # Productive Agent Roadmap
2
+
3
+ AgInTiFlow should become a practical coding agent, not only a chat UI around a model. DeepSeek v4 pro is strong and cheap, so the advantage is to spend more inference on context, review, and verification while keeping the main executor focused.
4
+
5
+ ## Lessons From Other Agents
6
+
7
+ - Codex: orient with file search, edit with deterministic patches, run focused checks, and keep git status visible.
8
+ - Claude Code: keep the terminal UX simple, project-local, resumable, and interruption-friendly.
9
+ - Gemini CLI: expose extensibility through tools, MCP-style capabilities, large-context workflows, and auth/setup discovery.
10
+ - Copilot SDK: make sessions, hooks, permissions, telemetry, and tool events first-class APIs.
11
+ - Claw Code: use doctor/preflight checks, container-first execution, parity tests, and explicit lifecycle state.
12
+ - LazyingArtBot: preserve workflow memory and artifacts so the agent can continue creative or production tasks later.
13
+
14
+ ## Current Strengths
15
+
16
+ - Project-local CLI and web share sessions, preferences, artifacts, and `AGINTI.md`.
17
+ - DeepSeek flash/pro routing, Docker workspace mode, web search, image generation, canvas artifacts, and guarded file tools are already wired.
18
+ - `inspect_project`, `apply_patch`, command policy, git discipline, and the scout swarm give the model concrete tools instead of relying on memory.
19
+
20
+ ## Missing Productive-Agent Pieces
21
+
22
+ 1. Durable codebase map: cache `inspect_project`, symbol locations, test commands, package scripts, and recently changed files per project.
23
+ 2. Scout blackboard: let scouts write short structured findings to a shared board, then run a coordinator pass that resolves conflicts before execution.
24
+ 3. Long-run checkpoints: save phase state after inspect, patch, test, repair, and commit so a long task can recover after interruption.
25
+ 4. Symbol/LSP tools: add find-definition, references, diagnostics, and document-symbols for JS/TS, Python, Rust, Go, and C/C++ where available.
26
+ 5. Test triage: parse common test failures into file, symbol, command, and likely cause so repair loops stay narrow.
27
+ 6. Patch review loop: before finalizing large edits, run a cheap reviewer scout over diffs, risks, and missing tests.
28
+ 7. Dependency doctor: detect toolchain gaps and propose Docker/project-local setup before touching host installs.
29
+ 8. Release assistant: status, diff, changelog, version bump, pack, publish, push, and rollback notes as a reusable workflow.
30
+
31
+ ## Swarm Design
32
+
33
+ Scouts must not become noisy subagents. Each scout gets the same bounded context pack and one role. The coordinator produces a Swarm Board with shared context, execution order, disagreements, must-read files, checks, and stop conditions. The main agent still owns tool use and must re-read exact files before editing.
34
+
35
+ Use 3 scouts for medium tasks, 5 for large tasks, and up to 10 for complex multi-language or system tasks. More scouts are only useful when their roles cover different failure modes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.12.9",
3
+ "version": "0.12.11",
4
4
  "type": "module",
5
5
  "description": "AgInTiFlow is a resumable Playwright website-control agent with OpenAI-compatible tool calling.",
6
6
  "license": "Apache-2.0",
package/public/app.js CHANGED
@@ -1042,7 +1042,7 @@ function formPayload() {
1042
1042
  allowAuxiliaryTools: allowAuxiliaryToolsField?.checked ?? true,
1043
1043
  allowWebSearch: allowWebSearchField?.checked ?? true,
1044
1044
  allowParallelScouts: allowParallelScoutsField?.checked ?? true,
1045
- parallelScoutCount: Math.min(Math.max(Number(parallelScoutCountField?.value) || 3, 1), 8),
1045
+ parallelScoutCount: Math.min(Math.max(Number(parallelScoutCountField?.value) || 3, 1), 10),
1046
1046
  allowWrapperTools: allowWrapperToolsField.checked,
1047
1047
  preferredWrapper: preferredWrapperField.value,
1048
1048
  taskProfile: taskProfileField?.value || "auto",
package/public/index.html CHANGED
@@ -205,7 +205,7 @@
205
205
 
206
206
  <label>
207
207
  <span data-i18n="parallelScoutCountLabel">Scout count</span>
208
- <input id="parallelScoutCount" name="parallelScoutCount" type="number" min="1" max="8" value="3" />
208
+ <input id="parallelScoutCount" name="parallelScoutCount" type="number" min="1" max="10" value="3" />
209
209
  </label>
210
210
 
211
211
  <div class="grid wrapper-controls">
@@ -150,13 +150,16 @@ try {
150
150
  if (!latest.stdout.includes("resume history") || !latest.stdout.includes("Mock run complete")) {
151
151
  throw new Error("bare aginti resume did not preview saved chat history");
152
152
  }
153
+ if (latest.stdout.includes("showing=") || latest.stdout.includes("…")) {
154
+ throw new Error("resume history should render full saved messages instead of compact previews");
155
+ }
153
156
 
154
157
  console.log(
155
158
  JSON.stringify(
156
159
  {
157
160
  ok: true,
158
161
  projectRoot: tempRoot,
159
- checks: ["markdown-render", "markdown-table-no-duplicate", "patch-diff-render", "prompt-layout", "live-input-status-layout", "agent-response-gutter", "aginti-md", "instructions-command", "instructions-chat-edit", "interactive-chat", "mock-file-write", "run-status", "resume-latest", "resume-history-preview"],
162
+ checks: ["markdown-render", "markdown-table-no-duplicate", "patch-diff-render", "prompt-layout", "live-input-status-layout", "agent-response-gutter", "aginti-md", "instructions-command", "instructions-chat-edit", "interactive-chat", "mock-file-write", "run-status", "resume-latest", "resume-history-full"],
160
163
  },
161
164
  null,
162
165
  2
@@ -7,7 +7,7 @@ import { repairModelMessageHistory, runAgent } from "../src/agent-runner.js";
7
7
  import { resolveRuntimeConfig } from "../src/config.js";
8
8
  import { engineeringGuidanceForTask, recommendedMaxStepsForTask } from "../src/engineering-guidance.js";
9
9
  import { selectModelRoute } from "../src/model-routing.js";
10
- import { shouldRunParallelScouts } from "../src/parallel-scouts.js";
10
+ import { listParallelScouts, runParallelScouts, shouldRunParallelScouts } from "../src/parallel-scouts.js";
11
11
  import { SessionStore } from "../src/session-store.js";
12
12
  import { searchWeb } from "../src/web-search.js";
13
13
  import { executeWorkspaceTool } from "../src/workspace-tools.js";
@@ -127,6 +127,16 @@ try {
127
127
  ),
128
128
  "parallel scouts did not enable for complex auto task"
129
129
  );
130
+ const scoutNames = listParallelScouts().map((scout) => scout.name);
131
+ assert(scoutNames.length >= 10, "parallel scout roster did not expose 10 scout roles");
132
+ for (const expectedScout of ["cartographer", "git-operator", "integrator", "symbol-tracer", "dependency-doctor"]) {
133
+ assert(scoutNames.includes(expectedScout), `parallel scout roster missing ${expectedScout}`);
134
+ }
135
+ const scoutConfig = resolveRuntimeConfig(
136
+ { provider: "mock", parallelScoutCount: 99, commandCwd: workspace },
137
+ { baseDir: runtimeDir, packageDir: repoRoot, provider: "mock", commandCwd: workspace }
138
+ );
139
+ assert(scoutConfig.parallelScoutCount === 10, "parallel scout count did not clamp to 10");
130
140
  const drySearch = await searchWeb(
131
141
  { query: "AgInTiFlow web_search smoke", maxResults: 2 },
132
142
  { allowWebSearch: true, webSearchDryRun: true }
@@ -166,6 +176,53 @@ try {
166
176
  assert(inspected.sourceDirs.some((item) => item.path === "src"), "inspect_project did not identify src directory");
167
177
  assert(inspected.testFiles.some((item) => item.path === "test/index.test.js"), "inspect_project did not identify test file");
168
178
  assert(inspected.recommendedReads.includes("package.json"), "inspect_project did not recommend package.json");
179
+ const fakeScoutPrompts = [];
180
+ const fakeScoutClient = {
181
+ chat: {
182
+ completions: {
183
+ create: async ({ messages }) => {
184
+ const systemContent = messages.find((message) => message.role === "system")?.content || "";
185
+ const userContent = messages.find((message) => message.role === "user")?.content || "";
186
+ fakeScoutPrompts.push(userContent);
187
+ const role = userContent.match(/Scout role: ([^\n]+)/)?.[1] || "coordinator";
188
+ return {
189
+ choices: [
190
+ {
191
+ message: {
192
+ content: systemContent.includes("synthesize")
193
+ ? "Swarm Board: read package.json first, inspect src/test, patch narrowly, run npm test, stop on unrelated git changes."
194
+ : `Advice from ${role}: use the shared context pack and inspect package.json before editing.`,
195
+ },
196
+ },
197
+ ],
198
+ };
199
+ },
200
+ },
201
+ },
202
+ };
203
+ const scoutRun = await runParallelScouts(
204
+ fakeScoutClient,
205
+ {
206
+ provider: "deepseek",
207
+ model: "deepseek-v4-flash",
208
+ commandCwd: workspace,
209
+ allowFileTools: true,
210
+ parallelScoutCount: 10,
211
+ goal: "fix this complicated repo test bug",
212
+ taskProfile: "large-codebase",
213
+ sandboxMode: "host",
214
+ packageInstallPolicy: "block",
215
+ },
216
+ { goal: "fix this complicated repo test bug", meta: {}, plan: "Inspect and patch." }
217
+ );
218
+ assert(scoutRun.requested === 10 && scoutRun.completed === 10, "parallel scout fake run did not complete 10 scouts");
219
+ assert(scoutRun.contextPack.includes("package.json"), "parallel scout context pack did not include manifest evidence");
220
+ assert(scoutRun.summary.includes("## shared context pack"), "parallel scout summary omitted shared context pack");
221
+ assert(scoutRun.summary.includes("## coordinator"), "parallel scout summary omitted coordinator synthesis");
222
+ assert(
223
+ fakeScoutPrompts.filter((prompt) => /Shared context pack:[\s\S]*package\.json/.test(prompt)).length >= 10,
224
+ "parallel scouts did not receive the shared context pack"
225
+ );
169
226
 
170
227
  const inspectRun = await runMock("Inspect this large codebase and recommend next reads.", "coding-inspect");
171
228
  assert(
@@ -306,8 +363,11 @@ try {
306
363
  "auto_system_pro_route",
307
364
  "auto_engineering_guidance",
308
365
  "parallel_scout_trigger",
366
+ "parallel_scout_roster",
367
+ "parallel_scout_count_clamp",
309
368
  "web_search_dry_run",
310
369
  "inspect_project",
370
+ "parallel_scout_context_pack",
311
371
  "mock_inspect_project",
312
372
  "write_file",
313
373
  "duplicate_write_failed",
@@ -1175,6 +1175,7 @@ export async function runAgent(config) {
1175
1175
  model: scouts.model,
1176
1176
  requested: scouts.requested,
1177
1177
  completed: scouts.completed,
1178
+ contextPack: scouts.contextPack ? scouts.contextPack.slice(0, 1200) : "",
1178
1179
  synthesis: scouts.synthesis || "",
1179
1180
  };
1180
1181
  state.messages.push({
@@ -1185,6 +1186,7 @@ export async function runAgent(config) {
1185
1186
  model: scouts.model,
1186
1187
  requested: scouts.requested,
1187
1188
  completed: scouts.completed,
1189
+ contextPack: scouts.contextPack || "",
1188
1190
  synthesis: scouts.synthesis || "",
1189
1191
  scouts: scouts.scouts.map((scout) => ({
1190
1192
  name: scout.name,
package/src/cli.js CHANGED
@@ -261,7 +261,7 @@ export function parseArgs(argv) {
261
261
 
262
262
  function printUsage() {
263
263
  console.log(
264
- 'Usage: aginti [chat] OR aginti web [--port 3210] OR aginti login deepseek|openai|grsai OR aginti resume [latest|<session-id>] ["prompt"] OR aginti queue <session-id> "message" OR aginti [--image] [--latex] [--routing smart|fast|complex|manual] [--provider deepseek|openai|mock] [--sandbox-mode host|docker-readonly|docker-workspace] [--package-install-policy block|prompt|allow] [--approve-package-installs] [--allow-shell|--no-shell] [--allow-file-tools|--no-file-tools] [--web-search|--no-web-search] [--parallel-scouts|--no-parallel-scouts --scout-count 1..8] [--allow-auxiliary-tools|--no-auxiliary-tools] [--allow-wrappers --wrapper codex] [--sandbox-status|--sandbox-preflight] "your task"'
264
+ 'Usage: aginti [chat] OR aginti web [--port 3210] OR aginti login deepseek|openai|grsai OR aginti resume [latest|<session-id>] ["prompt"] OR aginti queue <session-id> "message" OR aginti [--image] [--latex] [--routing smart|fast|complex|manual] [--provider deepseek|openai|mock] [--sandbox-mode host|docker-readonly|docker-workspace] [--package-install-policy block|prompt|allow] [--approve-package-installs] [--allow-shell|--no-shell] [--allow-file-tools|--no-file-tools] [--web-search|--no-web-search] [--parallel-scouts|--no-parallel-scouts --scout-count 1..10] [--allow-auxiliary-tools|--no-auxiliary-tools] [--allow-wrappers --wrapper codex] [--sandbox-status|--sandbox-preflight] "your task"'
265
265
  );
266
266
  }
267
267
 
package/src/config.js CHANGED
@@ -102,7 +102,7 @@ export function resolveRuntimeConfig(args, overrides = {}) {
102
102
  parallelScoutCount: clampNumber(
103
103
  parseNumber(overrides.parallelScoutCount ?? args.parallelScoutCount ?? process.env.AGINTI_SCOUT_COUNT, 3),
104
104
  1,
105
- 8
105
+ 10
106
106
  ),
107
107
  preferredWrapper: normalizeWrapperName(
108
108
  overrides.preferredWrapper ?? args.preferredWrapper ?? process.env.PREFERRED_WRAPPER ?? process.env.AGENT_WRAPPER
@@ -351,6 +351,20 @@ function printPreviewBlock(role, text, { time = "", bg = ansi.systemBg, maxLines
351
351
  }
352
352
  }
353
353
 
354
+ function printHistoryBlock(role, text, { time = "", bg = ansi.systemBg } = {}) {
355
+ const header = [label(role, bg).trimEnd(), time ? color(time, ansi.dim) : ""].filter(Boolean).join(" ");
356
+ outputLine(header);
357
+ const width = Math.max(terminalWidth() - 8, 38);
358
+ const rendered = stripMarkdown(text)
359
+ .split(/\r?\n/)
360
+ .map((line) => line.trimEnd());
361
+ const lines = rendered.length ? rendered : ["(empty)"];
362
+ for (const line of lines) {
363
+ const wrapped = wrapTextLine(line || " ", width);
364
+ for (const wrappedLine of wrapped) outputLine(`${color(" | ", bg)} ${wrappedLine}`);
365
+ }
366
+ }
367
+
354
368
  function printSystemLine(text) {
355
369
  if (!String(text || "").trim()) {
356
370
  outputLine("");
@@ -468,7 +482,7 @@ function printHelp() {
468
482
  " /sessions List recent sessions in this project.",
469
483
  " /profile <name> Set task profile, e.g. code, website, latex, maintenance.",
470
484
  " /web-search on|off Enable or disable the web_search tool.",
471
- " /scouts on|off|<1-8> Enable parallel DeepSeek scouts and set scout count.",
485
+ " /scouts on|off|<1-10> Enable parallel DeepSeek scouts and set scout count.",
472
486
  " /routing <mode> Set routing: smart, fast, complex, manual.",
473
487
  " /provider <name> Set provider: deepseek, openai, mock.",
474
488
  " /model <name> Set an explicit model, or /model auto.",
@@ -1298,20 +1312,14 @@ async function latestSession() {
1298
1312
  return sessions[0] || null;
1299
1313
  }
1300
1314
 
1301
- function compactHistoryText(content = "", limit = 170) {
1302
- const rendered = stripAnsi(stripMarkdown(String(content || "")));
1303
- return compactLine(rendered.replace(/\s+/g, " "), limit);
1304
- }
1305
-
1306
1315
  function printHistoryEntry(entry) {
1307
1316
  const role = entry.role === "assistant" ? "aginti" : entry.role === "user" ? "user" : String(entry.role || "note");
1308
1317
  const bg = role === "aginti" ? ansi.agentBg : role === "user" ? ansi.userBg : ansi.systemBg;
1309
1318
  const time = entry.at ? new Date(entry.at).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : "";
1310
- const maxLines = role === "aginti" ? 4 : 3;
1311
- printPreviewBlock(role, compactHistoryText(entry.content, 520), { time, bg, maxLines });
1319
+ printHistoryBlock(role, entry.content, { time, bg });
1312
1320
  }
1313
1321
 
1314
- async function printResumeHistory(state, { limit = 8 } = {}) {
1322
+ async function printResumeHistory(state, { limit = 0 } = {}) {
1315
1323
  if (!state.sessionId) return;
1316
1324
  const store = new SessionStore(projectPaths(process.cwd()).sessionsDir, state.sessionId);
1317
1325
  const saved = await store.loadState().catch(() => null);
@@ -1321,8 +1329,10 @@ async function printResumeHistory(state, { limit = 8 } = {}) {
1321
1329
  return;
1322
1330
  }
1323
1331
 
1324
- const shown = chat.slice(-limit);
1325
- printSystemLine(`resume history session=${state.sessionId} showing=${shown.length}/${chat.length}`);
1332
+ const shown = limit > 0 ? chat.slice(-limit) : chat;
1333
+ printSystemLine(
1334
+ `resume history session=${state.sessionId} messages=${chat.length}${limit > 0 ? ` showing=${shown.length}/${chat.length}` : ""}`
1335
+ );
1326
1336
  for (const entry of shown) printHistoryEntry(entry);
1327
1337
  }
1328
1338
 
@@ -1596,7 +1606,7 @@ async function handleCommand(line, state, packageDir) {
1596
1606
  } else {
1597
1607
  state.allowParallelScouts = true;
1598
1608
  const count = Number(value);
1599
- if (Number.isFinite(count) && count > 0) state.parallelScoutCount = Math.min(Math.max(count, 1), 8);
1609
+ if (Number.isFinite(count) && count > 0) state.parallelScoutCount = Math.min(Math.max(count, 1), 10);
1600
1610
  }
1601
1611
  printSystemLine(`parallelScouts=${state.allowParallelScouts ? "on" : "off"} count=${state.parallelScoutCount}`);
1602
1612
  return true;
@@ -2,6 +2,10 @@ import { engineeringGuidanceForTask } from "./engineering-guidance.js";
2
2
  import { getModelPresets } from "./model-routing.js";
3
3
  import { getTaskProfile, normalizeTaskProfile } from "./task-profiles.js";
4
4
  import { redactSensitiveText } from "./redaction.js";
5
+ import { executeWorkspaceTool } from "./workspace-tools.js";
6
+
7
+ const MAX_CONTEXT_PACK_CHARS = 3800;
8
+ const MAX_SCOUT_CONTENT_CHARS = 1200;
5
9
 
6
10
  const SCOUTS = [
7
11
  {
@@ -44,8 +48,22 @@ const SCOUTS = [
44
48
  prompt:
45
49
  "Look across workstreams for conflicts, shared files, ordering constraints, and what each scout might be missing. Keep it execution-focused.",
46
50
  },
51
+ {
52
+ name: "symbol-tracer",
53
+ prompt:
54
+ "Infer likely symbols, APIs, routes, commands, schemas, or config keys that connect the change. Suggest exact searches before editing.",
55
+ },
56
+ {
57
+ name: "dependency-doctor",
58
+ prompt:
59
+ "Identify dependency, environment, package-manager, Docker, and generated-artifact risks. Prefer project-local or sandboxed setup and focused verification.",
60
+ },
47
61
  ];
48
62
 
63
+ export function listParallelScouts() {
64
+ return SCOUTS.map((scout) => ({ name: scout.name, prompt: scout.prompt }));
65
+ }
66
+
49
67
  function shouldUseComplexScouts(config, state) {
50
68
  const profile = normalizeTaskProfile(config.taskProfile);
51
69
  const goal = String(config.goal || state.goal || "");
@@ -70,20 +88,88 @@ function scoutModel(config) {
70
88
  return config.model;
71
89
  }
72
90
 
73
- function scoutMessages(config, state, scout) {
91
+ function truncateText(text, limit = MAX_CONTEXT_PACK_CHARS) {
92
+ const value = String(text || "");
93
+ if (value.length <= limit) return value;
94
+ return `${value.slice(0, limit - 80)}\n... [truncated ${value.length - limit + 80} chars]`;
95
+ }
96
+
97
+ function listValues(items, limit, mapper) {
98
+ const values = Array.isArray(items) ? items.slice(0, limit).map(mapper).filter(Boolean) : [];
99
+ if (!values.length) return "";
100
+ const suffix = Array.isArray(items) && items.length > limit ? `, ... +${items.length - limit}` : "";
101
+ return `${values.join(", ")}${suffix}`;
102
+ }
103
+
104
+ function packageScriptValues(scripts) {
105
+ if (!Array.isArray(scripts) || !scripts.length) return "";
106
+ return listValues(scripts, 14, (item) => `${item.name}: ${item.command}`);
107
+ }
108
+
109
+ async function buildScoutContextPack(config) {
110
+ if (!config.allowFileTools) {
111
+ return "Context pack: workspace file tools are disabled. Scouts should recommend the minimal inspection commands/files instead of assuming repository structure.";
112
+ }
113
+
114
+ try {
115
+ const inspected = await executeWorkspaceTool(
116
+ "inspect_project",
117
+ { path: ".", maxDepth: 4, limit: 1000, includeFiles: false },
118
+ {
119
+ ...config,
120
+ allowFileTools: true,
121
+ }
122
+ );
123
+ if (!inspected?.ok) {
124
+ return `Context pack: inspect_project unavailable (${inspected?.reason || inspected?.error || "unknown error"}).`;
125
+ }
126
+
127
+ const packageScripts = packageScriptValues(inspected.packageScripts);
128
+ const sections = [
129
+ `Context pack for ${config.commandCwd}`,
130
+ `Summary: ${inspected.summary || "no summary"}`,
131
+ inspected.counts
132
+ ? `Counts: files=${inspected.counts.files} dirs=${inspected.counts.directories} bytes=${inspected.counts.totalBytes}`
133
+ : "",
134
+ `Top level: ${listValues(inspected.topLevel, 20, (item) => `${item.type}:${item.path}`)}`,
135
+ `Manifests: ${listValues(inspected.manifestFiles, 18, (item) => item.path)}`,
136
+ `Source dirs: ${listValues(inspected.sourceDirs, 14, (item) => item.path)}`,
137
+ `Tests: ${listValues(inspected.testFiles, 18, (item) => item.path)}`,
138
+ `Package managers: ${listValues(inspected.packageManagers, 8, (item) => item.name || item.path || item)}`,
139
+ packageScripts ? `Package scripts: ${packageScripts}` : "",
140
+ `Languages: ${listValues(inspected.languageCounts, 10, (item) => `${item.name}:${item.count}`)}`,
141
+ inspected.git?.present
142
+ ? `Git: present; start with ${inspected.git.recommendedCommands?.join(" && ") || "git status --short"}; ${inspected.git.workflow}`
143
+ : "Git: not detected at workspace root.",
144
+ `Recommended reads: ${listValues(inspected.recommendedReads, 16, (item) => item)}`,
145
+ `Engineering hints: ${listValues(inspected.engineeringHints, 8, (item) => item)}`,
146
+ ].filter(Boolean);
147
+
148
+ return truncateText(redactSensitiveText(sections.join("\n")));
149
+ } catch (error) {
150
+ return `Context pack: inspect_project failed (${redactSensitiveText(error instanceof Error ? error.message : String(error))}).`;
151
+ }
152
+ }
153
+
154
+ function capScoutContent(content) {
155
+ return truncateText(redactSensitiveText(content || "").trim(), MAX_SCOUT_CONTENT_CHARS);
156
+ }
157
+
158
+ function scoutMessages(config, state, scout, contextPack) {
74
159
  const profile = getTaskProfile(config.taskProfile);
75
160
  const guidance = engineeringGuidanceForTask(config.goal || state.goal || "", config.taskProfile);
76
161
  return [
77
162
  {
78
163
  role: "system",
79
164
  content:
80
- "You are a parallel scout for AgInTiFlow. Your answer is advisory only: do not claim work is done, do not ask questions, do not use tools, and keep under 180 words.",
165
+ "You are a parallel scout for AgInTiFlow. Your answer is advisory only: do not claim work is done, do not ask questions, do not use tools, and keep under 180 words. Work from the shared context pack and state dependencies on other scout roles when relevant.",
81
166
  },
82
167
  {
83
168
  role: "user",
84
169
  content: [
85
170
  `Scout role: ${scout.name}`,
86
171
  scout.prompt,
172
+ `Shared context pack:\n${contextPack}`,
87
173
  `Goal: ${config.goal || state.goal || ""}`,
88
174
  `Task profile: ${profile.label}. ${profile.prompt}`,
89
175
  guidance,
@@ -100,7 +186,7 @@ function scoutMessages(config, state, scout) {
100
186
  ];
101
187
  }
102
188
 
103
- async function synthesizeScouts(client, config, model, scouts) {
189
+ async function synthesizeScouts(client, config, model, scouts, contextPack) {
104
190
  const usable = scouts.filter((scout) => scout.content);
105
191
  if (usable.length < 2) return "";
106
192
  const response = await client.chat.completions.create(
@@ -111,11 +197,13 @@ async function synthesizeScouts(client, config, model, scouts) {
111
197
  {
112
198
  role: "system",
113
199
  content:
114
- "You synthesize parallel coding-agent scout notes. Produce a compact execution brief under 220 words. Resolve conflicts, identify shared context, and list stop conditions. Do not claim work is done.",
200
+ "You synthesize parallel coding-agent scout notes into a Swarm Board. Produce under 320 words with: shared context, execution order, conflicts/unknowns, must-read files/checks, and stop conditions. Prefer concrete paths/commands from the context pack. Do not claim work is done.",
115
201
  },
116
202
  {
117
203
  role: "user",
118
- content: usable.map((scout) => `## ${scout.name}\n${scout.content}`).join("\n\n"),
204
+ content: [`## shared context pack\n${contextPack}`, ...usable.map((scout) => `## ${scout.name}\n${scout.content}`)].join(
205
+ "\n\n"
206
+ ),
119
207
  },
120
208
  ],
121
209
  },
@@ -128,20 +216,21 @@ export async function runParallelScouts(client, config, state) {
128
216
  const count = Math.min(Math.max(Number(config.parallelScoutCount) || 3, 1), SCOUTS.length);
129
217
  const selected = SCOUTS.slice(0, count);
130
218
  const model = scoutModel(config);
219
+ const contextPack = await buildScoutContextPack(config);
131
220
  const settled = await Promise.allSettled(
132
221
  selected.map(async (scout) => {
133
222
  const response = await client.chat.completions.create(
134
223
  {
135
224
  model,
136
225
  temperature: 0,
137
- messages: scoutMessages(config, state, scout),
226
+ messages: scoutMessages(config, state, scout, contextPack),
138
227
  },
139
228
  config.abortSignal ? { signal: config.abortSignal } : undefined
140
229
  );
141
230
  return {
142
231
  name: scout.name,
143
232
  model,
144
- content: redactSensitiveText(response.choices[0]?.message?.content || "").trim(),
233
+ content: capScoutContent(response.choices[0]?.message?.content || ""),
145
234
  };
146
235
  })
147
236
  );
@@ -157,12 +246,13 @@ export async function runParallelScouts(client, config, state) {
157
246
  const completed = scouts.filter((scout) => scout.content).length;
158
247
  const synthesis =
159
248
  completed > 1
160
- ? await synthesizeScouts(client, config, model, scouts).catch((error) =>
249
+ ? await synthesizeScouts(client, config, model, scouts, contextPack).catch((error) =>
161
250
  `Synthesis failed: ${redactSensitiveText(error instanceof Error ? error.message : String(error))}`
162
251
  )
163
252
  : "";
164
253
  const summary = [
165
- "Parallel scout notes. Treat these as advisory, not completed work.",
254
+ "Parallel scout swarm notes. Treat these as advisory shared context, not completed work.",
255
+ `\n## shared context pack\n${contextPack}`,
166
256
  synthesis ? `\n## coordinator\n${synthesis}` : "",
167
257
  ...scouts.map((scout) =>
168
258
  scout.content ? `\n## ${scout.name}\n${scout.content}` : `\n## ${scout.name}\nScout failed: ${scout.error || "unknown error"}`
@@ -177,6 +267,7 @@ export async function runParallelScouts(client, config, state) {
177
267
  requested: selected.length,
178
268
  completed,
179
269
  scouts,
270
+ contextPack,
180
271
  synthesis,
181
272
  summary,
182
273
  };