@lazyingart/agintiflow 0.20.197 → 0.20.199

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 (88) hide show
  1. package/.env.example +34 -0
  2. package/AGENTS.md +1 -1
  3. package/README.md +26 -16
  4. package/bin/aginti-cli.js +18 -3
  5. package/docs/agent-runtime-pipe.md +24 -0
  6. package/docs/auxiliary-image-generation.md +6 -0
  7. package/docs/external-skill-packs.md +1 -1
  8. package/docs/labcanvas-chatops-fallback.md +46 -0
  9. package/docs/large-codebase-engineering.md +7 -7
  10. package/docs/local-first-agent-runtime.md +199 -0
  11. package/docs/model-selection.md +29 -12
  12. package/docs/patch-tools.md +1 -1
  13. package/docs/perception-and-web-research.md +9 -6
  14. package/docs/productive-agent-roadmap.md +2 -2
  15. package/docs/self-development-supervision.md +2 -2
  16. package/docs/skills-and-tools.md +9 -5
  17. package/i18n/README.ar.md +24 -12
  18. package/i18n/README.de.md +24 -12
  19. package/i18n/README.es.md +24 -12
  20. package/i18n/README.fr.md +24 -12
  21. package/i18n/README.ja.md +24 -12
  22. package/i18n/README.ko.md +24 -12
  23. package/i18n/README.ru.md +24 -12
  24. package/i18n/README.vi.md +24 -12
  25. package/i18n/README.zh-Hans.md +24 -12
  26. package/i18n/README.zh-Hant.md +24 -12
  27. package/package.json +31 -5
  28. package/public/app.js +106 -277
  29. package/public/index.html +27 -15
  30. package/public/markdown-renderer.js +222 -0
  31. package/public/math-renderer.js +163 -0
  32. package/public/styles.css +48 -0
  33. package/references/lazyingrouter-account-login-design.md +9 -8
  34. package/references/model-routing-provider-design.md +25 -16
  35. package/references/venice-model-reference.md +6 -4
  36. package/scripts/fixtures/local-first-agent-eval-fixtures.mjs +93 -0
  37. package/scripts/local-first-agent-eval.mjs +696 -0
  38. package/scripts/smoke-auth.js +10 -8
  39. package/scripts/smoke-auxiliary-tools.js +108 -3
  40. package/scripts/smoke-cli-chat.js +306 -5
  41. package/scripts/smoke-execution-policy.js +61 -1
  42. package/scripts/smoke-inbox.js +416 -0
  43. package/scripts/smoke-local-resource-policy.js +112 -0
  44. package/scripts/smoke-localllm-auto-max.js +393 -0
  45. package/scripts/smoke-localllm-model-tiers.js +365 -0
  46. package/scripts/smoke-localllm-provider.js +723 -0
  47. package/scripts/smoke-math-rendering.js +213 -0
  48. package/scripts/smoke-mcp.js +108 -1
  49. package/scripts/smoke-model-roles.js +94 -24
  50. package/scripts/smoke-perception-research.js +254 -0
  51. package/scripts/smoke-progressive-tool-selection.js +1178 -0
  52. package/scripts/smoke-run-stdin.js +64 -44
  53. package/scripts/smoke-runtime-core.js +98 -0
  54. package/scripts/smoke-safe-chat.js +27 -9
  55. package/scripts/smoke-session-runtime.js +385 -0
  56. package/scripts/smoke-truthful-completion.js +234 -0
  57. package/scripts/smoke-web-api.js +194 -3
  58. package/scripts/smoke-web-ui.js +31 -11
  59. package/scripts/smoke-writing-specialist-routing.js +200 -0
  60. package/src/agent-runner.js +827 -60
  61. package/src/auth-onboarding.js +20 -7
  62. package/src/auxiliary-tools.js +139 -22
  63. package/src/cli.js +185 -21
  64. package/src/config.js +188 -34
  65. package/src/context-budget-controller.js +121 -5
  66. package/src/guardrails.js +95 -9
  67. package/src/i18n.js +11 -11
  68. package/src/interactive-cli.js +202 -70
  69. package/src/json-specialist.js +31 -9
  70. package/src/local-auto-max.js +203 -0
  71. package/src/local-resource-policy.js +130 -0
  72. package/src/model-client.js +151 -32
  73. package/src/model-routing.js +382 -75
  74. package/src/perception-tools.js +148 -18
  75. package/src/progressive-tool-selection.js +695 -0
  76. package/src/project.js +71 -61
  77. package/src/provider-contract.js +309 -0
  78. package/src/provider-runtime.js +447 -0
  79. package/src/safe-chat-wrapper.js +53 -23
  80. package/src/scs-evidence.js +37 -14
  81. package/src/session-index.js +119 -74
  82. package/src/session-runtime.js +626 -0
  83. package/src/session-store.js +557 -48
  84. package/src/task-profiles.js +1 -1
  85. package/src/tool-contract.js +291 -0
  86. package/src/web-db.js +49 -8
  87. package/src/writing-specialist.js +106 -34
  88. package/web.js +280 -138
