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
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.Newon 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]- 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]
License
This project is licensed under the MIT LICENSE.
Author
Just open an issue to share an idea.
©️ 2026 邱敬幃 Pardn Chiu