minovative-mind-cli 2.14.1 → 2.14.3

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 (47) hide show
  1. package/README.md +40 -59
  2. package/dist/services/agent/slashCommands.js +144 -13
  3. package/dist/services/agent/toolLoop.js +11 -2
  4. package/dist/services/agent/types.d.ts +9 -2
  5. package/dist/services/agent-tools.d.ts +20 -1
  6. package/dist/services/agent-tools.js +272 -47
  7. package/dist/services/agent.js +43 -18
  8. package/dist/services/ai.d.ts +9 -0
  9. package/dist/services/ai.js +71 -21
  10. package/dist/services/chatHistoryService.d.ts +5 -0
  11. package/dist/services/contextAgent.d.ts +14 -6
  12. package/dist/services/contextAgent.js +36 -10
  13. package/dist/services/orchestration/investigationAgent.js +31 -7
  14. package/dist/services/orchestration/investigationCache.js +19 -9
  15. package/dist/services/orchestration/readCache.d.ts +1 -0
  16. package/dist/services/orchestration/readCache.js +5 -2
  17. package/dist/services/orchestration/scopedTools.js +37 -10
  18. package/dist/services/orchestration/subAgent.js +16 -2
  19. package/dist/services/proxyClient.d.ts +6 -0
  20. package/dist/services/proxyClient.js +24 -10
  21. package/dist/services/sessionSettings.d.ts +66 -0
  22. package/dist/services/sessionSettings.js +126 -0
  23. package/dist/services/userProfileService.d.ts +14 -0
  24. package/dist/services/userProfileService.js +105 -3
  25. package/dist/services/verificationService.js +24 -2
  26. package/dist/utils/analysisRunner.d.ts +120 -8
  27. package/dist/utils/analysisRunner.js +946 -125
  28. package/dist/utils/antiCheatingGuard.d.ts +21 -0
  29. package/dist/utils/antiCheatingGuard.js +554 -0
  30. package/dist/utils/contextPrompts.d.ts +39 -0
  31. package/dist/utils/contextPrompts.js +81 -9
  32. package/dist/utils/contextRanker.d.ts +216 -0
  33. package/dist/utils/contextRanker.js +603 -0
  34. package/dist/utils/dependencyTracer/modules/graph.d.ts +4 -1
  35. package/dist/utils/dependencyTracer/modules/graph.js +11 -0
  36. package/dist/utils/dependencyTracer/modules/types.d.ts +10 -0
  37. package/dist/utils/dependencyTracer.d.ts +40 -2
  38. package/dist/utils/dependencyTracer.js +95 -3
  39. package/dist/utils/fileReadCache.d.ts +58 -0
  40. package/dist/utils/fileReadCache.js +162 -0
  41. package/dist/utils/projectStorage.js +2 -1
  42. package/dist/utils/symbolExtractor.d.ts +12 -0
  43. package/dist/utils/symbolExtractor.js +111 -15
  44. package/dist/utils/systemPrompts.d.ts +4 -3
  45. package/dist/utils/systemPrompts.js +66 -8
  46. package/oclif.manifest.json +1 -1
  47. package/package.json +1 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@ and hope for the best.
7
7
 
8
8
  This CLI does the opposite — it uses a custom built agentic system called,
9
9
  **Precision-Context Verification (PCV)** engine to feed lightweight Flash models
10
- exactly the right context via **AST-level targeted reads** and **2-tier context compression**, execute code, verify compilation, execute Property-Based Testing (PBT) suites and diff-scoped mutation audits, and self-correct (if it even needs to), until
10
+ exactly the right context via **3-tier IR/graph context ranking**, **AST-level targeted reads**, and **asymmetric outline injection**, execute code, verify compilation, execute Property-Based Testing (PBT) suites and diff-scoped mutation audits, and self-correct (if it even needs to), until
11
11
  the build/performance metrics are green.
12
12
 
13
13
  > The result: **Genuine Pro reasoning accuracy at Flash-level speed and efficiency.**
