Expand description
§sqlite-graphrag
Local GraphRAG memory for LLMs in a single SQLite file — zero external services required.
sqlite-graphrag is a CLI-first library that persists memories, entities and
typed relationships inside a single SQLite database. It combines FTS5
full-text search with sqlite-vec KNN over locally-generated embeddings to
expose a hybrid retrieval ranker tailored for LLM agents.
§CLI usage
Install and initialize once, then save and recall memories:
cargo install sqlite-graphrag
sqlite-graphrag init
sqlite-graphrag remember \
--name onboarding-note \
--type user \
--description "first memory" \
--body "hello graphrag"
sqlite-graphrag recall "graphrag" --k 5§Crate layout
The public modules group the CLI, the SQLite storage layer and the
supporting primitives (embedder, chunking, graph, namespace detection,
output, paths and pragmas). The CLI binary wires them together through the
commands in commands.
§Exit codes
Errors returned from errors::AppError map to deterministic exit codes
suitable for orchestration by shell scripts and LLM agents. Consult the
README for the full contract.
Modules§
- chunking
- Token-aware chunking utilities for bodies that exceed the embedding window.
- cli
clapdefinitions for the top-levelsqlite-graphragbinary.- commands
- Subcommand handlers wired into the
claptree fromcli. - constants
- Compile-time constants: embedding dimensions, limits and thresholds. Compile-time constants shared across the crate.
- daemon
- Daemon IPC for persistent embedding model reuse across CLI invocations.
- embedder
- Local embedding generation backed by
fastembed. - errors
- Library-wide error type and the mapping to process exit codes (see
errors::AppError). Library-wide error type. - graph
- Graph traversal helpers over the entities and relationships tables.
- i18n
- Bilingual message layer for human-facing stderr progress (
--lang en|pt,SQLITE_GRAPHRAG_LANG). Camada bilíngue de mensagens humanas. - lock
- Semáforo de contagem via lock files para limitar invocações paralelas (veja
lock::acquire_cli_slot). Semáforo de contagem via lock files para limitar invocações paralelas do CLI. - memory_
guard - Guarda de memória: verifica disponibilidade de RAM antes de carregar o modelo ONNX. Guarda de memória: verifica disponibilidade de RAM antes de carregar o modelo ONNX.
- migrations
- namespace
- Namespace resolution with precedence between flag, environment and markers.
- output
- Centralized stdout/stderr emitters for CLI output formatting.
- parsers
- Parser de argumentos dual-format: aceita Unix epoch e RFC 3339.
- paths
- Filesystem paths for the project-local database and app support directories.
- pragmas
- SQLite pragma helpers applied on every connection.
- storage
- Persistence layer: memories, entities, chunks and version history.
- tokenizer
- Tokenizer real do modelo de embeddings para contagem e chunking por tokens reais.
- tz
- Fuso horário de exibição para campos
*_iso(flag--tz, envSQLITE_GRAPHRAG_DISPLAY_TZ, fallback UTC). Fuso horário de exibição para campos*_isodo JSON de saída.
Statics§
- SHUTDOWN
- Sinaliza que um sinal de encerramento (SIGINT / SIGTERM / SIGHUP) foi recebido.
Functions§
- shutdown_
requested - Retorna
truese um sinal de encerramento foi recebido desde o início do processo.