Knowledge Store
Knowledge Store
Details
Persistent JSONL key-value knowledge base. Each entry stores a key, value, optional metadata, and timestamp.
Methods
Method new()
Create a new knowledge store.
Usage
knowledge_store$new(path = NULL, encryption_key = NULL, audit_log = NULL)Arguments
pathOptional file path for JSONL persistence.
NULLfor in-memory only.encryption_keyRaw 32-byte key for AES-256-CBC encryption at rest, or
NULLto check theSECURECONTEXT_ENCRYPTION_KEYenv var. If neither is set, data is stored unencrypted.audit_logOptional path to a JSONL audit log file. If non-NULL, store operations are logged via
log_store_event().
Method set()
Set a key-value pair (upsert).
Usage
knowledge_store$set(key, value, metadata = list())Method get()
Get a value by key.
Method search()
Search keys by regex pattern.
Method list()
List all keys.
Examples
ks <- knowledge_store$new()
ks$set("color", "blue", metadata = list(source = "test"))
ks$get("color")
#> [1] "blue"
ks$search("col")
#> [1] "color"
ks$size()
#> [1] 1