minovative-mind-cli 2.13.5 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -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, 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 **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
11
11
  the build/performance metrics are green.
12
12
 
13
13
  > The result: **Genuine Pro reasoning accuracy at Flash-level speed and efficiency.**
@@ -82,7 +82,7 @@ Works in any terminal — SSH, Docker, CI pipelines, Vim, Windows Command Prompt
82
82
 
83
83
  ### 🔬 Automated SWE-bench Evaluation Runner
84
84
 
85
- Evaluate the agent on SWE-bench Lite datasets with automated repo isolation, patch extraction, and public-ready telemetry reporting:
85
+ Evaluate the agent on SWE-bench Lite datasets with automated repo isolation, patch extraction, AST-scoped context minimization, and public-ready telemetry reporting:
86
86
 
87
87
  ```bash
88
88
  # Run SWE-bench evaluation and generate JSON report
@@ -92,20 +92,31 @@ minovative-mind-cli eval -i test_instances.jsonl -o predictions.jsonl -r evaluat
92
92
  minovative-mind-cli eval -i instances.jsonl --repo astropy/astropy --concurrency 2
93
93
  ```
94
94
 
95
- ---
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.
96
96
 
97
+ ---
97
98
 
98
99
  ## Models
99
100
 
100
- Hot-swap during a session using `/models`:
101
+ Minovative Mind CLI features native support for Google's Gemini 3.x reasoning capabilities (`thinking_config`), allocating dynamic thinking budgets before tool execution and code generation. Hot-swap models and customize reasoning levels during a session using `/models`:
102
+
103
+ | Model | Default Thinking Level | Best for |
104
+ | ------------------------- | ---------------------- | --------------------------------------------------- |
105
+ | **Auto** (default) | `Medium` (`MEDIUM`) | Automatically selects (3.7 Flash or 3.5 Flash Lite) |
106
+ | **Gemini 3.7 Flash** | `Medium` (`MEDIUM`) | Next-gen performance, reasoning & fast execution |
107
+ | **Gemini 3.6 Flash** | `Medium` (`MEDIUM`) | Everyday coding — fast and accurate |
108
+ | **Gemini 3.1 Pro** | `High` (`HIGH`) | Complex architectural changes & deep reasoning |
109
+ | **Gemini 3.5 Flash Lite** | `Low` (`LOW`) | Best for speed and cost efficiency |
110
+
111
+ ### Native Thinking & Reasoning Levels
112
+
113
+ Gemini 3.x models support native provider-level reasoning control via `thinking_config`. When switching models or invoking `/models`, you can interactively customize the thinking depth across three streamlined developer tiers:
101
114
 
102
- | Model | Best for |
103
- | ------------------------- | --------------------------------------------------- |
104
- | **Auto** (default) | Automatically selects (3.7 Flash or 3.5 Flash Lite) |
105
- | **Gemini 3.7 Flash** | Next-gen performance, reasoning & fast execution |
106
- | **Gemini 3.6 Flash** | Everyday coding fast and accurate |
107
- | **Gemini 3.1 Pro** | Complex architectural changes |
108
- | **Gemini 3.5 Flash Lite** | Best for speed and cost efficiency |
115
+ - **`Low` (`LOW`)**: Fast, lightweight reasoning for routine tasks, minor bug fixes, and quick code edits.
116
+ - **`Medium` (`MEDIUM`)**: Balanced reasoning depth for multi-file refactoring, debugging, and feature development (default for 3.7 Flash, 3.6 Flash, and Auto).
117
+ - **`High` (`HIGH`)**: Exhaustive chain-of-thought deliberation for complex architectural transformations, intricate algorithmic puzzles, and large-scale migrations (default for 3.1 Pro).
118
+
119
+ _(Note: Internal `Minimal` reasoning is strictly reserved for lightweight background micro-agents and is excluded from user-facing selection to ensure optimal coding performance.)_
109
120
 
110
121
  ### BYOK (Bring Your Own Key)
111
122
 
@@ -114,17 +125,21 @@ If you prefer to use your own API key instead of credits, you can configure it v
114
125
  - **Configuration:** Use `/config-key` in the chat session to set and manage your API key.
115
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).
116
127
 
117
- ### Auxiliary Model Routing Defaults
128
+ ### Auxiliary Model Routing Defaults & Reasoning Invariants
118
129
 
119
- Background tasks automatically route to dedicated auxiliary models with native `responseSchema` constraints for optimal latency, cost efficiency, and structured output reliability:
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:
120
131
 
