A simple key-value store that gives tool-calling models a basic persistent storage capability, backed by SQLite.
Parts of this implementation were originally inspired by dirty-data/persistent-memory, itself a fork of khtsly/persistent-memory.
I built this to evaluate how well small models can create their own schemes/protocols for using well-defined persistent storage tools to manage higher-order goals.
~/.lmstudio/plugin-data/student489/kv-store/.You have access to KV store tools, which allow you to store and retrieve data. First, test these KV store tools. Then, create a plan/scheme/protocol to describe how you would use these KV store tools to plan and track multi-step tasks. Then, present the plan for review and refinement.
The plugin exposes the following tools to models:
| Tool | Parameters | Behavior |
|---|---|---|
kv_set | key: string, value: string | Sets or replaces a text (string) value. Key length must be 1 to 255 characters. Value length must be at most 10,240 characters (10 KB equivalent). Returns { ok: true, size } on success, { ok: false, error } on failure. |
kv_get | key: string | Returns value for a key. If not found, returns found=false, value=null, and size=null. Returns { ok: true, found, value, size } on success, { ok: false, error } on failure. |
kv_append | key: string, value: string | Appends text to the current value for a key, creating the key if it does not already exist. Returns the post-append value in the same shape as kv_get: { ok: true, found, value, size } on success, { ok: false, error } on failure. |
kv_get_many | keys: string[] | Gets values for multiple keys (1 to 10 keys per call). Returns { ok: true, pairs } on success, where pairs is an array of { key, value, size }. Only keys that exist are returned. Returns { ok: false, error } on failure. |
kv_delete | key: string | Deletes a key. No-op if it does not exist. Returns { ok: true } on success, { ok: false, error } on failure. |
kv_delete_many | keys: string[] | Deletes multiple keys in a single call (1 to 10 keys per call). Missing keys are ignored. Returns { ok: true } on success, { ok: false, error } on failure. |
kv_rename | oldKey: string, newKey: string | Renames a key while preserving its value. Fails if the source key does not exist or the destination key already exists. Returns { ok: true } on success, { ok: false, error } on failure. |
kv_list_keys | limit?: number, offset?: number | Lists keys in sorted order with optional pagination. Maximum 200 keys per call. Returns { ok: true, keys } on success, { ok: false, error } on failure. |
kv_filter_keys | match: string, limit?: number, offset?: number | Lists keys containing match (case-insensitive), with optional pagination. Maximum 200 keys per call. Returns { ok: true, keys } on success, { ok: false, error } on failure. |
kv_count_keys | filter?: string | Counts total keys. If filter is provided, counts only keys containing the filter substring (case-insensitive), like kv_filter_keys. Returns { ok: true, count } on success, { ok: false, error } on failure. |
get_current_timestamp | none | Returns the current UTC time in ISO 8601 format as { timestamp }. Disabled by default; enable via plugin setting. |
DB storage filename (dbStorageFilename)
~/.lmstudio/plugin-data/student489/kv-store/.Enable timestamp utility tool (enableTimestampUtilityTool)
get_current_timestamp tool is exposed to models.on or off.off.The plugin uses sql.js as the database engine, which is a JavaScript port of SQLite.
The database schema contains a single table kv_store with the following columns:
key (TEXT PRIMARY KEY): The key of the key-value pair.value (TEXT): The value of the key-value pair, stored as string.created_at (DATETIME): The timestamp when the key-value pair was created.updated_at (DATETIME): The timestamp when the key-value pair was last updated.MIT