Ask & Agent Modes
Two modes, pickable via the mode pill at the bottom of the chat panel. They share providers, chat history, project rules, and cost tracking; they differ in what happens after the message hits the extension.
Side-by-side
Section titled “Side-by-side”| Ask mode | Agent mode | |
|---|---|---|
| Purpose | Conversational Q&A | Autonomous task execution |
| Side effects | None — read-only | Reads/writes files, runs commands, browses |
| Tools | None (pure LLM) | 27+ built-in + MCP |
| Subagents | Not available | 9 specialists |
| Engine | Direct provider streaming | deepagents pipeline (LangGraph) |
| Memory | Chat history only (session) | Chat history + persistent core memories |
| Cost | Lower (one LLM call per turn) | Higher (multi-step reasoning + tool calls) |
| Latency | Faster | Varies — simple tasks fast, complex tasks longer |
| Context enhancement | RAG (vector DB + files) | RAG + tool-based code retrieval |
Ask mode
Section titled “Ask mode”Read-only. Cannot modify files, run commands, or reach external services.
Flow:
ContextEnhancementServiceenriches the message with vector-DB results, active file, and any@-mentioned files.- Sent directly to the configured LLM provider.
- Response streams back token by token.
- Persisted to session chat history.
When to reach for it: quick questions, code snippets, error explanations, code-review feedback without applying, learning/exploration.
Chat-history compaction runs the same 5-tier strategy as agent mode (see Self-healing L4) — token budget from codebuddy.contextWindow.
Agent mode
Section titled “Agent mode”Full deepagents pipeline — LangGraph agent loop, tool use, subagent delegation, autonomous execution.
Flow:
- Message wrapped with session metadata →
CodeBuddyAgentService. - Service constructs/reuses the
DeveloperAgent(createDeepAgent()from deepagents) with the full middleware stack. - deepagents runs the agent loop: reasoning → tool calls → subagent delegation → planning (via built-in
todoList,filesystem,subAgentmiddleware). - Real-time events (
TOOL_START,TOOL_END,THINKING,PLANNING,TERMINAL_OUTPUT) drive the chat panel UI. - Message + response persisted to session history.
Capabilities in Agent mode:
| Area | What |
|---|---|
| File ops | Read, write, edit, list, compose (atomic multi-file) |
| Terminal | Modal-approved shell commands, persistent sessions, test runners |
| Search | Ripgrep, symbol search, vector DB, web (Tavily) |
| Debug | Full DAP — state, stack, variables, evaluate, control |
| Browser | Playwright with SSRF + DNS-rebinding guards |
| Subagents | Delegate to 8 specialists + general-purpose |
| Memory | Read/write manage_core_memory + cross-session /docs/ store |
Safety controls layered on top:
| Control | Default | Setting |
|---|---|---|
| Auto-approve actions | Off | codebuddy.autoApprove |
| Allow file edits | On | codebuddy.allowFileEdits |
| Allow terminal | On | codebuddy.allowTerminal |
| Diff approval | Off | codebuddy.requireDiffApproval |
| Permission profile | standard | codebuddy.permissionScope.defaultProfile |
| Max tool calls | 2000 | codebuddy.agent.maxToolInvocations |
| Max events | 15000 | codebuddy.agent.maxEventCount |
| Max duration | 60 min | codebuddy.agent.maxDurationMinutes |
With auto-approve off, the agent pauses before every tool call for user confirmation — full visibility into intent before action.
When to reach for it: feature implementation across files, refactoring, debugging with breakpoints, running tests, project-wide search-and-replace, infra/CI setup.
Switching
Section titled “Switching”In the chat panel: click the mode pill (bolt = Agent, chat bubble = Ask).
In settings: codebuddy.codeBuddyMode dropdown (Agent / Plan / Ask, default Agent) for the default mode.
Programmatically: the message carries metaData.mode. "Agent" routes through LangGraph; anything else goes to direct provider streaming.
What both modes share
Section titled “What both modes share”- All 9 providers work in both.
- Provider failover in both.
- Chat history persistence in both.
- Vector-DB indexing + RAG in both.
- Cost tracking in both.
- Project rules from
.codebuddy/rules.mdinjected in both.
Related
Section titled “Related”- Architecture — how the Agent pipeline is built
- Subagents — the 9 specialists available in Agent mode
- Tools — full tool list
- Security — permission profiles + safety controls