121
- - **Intent Routing (`routeIntent`)**: `Gemini 3.7 Flash` (Temp 0, native `responseSchema`) — permissive zero-temperature classification into `SEARCH` vs `SKIP` and `CHAT` vs `EXECUTE` with resilient fallback to repository exploration.
122
- - **Complexity Evaluators (`evaluateInvestigationComplexity`)**: `Gemini 3.7 Flash` (Temp 0, native `responseSchema`) — permissive parallel domain partitioning, global override detection, primary sub-path auto-focusing, and dynamic agent assignment recovery.
123
- - **Context Compressor**: `Gemini 3.7 Flash` (Temp 0.2) — surgical code distillation for files exceeding 2,000 characters.
124
- - **Session Titling**: `Gemini 3.7 Flash` (Temp 0.7, native `responseSchema`) automated concise chat session titling.
125
- - **Semantic Cache Classifier**: `Gemini 3.5 Flash Lite` (Temp 0, native `responseSchema`) intent and topic classification for cache hits.
126
- - **History Summarizer**: `Gemini 3.7 Flash` (Temp 0.2) — 3-part structured conversation compression preserving recent history.
127
- - **Commit Generator**: `Gemini 3.5 Flash Lite` — conventional commit message synthesis.
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`).
128
143
 
129
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.
130
145
 
@@ -136,13 +151,13 @@ Background tasks automatically route to dedicated auxiliary models with native `
136
151
  | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
137
152
  | `/config-key` | Configure custom Google AI Studio API key (BYOK mode) |
138
153
  | `/profile` | View, inspect, delete, or reset global adaptive persona memory and AI side-notes |
139
- | `/models` | Hot-swap the active model |
154
+ | `/models` | Hot-swap the active model or configure its native reasoning thinking level (`Low`, `Medium`, `High`) |
140
155
  | `/paste` | Multi-line input mode (cancel with Ctrl+C) |
141
156
  | `/clear` | Clear conversation history |
142
157
  | `/debug` | Expose internal agent diagnostics |
143
158
  | `/auto-approve` | Toggle skipping confirmation prompts for commands |
144
159
  | `/sub-agents` | Toggle the MMAAK Engine for parallel investigation and execution (concurrency limited to 2) |
145
- | `/stats` | View session and all-time statistics, plus configurations |
160
+ | `/stats` | View session and all-time statistics, token telemetry, active model settings, and live thinking level runtime telemetry |
146
161
  | `/commit` | Generate a conventional commit message from your diff |
147
162
  | `/revert` | Undo changes from the last turn, or toggle the revert logger |
148
163
  | `/chats` | View, resume, rename, or delete previous chat sessions (with centralized token telemetry, Git branch, auto-approve status, and sub-agent state) |
@@ -151,6 +166,56 @@ Background tasks automatically route to dedicated auxiliary models with native `
151
166
 
152
167
  ---
153
168
 
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
+ ### Interactive Autocomplete & Keyboard Navigation
174
+
175
+ When typing `@`, the interactive terminal autocomplete popup immediately renders:
176
+
177
+ - **10-Option Pagination**: Displays up to 10 ranked suggestions per page with dynamic page indexing `(1/10)`.
178
+ - **Cyan Navigation Helper**: Highlights the action footer in light blue (`Tab to insert • ↑/↓ navigate • Esc dismiss`) for clear guidance.
179
+ - **Keyboard Controls**:
180
+ - `↑` / `↓` (Up / Down Arrows): Cycle smoothly through ranked suggestions with automatic window scrolling.
181
+ - `Tab` or `Enter`: Select and insert the highlighted mention directly at the cursor.
182
+ - `Esc`: Dismiss the autocomplete dropdown.
183
+ - `Backspace` / Alphanumeric keys: Filter suggestions in real-time with fuzzy matching.
184
+
185
+ ### Supported Mention Types
186
+
187
+ | Mention Syntax | Category Badge | Type | What it Resolves & Injects |
188
+ | :--------------------------------------- | :------------------ | :----------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
189
+ | `@<path>` or `@file:<path>` | `[file]` | **File** | Injects the complete content of a workspace file (e.g. `@src/index.ts` or `@file:package.json`). |
190
+ | `@<path>:<start>-<end>` | `[lines]` | **Line Range Slicing** | Surgically slices and injects only the specified line numbers (e.g. `@src/utils/config.ts:10-50`), saving tokens. |
191
+ | `@symbol:<name>` or `@#<name>` | `[sym]` | **AST Symbol** | Injects exact definitions of functions, classes, interfaces, types, methods, or structs (e.g. `@symbol:getUser` or `@#AuthService`) using polyglot AST extraction. |
192
+ | `@symbol:<path>:<name>` | `[sym]` | **Scoped Symbol** | Injects a specific symbol definition directly from a designated source file (e.g. `@symbol:src/services/auth.ts:validateToken`). |
193
+ | `@git:diff` or `@diff` | `[git]` | **Git Diff** | Injects the active unstaged working tree diff. |
194
+ | `@git:staged` | `[git]` | **Git Staged** | Injects currently staged git changes (`git diff --staged`). |
195
+ | `@git:status` | `[git]` | **Git Status** | Injects the current branch state and working tree status (`git status --short`). |
196
+ | `@git:branch` | `[git]` | **Git Branch** | Injects the current active Git branch and upstream tracking info. |
197
+ | `@git:log` | `[git]` | **Git Commit Log** | Injects the recent commit history (last 10 commits with hashes, authors, and messages). |
198
+ | `@diagnostics` / `@problems` / `@errors` | `[diag]` / `[prob]` | **Diagnostics** | Injects active compiler, linter, or syntax error diagnostics. |
199
+ | `@terminal` / `@console` | `[term]` | **Terminal Context** | Injects recent terminal environment context, shell environment, and command execution state. |
200
+ | `@<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
+ | `@<alias>` | `[ws]` | **Workspace Summary** | Injects configuration, manifest overview, and path details for a registered external workspace. |
202
+
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
+ ---
218
+
154
219
  ## 🌐 Multi-Workspace, Sub-Path Focusing & Security Guardrails
155
220
 
156
221
  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`).