package/.env.example ADDED
@@ -0,0 +1,34 @@
1
+ # Local-only credentials template. Copy to .env and keep it untracked.
2
+ # Do not commit real values.
3
+
4
+ # Default local-first text provider. Keep LocalLLM on loopback.
5
+ LOCALLLM_BASE_URL=http://127.0.0.1:8008/v1
6
+ LOCALLLM_API_KEY=local-dev-key
7
+ AGINTI_LOCALLLM_ROUTE_MODEL=localllm-fast
8
+ AGINTI_LOCALLLM_MAIN_MODEL=localllm-deep
9
+ AGINTI_LOCALLLM_MAX_MODEL=localllm-max
10
+ AGINTI_LOCALLLM_ALLOW_AUTO_MAX=false
11
+ AGINTI_LOCALLLM_VISION_MODEL=localllm-vision-xl
12
+ AGINTI_LOCALLLM_CONTEXT_TOKENS=32768
13
+ AGINTI_LOCALLLM_MAX_OUTPUT_TOKENS=8192
14
+ AGINTI_LOCALLLM_TOOL_SCHEMA_TOKENS=4096
15
+
16
+ # Auto-Max is off unless explicitly enabled. Enabled runs still require authenticated
17
+ # alias discovery plus a fresh RAM/swap/GPU headroom check before selecting Max.
18
+ # Hosted provider keys below never act as a LocalLLM failure fallback.
19
+
20
+ # Optional explicit hosted upgrades. They are never automatic fallbacks.
21
+ DEEPSEEK_API_KEY=
22
+ OPENAI_API_KEY=
23
+ AGINTI_ALLOW_HOSTED_IMAGE_PERCEPTION=false
24
+ AGINTI_ALLOW_HOSTED_WEB_RESEARCH=false
25
+ AGINTI_ALLOW_HOSTED_JSON_SPECIALIST=false
26
+ # A cross-provider writer needs both an explicit target and the permission below.
27
+ AGINTI_WRITING_PROVIDER=
28
+ AGINTI_WRITING_MODEL=
29
+ AGINTI_ALLOW_HOSTED_WRITING_SPECIALIST=false
30
+
31
+ # Optional local npm publish fallback. Prefer GitHub Actions Trusted Publishing.
32
+ NPM_TOKEN=
33
+ NODE_AUTH_TOKEN=
34
+ NPM_CONFIG_REGISTRY=https://registry.npmjs.org/
package/AGENTS.md CHANGED
@@ -20,7 +20,7 @@
20
20
  - `npm run smoke:coding-tools`: verify mock workspace writes, patches, and path guardrail blocks.
21
21
  - `npm pack --dry-run`: inspect npm package contents before release.
22
22
 
23
- Use `AGENT_PROVIDER=openai`, `AGENT_PROVIDER=deepseek`, or `AGENT_PROVIDER=mock` when running locally.
23
+ Use `AGENT_PROVIDER=localllm` for the default loopback LocalLLM runtime. Select `AGENT_PROVIDER=openai`, `AGENT_PROVIDER=deepseek`, or another hosted provider only as an explicit upgrade; saved or ambient hosted keys authenticate that choice but never select it or create a fallback. Use `AGENT_PROVIDER=mock` for deterministic offline tests.
24
24
 
25
25
  ## Coding Style & Naming Conventions
