Documentation How the Claude Code Agent works

How the Claude Code Agent works

The Claude Code Agent is not an autocomplete tool. It starts from a map of your whole project and reads the files it needs before writing code.

Context building

Before your message reaches the agent, CloudCode attaches a context packet: your project file tree, installed dependencies, recent console errors from the preview, project memory and the session changelog, plus the contents of any files you attach. With auto-context on, key config files (package.json, tsconfig.json, vite.config.ts, tailwind.config.ts, src/App.tsx, src/main.tsx, src/index.css) are attached too. Anything else the agent needs, it reads on demand with its file tools.

Tool calls, applied as they run

With Tools ON (the default), the agent works through tool calls — reading, searching, writing, patching and deleting files — and each change is saved to your project as soon as that tool runs. Edits made in a single batch are all-or-nothing: if one fails, the rest of that batch is rolled back. With Tools OFF, the agent replies with code blocks you apply yourself.

Multi-step reasoning

Each message runs a loop: the model calls tools, sees their results, and continues until it replies without calling a tool. Along the way it classifies your request, proposes a plan for multi-step work, and reports its reasoning, plan progress and confidence in the panel.

Model

Pick the model in the agent panel's model selector (custom agents can set their own override). Anthropic: Claude Opus 5.5 (most capable), Claude Sonnet 5.5 (the default) and Claude Haiku 5.5 (fastest) run on the Anthropic API. Gemini / OpenAI: Gemini 3.1 Pro, 3 Pro, 3 Flash, 2.5 Pro, 2.5 Flash and 2.5 Flash Lite, and GPT-5.2, GPT-5, GPT-5 mini and GPT-5 nano run through CloudCode's AI gateway. Every model gets the same tools and the same loop. Claude models use the Anthropic API key saved in Settings → API Keys & Integrations if you have one, otherwise CloudCode's own key; if a saved key is rejected, the run retries once on CloudCode's key. Your selection is remembered, and selections saved by older versions (such as claude-sonnet-4-20250514) map to the matching Claude 5.5 model.

Version history

Every update to an existing file — by the agent or by you — saves the previous content as a version (the last 50 per file are kept). Open a file's version history in the editor to restore one. Deleting a file does not create a version.

What the agent's tools cover
  • Files — read_file, parallel_read_files (up to 20), list_files, write_file, search_replace_file, multi_search_replace, partial_file_edit, batch_edit_files, delete_file
  • Search — search_files, regex_search_files, semantic_search, find_todos, get_related_files, dependency_graph
  • Refactoring — rename_symbol, manage_imports, extract_component, scaffold, smart_merge, find_and_replace_regex, detect_dead_code, detect_code_style
  • Project checks — run_typecheck, run_lint, analyze_build, detect_missing_imports, check_env_vars, install_package (edits package.json), generate_migration (writes a .sql file), test_endpoint
  • Memory — store_memory, recall_memories, summarize_file, bookmark_message, log_change, record_error, record_fix, get_error_history
  • Generation — figma_to_code, generate_storybook, import_api_spec, extract_i18n, add_analytics_tracking
Warning
The agent cannot run commands. Its terminal tool returns without executing anything, and run_typecheck, run_lint and analyze_build are quick heuristic scans — not tsc, ESLint or a real build. Check the preview, or run builds and tests yourself, before relying on a change.