🐙 Git Assist Agent

SLM Git Repo Manager

Lightweight local Git utility that processes raw diff streams and formats standards-compliant Conventional Commit messages offline.

💻 Installation

Terminal
# Install in editable mode locally
pip install -e ./slm_git_repo_manager

# Set runtime thread performance
export SLM_GIT_REPO_MANAGER_N_THREADS=4

🐙 Checkout from GitHub

Clone only this agent's folder from the monorepo using Git sparse-checkout — no need to download the full repository:

Option 1 — Sparse Checkout (Recommended)

Terminal — Git Sparse Checkout
# 1. Create and enter a new directory
$ mkdir slm_git_repo_manager && cd slm_git_repo_manager

# 2. Initialise empty git repo and add remote
$ git init
$ git remote add origin https://github.com/t00114218-stack/SLMAgents.git

# 3. Enable sparse-checkout and set target folder
$ git sparse-checkout init --cone
$ git sparse-checkout set slm_git_repo_manager

# 4. Pull only that agent's source
$ git pull origin main

Option 2 — Full Repository Clone

Terminal — Full Clone
$ git clone https://github.com/t00114218-stack/SLMAgents.git
$ cd SLMAgents/slm_git_repo_manager

💡 Tip: After checkout, install the package locally with pip install -e ./slm_git_repo_manager to run in editable mode without publishing to PyPI.

⚙️ Configuration API

Constructor Parameters

ParameterType / DefaultDescription
model_pathstr | NoneExplicit path to the ONNX model directory. Defaults to caching/sharing the main model in the monorepo.
cache_dirstr | NoneHF model directory path. Also settable via SLM_GIT_REPO_MANAGER_CACHE_DIR.
n_ctxint | 2048Context window size in tokens. Also settable via SLM_GIT_REPO_MANAGER_N_CTX.
n_threadsint | 4CPU threads for ONNX Runtime. Also settable via SLM_GIT_REPO_MANAGER_N_THREADS.
system_promptstr | NoneOptional custom system prompt instructions overriding the default template.
user_inputstr | NoneOptional additional user-supplied target parameters or variables.

generate_commit_message() Parameters

ParameterType / DefaultDescription
diff_textstrRequired. The raw output of your git diff script sequence.
streambool | FalseIf True, enables token streaming of the model's Conventional Commit generation in real-time. Returns a Python generator.
system_promptstr | NoneOptional custom system prompt instructions overriding the default template.
user_inputstr | NoneOptional additional user-supplied target parameters or variables.
Python Quick Start
from slm_git_repo_manager.git_repo_manager import SLMGitRepoManager

copilot = SLMGitRepoManager()

diff_data = """diff --git a/slm_core/orchestrator.py b/slm_core/orchestrator.py
--- a/slm_core/orchestrator.py
+++ b/slm_core/orchestrator.py
@@ -12,5 +12,12 @@ class SLMOrchestrator:
-        print("Running orchestrator route...")
+        logger.info("Initializing query router path routing details")
-        return self.fallback_run(query)
+        route = self.classifier.predict(query)
+        if route == "rag":
+            return self.rag_agent.query(query)

diff --git a/tests/test_orchestrator.py b/tests/test_orchestrator.py
--- a/tests/test_orchestrator.py
+++ b/tests/test_orchestrator.py
@@ -2,4 +2,9 @@
-def test_orchestrator():
+def test_orchestrator_routing():
"""

msg = copilot.generate_commit_message(diff_data)
print(msg)
# Output:
# feat(slm_core): Implement classifier-based routing in SLMOrchestrator
# - Replace print statement with structured logger info
# - Add test_orchestrator_routing to verify query routing

Conventional Commit Standards

The Git Repo Manager forces structural formatting that aligns strictly with standard guidelines:

  • Formats: <type>(<scope>): <description> followed by optional description paragraphs.
  • Permitted Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.
  • Zero explanation output: Synthesizes only standard git message blocks without conversational prefaces.

🔀 Advanced Git Workflows

Git Repo Manager exposes advanced instance methods to automate local staging, commits, merges, and auto-conflict resolutions:

1. Automated Conventional Commit

Stages tracked changes, generates a message, and commits in a single line:

success, log_msg = copilot.commit()

2. Branch Merge and Conflict Resolution

Merges developer branches and automatically rewrites standard git conflict markers with combined resolutions from the local SLM model:

success, merge_status = copilot.merge("feature-branch")
if not success:
    resolution_results = copilot.resolve_conflicts()
    print("Resolved files:", resolution_results["resolved"])

🔌 VS Code Task Integration

You can run commit and conflict resolution workflows directly within your VS Code workspace using the task runner config. Add the following to your .vscode/tasks.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "SLM Git: Auto-Commit Changes",
      "type": "shell",
      "command": "python -c \"from slm_git_repo_manager.git_repo_manager import SLMGitRepoManager; print(SLMGitRepoManager().commit()[1])\"",
      "problemMatcher": []
    },
    {
      "label": "SLM Git: Resolve Merge Conflicts",
      "type": "shell",
      "command": "python -c \"from slm_git_repo_manager.git_repo_manager import SLMGitRepoManager; print(SLMGitRepoManager().resolve_conflicts())\"",
      "problemMatcher": []
    }
  ]
}

Run these tasks by triggering the Command Palette (Cmd+Shift+P or Ctrl+Shift+P), selecting Run Task, and choosing the desired Git helper task.

Context Truncation Safeguard

Raw git diff outputs can scale to tens of thousands of tokens, which can overflow the context limits of small models or cause massive performance latency.

Optimized Context Window: The agent tracks diff text size. If it exceeds 4,000 characters, it slices the sequence and appends a truncation warning. This maintains high speed and resource safety while providing sufficient context for the model.