Skip to content

Agent Commits

At the end of each agent turn, Cosine CLI can automatically create an Agent Commit — a lightweight git commit that captures exactly the files the agent edited. This gives you a per-turn undo history for agent changes without sweeping in unrelated work.

Agent Commits are not limited to Auto mode. If Agent Commits are enabled, Cosine is running inside a git repository, and the agent edited files during the turn, a commit is created when that turn completes. In Plan mode, the agent does not modify files, so there is normally nothing to commit.

  1. As the agent edits files, each change is recorded internally.
  2. When the agent finishes its turn, a commit is created containing only those edits.
  3. The commit message is AI-generated from the conversation context, with a fallback commit name if needed.
  4. A Commit marker appears in the timeline with the file summary and diff stats:
──── Commit · 3 files: app/page.tsx, lib/auth.ts, +1 more · +82 -14 ────

Each commit includes a Co-Authored-By: Cosine CLI (<model>) <agent@cosine.sh> trailer so Agent Commits are easy to identify in your git log.

  • Press Ctrl+G to open the Git view.
  • In the Commits panel, select the commit you want to inspect.
  • The lower diff pane shows the full diff for the selected commit.
  • In the timeline, you can also click the files segment or the diff stats segment on a Commit marker to jump straight into that commit’s diff view.

The Files panel in the Git view includes files from commit history and any current unstaged files. Unstaged files are labeled unstaged.

Agent Commits can be reverted to restore files to their state before the agent’s changes, and reapplied later if needed. The patch files are stored alongside the session data for recovery.

If you don’t want the agent to create Agent Commits, you can disable them per session:

Terminal window
cos start --enable-agent-commits=false

Or globally in your config file:

[config]
agent_commits = false
  • Timeline — Commit markers appear in the conversation timeline
  • Configuration — Configure defaults for CLI behavior
  • Flags — Override Agent Commits per session