My AI Stack: Agents Change, Git Stays
Persistent agents, shared context, observable inference and Git-based reviews

How I run coding agents from my homelab, keep their context in sync, watch inference costs, and review what they ship.
November 2026 — this is a snapshot of a setup that keeps evolving, not a finished architecture or a step-by-step tutorial.
I currently use OpenCode most of the time, Pi less often, and Google Antigravity CLI as the newest addition. I may replace any of them tomorrow. That is precisely why the most important part of my AI stack is not the coding agent itself.
The interesting part is the system around it: a persistent runtime, shared instructions and skills, centralized inference, useful tools, and a Git workflow that lets me inspect what the agents produce.
I work as a Solutions Engineer at Cloudflare, so this setup is naturally quite Cloudflare-heavy. I regularly need to test a product, reproduce a suspected bug, investigate a limitation, or build a small proof of concept. I want those experiments to be repeatable, and I want to be able to destroy and recreate their environments without reconstructing what an agent did three weeks earlier.
This article is simply where I am today, the choices I made, and the trade-offs I accepted.
The constraints I started with
The problems I wanted to solve were:
- Agents must keep working when my laptop is closed. This was the number-one constraint. Closing the lid or dropping an SSH connection should not kill a task.
- Every agent should start with the same context. I want clear, improvable global instructions and reusable skills, not a different personality and set of conventions in each CLI.
- The setup should be agent-agnostic. OpenCode, Pi, Antigravity, or something else next month: I do not want to rebuild everything around one vendor.
- I need visibility and control. I want to know which agent is working, blocked, or done, and I want a clean way to review the changes it produces.
- Inference should be observable and cost-effective. I want to switch models easily, understand daily and per-model costs, inspect logs, and put guardrails around spending.
The resulting architecture looks like this:

The high-level architecture. The LXC is the execution environment; Gitea and Cloudflare provide most of the control plane around it. The diagram is simplified: AI Gateway handles inference for OpenCode and Pi, while Antigravity uses its Google subscription directly.
A small LXC instead of a process on my laptop
The agents work on a dedicated Debian 12 LXC container in my Proxmox homelab. It is a small, unprivileged container with 2 vCPUs and 4 GB of RAM, reachable over SSH. It has the usual development tools installed: Git, Node.js, Wrangler, Terraform, and the agent CLIs themselves.
There is no local GPU inference happening on this machine. Its job is to give agents a persistent place to execute code and use tools; model inference happens elsewhere.
Why an LXC rather than a VM with stronger isolation? Mostly memory. LXC gives me more flexible and economical memory management on a constrained homelab host. If I had RAM to spare, I would prefer a VM. This is a conscious compromise, not a claim that containers provide the same isolation boundary.
The container itself is provisioned with Terraform, and Ansible installs and configures the software. The same pattern is available to agents through a reusable template: Terraform creates the machine, Ansible configures it. That makes the runtime reproducible instead of turning it into a carefully hand-crafted snowflake.
Herdr: persistent sessions and a view across agents
The piece that made the remote runtime pleasant to use is Herdr TUI. The simplest description I can give is “tmux on steroids, designed for coding agents,” although that only covers part of it.
Herdr TUI runs a server on the LXC. Agents keep running there when I detach, close the app, or shut my laptop. I can attach again later from my Mac or another machine and find the same terminals.
It also gives me the operational view I wanted: workspaces for projects, terminals for tasks, and agent states such as working, blocked, idle, or done. Instead of checking every terminal to see whether something needs me, I can look for the agents that are blocked or have finished.

Local and remote agents in the same Herdr TUI interface. The OpenCode session is running on the LXC, not on my laptop.
Herdr now also has official iPhone, iPad, and Android apps. The newer Herdr app and Herdr TUI are separate programs, so I am testing mobile as a complement to my existing TUI workflow rather than a like-for-like replacement.
This solves the first constraint without tying the rest of the system to a particular coding agent. Herdr TUI runs real terminals; OpenCode, Pi, and Antigravity are simply processes I can launch inside them.
One shared context for several agents
The next problem was configuration drift. Every agent has its own global configuration path, its own conventions, and its own way of discovering skills. Maintaining separate copies would guarantee that they eventually diverge.
My solution is a private Gitea repository named agent-context. It is effectively a small dotfiles repository containing:
agent-context/
├── AGENTS.md
├── skills.txt
├── install.sh
└── sync-skills.shAGENTS.md is the single source of truth for global instructions. Scripts link it into the locations read by the different agents. Skills live in their own versioned repositories; skills.txt is the manifest, and sync-skills.sh clones or updates them before exposing them through symbolic links in a shared skills directory.
A pullContext alias lets me refresh the global context and synchronize the skills on the machine. When I want to change agent behavior, I edit the repository, commit the change, push it, and distribute it. I do not patch five local configurations and hope they remain aligned.

The `agent-context` repository: one versioned source for global instructions and shared skills.
The global context includes things such as:
- who I am and how I like to work;
- where new projects belong and how repositories should be organized;
- coding conventions, preferred technologies, and commit style;
- the fact that projects should be GitOps-managed and Gitea-first;
- which Cloudflare account to use for experiments;
- how to build repeatable environments with Terraform and Ansible;
- which homelab systems the agent can access, and where to find the relevant credentials when a task requires them;
- the rule that secrets must never be hardcoded or committed.
This is not magical long-term memory. It is explicit, reviewable configuration. That is a feature: when an agent repeatedly makes the wrong assumption, I can correct the source, review the diff, and distribute the improvement.
“Agent-agnostic” also does not mean that every CLI has identical configuration mechanics. There are still small adapters and symlinks for each one. The goal is to share the source of truth, not to pretend the tools are identical.
Centralized inference with AI Gateway
For OpenCode and Pi, inference goes through Cloudflare AI Gateway, using models served by Workers AI.
At the time of writing, my main model is DeepSeek V4.1 Flash. I also used GLM 5.3 Flash quite a lot before that. I expect this paragraph to age badly, which is exactly the point: the model is a replaceable component, not the foundation of the setup.
The gateway gives me a single place to inspect requests, tokens, errors, logs, and estimated costs, broken down over time and by model. I also configured spend limits to catch abnormal consumption. They are useful guardrails, although they should not be treated as perfectly instantaneous billing caps.

A real 30-day window: roughly 3.6k requests, 392 million tokens, and $17.91 in estimated inference cost. This is not a benchmark—just the visibility I needed.
There is one deliberate exception: Antigravity uses the quota from my Google subscription, which costs around €20 per month. That subscription-based authentication cannot simply be routed through AI Gateway, so this inference does not appear in the same analytics. My “all inference through the gateway” rule is therefore true for OpenCode and Pi, not for every agent in the system.
That is a trade-off I currently accept: subscription economics on one side, centralized observability on the other.
Tools through one MCP portal, browsers outside the LXC
Coding agents become much more useful when they can consult documentation, inspect an account, read notes, and verify a web interface. I use several MCP servers for that, but I do not register each server separately in every agent.
Instead, agents connect to a Cloudflare MCP server portal. The portal gives me one authenticated endpoint through which I can expose selected tools, centralize governance, and inspect tool requests.
Behind it, I currently have things such as:
- the Cloudflare documentation MCP server;
- access to my Cloudflare staging account for data, logs, and approved operations;
- Context7 for library documentation;
- a custom Obsidian MCP server, implemented as a Cloudflare Worker backed by R2.
The Obsidian integration is particularly useful. I can ask an agent to save an interesting result as a Markdown note, or search existing notes and folders when I need previous context. Adding another MCP server is now a portal configuration change, not a tour of every CLI configuration on the machine.
Agents also need a browser, both to explore the web and to check the interfaces they build. Running several Chrome instances on a 4 GB LXC is a quick way to rediscover the limits of that container.
For that reason, I use Cloudflare Browser Run and Kitesurf to run browser sessions outside the LXC. The agents can navigate and validate web interfaces without consuming the container's memory with local browser processes.
Kitesurf is stateless and agent-first rather than a complete, persistent Chromium environment. That is another trade-off: lower local resource consumption and easy scaling, in exchange for fewer full-browser capabilities and no persistent authenticated session. For the browsing tasks I give agents most often, that trade-off currently makes sense.
Git is the real control plane
The most stable part of this setup is Gitea. Every project gets a repository. Code, infrastructure definitions, workflows, and documentation go through Git.
This matters even more for my Cloudflare experiments. When I want to test a feature or investigate a possible limitation, I do not want an agent to click through a dashboard and leave an undocumented environment behind. The instructions are explicit: use the staging account, define the environment with Terraform, and make it possible to recreate or destroy the result.
The same principle applies when an experiment needs another machine. Agents have access to a Terraform/Ansible template that can provision an LXC or a VM on Proxmox. They can create the environment required for a test instead of stopping at “you should now create a server.”
The objective is not merely autonomous code generation. It is work that remains inspectable, repeatable, and reversible.
A concrete workflow: from an issue to a preview
There are currently two main ways I start work.
For an interactive project, I launch an agent through Herdr, describe the problem, and plan with it before letting it execute. Herdr then gives me visibility while it works.
For a more autonomous task, I can create a Gitea issue and mention Bob, my newest agent. Bob is still experimental, but it shows where this setup is heading.
Here is a real example from cf-models-rankings, a small Cloudflare Worker dashboard that compares Cloudflare-hosted AI models with OpenRouter data.
1. I describe the task in an issue
I asked Bob to add a preview workflow to the repository, pointing it to an existing implementation it could study.

