Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>OpenCode Commit MessageNew to Visual Studio Code? Get it now.
OpenCode Commit Message

OpenCode Commit Message

DevVN

|
3 installs
| (0) | Free
Generate a single-line Conventional Commit message with OpenCode, straight from the Source Control input box.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

OpenCode Commit Message

Adds a sparkle button to the Source Control commit message box (and to the Source Control title bar) that generates the message with freebuff first and OpenCode as fallback — instead of the built-in Copilot provider.

The extension only fills the message box. It never stages, commits or pushes.

How it works

  1. Reads the staged diff; if nothing is staged it falls back to the working tree diff (configurable with opencodeCommit.stagedOnly).

  2. Loads the git-commit-best-practice skill and the Git/language part of the coding rules (see Commit skill & rules).

  3. Tries the configured chain and stops at the first answer: freebuff (when enabled) → primary OpenCode model → fallback model.

  4. freebuff has no headless mode, so a small Python driver (freebuff_driver.py) opens a pseudo terminal, pastes the prompt, presses Enter and reads the answer from freebuff's own transcript. See The freebuff leg.

  5. OpenCode is called with the diff written to a temporary file:

    opencode run --format json --file <diff> --model <model> --agent commit "<prompt>"
    
  6. Parses the answer, strips code fences and markers, and puts the result in the commit message box. If the box already has text it asks before replacing.

Every run creates a new OpenCode session and a new freebuff chat, so the commit prompt never pollutes your normal chat history.

The freebuff leg

freebuff is a full-screen TUI and has no --print, --headless or API mode. It is driven in the background through a pseudo terminal, and one run consumes one hour of its daily free allowance (roughly 5 runs per day). Measured end-to-end through this extension: about 16 s for a 370-line diff, with clean output and no leftover process.

