Skip to content

How the agent works

Cosine is an AI software engineering agent that plans, writes, tests, and submits code by interacting with your existing repositories and tools.

When you give Cosine a task, it follows a loop of reasoning, tool use, and response:

  1. Read context — Cosine reads files, searches the codebase, and consults memory to understand the current state.
  2. Plan — For larger or ambiguous tasks, Cosine may pause to propose a plan before making changes.
  3. Act — Cosine edits files, runs terminal commands, uses MCP tools, or delegates to subagents.
  4. Validate — Cosine checks its work by running tests, reviewing diffs, or asking for your confirmation.
  5. Respond — Cosine reports back with a summary, asks clarifying questions, or asks for your approval before continuing.

Cosine has access to a set of tools depending on the surface and configuration:

  • File system — Read, write, search, and navigate your codebase
  • Terminal — Run shell commands in the task environment
  • LSP — Go-to-definition, find references, diagnostics
  • Browser — Navigate, screenshot, and extract data from web pages
  • MCP — Connect to external tools and APIs via Model Context Protocol servers
  • Git — Create commits, branches, and pull requests
  • Memory — Save and recall project conventions and user preferences

Cosine operates in multiple surfaces, each optimized for different workflows:

  • Cloud — Browser-based workspace for reviewing, planning, and managing tasks
  • CLI — Terminal user interface for local development and fast iteration
  • Desktop — Native app combining local file access with a visual workspace

Each surface shares the same agent core but exposes different controls and workflows. See Ways to use Cosine for a comparison.

Cosine reads personal configuration and runtime overrides in this order:

  1. Command-line flags — Highest priority, per-session overrides
  2. Personal profileconfig.toml or the selected config.<name>.toml in the platform-specific Cosine config directory
  3. Build and code defaults — Built-in distribution defaults

Explicit runtime flags override the selected personal profile. The legacy repository files cosine.toml and .cosine.toml are deprecated and retained only for existing project-automation features such as hooks, LSP settings, extra context, and project skills. They do not select profiles, credentials, inference endpoints, or models.