Core Concepts
ON THIS PAGE
- Tokens and Token Management
- Rules
- Skills
- Loops
- Prompt, Context, and Harness Engineering
- The AI Coding Harness Landscape
- IDE-Native Agents
- Terminal-Native Agents
- Cloud-Sandboxed Agents
- Enterprise Intelligence Layers
- VS Code Extension Agents
- Harness Comparison Table
- Our Recommendation
- Agentic Workflows & Gates
Before deploying AI agents effectively, teams need a shared vocabulary. These are not academic definitions—they are operational concepts that directly determine whether your agent runs cost you $0.50 or $50, whether your agent hallucinates or follows your architecture, and whether your team adopts AI workflows or abandons them after a frustrating week. Every concept below maps to a concrete decision you will make when setting up your first agent-augmented project.
Tokens and Token Management #
A token is a chunk of text—roughly three-quarters of a word in English—that an AI model processes as a single unit. Models do not read characters or words; they read tokens. The number "123456" might be one or two tokens, while the word "internationalization" is typically three or four.
The context window is the model's total working memory for a single conversation. Think of it as a whiteboard with a hard size limit: everything the model needs to reason about—your system prompt, tool definitions, file contents, conversation history, and its own generated output—must fit on that whiteboard simultaneously. As of mid-2026, frontier context windows range from 128K tokens (Claude Sonnet) to 2M tokens (Gemini 3.5 Pro), but bigger is not automatically better. A model reasoning over 500K tokens of loosely relevant code will produce worse results than the same model reasoning over 20K tokens of precisely relevant context. This is the "needle in a haystack" problem: critical instructions buried in a sea of boilerplate get overlooked, misinterpreted, or outright ignored.
Token management is the discipline of keeping only essential information in the context window at any given time. Practical strategies include: structuring repositories so agents can load individual modules rather than entire codebases, using skills that load on-demand rather than persisting in every prompt, writing concise rules files rather than exhaustive novels, and breaking large tasks into focused subtasks that each operate within a manageable context scope.
Underneath sits the KV cache (Key-Value cache), a performance optimization that has significant cost implications. When the beginning of a prompt remains identical across requests—system rules, tool definitions, and project context that do not change between turns—the model reuses precomputed attention values rather than re-processing those tokens from scratch. This prompt caching can reduce latency by 50-80% and cut costs proportionally. In practice, this means structuring your system prompt and rules files so they remain static at the top, with dynamic content (user messages, file contents) appended below. Most commercial APIs (Anthropic, Google, OpenAI) now apply prompt caching automatically when they detect shared prefixes.
Rules #
Rules are persistent, repository-level instructions stored in configuration files that the agent reads at the start of every session. They establish the ground truth for how the agent should behave within your project—build commands, style conventions, architectural boundaries, prohibited actions, and testing requirements. Write them once, and every agent session automatically inherits your team's norms without repeated manual prompting.
The naming convention for rules files varies by harness:
| Harness | Rules File(s) | Format |
|---|---|---|
| Antigravity | AGENTS.md, .agents/skills/ | Markdown with YAML frontmatter |
| Claude Code | CLAUDE.md (root, nested, or ~/.claude/CLAUDE.md) | Free-form Markdown |
| Cursor | .cursor/rules/*.mdc | MDC files with glob-based activation |
| Windsurf | .windsurf/rules/ | Markdown rules |
| Copilot | .github/copilot-instructions.md | Markdown |
| Cline | .clinerules | Markdown |
| Aider | .aider.conf.yml, conventions files | YAML + Markdown |
Despite the naming differences, the principle is identical: tell the agent how your project works so it does not have to guess. A good rules file includes your build and test commands, your preferred code style and naming conventions, the technology stack and framework versions in use, files or directories the agent should never modify, and any domain-specific constraints that are not obvious from the code itself.
Skills #
Skills are modular, task-specific playbooks loaded into the agent's context only when a particular type of work is required. Rather than cramming every possible instruction into the main rules file—which would bloat the context window and dilute attention—skills act as on-demand expert checklists that keep the baseline context lightweight while ensuring consistent, repeatable execution quality for specialized tasks.
A security audit skill, for example, might include a checklist of OWASP Top 10 patterns to scan for, preferred static analysis tools, and a report template. A database migration skill might enforce additive-only schema changes, require rollback scripts, and mandate integration test coverage. The skill loads when the agent needs it and unloads when the task is complete.
The skills ecosystem has matured significantly in 2026. Platforms like skills.sh provide a searchable registry of community and vendor-published skills that can be installed with a single command (npx skills add <author>/<repo>@<skill-name>). Most modern harnesses (Antigravity, Claude Code, Cursor, Cline) support some form of skill or instruction-file loading, though the specific mechanisms and compatibility vary.
Loops #
An agentic loop is the continuous cycle of act → observe → adjust that distinguishes autonomous agents from single-shot chat responses. When you ask a traditional chatbot to "fix this bug," it generates one response and stops. When you ask an agent to fix a bug, it enters a loop: it reads the error, forms a hypothesis, edits the code, runs the tests, reads the new output, adjusts if tests still fail, and repeats until the acceptance criteria are met or it determines it needs human input.
The quality of this loop is what separates a productive agent session from an expensive token-burning spiral. Good loops have clear exit conditions (tests pass, linter is clean, build succeeds). Bad loops occur when the agent lacks sufficient context to diagnose the root cause and keeps applying superficial patches that fail in new ways. The primary defense against bad loops is providing agents with comprehensive test suites and explicit error reporting—topics covered in detail in Chapters 3 and 5.
Prompt, Context, and Harness Engineering #
These three layers of engineering determine how effectively an AI model performs in practice:
Prompt Engineering is the craft of writing clear, direct instructions for specific tasks. Good prompts are unambiguous, include concrete examples, specify the desired output format, and state constraints explicitly. Prompt engineering matters most for one-off interactions and for crafting the system-level instructions that shape an agent's baseline behavior.
Context Engineering is the broader discipline of dynamically assembling the right background information—code files, documentation, API schemas, conversation history, external data—and delivering it to the model at the right time. Techniques include Retrieval-Augmented Generation (RAG), where a retrieval system fetches relevant documents from a knowledge base before the model generates its response; repository mapping, where tools like Aider build compressed structural indexes of your codebase; and semantic search, where the harness indexes your project and retrieves only the files relevant to the current task. Context engineering is arguably more important than prompt engineering for agent workflows, because even a perfectly crafted prompt will produce poor results if the model lacks the right context to reason about.
Harness Engineering is the design of the execution environment wrapped around the model—the tools it can call (bash, file editing, browser, API requests), the permissions it holds, the safety boundaries it operates within, and the feedback loops that allow it to verify its own work. The harness is what transforms a language model from a text generator into an autonomous agent capable of modifying real systems. The standard protocol for connecting external tools and data sources to any model, regardless of vendor, is MCP (Model Context Protocol), which has become the de facto industry standard as of 2026 under the Linux Foundation's stewardship. With over 17,000 publicly listed MCP servers and approximately 97 million monthly SDK downloads, MCP provides a universal "USB-C for AI" that allows agents to connect to databases, APIs, cloud services, and development tools through a standardized interface.
The AI Coding Harness Landscape #
The harness—the specific tool environment wrapping the AI model—is arguably the most consequential choice an engineering team makes when adopting agent-augmented development. The underlying frontier models (Claude, Gemini, GPT) have largely converged in raw capability; what differentiates the developer experience is how each harness orchestrates context, manages tools, handles permissions, and integrates into existing workflows.
The landscape in mid-2026 has settled into four broad categories: IDE-native agents (embedded in your editor), terminal-native agents (command-line-first workflows), cloud-sandboxed agents (remote execution environments), and open-source/extensible frameworks (bring-your-own-model flexibility). Below is a comprehensive overview of the major options:
IDE-Native Agents #
Cursor is a forked VS Code editor rebuilt around AI-first development. Its standout features are Composer—a multi-file editing engine that operates within tight feedback loops—and Background Agents, which run asynchronously in cloud-hosted VMs to complete tasks while you work elsewhere. Cursor uses .cursor/rules/*.mdc files for project-specific configuration, supporting Project Rules (version-controlled), User Rules (global), and Team Rules (organization-enforced). Pricing follows a credit-based model: Free (limited), Pro ($20/month), Pro+ ($60/month), Ultra ($200/month), with team tiers at $40-$120/user/month.
Windsurf (originally Codeium, now owned by Cognition AI / Devin) centers around its Cascade agentic engine—an autonomous coding partner that performs multi-file edits, executes terminal commands, and navigates codebases independently. It runs its own proprietary SWE-1 model family optimized for software engineering workflows. Windsurf features a sophisticated memory and context engine: persistent Memories that store developer preferences across sessions, project-level Rules files, and deep workspace indexing. Pricing uses quota-based tiers: Free, Pro ($20/month), Teams ($40/user/month), Max ($200/month).
GitHub Copilot has evolved from autocomplete into an agent-native platform within VS Code. Its Agent Mode (GA as of June 2026) allows Copilot to analyze codebases, generate multi-step plans, edit files, run terminal commands, and iterate until tasks are complete. The Coding Agent feature takes this further—you assign GitHub Issues directly to Copilot, and it works asynchronously via GitHub Actions to research, implement, and open draft PRs. Pricing transitioned to a credit-based model on June 1, 2026: Free (2,000 completions/month), Pro ($10/user/month), Pro+ ($39), Max ($100), Business ($19), Enterprise ($39).
Antigravity IDE (Google DeepMind) is a VS Code-based environment designed around multi-agent orchestration. Its distinguishing features include dynamic subagent spawning (a primary agent autonomously creates specialized worker agents for subtasks), a built-in Chromium browser subagent for visual verification and testing, a Manager View for orchestrating parallel agents, and a mature skills ecosystem with project-scoped and global skill loading. Antigravity supports multiple models (Gemini 3.1 Pro default, with Claude Sonnet/Opus support) and provides artifact-based transparency—implementation plans, task lists, and verification screenshots rather than just raw tool calls.
Terminal-Native Agents #
Claude Code (Anthropic) is the terminal-first agent that popularized the CLAUDE.md convention. It excels at deep repository reasoning, supporting up to 1M token context windows, persistent memory, and structural dependency mapping. Claude Code supports multi-agent orchestration with subagent delegation, MCP integration, custom Hooks for shell-level lifecycle automation, and a headless mode (-p flag) for CI/CD integration. Pricing bundles with Anthropic subscriptions: Pro ($20/month), Max ($100-$200/month), with API pay-as-you-go starting from ~$1 per million tokens depending on model tier.
Gemini CLI / Antigravity CLI (Google) started as an Apache 2.0 open-source terminal agent and has transitioned into the Antigravity CLI as of June 2026. It brings the full Antigravity multi-agent capabilities to terminal users via a Go-based binary. Free usage is available via personal Google account authentication (1,000-1,500 requests/day), with pay-as-you-go API pricing for production use (Gemini 3.5 Flash: ~$1.50/$9.00 per 1M input/output tokens).
Aider is the premier open-source, git-native terminal agent. Its core philosophy treats Git as the fundamental primitive: every edit is automatically committed with an AI-generated message, and git revert provides instant rollback. Aider's repository mapping feature builds a compressed structural index of your entire codebase, allowing the model to understand cross-file dependencies without loading every file into context. It supports 15+ model providers (Anthropic, OpenAI, Google, Groq, local via Ollama) with mid-session model switching via the /model command. Aider is completely free and open-source (Apache 2.0), with costs limited to your chosen LLM provider's API rates.
Hermes (Nous Research) is an open-source agent designed for persistent, self-improving terminal workflows. When Hermes solves a problem successfully, it automatically creates and stores a reusable skill document, allowing it to handle similar tasks more efficiently over time. It features a built-in cron scheduler for unattended tasks, parallel sub-agents, multi-platform gateway support (Telegram, Discord, Slack, WhatsApp), and runs fully self-hosted with zero telemetry. It is model-agnostic, connecting to any OpenAI-compatible endpoint or local models via Ollama/vLLM. MIT-licensed and free.
Pi (pi.dev, created by Mario Zechner / Earendil) takes extreme minimalism as its design philosophy. The agent ships with just four core tools—read, write, edit, and bash—and one of the shortest system prompts in the industry (under 1,000 tokens). Everything else is opt-in via TypeScript extensions, skills, prompt templates, and themes. Pi deliberately omits built-in plan mode, sub-agents, and MCP support, trusting that users will add these capabilities through extensions when needed. It supports 15+ model providers and four runtime modes (Interactive TUI, Print/JSON, RPC, SDK). MIT-licensed and free.
Cloud-Sandboxed Agents #
OpenAI Codex operates as an autonomous agent within the ChatGPT ecosystem, executing tasks in isolated cloud sandbox environments preloaded with your repository. It is designed for parallel task execution—multiple engineering tasks running simultaneously—and is available via the ChatGPT web interface, a Rust-based CLI (@openai/codex), a VS Code extension, and desktop apps. Pricing bundles into ChatGPT subscriptions: Plus ($20/month), Pro ($100-$200/month), with Business and Enterprise tiers including team controls and SSO.
Enterprise Intelligence Layers #
AMP (Sourcegraph) positions itself as the enterprise-grade agentic coding tool backed by Sourcegraph's deep code graph. Its "Orbs" feature provides persistent remote environments where agents continue working on long-running tasks even after the developer disconnects. AMP utilizes sub-agents for dependency resolution, syntax checking, and test generation, and leverages Sourcegraph's SCIP-powered cross-repository indexing through MCP to provide agents with the same institutional knowledge as senior engineers. Pricing ranges from subscription-based individual tiers to enterprise plans ($16K+ annually for the full Sourcegraph platform).
VS Code Extension Agents #
Cline is the most popular open-source VS Code extension agent (Apache 2.0). It uses a Bring Your Own Key (BYOK) model—you connect your preferred API provider (Anthropic, OpenAI, Google, local models)—and provides native MCP support, a Plan/Act dual-mode system (plan without making changes, then execute with approval), and built-in cost tracking with configurable spend limits. Cline is free; costs are limited to your chosen LLM provider's rates. ClinePass offers a flat monthly subscription for users who prefer predictable billing.
Harness Comparison Table #
| Harness | Category | Open Source | MCP | Multi-Agent | Background Exec | Starting Price |
|---|---|---|---|---|---|---|
| Antigravity | IDE + CLI + SDK | No | Yes | Yes (native) | Yes | Free tier available |
| Claude Code | Terminal | No | Yes | Yes | Headless mode | $20/month (Pro) |
| Codex | Cloud Sandbox | CLI is OSS | Yes | Parallel tasks | Yes (cloud) | $20/month (Plus) |
| Cursor | IDE | No | Yes | Background agents | Yes (cloud VMs) | Free / $20/month |
| Windsurf | IDE | No | Yes | Cascade flows | Limited | Free / $20/month |
| Copilot | IDE Extension | No | Yes | Coding Agent | Yes (Actions) | Free / $10/month |
| AMP | IDE + Web | No | Yes | Sub-agents | Orbs (persistent) | Subscription |
| Cline | VS Code Ext | Yes (Apache 2.0) | Yes (native) | Plan/Act mode | No | Free (BYOK) |
| Aider | Terminal | Yes (Apache 2.0) | No | No | No | Free (BYOK) |
| Pi | Terminal | Yes (MIT) | Via extensions | Via extensions | No | Free (BYOK) |
| Hermes | Terminal | Yes (MIT) | No | Sub-agents | Cron scheduler | Free (self-hosted) |
Our Recommendation #
After extensive use across multiple production projects, we recommend Antigravity as the all-rounder harness for teams adopting AI-augmented development at scale. Its native multi-agent orchestration, built-in browser verification, mature skills ecosystem, and artifact-based transparency provide the most complete out-of-the-box experience for enterprise workflows. The planning mode and gate-aware execution patterns align directly with the four-gate protocol described in Chapter 7.
That said, every harness on this list is production-capable in 2026. Claude Code is the strongest choice for developers who prefer terminal-first workflows and need deep repository reasoning. Cursor provides the smoothest experience for developers who want AI capabilities without leaving their editor. Aider and Pi are excellent for teams that value open-source transparency, vendor independence, and minimal overhead. Cline is the best option for teams already invested in VS Code who want maximum model flexibility with cost transparency. The right choice depends on your team's existing toolchain, your comfort with terminal vs. GUI workflows, your budget constraints, and whether you need multi-agent orchestration or prefer a simpler single-agent loop.
The critical insight is this: the harness matters more than the model. A mediocre model in a well-configured harness with strong rules, good skills, and comprehensive test suites will outperform a frontier model in a poorly configured harness with no project context. Invest in harness engineering—it compounds.
Agentic Workflows & Gates #
Agents carry out real-world actions with side effects: editing source files, creating pull requests, running shell commands, triggering deployments, modifying databases. Unlike a chatbot that merely generates text, an agent's output has consequences that are difficult or impossible to reverse. A misplaced DROP TABLE, an unreviewed merge to main, or a deployment pushed without canary validation can cause production outages.
To maintain safety and quality at scale, agentic workflows rely on gates—mandatory checkpoints where human engineers or automated review agents must inspect and approve progress before the workflow proceeds to the next stage. Gates are not bureaucratic friction; they are the safety mechanism that allows you to grant agents high autonomy within bounded stages while preventing unchecked cascading failures. The specific gate protocol used in this playbook is detailed in Chapter 7.