26
26
 
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  ![Node.js](https://img.shields.io/badge/Node.js-22%2B-339933?logo=nodedotjs&logoColor=white)
14
14
  ![Playwright](https://img.shields.io/badge/Browser-Playwright-2EAD33?logo=playwright&logoColor=white)
15
15
  ![CLI + Web](https://img.shields.io/badge/Interface-CLI%20%2B%20Web-0ea5e9)
16
- ![Text Models](https://img.shields.io/badge/Text-DeepSeek%20%2B%20Venice%20%2B%20OpenAI%20%2B%20Qwen-2563eb)
16
+ ![Text Models](https://img.shields.io/badge/Text-LocalLLM%20%2B%20Optional%20Hosted-2563eb)
17
17
  ![Aux Image](https://img.shields.io/badge/Aux%20Image-GRS%20AI%20%2B%20Venice-ec4899)
18
18
  ![Sandbox](https://img.shields.io/badge/Shell-Docker%20Sandbox-f97316)
19
19
  ![Status](https://img.shields.io/badge/Status-Prototype-7c3aed)
@@ -49,12 +49,12 @@ Most agent tools are either a chat box with hidden state or an expensive one-mod
49
49
 
50
50
  | Principle | What it means in practice |
51
51
  | --- | --- |
52
- | Cheap intelligence changes the architecture | DeepSeek V4 Flash and Pro make it practical to spend more calls on routing, scouting, review, and recovery instead of forcing one expensive call to do everything. |
52
+ | Local intelligence changes the architecture | The baseline uses the sibling LocalLLM gateway for private route and main lanes. Stronger hosted models remain explicit upgrades, not hidden fallbacks. |
53
53
  | Inspectable beats mysterious | Plans, tool calls, file diffs, command output, canvas artifacts, and session events are saved and resumable. |
54
54
  | Disciplined by default | `AGINTI.md` starts with a behavior contract: surface ambiguity, keep edits surgical, avoid speculative complexity, verify outcomes, and respect permission blockers. |
55
- | Role-based models | Route, main, spare, wrapper, and auxiliary image roles are separate. You can use cheap route models, stronger main models, optional OpenAI/Qwen/Venice routes, and GRS AI/Venice image tools. |
56
- | Writing without agent noise | `writing_specialist` drafts novels, books, scripts, essays, and paper prose in an isolated writing-only context, then the main agent handles files, formatting, citations, checks, and artifacts. |
57
- | Visual and web evidence | `read_image` reads screenshots/figures with typed JSON and Markdown perception artifacts, uses OpenAI vision when configured, and falls back to `codex exec --image` when Codex is available. `web_research` saves sourced research artifacts, and `research_wrapper` can ask Codex `gpt-5.4-mini` medium for a strict-JSON second opinion. |
55
+ | Role-based models | Route, main, spare, wrapper, and auxiliary image roles are separate. LocalLLM supplies the default fast/deep lanes; DeepSeek, OpenAI, OpenRouter, Qwen, and Venice are optional explicit routes. |
56
+ | Writing without agent noise | `writing_specialist` drafts novels, books, scripts, essays, and paper prose in an isolated writing-only context on the active provider. Cross-provider writing requires explicit permission; ambient keys and model arguments cannot silently switch a LocalLLM session to a hosted model. The main agent then handles files, formatting, citations, checks, and artifacts. |
57
+ | Visual and web evidence | `read_image` uses the loopback LocalLLM vision model in local sessions and never falls through to a hosted provider. `web_research` saves sourced snippet artifacts for local synthesis. OpenAI perception/research and wrapper second opinions require explicit provider/tool permission. |
58
58
  | Scouts before big work | Parallel scouts can cheaply map architecture, tests, risks, symbols, and integration points before the main executor edits anything. |
59
59
  | SCS by default | Student-Committee-Supervisor mode adds a typed gate: committee drafts, student approves/monitors, supervisor executes. Use `/scs off` or `--no-scs` only when speed matters more than validation. |
60
60
  | AAPS for large workflows | AAPS describes top-down agentic pipeline scripts; AgInTiFlow can act as the interactive backend that validates, compiles, and executes those workflows. |
@@ -85,7 +85,9 @@ aginti init --template aaps
85
85
  aginti init --template supervision
86
86
  ```
87
87
 
88
- On first interactive use, AgInTiFlow opens an auth wizard if no main model key is found. Pick DeepSeek, OpenAI, OpenRouter, Qwen, or Venice, paste the key, and it saves account-wide to `~/.agintiflow/.env` with restricted permissions. Current project `.aginti/.env` files can still override account defaults when needed. You can rerun setup any time:
88
+ By default, AgInTiFlow connects to the sibling LocalLLM gateway at `http://127.0.0.1:8008/v1`, using `localllm-fast` for routing and the installed 30B-A3B Q4 `localllm-deep` for substantive coding and agent work. The Q8 `localllm-max` remains resource-gated on every new or resumed run (24 GiB available RAM, no more than 75% swap use, and 40 GiB aggregate free NVIDIA memory). The automatic Vision policy requires both a trusted image-input signal and confirmed model capability; the shipped CLI/web currently use the readiness-checked local `read_image` tool or an explicit `localllm-vision-xl` selection rather than inferring vision from prompt keywords. Routing does not load a model. Startup checks the LocalLLM service, its Ollama runtime, selected aliases, and any required Max headroom before inference. A local failure stops with an actionable error; it never silently sends the task to a hosted provider.
89
+
90
+ Hosted providers are optional, explicit upgrades. When you select DeepSeek, OpenAI, OpenRouter, Qwen, or Venice, the auth wizard can save that provider's key account-wide in `~/.agintiflow/.env` with restricted permissions. Current project `.aginti/.env` files can still override account defaults when needed. You can rerun setup any time:
89
91
 
90
92
  ```bash
91
93
  aginti auth
@@ -100,6 +102,7 @@ Provider signup and key pages:
100
102
 
101
103
  | Provider | Register / key page | API base URL used by AgInTiFlow |
102
104
  | --- | --- | --- |
105
+ | LocalLLM | Local sibling service; no signup | `http://127.0.0.1:8008/v1` |
103
106
  | DeepSeek | [https://platform.deepseek.com/api_keys](https://platform.deepseek.com/api_keys) | `https://api.deepseek.com` |
104
107
  | OpenRouter | [https://openrouter.ai/settings/keys](https://openrouter.ai/settings/keys) | `https://openrouter.ai/api/v1` |
105
108
  | Venice | [https://venice.ai/settings/api](https://venice.ai/settings/api) | `https://api.venice.ai/api/v1` |
@@ -180,7 +183,7 @@ aginti --language de
180
183
  | Sync reviewed skills | `aginti skillmesh status`, `aginti skillmesh sync` |
181
184
  | Update CLI | `aginti update` |
182
185
 
183
- Interactive chat supports slash completion, Up/Down selectors, a newest-first resume selector with direct Space pagination, multiline input with `Ctrl+J`, full resume history, Markdown rendering, visible run status, ASAP pipe messages during a run, and clean interruption/resume with `Ctrl+C`. Installed interactive commands also check npm for a newer AgInTiFlow release and show an update/skip selector; source checkouts and non-TTY automation are left alone.
186
+ Interactive chat supports slash completion, Up/Down selectors, a newest-first resume selector with direct Space pagination, multiline input with `Ctrl+J`, full resume history, Markdown rendering, visible run status, ASAP pipe messages during a run, and clean interruption/resume with `Ctrl+C`. A resumed session keeps its versioned provider/model/tool-policy snapshot; current preferences do not silently change it, and explicit changes use revision checks. Installed interactive commands also check npm for a newer AgInTiFlow release and show an update/skip selector; source checkouts and non-TTY automation are left alone.
184
187
 
185
188
  AgInTiFlow treats `maxSteps` as an initial budget, not a silent infinite loop. By default, real-provider runs can receive a bounded extension only near the limit, only when recent tool/file/artifact evidence shows concrete progress, and never to bypass permission, package, host, or secret guardrails. Use `--dynamic-steps off` for a strict hard stop, or `--dynamic-steps on` to test the budget gate in mock/offline runs.
186
189
 
@@ -242,15 +245,15 @@ The website keeps the visual walkthrough in a carousel so this README can stay f
242
245
  | File tools | `inspect_project`, `list_files`, `read_file`, `search_files`, `write_file`, `apply_patch`, `open_workspace_file`, `preview_workspace`, and `read_image`. |
243
246
  | Shell tools | Guarded host or Docker workspace shell execution with package-install policy and command safety checks. |
244
247
  | Browser tools | Playwright browser actions with lazy startup and optional domain allowlists. |
245
- | Model routing | DeepSeek fast/pro defaults, manual OpenAI/Qwen/Venice/mock routes, spare models, wrapper models, and auxiliary image models. |
248
+ | Model routing | LocalLLM Fast/Deep defaults, explicit and resource-gated Max, image-capability-gated Vision XL, explicit DeepSeek/OpenAI/OpenRouter/Qwen/Venice/mock routes, and optional spare/wrapper/auxiliary models. |
246
249
  | Writing specialist | A dedicated writing-only LLM call for prose, chapters, scripts, books, essays, research-paper sections, and revisions, with formatter handoff notes for Markdown/LaTeX/Final Draft. |
247
250
  | Patch workflow | Codex-style patch envelopes, unified diffs, exact replacements, hashes, compact diffs, and path guardrails. |
248
251
  | Parallel scouts | Optional scout calls for architecture, implementation, review, tests, git flow, research, symbol tracing, and dependency risk. |
249
- | Image reading and web research | `read_image` uses OpenAI vision for workspace images when `OPENAI_API_KEY` is configured, otherwise it can fall back to Codex CLI image attachments when available. It saves JSON and Markdown reports and can surface the report in the canvas. `web_research` preserves source lists, and optional OpenAI hosted web search or `research_wrapper` can be used for higher-confidence research. |
252
+ | Image reading and web research | LocalLLM sessions send pixels only to the loopback vision endpoint. `web_research` preserves source lists for the active model to synthesize. Hosted OpenAI and wrapper paths are explicit opt-ins, never credential-driven fallbacks. |
250
253
  | SCS mode | Default Student-Committee-Supervisor quality gate with independent planning, execution, and validation roles. |
251
254
  | AAPS adapter | Optional `@lazyingart/aaps` integration for `.aaps` workflow init, validate, parse, compile, dry-run, and run commands. |
252
255
  | AgentLink | Local-first collaboration between AgInTi sessions through boards, typed messages, action contracts, safe summaries, and evidence bundles. |
253
- | Image generation | Optional GRS AI and Venice image tools with saved manifests and canvas artifact previews. |
256
+ | Image generation | Optional, default-off GRS AI and Venice image tools with saved manifests and canvas previews. Credentials authenticate the selected provider but never select or fail over providers. |
254
257
  | Skill library | Built-in Markdown skills plus project-local `.aginti/skills/<id>/SKILL.md` skills for reusable workflow knowledge that should not be hard-coded into the runtime. |
255
258
  | External skill packs | Whole Agent Skills repositories can be loaded as grouped packs without flattening. A sibling `../scientific-agent-skills` checkout is discovered as the `scientific` category, so commands like `aginti skills rdkit` and `aginti skills "single cell scanpy"` expose K-Dense Scientific Agent Skills when present. |
256
259
  | Skill Mesh | Optional strict skill recording/sharing for reviewed reusable skill packs. If unused, AgInTiFlow runs normally without background sharing. |
@@ -262,11 +265,11 @@ AgInTiFlow does not treat "the model" as one global setting. It has roles:
262
265
 
263
266
  | Role | Default | Purpose |
264
267
  | --- | --- | --- |
265
- | Route | `deepseek/deepseek-v4-flash` | Cheap planner, triage, short tasks, routing decisions. |
266
- | Main | `deepseek/deepseek-v4-pro` | Complex coding, debugging, writing, research, long tasks. |
267
- | Spare | `openai/gpt-5.4` medium | Optional fallback or cross-check route. |
268
+ | Route | `localllm/localllm-fast` | Local planner, triage, short tasks, and routing decisions. |
269
+ | Main | `localllm/localllm-deep` | Local complex executor for coding, debugging, writing, research, and long tasks. |
270
+ | Spare | `localllm/localllm-deep` medium | Local cross-check lane; a hosted spare requires explicit selection. |
268
271
  | Wrapper | `codex/gpt-5.5` medium | Optional external coding-agent advisor; `research_wrapper` defaults to `gpt-5.4-mini` medium for image/web second opinions. |
269
- | Auxiliary | `grsai/nano-banana-2` | Image generation and other non-text helper tools. |
272
+ | Auxiliary | `grsai/nano-banana-2` (off) | Explicitly enabled image generation and other non-text helper tools; no credential-driven provider failover. |
270
273
 
271
274
  Useful selectors:
272
275
 
@@ -280,7 +283,7 @@ Useful selectors:
280
283
  /venice
281
284
  ```
282
285
 
283
- Venice routes can be used for optional uncensored or less restricted creative work. DeepSeek remains the economic default for normal engineering workflows. See [docs/model-selection.md](docs/model-selection.md) and [references/venice-model-reference.md](references/venice-model-reference.md).
286
+ Venice routes can be used for optional uncensored or less restricted creative work. DeepSeek and the other hosted providers remain explicit upgrades for tasks that benefit from them. See [docs/model-selection.md](docs/model-selection.md), [docs/local-first-agent-runtime.md](docs/local-first-agent-runtime.md), and [references/venice-model-reference.md](references/venice-model-reference.md).
284
287
  OpenRouter is available as a first-class OpenAI-compatible provider with one key and company-grouped model buckets such as OpenRouter OpenAI, Anthropic, Google, DeepSeek, Qwen, Meta, Mistral, Moonshot, and xAI.
285
288
 
286
289
  ## AAPS And Large Workflows
@@ -356,6 +359,13 @@ Detailed runtime notes are in [docs/runtime-modes-and-autonomy.md](docs/runtime-
356
359
  Common environment variables:
357
360
 
358
361
  ```bash
362
+ AGENT_PROVIDER=localllm
363
+ LOCALLLM_BASE_URL=http://127.0.0.1:8008/v1
364
+ LOCALLLM_API_KEY=local-dev-key
365
+ AGINTI_LOCALLLM_ROUTE_MODEL=localllm-fast
366
+ AGINTI_LOCALLLM_MAIN_MODEL=localllm-deep
367
+
368
+ # Optional explicit hosted upgrades; never automatic LocalLLM fallbacks.
359
369
  DEEPSEEK_API_KEY=...
360
370
  OPENAI_API_KEY=...
361
371
  OPENROUTER_API_KEY=...
@@ -364,7 +374,6 @@ OPENROUTER_MODEL=openrouter/auto
364
374
  QWEN_API_KEY=...
365
375
  VENICE_API_KEY=...
366
376
  GRSAI_API_KEY=...
367
- AGENT_PROVIDER=deepseek
368
377
  AGENT_ROUTING_MODE=smart
369
378
  AGINTI_TASK_PROFILE=auto
370
379
  AGINTI_LANGUAGE=en
@@ -398,6 +407,7 @@ More detail:
398
407
  | AAPS adapter | [docs/aaps.md](docs/aaps.md) |
399
408
  | AgentLink | [docs/agentlink.md](docs/agentlink.md) |
400
409
  | Model selection and roles | [docs/model-selection.md](docs/model-selection.md) |
410
+ | Local-first provider and agent boundary | [docs/local-first-agent-runtime.md](docs/local-first-agent-runtime.md) |
401
411
  | SCS mode | [docs/student-committee-supervisor.md](docs/student-committee-supervisor.md) |
402
412
  | Large-codebase engineering | [docs/large-codebase-engineering.md](docs/large-codebase-engineering.md) |
403
413
  | Runtime modes and autonomy | [docs/runtime-modes-and-autonomy.md](docs/runtime-modes-and-autonomy.md) |
package/bin/aginti-cli.js CHANGED
@@ -1,7 +1,22 @@
1
1
  #!/usr/bin/env node
2
- import { main } from "../src/cli.js";
2
+ import fs from "node:fs";
3
3
 
4
- main().catch((error) => {
4
+ const argv = process.argv.slice(2);
5
+
6
+ function fail(error) {
5
7
  console.error(error);
6
8
  process.exit(1);
7
- });
9
+ }
10
+
11
+ try {
12
+ if (["--version", "version", "-v"].includes(argv[0])) {
13
+ const packageJson = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"));
14
+ console.log(packageJson.version);
15
+ } else {
16
+ import("../src/cli.js")
17
+ .then(({ main }) => main(argv))
18
+ .catch(fail);
19
+ }
20
+ } catch (error) {
21
+ fail(error);
22
+ }
@@ -8,6 +8,30 @@ AgInTiFlow keeps CLI and web runs equivalent by using a project-local session in
8
8
  - Canonical session store: `~/.agintiflow/sessions/<session-id>/`.
9
9
  - Runtime inbox: `~/.agintiflow/sessions/<session-id>/inbox.jsonl`.
10
10
 
11
+ ## Persistence Guarantees
12
+
13
+ Long-lived processes reuse one SQLite session-index connection and prepared
14
+ statement set per resolved `AGINTIFLOW_HOME`. The index enables WAL mode and a
15
+ bounded busy timeout so CLI, web, and bridge processes can update the
16
+ rebuildable index without repeatedly reopening and migrating the database.
17
+ Call `closeSessionIndexConnections()` in tests or embedding hosts that switch
18
+ runtime homes inside one process.
19
+
20
+ Each `SessionStore` memoizes directory/pointer initialization and serializes
21
+ its event appends. Concurrent callers therefore retain call order without
22
+ recreating the session pointer for every event. `state.json` remains an atomic,
23
+ fsynced save boundary. A missing state file is resumably absent; malformed JSON
24
+ raises `SESSION_STATE_CORRUPT` instead of silently looking like a new session.
25
+
26
+ ## Machine Run Input
27
+
28
+ `aginti run` uses deterministic input precedence: explicit `--stdin` reads
29
+ standard input, otherwise a positional prompt wins, and piped standard input is
30
+ used only when no positional prompt exists. This keeps positional automation
31
+ working in subprocesses whose stdin is non-interactive while preserving both
32
+ explicit and implicit pipe workflows. `aginti --version` is handled by the
33
+ lightweight launcher without loading the full agent and web runtime.
34
+
11
35
  When a run is active, the web chat and `aginti queue <session-id> "..."` append messages to the inbox instead of trying to mutate the running process directly. The web API exposes `GET /api/sessions/:id/inbox`, `POST /api/sessions/:id/inbox`, `PATCH /api/sessions/:id/inbox/:itemId`, and `DELETE /api/sessions/:id/inbox/:itemId` so browser users can inspect, edit, or remove pending pipe messages before the runner consumes them. The runner drains the inbox at safe boundaries: before each model step and after tool execution. This mirrors the event-queue style used by mature agent UIs while keeping the backend decoupled from any specific frontend.
12
36
 
13
37
  The interactive CLI keeps the input panel visible while a run is working. Enter sends the current draft as an ASAP pipe message and displays it as `→`; the runner drains those messages before normal inbox items and before after-finish queued prompts. Tab stores the draft as an after-finish queue item and displays it as `↳`; those prompts run only after the current run completes. Alt+Up moves the last pending `→` message back into the editor, and Shift+Left moves the last pending `↳` message back into the editor. Idle Esc is ignored so it does not redraw the prompt into the transcript. During a run, Esc waits when `→` pipe messages are still pending and stops the run only when no ASAP pipe message is pending; Ctrl+C always stops. The current command cwd is rendered below the input panel in both idle and running states.
@@ -7,6 +7,8 @@ AgInTiFlow separates **skills** from **tools**:
7
7
 
8
8
  The optional image-generation skills are `image_generation` and `venice_image_generation`. Both use the deterministic `generate_image` tool.
9
9
 
10
+ Hosted image generation is off by default. Enable the auxiliary mode explicitly with `/auxiliary on`, `/auxiliary image`, the corresponding UI toggle, or `allowAuxiliaryTools=true`. Merely storing `GRSAI` or `VENICE_API_KEY` does not expose or authorize `generate_image` in an agent run.
11
+
10
12
  `generate_image` is a raster-image tool. It does not produce true SVG/vector output. If a caller requests `svg`, the tool records
11
13
  `requestedFormat: "svg"`, generates a PNG fallback with `actualFormat: "png"`, and returns a `formatNotice`. If the task truly requires
12
14
  editable vectors, use AgInTiFlow file tools to write deterministic SVG/LaTeX/HTML instead of calling `generate_image`.
@@ -32,6 +34,8 @@ Inside interactive chat, use either spelling:
32
34
 
33
35
  Keys are saved in `~/.agintiflow/.env` by default as `GRSAI` or `VENICE_API_KEY` with `0600` permissions. Project `.aginti/.env` can override them. The CLI and web app only report whether a key exists; they never return raw values.
34
36
 
37
+ Provider selection is independent of key discovery. The selected auxiliary provider remains GRS AI or Venice for the whole call. If its key is missing or the request fails, the tool stops visibly; it never switches to the other provider because that provider's ambient key happens to exist. When no provider is selected, the deterministic default is GRS AI.
38
+
35
39
  ## Runtime Flow
36
40
 
37
41
  For image, cover, poster, illustration, photo, or logo-concept requests, the model can call:
@@ -118,3 +122,5 @@ Generated images are sent to the canvas automatically when available.
118
122
  ## Guardrails
119
123
 
120
124
  Output paths must stay inside the project workspace. Secret paths, `.git`, `node_modules` writes, and oversized reference images are blocked. Reference images may be workspace files, HTTPS URLs, or data URLs.
125
+
126
+ The mode gate is enforced inside `generate_image` as well as in progressive tool exposure, so a handcrafted model tool call cannot bypass a disabled auxiliary mode.
@@ -6,7 +6,7 @@ them into AgInTiFlow's built-in `skills/` directory.
6
6
 
7
7
  ## Scientific Agent Skills
8
8
 
9
- When `/home/lachlan/ProjectsLFS/Agent/scientific-agent-skills` exists,
9
+ When a sibling `../scientific-agent-skills` checkout exists,
10
10
  AgInTiFlow automatically discovers it as:
11
11
 
12
12
  - pack: `scientific-agent-skills`
@@ -0,0 +1,46 @@
1
+ # LabCanvas ChatOps Fallback
2
+
3
+ AgInTiFlow is a reasoning and tool-supervision fallback for LabCanvas. LabCanvas remains the owner of chat transport, schedules, exact-source media resolution, durable task state, routine selection, artifact validation, and delivery.
4
+
5
+ ## Contract
6
+
7
+ LabCanvas should pass one bounded task packet containing:
8
+
9
+ - exact current request and source-chat identity;
10
+ - latest same-chat interruptions and a small amount of attributed context;
11
+ - one selected routine and its contract paths;
12
+ - current deterministic preflight and stage state;
13
+ - exact artifact directory and irreversible-action gates.
14
+
15
+ AgInTi should read `AGENTS.md` and the selected routine contract, then call established commands. It should not invent a second scheduler, publication pipeline, media downloader, CAD generator, or delivery mechanism.
16
+
17
+ The default provider chain is `deepseek,localllm`. Switching providers is safe only when the first provider failed before inference or tool execution. Never replay an unknown task failure or timeout on another provider because the first attempt may already have caused a side effect.
18
+
19
+ ## Evidence Scope
20
+
21
+ ChatOps prompts may include a trusted single-line marker:
22
+
23
+ ```text
24
+ AGINTI_EVIDENCE_SCOPE_JSON: {"mode":"chat-response","request":"Produce only the requested chat response."}
25
+ ```
26
+
27
+ or:
28
+
29
+ ```text
30
+ AGINTI_EVIDENCE_SCOPE_JSON: {"mode":"task","request":"Create the requested PDF from the supplied evidence."}
31
+ ```
32
+
33
+ For `chat-response`, ordinary conversation and routing do not require file or command evidence. For `task`, evidence requirements are inferred only from the exact request, not from surrounding wrapper prose. Artifact requests still require real artifacts.
34
+
35
+ ## Local Context Recovery
36
+
37
+ LocalLLM planning compacts oversized goals to a bounded head-and-tail representation. Runtime compaction retains the first request and latest interruptions. A `LocalContextBudgetError` triggers one compact-and-retry cycle at the same step and records private recovery events. It does not authorize replaying task side effects.
38
+
39
+ Validate with:
40
+
41
+ ```bash
42
+ npm run check
43
+ npm run smoke:context-budget-recovery
44
+ npm run smoke:truthful-completion
45
+ ```
46
+
@@ -13,11 +13,11 @@ 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.
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 can use bounded scout calls on the explicitly selected provider to add more independent eyes around that loop, not to replace it.
17
17
 
18
18
  ## Skill vs Tool
19
19
 
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.
20
+ The `large-codebase` profile is a skill: it changes the model’s engineering behavior. It tells the active main model—LocalLLM Deep by default—to orient first, plan minimally, patch incrementally, and verify.
21
21
 
22
22
  The `inspect_project` function is a tool: it deterministically scans the workspace and returns:
23
23
 
@@ -48,7 +48,7 @@ Mature coding agents avoid keeping an entire growing project in the prompt. AgIn
48
48
  - Project map: `inspect_project` summaries, language counts, source/test directories, and recommended reads.
49
49
  - Active evidence: exact search hits, selected files, failing command output, and compact git status/diff.
50
50
  - Patch context: only the nearby code needed for `apply_patch`, plus before/after hashes and compact diffs.
51
- - Scout synthesis: cheap parallel DeepSeek scouts produce bounded advice, then a coordinator summary is injected instead of every long transcript becoming permanent context.
51
+ - Scout synthesis: bounded parallel scouts use the explicitly selected provider, then a coordinator summary is injected instead of every long transcript becoming permanent context.
52
52
 
53
53
  This keeps the main executor sober: it knows where it is in the repo, but it still re-reads exact files before editing and validates with commands rather than trusting stale memory.
54
54
 
@@ -84,7 +84,7 @@ aginti --profile large-codebase "fix the failing tests"
84
84
 
85
85
  or choose **Large codebase engineering** in the web task-profile dropdown.
86
86
 
87
- Smart routing sends this profile to DeepSeek v4 pro even when the user prompt is short.
87
+ Smart routing sends this profile to LocalLLM Deep even when the user prompt is short. Hosted providers are used only when selected explicitly; their presence in saved or ambient credentials does not activate them or create a fallback.
88
88
 
89
89
  ## Auto Profile Behavior
90
90
 
@@ -100,11 +100,11 @@ aginti "fix the Rust workspace build"
100
100
  aginti "repair the Docker setup and run the Node tests"
101
101
  ```
102
102
 
103
- These route to DeepSeek v4 pro when the complexity score is high enough.
103
+ These route to LocalLLM Deep when the complexity score is high enough.
104
104
 
105
105
  ## Parallel Scout Mode
106
106
 
107
- DeepSeek calls are cheap enough that complex tasks can use several short advisory calls before the main executor starts. When enabled, AgInTiFlow runs bounded scouts in parallel:
107
+ Complex tasks can use several short advisory calls before the main executor starts. When explicitly enabled, AgInTiFlow runs bounded scouts in parallel on the selected provider:
108
108
 
109
109
  - Architect: decomposes the task and identifies first files/logs/commands.
110
110
  - Implementer: predicts patch boundaries and focused checks.
@@ -139,7 +139,7 @@ aginti --no-web-search "work fully offline"
139
139
 
140
140
  ## Cross-Language Playbook
141
141
 
142
- AgInTiFlow gives DeepSeek stack-specific reminders without hardcoding a solution:
142
+ AgInTiFlow gives the active executor stack-specific reminders without hardcoding a solution:
143
143
 
144
144
  - JS/TS: inspect package scripts and lockfiles, then run focused `node`, `tsc`, or test commands.
145
145
  - Python: inspect `pyproject.toml` or requirements, prefer project-local venv/conda/Docker, then run focused pytest/module checks.
@@ -0,0 +1,199 @@
1
+ # Local-First Agent Runtime
2
+
3
+ Status: active architecture and implementation goal
4
+
5
+ ## Objective
6
+
7
+ AgInTiFlow must remain a general agent that can plan, select tools, execute guarded work, verify evidence, and finish truthfully. Its dependable baseline is the sibling LocalLLM service. DeepSeek, OpenAI, and other hosted providers remain optional upgrades, never hidden prerequisites or silent fallbacks.
8
+
9
+ The projects stay decoupled:
10
+
11
+ ```text
12
+ AgInTiFlow orchestration
13
+ -> provider/capability contract
14
+ -> LocalLLM /v1 (baseline)
15
+ -> DeepSeek / OpenAI / compatible gateways (explicit upgrades)
16
+ ```
17
+
18
+ AgInTiFlow owns sessions, plans, permissions, tool dispatch, idempotency, context compaction, recovery, and verification. LocalLLM owns bounded stateless inference. AgInTiFlow must not depend on LocalLLM's web UI, SQLite conversations, or `/api/agent/*` management routes.
19
+
20
+ ## Baseline provider contract
21
+
22
+ The canonical provider id is `localllm`. User-facing aliases `local`, `local-llm`, and `local_llm` may normalize to it, but raw engine labels such as `ollama` or `lmstudio` must not silently become LocalLLM. Saved sessions and events use the canonical id.
23
+
24
+ Default connection:
25
+
26
+ ```text
27
+ base URL: http://127.0.0.1:8008/v1
28
+ placeholder key: local-dev-key
29
+ health: http://127.0.0.1:8008/healthz
30
+ models: authenticated GET /v1/models
31
+ route lane: localllm-fast
32
+ main lane: localllm-deep
33
+ maximum lane: localllm-max
34
+ vision: localllm-vision-xl
35
+ embedding: localllm-embed (sibling-service alias; not an AgInTi text-routing tier)
36
+ ```
37
+
38
+ The default bearer value used by the local deployment is an interoperability placeholder, not a security boundary. Configuration must still send it as a normal bearer token and must never log it. Local endpoints remain loopback-only. A non-loopback LocalLLM base URL is rejected instead of quietly exporting prompts.
39
+
40
+ Readiness requires both `health.ok === true` and `health.ollama.ok === true`, followed by an authenticated `/v1/models` check that confirms the requested alias exists. Health alone is not sufficient.
41
+
42
+ The installed local ladder is capability- and resource-aware. `localllm-fast` handles short routing and bounded work; substantive coding and agent tasks use the 30B-A3B Q4 `localllm-deep` lane. The 30B-A3B Q8 `localllm-max` lane remains explicitly selectable, but every new or resumed Max run performs a fresh pre-inference gate after authenticated alias discovery. It requires at least 24 GiB available host RAM, swap use no higher than 75%, and 40 GiB aggregate free NVIDIA memory (Q8 weights plus working reserve). Missing GPU telemetry fails closed. Automatic Max is off by default and requires `AGINTI_LOCALLLM_ALLOW_AUTO_MAX=true`; an eligible run confirms the configured Max alias and fresh headroom before upgrading the actual model client from Deep. If the optional upgrade cannot be proven safe, it continues on Deep rather than failing. The automatic Vision policy requires both a trusted image-input signal and confirmed model capability. The shipped CLI/web currently reach vision through the local `read_image` tool or explicit `localllm-vision-xl` selection; both paths readiness-check the selected alias, and prompt keywords alone never activate Vision XL.
43
+
44
+ ## Provider-neutral capabilities
45
+
46
+ Provider identity and model capability are separate. The current public provider contract normalizes `provider`, `label`, `openaiCompatible`, `local`, `requiresApiKey`, `toolProtocol`, `structuredOutput`, `supportsReasoningEffort`, and `textToolFallback`. The reusable target contract will expand that record with model- and runtime-specific fields instead of scattering provider-name checks:
47
+
48
+ ```text
49
+ local
50
+ requiresApiKey
51
+ nativeTools
52
+ textToolFallback
53
+ jsonObject
54
+ strictJsonSchema
55
+ vision
56
+ embeddings
57
+ reasoningEffort
58
+ effectiveContext
59
+ maxOutput
60
+ maxConcurrency
61
+ ```
62
+
63
+ Current LocalLLM request policy starts conservatively:
64
+
65
+ - native OpenAI-compatible function calls are tried first and locally validated;
66
+ - parallel tool calls are disabled;
67
+ - `json_object` plus strict post-validation is preferred over recursive `oneOf`/`$defs` schemas;
68
+ - a bounded text-tool protocol is a fallback path, not the default;
69
+ - remote images are fetched only when web access is enabled and any configured domain allowlist permits them; the provider receives bounded data URLs rather than the original remote URL;
70
+ - cancellation closes the active HTTP request; it does not imply provider-side rollback;
71
+ - the main agent loop is sequential, but the general runtime does not yet enforce a provider-wide semaphore across sessions; explicitly enabled scouts and specialist batches use their own bounded concurrency.
72
+
73
+ DeepSeek and OpenAI use the same normalized interface. A stronger model may receive a larger context, broader tool set, or higher step budget, but it does not get weaker permissions or a different truthfulness contract.
74
+
75
+ ## Local-model execution ladder
76
+
77
+ The runtime should choose the least expensive lane that can satisfy the request:
78
+
79
+ 1. **Direct answer** — ordinary conversation or a bounded knowledge question, with no tool schemas.
80
+ 2. **Focused agent** — one task-shaped tool bundle, a small step budget, and no separate planning call unless needed.
81
+ 3. **Thorough agent** — explicit plan, broader task-shaped tools, evidence checks, and context compaction.
82
+ 4. **Supervised/SCS** — high-risk or long work with separate review and truthful blocker handling.
83
+
84
+ This is progressive capability disclosure, not capability removal. A focused coding request initially needs workspace inspection, search/read, patch/write, a guarded command, and finish. It does not need browser, MCP, writing, image, AgentLink, tmux, and research schemas in the same first call. A later turn may add a capability only when task routing or observed evidence justifies it.
85
+
86
+ Suggested compact bundles:
87
+
88
+ | Bundle | Initial tools |
89
+ | --- | --- |
90
+ | Workspace/code | `inspect_project`, `list_files`, `search_files`, `read_file`, `apply_patch`, `write_file`, `run_command`, `finish` |
91
+ | Browser | `open_url`, `click`, `type`, `scroll`, `press`, `back`, `wait`, `finish` |
92
+ | Research | `web_search`, `web_research`, `finish` |
93
+ | Long job | `start_long_job`, `long_job_status`, `finish` |
94
+ | Coordination | selected AgentLink or tmux tools plus `finish` |
95
+
96
+ Disabled tools stay impossible to dispatch even if a model names them in text or JSON.
97
+
98
+ ## Tool-call recovery
99
+
100
+ Every model-selected action passes the same server-side registry and argument validator. Model output is never executable authority.
101
+
102
+ For one agent step:
103
+
104
+ 1. Try a simple native function call.
105
+ 2. Reject unknown, disabled, duplicate, malformed, or over-budget calls locally.
106
+ 3. If the provider/model is known to need repair, request one plain JSON or text-protocol repair with only the relevant tools.
107
+ 4. Revalidate the repair from scratch.
108
+ 5. If repair fails, return a deterministic safe blocker or use an explicitly configured stronger lane.
109
+
110
+ Never replay a mutating tool merely because a model request timed out. The persisted tool ledger must prove a call has not already completed before retrying it.
111
+
112
+ Plain assistant content with no tool call is a valid finish only when the execution policy permits a direct answer or the evidence ledger shows the requested work is already complete. Otherwise the runtime asks once for the missing action/evidence, then stops truthfully instead of pretending completion.
113
+
114
+ ## Context and output budgets
115
+
116
+ Character-only history accounting is not enough because tool schemas and UTF-8 density also consume context. The request budget includes:
117
+
118
+ ```text
119
+ system instructions
120
+ + selected tool schemas
121
+ + conversation and compacted evidence
122
+ + current task/snapshot
123
+ + output reserve
124
+ ```
125
+
126
+ Conservative LocalLLM defaults:
127
+
128
+ - configured request envelope: 32K total context, including messages, selected tool schemas, and output allowance;
129
+ - planning response: at most 2K output inside that same configured request envelope;
130
+ - normal agent step: an 8K output allowance and 4K tool-schema reserve leave a 20K compaction input ceiling under the default 32K envelope;
131
+ - final answer: at most 8K output unless the task explicitly requires more;
132
+ - compaction target: preserve goal, permissions, plan, unresolved blockers, file/tool evidence, and recent turns;
133
+ - concurrency is controlled by each execution path: the main loop is sequential, while explicitly enabled batch/helper paths may issue bounded parallel requests.
134
+
135
+ If a model returns empty visible content and no valid tool call, retry once with a compacted prompt and adequate output headroom. Repeated emptiness becomes a visible model limitation, not an infinite loop.
136
+
137
+ ## Durable session runtime
138
+
139
+ Each session stores a versioned, revisioned runtime snapshot containing only safe provider, model-role, tool-policy, sandbox, context-budget, wrapper, auxiliary, and network-scope choices. It never stores API keys, bearer values, base URLs, environment maps, clients, callbacks, or abort signals.
140
+
141
+ On resume, the saved snapshot is authoritative. Current shell variables and current web preferences cannot silently replace its provider or role models. Credentials are freshly resolved for the saved provider after the snapshot is loaded. An explicit runtime change must carry the current revision; stale changes and continuations fail with a conflict before readiness checks or model-client creation. Web preferences seed new sessions only. The same contract applies to CLI, interactive, and web continuations.
142
+
143
+ Legacy sessions without a snapshot are migrated conservatively: route, main, and spare roles all inherit their saved top-level provider/model so migration cannot introduce a hosted lane. The web execution gate serializes same-process continuations; independent processes should not concurrently mutate one session.
144
+
145
+ ## Hosted upgrades and privacy
146
+
147
+ Cloud escalation is opt-in and visible. A local failure must not silently send the workspace, prompt, images, tool results, or compacted history to DeepSeek/OpenAI.
148
+
149
+ An escalation policy records:
150
+
151
+ ```text
152
+ allowed providers
153
+ reason for escalation
154
+ maximum context exported
155
+ whether artifacts/images may leave the host
156
+ whether the user approved this run or configured a durable policy
157
+ ```
158
+
159
+ Provider failure before any tool executes may retry or switch according to that policy. After a tool executes, failover reuses the persisted result and never repeats the action without an idempotency proof.
160
+
161
+ ## Evaluation gates
162
+
163
+ Offline deterministic tests run on every change:
164
+
165
+ - LocalLLM defaults, aliases, loopback enforcement, and no-key onboarding;
166
+ - smart route/main selection for `localllm-fast` and `localllm-deep`;
167
+ - compact tool bundle size and disabled-tool rejection;
168
+ - valid native tool call and complete tool-result round trip;
169
+ - malformed arguments, unknown tool, duplicate call id, and one bounded repair;
170
+ - no-tool direct answer versus incomplete-work retry/blocker;
171
+ - timeout before output, cancellation, and no post-cancel dispatch;
172
+ - context calculation includes tool schemas and output reserve;
173
+ - no silent hosted fallback;
174
+ - session resume preserves provider, model, capability profile, and executed-tool ledger.
175
+
176
+ Live compatibility tests are opt-in because they load local models:
177
+
178
+ | Lane | Minimum cases |
179
+ | --- | --- |
180
+ | `localllm-pocket` / 4B (direct sibling-service compatibility alias, not an automatic AgInTi tier) | direct answer, one-tool selection, malformed-output recovery, truthful blocker |
181
+ | `localllm-fast` / 8B | focused code inspection/edit/test loop, cancellation, resumed turn |
182
+ | `localllm-deep` / 30B-A3B Q4 | multi-step plan, repair after failed tool evidence, long-context compaction |
183
+ | `localllm-max` / 30B-A3B Q8 | explicit opt-in, resource preflight, highest-fidelity local code task |
184
+ | `localllm-vision-xl` / 30B-A3B Q4 | attached-image understanding with no keyword-only activation |
185
+ | DeepSeek/OpenAI | same fixtures, plus explicit escalation and stronger-model quality comparison |
186
+
187
+ Record pass/fail, latency, prompt size, tool accuracy, repair count, repeated-call count, completion truthfulness, and peak context. Quality promotion requires deterministic safety gates first; a fluent answer is not evidence that work completed.
188
+
189
+ ## Delivery sequence
190
+
191
+ 1. Add the provider contract and make LocalLLM the credential-free local-first default.
192
+ 2. Remove DeepSeek-only assumptions from routing, auth, specialists, CLI, web settings, and saved preferences.
193
+ 3. Add provider-aware request budgets and progressive tool disclosure.
194
+ 4. Add bounded native-tool repair and incomplete-work detection.
195
+ 5. Add offline conformance fixtures, then opt-in live LocalLLM evaluations.
196
+ 6. Add explicit cloud escalation policy and comparative quality routing.
197
+ 7. Expose the provider-neutral agent runtime as a reusable library/API so LocalLLM may later mount AgInTi capabilities without importing AgInTiFlow UI or storage internals.
198
+
199
+ The final integration direction is dependency inversion: LocalLLM can call a packaged AgInTi runtime adapter later, and AgInTiFlow can call any conforming inference provider today. Neither repository becomes the other's internal implementation detail.