perf: auto-populate git context natively to avoid token waste

- Added get_git_context() to utils.rs using git2 to natively fetch branch, commit, and repo_name without CLI overhead.
- Wired native auto-population into LogCodeChangeHandler, LogErrorFixHandler, TechDebtHandler, TasksHandler, MilestonesHandler, AutoSessionCheckpointHandler, and HandoffMemosHandler.
- Eliminates the need for the LLM to waste repetitive background turns running git rev-parse HEAD and git branch --show-current via terminal shell commands just to feed the MCP logging tools.
This commit is contained in:
Riz Ashraf committed 2026-10-10 18:32:02 +01:00
1 parent 11f375017a
commit 760ebfcd40
4 files changed
+48 -15

No files matched your search

+3 -3
View File
@@ -37,13 +37,13 @@ impl McpTool for TasksHandler {
description,
created_at: now,
updated_at: now,
git_branch,
git_branch: git_branch.or_else(|| crate::handlers::utils::get_git_context().0),
parent_id,
dependencies: deps,
acceptance_criteria: vec![],
expires_at: None,
namespace: namespace.unwrap_or_else(|| "default".to_string()),
repo_name,
repo_name: repo_name.or_else(|| crate::handlers::utils::get_git_context().2),
priority,
assigned_agent,
verification_command,
@@ -430,7 +430,7 @@ impl McpTool for MilestonesHandler {
description: description,
task_ids: task_ids.unwrap_or_default(),
deliverables: deliverables.unwrap_or_default(),
repo_name,
repo_name: repo_name.or_else(|| crate::handlers::utils::get_git_context().2),
..Default::default()
})
});