Skip to content

axtontc/AntiMem

AntiMem Memory compactor Banner

Status Python License CI


🧠 AntiMem β€” Edge-Native Memory Daemon & CRDT Compactor

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


πŸ’‘ The Paradigm Shift

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:

  1. Real-time Event Watchers: Uses OS-level file system notifications to monitor active conversation transcripts in the background without poll loops.
  2. Local Vector Caching: Stores, index, and retrieves semantic matches instantly from an embedded local ChromaDB instance using fast inference.
  3. Canary-Gated Compaction: Employs an 80/20 CRDT tombstone compression pipeline that reduces log sizes by 80% while retaining critical entity structures.
  4. Cross-Platform Lock Guards: Utilizes platform-agnostic file lock mechanisms (msvcrt on Windows, fcntl on Unix) to prevent concurrency race conditions.

⚑ Quickstart

Prerequisites

  • Python 3.11+
  • uv (recommended for rapid dependency syncing)
  • Ollama running locally on your system for LLM summarization

1. Clone & Setup

git clone https://github.com/axtontc/AntiMem.git
cd AntiMem

# Sync virtual environment using uv
uv sync

2. Verify with the Test Suite

Ensure the indexer, prompt extraction rules, and compactor work locally:

uv run python -m pytest tests/ -v

πŸ› οΈ CLI Reference

1. Start the Memory Daemon

Launch the background watcher daemon to scan skills and actively monitor conversation transcripts:

antimem start

2. Compact Context File

Compresses 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 4000

πŸ— Architecture

flowchart 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
Loading

πŸ—οΈ Core Subsystems

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

πŸ“– API & Core Functions Reference

antimem/core/daemon.py

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.

antimem/core/compactor.py

This class drives file context compaction:

Function / Method Parameters Description
Compactor.compact() None Locks target files, runs token heuristics, prompts Ollama, and commits tombstones.

πŸ“Š Comparison Matrix

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)

🧰 Tech Stack

  • 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

πŸ—ΊοΈ Roadmap

  • 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

πŸ”— Ecosystem Cross-Linking

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

πŸ“œ License & Copyright

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!

GitHub Stars

Built by Axton Carroll β€” "Nothing is impossible, we merely don't know how to do it yet."

About

Context-Gated Memory Daemon and CRDT 80/20 Compactor for Antigravity.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages