How Regenesis Built MedShift’s Self-Healing Loop With VectorAI DB
Key Takeaways
- Regenesis uses Actian VectorAI DB as persistent memory so its self-healing agent can recognize failures it has already fixed.
- The agent queries memory before every patch, reusing verified fixes for known failures instead of repeating the full diagnosis cycle.
- Only fixes with outcome: “success” are recalled, keeping failed repairs from resurfacing as solutions.
- Replay Loop QA independently verifies each repair before memory_remember stores the successful fix for future use.
- The approach shows three reusable patterns: index failures by structure, filter memory at recall, and verify every fix before storing it.
This build was originally submitted to the Self-Evolving Agents Hack
An agent that remembers how it fixed that rule yesterday changes what recovery looks like.
That was the problem Regenesis ran into with MedShift, a hospital scheduling application built around a 26-person clinical roster. The system has to keep certification windows, rest requirements, overtime limits, and coverage rules intact. When one of those rules breaks, the agent needs to find the problem, repair it, and make sure the repair actually worked.
Without memory, the agent had no way to tell whether it had seen the same failure before. Every new violation meant starting the diagnosis again. The same root cause could appear through a different entry point and still look novel. The system could recover, but recovery alone left it flat. Every encounter begins from scratch.
Chineseman Lai the builder behind Regenesis, names what changes that: “Actian is the agent’s memory, what makes this evolution rather than retry.”
TL;DR
- MedShift is a hospital shift-scheduling SaaS that detects safety violations, patches the rule that caused them, and verifies every fix before it ships.
- Actian VectorAI DB is the memory layer. The agent embeds each failure as a vector, queries it before every patch, and retrieves verified prior fixes rather than re-diagnosing from scratch.
- On first encounter, VectorAI DB returns cosine=0.00 and the agent runs a full diagnosis cycle. On the second encounter with the same failure, it returns cosine=1.00 and resolves in one step.
- Failed fixes never surface as solutions. The recall filter runs on outcome=”success,” and no fix enters memory until Replay Loop QA confirms the repair held.
- Three patterns transfer to any self-healing agent: index failures by structure not vocabulary, filter memory at recall not at write, and never store a fix before an independent verifier confirms it held.
What Regenesis Changed
To test the loop, Regenesis disabled MedShift’s certification guard. The oracle surfaced 14 real scheduling violations, each computed from the live schedule. The Guild Agent queried Actian VectorAI DB, got back cosine=0.00 with no prior record in memory, then diagnosed the failure from the root cause, patched the broken guard, verified the repair, and stored the fix.
When the same defect surfaced again, VectorAI DB returned cosine=1.00, retrieved the prior fix, and cleared all 14 violations in one step.
That is what persistent memory produces, and Lai described Medshift as “a scheduling SaaS that detects, diagnoses, and repairs its own safety defects, and gets faster every time it sees one.”
Where Actian VectorAI DB Comes In
VectorAI DB is the memory layer that makes the distinction between retry and evolution possible.
The agent embeds each failure shape as a vector and queries VectorAI DB before every patch. When the query returns warm=true, the agent retrieves the verified fix and applies it immediately. When it returns warm=false, the agent treats the failure as novel, diagnoses the root cause, and stores the fix only after external QA confirms the repair held.
Every memory point carries a status that starts as pending. The recall filter runs on outcome: "success", so failed fixes stay out of results permanently. Without that persistent, queryable memory, every failure looks novel, no matter how many times the agent has fixed it before.
How the Self-Healing Loop Works
Regenesis built a four-stage loop: detection, memory query, patching, and external verification. The oracle surfaces the violation. The Guild Agent queries VectorAI DB for a prior fix, retrieves a verified repair when one exists, or flags the failure as novel when it does not. The patch restores the broken guard, and Replay Loop QA, which is Guild’s autonomous quality gate that validates the fix before anything ships. Each stage is independent; therefore, replacing the oracle, swapping the QA gate, or changing the agent framework does not require rebuilding the others.

