Runaway branches and pull requests
Problem. Left alone, the model invented a new branch name for every bug.
Solution. The branch name is fixed on the server and the model's choice is ignored, with pull request reuse on top.

A full-stack AI coding agent for GitHub. Sign in, ask about your code in plain English, and let the agent read, search, review and fix it, then open a pull request for you to approve.
RepoSentry turns a GitHub account into a conversation. After signing in with GitHub OAuth, a developer can ask questions like "show me the full structure of my repo", "review auth.ts for bugs" or "fix this and open a PR". Behind the chat, a Gemini-powered agent decides which GitHub tools to call, reads real code instead of guessing, and reports back. When asked to fix something, it commits the change to a dedicated branch and opens a pull request so a human always reviews before merging.
AI assistants usually answer from memory, which is risky for code. The goal was an agent that works on the real repository and can be trusted with write access. The hard problems were grounding answers in actual files, keeping the agent from damaging a repo, and keeping responses fast on large codebases while running on free-tier model quotas.
GitHub OAuth, then a signed JWT session. The agent uses that user's own GitHub token.
The user types a request in plain English, optionally with Think mode or voice input.
Gemini picks the right tool through function calling instead of guessing.
The server runs the tool against the GitHub API and returns real data to the model.
The reply is rendered as markdown with code blocks, trees and tables.
For fixes: branch, commit, pull request. The user reviews and merges.
list_reposLists every repository the signed-in user can access.
list_repo_filesLists one folder level of a repository.
get_full_repo_treeFetches the complete nested structure through the Git Trees API.
read_fileReads a file's real content, with a size cap for speed.
search_codeSearches a repository with GitHub code search instead of opening files one by one.
create_branchCreates the single shared fix branch for a repository.
update_fileCommits the corrected file to the fix branch with a clear message.
create_pull_requestOpens the pull request, or reuses the open one, so the user can review.
Problem. Left alone, the model invented a new branch name for every bug.
Solution. The branch name is fixed on the server and the model's choice is ignored, with pull request reuse on top.
Problem. A huge file or tree can turn one question into minutes of model input.
Solution. Files are capped at 30,000 characters, history is trimmed to recent messages, and the last file or tree is carried forward so it is not fetched twice.
Problem. Models retype indentation badly and burn output tokens doing it.
Solution. The server builds the ASCII tree itself. Plain tree requests skip the model and return it directly, saving two model calls.
Problem. Models return 503s and run out of daily requests.
Solution. A fast model handles normal chat and a deeper model handles Think mode, each acting as the other's fallback, with retries on overload.
Problem. There is no endpoint that reports remaining requests.
Solution. Every call is logged with its token counts and compared with a configurable daily cap, so users see honest, self-tracked usage.
React · TypeScript · Vite. Components for sidebar, chat window, input panel, login and settings.
Node.js · Express · TypeScript with routes, controllers, services and JWT middleware.
Google Gemini with function calling, a tool executor and context carry-over.
PostgreSQL through Prisma: users, chats, messages and usage logs with cascading deletes.
GitHub OAuth, REST API, Git Trees API and code search API.
Vercel for the client and Render for the server, configured through render.yaml.
| Method | Endpoints |
|---|---|
| GET | /auth/github · /auth/github/callback · /auth/me |
| POST | /api/chat |
| GET POST PATCH DELETE | /api/chats |
| GET | /api/github/repos · files · file · tree |
| GET | /api/usage |
RepoSentry is live and open source. It shows how to give an AI model real access to a codebase without giving up control: the agent reads, reasons and writes, but a human always makes the final call. Building it end to end covered OAuth, a typed REST API, a relational schema, agent design, prompt engineering and deployment.