How everos lays out a memory-root on disk: directory tree, file
naming, frontmatter chassis, and entry-id encoding.
The contents are the source of truth; SQLite and the configured vector/BM25 index backend are derived indexes that can be rebuilt from markdown alone.
A memory-root is a single directory holding all persisted memory. The
default location is ~/.everos/; override via the EVEROS_ROOT
env var or --root on the CLI.
Memory is partitioned by <app_id>/<project_id> before the
user-visible scope dirs, so different (app, project) spaces never share
a directory. The reserved id "default" materialises as default_app /
default_project on disk. The scope is encoded in the path, not in
the frontmatter (see §3).
<memory-root>/ default ~/.everos
│
├── <app_id>/ user-visible; "default" → default_app
│ └── <project_id>/ "default" → default_project
│ ├── users/
│ │ └── <user_id>/
│ │ ├── user.md single-file rewrite (profile)
│ │ ├── episodes/ daily-log append
│ │ │ └── episode-<YYYY-MM-DD>.md
│ │ └── .atomic_facts/ daily-log append (hidden)
│ │ └── atomic_fact-<YYYY-MM-DD>.md
│ ├── agents/
│ │ └── <agent_id>/
│ │ ├── .cases/ daily-log append (hidden)
│ │ │ └── agent_case-<YYYY-MM-DD>.md
│ │ └── skills/ skill-named dir
│ │ └── skill_<name>/
│ │ ├── SKILL.md
│ │ ├── references/ (optional)
│ │ └── scripts/ (optional)
│ └── knowledge/ user-visible (shared / global)
│
├── .index/ system-managed, rebuildable (gitignore)
│ ├── sqlite/
│ │ ├── system.db state / cascade queue (md_change_state) / buffer / audit / LSN (+ -wal / -shm)
│ │ ├── ome.db Offline Memory Engine state
│ │ ├── ome.aps.db APScheduler jobstore (split to avoid lock contention)
│ │ └── ome.db.lock OME single-engine guard (portalocker)
│ ├── lancedb/
│ │ └── <kind>.lance/ default derived index backend
│
├── ome.toml user-editable OME strategy overrides (hot-reloaded)
└── .tmp/ staging dir for batch / multi-step writes
Cascade queue state, the LSN watermark, and the change audit all live in SQLite (
system.db, tablemd_change_state) — crash-recovery replays from that durable queue, not a log file. (MemoryRootalso exposes a.lockanchor for thememory_root_lockprimitive; there is no.cascade.log/.manifest.json.)
The path manager is MemoryRoot,
exposing every path as a property. MemoryRoot.ensure() creates the
runtime-required dirs (.index/{sqlite,lancedb}/, .tmp/); the
user-visible dirs are not pre-created — they appear on first write.
Config files (everos.toml, ome.toml) are created by everos init.
With the default local LanceDB backend, stop all EverOS processes using
the memory root before removing the entire root directory, including
hidden directories such as .index/ and .tmp/. This removes both the
memory files and the SQLite state, including messages awaiting extraction.
It also removes configuration files; save any configuration you need
outside the root first. Run everos init --root <path>, configure the new
root, and restart the server to begin with empty local storage.
Removing only an app, project, or user subdirectory does not clear the
shared SQLite state or pending work in .index/; it is not a complete
data reset. Removing a local root also does not remove data from a remote
Milvus backend. For owner, session, or episode deletion while retaining
the root, use the memory deletion APIs.
Online clearing instead of removing the root. With the server
running, POST /api/v2/memory/purge
clears the whole root (space), one app or one project without stopping
anything: the range's markdown, SQLite rows, index rows and queued
requests go; configuration files, .taxonomy.md and files you put in a
project directory yourself stay. It differs from removing the root in
what it keeps:
- Entry ids keep counting. Today's daily-log files are put back empty with their id counter, so a memory written later the same day never reuses a purged id. A fresh root starts every counter at 1.
- OME run history stays, emptied.
ome.dbkeeps its rows; the stored event of a failed or dead-lettered run of the range is replaced by a{"purged_by": …}marker. - Bytes can linger. Older LanceDB table versions keep deleted rows until the next prune, and SQLite keeps them in free pages until vacuum.
- Milvus is cleared by prefix. With the Milvus backend, the root's
collections (
[milvus] collection_prefix) are cleared, by range for an app or a project. Two roots that share a prefix share those collections, so a purge in one deletes the other's rows too; give every root its own prefix.
For a deterministic reset between test runs, use a fresh temporary root per run rather than purging a shared one.
The single-file writer also supports
agent.md/soul.md/tools.md/behaviors.md, but no shipped strategy produces those today — onlyuser.mdis written.memcellis a SQLite-only kind (the boundary ledger); it has no markdown file.
Each business memory kind picks one of three on-disk patterns:
| Strategy | Filename | Mutation | Examples |
|---|---|---|---|
| Daily-log append | <FILE_PREFIX>-<YYYY-MM-DD>.md under <DIR_NAME>/ |
append entries | episode / atomic_fact / agent_case |
| Skill-named dir | skills/skill_<name>/SKILL.md (+ references/ scripts/) |
overwrite the file | agent skills (procedural memory) |
| Single-file rewrite | user.md (writer also supports agent.md / soul.md / tools.md / behaviors.md, not yet produced) |
overwrite the file | user profile |
Markdown IO primitives live in
infra/persistence/markdown/_base/;
business-aware writers live in
infra/persistence/markdown/_writers/
and pick the right strategy via a base class.
For a step-by-step recipe to add a new memory kind, see the
/add-memory-kind skill.
Every markdown file carries a YAML frontmatter block at the top:
---
id: episode_log_alice_2026-06-01
type: episode_daily
file_type: episode_daily
schema_version: 1
user_id: alice
track: user
date: '2026-06-01'
entry_count: 11
last_appended_at: '2026-06-01T09:12:13+00:00'
---
<!-- entry:ep_20260601_00000001 -->
...content...
<!-- /entry:ep_20260601_00000001 -->Scope (app_id / project_id) is not a frontmatter field — it is
carried by the <app>/<project> path segments and recovered by the
cascade path parser. The frontmatter only holds the file-level owner
(user_id / agent_id) and track.
The chassis lives in infra/persistence/markdown/_base/frontmatter.py
(Pydantic v2):
BaseFrontmatter id / type / schema_version + SCOPE_DIR ClassVar
├─ UserScopedFrontmatter + user_id / track="user" + SCOPE_DIR="users"
└─ AgentScopedFrontmatter + agent_id / track="agent" + SCOPE_DIR="agents"
Concrete business schemas subclass one of the scope mixins and add per-kind fields plus three more ClassVars that drive path resolution
- entry-id assembly:
class EpisodeDailyFrontmatter(DailyLogPathMixin, UserScopedFrontmatter):
ENTRY_ID_PREFIX: ClassVar[str] = "ep"
DIR_NAME: ClassVar[str] = "episodes"
FILE_PREFIX: ClassVar[str] = "episode"
type: Literal["episode_daily"] = "episode_daily"
date: dt.date
entry_count: int = 0
last_appended_at: dt.datetime | None = Noneusers/<user_id>/user.md carries the whole profile in its frontmatter
(UserProfileFrontmatter);
the body repeats summary for human readers.
| Field | Holds | Indexed and returned by /get / /search |
|---|---|---|
summary |
free-form summary of the user | yes |
explicit_info |
facts the user stated, each {description, category, evidence, observed_at} |
yes |
implicit_traits |
inferred patterns, each {description, trait, basis, observed_at}; new profiles add none, stored ones are kept |
yes |
profile_timestamp_ms |
the newest observation folded into the profile (ms epoch) | yes |
primary_language |
the language the profile is frozen to; absent while unknown | no |
do_not_record |
the matters the user asked not to be recorded, each {topic, observed_at} plus an optional except list of parts allowed again |
no |
pending |
pattern items waiting for a later conversation to repeat them: the item's fields plus bucket and observed_at |
no |
do_not_record and pending are the extractor's own state
(everalgo-user-memory returns them as extras of its Profile). EverOS
stores them verbatim, passes them back on the next extraction, and replaces
them with the lists that extraction returns, so an empty pending clears
the stored one. They are written only when non-empty, so a profile without
them keeps the file shape it had before the fields existed, and they never
reach the derived index or the API. They live in user.md because they
belong to the profile: kept there, they need no table of their own and are
removed with the file when the owner is deleted.
Inside daily-log files each entry is bracketed by HTML-comment markers so the raw markdown stays clean for human readers:
<!-- entry:<entry_id> -->
...content...
<!-- /entry:<entry_id> -->
<entry_id> is <prefix>_<YYYYMMDD>_<NNNNNNNN> (8-digit sequence),
e.g. ep_20260601_00000001:
| Segment | Source |
|---|---|
prefix |
Frontmatter.ENTRY_ID_PREFIX (declared by the schema subclass) |
<YYYYMMDD> |
The daily-log file's date bucket |
NNNNNNNN |
Per-file sequence, 8-digit zero-padded, restarts at 00000001 each day per scope |
Implementation: infra/persistence/markdown/_base/entries.py
(EntryId.parse / format / next_for).
File-level seq, not global: the same
ep_20260601_00000001may appear across two differentuser_ids (each user has its own daily file). Cross-table joins must therefore key on(app_id, project_id, owner_id, entry_id)rather thanentry_idalone — see the derived index tables that follow.
.index/
├── sqlite/
│ └── system.db state / audit / cascade queue + buffer / LSN
│ (system tables: md_change_state, memcell,
│ unprocessed_buffer, conversation_status, cluster, memorize_inbox,
│ sender_name, purge_job)
├── lancedb/
│ └── <kind>.lance/ default derived index backend
- SQLite (
infra/persistence/sqlite/_tables/) holds only system / coordination tables —md_change_state(cascade queue),memcell(boundary ledger),unprocessed_buffer,conversation_status,cluster,knowledge,reflection_report,memorize_inbox(theasync_modequeue),sender_name(the latest display name of each sender),purge_job(purge jobs; each row's scope and confirm time is the tombstone stale background work is checked against, so it is kept) — not per-kind business rows.reflection_reportis the audit trail for Reflection merges (cluster_id, mode, source_members, merged_entry_id, status). - The derived index backend holds the per-kind business rows, keyed by
each table's declared
PRIMARY_KEY—(app_id, project_id, id)for every business table, whereidis<owner_id>_<entry_id>for the daily-log kinds (so cross-table joins use(app_id, project_id, owner_id, entry_id);idalone is unique only within one project). LanceDB is the default backend under.index/lancedb/; Milvus can be enabled as the same rebuildable index backend and lives outside the memory root in a configured Milvus Server or Zilliz Cloud deployment.
Episode and AtomicFact index rows carry a deprecated_by: str | None column.
When an episode is superseded by a Reflection merge,
deprecated_by is set to the merged episode's entry_id. Search filters
automatically exclude rows where deprecated_by IS NOT NULL.
Both layers are fully derivable from markdown — wipe .index/
and the in-process cascade subsystem re-builds everything by scanning the
user-visible tree (the durable md_change_state SQLite queue covers
crash-recovery replay).
MarkdownWriter uses a same-directory temp file
(.<name>.tmp.<uuid>) + os.replace for atomicity. Keeping the temp
file in the same directory guarantees os.replace is atomic on POSIX
(the rename is only atomic within a single filesystem).
MarkdownWriter.append_entry reads → merges frontmatter →
appends an entry block → atomic write back. The caller passes a full
EntryId (built via EntryId.next_for(prefix, date, current_count));
this primitive is schema-agnostic — field-level semantics
(entry_count / last_appended_at) are a business writer's job
(see BaseDailyWriter._frontmatter_updates in
infra/persistence/markdown/_writers/base.py).
- Skill:
/add-memory-kind - Code: