Power Mode
Power Mode is an autonomous coding agent that opens in its own window (Cmd+Alt+P). It plans, edits files, runs terminal commands, and iterates until the task is done.
How It Works
Power Mode uses native tool calling (MCP protocol) with the LLM. The agent loop:
- User gives an instruction
- LLM reasons about the task
- LLM calls tools (read files, edit code, run commands, search, etc.)
- Results return to the LLM
- LLM decides: done, or call more tools
- Repeat until task is complete
The key principle: action, not words — the agent executes immediately rather than explaining what it would do.
Built-in Tools
| Category | Tools | What they do |
|---|---|---|
| Filesystem | bash, read, write, edit | Run commands, read/write/edit files |
| Search | glob, grep, list | Find files by pattern, search content, list directories |
| Sub-agents | workflow tools | Spawn child agents for parallel tasks |
| Modernisation | migration tools | Access active modernisation session data |
| Knowledge Base | KB tools | Query the modernisation knowledge base |
| Autonomy | execution tools | Control autonomous execution flow |
Tools are registered via IVoidInternalToolService and shared across Power Mode and sidebar chat.
System Prompt
The system prompt (powerMode/browser/session/systemPrompt.ts) dynamically includes:
- Current working directory and git status
- Platform info (OS, shell)
- Active modernisation session context (if running)
- Active firmware session context (if running)
- Custom instructions from
AGENTS.mdin the workspace root - BYOLLM attribution rules for git commits
Agent Configuration
Users can configure agent behavior via .neuralinverseagent JSON file at workspace root:
{
"maxIterations": 50,
"autoApproval": {
"fileEdits": true,
"terminalCommands": ["npm test", "npm run build"]
},
"blockedCommands": ["rm -rf", "git push --force"],
"subAgents": {
"maxConcurrent": 3
}
}Sub-Agents
Power Mode can spawn sub-agents for parallel work:
| Role | Capabilities | Use case |
|---|---|---|
| Explorer | Read-only filesystem access | Research, find files, understand code |
| Editor | Scoped file edits | Make changes to specific files |
| Verifier | Run tests and lint | Validate changes before completing |
Sub-agents run concurrently (up to maxConcurrentSubAgents) with their own chat threads and scoped tool whitelists.
Session Compaction
Power Mode supports 200-step sessions. To keep within context limits, the compaction engine runs automatically when token count exceeds 100K.
How Compaction Works
4 progressive levels (cheapest first, stop when under target):
Level 1: Truncate tool outputs
- Tool outputs > 8K tokens → first 200 + last 100 tokens kept
- Inserts
[...N tokens truncated...]marker - Skips messages in the preserved recent window
Level 2: Drop reasoning parts
- Removes internal chain-of-thought from old messages
- Preserves all tool calls and results
Level 3: Collapse redundant sequences
- 3+ consecutive read/list calls to same directory → one-line summary
- Zero-result grep calls → collapsed to "Searched for X — no results"
Level 4: LLM summarization
- Groups messages into step ranges (step-start to step-finish boundaries)
- LLM generates structured summary: goal, decisions, file changes, errors
- Heuristic fallback if LLM unavailable
- Summary injects as single message replacing compacted range
Preservation Rules
Always kept verbatim:
- First user message (original goal)
- Last 6 messages (recent context)
- Messages with unresolved errors
- Messages referencing currently active files
Implementation
| File | Purpose |
|---|---|
compaction/tokenEstimator.ts | Browser-safe token counting (prose/code/JSON detection) |
compaction/compactionStrategy.ts | Decides when/what/how to compact |
compaction/conversationSummarizer.ts | LLM + heuristic summarization |
compaction/compactionService.ts | Orchestrates estimation + strategy + summarization |
powerModeProcessor.ts | Pre-step budget check, triggers compaction |
Compaction is non-fatal — failures never crash the agent loop. Sessions continue with full history if compaction fails.
UI
Power Mode opens as a dedicated auxiliary window with:
- Dark theme terminal-style interface
>prompt for input- Tool call rendering (amber
#e0a84efor tool names) - Streaming output with real-time progress
- Abort button to stop execution mid-flow
Contributing
Key files:
powerMode/browser/powerModePart.ts— window UIpowerMode/browser/tools/allTools.ts— tool registrypowerMode/browser/session/systemPrompt.ts— prompt constructionpowerMode/browser/powerBusService.ts— real-time communication buspowerMode/browser/session/compaction/— session compaction engine