memory· @zero/memory · 5 strata · 2 backends · 1 provider
an agent remembers in five layers, locally
spec part 4 names a five-stratum memory architecture every agent surface should support. ZERO ships it in @zero/memory: five strongly-typed slices, two backends (localStorage and in-memory), and a React provider with five strata-scoped hooks. article I.4 makes the default local-first · no transport, no telemetry, no opt-out required because nothing leaves the tab.
as of
00 · liveuseMemorySnapshot() · localStorage · zero.memory.v1 · 5 stratayour own memory · edit it now · see it persist
- — · empty
- —
- — · empty
- —
skin · live retintdensitymotion tierlocale
- — · empty
- —
written automatically by RootProviders.MemoryBridge on every page load
- — · empty
- —
- — · empty
- —
as of
01 · five stratathe canonical contract · same names across every agent surfaceidentity · preference · navigation · workingTask · learning
| stratum | scope | persistence | example field |
|---|---|---|---|
identity | operator facts that never change · handle, brand role, public key | persist forever · operator-controlled | handle · brandRole |
preference | operator settings shaping rendering · skin, density, motion tier | persist forever · operator-controlled | skin · motionTier |
navigation | recent surfaces · cursor · last chapter | per-tab · transient is acceptable | lastChapter · visitedChapters[] |
workingTask | currently-active goal · in-flight steps · collected references | per-session · cleared on completion | goal · steps[] |
learning | distilled lessons · heuristics · refused-pattern hits | persist · summarised by future ADR | heuristics[] · refusedPatterns[] |
why five and not eight
eight strata is overspecified for a brand-system contract. four is underspecified — there is no place to put learned heuristics. five maps to the GAIN-spec's reference architecture and to every agent SDK that ships a memory hook today. each stratum has its own React hook (useIdentity, usePreference,useNavigation, useWorkingTask, useLearning) so subscriptions stay scoped.as of
02 · shapeMemoryShape · rendered with demo dataevery stratum carries a typed receipt
- handle
- operator-0
- brand role
- operator
- pubkey
- ◆ b39e02 5f1c 9a02 ee87
- joined
- 2026-01-08
- skin
- signature
- density
- compact
- motion tier
- full
- locale
- en-US
- ambient tier
- A
- last chapter
- /agent-stream
- last surface
- /floor
- visited
- 3 chapters
- 00:14:08z · /agent-context
- 00:14:14z · /agent-stream
- 00:14:21z · /memory
- goal
- reduce sol-perp short · 0.7x → 0.4x · paper
- started
- 00:13:51z
- steps
- 4 steps
- references
- 2 refs
- ✓ observe · book + funding skew
- ✓ decide · reduce
- ◆ event · stop replaced
- · refuse · doge-perp
- heuristics
- 3 rules
- refused patterns
- 3 patterns
- w 0.91 · doge-perp · funding above 0.04 · always refuse
- w 0.84 · sol-perp · short · respect drawdown gate strictly
- w 0.72 · after 3 consecutive refusals · pause for 5 min · cooler
as of
02b · ttls · adr-085documented ttl per stratum · runtime memory honors thesesome strata expire · others persist forever
| stratum | ttl | rationale |
|---|---|---|
identity | ∞ · operator-controlled | operator facts that never change |
preference | ∞ · operator-controlled | operator picks · persists until changed |
navigation | 1 h | cursor goes stale fast · 1h is enough |
workingTask | 24 h | cleared on completion · 24h backstop |
learning | ∞ · operator-controlled | distilled wisdom · garbage-collected by future ADR |
advisory · not destructive
ttls are honored by the runtime memory's tail() read, which returns an empty stratum past the ttl. get()still reads the underlying value · stale rows stay on disk for inspection until the operator (or a future garbage-collection ADR) compacts the file.as of
03 · backendsLocalStorageBackend (default) · InMemoryBackend (test)two backends · one interface
| backend | persistence | scope | SSR | privacy posture |
|---|---|---|---|---|
LocalStorageBackend | browser localStorage · per-origin · per-key | tab + restore | SSR-safe (returns EMPTY_MEMORY on the server) | local-first · article I.4 default |
InMemoryBackend | none · process-lifetime only | this render | fully SSR-safe | strictest · zero persistence by construction |
as of
04 · article I.4local-first by default · the privacy articlememory does not become telemetry
how the constitution shapes this package
article I.4 names US and Ontario operators refused, and names ZERO telemetry-spare by design. @zero/memory ships with no transport, no key-rotation hooks, no sync API. a future ADR will land server-side sync as opt-in transport with consent receipts; today the default is the strictest available posture — every byte stays in the operator's tab.transport
none
identifiers
0
cookies
0
cross-tab sync
0
default backend
local-storage
local-firstsigned
◆ mem001a