The MedShift self-healing loop. Oracle, Guild Agent, VectorAI DB, Rules Config (Genome), and Replay Loop QA as the external gate. Arrows show the full cycle, including the memory write on confirmed fix.
The Oracle
The oracle is deterministic, running rule-based checks rather than inference. It audits the live schedule against an immutable spec covering certification windows, rest requirements, overtime limits, and coverage minimums. The spec is signed off once, and the agent never touches it. Only the rules config is mutable.
That separation is what makes the loop trustworthy. Sabotage the rules config and the oracle surfaces real violations from the live schedule, computed from the data. As the README states: “Every bug is genuinely computed, never scripted.” The demo disables the certification guard and produces 14 violations, every one a real scheduling conflict from the live roster computed against the fixed spec.
The Memory Query
Before the agent patches anything, it embeds the failure shape and queries regenesis_memory, a 96-dimensional cosine collection in VectorAI DB. The query filters on outcome: "success", keeping failed fixes out of results. VectorAI DB exposes vector similarity search rather than hybrid search, so Regenesis built its own Reciprocal Rank Fusion layer. Multiple ANN queries run per defect view and the layer fuses their rankings before returning the top hit.
// lib/sponsors/actian.ts — LiveActianClient
// The agent calls search() with must: { outcome: "success" }
// so failed fixes are never surfaced as solutions.
async search(
vector: number[],
opts: { topK?: number; filter?: VectorFilter } = {},
): Promise<VectorHit[]> {
const { hits } = await this.post<{ hits: VectorHit[] }>("/api/memory/search", {
vector,
topK: opts.topK ?? 5,
filter: opts.filter,
});
return hits;
}
function fuse(rankings: VectorHit[][], topK: number): VectorHit[] {
const fused = new Map<string, { hit: VectorHit; score: number }>();
for (const ranked of rankings) {
ranked.forEach((hit, rank) => {
const prev = fused.get(hit.id);
const contribution = 1 / (RRF_K + rank + 1);
if (prev) prev.score += contribution;
else fused.set(hit.id, { hit, score: contribution });
});
}
return [...fused.values()]
.sort((a, b) => b.score - a.score)
.slice(0, topK)
.map(({ hit, score }) => ({ ...hit, score }));
}
search() returns VectorHit[] sorted by cosine similarity descending. cosine=0.00 is a novel failure. cosine=1.00 is an exact match. The agent branches on warm: apply the prior fix immediately or diagnose the root cause. The failure shape captures which guard was violated and in what context, so retrieval turns on the pattern rather than vocabulary.
That, cosine=1.00 on the second encounter, is where the loop proves it is learning: one step instead of the full cycle.
The Patch and the Gate
Patching restores the implicated guard to policy. The repair function maps a finding to the guard that produced it and restores that guard to its specification value, handling any failure type within the oracle’s scope.
After patching, the agent probes again. A clear probe triggers memory_remember, which writes the failure embedding as the vector and {guard, outcome: "success", generation, timesReinforced} as the payload to VectorAI DB.
await client.upsert([{
id: pointIdFor(failureHash),
vector: embed(failureShape),
payload: {
guard,
outcome: "success",
generation,
timesReinforced: 1,
},
}]);
A failed probe writes a negative example with outcome: "failure", which the recall filter excludes permanently. Replay Loop QA then gates deployment, and the fix does not ship until Replay confirms it is clean. Lai’s framing: “The genome is a mutable rules config; memory is a vector collection; natural selection is externally judged QA.”
A compound failure makes the strongest case. One push broke two different guards and produced 27 violations. The agent recalled both findings, applied both patches, verified once, and stored both fixes. It probed, reasoned about what it found, and continued until the schedule was clean.
What You Can Take From This Into Your Own System
Agents can generate fixes. What Regenesis shows is what happens after a fix works. The system records the failure, stores the verified repair, and recognizes it the next time it appears. That is the difference between recovering from an incident and learning from one.
Three patterns from this build transfer directly.
| Pattern | What Regenesis did | What to implement |
| Index failures by shape, not domain vocabulary | 96-dim cosine embedding of failure structure, not free-text | Embed the structured representation of each failure type, not the words used to describe it |
| Filter memory by outcome at recall, not at write | must: {outcome: "success"} in recall query |
Attach outcome to every stored point; run the filter at retrieval time, not when you write |
| Gate every fix externally before storing it | Replay Loop QA verifies the live deployment; memory_remember only runs on a passing probe |
Never write a fix to memory until an independent verifier confirms the repair held |
The third pattern is the one most systems skip. Writing a fix to memory before verifying it means the next recall may surface an unverified solution. In MedShift, that means the agent applies a fix it has never confirmed works, stores it as successful, and repeats the error on the next encounter. The external gate is what makes the memory trustworthy.
In Regenesis, VectorAI DB provides the persistent memory layer that makes this loop possible. You can run it locally with Docker in minutes.
docker run -d --name vectorai -p 6573-6575:6573-6575 \
-e ACTIAN_VECTORAI_ACCEPT_EULA=YES \
-v vectorai_data:/var/lib/actian-vectorai actian/vectorai:latest
Sign up for VectorAI DB Community Edition to get started. Join the Actian community on Discord to ask questions and see what others are building.
This build was originally submitted to the Self-Evolving Agents Hack. You can view the Regenesis project on Github