Skip to content

[FEATURE]: Add includeGitInstructions config option to control git instruction injection in tool prompts #23014

Closed as not planned

Description

@ChungHwemo

Problem

OpenCode currently hardcodes git commit/PR workflow instructions (~1,300 tokens per turn) into the Bash tool's description template. These instructions are always injected with no way to disable them.

For users who:

  • Have their own git workflow instructions via plugins (e.g., oh-my-opencode's git-master skill)
  • Use custom AGENTS.md/CLAUDE.md rules for git behavior
  • Want to maximize context window for complex tasks

...these hardcoded instructions waste significant tokens every turn.

Measured token impact

Extracted from compiled binary (v1.4.7) and measured with tiktoken:

Section Tokens (cl100k_base) Chars
# Committing changes with git 806 3,702
# Creating pull requests 404 1,909
# Other common operations 4 24
Total 1,259 5,795

Cumulative cost (resent every turn):

Scenario Token waste Cost (Opus @ $15/M input)
50-turn session ~63K $0.94
10 sessions/day ~630K $9.44
Monthly (22 work days) ~13.8M $207.74

Claude Code comparison

Claude Code already implements this via:

  • Setting: includeGitInstructions: false in settings.json
  • Env var: CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1
  • Source: src/utils/gitSettings.ts → shouldIncludeGitInstructions()

When disabled, it removes the commit/PR instruction blocks from the Bash tool prompt and git status from system context.

Proposed Solution

Add an includeGitInstructions config option (default: true for backward compatibility):

{
  "$schema": "https://opencode.ai/config.json",
  "includeGitInstructions": false
}

And/or an environment variable:

OPENCODE_DISABLE_GIT_INSTRUCTIONS=1

Implementation hint

In the bash tool description builder, add a conditional check before including the git sections:

if (shouldIncludeGitInstructions()) {
  description += GIT_COMMIT_INSTRUCTIONS + GIT_PR_INSTRUCTIONS
}

Impact

  • Token savings: ~1,300 tokens per turn
  • Backward compatible: Default true preserves current behavior
  • Precedent: Claude Code already ships this feature

Environment

  • OpenCode version: 1.4.7
  • OS: macOS (Darwin, ARM64)
  • Using oh-my-opencode plugin with custom git workflow skills

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 17, 2026
  2. github-actions commented on Apr 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review that issue and consider whether your request adds something distinct (e.g., the explicit config toggle / env var approach vs. moving to system prompt). If so, it may be worth clarifying the difference.

  3. ChungHwemo commented on Apr 17, 2026

    @ChungHwemo
    Author

    Token measurement correction

    I ran actual measurements against the compiled binary (v1.4.7). The extracted git instructions (# Committing changes with git + # Creating pull requests + # Other common operations) are:

    Raw text

    • 5,795 characters / 987 words / 57 lines

    Token counts

    Tokenizer Tokens
    cl100k_base (GPT-4) 1,259
    o200k_base (GPT-4o) 1,261
    Claude estimate (~chars/3.8) ~1,525

    Per-section breakdown (cl100k_base)

    Section Tokens Chars
    # Committing changes with git 806 3,702
    # Creating pull requests 404 1,909
    # Other common operations 4 24

    Cumulative cost (these tokens are resent every turn)

    Scenario Token waste Cost (Opus @ $15/M input)
    1 turn ~1,259 $0.02
    50-turn session ~62,950 $0.94
    10 sessions/day ~629,500 $9.44
    Monthly (22 work days) ~13.8M $207.74

    Correcting my original estimate: it's ~1,300 tokens/turn, not ~3,000+. Still significant over time.

    Methodology

    # Extract from compiled binary
    strings .opencode | grep -A 200 "# Committing changes with git" > git-instructions.txt
    # Clean to only instruction text (57 lines)
    # Count with tiktoken (cl100k_base, o200k_base)
  4. assigned and unassigned on Apr 26, 2026
  5. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions