LemonMemory. TaskFingerprint
(lemon_memory v0.1.0)
View Source
Coarse task fingerprint derived from a finalized run.
A fingerprint groups runs by the dimensions that matter for routing decisions:
what the user was trying to do (:task_family), which tools were involved,
which workspace the run belonged to, and which model/provider served it.
Fingerprints are intentionally coarse — granular enough to accumulate signal across similar runs, but not so specific that each run gets its own bucket.
Fields
:task_family— broad semantic category of the task (see "Task families" below):toolset— sorted unique list of tool names used during the run:workspace_key— workspace identifier, ornilfor session-scoped runs:model— LLM model name, ornilif unknown:provider— LLM provider name, ornilif unknown
Task families
| Family | Signals |
|---|---|
:code | Implement, fix, debug, refactor, build, write, test, deploy |
:query | Explain, describe, analyze, compare, review, summarize |
:file_ops | Read, write, create, delete, move, rename, find |
:chat | Short conversational turns (yes/no/thanks/status) |
:unknown | Default when no signal is detected |
Fingerprint key
key/1 serialises a fingerprint to a stable string suitable for use as a
SQLite key or map key. The key is constructed from sorted, lowercased
dimensions joined by | so it remains human-readable in debug output.
Summary
Functions
Classify a prompt text into a task family atom.
Returns the 3-segment context key for cross-model comparison.
Build a TaskFingerprint from a Document.
Serialise a fingerprint to a stable, deterministic string key.
Returns the valid task family atoms.
Types
@type t() :: %LemonMemory.TaskFingerprint{ model: String.t() | nil, provider: String.t() | nil, task_family: task_family(), toolset: [String.t()], workspace_key: String.t() | nil }
@type task_family() :: :code | :query | :file_ops | :chat | :unknown
Functions
@spec classify_prompt(String.t() | nil) :: task_family()
Classify a prompt text into a task family atom.
Returns one of :code, :query, :file_ops, :chat, or :unknown.
Returns the 3-segment context key for cross-model comparison.
Strips the provider and model dimensions so the key can be used to look up historical performance across different models serving the same task context.
Format: family|toolset|workspace
@spec from_document(LemonMemory.Document.t()) :: t()
Build a TaskFingerprint from a Document.
Serialise a fingerprint to a stable, deterministic string key.
The format is family|toolset|workspace|provider|model where each segment
is lowercased and missing values are replaced with "-".
@spec task_families() :: [task_family()]
Returns the valid task family atoms.