Skip to main content

Honeycomb-structured lossless context archival for AI agents

Project description

     _____ _____ _____ _____
    / ____/ ___ / _  \/ _  \     COMB
   / /   / / / / / / / /_/ /     Chain-Ordered Memory Base
  / /___/ /_/ / / / / ___ /
  \____/\___/_/ /_/_/   \_\      Lossless context archival
                                  for AI agents.
  

Your AI doesn't need a better summary. It needs a better memory.

Quick StartThe HoneycombArchitectureCLICustom Search

PyPI Python versions Zero deps JSON Hash-linked MIT


COMB is a honeycomb-structured, lossless context archival system for AI agents. Instead of summarizing conversations (lossy), COMB archives the full text as documents in a three-directional graph.

Zero dependencies. Pure Python. Single directory storage. Copy the folder, copy the memory.

Why not just summarize?

Every AI memory system today works the same way: conversations get summarized, compressed, or embedded into vectors. Information is lost at every step. Important details — the user's exact phrasing, the nuance of a disagreement, the specific numbers discussed — vanish.

COMB takes a different approach: keep everything.

Principle
🔒 Lossless Full conversation text, always recoverable
⛓️ Hash-chained Tamper-evident, like a blockchain for conversations
🐝 Three-directional links Navigate by time, by meaning, or by relationship
📐 Schema-on-read Your data, your interpretation
📁 Serverless No database, no server, just files in a directory

Architecture

                    ┌─────────┐
               ╱╲   │ Tier 1  │   Agent's context window
              ╱  ╲  │ Active  │   (not managed by COMB)
             ╱    ╲ └─────────┘
            ╱      ╲
    ┌──────╱────────╲──────┐
    │      Tier 2          │   Today's conversation dumps
    │   Daily Staging      │   Append-only JSONL
    │   (append-only)      │
    └──────────┬───────────┘
               │ rollup()
    ┌──────────▼───────────┐
    │      Tier 3          │   One document per day
    │   Chain Archive      │   Hash-chained
    │                      │   Honeycomb-linked
    └──────────────────────┘
comb/
├── core.py          # CombStore — the main interface
├── staging.py       # DailyStaging — append-only JSONL staging
├── archive.py       # ChainArchive — hash-chained document store
├── document.py      # CombDocument — temporal, semantic, social links
├── honeycomb.py     # HoneycombGraph — three-directional link computation
├── search.py        # BM25Search — zero-dependency full-text search
├── cli.py           # Click CLI — stage, rollup, search, show, verify, stats
└── _utils.py        # Hashing, date helpers

Quick Start

pip install comb-db
from comb import CombStore

# Create a store (just a directory)
store = CombStore("./my-memory")

# Stage today's conversations
store.stage("User asked about encryption. Assistant explained AES-256...")
store.stage("User clarified they need RSA for key exchange...")

# Roll up into the archive
doc = store.rollup()
# → hash-chained, semantic + social links computed automatically

# Search
results = store.search("encryption")
for r in results:
    print(r.date, r.similarity_score)

# Navigate the honeycomb
doc = store.get("2026-02-17")
doc.temporal.prev          # previous day
doc.semantic.neighbors     # similar conversations
doc.social.strengthened    # deepening relationships
doc.social.cooled          # cooling relationships

# Verify integrity
assert store.verify_chain()  # no tampering

The Honeycomb

Every archived document lives in a three-directional graph:

         TEMPORAL ←──→  chronological chain (prev/next hash-linked)
         SEMANTIC ←──→  content similarity (BM25 cosine, top-k neighbors)
         SOCIAL   ←──→  relationship gradient (warming ↔ cooling)

⛓️ Temporal Links

A chronological chain. Each document points to the previous and next day. Hash-linked — if any document is tampered with, the chain breaks. Blockchain-grade integrity for conversation history.

🧠 Semantic Links

Computed via term-frequency cosine similarity (built-in, zero dependencies). The top-k most similar documents are linked automatically during rollup. Plug in your own search backend for better results.

💛 Social Links

The novel part. Conversations have relational temperature. COMB tracks:

  • Inward fade (strengthening) — engagement is increasing, sentiment is warming
  • Outward fade (cooling) — engagement is decreasing, sentiment is cooling

This lets an agent understand not just what was discussed, but how the relationship evolved.

CLI

# Stage from stdin
echo "Today's conversation..." | comb -s ./my-memory stage

# Stage from file
comb -s ./my-memory stage -f conversation.txt

# Roll up
comb -s ./my-memory rollup

# Search
comb -s ./my-memory search "encryption"

# Show a document
comb -s ./my-memory show 2026-02-17

# Verify chain integrity
comb -s ./my-memory verify

# Stats
comb -s ./my-memory stats

Requires pip install comb-db[cli].

Custom Search Backend

The built-in BM25 is good enough for hundreds of documents. For scale, implement the SearchBackend protocol:

from comb import SearchBackend

class MyVectorBackend:
    def index(self, doc_id: str, text: str) -> None:
        ...
    def search(self, query: str, k: int = 5) -> list[tuple[str, float]]:
        ...

store = CombStore("./memory", search_backend=MyVectorBackend())

Storage Format

Everything is JSON. Human-readable. No binary formats. No proprietary encodings.

my-memory/
├── staging/
│   └── 2026-02-17.jsonl    # today's staged conversations
└── archive/
    ├── 2026-02-15.json     # archived, hash-chained
    ├── 2026-02-16.json     # with honeycomb links
    └── 2026-02-17.json

What COMB Is — and Isn't

Is:

  • A file-based archival system for conversation history
  • A tamper-evident chain of daily conversation documents
  • A three-directional graph for navigating memory
  • A zero-dependency library. Portable. Copy the directory, copy the memory.

Isn't:

  • Not a vector database
  • Not a summarization tool
  • Not a real-time retrieval system
  • Not a replacement for your agent's context window

Lineage

COMB descends from HYBRIDbee, a serverless document database. It inherits the philosophy: schema-on-read, single-directory storage, zero configuration.

Requirements

  • Python 3.10+
  • Zero dependencies (stdlib only)
  • Optional: click for CLI

License

MIT


Built by Ava Shakil at Artifact Virtual

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

comb_db-0.1.0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

comb_db-0.1.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file comb_db-0.1.0.tar.gz.

File metadata

  • Download URL: comb_db-0.1.0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for comb_db-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80a9fd87f241a5f9f4208ca37cb4544bf46659ec1846afbe4811e98f57b7e1e8
MD5 2279b523600ea9df0e2e2c2222a5c6b3
BLAKE2b-256 aded9bdb79a38864c6eabbe09e554599976338391bd76288641a35da56e94c9d

See more details on using hashes here.

File details

Details for the file comb_db-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: comb_db-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for comb_db-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09f4412844ed6c561d331f68bb33b46ba28b335c8eda7ac333559d508cf641e2
MD5 1fa062040d03e204413d97a71ffd9be6
BLAKE2b-256 7b525edb5528fcf308405ae6ef57fce9752b910e44fc14dadef3ab847fa8c6fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page