# I built a desktop AI agent that writes its own tools — behind verification gates

> Source: <https://dev.to/moriwodevai/i-built-a-desktop-ai-agent-that-writes-its-own-tools-behind-verification-gates-2jfl>
> Published: 2026-07-23 10:02:47+00:00

*A desktop AI agent that writes its own tools — and why every line passes a gate before it runs.*

Agent capability is quietly becoming synonymous with a specific vendor's pricing plan. I wanted the opposite: an agent that runs on my machine, where models are swappable parts (Anthropic / OpenAI / Moonshot, or free-tier OpenAI-compatible APIs), and where the tools it writes stay on my PC as my assets.

So I built **AMA-teras** (AGPL, Electron + TypeScript): a desktop agent that, when it hits a capability it lacks, writes a new tool plugin for itself.

"Self-evolving" sounds like a horror story, so the pipeline is the product:

Nothing ships unreviewed — including code it wrote for itself, and anything imported from the community registry (shared plugins carry a verification-evidence record; audits elsewhere report 12–20% of marketplace skills are malicious, so evidence-or-nothing felt right).

A large part of this app was built by the agent itself, under the same gates. The failure stories are documented in the repo — including the night it deleted its own work branch and we had to rebuild two tools from scratch (that incident is why nightly work now auto-backs-up to a private remote).

Repo: [https://github.com/moriwo-dev-ai/ama-teras](https://github.com/moriwo-dev-ai/ama-teras)

Feedback very welcome, especially on the safety model.
