feat: Add model context system for improved project awareness#375
Merged
feat: Add model context system for improved project awareness#375
Conversation
edenreich
commented
Jan 24, 2026
ig-semantic-release-bot bot
pushed a commit
that referenced
this pull request
Jan 24, 2026
## [0.99.0](v0.98.0...v0.99.0) (2026-01-24) ### 🚀 Features * Add model context system for improved project awareness ([#375](#375)) ([1afb26b](1afb26b)) ### 🐛 Bug Fixes * Skip migrations for JSONL storage in infer init ([#376](#376)) ([3793345](3793345)), closes [#372](#372) ### ♻️ Code Refactoring * Improve the testability of conversation optimizer ([#374](#374)) ([4c7c428](4c7c428))
|
🎉 This PR is included in version 0.99.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds automatic git repository and working directory context to the AI agent. The system provides repository name, branch info, recent commits, and working directory path to reduce confusion and improve accuracy. Includes caching for performance and configurable refresh intervals.
What changed
Why changed
To reduce model confusion about repository identity and improve accuracy by providing project context. Previously, models were often confused about repository names ("inference-gateway" vs "inference-gateway/cli" vs "inference-gateway/infer") and had no awareness of current branch or git state.
Configuration
Enabled by default with:
git_context_enabled: trueworking_dir_enabled: truegit_context_refresh_turns: 10(configurable refresh rate)Performance
Benefits
Before:
After:
inference-gateway/cliImplementation Details
internal/services/agent_utils.gobuildGitContextInfo(),buildWorkingDirectoryInfo()isGitRepository(),getGitRepositoryName(),getGitBranch(),getGitMainBranch(),getRecentCommits()sync.RWMutexinAgentServiceImpl