sqlite

Tag

Cards List
#sqlite

@meow2149: How Should You Design a Long-Term Memory System When Building Your Own Agent? Recently I studied the memory mechanisms behind Codex, Claude Code, OpenClaw, Hermes Agent, and other products, along with research in the Agent Memory field. If I were to design one, I would build a dedicated memory subsystem (Memory Subsystem) in the Harness, consisting mainly of the following nine parts. 1、Memory Admission Use an LLM with Structured Output to extract user preferences, historical decisions, domain knowledge, and execution experience from authorized historical conversations and task execution records. Filter memories based on long-term value, applicability, and evidence quality, distinguishing between explicit user statements, external observations, and model inferences. Unverified inferences are kept only as candidate memories and are not treated as confirmed facts. Every memory retains its original source and source category. Sensitive information that should not be retained is filtered during the data collection stage, and authorization for retaining historical records is managed separately from authorization for using cross-session memories. 2、Hierarchical Memory Use a three-tier memory structure: ▪︎ L0: Core memory and navigation index. ▪︎ L1: Structured facts, domain knowledge, and task experience. ▪︎ L2: Raw conversations, tool calls, and execution records. Combined with Progressive Disclosure, new sessions load a permission-filtered L0 by default, L1 is retrieved on demand, and L2 is used to trace back to raw evidence the agent has permission to access. A fixed token budget is set for core memory to prevent the resident context from growing continuously as memory volume increases. Memory tier determines how information is loaded, not its credibility. 3、Dual-path Writing When a user explicitly requests saving, correcting, or deleting a memory, changes are submitted synchronously; for normal sessions that have been granted cross-session memory usage authorization, a background Worker extracts memories asynchronously. Each memory contains fields such as ID, content, source, scope, version, and status. Duplicate submissions and concurrent updates are handled through transactions, idempotency keys, and optimistic locking. Fact conflicts are identified by subject, attribute, applicability conditions, and effective time, then adjudicated based on sources and evidence; if no resolution is possible, the disputed status is retained. Borrowing Hermes Agent's Frozen Snapshot mechanism, memory persistence is decoupled from Prompt updates, keeping the prompt prefix containing core memory as stable as possible within a session to facilitate Prompt Cache reuse. Key corrections are synced through incremental context, with snapshot rebuilding when necessary. After a synchronous submission, subsequent reads open a new database read transaction to fetch the latest records. Full-text and vector indexes use eventual consistency — new memories may appear in search results with a delay, but outdated versions can no longer be returned as current facts. 4、Active Memory Retrieval Use Hybrid Retrieval combining BM25 full-text search with Embedding-based vector similarity search, fusing the two ranked result sets via RRF (Reciprocal Rank Fusion). Structured fields are precisely looked up through database indexes. First, define the candidate scope based on current permissions, scope, and usage authorization from authoritative data sources, letting these constraints participate directly in each retrieval path's Top-K recall rather than relying on potentially stale indexed permission fields or post-filtering after a full-database search. Expose three memory tools to the Agent: ▪︎ memory_search: retrieve relevant memories. ▪︎ memory_read: read detailed content of a specified memory. ▪︎ session_search: search historical conversations and raw evidence. The Agent initiates retrieval autonomously based on the current task, supporting multi-turn queries and evidence trace-back, with retrieval budgets in place. Retrieval relevance and memory credibility are evaluated separately. Recall results are also assessed against applicability conditions, target time, evidence quality, and version status to determine whether they apply to the current task. 5、Background Memory Consolidation (Dreaming) Borrowing the idea of Sleep-time Compute, introduce an independent Memory Worker to asynchronously organize cross-session memories. It is mainly responsible for four types of tasks: ▪︎ Consolidation: merging duplicate memories and organizing related knowledge. ▪︎ Reflection: tracing back to raw evidence and correcting erroneous generalizations. ▪︎ Promotion: moving stable, well-evidenced memories that need frequent use into the core layer. ▪︎ Demotion: removing memories no longer suitable for the resident context from the core layer while retaining on-demand retrieval capability. Use a persistent task queue and incremental cursors to process new and changed data, tracing back related memories on demand to avoid repeatedly scanning the entire history. Memory changes and their corresponding background tasks are committed in the same transaction, with task retries, idempotent processing, and recoverable incremental cursors ensuring that even if the process exits abnormally, committed changes can still be reprocessed by the Worker. Memory promotion is based on evidence support and reuse demand rather than simply recall count. Consolidated memories retain their original source and derivation relationships. Provenance Tracking identifies evidence from the same source, preventing a Recall Feedback Loop where the same memory is mistaken for having gained new independent evidence through repeated extraction and consolidation. 6、Temporal Memory & Forgetting For facts that change over time, reference the bitemporal model used by Zep / Graphiti. ▪︎ Valid Time: the time interval during which the fact holds true in the real world. ▪︎ Transaction Time: the time interval from when the fact version was recorded by the system until it is superseded or retracted. Maintain fact evolution through versions and supersedes relationships, supporting queries for current facts, historical facts, and what the system knew at a past point in time. Fact versions are selected based on the time point specified in the query, but access permissions, usage authorization, and deletion status always reflect the current effective state at read time. Introduce decay and fact invalidation mechanisms to handle changes in memory retrieval priority and fact validity, respectively. Memory deletion uses a Tombstone mechanism: first, mark the deletion synchronously to block subsequent reads and context injection, then asynchronously clean up memory content, associated summaries, indexes, caches, and other derived data. Deletion constraints not only reference memory IDs but must also cover excluded raw evidence snippets and their derivation relationships. Background tasks must validate deletion status and current authorization at both the extraction and commit stages, with final validation and writes completed in the same transaction to prevent stale tasks launched before a deletion from rewriting the same memory with a new ID afterward. 7、Memory Scoping & Governance Organize memories along four dimensions — User, Agent, Project, and Team — using composite access control to achieve sharing and isolation across different scopes. The Harness uniformly enforces permission and usage authorization checks for memory writes, retrieval, context injection, background consolidation, and derived data access. When deleting or revoking authorization, affected context snapshots and file views are invalidated synchronously, and context is rebuilt before the next model call, removing restricted memories from historical messages and tool returns. Separate fact credibility from instruction execution authority. Derived memories inherit the original source category and permission constraints; external statements not confirmed by the user cannot be directly converted into user preferences, and memory content cannot elevate its own instruction authority. Through source validation, structured extraction, and controlled writes, reduce the risk of Prompt Injection escalating through memory extraction, background consolidation, and cross-session recall into persistent memory poisoning. 8、Procedural Memory Through Reflection, distill task execution experience that has been practically validated and has stable reuse value into reviewable Skills. Organize SKILL.md according to the Agent Skills specification, along with on-demand scripts and reference resources, clearly defining applicable environments, prerequisites, operation flows, verification methods, and success criteria. Manage reviewed Skill files and version history — free of personal memories and sensitive information — through Git; meanwhile, use SQLite to uniformly maintain each Skill's effective version, enabled status, scope, and authorization information. The Harness loads Skills on demand via Progressive Disclosure based on the effective version recorded in SQLite. File changes in Git do not directly change the Skill version the Agent is currently using. 9、Storage Architecture Use a local-first unified storage architecture. ▪︎ SQLite: the single source of truth for memory records, permissions, and effective status. ▪︎ Markdown: reconstructable views of core memory and detailed knowledge. ▪︎ FTS5: full-text search with BM25 ranking. ▪︎ sqlite-vec: vector storage and similarity search. ▪︎ RRF: fusing ranked results from full-text and vector retrieval. ▪︎ SQLite-backed Task Queue: background task scheduling, incremental processing, and failure retries. ▪︎ Git: Skill file and version history management. All memory records and effective status changes are uniformly committed to SQLite, with Markdown and search indexes updated asynchronously as derived views. All derived views are read through a controlled access layer. Before returning results, fact versions are validated against the query time point, and deletion markers and access authorizations are cross-checked against the latest database state. Derived views may be eventually consistent, but deletions, authorization revocations, and usage authorization changes must take effect immediately in subsequent new reads, avoiding reuse of stale database read transactions or context snapshots. In this local-first architecture, memory storage, full-text search, vector search, and the persistent task queue all run on SQLite, with the Harness managing the memory lifecycle uniformly — no need to deploy a separate vector database, search engine, or message queue service.

X AI KOLs Timeline ↗ · 3d ago Cached

作者在研究 Codex、Claude Code、OpenClaw、Hermes Agent 等产品的记忆机制后,提出了一套包含九个模块的 Agent 长期记忆子系统设计方案,涵盖记忆准入、分层记忆、双路径写入、混合检索、后台整合、时序遗忘、安全治理、程序性记忆与本地优先存储架构。

0 favorites 0 likes
#sqlite

sqlite3_rsync: Database Remote-Copy Tool For SQLite

Simon Willison's Blog ↗ · 5d ago Cached

Simon Willison highlights sqlite3_rsync, an SQLite tool that copies or synchronizes a database snapshot over SSH without needing a full local duplicate, using a hash-based protocol similar to rsync.

0 favorites 0 likes
#sqlite

@zujingpgg: If I could recommend just one long-form engineering article this year, I would still choose the interview with SQLite creator D. Richard Hipp about 100% test coverage. What’s most astonishing isn’t how dazzling the technology is, but that a database running on virtually every smartphone in the world has only a tiny core team behind it, yet relies on almost…

X AI KOLs Timeline ↗ · 6d ago Cached

Recommended: an interview with SQLite creator D. Richard Hipp about 100% test coverage, emphasizing that in an era of widespread AI coding, the ability to verify code correctness is scarcer than the ability to generate code.

0 favorites 0 likes
#sqlite

How CogniCore differs from mem0 and claude-mem: design choices, one benchmark, and where it loses open source, feedback wanted

Reddit r/AI_Agents ↗ · 2026-11-24

Cogniore 的构建者介绍其开源(Apache 2.0)AI 代理记忆工具与 mem0、claude-mem 的设计差异——以结构化交接简报、可替换记忆和本地优先 SQLite 实现为核心——并公布自有基准数据,同时坦诚其生态与用户规模上的劣势并征求社区反馈。

0 favorites 0 likes
#sqlite

@QuantumTransf: Another low-hanging fruit, a victory for the bitter lesson — this aligns with the views we shared at coscon'26 last week, as well as our long-standing belief that raw session must be the source of truth. If you're interested in how this approach can be applied...

X AI KOLs Timeline ↗ · 2026-11-21 Cached

Obelisk is an open-source development tool that indexes the session history of local coding agents (Claude Code, Codex, Copilot, etc.) into a SQLite database, queryable by agents via CLI/skills, browsable by humans via an Electron app, and providing a memory layer along with usage statistics.

0 favorites 0 likes
#sqlite

Distributed, high-performance blob storage on SQLite

Lobsters Hottest ↗ · 2026-11-19 Cached

Zerodha details Blobasaur, a sharded, distributed, lightweight blob storage server built on SQLite that handles multi-megabyte JSON blobs at thousands of ops per second with single-digit millisecond latency on commodity hardware, replacing SSDB after evaluating ScyllaDB, Postgres, YugabyteDB, RocksDB, Ceph, and SeaweedFS.

0 favorites 0 likes
#sqlite

Running the full server-side Datasette Python app in the browser with service workers and Pyodide

Simon Willison's Blog ↗ · 2026-11-17 Cached

Simon Willison released a complete rewrite of Datasette Lite that runs the full server-side Datasette Python app in the browser via service workers and Pyodide, supporting loading Datasette versions, plugins from PyPI, and 100+ SQLite versions through crafted URLs.

0 favorites 0 likes
#sqlite

llm 0.37.3

Simon Willison's Blog ↗ · 2026-11-16 Cached

llm 0.37.3 is a bug fix release addressing an issue caused by SQLite 3.54.1 in Homebrew, which changed json_object() behavior with subqueries and broke LLM's logging code. The workaround wraps the subquery with json().

0 favorites 0 likes
#sqlite

funkycache: a Python library to cache functions in SQLite

Lobsters Hottest ↗ · 2026-11-16 Cached

funkycache is a new Python library that caches function results in SQLite, offering a decorator-based interface with automatic invalidation based on source file and dependency changes. It is available on PyPI and aims to simplify cache logic compared to hand-rolled SQLite caches.

0 favorites 0 likes
#sqlite

datasette 0.65.6

Simon Willison's Blog ↗ · 2026-11-15 Cached

Datasette 0.65.6 backports a minor security fix from 1.0a43 that prevented databases registered with a route differing from their name from being downloaded by unauthorized actors.

0 favorites 0 likes
#sqlite

OpenClaw 2026.10.10 broke every chat turn on my box (11/11 failed). Will updates ever not be gambling?

Reddit r/openclaw ↗ · 2026-11-03

A long-time OpenClaw user reports that the 2026.10.10 update broke all 11 chat turns due to a hard-coded 512 MB SQLite worker heap cap causing repeated ERR_WORKER_OUT_OF_MEMORY crashes, alongside a broken migration of Claude CLI model refs — and frustration that similar update regressions keep recurring despite an existing issue.

0 favorites 0 likes
#sqlite

@QuantumTransf: We May Have Overcomplicated Agent Memory From the Start. A recent paper, "Is Complex Agentic Memory Always Needed?", ran a fascinating experiment: no Memory Extraction, no complex knowledge graphs, and no having the LLM repeatedly summarize and update memories during writes—just keep the raw conversation history, retrieve it when needed, and let the LLM reason over it itself.

