Feature

Self-Improvement Engine

Guaardvark continuously tests, diagnoses, and repairs its own codebase without human intervention. When a bug is found, a ReACT agent writes the fix, validates it, and broadcasts the patch to every connected device in your fleet.

Autonomous Code Maintenance

Most software waits for a developer to notice something is broken. Guaardvark does not. Its self-improvement engine runs a continuous background cycle that treats the platform's own source code as a living system requiring constant attention. The engine relies on pytest as its primary diagnostic instrument, executing the full test suite at regular intervals and after every code change propagated through the network.

When a test fails, the engine does not simply log the error and wait. It captures the complete failure context: the stack trace, the failing assertion, the relevant source file, and the surrounding code. This failure report becomes the input to a ReACT reasoning agent that is specifically tasked with autonomous code repair. The agent operates with the same tool registry used by user-facing agents, giving it access to over 30 tools for file reading, code editing, shell execution, and dependency analysis.

The agent examines the failing code, reasons about potential root causes using the ReACT (Reasoning + Acting) framework, and generates a targeted patch. Before the patch is applied to the live codebase, it is validated by re-running the originally failing tests in isolation. Only patches that pass validation are committed. This means the self-improvement engine never introduces regressions by applying an untested fix. The entire cycle, from test failure to validated commit, runs autonomously without any developer input.

This approach transforms software maintenance from a reactive, manual process into an autonomous, continuous one. Bugs that would traditionally sit in an issue tracker for days or weeks are identified and resolved within minutes. The system treats every test failure as an actionable event, not a notification to be triaged by a human.

The Self-Improvement Loop

The engine operates as a six-stage pipeline. Each stage feeds directly into the next, creating a closed loop that transforms raw test output into validated, deployed code changes. Understanding these stages reveals how Guaardvark achieves autonomous software maintenance at scale.

1. Test Discovery

The cycle begins when the pytest runner discovers and executes the full test suite. Guaardvark maintains comprehensive test coverage across its modules, including unit tests for individual functions, integration tests for inter-system communication, and end-to-end tests for complete workflows. The discovery phase collects every test file, parameterized test case, and fixture. Tests are executed by Celery workers in the background so the main application remains responsive throughout the process.

2. Failure Detection

When one or more tests fail, the engine captures detailed failure artifacts. This includes the full stack trace, the exact assertion that failed, the expected versus actual values, and the file path and line number of the failure. The engine also collects contextual information: which module the failing code belongs to, what recent changes may have touched it, and whether the failure is new or recurring. This rich context is essential for giving the ReACT agent enough information to reason about the root cause.

3. Code Analysis

A ReACT agent receives the failure report and begins its reasoning cycle. Using the Reasoning + Acting pattern, the agent alternates between thinking about the problem and taking concrete actions. It reads the source file containing the bug, examines related files and imports, checks recent changes, and builds a mental model of what went wrong. The agent has access to the same 30+ tool registry used by user-facing agents, including tools for reading files, searching codebases, running shell commands, and inspecting module dependencies.

4. Patch Generation

Once the agent has identified the root cause, it writes a targeted fix. The patch is generated using the tool registry's code editing capabilities, which allow the agent to modify specific lines, add new functions, update imports, or refactor existing logic. The agent follows the principle of minimal change: it modifies only what is necessary to resolve the failing test, avoiding unnecessary refactoring that could introduce side effects. Each patch is recorded with a clear description of what was changed and why.

5. Validation

Before any patch reaches the live codebase, it must pass validation. The engine re-runs the originally failing tests against the patched code. If the tests pass, the patch is marked as validated. If they fail again, the agent can retry with a different approach or escalate the failure for manual review. This validation gate is critical: it ensures that the self-improvement engine never introduces new bugs while fixing existing ones. The system maintains a strict no-regression policy.

6. Commit and Broadcast

Validated patches are committed to the local repository with a machine-generated commit message that includes the original failure description, the root cause analysis, and the fix summary. Once committed, the patch is immediately broadcast to all connected devices in the fleet via the Interconnector mesh network. Other devices receive the patch, run their own validation, and apply it automatically. The entire fleet converges on the fixed version without any manual deployment steps.

Network Broadcasting

A fix that stays on one machine is only half a fix. Guaardvark's self-improvement engine is designed for fleet-wide self-healing, ensuring that every device in a deployment benefits from every bug fix discovered on any single device.

When a validated patch is committed on one device, it is packaged and broadcast to the entire device swarm via the Interconnector protocol. The Interconnector is Guaardvark's peer-to-peer mesh networking layer, which handles device discovery, secure communication, and state synchronization across the local network. Patches travel over this same channel, alongside model weights, configuration updates, and status heartbeats.

Receiving devices do not blindly apply incoming patches. Each device independently validates the patch by running the relevant tests against its own codebase. This ensures compatibility even when devices have slightly different configurations or hardware capabilities. Only after local validation succeeds is the patch applied. If a patch fails validation on a specific device, that device reports the failure back to the swarm, providing additional diagnostic data that the originating device can use to refine the fix.

The result is a self-healing fleet where one device's discovery becomes every device's improvement. In multi-device deployments, such as a cluster of Raspberry Pi edge nodes or a distributed office installation, this eliminates the need for centralized patch management, manual SSH sessions, or staged rollouts. The fleet maintains consistency autonomously, reducing operational overhead to near zero.

Why This Matters

The self-improvement engine addresses four critical challenges in autonomous software operation.

Reduced Downtime

Bugs are detected and fixed before users ever encounter them. The continuous test-and-repair cycle means failures are resolved in minutes, not days. Systems stay operational without waiting for a developer to be available, review the issue, and deploy a fix.

Fleet Consistency

Every device in the swarm runs the same validated code. When a fix is broadcast and applied fleet-wide, version drift is eliminated. Administrators do not need to track which devices have which patches or coordinate manual update schedules across dozens of machines.

Autonomous Operation

No developer intervention is required for routine maintenance. The engine handles the complete lifecycle from detection through deployment. This is critical for air-gapped environments, edge deployments, and installations where technical staff are not immediately available.

Continuous Quality

Test coverage directly drives system improvement. Every new test becomes a new diagnostic sensor. As the test suite grows, the self-improvement engine gains more fine-grained visibility into system health and more opportunities to catch and resolve issues early.

Technical Architecture

The self-improvement engine is not a separate system bolted onto Guaardvark. It is built on the same foundational infrastructure that powers every other feature of the platform. This architectural consistency means the engine inherits the reliability, extensibility, and security model of the broader system.

At its core, the engine uses the same ReACT agent framework that drives user-facing AI agents. The ReACT pattern, which interleaves reasoning steps with concrete tool-calling actions, gives the repair agent the ability to think through complex bugs step by step rather than relying on pattern matching alone. The agent can read files, write patches, run commands, inspect logs, and validate changes, all within a single reasoning session.

The agent has access to the complete 30+ tool registry shared across the platform. This includes file system tools (read, write, search, diff), shell execution tools, dependency inspection tools, and git integration tools. The same tools that let a user-facing agent help with code review are the same tools that let the self-improvement agent fix a failing test.

Celery workers handle all test execution in the background. This ensures that the self-improvement cycle never blocks the main application process. Tests run in isolated worker processes, and results are communicated back to the engine through the task queue. This architecture scales naturally: adding more workers allows the engine to run tests faster and process multiple failures in parallel.

Redis pub/sub provides real-time status updates throughout the self-improvement cycle. When tests start running, when a failure is detected, when the agent begins its analysis, when a patch is generated, and when validation completes, each event is published to a Redis channel. The dashboard subscribes to these channels to display live progress. Administrators can watch the engine work in real time, observing each step of the diagnosis and repair process as it unfolds.

Autonomous Zero Human Intervention
ReACT-Powered Reasoning + Acting Agents
Fleet-Wide Broadcast to All Devices

Software That Fixes Itself

Guaardvark is an open-source AI platform with autonomous self-repair built in. Deploy it on your hardware and let the engine handle the rest.

View on GitHub Explore Platform