🦴 Caveman — The Self-Evolving AI Agent Framework
An AI agent that learns, remembers, and improves itself.
Caveman is an AI agent operating system built around a 6-engine memory flywheel. Unlike agents that forget between sessions, Caveman's knowledge gets richer, more confident, and more useful over time. It audits its own code, learns skills from experience, and compiles knowledge into a structured wiki — all automatically.
What Makes Caveman Different
Most agent frameworks are static tools: you build them, they run, they forget. Caveman is a living system:
- Self-Evolving Skills — The Reflect engine learns patterns from every completed task, creates skills, and evolves them over time
- 3-Layer Knowledge Pyramid — A Wiki Compiler (inspired by Karpathy's LLM Wiki) distills conversations into structured, tiered knowledge
- Knowledge Drift Detection — Detects when memories become stale or contradictory, weakens outdated knowledge automatically
- Self-Auditing Flywheel — Audits and fixes its own code: find bugs → fix → test → commit → learn
- 30 Built-in Tools — From memory search to MCP client to process management to browser automation
- MCP Ecosystem — Both server and client, connecting to thousands of external tools
Architecture
┌──────────────────────────────────────────────────────────────┐
│ CAVEMAN AGENT OS │
│ │
│ ┌─────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Agent │ │ Engines │ │ Memory │ │ Tools │ │
│ │ Loop │──▶│ (6-core) │──▶│ (SQLite │◀──│ (30 │ │
│ │ │ │ │ │ +FTS5) │ │ built-in)│ │
│ └────┬────┘ └──────────┘ └──────────┘ └──────────┘ │
│ │ │
│ ┌────▼────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │Compress-│ │ Wiki │ │ Training │ │ Gateway │ │
│ │ ion │ │ Compiler │ │ Pipeline │ │ (TG/DC) │ │
│ └─────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ │
│ ┌─────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ MCP │ │ Security │ │ Bridge │ │Coordinat-│ │
│ │ Server │ │ (sandbox │ │ (Hermes/ │ │ or │ │
│ │+Client │ │ +crypto)│ │ OpenClaw)│ │ │ │
│ └─────────┘ └──────────┘ └──────────┘ └──────────┘ │
└──────────────────────────────────────────────────────────────┘
Quick Start
pip install caveman-agent
caveman run "What files are in this directory?"
Or interactive mode:
caveman run -i
Other commands:
caveman status # Dashboard: engines, memory, skills
caveman skills # List learned skills
caveman flywheel # Run self-improvement loop
caveman wiki status # Knowledge stats per tier
caveman wiki compile # Compile knowledge (promote + expire)
caveman audit # Static code quality checks
caveman bench # Memory performance benchmarks
caveman self-test # Full lifecycle verification
Cognitive Engines
The 6 engines form a continuous learning flywheel:
Shield → Nudge → Reflect → Ripple → Lint → Recall
↑ │
└───────────── continuous loop ─────────────┘
| Engine | Purpose |
|---|---|
| Shield | Preserves conversation essence across context compressions |
| Nudge | Extracts new knowledge from every interaction |
| Reflect | Learns skills from completed tasks, evolves them over time |
| Ripple | Propagates knowledge updates across related memories |
| Lint | Detects stale or contradicted knowledge, weakens confidence |
| Recall | Restores relevant context at session start |
Plus a scheduler that orchestrates engine execution based on priority and resource availability.
Wiki Compiler
Inspired by Karpathy's LLM Wiki, the Wiki Compiler organizes all knowledge into a 4-tier pyramid:
Procedural ← workflows and patterns (months, never expires)
Semantic ← cross-session facts (weeks)
Episodic ← session summaries (days)
Working ← recent observations (hours)
Knowledge automatically promotes upward as it proves useful and expires downward when stale.
Tools (30)
| Category | Tools |
|---|---|
| Shell | bash |
| Files | file_read, file_write, file_edit, file_search, file_list |
| Web | web_search, browser |
| Memory | memory_search, memory_store, memory_recent |
| Process | process_start, process_list, process_output, process_kill |
| Agent | delegate, coding_agent |
| Todo | todo_add, todo_list, todo_done, todo_remove |
| Skills | skill_list, skill_show, skill_delete |
| Vision | vision_describe |
| MCP | mcp_connect, mcp_list_tools, mcp_call, mcp_disconnect |
| Gateway | gateway_send, gateway_list |
| Checkpoint | checkpoint_save, checkpoint_restore, checkpoint_list |
MCP Server
Expose Caveman's memory to any MCP-compatible agent (Claude Code, Codex, Gemini CLI):
{
"caveman": {
"command": "caveman",
"args": ["mcp", "serve"]
}
}
Tools exposed: memory_store, memory_search, memory_recall, shield_save, shield_load, reflect, skill_list, skill_get, wiki_search, wiki_context.
Self-Improvement Flywheel
Caveman can audit and fix its own code:
┌─────────────────────────────────────────┐
│ FLYWHEEL LOOP │
│ │
│ Discover subsystems │
│ ↓ │
│ Audit each (P0/P1/P2 findings) │
│ ↓ │
│ Fix P0 + P1 issues │
│ ↓ │
│ Run tests (must pass) │
│ ↓ │
│ Commit │
│ ↓ │
│ Record stats → learn from patterns │
│ ↓ │
│ Next round │
└─────────────────────────────────────────┘
Run it: caveman flywheel --rounds 3 --target memory
Parallel mode: caveman flywheel --parallel --targets memory,engines,tools
Standing on Giants
Caveman incorporates battle-tested patterns from open-source projects:
- Hermes (MIT) — Compression, retrieval, error classification, credential management
- OpenClaw (MIT) — Compaction safeguards, identifier preservation
- Karpathy's LLM Wiki — Wiki compilation pattern
- Memento-Skills — Reflect-Write skill evolution
Stats
- 159 Python files (core)
- 24,600+ lines of code
- 1,253 tests (unit + integration)
- 20 subsystems
- 30 tools
- 6 cognitive engines
- 170 commits
- Self-audited through 94 rounds
License
MIT
Metadata
Release files for caveman-agent 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| caveman_agent-0.3.0.tar.gz | 455.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| caveman_agent-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 853.4 kB
Release files / caveman_agent-0.3.0.tar.gz
| Download URL | caveman_agent-0.3.0.tar.gz |
|---|---|
| Size | 455.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c867289621e6423ab70fee8501e3ffa00be7c81ae662b4e6bb0f73f705e94bec
|
|
BLAKE2b-256 checksum How to use checksums |
aca1df9fbc10b02d5d37ce60455c9b86fcec9d0d9dd7d4dc0fea9d01bb827356
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / caveman_agent-0.3.0-py3-none-any.whl
| Download URL | caveman_agent-0.3.0-py3-none-any.whl |
|---|---|
| Size | 398.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5e1ab3c872bc716bfa4cc3b611e93f2fba735ca43b4f937d5f4b0995375d551
|
|
BLAKE2b-256 checksum How to use checksums |
03dd0e8dd440cde2d0670ad672c67a0c5e80c8374840aa4ef6d6ec76bcbdd7a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Security for caveman-agent 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.