Self-Hosted AI Coding Agents: Build a Remote Factory
Learn how a self-hosted AI coding factory uses Proxmox, Forgejo, isolated VMs and controlled agent workflows to run development jobs remotely.

How to Build a Self-Hosted AI Coding Factory
Running coding agents on a laptop is convenient - until the laptop becomes the bottleneck. Virtual machines chew through battery, run hot, and lock long jobs to a device you might want to close or take with you. If you move those workloads to an always-on machine at home, the whole setup changes: you can assign work remotely, keep agents running in isolated environments, and review what happened when you're ready.
The harder part isn't getting an agent to write code. It's building a system around that agent - one you can rebuild, monitor, and keep from reaching credentials or services it doesn't need. When you self-host, the operational load shifts to you too: networking, updates, backups, and troubleshooting.
This guide lays out a practical architecture for a remote development "factory": a small Proxmox host, separate network zones, self-hosted Git and automation, reproducible virtual machines, and a harness that turns issues and scheduled jobs into agent sessions. It also covers the limits. Isolation reduces risk, but it doesn't magically make autonomous coding "safe by default."
Why move AI coding agents off your laptop?
A laptop is great for interactive development. It's a weaker choice for 24/7 hosting of virtual machines and background agents. When you need a long research run, a recurring maintenance task, or multiple coding sessions at once, tying everything to your personal device adds friction. The machine has to stay powered, connected, and available - while still competing for resources with whatever you're doing locally.
An always-on server removes that constraint. You can connect over VPN, check sessions in a terminal, and keep agents running even if your laptop is closed. The point isn't to "remove the developer from the loop." It's to make the work persistent and easier to schedule, while keeping review and decisions in human hands.
Define the operating requirements first
Before you buy hardware or pick an agent dashboard, write down what the system actually needs to do. A solid baseline could include:
- One isolated development environment per project.
- Rebuild a damaged or compromised environment without redoing everything by hand.
- Keep Git, CI, secrets, and management services off the agent network where practical.
- Support both interactive work and recurring automation.
- Let a developer inspect or take over an agent session at any point.
- Avoid custom services when an existing tool already solves the job.
These requirements are more useful than a checklist of "cool tools." They force the real design questions: how a VM gets credentials, what an agent can reach, and what happens during a reboot.
Prefer a durable workflow over a custom control panel
A bespoke web interface sounds like the obvious way to manage agents. But it becomes another app you have to build, secure, and maintain. If the workflow is already covered by something like an issue tracker, a terminal multiplexer, and notifications, a custom interface can end up adding more operational burden than value.
In the setup described here, Forgejo issues are the task queue, tmux is the live control surface, and phone notifications report failures. You can run the day-to-day from a laptop, or start an issue from a mobile app that works with Forgejo-compatible clients. It's less polished than a purpose-built dashboard, but it reuses tools you already know - and it keeps the important state (tasks and code) inside the project workflow.
The trade-off is that you need to be comfortable working from the terminal. That choice usually makes sense when the primary operator is a developer. It may be a bad fit for teams that want role-based dashboards, audit reports, or a nontechnical review process.
What hardware and network architecture do you need?
A small server can run a useful development factory, but capacity limits how much concurrency you can support. One example uses a refurbished Dell OptiPlex Micro 7010 (Intel Core i5-13500T, 32 GB RAM) running Proxmox. Another example uses an existing Lenovo ThinkCentre Tiny running Proxmox too, with both hosts monitored together.
The small form factor helps with noise and power at home. The real constraint is memory: virtual machines, build jobs, and agents all compete for it. Thirty-two gigabytes can support a modest workload, but it doesn't mean you can run an unlimited number of heavy projects at once. Size the host for the number and type of concurrent environments you actually expect, then leave room for the hypervisor and supporting services.
Separate development machines from supporting services
A good starting point is to split your networks into distinct zones. In this design, one VLAN hosts services like Git, DNS, and secrets management; another VLAN hosts the development VMs. A separate zone holds CI runners. Firewall rules should allow only the traffic each role needs.
This separation matters because an agent is running code and handling inputs that could be untrusted. If a development VM gets compromised, you don't want it to automatically expose the Git server's management interface, your CI infrastructure, or every other machine on your home network. Network segmentation reduces what an attacker can reach, but it can't guarantee the breach stays contained.
A restrictive setup also adds work. You may need precise firewall exceptions, and DNS can get annoying across VLANs. In the example, Technitium handles internal DNS and DHCP. Each development VM registers its hostname, creating an internal name under a development domain. Since DHCP broadcasts don't cross VLAN boundaries by default, a small dnsmasq relay forwards requests between the development and services networks.
This is the classic operational trade-off: segmentation makes the system easier to reason about from a security perspective, but it introduces plumbing. If you can't maintain those rules or troubleshoot name resolution quickly, a simpler network might be safer in practice than a fancy one that's easy to misconfigure.
Keep CI runners and deployment credentials apart
A CI runner executes repository workflows - downloading dependencies and running arbitrary scripts. Treat it as its own trust boundary, not as a harmless extension of the Git server. Here, the runner can reach Forgejo to register and receive jobs, but it's isolated from the other network zones.
Deployment credentials deserve a separate boundary too. Storing private production SSH keys in CI secrets can get risky if agents can modify workflow files. A malicious or mistaken workflow might try to expose those secrets, even if changes to the main branch require human review.
The alternative in this setup is to use Semaphore UI for deployment. Semaphore holds the private keys and runs a constrained deployment script after code lands on the reviewed main branch. That reduces direct access to credentials, but it doesn't remove supply-chain risk: reviewed code can still contain a bug - or a deliberate payload. The design limits what the agent can access, but it can't replace code review, testing, or production controls.
How do you provision and coordinate agent work?
Disposable development environments only help if rebuilding them is routine. That means declarative provisioning: start with a Proxmox cloud-init template for the initial VM, then apply configuration using Ansible. Manage dotfiles with chezmoi, so a new machine gets a familiar terminal setup without manual file copying.
In this implementation, a small orchestration program called Kamino ties those steps together. You run an interactive command to choose which Proxmox host and VM size to use, then it selects the relevant repository. It creates a dedicated Forgejo bot account for the VM, grants it access to the repository, provisions the VM, and configures the secrets the VM needs. Sensitive values come from a password manager rather than being baked into the VM image.
This automation has a practical upside: if a VM gets corrupted, rebuilding it is a known procedure, not a weekend spent recreating undocumented steps. It also helps new environments stay consistent. The downside is real too - your provisioning code becomes critical infrastructure, so it needs version control, testing, and careful credential handling.
Use issues for immediate work and labels for stages
You can kick off interactive tasks in a terminal: an agent runs inside a tmux session on a Git worktree. You can also start work as Forgejo issues. Labels such as status/ready mark an issue for pickup, and labels like stage/research, stage/plan, and stage/implement describe the kind of work expected.
Tipoca, a custom harness, listens for Forgejo events and starts an agent session when an issue is ready. The agent gets the issue details and works in its own session. You can attach to that session, adjust the task, or comment on the issue to steer the work. If the VM restarts, the harness can resume the session using a stable identifier tied to the issue.
This approach keeps the task's intent visible in the issue tracker instead of buried in a chat history. It also makes the human approval step explicit: the agent can prepare changes, but someone still decides what's ready to merge.
Treat scheduled jobs as a separate class of work
Recurring tasks - repository maintenance, checking for new error reports, and similar - don't always fit cleanly into a manually created issue. One approach is to define each job in a Markdown file in the repository, including a cron or systemd schedule and strict limits on what output it's allowed to produce. For example, a job might be limited to proposing no more than one pull request or creating only a small number of issues.
Tipoca converts those definitions into systemd timers and starts an agent session when a timer fires. It can also poll an error-monitoring service like Sentry if inbound webhooks aren't available, or if you don't want to expose a local server publicly. Polling is less immediate than a webhook, but it avoids opening an inbound route just to receive events.
Scheduled jobs should have stricter controls than developer-written issues. They may process internet content or externally generated reports, so their inputs can be manipulated. In this design, a scheduled job runs as a separate, unprivileged Linux user - no sudo and no direct Forgejo access. It can propose an action to Tipoca, which validates the requested output and performs approved operations on the job's behalf.
That extra layer isn't a guarantee that the output is safe. It does reduce the agent's direct authority and makes allowed actions explicit, which matters when automation runs without someone watching every step.
How do you control access, risk and project knowledge?
The most important security question isn't whether an agent is "trusted." It's what the agent can do if it behaves incorrectly or gets pushed by hostile input. A practical design assumes an agent might try to read files, use credentials, or reach services outside the task it was given.
Keep secrets out of development VMs
Give an agent only the credentials it needs. One approach is to put API keys behind a secrets proxy (for example, an agent-vault service) and configure the VM to trust that proxy's certificate authority. The VM can make allowed requests through that service without storing the underlying keys locally.
But this only works if your network rules enforce it. If the VM can reach an alternate path that still contains the same credentials, the proxy becomes just a convention. Keep the secrets service on the services network, allow only required connections, and avoid putting broad administrative tokens into the VM's environment.
Secrets tooling changes over time. A proxy might become unsupported or shift toward a hosted offering. That's a good reason to keep the integration narrow and replaceable, rather than assuming any single component will stay the "right" long-term choice.
Make permissions different for different agent workflows
Not every agent session should have the same authority. A manually reviewed issue may need scoped write access to its repository if it has to create a branch or open a pull request. A scheduled job processing external inputs should have less access, and deployment credentials should stay outside both environments.
A simple permission matrix can make the design concrete:
| Workflow | Repository access | Secrets | Production access |
|---|---|---|---|
| Interactive development VM | Scoped bot access | Proxy-mediated, task-specific | None |
| Scheduled agent job | No direct Forgejo access | Minimal or none | None |
| CI runner | Job-specific checkout and execution | Avoid production keys | None |
| Deployment service | Read approved artifact or commit | Deployment keys held separately | Limited to deployment task |
This table is a starting point, not a complete threat model. You'll still need to decide who can approve changes, how artifacts get verified, and what the system logs. The key principle is simple: don't hand the same powerful credential to every stage just because it's convenient.
Store durable project knowledge with the project
Agent context that lives only inside a running session is fragile. If the VM is destroyed, your preferences and discoveries from local history can vanish. Put useful project knowledge where it can be reviewed and versioned.
A lightweight convention works well: keep short, durable instructions in an AGENTS.md file, and put longer explanations in the project documentation. A root instruction file can tell agents what belongs in each location and how it should be updated. That keeps project-specific knowledge near the code it refers to and lets future sessions pick up the context after a rebuild.
Cross-project "global memory" is a separate problem. It may be useful later, but a shared repository raises questions about ownership, relevance, and conflicting guidance. Start with project-level knowledge. Add a cross-project layer only when you repeatedly see the same work being done and there's a real reason to centralize it.
Conclusion: automate the environment, not your judgment
A self-hosted development factory isn't just a powerful PC with an AI model attached. It's a set of boundaries and repeatable processes: isolated VMs, managed network access, controlled credentials, visible task queues, and a reliable way to rebuild machines.
Start by making one project environment disposable. Add issue-driven agent sessions once provisioning and access controls are dependable. Bring in scheduled jobs only after you can limit their inputs and outputs. That order keeps the system useful without pretending autonomy removes operational risk.
The payoff is straightforward: work can keep moving while you're away from your laptop, and you still have the ability to inspect, steer, and approve it. Build for that human control loop first. More automation is only valuable when the system stays understandable and recoverable.