@@ -166,28 +231,28 @@ Minovative Mind CLI doesn't restrict you to a single repository. You can logical
166
231
 
167
232
  Minovative Mind CLI fundamentally supports **ALL programming languages** for chat, code generation, and execution, as it relies on Gemini's vast training data.
168
233
 
169
- However, the PCV engine features deep, context-aware analysis across **12 major programming language families**. Our core advanced engines—**Smart Dependency Tracing**, **Property-Based & Mutation Verification**, **Performance Auditing** (across 9 language families), and **Ephemeral Analysis Scripts**—provide tailored support depending on the language's syntax and runtime model:
170
-
171
- | Language Family | Supported Extensions | Dependency Tracing | Performance Auditing | Ephemeral Analysis |
172
- | :--------------------------- | :------------------------------------------- | :----------------: | :------------------: | :----------------: |
173
- | **JavaScript / TypeScript** | `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs` | ✅ | ✅ | ✅ |
174
- | **Python** | `.py`, `.pyw` | ✅ | ✅ | ✅ |
175
- | **Rust** | `.rs` | ✅ | ✅ | ✅ |
176
- | **Go** | `.go` | ✅ | ✅ | ✅ |
177
- | **C / C++** | `.c`, `.h`, `.cpp`, `.hpp`, `.cc`, `.cxx` | ✅ | ✅ | ⚠️ \* |
178
- | **C#** | `.cs` | ✅ | ✅ | ❌ |
179
- | **Java / Kotlin** | `.java`, `.kt`, `.kts` | ✅ | ✅ | ⚠️ \* |
180
- | **PHP** | `.php` | ✅ | ✅ | ❌ |
181
- | **Ruby** | `.rb` | ✅ | ✅ | ❌ |
182
- | **CSS / SCSS / SASS / LESS** | `.css`, `.scss`, `.sass`, `.less` | ✅ | ❌ | ❌ |
183
- | **Swift** | `.swift` | ✅ | ❌ | ❌ |
184
- | **Dart** | `.dart` | ✅ | ❌ | ❌ |
234
+ However, the PCV engine features deep, context-aware analysis across **12 major programming language families**. Our core advanced engines—**Smart Dependency Tracing**, **AST Symbol Extraction & Chunking**, **Property-Based & Mutation Verification**, **Performance Auditing** (across 9 language families), and **Ephemeral Analysis Scripts**—provide tailored support depending on the language's syntax and runtime model:
235
+
236
+ | Language Family | Supported Extensions | Dependency Tracing | AST Extraction | Performance Auditing | Ephemeral Analysis |
237
+ | :--------------------------- | :------------------------------------------- | :----------------: | :------------: | :------------------: | :----------------: |
238
+ | **JavaScript / TypeScript** | `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs` | ✅ | ✅ | ✅ | ✅ |
239
+ | **Python** | `.py`, `.pyw` | ✅ | ✅ | ✅ | ✅ |
240
+ | **Rust** | `.rs` | ✅ | ✅ | ✅ | ✅ |
241
+ | **Go** | `.go` | ✅ | ✅ | ✅ | ✅ |
242
+ | **C / C++** | `.c`, `.h`, `.cpp`, `.hpp`, `.cc`, `.cxx` | ✅ | ✅ | ✅ | ⚠️ \* |
243
+ | **C#** | `.cs` | ✅ | ✅ | ✅ | ❌ |
244
+ | **Java / Kotlin** | `.java`, `.kt`, `.kts` | ✅ | ✅ | ✅ | ⚠️ \* |
245
+ | **PHP** | `.php` | ✅ | ✅ | ✅ | ❌ |
246
+ | **Ruby** | `.rb` | ✅ | ✅ | ✅ | ❌ |
247
+ | **CSS / SCSS / SASS / LESS** | `.css`, `.scss`, `.sass`, `.less` | ✅ | ❌ | ❌ | ❌ |
248
+ | **Swift** | `.swift` | ✅ | ✅ | ❌ | ❌ |
249
+ | **Dart** | `.dart` | ✅ | ✅ | ❌ | ❌ |
185
250
 
