The Local Agent Imperative
The current landscape of AI agent capabilities often ties functionality to vendor-specific, escalating pricing plans. Moriwodevai, a developer, sought an alternative: an AI agent that operates entirely on a local machine. This approach allows for swappable underlying models—Anthropic, OpenAI, Moonshot, or even free-tier OpenAI-compatible APIs—and ensures that any tools the agent creates remain local assets. To address this, they developed AMA-teras (AGPL), a desktop application built with Electron and TypeScript. The core innovation of AMA-teras is its ability to generate new tool plugins for itself when it encounters a task beyond its current capabilities.
Engineering Safety into Self-Evolution
The concept of a self-evolving agent can evoke unease. Moriwodevai prioritized a robust pipeline to mitigate risks, treating the verification process as a primary feature. This pipeline ensures that generated code is safe and functional before deployment within the agent's ecosystem. The process begins with code generation occurring within an isolated Git worktree. This separation guarantees that the running application remains untouched by the development process of new tools. Once generated, a new tool must successfully navigate three distinct verification stages. First, it undergoes static analysis via type-checking to ensure structural integrity and adherence to defined types. Following this, the tool must pass a suite of real unit tests designed to validate its specific functionalities. Finally, a smoke test is performed to confirm the tool integrates correctly with the agent and performs its intended task in a simulated environment. Only after successfully passing these rigorous checks is the generated tool presented to a human for final review and approval.

Tool Generation and Plugin Architecture
AMA-teras's architecture is designed for modularity and extensibility. When the agent identifies a need for a new capability, it initiates a process that leverages its underlying LLM to generate the necessary code for a new tool. This code is not immediately integrated. Instead, it's placed within a separate, isolated Git repository. This isolation is critical; it prevents any potentially buggy or malicious code from directly affecting the core application. The generated code is typically a TypeScript file intended to be compiled into a JavaScript plugin. The agent uses a predefined schema or interface that all plugins must adhere to, ensuring consistency and predictable interactions.
The generation prompt sent to the LLM is carefully crafted. It includes the agent's current state, the user's request, and crucially, the schema for tool plugins. The LLM's output is expected to be a complete, self-contained tool function that fits within this schema. For instance, if the agent needs to interact with a local file system in a way it hasn't before, it might generate a new file I/O utility. The prompt would guide the LLM to create a function that accepts a file path and desired operation, returning the result or an error, all within the defined plugin structure.
The Verification Gauntlet
The multi-stage verification is the linchpin of AMA-teras's safety model. It transforms the potentially risky process of AI-generated code execution into a controlled, auditable workflow.
Type Checking
The first layer of defense is TypeScript's static type checking. This catches a broad range of errors before runtime, including type mismatches, undefined variables, and incorrect function signatures. By enforcing a strict type system, AMA-teras ensures that the generated code adheres to the expected structure and data formats defined by the agent's plugin API. This is akin to an architect ensuring all building materials meet specific engineering standards before construction begins.
Unit Testing
Following type-checking, the generated tool is subjected to a battery of unit tests. These tests are written by the AI itself, based on the intended functionality described in the prompt. They serve to verify that the code behaves as expected under various conditions, including edge cases and error scenarios. For example, a tool designed to parse a specific data format would have unit tests to ensure it correctly handles valid inputs, malformed inputs, and empty inputs. The success of these tests provides a strong signal of the tool's correctness and reliability.
Smoke Testing
The final automated stage is a smoke test. This is a more integrated test that runs the tool within a simulated or minimal version of the agent's environment. It verifies that the tool can be loaded, executed, and that its output is compatible with the agent's overall workflow. It's less about granular correctness (handled by unit tests) and more about ensuring the tool doesn't break the agent or other existing components. A successful smoke test indicates that the tool is ready for human inspection.
Human Oversight: The Final Gate
Despite the rigorous automated checks, Moriwodevai emphasizes that human review remains the ultimate gatekeeper. Before any newly generated tool is permanently integrated and made available for use, a human developer must review the code. This manual inspection is crucial for catching subtle logical flaws, security vulnerabilities that automated tests might miss, or deviations from best practices. It also provides an opportunity to refine the generated code, improve its efficiency, or add comments for better future understanding. This human-in-the-loop approach balances the automation's speed and scalability with the indispensable judgment and security awareness of a human expert.
Implications for Local AI Development
AMA-teras represents a significant step towards empowering users with truly local, customizable AI agents. By abstracting the complexity of tool creation and embedding a strong verification process, it lowers the barrier to entry for developing sophisticated AI assistants that respect user privacy and data ownership. The model of an agent that can autonomously extend its own capabilities, under strict human supervision, opens up new possibilities for personalized AI workflows and specialized task automation without relying on cloud-based services or incurring ongoing subscription fees. This approach could foster a more open and decentralized ecosystem for AI agent development.
