Skip to main content

Module constants

Module constants 

Source
Expand description

Compile-time constants: embedding dimensions, limits and thresholds. Compile-time constants shared across the crate.

Grouped into embedding configuration, length and size limits, SQLite pragmas and retrieval tuning knobs. Values are taken from the PRD and must stay in sync with the migrations under migrations/.

§Cálculo dinâmico de permits de concorrência

O número máximo de instâncias simultâneas pode ser ajustado em runtime usando a fórmula:

permits = min(cpus, available_memory_mb / EMBEDDING_LOAD_EXPECTED_RSS_MB) * 0.5

onde available_memory_mb é obtido via sysinfo::System::available_memory() convertido para MiB. O resultado é limitado superiormente por MAX_CONCURRENT_CLI_INSTANCES e inferiorizado em 1.

Constants§

BATCH_PARTIAL_FAILURE_EXIT_CODE
Exit code para falha parcial de batch (PRD linha 1822). Conflita com DbBusy em v1.x; em v2.0.0 DbBusy migra para 15 e este código assume 13 conforme PRD.
BUSY_TIMEOUT_MILLIS
PRAGMA busy_timeout value applied on every connection.
CACHE_SIZE_KB
PRAGMA cache_size value in kibibytes (negative means KiB).
CHUNK_OVERLAP_TOKENS
Token overlap between consecutive chunks.
CHUNK_SIZE_TOKENS
Chunk size expressed in tokens for body splitting.
CLI_LOCK_DEFAULT_WAIT_SECS
Tempo máximo em segundos que uma instância aguarda para adquirir um slot de concorrência.
CLI_LOCK_EXIT_CODE
Process exit code returned when the lock is busy and no wait was requested (EX_TEMPFAIL).
CLI_LOCK_FILE
Filename used for the advisory exclusive lock that prevents parallel invocations.
CLI_LOCK_POLL_INTERVAL_MS
Polling interval em milliseconds usado por --wait-lock entre tentativas de try_lock_exclusive.
DAEMON_IDLE_SHUTDOWN_SECS
Idle duration in seconds before the daemon shuts itself down.
DAEMON_PING_TIMEOUT_MS
Timeout in milliseconds for a single ping probe against the daemon socket.
DB_BUSY_EXIT_CODE
Exit code para DbBusy em v2.0.0 (migrado de 13 para liberar 13 para batch failure).
DEDUP_FUZZY_THRESHOLD
Jaccard threshold above which two memories are considered fuzzy duplicates.
DEDUP_SEMANTIC_THRESHOLD
Cosine distance threshold below which two memories are semantic duplicates.
DEFAULT_K_RECALL
Default k used by recall when the caller omits --k.
DEFAULT_MAX_HOPS
Default traversal depth for related when --hops is omitted.
DEFAULT_MIN_WEIGHT
Default minimum weight filter applied during graph traversal.
DEFAULT_RELATION_WEIGHT
Default weight assigned to newly created relationships.
EMBEDDING_DIM
Embedding vector dimensionality produced by multilingual-e5-small.
EMBEDDING_LOAD_EXPECTED_RSS_MB
RSS esperado em MiB de uma única instância com o modelo ONNX carregado via fastembed.
EMBEDDING_MAX_TOKENS
Máximo de tokens aceito por embedding input antes de chunking.
FASTEMBED_BATCH_SIZE
Batch size for fastembed encoding calls.
FASTEMBED_MODEL_DEFAULT
Default fastembed model identifier used by remember and recall.
K_ENTITIES_SEARCH
Default k for entity KNN searches during graph expansion.
K_GRAPH_ENTITIES_DEFAULT_LIMIT
Default --limit para graph entities quando omitido.
K_GRAPH_MATCHES_LIMIT
Limite máximo de resultados da CTE recursiva de grafo em recall.
K_HISTORY_DEFAULT_LIMIT
Default --limit para history quando omitido.
K_LIST_DEFAULT_LIMIT
Default --limit para list quando omitido.
K_MEMORIES_DEFAULT
Default k for memory KNN searches when the caller omits --k.
K_RELATED_DEFAULT_LIMIT
Default --limit para related quando omitido.
LOW_MEMORY_EXIT_CODE
Process exit code retornado quando memória disponível está abaixo de MIN_AVAILABLE_MEMORY_MB.
MAX_BODY_CHARS_BEFORE_CHUNK
Body character count above which the body is split into chunks.
MAX_CONCURRENT_CLI_INSTANCES
Número máximo de instâncias CLI em execução simultânea.
MAX_ENTITIES_PER_MEMORY
Upper bound on distinct entities persisted per memory.
MAX_GRAPH_HOPS
Maximum number of hops allowed in graph traversals.
MAX_MEMORY_BODY_LEN
Hard upper bound on memory body length in characters.
MAX_MEMORY_DESCRIPTION_LEN
Maximum character length for a memory description field.
MAX_MEMORY_NAME_LEN
Maximum byte length for a memory name field in kebab-case.
MAX_NAMESPACES_ACTIVE
Limite máximo de namespaces ativos (deleted_at IS NULL) simultâneos. Exit 5 ao exceder.
MAX_RELATIONSHIPS_PER_MEMORY
Upper bound on distinct relationships persisted per memory.
MAX_SQLITE_BUSY_RETRIES
Maximum attempts when a statement returns SQLITE_BUSY.
MIN_AVAILABLE_MEMORY_MB
Memória disponível mínima em MiB exigida antes de iniciar o carregamento do modelo.
MIN_RELATION_WEIGHT
Minimum relationship weight required for traversal inclusion.
MMAP_SIZE_BYTES
PRAGMA mmap_size value in bytes applied to each connection.
NAME_SLUG_REGEX
PRD-canonical regex que valida nomes e namespaces. Permite 1 char [a-z0-9] OU string de 2-80 chars começando com letra e terminando com letra/dígito, contendo apenas [a-z0-9-]. Rejeita prefixo __ (internal reserved).
OMP_NUM_THREADS_DEFAULT
Valor default injetado em OMP_NUM_THREADS quando não definido pelo usuário.
ORT_INTRA_OP_NUM_THREADS_DEFAULT
Valor default injetado em ORT_INTRA_OP_NUM_THREADS quando não definido.
ORT_NUM_THREADS_DEFAULT
Valor default injetado em ORT_NUM_THREADS quando não definido pelo usuário.
PASSAGE_PREFIX
Prefix prepended to bodies before embedding as required by E5 models.
PURGE_RETENTION_DAYS_DEFAULT
Retenção padrão (dias) usada por purge quando --retention-days é omitido.
QUERY_PREFIX
Prefix prepended to queries before embedding as required by E5 models.
QUERY_TIMEOUT_MILLIS
Query timeout applied to statements in milliseconds.
RRF_K_DEFAULT
Default k constant used by Reciprocal Rank Fusion in hybrid-search.
SCHEMA_USER_VERSION
Valor canônico de PRAGMA user_version gravado após migrações.
SQLITE_GRAPHRAG_VERSION
Crate version string sourced from CARGO_PKG_VERSION at build time.
TEXT_BODY_PREVIEW_LEN
Tamanho em caracteres do preview do body emitido em formatos text/markdown.
TEXT_DESCRIPTION_PREVIEW_LEN
Character length of the description preview shown in list output.
WAL_AUTOCHECKPOINT_PAGES
PRAGMA wal_autocheckpoint threshold in pages.
WEIGHT_FTS_DEFAULT
Peso padrão da contribuição textual BM25 na fórmula RRF de hybrid-search.
WEIGHT_VEC_DEFAULT
Peso padrão da contribuição vetorial na fórmula RRF de hybrid-search.