Feature Request: Built-in Git Support for Subagents

Resolved 💬 3 comments Opened Jul 27, 2025 by sergekostenchuk Closed Aug 19, 2025

Feature Request: Built-in Git Support for Subagents

Summary

Add automatic Git integration for subagents based on their roles and permissions.

Problem

Currently, when using subagents through the Task tool, there's no built-in way to ensure they follow Git best practices. Users need to manually add Git instructions to each task prompt, which is repetitive and error-prone.

Proposed Solution

Implement automatic Git behavior for subagents based on their type:

1. Agent Git Permission Levels

Full Git Access (auto-commit after tasks):

  • coder - commits with feat: prefix
  • refactorer - commits with refactor: prefix
  • debugger - commits with fix: prefix
  • tester - commits with test: prefix
  • deployer, project-manager - commits with chore: prefix

Limited Git Access (docs/config only):

  • architect, documenter, teacher - can only commit documentation
  • requirements-engineer, quality-controller - read + doc commits only

Read-Only Git Access:

  • planner, analyst, investigator, security - can only view git status/log

No Git Access:

  • designer, concept-creator, research agents, prompt agents

2. Implementation Ideas

# Option 1: Add git_mode parameter
Task(
    description="Fix authentication bug",
    prompt="Fix the login issue in auth.js",
    subagent_type="debugger",
    git_mode="auto"  # auto/manual/disabled
)

# Option 2: Global configuration
claude_config = {
    "subagents": {
        "git_integration": True,
        "auto_commit": True,
        "commit_format": "conventional"  # conventional/simple/custom
    }
}

# Option 3: Per-agent Git behavior in agent definitions
AGENT_DEFINITIONS = {
    "coder": {
        "git": {
            "access": "full",
            "auto_init": True,
            "auto_commit": True,
            "commit_prefix": "feat"
        }
    }
}

3. Expected Behavior

When Git integration is enabled:

  1. Before task: Agent checks git status and initializes repo if needed
  2. After task: Agent automatically creates appropriate commit
  3. Never: Agent never pushes without explicit user request
  4. Safety: Agent checks .gitignore and never commits secrets

4. Benefits

  • Consistency: All agents follow same Git practices
  • Safety: Prevents accidental commits of sensitive data
  • Automation: Reduces manual Git commands
  • Traceability: Every agent action is tracked in Git history
  • Education: Helps users learn Git best practices

5. Configuration Example

// .claude/settings.json
{
  "subagents": {
    "git": {
      "enabled": true,
      "auto_commit": true,
      "commit_rules": {
        "coder": "feat: {task_description}",
        "debugger": "fix: {task_description}",
        "refactorer": "refactor: {task_description}"
      },
      "ignore_patterns": [
        ".env",
        "*.secret",
        "node_modules/"
      ]
    }
  }
}

Use Cases

  1. Team Development: Ensure consistent Git history across team members
  2. Learning: Help beginners follow Git best practices automatically
  3. Audit Trail: Track all code changes by different agents
  4. CI/CD Integration: Clean commit history for automated workflows

Additional Considerations

  • Add --no-git flag to disable Git for specific tasks
  • Provide Git commit message templates per agent type
  • Option to review commits before they're created
  • Integration with Git hooks for additional validation

This feature would significantly improve the development workflow and ensure professional Git practices are followed automatically.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