v0.7.0

pardnchiu/ToriiDB

Last updated

NoteThis README was generated by SKILL, get the ZH version from here.



EMBEDDED JSON KV STORAGE WITH A SHARED SOCKET DAEMON AND VECTOR SEARCH


Go ReferenceReleaseLicense




A Go embedded key-value database with Redis-style commands, a shared socket daemon, and vector search

NoteToriiDB is built primarily as the storage layer for Agenvoy, a Go AI agent harness by Pardn Chiu; Agenvoy processes share one ToriiDB socket daemon for session history, tool cache, tool error memory, and vector search over past conversations. See ToriiDB in Agenvoy for which Agenvoy feature uses which database.

Table of Contents



Features


go get github.com/pardnchiu/toriidb · Documentation

  • One Daemon Per Directory — The first process to call daemon.New on a data directory serves a unix socket, and every later caller becomes a client using the same Get/Set/Del methods.
  • Crash-Safe Snapshot Persistence — Every write is fsynced to an append log, and compaction atomically swaps in a new snapshot while keeping the previous generation for fallback replay.
  • JSON Field Mutation — Read, set, increment, and delete nested fields with dot notation, and filter documents with AND/OR/NOT query expressions.
  • Built-In Vector Search — Attach OpenAI embeddings in the background, reuse cached vectors, and rank keys by cosine similarity with glob filters.
  • Redis-Style Command Router — Run 17 commands across 16 isolated databases with TTL expiry, from the REPL or the Go API.

Architecture


Full Architecture

graph TB
    APP[Go Application] --> NEW[daemon.New]
    NEW -->|socket is live| CLI[Unix Socket Client]
    NEW -->|first caller| SRV[Socket Server and Store]
    CLI --> SRV
    REPL[REPL] --> OPS[Command and API Operations]
    SRV --> OPS
    OPS --> DBS[16 In-Memory Databases]
    DBS --> DISK[Snapshot and Append Log]
    OPS --> EMB[OpenAI Embeddings]
  1. graph TB
  2. APP[Go Application] --> NEW[daemon.New]
  3. NEW -->|socket is live| CLI[Unix Socket Client]
  4. NEW -->|first caller| SRV[Socket Server and Store]
  5. CLI --> SRV
  6. REPL[REPL] --> OPS[Command and API Operations]
  7. SRV --> OPS
  8. OPS --> DBS[16 In-Memory Databases]
  9. DBS --> DISK[Snapshot and Append Log]
  10. OPS --> EMB[OpenAI Embeddings]

License


This project is licensed under the MIT LICENSE.

Author


Just open an issue to share an idea.
toriidb contributors


©️ 2026 邱敬幃 Pardn Chiu
中文