Building a Git-driven agentic workflow A Git-driven agentic workflow uses Git and the pull request as the control plane: a labeled GitHub issue starts a bounded run, the agent works on an isolated branch, deterministic checks such as `npm run typecheck` and `npm test` evaluate the changes, and a pull request stops before merge for a maintainer to review. Andrew Evans's sample project PatchPup, a small TypeScript API, demonstrates the pattern with an OpenCode session restricted to `src/**` and `test/**`, an authorization job that checks the triggering user and issue author against `PATCHPUP_AUTHORIZED_ACTORS`, and a local event log plus `LEARNINGS.md` for debugging runs. The approach matters because a model call alone is not a development workflow, and without clear boundaries a small request can turn into a noisy branch and a long debugging session. Coding agents are good at exploring a codebase, proposing edits, and running commands. A model call alone, however, does not make a development workflow. Without clear boundaries and guardrails, a small request can turn into a noisy branch and a long debugging session. Git-driven Agentic workflows resolve a lot of the challenges of using agents in regular software development. A Git-driven agentic workflow treats Git and the pull request as the control plane. An issue or review comment starts a bounded run. The agent works on an isolated branch, deterministic checks evaluate changes, and a pull request gives a developer a familiar place to review or redirect the work. The agent can do useful implementation, but it does not get to silently decide that its own changes are ready for production. This post will introduce what Git-driven agentic workflows look like, and then talk about best practices at scale. I’ll also be walking through my sample project PatchPup https://github.com/andrewevans0102/patchpup , which you can clone and follow along with. After covering best practices, I’ll conclude with an example of a larger-scale system that uses Git-driven agentic workflows called Fullsend https://fullsend.sh . A Git-driven agentic workflow connects a request to a bounded implementation run. Git-driven agentic workflows move local coding into a controlled workflow that has gates and controls along every step of the software development cycle. The core idea of Git-driven Agentic Workflows is to let GitHub events initiate work, but keep the work reviewable and reversible. At a high level, a typical Git-Driven Agentic Workflow would take the following steps: Visually, this process looks like the following: A few key takeaways from this workflow: My sample project PatchPup https://github.com/andrewevans0102/patchpup is a small TypeScript API with a few tests and a GitHub workflow that demonstrates a Git-driven Agentic Workflow. PatchPup starts with a labeled issue to kick off the process. The PatchPup workflow makes a focused change on a task branch, runs the project’s checks, and reports the result in a pull request. PatchPup also keeps a local event log and a short LEARNINGS.md to show how to debug runs and carry durable fixes forward. In the next section, I’ll walk through what a Git-driven agentic workflow looks like by showcasing an example run with PatchPup. PatchPup turns a labeled GitHub issue into a pull request, and the workflow stops before merge. If you want to use PatchPup or set it up in a sample repo, I recommend cloning into a project either public or private in GitHub. I cloned the original PatchPup project and used a private patchpup-v1 repository to follow one real run from its issue contract through authorization, implementation, checks, review, and a separate maintainer merge. The workflow also uses an agent that is run with an OpenCode https://opencode.ai/docs session to do the actual work. Visually, the workflow that PatchPup creates looks like the following: Let’s step through what it looks like in practice with a run-through of an actual version of PatchPup from initial issue to merged PR: GET /api/character-count with explicit outcomes for ordinary text, an empty value, and a missing parameter. I also included a requirement to add API tests. Applying the patchpup label triggers the run. The authorization job checked the triggering user and issue author against PATCHPUP AUTHORIZED ACTORS before unlocking the write-capable job. patchpup/issue-18 branch and ran the associated GitHub action workflow. The GitHub action gave OpenCode the issue, repository guidance, and focused source/test context. The implementation agent was restricted to src/ and test/ , and the harness separately rejects out-of-scope diffs. In this run, it changed src/api.ts and test/api.test.ts only. npm run typecheck and npm test . Both of these checks passed before it pushed the branch and opened a PR. The workflow also uploaded its structured run artifact. This repository has no PR-level checks configured, so those results are visible in the issue-triggered Actions run rather than a check suite attached to the PR. {"count":8} for PatchPup , returns zero for an explicitly empty value, and returns 400 with {"error":"missing text"} when the parameter is absent. Its 28-line diff contains only the route and three API tests, matching the issue’s scope. The PR links the issue I created and records the checks that passed. The final step was me inspecting the diff before merging the PR. Working through this example, you can see how the Git-driven Agentic Workflow provided a controlled experience from requirement to implementation. Checks like the initial user check, as well as controlled output with a Feature Branch and PR, provide a stable developer experience. Utilizing the tools already built into GitHub like Issues, PRs, and GitHub Actions also enables this workflow to work well within the Git ecosystem. In the next few sections, I will cover some best practices for working with Git-driven agentic workflows. A Git-driven agentic workflow does not need an elaborate agent hierarchy to be effective. The workflow needs to give the agent useful context, enforce clear operational boundaries, respond predictably to failure, and retain enough evidence to support debugging and improvement. The following is a set of best practices that enforce these core concepts. Token use is often treated as a model-selection problem. In a Git-driven workflow, the first optimization is usually to send less irrelevant context. A useful task context might include: Avoid attaching the full repository, every prior run transcript, or a complete CI log by default. Broad context costs more and can distract the agent from the requested change. Too little context can also produce avoidable mistakes, particularly when a task depends on architectural constraints or consumers outside the edited files. The goal is not the smallest possible prompt, but rather it is the smallest prompt that contains the evidence the task requires. A few practices make context more predictable: PatchPup’s makePrompt function in scripts/patchpup.ts illustrates this approach. It passes a size-limited issue to the agent. On repair runs, it adds bounded failure evidence and the current diff instead of replaying the previous conversation or sending the complete test log: function makePrompt context: RunContext, failure: string, diff: string, attempt: number : string { const issue = { number: context.issueNumber, title: context.event.issue?.title ?? "" .slice 0, 300 , body: context.event.issue?.body ?? "" .slice 0, MAX ISSUE CHARS , }; const repair = failure ? \n\nRepair attempt ${attempt}/${MAX REPAIR ATTEMPTS}. Deterministic failure evidence follows; address it with the smallest in-scope change.\n