memlocal_dart 1.0.1
memlocal_dart: ^1.0.1 copied to clipboard
Local AI memory layer for Flutter. Sensory, short-term, and long-term memory with LLM-driven extraction, vector search, graph relationships, and full-text search. Built on CozoDB.
1.0.1 #
bug fixes #
- fixed CozoDB Datalog parse failures on special characters — all write operations (
putMemory,putMessage,putProfile,putProspective,putEdge) now use parameterized queries instead of inline string interpolation. Content containing markdown (**bold**), emoji, JSON braces, or quotes no longer crashes the Datalog parser. - fixed FTS query parse errors on punctuation — user queries containing
?,.,,,+,*,"and other punctuation are now sanitized before reaching CozoDB's BM25 engine. A new_sanitizeFtsQuery()strips all non-word characters. - fixed crash on empty FTS queries — queries that sanitize to an empty string (e.g., just
?) now return an empty result set immediately instead of throwingexpected fts_expr. - fixed "I could not generate a response" fallback — when the LLM returns empty text after a tool call, the system now falls back to the pre-tool response text, then to a neutral
'Done.'instead of showing an error message. - fixed "Done." appearing on question-answering queries — added a text nudge in the tool-result turn for Anthropic and OpenAI providers, ensuring the model always produces a text response after tool execution instead of staying silent.
temporal memory #
- relative date resolution — when users mention relative dates ("tomorrow", "Saturday", "next week"), the extraction pipeline now resolves them to absolute ISO 8601 datetimes using the current date and time. Resolved dates are written into both the memory content and the
valid_at/invalid_attemporal fields. - temporal validity windows — extracted memories with time-anchored events now populate
valid_at(start) andinvalid_at(expiry) fields. Single-day events setinvalid_atto end-of-day (T23:59:59). - timezone-aware extraction — the extraction prompt now includes the local UTC offset (e.g.,
+05:30). Parsed datetimes are normalized to local time via.toLocal(), ensuring correct epoch storage regardless of LLM output format.
chat improvements #
- current date in system prompt — the chat system prompt now includes
Today is {day}, {date} {UTC offset}, preventing the LLM from hallucinating wrong days-of-week when answering temporal queries.
1.0.0 #
initial release #
a local AI memory layer for Flutter, built on CozoDB.
memory taxonomy #
- sensory memory — ephemeral ring buffers with configurable capacity and TTL for raw signals (audio chunks, camera frames, sensor telemetry).
- short-term memory — conversation buffer (sliding window of recent messages), working memory (per-session scratch pad), attention context.
- long-term memory — 8 persistent subtypes:
- episodic — past conversations and events with temporal context.
- semantic — general knowledge facts with deduplication.
- factual — user profile data and preferences as key-value pairs.
- procedural — skills, workflows, SOPs, and prompt recipes.
- social — contact graph with relationships, path finding, and PageRank via CozoDB graph algorithms.
- spatial — location-tagged memories with Haversine distance queries.
- prospective — reminders, follow-ups, and condition-triggered tasks.
- affective — sentiment tracking and tone preference history.
LLM providers #
- Anthropic: Claude Sonnet 4.6, Claude Haiku 4.5.
- OpenAI: GPT-5.2, GPT-5 Mini.
- Google: Gemini 3.1 Pro Preview, Gemini 3 Flash Preview.
- custom: any OpenAI-compatible endpoint.
embedding #
- OpenAI
text-embedding-3-small(1536 dimensions) as default. - configurable provider and dimensions.
storage #
- persistent SQLite via
CozoDatabase.openSqlite(). - in-memory mode for testing.
- idempotent schema creation with
:createand graceful conflict handling. - 5 core relations:
mem_items,mem_edges,mem_conversations,mem_profiles,mem_prospective. - 3 indices: HNSW vector index, full-text search index, LSH index.
search #
- 4 search modes:
semantic(vector k-NN),text(full-text search),graph(relationship traversal),hybrid(all three merged and re-ranked).
extraction pipeline #
- LLM-driven fact extraction from conversations.
- automatic memory type classification.
- deduplication via content hashing and vector similarity.
- reconciliation: ADD, UPDATE, DELETE, or NONE actions with full audit history.
- user profile synthesis from accumulated memories.
tool calling #
- 10 memory tools:
memory_add,memory_search,memory_get,memory_get_all,memory_update,memory_delete,memory_profile,memory_context,memory_schedule_reminder,memory_social_relation. - provider-native tool definitions for Anthropic, OpenAI, Google, and custom formats.
- tool executor with timing metrics.
context assembly #
getContext()assembles LLM-ready context from user profile, relevant memories, recent conversation, and pending reminders.
example app #
- full chat application with memory-augmented LLM responses.
- inline memory info cards showing retrieval/storage timing with color-coded duration chips.
- memory browser tab with type filtering and search mode selection.
- settings tab with provider selection, API key configuration, and
.envsupport. - markdown rendering in chat messages (bold, italic, code, strikethrough).
- multi-turn tool calling with proper conversation threading for all 3 provider families.
platform support #
- Android, iOS, macOS, Linux, Windows.