AI Commit
Generate Git commit messages from VS Code's Source Control view with the Claude Code CLI (claude) or the Codex CLI (codex) instead of Copilot. It uses the CLIs you're already signed in to, so there's no API key to configure.
What it does
- Reads the staged diff. If nothing is staged, it uses all working-tree changes; set
aiCommit.changes to staged to forbid that fallback.
- Adds context: the branch name, the last 10 commit subjects (so the message matches your style, e.g. Conventional Commits), and any text you already typed in the message box (as notes to refine).
- Pipes it on stdin to one of:
claude -p … --tools "": no tools, no MCP servers, user settings only, no saved session.
codex exec --sandbox read-only --ephemeral … -: read-only sandbox, no saved session.
- Cleans the output (code fences, "Here's your message:", quotes, AI co-author trailers) and puts it in the commit message box.
Lockfiles, minified files and source maps are left out of the diff (the files are still listed). Big diffs are trimmed fairly per file, so one huge file can't crowd out the rest.
Requirements
- VS Code 1.100+
- At least one CLI, installed and signed in. Run it once in a terminal to confirm.
claude: Claude Code
codex: Codex CLI
Install
Install it from the Visual Studio Marketplace: search for AI Commit in the Extensions view, or run:
code --install-extension pavankjadda.claude-codex-commit
The Marketplace version has everything except the optional sparkle inside the commit message box. That one needs the sideload build; see Sparkle inside the message box below.
Use
A ✨ sparkle appears in the Source Control title bar. It runs the CLI chosen in aiCommit.provider (default: Claude Code).
- While it runs, the button turns into ■ Cancel, and the status bar shows
Claude Code: writing commit message. Click either one to cancel.
- … menu → Generate Commit Message with Claude Code / Codex runs a specific CLI once.
- … menu → Select Default Commit Message CLI switches the default.
If Copilot's own sparkle is also in the title bar, right-click the title bar and untick it.
Sparkle inside the message box (sideload build only)
The ✨ inside the commit message box uses a VS Code menu (scm/inputBox) that is still a proposed API. The Marketplace doesn't accept extensions that use proposed APIs, so the Marketplace version leaves this button out. The toolbar button does the same job.
To get the in-box button anyway:
Build the sideload VSIX from source with pnpm run package (see CONTRIBUTING.md). It creates claude-codex-commit-<version>.vsix.
Extensions view → … → Install from VSIX… and pick that file. It replaces the Marketplace version, since both have the same extension ID.
Command Palette → Preferences: Configure Runtime Arguments (opens argv.json). Only Microsoft's own extensions get proposed APIs by default, so add the following, then fully quit and reopen VS Code:
"enable-proposed-api": ["pavankjadda.claude-codex-commit"]
The in-box button then becomes a dropdown: Generate with Claude Code, Generate with Codex and Copilot's entry if installed. VS Code makes whichever you used last the primary button, so after one click Claude Code (or Codex) is the sparkle. The stop button in the box cancels.
Without the argv.json entry the sideload build works like the Marketplace version. VS Code just logs that AI Commit can't use the scm/inputBox menu and skips that one entry.
To remove Copilot's AI features entirely, set "chat.disableAIFeatures": true.
Regenerating
Click again to get a new message. AI Commit remembers the message it wrote, so it isn't fed back as your notes. Edit the text first if you want your edits treated as guidance.
Settings
| Setting |
Default |
What it does |
aiCommit.provider |
claude |
CLI used by the toolbar button: claude or codex |
aiCommit.claude.path |
claude |
Path to the Claude Code CLI (use which claude output if it isn't found) |
aiCommit.claude.model |
sonnet |
--model value: haiku is faster, opus is slower; empty uses your CLI default |
aiCommit.claude.extraArgs |
[] |
Extra CLI arguments, e.g. ["--effort", "low"] |
aiCommit.codex.path |
codex |
Path to the Codex CLI |
aiCommit.codex.model |
(empty) |
--model value; empty uses ~/.codex/config.toml |
aiCommit.codex.reasoningEffort |
low |
model_reasoning_effort; low is plenty for commit messages |
aiCommit.codex.extraArgs |
[] |
Extra arguments for codex exec |
aiCommit.changes |
auto |
auto: staged changes, else all changes. staged: staged only |
aiCommit.instructions |
(empty) |
Your commit rules, e.g. Use Conventional Commits with a scope. Reference the Jira key from the branch name. |
aiCommit.excludePatterns |
lockfiles, *.min.*, *.map, *.snap |
Files whose diff content is left out |
aiCommit.maxDiffChars |
40000 |
Max diff characters sent |
aiCommit.recentCommits |
10 |
Recent subjects included for style; 0 disables |
aiCommit.useInputAsHint |
true |
Use text already in the box as notes to refine |
aiCommit.removeAiAttribution |
true |
Strip Co-Authored-By: Claude … / Claude-Session: / Generated with … trailers |
aiCommit.timeoutSeconds |
120 |
Kill the CLI after this long |
Team rules belong in the repo's .vscode/settings.json:
{ "aiCommit.instructions": "Conventional Commits. Scope = top-level module (api, web, infra). Body explains why." }
Security and privacy
- The diff goes to the model provider. It is sent to Anthropic (Claude Code) or OpenAI (Codex) under your CLI's account. Don't use it on repos whose contents may not leave your machine, or exclude sensitive paths with
aiCommit.excludePatterns.
- The CLIs never run inside your repository. They run in a private, empty folder in VS Code's extension storage. A cloned repo's
.claude/settings.json (hooks, env), CLAUDE.md, AGENTS.md or planted executables can't affect them. Claude also gets --setting-sources user.
- No tools. Claude runs with all tools disabled and no MCP servers. Codex runs in its read-only sandbox.
- Workspace settings can't change what runs.
*.path and *.extraArgs are machine-scoped, so a repo's .vscode/settings.json can't change the executable or add flags. Model names are validated.
- Repo instructions can only shape style. The safety rules come last in the prompt, after all repo-controlled text.
- Nothing sensitive is logged. The output channel (AI Commit: Show Log) records the command, sizes and timings, never the diff or prompt. CLI error output is scrubbed of any echoed prompt.
- Untrusted workspaces: the extension is disabled there.
Troubleshooting
- "Couldn't run
claude": VS Code didn't find the CLI on its PATH. Set aiCommit.claude.path to the output of which claude. Same for Codex.
- "exit code 1 … not logged in": run
claude (or codex) once in a terminal and sign in.
- Slow: use
aiCommit.claude.model: "haiku", or aiCommit.codex.reasoningEffort: "low".
- Details: Command Palette → AI Commit: Show Log.
Contributing
Building from source, running the tests and publishing releases are covered in CONTRIBUTING.md. Report bugs and request features in GitHub Issues.