Bob acknowledges the issue, explains its plan, and later links the pull request back to it.
2. A webhook wakes Bob up
The Gitea webhook reaches Bob, which runs on Cloudflare and is built with Flue, an open-source TypeScript agent framework. Bob accesses my private Gitea instance through a Cloudflare Tunnel and uses its own credentials to read the issue and interact with the repository.
It then acknowledges the request, outlines its approach, and provides a link where I can follow its work.
Bob does not need to boot a full container just to perform every lightweight operation. Flue's virtual sandbox uses just-bash to emulate Bash with an ephemeral in-memory filesystem. That is useful for lightweight execution, but it is not a full Linux machine; the execution environment still needs to match the task.
3. Bob explores, commits, and opens a pull request
After inspecting the repository and the example, Bob creates a branch, makes several commits, and opens a PR. The expectation of small, reviewable commits is part of the instructions and skills loaded into the agent.
At this point, the workflow becomes deliberately boring—and that is a compliment. I am no longer watching an opaque stream of terminal output. I am looking at a normal branch, normal commits, and a normal pull request.
4. CI deploys a preview for the PR
The repository uses Gitea Actions for CI/CD. On a pull request, workflows run the checks and deploy a temporary Worker Preview. A script posts the preview URL back into the PR and updates it on subsequent pushes; the preview is removed when the PR closes.

The PR contains both a temporary preview URL and the CI results.
This is extremely useful for UI work. I do not have to infer whether a visual change looks right from a diff. I can open the deployed branch in my browser and check the actual behavior. For private work, Cloudflare Access is the piece I use to restrict who can open a preview.
5. Another agent reviews the PR
I also run PR-Agent, a community-maintained open-source PR reviewer. It analyzes the changes, estimates review effort, reports whether the PR contains tests, and raises potential correctness or security concerns.

Automated review is another signal, not a replacement for human judgment.
The findings are not automatically correct, just as agent-produced code is not automatically correct. But they give me specific things to verify before merging, including issues that are easy to overlook in a large infrastructure-oriented PR.
I am not sure PR-Agent will remain a permanent part of the stack. There is a good chance I will eventually replace it with a Cloudflare-based agent, similarly to Bob. The workflow matters more than the current implementation.
6. I make the final call
If CI is green, the preview behaves correctly, and the review findings are addressed, I merge into main myself.
The agent can create the environment, write the code, open the PR, and deploy the preview. It does not get to define “good enough” on my behalf.
Autonomy does not remove the need for guardrails
There is an obvious tension in this setup: I want agents to be autonomous, but I also want to control what they change.
Some of that autonomy is very concrete. For example, I have Antigravity aliases for automatic and highly permissive “YOLO” modes because manually approving every edit and shell command turns remote agents into a babysitting exercise. Those modes are convenient, but they increase the importance of everything around the agent.
My current guardrails are a mixture of:
- a dedicated LXC rather than running everything directly on my laptop;
- a separate Cloudflare staging account for experiments;
- credentials kept outside repositories and used only when required;
- Cloudflare Tunnel and Access for controlled connectivity;
- inference analytics and spend limits;
- Git history, pull requests, CI, previews, and automated review;
- a human merge decision.
This is not a perfect security model, and it is certainly not a universal reference for hostile or multi-tenant workloads. An LXC is not a VM, permissive agent modes reduce friction by reducing confirmation checks, and centralized credentials require careful scoping. I am optimizing a personal lab while keeping those risks visible rather than pretending they do not exist.
What is stable, and what will probably change
The parts that currently bring the most value are:
- The persistent runtime. I can start a task and close my laptop.
- The shared, versioned context. Changing agents no longer means losing my conventions and skills.
- The inference control point. I can compare usage, investigate logs, and keep an eye on costs.
- The Git-centric workflow. Projects, changes, checks, and deployments remain visible.
- Per-PR previews. I can validate the result instead of reviewing only the intention.
The moving parts are just as clear:
- the models I use, because price and capability keep changing;
- the coding agents themselves;
- Bob, which is still new;
- PR-Agent, which I may replace;
- the mobile workflow, which I am still testing;
- and possibly the LXC, if I decide that stronger VM isolation is worth the additional memory.
The main lesson from this setup is that the coding agent is becoming interchangeable. The durable value is in the surrounding system: persistent execution, shared context, observable inference, useful tools, and a reviewable delivery workflow.
Agents come and go. Git stays.
Comments
No comments yet