186
251
  _⚠️\*Support is limited or requires custom local system tooling/environment setup._
187
252
 
188
253
  ### Why do some features only support specific languages?
189
254
 
190
- 1. **Dependency Tracing:** Fully supported across language families. It uses lightning-fast static regex pattern matching to resolve local import structures and determine the "blast radius" of code changes without requiring local compilations.
255
+ 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.
191
256
  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).
192
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.
193
258
 
@@ -15,10 +15,10 @@ import { readPaste } from '../../utils/paste.js';
15
15
  import { setApprovalMode, getApprovalMode, isSubAgentsEnabled, setSubAgentsEnabled } from '../agent-tools.js';
16
16
  import { ProxyClient, getAndResetTurnUsage } from '../proxyClient.js';
17
17
  import { checkByokSubscription } from '../auth.js';
18
- import { GEMINI_MODELS, isByokEnabled } from '../../utils/config.js';
18
+ import { GEMINI_MODELS, isByokEnabled, DEFAULT_MODEL_THINKING_LEVELS } from '../../utils/config.js';
19
19
  import { loadCredentials, updateCredentialField } from '../../utils/credentialStore.js';
20
- import { getGlobalActiveModel, setGlobalActiveModel, ProxyChatSession } from '../ai.js';
21
- import { loadUserProfile, deleteSideNote, clearUserProfile, getUserProfilePath, } from '../userProfileService.js';
20
+ import { getGlobalActiveModel, setGlobalActiveModel, getModelThinkingLevel, setModelThinkingLevel, ProxyChatSession } from '../ai.js';
21
+ import { loadUserProfile, deleteSideNote, clearUserProfile, getUserProfilePath } from '../userProfileService.js';
22
22
  /**
23
23
  * @file slashCommands.ts
24
24
  * @description Interactive slash command handler module for Minovative Mind CLI.
@@ -139,7 +139,50 @@ export async function handleSlashCommand(command, context) {
139
139
  if (!p.isCancel(selectedModel)) {
140
140
  chat.setModel(selectedModel);
141
141
  setGlobalActiveModel(selectedModel);
142
- p.log.success(`Model successfully switched to ${pc.cyan(selectedModel)}`);
142
+ if (selectedModel === 'auto') {
143
+ const defaultAutoThinking = DEFAULT_MODEL_THINKING_LEVELS[GEMINI_MODELS.AUTO] || 'MEDIUM';
144
+ if (typeof chat.setThinkingLevel === 'function') {
145
+ chat.setThinkingLevel(defaultAutoThinking);
146
+ }
147
+ p.log.success(`Model successfully switched to ${pc.cyan('Auto (Smart Routing & Reasoning)')}`);
148
+ }
149
+ else {
150
+ const activeModelThinking = getModelThinkingLevel(selectedModel);
151
+ const selectedThinking = await p['select']({
152
+ message: `Configure Thinking Level for ${pc.cyan(selectedModel)} (Current: ${pc.cyan(activeModelThinking)})`,
153
+ initialValue: activeModelThinking,
154
+ options: [
155
+ {
156
+ value: 'LOW',
157
+ label: 'Low',
158
+ hint: 'Quick reasoning with low token overhead',
159
+ },
160
+ {
161
+ value: 'MEDIUM',
162
+ label: 'Medium',
163
+ hint: 'Balanced reasoning for everyday coding and debugging',
164
+ },
165
+ {
166
+ value: 'HIGH',
167
+ label: 'High',
168
+ hint: 'Deepest reasoning for complex architectural tasks',
169
+ },
170
+ ],
171
+ });
172
+ if (!p.isCancel(selectedThinking)) {
173
+ setModelThinkingLevel(selectedModel, selectedThinking);
174
+ if (typeof chat.setThinkingLevel === 'function') {
175
+ chat.setThinkingLevel(selectedThinking);
176
+ }
177
+ p.log.success(`Model successfully switched to ${pc.cyan(selectedModel)} with thinking level ${pc.cyan(selectedThinking)}`);
178
+ }
179
+ else {
180
+ if (typeof chat.setThinkingLevel === 'function') {
181
+ chat.setThinkingLevel(activeModelThinking);
182
+ }
183
+ p.log.success(`Model successfully switched to ${pc.cyan(selectedModel)}`);
184
+ }
185
+ }
143
186
  }
144
187
  return { shouldContinue: true };
145
188
  }
@@ -149,7 +192,10 @@ export async function handleSlashCommand(command, context) {
149
192
  if (lowerCommand === '/debug') {
150
193
  const debugMode = toggleDebugMode();
151
194
  if (debugMode) {
152
- p.log.info('Debug mode enabled. Internal logs will now be shown.');
195
+ const currentModel = chat.getModel();
196
+ const currentThinkingLevel = (typeof chat.getThinkingLevel === 'function' ? chat.getThinkingLevel() : undefined) ||
197
+ getModelThinkingLevel(currentModel);
198
+ p.log.info(`Debug mode enabled. Active Model: ${pc.cyan(currentModel)} (thinking: ${pc.cyan(currentThinkingLevel)}). Internal logs will now be shown.`);
153
199
  }
154
200
  else {
155
201
  p.log.info('Debug mode disabled.');
@@ -210,12 +256,15 @@ export async function handleSlashCommand(command, context) {
210
256
  else {
211
257
  displayModel = modelStatsStr || currentModel;
212
258
  }
259
+ const currentThinkingLevel = (typeof chat.getThinkingLevel === 'function' ? chat.getThinkingLevel() : undefined) ||
260
+ getModelThinkingLevel(currentModel);
213
261
  const autoApprove = getApprovalMode() === 'skip-all' ? 'Enabled' : 'Disabled';
214
262
  const subAgents = isSubAgentsEnabled() ? 'Enabled' : 'Disabled';
215
263
  const byokEnabled = (await isByokEnabled()) ? 'Enabled' : 'Disabled';
216
264
  p.log.step(pc.magenta('📊 Session Statistics & Status'));
217
265
  console.log(pc.dim('----------------------------------------'));
218
266
  console.log(`${pc.bold('AI Model:')} ${pc.cyan(displayModel)}`);
267
+ console.log(`${pc.bold('Thinking Level:')} ${pc.cyan(currentThinkingLevel)}`);
219
268
  console.log(`${pc.bold('Auto-Approve:')} ${autoApprove === 'Enabled' ? pc.green(autoApprove) : pc.yellow(autoApprove)}`);
220
269
  console.log(`${pc.bold('Sub-Agents:')} ${subAgents === 'Enabled' ? pc.green(subAgents) : pc.yellow(subAgents)}`);
221
270
  console.log(`${pc.bold('BYOK:')} ${byokEnabled === 'Enabled' ? pc.green(byokEnabled) : pc.yellow(byokEnabled)}`);
@@ -1024,10 +1073,10 @@ Output ONLY the raw commit message text. Absolutely NO conversational preambles,
1024
1073
 
1025
1074
  Strict Formatting Rules:
1026
1075
  1. First line must follow Conventional Commits format: type(scope): description
1027
- - Allowed types: feat, fix, refactor, test, docs, chore, perf, style
1028
- - Subject line must be in imperative mood (e.g. "add support for...", "fix bug in...") and strictly under 50 characters.
1076
+ - Allowed types: feat, fix, refactor, test, docs, chore, perf, style, etc
1077
+ - Subject line must be in imperative mood (e.g. "added support for...", "fixed bug in...") and strictly under limited characters.
1029
1078
  2. Leave a single blank line after the subject.
1030
- 3. Provide a concise bulleted list (using '-' or '*') explaining the architectural "what" and "why" of the changes based on the provided diff. If diff spans multiple areas, prioritize the primary architectural change.`;
1079
+ 3. Provide a concise bulleted list (using '-' or '*') explaining the architectural "what" and "why" of the changes based on the provided diff.`;
1031
1080
  const commitAgent = new ProxyChatSession(GEMINI_MODELS.FLASH_LITE, commitSystemPrompt, [], {});
1032
1081
  const commitResult = await commitAgent.sendMessage(prompt);
1033
1082
  let commitMsg = commitResult.response.text().trim();
@@ -1,6 +1,7 @@
1
1
  import { ProxyChatSession } from '../ai.js';
2
2
  import { GEMINI_MODELS, MAX_OUTPUT_TOKENS } from '../../utils/config.js';
3
3
  import { localValidate } from '../../utils/localSyntaxValidator.js';
4
+ import { debugLog } from '../../utils/logger.js';
4
5
  /**
5
6
  * Extracts a numeric character position from a syntax error message if present.
6
7
  */
