Like many developers, I started building LLM agents by stringing together API calls and hoping for the best. It worked, for a while. My agents could browse the web, execute code, and call APIs. They could decompose tasks into sub-steps.
Then I hit a wall.
Every morning, I would wake up to logs of failures I'd seen the day before. The same buggy code modifications. The same incorrect API parameters. The same flawed reasoning paths — repeated, session after session, as if the agent had learned nothing. Because it hadn't. Every conversation was a fresh start.
I spent months trying to fix this. I tried prompt engineering. I tried better tool definitions. I tried chaining. Nothing worked, because the problem wasn't in any single interaction — it was in how we build agents. We were building them as functions, when they should be built as living systems.
What GBase Is
GBase is an open-source Python framework that gives LLM agents three capabilities most frameworks don't:
- A Recursive Self-Improvement (RSI) Engine — a closed loop where an agent's code changes are automatically triggered, evaluated across stability/performance/security, accepted or rolled back, and diagnosed after failure.
- Mirror Memory — long-term memory using the Ebbinghaus forgetting curve, with verification reinforcement. Not just a vector store — memories decay like human memories, and verified knowledge fades slower.
- Quality Gate Pipelines — multi-agent collaboration through YAML-defined workflows with JSONL audit trails.
It's MIT-licensed, runs on real infrastructure (not sandboxes), and is already in production.
The Problem We All Face
Every major agent framework — BabyAGI, AutoGPT, LangChain — shares a common limitation: the agent does not learn from its own execution history. When it fails, it fails the same way next time. There's no memory of past mistakes, no improvement between sessions.
Recursive Self-Improvement (RSI) has been discussed in AI safety literature for decades. But there's a big gap between "RSI as an idea" and "RSI as a deployable system." Most work falls into two camps:
- Theoretical frameworks that never ship code
- Sandboxed experiments where agents modify themselves inside Minecraft
Neither addresses the hard question: how do you let an agent modify itself in production, without breaking everything?
How GBase Works
The RSI Loop (Four Stages)
Stage 1: Trigger Evaluation — Not every change should trigger a full RSI cycle. Rules filter by file path, change size, and frequency. Trivial changes are silently skipped.
Stage 2: Multi-Perspective Evaluation — Three independent checks:
- Stability: Does the code parse? Are imports valid?
- Performance: Any redundant operations introduced?
-
Security: Any
eval(), shell injection, or dangerous patterns?
Stage 3: Rollback Decision — Stability failure = immediate rollback. Performance/security failure = conditional. Multiple failures = rollback + diagnostic.
Stage 4: Post-Failure Diagnosis — The system captures state before/after rollback, logs the report, and verifies health. The diagnosis is written to Mirror as experiential memory.
Mirror Memory with Ebbinghaus Decay
Most agent memory uses RAG (vector retrieval). It works, but it doesn't model decay — a fact from yesterday and a fact from six months ago are treated equally.
Mirror applies a modified Ebbinghaus formula:
S(t) = S₀ × exp(-t / (λ × (1 + α × V + β × f)))
Where V = verification count, f = access frequency. Memories that have been verified decay slower. Frequently accessed memories decay slower. This mirrors the spacing effect in human memory.
Periodic review identifies decaying memories, attempts re-verification, and removes stale or contradictory information.
Quality Gate Pipelines
Multi-agent collaboration through structured YAML pipelines:
steps:
- role: hammer
task: Generate code solution
- role: ink
task: Review hammer's solution
- role: judge
task: Final verdict
All inputs and outputs are serialized to JSONL — creating an auditable, deterministic trail. No LLM consensus debate needed.
Real Results (Yes, Numbers)
We ran 100 RSI cycles on a production GBase instance. Here's what happened:
| Metric | Value |
|---|---|
| Total RSI cycles | 100 |
| Trigger rate | 93.0% |
| Evaluation pass rate | 90.3% |
| Auto-rollback rate | 0% |
| Skipped (too small to matter) | 7.0% |
Of the 93 triggered cycles, 9 failed security evaluation — catching patterns like eval() usage and shell injection correctly. All 93 passed stability and performance checks.
The full experimental scripts and raw data are in the repository.
Standing on Shoulders
I want to be clear about something: I didn't build GBase because I'm smart. I built it because I was frustrated, and then I was inspired.
Reflexion [Shinn et al., 2023] showed me agents could reflect on their own failures. CRITIC [Gou et al., 2024] showed me evaluation tools could enable self-correction. BabyAGI [Nakajima, 2023] showed the world that autonomous agents were possible. AutoGPT demonstrated what happened when you gave an agent real tools. LangChain [Chase, 2023] made agent building accessible to everyone. AutoGen [Wu et al., 2023] and MetaGPT [Hong et al., 2023] showed me the power of multi-agent collaboration. The Generative Agents project at Stanford [Park et al., 2023] demonstrated agents that remember and grow.
Every one of these projects gave me the courage to build something that didn't exist yet. This paper is my way of saying thank you.
What's Next
GBase is not finished. It's not perfect. But it works, in production, right now.
If you're building agents and you've felt the same frustration I felt — watching the same failures repeat, session after session — I invite you to look at the code, try the framework, and tell me what's missing.
The code is at https://github.com/garyqlin/gbase — MIT licensed.
References
- Shinn et al. (2023). Reflexion. arXiv:2303.11366
- Gou et al. (2024). CRITIC. arXiv:2305.11738
- Wang et al. (2024). Survey on LLM based Autonomous Agents. arXiv:2308.11432
- Park et al. (2023). Generative Agents. arXiv:2304.03442
- Wu et al. (2023). AutoGen. arXiv:2308.08155
- Hong et al. (2023). MetaGPT. arXiv:2308.00352
- Nakajima (2023). BabyAGI
- Significant Gravitas (2023). AutoGPT
- Chase (2023). LangChain
- Ebbinghaus (1885). Über das Gedächtnis
Code: https://github.com/garyqlin/gbase
Website: https://opprimeworld.com
Top comments (0)