An industrial-grade background memory daemon and token compactor. Silently index, monitor, and inject semantic insights into active context windows via ChromaDB and FileSystem Watchdogs.
Quickstart β’ The Paradigm Shift β’ CLI Reference β’ Architecture β’ Subsystems β’ API Reference β’ Comparison Matrix β’ Roadmap
AI agents fail when their conversational context grows too large, causing LLM context limits to trigger or query latency to spike. Standard memory retrieval engines are too slow, relying on heavy REST network requests that interrupt active coding execution loops.
AntiMem resolves this by shifting memory management to a lightweight local edge daemon:
- Real-time Event Watchers: Uses OS-level file system notifications to monitor active conversation transcripts in the background without poll loops.
- Local Vector Caching: Stores, index, and retrieves semantic matches instantly from an embedded local ChromaDB instance using fast inference.
- Canary-Gated Compaction: Employs an 80/20 CRDT tombstone compression pipeline that reduces log sizes by 80% while retaining critical entity structures.
- Cross-Platform Lock Guards: Utilizes platform-agnostic file lock mechanisms (
msvcrton Windows,fcntlon Unix) to prevent concurrency race conditions.
- Python 3.11+
- uv (recommended for rapid dependency syncing)
- Ollama running locally on your system for LLM summarization
git clone https://github.com/axtontc/AntiMem.git
cd AntiMem
# Sync virtual environment using uv
uv syncEnsure the indexer, prompt extraction rules, and compactor work locally:
uv run python -m pytest tests/ -vLaunch the background watcher daemon to scan skills and actively monitor conversation transcripts:
antimem startCompresses logs exceeding token boundaries by replacing the oldest 80% with an LLM-synthesized summary (CRDT Tombstone):
antimem compact --file "C:/path/to/transcript.jsonl" --threshold 4000flowchart TD
A[Agent Workspace File] -->|OS File System Event| B[Watchdog Event Handler]
B -->|Submit Task| Pool[ThreadPoolExecutor]
Pool -->|Extract Prompts| C[ChromaDB Indexer]
C -->|Retrieve Past Insights| D[Semantic Query]
D -->|Ollama Synthesis Prompt| E[LLM Local Synth]
E -->|JSON Payload| F[JSON File Injection]
F -->|Write-Ahead File Lock| A
style B fill:#1a1a2e,stroke:#3776AB,color:#fff
style Pool fill:#16213e,stroke:#3776AB,color:#fff
style C fill:#16213e,stroke:#3776AB,color:#fff
style F fill:#2ea043,stroke:#2ea043,color:#fff
| Subsystem | Folder / File | Responsibility |
|---|---|---|
| CLI Router | antimem/cli.py |
Routes arguments to starting watchers or triggering compactors |
| Watcher Daemon | antimem/core/daemon.py |
Initializes persistent ChromaDB collections, parses directories, and manages watchdog events |
| CRDT Compactor | antimem/core/compactor.py |
Performs 80/20 file splits, generates LLM summaries, and writes locked tombstone divisions |
| Skill Registry | antimem/core/daemon.py |
Scans workspace markdown configurations to automatically extract and register capabilities |
These functions manage background watchers and semantic indexing:
| Function / Method | Parameters | Description |
|---|---|---|
AntimemIndexer.index_skills() |
None | Discovers and indexes markdown headers and description profiles in global config spaces. |
AntimemIndexer.query(text, limit) |
str, int |
Conducts query matching on vector spaces returning high-similarity results. |
TranscriptHandler.on_modified(event) |
FileSystemEvent |
Watchdog routine detecting modification logs, extracting prompts, and injecting synth context. |
This class drives file context compaction:
| Function / Method | Parameters | Description |
|---|---|---|
Compactor.compact() |
None | Locks target files, runs token heuristics, prompts Ollama, and commits tombstones. |
| Feature | Standard Chroma | pgvector-only | memmcp | AntiMem |
|---|---|---|---|---|
| Edge Watchdog Triggers | β | β | β | β Yes (Watchdog) |
| 80/20 CRDT Compactor | β | β | β | β Yes (Tombstones) |
| Background Thread Injection | β | β | β | β Yes (Non-blocking) |
| Fast Local Storage | β Yes | β | β Yes | β‘ High performance (<3ms local) |
- Core Language: Python 3.11+
- Vector Store: ChromaDB (persistent client)
- File Monitor: watchdog (OS-level notifications)
- Model Inference: Ollama (Qwen2.5-coder & nomic-embed-text)
- Testing & Formatting: pytest, Ruff, mypy
- Persistent local ChromaDB integration
- OS-level Watchdog event listening loop
- Non-blocking thread pool execution
- 80/20 CRDT tombstone log compression
- Cross-platform file locking support
- Increment Vector Deletes β Implement direct deletion pipelines when files are modified or deleted
- Smarter Tokenizer β Switch from character heuristics to tiktoken embeddings calculations
- Visual Admin UI β Add a micro-dashboard to inspect indexed skills and memories visually
AntiMem acts as the context injection daemon of the Antigravity Swarm ecosystem:
| Project | Description |
|---|---|
| AUI | Zero-latency cross-process UI automation for Windows and Web |
| MemMCP | Stdio-transport memory server using SQLite WAL and FAISS RRF |
| The-Skillbrary | FastMCP skill execution server and registry |
| Multiverse-Planner | Brute-forces optimal plans via timeline expansion and pruning |
| Fractal-Swarm-v2 | Mathematically optimal state-machine agent swarm orchestration |
| OmniMem | PostgreSQL hybrid memory system for large enterprise swarms |
| The-Sentinel-Reviewer | Code quality gatekeeper running static audits, tests, and deep traces |
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details. Copyright (c) 2026 Axton Carroll.
β If AntiMem helps keep your agentic contexts clean, consider giving it a star!
Built by Axton Carroll β "Nothing is impossible, we merely don't know how to do it yet."
