Skip to content

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.

Ask modeAgent mode
PurposeConversational Q&AAutonomous task execution
Side effectsNone — read-onlyReads/writes files, runs commands, browses
ToolsNone (pure LLM)27+ built-in + MCP
SubagentsNot available9 specialists
EngineDirect provider streamingdeepagents pipeline (LangGraph)
MemoryChat history only (session)Chat history + persistent core memories
CostLower (one LLM call per turn)Higher (multi-step reasoning + tool calls)
LatencyFasterVaries — simple tasks fast, complex tasks longer
Context enhancementRAG (vector DB + files)RAG + tool-based code retrieval

Read-only. Cannot modify files, run commands, or reach external services.

graph TB A[User message] --> B[Context enhancement<br/>vector DB + active file + @-mentions] B --> C[Provider LLM<br/>streaming] C --> D[Streamed response]

Flow:

  1. ContextEnhancementService enriches the message with vector-DB results, active file, and any @-mentioned files.
  2. Sent directly to the configured LLM provider.
  3. Response streams back token by token.
  4. 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.

Full deepagents pipeline — LangGraph agent loop, tool use, subagent delegation, autonomous execution.

graph TB A[User message] --> B[CodeBuddyAgentService<br/>session + safety guard + cost] B --> C[Developer Agent<br/>createDeepAgent] C --> D[Tool calls<br/>file ops · terminal · search · debug · browser] C --> E[Subagent delegation<br/>task tool] C --> F[Memory + docs store] C --> G[MCP tools] D --> H[Streamed response + applied changes] E --> H F --> H G --> H

Flow:

  1. Message wrapped with session metadata → CodeBuddyAgentService.
  2. Service constructs/reuses the DeveloperAgent (createDeepAgent() from deepagents) with the full middleware stack.
  3. deepagents runs the agent loop: reasoning → tool calls → subagent delegation → planning (via built-in todoList, filesystem, subAgent middleware).
  4. Real-time events (TOOL_START, TOOL_END, THINKING, PLANNING, TERMINAL_OUTPUT) drive the chat panel UI.
  5. Message + response persisted to session history.

Capabilities in Agent mode:

AreaWhat
File opsRead, write, edit, list, compose (atomic multi-file)
TerminalModal-approved shell commands, persistent sessions, test runners
SearchRipgrep, symbol search, vector DB, web (Tavily)
DebugFull DAP — state, stack, variables, evaluate, control
BrowserPlaywright with SSRF + DNS-rebinding guards
SubagentsDelegate to 8 specialists + general-purpose
MemoryRead/write manage_core_memory + cross-session /docs/ store

Safety controls layered on top:

ControlDefaultSetting
Auto-approve actionsOffcodebuddy.autoApprove
Allow file editsOncodebuddy.allowFileEdits
Allow terminalOncodebuddy.allowTerminal
Diff approvalOffcodebuddy.requireDiffApproval
Permission profilestandardcodebuddy.permissionScope.defaultProfile
Max tool calls2000codebuddy.agent.maxToolInvocations
Max events15000codebuddy.agent.maxEventCount
Max duration60 mincodebuddy.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.

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.

  • 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.md injected in both.
  • Architecture — how the Agent pipeline is built
  • Subagents — the 9 specialists available in Agent mode
  • Tools — full tool list
  • Security — permission profiles + safety controls