@@ -20,6 +20,7 @@ the build/performance metrics are green.
20
20
  [![License](https://img.shields.io/npm/l/minovative-mind-cli.svg)](https://github.com/quarantiine/minovative-mind-cli/blob/main/LICENSE.md)
21
21
 
22
22
  - Official Website: [Main Website](https://www.minovativemind.dev/)
23
+ - Pricing & BYOK: [Pricing](https://www.minovativemind.dev/pricing)
23
24
  - Latest Updates: [Updates](https://www.minovativemind.dev/updates)
24
25
 
25
26
  ---
@@ -38,13 +39,23 @@ npm install -g minovative-mind-cli
38
39
  npm install -g minovative-mind-cli
39
40
  ```
40
41
 
41
- Create a free account at [minovativemind.dev](https://www.minovativemind.dev),
42
- then:
42
+ ### 1. Subscribe to BYOK ($3.99/mo)
43
+
44
+ Minovative Mind CLI operates on a transparent Bring Your Own Key (BYOK) subscription for **$3.99/month** with **0% token markup**.
45
+
46
+ - Subscribe at [minovativemind.dev/pricing](https://www.minovativemind.dev/pricing)
47
+ - 🎉 **Launch Special**: Use promo code **`MMCLI`** at checkout for **1 Month 100% Free** (limited to the first 1,000 developers).
48
+
49
+ ### 2. Get your Google AI Studio API Key
50
+
51
+ - Generate your free or paid API key at [Google AI Studio](https://aistudio.google.com).
52
+
53
+ ### 3. Login & Start Coding
43
54
 
44
55
  ```bash
45
- minovative-mind-cli login # One-click GitHub sign-in
56
+ minovative-mind-cli login # One-click GitHub or Google sign-in with your subscribed account
46
57
  cd your-project
47
- minovative-mind-cli chat # Start coding
58
+ minovative-mind-cli chat # Start coding (set your key when prompted or via /config-key)
48
59
  ```
49
60
 
50
61
  Works in any terminal — SSH, Docker, CI pipelines, Vim, Windows Command Prompt, PowerShell, anywhere Node runs.
@@ -92,7 +103,7 @@ minovative-mind-cli eval -i test_instances.jsonl -o predictions.jsonl -r evaluat
92
103
  minovative-mind-cli eval -i instances.jsonl --repo astropy/astropy --concurrency 2
93
104
  ```
94
105
 
95
- > **Token Economics & Efficiency**: With AST-level symbol chunking (`targetElements`), SHA-256 context caching, and in-place historical tool response pruning, benchmark evaluations achieve up to **85%–95% lower token usage per instance**, eliminating token-per-minute (TPM) rate limit thrashing while preserving deep reasoning fidelity.
106
+ > **Token Economics & Efficiency**: With deterministic 3-tier IR context ranking, AST-level symbol chunking (`targetElements`), asymmetric outline injection, SHA-256 context caching, and in-place historical tool response pruning, benchmark evaluations achieve up to **85%–95% lower token usage per instance**, eliminating token-per-minute (TPM) rate limit thrashing while preserving deep reasoning fidelity.
96
107
 
97
108
  ---
98
109
 
@@ -118,58 +129,46 @@ Gemini 3.x models support native provider-level reasoning control via `thinking_
118
129
 
119
130
  _(Note: Internal `Minimal` reasoning is strictly reserved for lightweight background micro-agents and is excluded from user-facing selection to ensure optimal coding performance.)_
120
131
 
121
- ### BYOK (Bring Your Own Key)
122
-
123
- If you prefer to use your own API key instead of credits, you can configure it via the `/config-key` slash command. **Only API keys from [Google AI Studio](https://aistudio.google.com) are supported** — Vertex AI, OpenAI, and Anthropic keys are not compatible.
132
+ ### 🔑 BYOK (Bring Your Own Key) All-Access
124
133
 
125
- - **Configuration:** Use `/config-key` in the chat session to set and manage your API key.
126
- - **Error Handling:** If your key is invalid, expired, or you hit rate limits, the CLI will report a `BYOK AI Error`. Please check your API key status in the [Google AI Studio dashboard](https://aistudio.google.com).
134
+ Minovative Mind CLI operates exclusively on a **Bring Your Own Key (BYOK)** model ($3.99/month flat developer subscription with **zero token markups**):
127
135
 
128
- ### Auxiliary Model Routing Defaults & Reasoning Invariants
136
+ - **Wholesale AI Pricing:** You pay Google AI Studio directly at pure wholesale rates (or $0 on their generous free tier) with no middleman markup or expiring credit packs.
137
+ - **Supported Provider:** **Only API keys from [Google AI Studio](https://aistudio.google.com) are supported** (all Gemini 3.x Flash, Pro, Lite, Thinking, and Experimental models). Vertex AI, OpenAI, and Anthropic keys are not compatible.
138
+ - **Secure Keychain Storage:** Your API key is encrypted and stored locally in your operating system keychain (`keytar` / local secure storage) and is never sent to Minovative Mind servers.
139
+ - **Configuration:** Set or update your key anytime in the chat session via `/config-key`.
140
+ - **Error Handling:** If your key is invalid, expired, or you hit rate limits, the CLI will report a `BYOK AI Error`. Check your key and quota status in the [Google AI Studio dashboard](https://aistudio.google.com).
129
141
 
130
- Background tasks automatically route to dedicated auxiliary models with native `responseSchema` constraints, AST symbol extractors, persistent caches, and deterministic reasoning invariants for optimal latency, cost efficiency, and structured output reliability:
142
+ ### 🧠 Adaptive Persona & Pair Programming Memory Bank
131
143
 
132
- - **Intent Routing (`routeIntent`)**: `Gemini 3.7 Flash` (Temp 0, native `responseSchema`, `MINIMAL` invariant) — permissive zero-temperature classification into `SEARCH` vs `SKIP` and `CHAT` vs `EXECUTE` with resilient fallback to repository exploration.
133
- - **Complexity Evaluators (`evaluateInvestigationComplexity`)**: `Gemini 3.7 Flash` (Temp 0, native `responseSchema`, `MINIMAL` invariant) — permissive parallel domain partitioning, global override detection, primary sub-path auto-focusing, and dynamic agent assignment recovery.
134
- - **Context Compressor & Caching**: `Gemini 3.7 Flash` (Temp 0.2, `MINIMAL` invariant) — surgical code distillation for files exceeding 2,000 characters backed by a persistent 2-tier SHA-256 disk cache (`context_cache.json`) capped at 5MB LRU. Files under 2,000 characters retain 100% full fidelity without compression overhead.
135
- - **AST Symbol Extraction & Targeted Reads**: Polyglot AST declaration extractor (`symbolExtractor.ts`) enabling granular `targetElements` symbol chunking in `read_file`, slashing input token bloat by up to 85%–95%.
136
- - **In-Place Tool History Pruning**: Active working memory management preserving raw workspace file blocks while compacting historical command/test outputs across multi-turn reasoning loops.
137
- - **Session Titling**: `Gemini 3.7 Flash` (Temp 0.7, native `responseSchema`, `MINIMAL` invariant) — automated concise chat session titling.
138
- - **Semantic Cache Classifier**: `Gemini 3.5 Flash Lite` (Temp 0, native `responseSchema`, `MINIMAL` invariant) — intent and topic classification for cache hits.
139
- - **History Summarizer**: `Gemini 3.7 Flash` (Temp 0.2, `MINIMAL` invariant) — 3-part structured conversation compression preserving recent history.
140
- - **Commit Generator**: `Gemini 3.5 Flash Lite` (`MINIMAL` invariant) — conventional commit message synthesis.
141
- - **Micro-Agent Safety Invariants & Normalization**: All internal background micro-agents enforce a hardcoded `MINIMAL` invariant to guarantee zero-latency execution without conversational token burn. The generation pipeline's `normalizeGenerationConfig` automatically strips unsupported internal minimal payloads before dispatching to Google's API, preventing `400 Bad Request` schema errors while ensuring user-selected thinking levels never pollute lightweight background micro-agents.
142
- - **Subsystem Reasoning Budgets**: Orchestrated subsystems maintain tailored reasoning allocations: **PM Kernel Task Decomposition** operates at `HIGH` reasoning depth for optimal topological dependency sorting; **Investigation & Context Sub-Agents** dynamically inherit your configured model thinking level (default: `MEDIUM`) for comprehensive repository reconnaissance; **Syntax Repair Agents** operate at `LOW` reasoning depth for precise AST corrections; and **Execution Sub-Agents / Main Agent** dynamically inherit your configured model thinking level (`LOW` | `MEDIUM` | `HIGH`).
144
+ Minovative Mind CLI continuously adapts to your unique developer personality and working habits without adding latency or telemetry bloat:
143
145
 
144
- > You pay for auxiliary model background AI operations and for your selected model during chat and code execution. Use `/debug` to inspect real-time routing diagnostics.
145
-
146
- ---
146
+ - **Conversational Wavelength & Pairing Dynamics:** Learns your relationship model (collaborative peer vs. direct operator), banter and humor affinity, speech formality, apology tolerance, and conversational quirks (e.g. catchphrases like _"lgtm"_ and _"ship it"_).
147
+ - **Cognitive & Decision Spectrums:** Adapts to your architectural preferences (top-down vs. bottom-up), decision autonomy, risk tolerance, and debugging style.
148
+ - **Zero-Latency Flash-Lite Profiling:** A dedicated background `gemini-3.5-flash-lite` agent classifies turns and reconciles behavioral drift asynchronously.
149
+ - **100% Client-Side Privacy:** Stored globally at `~/.minovativemind/user_profile.json` (`0600` permissions), never synced to cloud databases, and fully manageable via `/profile`.
147
150
 
148
151
  ## Session Commands
149
152
 
150
153
  | Command | What it does |
151
154
  | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
152
155
  | `/config-key` | Configure custom Google AI Studio API key (BYOK mode) |
153
- | `/profile` | View, inspect, delete, or reset global adaptive persona memory and AI side-notes |
156
+ | `/profile` | View, inspect, delete, or reset global adaptive persona memory, pairing dynamics, and AI side-notes |
154
157
  | `/models` | Hot-swap the active model or configure its native reasoning thinking level (`Low`, `Medium`, `High`) |
155
158
  | `/paste` | Multi-line input mode (cancel with Ctrl+C) |
156
- | `/clear` | Clear conversation history |
157
- | `/debug` | Expose internal agent diagnostics |
158
- | `/auto-approve` | Toggle skipping confirmation prompts for commands |
159
- | `/sub-agents` | Toggle the MMAAK Engine for parallel investigation and execution (concurrency limited to 2) |
159
+ | `/clear` | Clear conversation history and reset session settings to safe defaults |
160
+ | `/debug` | Toggle internal agent telemetry and diagnostic logging (saved per session) |
161
+ | `/auto-approve` | Toggle skipping confirmation prompts for commands (saved per session, automatically resets to 'ask' on new sessions) |
162
+ | `/sub-agents` | Toggle the MMAAK Engine for parallel investigation and execution (saved per session, concurrency limited to 2) |
160
163
  | `/stats` | View session and all-time statistics, token telemetry, active model settings, and live thinking level runtime telemetry |
161
164
  | `/commit` | Generate a conventional commit message from your diff |
162
165
  | `/revert` | Undo changes from the last turn, or toggle the revert logger |
163
- | `/chats` | View, resume, rename, or delete previous chat sessions (with centralized token telemetry, Git branch, auto-approve status, and sub-agent state) |
166
+ | `/chats` | View, resume, rename, or delete previous chat sessions (with session settings restoration, Git branch, auto-approve status, and sub-agent state) |
164
167
  | `/workspaces` | Manage active workspaces and linked cross-repo aliases |
165
168
  | `stop` | Abort generation immediately |
166
169
 
167
170
  ---
168
171
 
169
- ## 🏷️ @ Context Mentions & Interactive Autocomplete
170
-
171
- Minovative Mind CLI features real-time, interactive **@ Context Mentions** directly in your terminal prompt. Type `@` anywhere while writing a prompt to trigger fuzzy-filtered autocomplete and inject targeted codebase context, AST symbols, Git status/diffs, diagnostics, or cross-workspace files directly into the model's reasoning loop without manual copy-pasting or extra discovery tool turns.
172
-
173
172
  ### Interactive Autocomplete & Keyboard Navigation
174
173
 
175
174
  When typing `@`, the interactive terminal autocomplete popup immediately renders:
@@ -200,31 +199,12 @@ When typing `@`, the interactive terminal autocomplete popup immediately renders
200
199
  | `@<alias>/<path>` | `[ws]` | **Cross-Workspace File** | Injects file contents from registered external workspaces (e.g. `@backend/src/routes.ts` or `@frontend/src/App.tsx`). |
201
200
  | `@<alias>` | `[ws]` | **Workspace Summary** | Injects configuration, manifest overview, and path details for a registered external workspace. |
202
201
 
203
- ### Visual Terminal Indicators & Status Tracking
204
-
205
- When a prompt with `@` context mentions is submitted, the CLI provides real-time, high-contrast visual confirmation indicators in the terminal:
206
-
207
- - **Success Indicators (`✔`)**: High-contrast green checkmark with dim status summary confirming successful extraction (e.g. `✔ Context @src/index.ts:1-25 (lines 1-25, 420 chars)`, `✔ Context @symbol:startServer (src/index.ts, 12 lines)`, `✔ Context @git:status (short status, clean)`, `✔ Context @diagnostics (syntax scan clean)`, `✔ Context @terminal (Darwin arm64, node v20.x)`, `✔ Context @backend (external workspace)`).
208
- - **Failure Indicators (`✖`)**: Clear red indicator with explicit error reasoning when resolution fails (e.g. `✖ Context @missing.ts (File does not exist)`, `✖ Context @symbol:unknownFunc (Could not find declaration for symbol)`).
209
- - **Structured Metadata Status Tracking**: Every resolved mention produces a rich `metadata` envelope (capturing line counts, char counts, symbol kind, git diff stats, and syntax scan metrics) powering both visual indicators and token-budgeted prompt injection.
210
-
211
- ### Context Resolution & Safety Architecture
212
-
213
- - **Token Budgeting & Safety Allocation**: All parsed mentions are resolved into structured XML blocks (`<context_mentions>`) wrapped in CDATA sections with strict token budgeting and prompt injection defenses.
214
- - **Read-Guard Pre-Registration (`fileReadGuard`)**: Files referenced via `@` mentions are automatically registered in the system's `fileReadGuard`. This allows the AI agent to immediately invoke file modifications (`modify_file`, `write_file`) without redundant `read_file` roundtrips, accelerating execution speed.
215
- - **Multi-Workspace Path Resolution**: Automatically validates boundaries across registered workspaces via `resolveAndValidateMultiWorkspacePath`, preventing directory traversal escapes (`../`).
216
-
217
202
  ---
218
203
 
219
204
  ## 🌐 Multi-Workspace, Sub-Path Focusing & Security Guardrails
220
205
 
221
206
  Minovative Mind CLI doesn't restrict you to a single repository. You can logically group multiple external repositories into **Master Workspaces** (Profiles) containing dedicated **Sub-Workspaces** (mapped to short aliases like `@backend` or `@frontend`).
222
207
 
223
- - **Primary Sub-Path Auto-Focusing & Global Override Detection**: Workspaces can designate a default primary sub-path (e.g. `src/` or `packages/core`), automatically scoping file operations and context turns without repetitive prefixing. If global override search phrases (e.g., "across the codebase", "entire project", "global", "end to end") or root monorepo configurations are detected, sub-path auto-focusing is dynamically bypassed to evaluate the entire repository.
224
- - **Multi-Workspace Path Security Boundaries**: Strictly enforces workspace and profile containment via `resolveAndValidateMultiWorkspacePath`, preventing directory traversal (`../`), null-byte injections (`\0`), and absolute path escapes.
225
- - **Canonical Lock Path Resolution in Scoped Tool Execution**: In parallel multi-agent workflows (MMAAK), file mutation tools automatically resolve relative paths, auto-focused sub-paths, and `@alias/` cross-repo prefixes to canonical absolute filesystem paths before acquiring mutexes in `FileLockRegistry`, preventing race conditions and lock collisions across concurrent agents.
226
- - **Cross-Repo Coordination**: Prefix file paths with `@alias/` (e.g., `@backend/src/api.ts` and `@frontend/src/App.tsx`) to investigate, refactor, and coordinate changes across your entire stack in a single prompt. The terminal highlights cross-workspace actions with a blue `[alias]` visual tag. Use `/workspaces` to create profiles, link sub-workspaces, or switch active environments.
227
-
228
208
  ---
229
209
 
230
210
  ## 🌐 Supported Languages
@@ -248,13 +228,13 @@ However, the PCV engine features deep, context-aware analysis across **12 major
248
228
  | **Swift** | `.swift` | ✅ | ✅ | ❌ | ❌ |
249
229
  | **Dart** | `.dart` | ✅ | ✅ | ❌ | ❌ |
250
230
 
251
- _⚠️\*Support is limited or requires custom local system tooling/environment setup._
231
+ _⚠️\*Support is limited or requires custom local system tooling/environment setup from the developer's end._
252
232
 
253
233
  ### Why do some features only support specific languages?
254
234
 
255
235
  1. **Dependency Tracing & AST Symbol Extraction:** Fully supported across major language families. It uses lightning-fast static regex pattern matching and AST outline parsers to resolve local import structures, extract targeted symbol definitions (`targetElements`), and determine the "blast radius" of code changes without requiring heavy compilations.
256
236
  2. **Performance Auditing:** Executed natively across 9 major language families (JavaScript/TypeScript, Python, Go, Rust, PHP, C#, Java, C/C++, and Ruby). It uses zero-dependency, ultra-fast (<50ms) language-aware regex heuristics with comment/string stripping and line-preserving offset tracking to detect severe runtime anti-patterns (such as unbounded loops, synchronous I/O, chained array allocations, unnecessary allocations, and unclosed resources).
257
- 3. **Ephemeral Analysis & Property-Based Probing:** Defaults to Node.js as a safe baseline, but natively leverages host-installed runtimes (Python, Rust, Go compilers) and standard libraries whenever available in the workspace.
237
+ 3. **Ephemeral Analysis & Property-Based Probing:** Defaults to Node.js as a safe baseline, but natively leverages host-installed runtimes (Python, Rust, Go compilers) and standard libraries whenever available in the workspace. Features direct binary subprocess spawning without shell overhead, zero-disk stdin streaming for interpreted scripts, per-workspace LRU environment caching, 1:1 stack trace line preservation, and dedicated FD-3 out-of-band telemetry streaming for high-precision diagnostic and property-based verification tools (`run_debug_script`, `run_fuzz_probe`, `check_heap_delta`, `check_behavioral_drift`).
258
238
 
259
239
  ---
260
240
 
@@ -262,7 +242,8 @@ _⚠️\*Support is limited or requires custom local system tooling/environment
262
242
 
263
243
  During heavy, multi-turn AI agent sessions, Minovative Mind CLI includes built-in architectural optimizations to eliminate IDE lag, CPU spikes, and dev-server interference:
264
244
 
265
- - **Ephemeral Scratch Isolation (`os.tmpdir()`)**: Diagnostic probes, validation scripts, and benchmark tests execute in a sandboxed OS temp directory (`os.tmpdir()`) rather than writing disposable files into your workspace root. This prevents file watcher churn (`fsevents`, `inotify`), avoids Language Server Protocol (LSP) re-indexing storms (TSServer, Pyright, rust-analyzer), and prevents running dev servers (Vite, Turbopack, Nodemon) from triggering unneeded full-page reloads.
245
+ - **Ephemeral Scratch Isolation (`os.tmpdir()`) & Zero-Disk Stdin Streaming**: Diagnostic probes, validation scripts, and benchmark tests execute via direct subprocess spawning with zero-disk stdin streaming (for Node.js, Python, Bash, Ruby, and PHP) or within a sandboxed OS temp directory (`os.tmpdir()`) rather than writing disposable files into your workspace root. This prevents file watcher churn (`fsevents`, `inotify`), avoids Language Server Protocol (LSP) re-indexing storms (TSServer, Pyright, rust-analyzer), and prevents running dev servers (Vite, Turbopack, Nodemon) from triggering unneeded full-page reloads.
246
+ - **Per-Workspace LRU Environment Caching & Out-of-Band FD-3 Telemetry**: The sandboxed execution engine caches runner binaries, virtual environments, and module types in an LRU cache (30s TTL) to minimize process startup latency, while streaming structured `emitResult` telemetry over a dedicated FD 3 pipe (`stdio: ['pipe', 'pipe', 'pipe', 'pipe']`) without polluting console standard output or altering 1:1 stack trace line numbers.
266
247
  - **Automatic IDE Watcher Exclusions (`.vscode/settings.json`)**: On session startup, the CLI automatically and non-destructively ensures that `.minovativemind/**`, `.tmp/**`, and `scratch/**` are added to `files.watcherExclude` and `search.exclude`. This stops IDE background processes from burning CPU on internal telemetry, chat session logs, and cache files.
267
248
  - **Clean Git Status Synchronization**: The CLI automatically ensures `.minovativemind/`, `.tmp/`, and `scratch/` are excluded from `.gitignore`, `.dockerignore`, and `.npmignore`, keeping your IDE's Source Control pane fast and responsive.
268
249
  - **Terminal Render Efficiency**: For long-running evaluation sweeps (`eval`) or massive test outputs, minimizing the terminal pane or running it in the background pauses Electron/xterm.js GPU canvas repaints and frees up system resources.
@@ -19,6 +19,10 @@ import { GEMINI_MODELS, isByokEnabled, DEFAULT_MODEL_THINKING_LEVELS } from '../
19
19
  import { loadCredentials, updateCredentialField } from '../../utils/credentialStore.js';
20
20
  import { getGlobalActiveModel, setGlobalActiveModel, getModelThinkingLevel, setModelThinkingLevel, ProxyChatSession } from '../ai.js';
21
21
  import { loadUserProfile, deleteSideNote, clearUserProfile, getUserProfilePath } from '../userProfileService.js';
22
+ import { applySessionSettings, resetSessionSettingsToDefault, syncActiveSessionSettings, } from '../sessionSettings.js';
23
+ import { clearFileReadCache } from '../../utils/fileReadCache.js';
24
+ import { invalidateDependencyGraph } from '../../utils/dependencyTracer.js';
25
+ import { clearSymbolExtractorCache } from '../../utils/symbolExtractor.js';
22
26
  /**
23
27
  * @file slashCommands.ts
24
28
  * @description Interactive slash command handler module for Minovative Mind CLI.
@@ -79,12 +83,22 @@ export async function handleSlashCommand(command, context) {
79
83
  */
80
84
  if (lowerCommand === '/clear') {
81
85
  chat.clearHistory();
86
+ resetSessionSettingsToDefault(chat);
87
+ if (chatSessionState) {
88
+ chatSessionState.autoApprove = false;
89
+ chatSessionState.subAgents = true;
90
+ chatSessionState.debugMode = false;
91
+ chatSessionState.modelName = chat.getModel();
92
+ chatSessionState.thinkingLevel =
93
+ (typeof chat.getThinkingLevel === 'function' ? chat.getThinkingLevel() : undefined) ||
94
+ getModelThinkingLevel(chat.getModel());
95
+ }
82
96
  process.stdout.write('\x1B[2J\x1B[3J\x1B[H'); // Hard clear screen and scrollback
83
97
  printLogo();
84
98
  p.intro(`${brandBg(' Minovative Mind CLI ')} ${pc.dim('v' + version)}`);
85
99
  p.log.info(`${pc.dim('Workspace:')} ${brandFg(workspaceRoot)}`);
86
100
  p.log.info(`${pc.dim('Commands:')} Type ${pc.yellow('/')} to open the command menu and "${pc.yellow('stop')}" to stop the ai generation. Type ${pc.yellow('exit')} to leave.`);
87
- p.log.success('Chat history cleared.');
101
+ p.log.success('Chat history cleared (session settings reset to defaults).');
88
102
  console.log(pc.dim('\nType your coding request below. Type "exit" or "quit" to leave.\n'));
89
103
  return { shouldContinue: true };
90
104
  }
@@ -139,11 +153,17 @@ export async function handleSlashCommand(command, context) {
139
153
  if (!p.isCancel(selectedModel)) {
140
154
  chat.setModel(selectedModel);
141
155
  setGlobalActiveModel(selectedModel);
156
+ if (chatSessionState) {
157
+ chatSessionState.modelName = selectedModel;
158
+ }
142
159
  if (selectedModel === 'auto') {
143
160
  const defaultAutoThinking = DEFAULT_MODEL_THINKING_LEVELS[GEMINI_MODELS.AUTO] || 'MEDIUM';
144
161
  if (typeof chat.setThinkingLevel === 'function') {
145
162
  chat.setThinkingLevel(defaultAutoThinking);
146
163
  }
164
+ if (chatSessionState) {
165
+ chatSessionState.thinkingLevel = defaultAutoThinking;
166
+ }
147
167
  p.log.success(`Model successfully switched to ${pc.cyan('Auto (Smart Routing & Reasoning)')}`);
148
168
  }
149
169
  else {
@@ -174,15 +194,22 @@ export async function handleSlashCommand(command, context) {
174
194
  if (typeof chat.setThinkingLevel === 'function') {
175
195
  chat.setThinkingLevel(selectedThinking);
176
196
  }
197
+ if (chatSessionState) {
198
+ chatSessionState.thinkingLevel = selectedThinking;
199
+ }
177
200
  p.log.success(`Model successfully switched to ${pc.cyan(selectedModel)} with thinking level ${pc.cyan(selectedThinking)}`);
178
201
  }
179
202
  else {
180
203
  if (typeof chat.setThinkingLevel === 'function') {
181
204
  chat.setThinkingLevel(activeModelThinking);
182
205
  }
206
+ if (chatSessionState) {
207
+ chatSessionState.thinkingLevel = activeModelThinking;
208
+ }
183
209
  p.log.success(`Model successfully switched to ${pc.cyan(selectedModel)}`);
184
210
  }
185
211
  }
212
+ await syncActiveSessionSettings(chatSessionState?.id, chat);
186
213
  }
187
214
  return { shouldContinue: true };
188
215
  }
@@ -191,6 +218,10 @@ export async function handleSlashCommand(command, context) {
191
218
  */
192
219
  if (lowerCommand === '/debug') {
193
220
  const debugMode = toggleDebugMode();
221
+ if (chatSessionState) {
222
+ chatSessionState.debugMode = debugMode;
223
+ }
224
+ await syncActiveSessionSettings(chatSessionState?.id, chat);
194
225
  if (debugMode) {
195
226
  const currentModel = chat.getModel();
196
227
  const currentThinkingLevel = (typeof chat.getThinkingLevel === 'function' ? chat.getThinkingLevel() : undefined) ||
@@ -208,10 +239,18 @@ export async function handleSlashCommand(command, context) {
208
239
  if (lowerCommand === '/auto-approve') {
209
240
  if (getApprovalMode() === 'skip-all') {
210
241
  setApprovalMode('ask');
242
+ if (chatSessionState) {
243
+ chatSessionState.autoApprove = false;
244
+ }
245
+ await syncActiveSessionSettings(chatSessionState?.id, chat);
211
246
  p.log.success('Auto-approve disabled. You will be prompted before commands run.');
212
247
  }
213
248
  else {
214
249
  setApprovalMode('skip-all');
250
+ if (chatSessionState) {
251
+ chatSessionState.autoApprove = true;
252
+ }
253
+ await syncActiveSessionSettings(chatSessionState?.id, chat);
215
254
  p.log.success('Auto-approve enabled for all future commands in this session.');
216
255
  }
217
256
  return { shouldContinue: true };
@@ -222,10 +261,18 @@ export async function handleSlashCommand(command, context) {
222
261
  if (lowerCommand === '/sub-agents') {
223
262
  if (isSubAgentsEnabled()) {
224
263
  setSubAgentsEnabled(false);
264
+ if (chatSessionState) {
265
+ chatSessionState.subAgents = false;
266
+ }
267
+ await syncActiveSessionSettings(chatSessionState?.id, chat);
225
268
  p.log.success('MMAAK Engine disabled. Single-agent mode active.');
226
269
  }
227
270
  else {
228
271
  setSubAgentsEnabled(true);
272
+ if (chatSessionState) {
273
+ chatSessionState.subAgents = true;
274
+ }
275
+ await syncActiveSessionSettings(chatSessionState?.id, chat);
229
276
  p.log.success('MMAAK Engine enabled. The system will now use parallel investigation and thread agents.');
230
277
  }
231
278
  return { shouldContinue: true };
@@ -478,6 +525,9 @@ export async function handleSlashCommand(command, context) {
478
525
  await fs.writeFile(absolutePath, change.originalContent, 'utf-8');
479
526
  }
480
527
  }
528
+ clearFileReadCache();
529
+ invalidateDependencyGraph(workspaceRoot);
530
+ clearSymbolExtractorCache();
481
531
  spinner.stop('Reverted successfully.');
482
532
  p.log.success(`Reverted ${changesToRevert.length} changeset(s) successfully.`);
483
533
  }
@@ -514,6 +564,7 @@ export async function handleSlashCommand(command, context) {
514
564
  }
515
565
  if (chatsMenu === 'new') {
516
566
  chat.clearHistory();
567
+ resetSessionSettingsToDefault(chat);
517
568
  if (chatSessionState) {
518
569
  chatSessionState.id = crypto.randomUUID();
519
570
  chatSessionState.title = '';
@@ -521,6 +572,13 @@ export async function handleSlashCommand(command, context) {
521
572
  chatSessionState.totalInputTokens = 0;
522
573
  chatSessionState.totalOutputTokens = 0;
523
574
  chatSessionState.totalCreditsUsed = 0;
575
+ chatSessionState.autoApprove = false;
576
+ chatSessionState.subAgents = true;
577
+ chatSessionState.debugMode = false;
578
+ chatSessionState.modelName = chat.getModel();
579
+ chatSessionState.thinkingLevel =
580
+ (typeof chat.getThinkingLevel === 'function' ? chat.getThinkingLevel() : undefined) ||
581
+ getModelThinkingLevel(chat.getModel());
524
582
  chat.setSessionInfo(chatSessionState.id, workspaceRoot);
525
583
  }
526
584
  process.stdout.write('\x1B[2J\x1B[3J\x1B[H'); // Hard clear screen and scrollback
@@ -528,7 +586,7 @@ export async function handleSlashCommand(command, context) {
528
586
  p.intro(`${brandBg(' Minovative Mind CLI ')} ${pc.dim('v' + version)}`);
529
587
  p.log.info(`${pc.dim('Workspace:')} ${brandFg(workspaceRoot)}`);
530
588
  p.log.info(`${pc.dim('Commands:')} Type ${pc.yellow('/')} to open the command menu and "${pc.yellow('stop')}" to stop the ai generation. Type ${pc.yellow('exit')} to leave.`);
531
- p.log.success('Started a new chat session.');
589
+ p.log.success('Started a new chat session (settings reset to defaults).');
532
590
  console.log(pc.dim('\nType your coding request below. Type "exit" or "quit" to leave.\n'));
533
591
  return { shouldContinue: true };
534
592
  }
@@ -577,6 +635,8 @@ export async function handleSlashCommand(command, context) {
577
635
  }
578
636
  const session = sessions.find((s) => s.id === selectedSessionId);
579
637
  if (session) {
638
+ // Restore session-scoped operational settings
639
+ const applied = applySessionSettings(session, chat);
580
640
  // Update timestamp so it becomes the most recently used session
581
641
  session.timestamp = Date.now();
582
642
  await chatHistoryService.saveSession(session);
@@ -591,6 +651,11 @@ export async function handleSlashCommand(command, context) {
591
651
  chatSessionState.latestUsageMetadata = session.latestUsageMetadata;
592
652
  chatSessionState.previousUsageMetadata = session.previousUsageMetadata;
593
653
  chatSessionState.modelUsageCounts = session.modelUsageCounts || {};
654
+ chatSessionState.autoApprove = applied.autoApprove;
655
+ chatSessionState.subAgents = applied.subAgents;
656
+ chatSessionState.debugMode = applied.debugMode;
657
+ chatSessionState.modelName = applied.modelName;
658
+ chatSessionState.thinkingLevel = applied.thinkingLevel;
594
659
  chat.setSessionInfo(session.id, workspaceRoot);
595
660
  }
596
661
  process.stdout.write('\x1B[2J\x1B[3J\x1B[H'); // Hard clear screen and scrollback
@@ -599,6 +664,16 @@ export async function handleSlashCommand(command, context) {
599
664
  p.log.info(`${pc.dim('Workspace:')} ${brandFg(workspaceRoot)}`);
600
665
  p.log.info(`${pc.dim('Commands:')} Type ${pc.yellow('/')} to open the command menu and "${pc.yellow('stop')}" to stop the ai generation. Type ${pc.yellow('exit')} to leave.`);
601
666
  p.log.success(`Resumed session: ${session.title}`);
667
+ // Display session settings restoration status badge
668
+ const autoApproveBadge = applied.autoApprove ? pc.green('ON') : pc.dim('OFF');
669
+ const subAgentsBadge = applied.subAgents ? pc.green('ON') : pc.red('OFF');
670
+ const debugBadge = applied.debugMode ? pc.green('ON') : pc.dim('OFF');
671
+ const modelBadge = pc.cyan(applied.modelName);
672
+ const thinkingBadge = pc.cyan(applied.thinkingLevel);
673
+ p.log.info(`${pc.dim('Session Settings:')} Model: ${modelBadge} (thinking: ${thinkingBadge}) | Auto-Approve: ${autoApproveBadge} | Sub-Agents: ${subAgentsBadge} | Debug: ${debugBadge}`);
674
+ if (applied.autoApprove) {
675
+ p.log.warn(pc.yellow('Notice: Auto-approve is ENABLED for this resumed session.'));
676
+ }
602
677
  // Print the loaded history cleanly: only user and AI conversational messages,
603
678
  // with a clean indicator label if the turn involved tool/code changes.
604
679
  let turnHadModifications = false;
@@ -689,9 +764,6 @@ export async function handleSlashCommand(command, context) {
689
764
  if (session.lastTurnDuration !== undefined) {
690
765
  p.log.info(`${pc.dim('Generated in')} ${pc.cyan(session.lastTurnDuration + 's')}`);
691
766
  }
692
- if (session.modelName) {
693
- p.log.info(`${pc.dim('Model:')} ${pc.cyan(session.modelName)}`);
694
- }
695
767
  if (session.totalTokens !== undefined) {
696
768
  const inputStr = session.totalInputTokens
697
769
  ? ` (Input: ${session.totalInputTokens.toLocaleString()}, Output: ${(session.totalOutputTokens || 0).toLocaleString()})`
@@ -704,11 +776,6 @@ export async function handleSlashCommand(command, context) {
704
776
  if (session.gitBranch) {
705
777
  p.log.info(`${pc.dim('Last Active Branch:')} ${pc.cyan(session.gitBranch)}`);
706
778
  }
707
- if (session.autoApprove !== undefined || session.subAgents !== undefined) {
708
- const aa = session.autoApprove ? pc.green('Enabled') : pc.yellow('Disabled');
709
- const sa = session.subAgents ? pc.green('Enabled') : pc.yellow('Disabled');
710
- p.log.info(`${pc.dim('Sub-Agents:')} ${sa} | ${pc.dim('Auto-Approve:')} ${aa}`);
711
- }
712
779
  console.log(pc.dim('\nType your coding request below. Type "exit" or "quit" to leave.\n'));
713
780
  }
714
781
  }
@@ -754,12 +821,27 @@ export async function handleSlashCommand(command, context) {
754
821
  p.log.success('Session deleted successfully.');
755
822
  if (chatSessionState && chatSessionState.id === selectedSessionId) {
756
823
  chat.clearHistory();
824
+ resetSessionSettingsToDefault(chat);
825
+ chatSessionState.id = crypto.randomUUID();
826
+ chatSessionState.title = '';
827
+ chatSessionState.totalTokens = 0;
828
+ chatSessionState.totalInputTokens = 0;
829
+ chatSessionState.totalOutputTokens = 0;
830
+ chatSessionState.totalCreditsUsed = 0;
831
+ chatSessionState.autoApprove = false;
832
+ chatSessionState.subAgents = true;
833
+ chatSessionState.debugMode = false;
834
+ chatSessionState.modelName = chat.getModel();
835
+ chatSessionState.thinkingLevel =
836
+ (typeof chat.getThinkingLevel === 'function' ? chat.getThinkingLevel() : undefined) ||
837
+ getModelThinkingLevel(chat.getModel());
838
+ chat.setSessionInfo(chatSessionState.id, workspaceRoot);
757
839
  process.stdout.write('\x1B[2J\x1B[3J\x1B[H'); // Hard clear screen and scrollback
758
840
  printLogo();
759
841
  p.intro(`${brandBg(' Minovative Mind CLI ')} ${pc.dim('v' + version)}`);
760
842
  p.log.info(`${pc.dim('Workspace:')} ${brandFg(workspaceRoot)}`);
761
843
  p.log.info(`${pc.dim('Commands:')} Type ${pc.yellow('/')} to open the command menu and "${pc.yellow('stop')}" to stop the ai generation. Type ${pc.yellow('exit')} to leave.`);
762
- p.log.warn('Active session was deleted. Chat history cleared.');
844
+ p.log.warn('Active session was deleted. Chat history and settings reset to defaults.');
763
845
  console.log(pc.dim('\nType your coding request below. Type "exit" or "quit" to leave.\n'));
764
846
  }
765
847
  }
@@ -787,12 +869,27 @@ export async function handleSlashCommand(command, context) {
787
869
  p.log.success(`Successfully deleted ${selectedIds.length} session(s).`);
788
870
  if (chatSessionState && selectedIds.includes(chatSessionState.id)) {
789
871
  chat.clearHistory();
872
+ resetSessionSettingsToDefault(chat);
873
+ chatSessionState.id = crypto.randomUUID();
874
+ chatSessionState.title = '';
875
+ chatSessionState.totalTokens = 0;
876
+ chatSessionState.totalInputTokens = 0;
877
+ chatSessionState.totalOutputTokens = 0;
878
+ chatSessionState.totalCreditsUsed = 0;
879
+ chatSessionState.autoApprove = false;
880
+ chatSessionState.subAgents = true;
881
+ chatSessionState.debugMode = false;
882
+ chatSessionState.modelName = chat.getModel();
883
+ chatSessionState.thinkingLevel =
884
+ (typeof chat.getThinkingLevel === 'function' ? chat.getThinkingLevel() : undefined) ||
885
+ getModelThinkingLevel(chat.getModel());
886
+ chat.setSessionInfo(chatSessionState.id, workspaceRoot);
790
887
  process.stdout.write('\x1B[2J\x1B[3J\x1B[H'); // Hard clear screen and scrollback
791
888
  printLogo();
792
889
  p.intro(`${brandBg(' Minovative Mind CLI ')} ${pc.dim('v' + version)}`);
793
890
  p.log.info(`${pc.dim('Workspace:')} ${brandFg(workspaceRoot)}`);
794
891
  p.log.info(`${pc.dim('Commands:')} Type ${pc.yellow('/')} to open the command menu and "${pc.yellow('stop')}" to stop the ai generation. Type ${pc.yellow('exit')} to leave.`);
795
- p.log.warn('Active session was deleted. Chat history cleared.');
892
+ p.log.warn('Active session was deleted. Chat history and settings reset to defaults.');
796
893
  console.log(pc.dim('\nType your coding request below. Type "exit" or "quit" to leave.\n'));
797
894
  }
798
895
  }
@@ -1222,15 +1319,49 @@ Strict Formatting Rules:
1222
1319
  profile.cognitiveTraits?.delegationDepth ||
1223
1320
  profile.cognitiveTraits?.debuggingStyle ||
1224
1321
  profile.cognitiveTraits?.explanationFormat;
1322
+ const hasPersona = profile.conversationalPersona?.relationshipModel ||
1323
+ profile.conversationalPersona?.banterAffinity ||
1324
+ profile.conversationalPersona?.formalityLevel ||
1325
+ profile.conversationalPersona?.apologyTolerance ||
1326
+ profile.conversationalPersona?.stressCadence ||
1327
+ profile.conversationalPersona?.promptingHabit ||
1328
+ (profile.conversationalPersona?.conversationalQuirks &&
1329
+ profile.conversationalPersona.conversationalQuirks.length > 0);
1225
1330
  const hasStrengths = profile.technicalPreferences?.strengths && profile.technicalPreferences.strengths.length > 0;
1226
1331
  const hasConventions = profile.technicalPreferences?.conventions && profile.technicalPreferences.conventions.length > 0;
1227
1332
  const hasNotes = profile.agentNotes && profile.agentNotes.length > 0;
1228
1333
  console.log(`\n${pc.bold(pc.cyan('🧠 Global Adaptive User Profile & Persona Memory'))}`);
1229
1334
  console.log(`${pc.dim('Storage:')} ${pc.dim(getUserProfilePath())}\n`);
1230
- if (!hasStyle && !hasCognitive && !hasStrengths && !hasConventions && !hasNotes) {
1335
+ if (!hasStyle && !hasCognitive && !hasPersona && !hasStrengths && !hasConventions && !hasNotes) {
1231
1336
  p.log.info(pc.yellow('No personalized observations recorded yet. Mino will learn your communication style and preferences organically as you chat.'));
1232
1337
  }
1233
1338
  else {
1339
+ if (hasPersona) {
1340
+ console.log(pc.bold('Conversational Persona & Teammate Dynamics:'));
1341
+ if (profile.conversationalPersona?.relationshipModel) {
1342
+ console.log(` ${pc.dim('•')} Pairing Dynamic: ${pc.blue(profile.conversationalPersona.relationshipModel)}`);
1343
+ }
1344
+ if (profile.conversationalPersona?.banterAffinity) {
1345
+ console.log(` ${pc.dim('•')} Banter & Humor: ${pc.blue(profile.conversationalPersona.banterAffinity)}`);
1346
+ }
1347
+ if (profile.conversationalPersona?.formalityLevel) {
1348
+ console.log(` ${pc.dim('•')} Formality & Demeanor: ${pc.blue(profile.conversationalPersona.formalityLevel)}`);
1349
+ }
1350
+ if (profile.conversationalPersona?.apologyTolerance) {
1351
+ console.log(` ${pc.dim('•')} Apology Reaction: ${pc.blue(profile.conversationalPersona.apologyTolerance)}`);
1352
+ }
1353
+ if (profile.conversationalPersona?.stressCadence) {
1354
+ console.log(` ${pc.dim('•')} Stress Cadence: ${pc.blue(profile.conversationalPersona.stressCadence)}`);
1355
+ }
1356
+ if (profile.conversationalPersona?.promptingHabit) {
1357
+ console.log(` ${pc.dim('•')} Prompting Habit: ${pc.blue(profile.conversationalPersona.promptingHabit)}`);
1358
+ }
1359
+ if (profile.conversationalPersona?.conversationalQuirks &&
1360
+ profile.conversationalPersona.conversationalQuirks.length > 0) {
1361
+ console.log(` ${pc.dim('•')} Catchphrases & Quirks: ${pc.blue(profile.conversationalPersona.conversationalQuirks.join(', '))}`);
1362
+ }
1363
+ console.log('');
1364
+ }
1234
1365
  if (hasStyle) {
1235
1366
  console.log(pc.bold('Communication Style:'));
1236
1367
  if (profile.communicationStyle?.tonePreference) {
@@ -3,7 +3,7 @@ import * as p from '@clack/prompts';
3
3
  import pc from 'picocolors';
4
4
  import { debugLog } from '../../utils/logger.js';
5
5
  import { executeTool } from '../agent-tools.js';
6
- import { getPlanExecutionConfig } from '../ai.js';
6
+ import { getPlanExecutionConfig, getResearchConfig, HISTORICAL_TOOL_OUTPUT_THRESHOLD } from '../ai.js';
7
7
  import { routeIntent } from '../contextAgent.js';
8
8
  import { requestCommandApproval } from './commandApproval.js';
9
9
  import { getMetricCollector, recordRecoveryCircuitBreakerTrip } from '../metrics.js';
@@ -265,7 +265,7 @@ export async function processResponse(chat, result, workspaceRoot, inputHandler,
265
265
  if (queuedMsg) {
266
266
  additionalText = `[USER INTERRUPTION] The user sent the following message during your execution:\n"${queuedMsg}"\n\nPlease incorporate this feedback into your ongoing work. Address the user's message, but DO NOT lose track of your original overall plan or focus. After addressing this interruption, continue with your broader objective.`;
267
267
  p.log.info(pc.cyan(`Sending queued message to AI...`));
268
- // Dynamically upgrade agent permissions/intent to EXECUTE mode if the interrupted instruction requires system modifications
268
+ // Dynamically upgrade agent permissions/intent if the interrupted instruction requires system modifications
269
269
  const newIntent = await routeIntent(queuedMsg, '', abortSignal);
270
270
  if (agentState.targetAgent === 'CHAT') {
271
271
  if (newIntent.targetAgent === 'EXECUTE' || newIntent.needsContext) {
@@ -274,8 +274,17 @@ export async function processResponse(chat, result, workspaceRoot, inputHandler,
274
274
  chat.setAgentConfig(config.systemInstruction, config.tools);
275
275
  p.log.info(pc.yellow(`Upgraded session intent to EXECUTE based on chained message.`));
276
276
  }
277
+ else if (newIntent.targetAgent === 'RESEARCH') {
278
+ agentState.targetAgent = 'RESEARCH';
279
+ const config = getResearchConfig();
280
+ chat.setAgentConfig(config.systemInstruction, config.tools);
281
+ p.log.info(pc.cyan(`Upgraded session intent to RESEARCH based on chained message.`));
282
+ }
277
283
  }
284
+ // If agentState.targetAgent === 'RESEARCH', keep RESEARCH mode and incorporate into ongoing research
278
285
  }
286
+ // Apply in-place history pruning to collapse oversized tool responses older than 1 turn
287
+ chat.pruneToolOutputHistory(HISTORICAL_TOOL_OUTPUT_THRESHOLD, 1);
279
288
  // Feed tool results and potential interruption text back to the model
280
289
  let followUp;
281
290
  try {
@@ -1,12 +1,14 @@
1
1
  import type { ProxyChatSession } from '../ai.js';
2
2
  import type { AsyncInputHandler } from './inputHandler.js';
3
+ export type TargetAgent = 'CHAT' | 'RESEARCH' | 'EXECUTE';
3
4
  /**
4
5
  * State tracking container for the active agent operational mode.
5
6
  */
6
7
  export interface AgentState {
7
- /** The target agent mode: 'CHAT' for conversational interactions or 'EXECUTE' for tool/command execution. */
8
- targetAgent: 'CHAT' | 'EXECUTE';
8
+ /** The target agent mode: 'CHAT' for conversational interactions, 'RESEARCH' for active diagnostics/benchmarks, or 'EXECUTE' for tool/command execution. */
9
+ targetAgent: TargetAgent;
9
10
  }
11
+ import type { ThinkingLevel } from '../../utils/config.js';
10
12
  /**
11
13
  * Context object provided to slash command handlers containing session handles, terminal state, and metadata.
12
14
  */
@@ -32,6 +34,11 @@ export interface SlashCommandContext {
32
34
  latestUsageMetadata?: any;
33
35
  previousUsageMetadata?: any;
34
36
  modelUsageCounts?: Record<string, number>;
37
+ autoApprove?: boolean;
38
+ subAgents?: boolean;
39
+ debugMode?: boolean;
40
+ modelName?: string;
41
+ thinkingLevel?: ThinkingLevel;
35
42
  };
36
43
  }
37
44
  /**