@@ -100,6 +101,9 @@ Your job is to fix syntax errors in source code snippets extracted from large fi
100
101
  const snippetChat = new ProxyChatSession(model, snippetSystemInstruction, [], {
101
102
  maxOutputTokens: MAX_OUTPUT_TOKENS,
102
103
  temperature: 0.1,
104
+ thinkingConfig: {
105
+ thinkingLevel: 'LOW',
106
+ },
103
107
  });
104
108
  const snippetPrompt = `File Path: ${filePath}
105
109
  Line Range: Lines ${win.startLine} to ${win.endLine} (Error near position ${errorPos})
@@ -109,6 +113,7 @@ Code Snippet to Repair:
109
113
  ${win.snippet}
110
114
 
111
115
  Please fix the syntax error in the snippet above and return ONLY the raw repaired code snippet:`;
116
+ debugLog(`Attempting AI snippet syntax repair for ${filePath} with model ${model} (thinking: LOW)...`);
112
117
  try {
113
118
  const result = await snippetChat.sendMessage(snippetPrompt, undefined, abortSignal);
114
119
  const repairedSnippet = cleanOutput(result.response.text());
@@ -145,6 +150,9 @@ Your sole job is to read source code and verify or repair its syntax.
145
150
  const fullChat = new ProxyChatSession(model, fullSystemInstruction, [], {
146
151
  maxOutputTokens: MAX_OUTPUT_TOKENS,
147
152
  temperature: 0.1,
153
+ thinkingConfig: {
154
+ thinkingLevel: 'LOW',
155
+ },
148
156
  });
149
157
  const fullPrompt = `File Path: ${filePath}
150
158
 
@@ -153,6 +161,7 @@ ${effectiveError}
153
161
 
154
162
  Content:
155
163
  ${content}`;
164
+ debugLog(`Attempting AI full syntax repair for ${filePath} with model ${model} (thinking: LOW)...`);
156
165
  try {
157
166
  const result = await fullChat.sendMessage(fullPrompt, undefined, abortSignal);
158
167
  const output = cleanOutput(result.response.text());
@@ -215,6 +224,9 @@ Your primary job is to perform fuzzy search matching and replacement on source c
215
224
  const chat = new ProxyChatSession(model, systemInstruction, [], {
216
225
  maxOutputTokens: MAX_OUTPUT_TOKENS,
217
226
  temperature: 0.1,
227
+ thinkingConfig: {
228
+ thinkingLevel: 'LOW',
229
+ },
218
230
  });
219
231
  const prompt = `File Path: ${filePath}
220
232
 
@@ -226,6 +238,7 @@ ${replaceContent}
226
238
 
227
239
  File Content:
228
240
  ${fileContent}`;
241
+ debugLog(`Attempting AI fuzzy search and replace for ${filePath} with model ${model} (thinking: LOW)...`);
229
242
  try {
230
243
  const response = await chat.sendMessage(prompt, undefined, options.abortSignal);
231
244
  const rawOutput = response.response.text();
@@ -87,7 +87,7 @@ export declare function consumeSkipOnce(): void;
87
87
  * @param targetElements - Optional array of specific symbol or function names to extract.
88
88
  * @returns A promise resolving to a {@link ToolResult} containing the file content or error details.
89
89
  */
90
- export declare function readFile(workspaceRoot: string, filePath: string, startLine?: number, endLine?: number, targetElements?: string[]): Promise<ToolResult>;
90
+ export declare function readFile(workspaceRoot: string, filePath: string, startLine?: number, endLine?: number, targetElements?: string[], outlineOnly?: boolean): Promise<ToolResult>;
91
91
  /**
92
92
  * Creates a new file or completely overwrites an existing file with the provided content,
93
93
  * performing local syntax validation and iterative AI syntax auto-correction if validation fails.
@@ -570,7 +570,7 @@ async function getIgnoredPaths(workspaceRoot) {
570
570
  * @param targetElements - Optional array of specific symbol or function names to extract.
571
571
  * @returns A promise resolving to a {@link ToolResult} containing the file content or error details.
572
572
  */
573
- export async function readFile(workspaceRoot, filePath, startLine, endLine, targetElements) {
573
+ export async function readFile(workspaceRoot, filePath, startLine, endLine, targetElements, outlineOnly) {
574
574
  try {
575
575
  const absPath = resolveAndValidatePath(workspaceRoot, filePath);
576
576
  // Check if file is explicitly ignored
@@ -1809,7 +1809,7 @@ export async function executeTool(workspaceRoot, toolName, args, abortSignal) {
1809
1809
  break;
1810
1810
  }
1811
1811
  case 'read_file':
1812
- result = await readFile(effectiveRoot, resolvedArgs.filePath, resolvedArgs.startLine, resolvedArgs.endLine, resolvedArgs.targetElements);
1812
+ result = await readFile(effectiveRoot, resolvedArgs.filePath, resolvedArgs.startLine, resolvedArgs.endLine, resolvedArgs.targetElements, resolvedArgs.outlineOnly);
1813
1813
  // Record successful reads so the file-read guard allows subsequent modify_file calls
1814
1814
  if (!result.error) {
1815
1815
  recordFileRead(resolvedArgs.filePath);
@@ -26,7 +26,7 @@ const execAsync = promisify(exec);
26
26
  import { debugLog, isDebugOn } from '../utils/logger.js';
27
27
  import { ensureProjectStorage, ensureIgnored, readCache, writeCache, invalidateCacheForDependents, } from '../utils/projectStorage.js';
28
28
  import { GEMINI_MODELS, TPM_COOLING_DELAYS } from '../utils/config.js';
29
- import { createSharedChatSession, getGeneralChatConfig, getPlanExecutionConfig, compressTextUsingFlashLite, generateChatTitle, getGlobalActiveModel, summarizeChatHistory, } from './ai.js';
29
+ import { createSharedChatSession, getGeneralChatConfig, getPlanExecutionConfig, compressTextUsingFlashLite, generateChatTitle, getGlobalActiveModel, getModelThinkingLevel, summarizeChatHistory, } from './ai.js';
30
30
  import { getAndResetTurnUsage } from './proxyClient.js';
31
31
  import { changeLogger } from './changeLogger.js';
32
32
  import { chatHistoryService } from './chatHistoryService.js';
@@ -35,7 +35,7 @@ import { verifyChangedFiles } from './verificationService.js';
35
35
  import { buildContextInjection } from '../utils/contextPrompts.js';
36
36
  import { registerContextFiles } from '../utils/fileReadGuard.js';
37
37
  import { historyText } from '../utils/historyPrompt.js';
38
- import { loadUserProfile, formatUserProfileForContext, extractAndSaveUserInsights, } from './userProfileService.js';
38
+ import { loadUserProfile, formatUserProfileForContext, extractAndSaveUserInsights } from './userProfileService.js';
39
39
  // Submodule Imports
40
40
  import { AsyncInputHandler } from './agent/inputHandler.js';
41
41
  import { processResponse } from './agent/toolLoop.js';
@@ -164,7 +164,7 @@ export async function startAgentLoop(workspaceRoot, version) {
164
164
  }
165
165
  inputHandler.stop();
166
166
  // Input collection (delegated to a helper function to avoid nested loop warning)
167
- const { userInput: rawInput, canceled } = await collectUserInput(sessionInputHistory);
167
+ const { userInput: rawInput, canceled } = await collectUserInput(sessionInputHistory, workspaceRoot);
168
168
  if (canceled) {
169
169
  p.outro(pc.green('Goodbye! Happy coding. 🚀'));
170
170
  return;
@@ -402,6 +402,78 @@ export async function executeSingleTurn(workspaceRoot, userInput, chat, inputHan
402
402
  collector.recordCompressedContextSize(contextInjection.length);
403
403
  dynamicSystemInstruction += '\n\n' + contextInjection;
404
404
  }
405
+ // Resolve and inject explicit @ Context Mentions (files, symbols, git diffs, diagnostics, external workspaces)
406
+ try {
407
+ const { mentionEngine } = await import('./mentionEngine.js');
408
+ const resolvedMentions = await mentionEngine.resolveMentions(userInput, workspaceRoot);
409
+ if (resolvedMentions.hasMentions) {
410
+ const isPrompting = inputHandler.isCurrentlyPrompting();
411
+ if (!isPrompting) {
412
+ spinner.stop();
413
+ }
414
+ for (const item of resolvedMentions.mentions) {
415
+ if (item.resolved) {
416
+ const label = item.statusLabel ? ` ${pc.dim(`(${item.statusLabel})`)}` : '';
417
+ p.log.step(`${pc.green('✔')} Context ${pc.cyan(item.mention.raw)}${label}`);
418
+ }
419
+ else {
420
+ const reason = item.error ? ` ${pc.dim(`(${item.error})`)}` : '';
421
+ p.log.warn(`${pc.red('✖')} Context ${pc.yellow(item.mention.raw)}${reason}`);
422
+ }
423
+ }
424
+ if (!isPrompting) {
425
+ spinner.start('Preparing agent configuration...');
426
+ }
427
+ if (resolvedMentions.formattedContext) {
428
+ debugLog(`Resolved ${resolvedMentions.mentions.length} context mention(s) (${resolvedMentions.totalTokens} tokens estimated)`);
429
+ dynamicSystemInstruction += '\n\n' + resolvedMentions.formattedContext;
430
+ // Pre-register all resolved file mention paths with the read-guard
431
+ const mentionedFiles = resolvedMentions.mentions
432
+ .filter((m) => m.mention.type === 'file' && m.resolved)
433
+ .map((m) => m.mention.target);
434
+ if (mentionedFiles.length > 0) {
435
+ registerContextFiles(mentionedFiles);
436
+ }
437
+ }
438
+ }
439
+ // Also resolve mentions from any chained follow-up instructions received during investigation
440
+ if (gatherRes.chainedMessages.length > 0) {
441
+ const chainedContent = gatherRes.chainedMessages.join('\n');
442
+ const chainedMentions = await mentionEngine.resolveMentions(chainedContent, workspaceRoot);
443
+ if (chainedMentions.hasMentions) {
444
+ const isPrompting = inputHandler.isCurrentlyPrompting();
445
+ if (!isPrompting) {
446
+ spinner.stop();
447
+ }
448
+ for (const item of chainedMentions.mentions) {
449
+ if (item.resolved) {
450
+ const label = item.statusLabel ? ` ${pc.dim(`(${item.statusLabel})`)}` : '';
451
+ p.log.step(`${pc.green('✔')} Chained Context ${pc.cyan(item.mention.raw)}${label}`);
452
+ }
453
+ else {
454
+ const reason = item.error ? ` ${pc.dim(`(${item.error})`)}` : '';
455
+ p.log.warn(`${pc.red('✖')} Chained Context ${pc.yellow(item.mention.raw)}${reason}`);
456
+ }
457
+ }
458
+ if (!isPrompting) {
459
+ spinner.start('Preparing agent configuration...');
460
+ }
461
+ if (chainedMentions.formattedContext) {
462
+ debugLog(`Resolved ${chainedMentions.mentions.length} chained context mention(s) (${chainedMentions.totalTokens} tokens estimated)`);
463
+ dynamicSystemInstruction += '\n\n' + chainedMentions.formattedContext;
464
+ const chainedFiles = chainedMentions.mentions
465
+ .filter((m) => m.mention.type === 'file' && m.resolved)
466
+ .map((m) => m.mention.target);
467
+ if (chainedFiles.length > 0) {
468
+ registerContextFiles(chainedFiles);
469
+ }
470
+ }
471
+ }
472
+ }
473
+ }
474
+ catch (mentionErr) {
475
+ debugLog(`Context mention resolution encountered an error: ${mentionErr?.message || mentionErr}`);
476
+ }
405
477
  // Inject global adaptive user persona and learned preferences
406
478
  try {
407
479
  const userProfile = await loadUserProfile();
@@ -429,10 +501,20 @@ export async function executeSingleTurn(workspaceRoot, userInput, chat, inputHan
429
501
  selectedModel = complexity === 'EASY' ? GEMINI_MODELS.FLASH_LITE : GEMINI_MODELS.FLASH;
430
502
  }
431
503
  chat.setModel(selectedModel);
432
- debugLog(`Auto-routing to model ${selectedModel} based on intent ${effectiveTargetAgent}`);
504
+ const thinkingLevel = getModelThinkingLevel(selectedModel);
505
+ if (typeof chat.setThinkingLevel === 'function') {
506
+ chat.setThinkingLevel(thinkingLevel);
507
+ }
508
+ debugLog(`Auto-routing to model ${selectedModel} (thinking: ${thinkingLevel}) based on intent ${effectiveTargetAgent}`);
433
509
  }
434
510
  else {
435
- chat.setModel(getGlobalActiveModel());
511
+ const activeModel = getGlobalActiveModel();
512
+ chat.setModel(activeModel);
513
+ const thinkingLevel = getModelThinkingLevel(activeModel);
514
+ if (typeof chat.setThinkingLevel === 'function') {
515
+ chat.setThinkingLevel(thinkingLevel);
516
+ }
517
+ debugLog(`Active model set to ${activeModel} (thinking: ${thinkingLevel})`);
436
518
  }
437
519
  if (ac.signal.aborted) {
438
520
  spinner.stop();
@@ -599,6 +681,10 @@ export async function executeSingleTurn(workspaceRoot, userInput, chat, inputHan
599
681
  // Send the formulated prompt payload to the generative model
600
682
  let result;
601
683
  try {
684
+ const activeModel = chat.getModel();
685
+ const currentThinking = (typeof chat.getThinkingLevel === 'function' ? chat.getThinkingLevel() : undefined) ||
686
+ getModelThinkingLevel(activeModel);
687
+ debugLog(`Dispatching turn to model ${activeModel} (thinking: ${currentThinking})`);
602
688
  result = await chat.sendMessage(finalInput, undefined, ac.signal);
603
689
  }
604
690
  catch (e) {
@@ -794,14 +880,40 @@ export async function executeSingleTurn(workspaceRoot, userInput, chat, inputHan
794
880
  }
795
881
  });
796
882
  }
797
- async function collectUserInput(history) {
883
+ async function collectUserInput(history, workspaceRoot = process.cwd()) {
798
884
  let lines = [];
799
885
  let isMultiLine = false;
800
886
  while (true) {
801
887
  const userInputRaw = await historyText({
802
888
  message: isMultiLine ? ' ' : pc.magenta('❯'),
803
- placeholder: isMultiLine ? '' : 'Use ' + String.fromCharCode(92) + ' for new lines',
889
+ placeholder: isMultiLine
890
+ ? ''
891
+ : 'Use ' + String.fromCharCode(92) + ' for new lines or @ to mention file paths and more',
804
892
  history,
893
+ autocomplete: {
894
+ workspaceRoot,
895
+ getSuggestions: async (query) => {
896
+ try {
897
+ const { mentionEngine } = await import('./mentionEngine.js');
898
+ const suggestions = await mentionEngine.getSuggestionsForQuery(query, { workspaceRoot });
899
+ return suggestions.map((s) => ({
900
+ value: s.value,
901
+ label: s.label,
902
+ category: s.category,
903
+ description: s.description,
904
+ metadata: {
905
+ filePath: s.filePath,
906
+ symbol: s.label,
907
+ helperLabel: s.helperLabel,
908
+ symbolKind: s.symbolKind,
909
+ },
910
+ }));
911
+ }
912
+ catch {
913
+ return [];
914
+ }
915
+ },
916
+ },
805
917
  });
806
918
  if (p.isCancel(userInputRaw)) {
807
919
  if (isMultiLine) {