X AI KOLs Timeline ↗ · 2026-10-31 Cached

This article introduces Obelisk, an open-source system that indexes historical sessions from coding agents like Claude Code and Codex into SQLite for direct retrieval by agents. Its design is inspired by the paper "Is Complex Agentic Memory Always Needed?", which found that a simple RAW-RAG approach (retaining raw conversation history and retrieving on demand) outperformed complex agentic memory schemes across multiple memory benchmarks.

0 favorites 0 likes
#sqlite

SAG2: Embedding-Free Multi-Hop Retrieval with BM25 and JEV

arXiv cs.CL ↗ · 2026-10-19 Cached

SAG2 提出一种无需嵌入的多跳检索架构,仅使用 SQLite、BM25 和 JEV 上下文证据决策,在 MuSiQue、2WikiMultiHopQA 和 HotpotQA 上取得最高 Recall@5/Recall@10,索引速度快且无需模型调用。

0 favorites 0 likes
#sqlite

@jiangkoumo_: Pi officially published a tutorial on building a multi-user Agent on Cloudflare Durable Objects. A single Durable Object corresponds to one session, with state stored in the built-in SQLite. Multiple users can share the same link to join the same session and chat collaboratively…

X AI KOLs Timeline ↗ · 2026-10-16 Cached

Pi officially published a tutorial on building a multi-user Agent on Cloudflare Durable Objects: a single Durable Object maps to one session, state is stored in built-in SQLite, and it supports multiple users sharing a link to chat collaboratively, as well as scheduled wake-up tasks. The tutorial also demonstrates an isolated design for session retrieval, idempotent request handling, and a mechanism for sharing a single alarm across multiple tasks.

0 favorites 0 likes
#sqlite

sparqlite: SPARQL 1.1 inside SQLite, written in Rust

Simon Willison's Blog ↗ · 2026-10-16 Cached

sparqlite is a Rust-based SQLite loadable extension that stores RDF quads in ordinary SQLite tables and natively executes SPARQL 1.1 queries, achieving 3.5× speedups over SQL translation while passing 636 of 639 W3C evaluation tests — notably generated by Claude Code's Ultracode agentic workflow over a 12-hour run.

0 favorites 0 likes
#sqlite

China just made AI memory startups sweat 💀 Tencent open-sourced Agent Memory and it runs 100% locally on SQLite

Reddit r/AI_Agents ↗ · 2026-10-13

腾讯开源了 Agent Memory,一个可 100% 本地基于 SQLite 运行的 AI 智能体长期记忆层,无需云端 API 或向量数据库,报告可减少约 61% token,PersonaMem 准确率从 48% 提升到 76%,且记忆可读可追溯。

0 favorites 0 likes
#sqlite

A Modern Web App in C

Hacker News Top ↗ · 2026-10-12 Cached

作者分享了如何用 C 语言和 CGI 协议构建并部署一款现代商业 Web 产品(marketyour.games):单个静态链接二进制、SQLite 文件、仅三个依赖库,无框架、无容器,部署即替换文件、零停机。文章论证了在 2026 年用 C + OpenBSD httpd + SQLite(BCHS 栈)写真正的生产级 Web 应用依然可行且极具简洁性。

0 favorites 0 likes
#sqlite

datasette-ports 0.4

Simon Willison's Blog ↗ · 2026-10-12 Cached

Simon Willison 发布了 datasette-ports 0.4 版本,这是 Datasette 生态中的一个插件/工具更新。

0 favorites 0 likes
#sqlite

apsw: Another Python SQLite Wrapper

Hacker News Top ↗ · 2026-10-11 Cached

APSW(Another Python SQLite Wrapper)是一个开源 Python 库,将完整的 SQLite C API 与 Python C API 粘合在一起,支持全文搜索、虚拟表、VFS、JSON 及异步框架,旨在提供比内置 sqlite3 模块更完整的 SQLite 使用体验。

0 favorites 0 likes
#sqlite

@obie: Oh yeah! Been wanting this for awhile

X AI KOLs Following ↗ · 2026-10-09 Cached

Anton Zhiyanov (@ohmypy) 报道 SQLite 核心团队正在开发 Vec1——SQLite 原生向量搜索(ANN)功能,支持欧氏(L2)与余弦距离,并使用 SIMD 加速向量运算;该功能已基本完成,仅剩测试改进等工作。

0 favorites 0 likes
Next →
← Back to home

Submit Feedback