What the driver does:

  1. Starts freebuff --cwd <repository root> on a fresh PTY.
  2. Waits for Enter a coding task, waits 2.5 s for the UI to settle, pastes the prompt (bracketed paste), waits 1.5 s, then sends Enter. An earlier Enter is silently ignored by the TUI.
  3. Polls ~/.config/manicode/projects/<basename(cwd)>/chats/*/chat-messages.json for a new complete assistant message.
  4. Kills the whole process group as soon as the answer is complete.

The model is asked to wrap the message in <<<COMMIT / COMMIT>>>. freebuff sometimes leaks its reasoning before the message; the extension takes the last marked block, or the last Conventional Commit line when the markers are missing.

When freebuff fails or runs out of hours the extension logs it and continues with OpenCode, so the button always works. An out-of-hours failure stores freebuffCooldown for 24 h; the login status lives in freebuff's own config, so opencode/auth is not involved.

Privacy and cost notes:

  • The diff is pasted into the freebuff session and sent to its service.
  • freebuff shows ads in its UI and reports the remaining hours in the session.
  • Turn opencodeCommit.freebuff off to save the allowance and go straight to OpenCode.

Commit skill & rules

Both prompts (freebuff and OpenCode) start with the same compact guidance block:

  1. git-commit-best-practice skill — Conventional Commits format, 72-character imperative subject, optional scope, breaking-change footer, why-not-what body, English only, and the "text only, no git commands" rule. YAML frontmatter is stripped before injection.
  2. Coding rules — only the Git/commit/language lines are read from Coding Rule.instructions.md (about 500 tokens). The other 10 KB of rules are not sent; they are irrelevant to a commit message.

The block is about 2.2 KB (~550 tokens). Set commitSkillFile or rulesFile to an empty string to disable either part. A missing file is logged and skipped; generation still works.

Speed

freebuff is the slow leg: about 16 s, because it plays an interactive session. OpenCode answers in 1.2–1.7 s with a flash-lite model, so disabling freebuff is the fast path. The order is free-first by design: freebuff costs no money, only one hour of its daily allowance.

For OpenCode, two things dominate the runtime:

  1. The agent. OpenCode's default build agent ships a full coding system prompt with tool definitions, which is several thousand input tokens per call. The bundled commit agent (~/.config/opencode/agents/commit.md) has no tools at all, so the request is much smaller. If the agent file is missing the extension silently falls back to the default agent.

  2. The model. Measured with the same small diff and prompt, commit agent, Google provider (13 models):

    Model Time Input tokens
    google/gemini-3.5-flash-lite 1.1 s 631
    google/gemini-flash-lite-latest 1.6 s 627
    google/gemini-3.1-flash-lite 1.6 s 631
    google/gemini-4-hydrogen 5.6 s 662
    google/gemini-3.5-flash 6.0 s 628
    google/gemini-flash-latest 6.6 s 623
    google/gemini-3.8-flash 6.8 s 628
    google/gemini-3.6-flash 7.2 s 628
    google/gemini-3.7-flash 8.0 s 628
    google/gemini-4-argon 8.4 s 662
    google/gemini-4-carbon 9.6 s 662
    google/gemma-4-31b-it 12.2 s 632
    google/gemma-4-26b-a4b-it 20.7 s 639

    The three flash-lite models stay at 0.8–1.6 s on both a 10-line diff and a 370-line diff. End-to-end through the extension (login shell + CLI boot included) with gemini-3.5-flash-lite + commit: about 1.7 s.

    The opencode/*-free models share an account quota and can return FreeUsageLimitError with a retryAfterMs (about 20 h). They are used first when available; when they run out the extension automatically switches to the configured fallback model, so a quota error never blocks the button.

Use OpenCode: Select Commit Model from the Command Palette to pick the primary and fallback models from opencode models without editing settings by hand. The list has two steps: choose Primary model or Fallback model, then pick the model.

Models and fallback

The chain is freebuff (optional) → opencodeCommit.model → opencodeCommit.fallbackModel. freebuff is skipped when opencodeCommit.freebuff is off or its cooldown is active. A switch between OpenCode models happens only for availability problems — free/usage limit, rate limit, quota, HTTP 429, unknown or removed model. A malformed diff or a broken binary is reported as an error instead of silently trying another model.

When a model is out of quota the extension stores its retryAfterMs and skips it until the cooldown expires, so the next click goes straight to the fallback instead of waiting for the same error again. The state lives in the extension's global storage (modelCooldown) and survives window reloads. Once the cooldown expires the primary model is tried again automatically.

The status bar shows which model produced the message:

OpenCode: commit message ready in 1.3 s (google/gemini-3.5-flash-lite)

Where the time goes

OpenCode: Show Log prints one line per phase:

start: chain=freebuff → opencode/hy4-flash-free freebuff=freebuff fallback=google/gemini-3.5-flash-lite agent=commit timeout=60s
guidance ready: 2212 chars (skill=true, rules=true)
git diff: 0.1s {"chars":12345,"files":2,"lines":210} staged=false
skipped 1 noise file(s): package-lock.json
diff sent: {"chars":812,"files":1,"lines":32}
freebuff: driving TUI
freebuff: answer after 16.0s
freebuff: 16.1s total, used freebuff
total: 16.2s

When freebuff fails or is on cooldown, the OpenCode lines follow:

freebuff failed: freebuff exited (code 127) without a commit message
run: model=opencode/hy4-flash-free agent=commit
run failed: Free usage limit reached. Connect a provider or subscribe to OpenCode Go to keep going, or switch models.
run: model=google/gemini-3.5-flash-lite agent=commit
opencode: 1.5s total, 1.1s model, 662 in / 48 out tokens, used google/gemini-3.5-flash-lite
opencode/hy4-flash-free on cooldown until 2026-11-18T06:59:00.000Z
total: 17.6s
  • freebuff — the TUI wait, not the model, is most of the time. freebuff itself usually finishes in 9–12 s; the driver waits for the UI and the transcript to become readable.
  • git diff — the VS Code Git API. Large repositories with many changed files can spend a second here.
  • opencode total vs model — the difference is CLI boot and session setup, roughly 0.1 s. Almost all of the time is the model call itself.
  • input tokens — diffuse lockfiles and build output: 192 323 chars became 111 789 input tokens and 2.5 s. With skipNoiseFiles the same change is 662 tokens and 1.2 s, and the message no longer mentions the lockfile.

If the log shows model=OpenCode default model after changing the setting, the window has not been reloaded yet.

Settings

Setting Default Meaning
opencodeCommit.command ~/.opencode/bin/opencode OpenCode binary.
opencodeCommit.model empty provider/model tried first; empty uses the OpenCode default.
opencodeCommit.fallbackModel empty provider/model used when the primary is rate limited, out of quota or unavailable.
opencodeCommit.agent commit Agent used for the message; ignored when its file is missing.
opencodeCommit.freebuff true Try freebuff before OpenCode. One run uses one hour of the daily free allowance.
opencodeCommit.freebuffCommand freebuff freebuff binary or command name, resolved through the login shell.
opencodeCommit.freebuffTimeoutSeconds 180 Give up on freebuff and continue with OpenCode after this time.
opencodeCommit.freebuffMaxDiffCharacters 24000 Diff truncation for the freebuff paste. Large pastes slow the TUI down.
opencodeCommit.commitSkillFile ~/.gemini/config/skills/git-commit-best-practice/SKILL.md Commit best-practice skill injected into both prompts. Empty disables it.
opencodeCommit.rulesFile ~/.copilot/instructions/Coding Rule.instructions.md Coding rules file; only Git/commit/language lines are used. Empty disables it.
opencodeCommit.instructions [] Extra rules appended to the prompt.
opencodeCommit.maxDiffCharacters 120000 Diff truncation limit.
opencodeCommit.skipNoiseFiles true Drop lockfiles, minified bundles, maps and dependency output from the diff.
opencodeCommit.timeoutSeconds 60 Abort when OpenCode produces no result within this time.
opencodeCommit.stagedOnly false Only use the staged diff.

Troubleshooting

  • Log stops after diff sent. The opencode child process is waiting for stdin EOF. Fixed in 0.3.1 by closing the child's stdin; if it ever comes back, the request is also capped by opencodeCommit.timeoutSeconds.
  • model=OpenCode default model in the log. The setting is not picked up yet — reload the window.
  • provider.free-limit / Free usage limit reached. The shared opencode/*-free quota is exhausted. With a fallback configured this is handled automatically; without one, pick a Google model, e.g. google/gemini-3.5-flash-lite.
  • It keeps skipping the free model. That is the stored cooldown. It expires on its own; opencode/auth is not involved. Delete the modelCooldown key from the extension's global state to clear it early.
  • freebuff skipped (cooldown) in the log. freebuff ran out of daily hours or hit a limit on a previous run. The cooldown lasts 24 h. Delete freebuffCooldown from global state or wait for it to expire.
  • freebuff could not start / code 127. freebuff is not found in your login shell PATH. Ensure which freebuff works in your terminal or specify the full path in opencodeCommit.freebuffCommand.
  • freebuff hangs or times out. The driver waits up to freebuffTimeoutSeconds (default 180s). If the freebuff TUI changes or gets stuck on an update prompt, it automatically falls back to OpenCode.

Notes

  • The commands are executed through /bin/zsh -lc, so a login shell PATH is used; binaries installed through nvm, homebrew or ~/.opencode/bin are found even when the extension host has no PATH of its own.
  • freebuff requires Python 3 (python3) on macOS/Linux to run its PTY driver (freebuff_driver.py).
  • In a Remote SSH window the extension runs on the remote host, so OpenCode and freebuff must be installed there too.

Publish notes

  • Publisher: DevVN; extension id: devvn.opencode-commit.
  • Commit messages are a single Conventional Commit line (no body/bullets).
  • Best-practice skill and coding rules are bundled under assets/ so a fresh machine works without extra config files.
  • opencodeCommit.freebuff defaults to false (fast opencode → Google chain).
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft