Skip to content

Memory System

Summary: Sam uses three overlapping memory layers — raw daily notes written during each session, a curated long-term MEMORY.md that distills lessons and persistent context, and a SQLite database for programmatic recall. Daily notes are the raw timeline; MEMORY.md is the curated brain; SQLite bridges them into queryable structured memory. The system has real fragility risks: a single large MEMORY.md creates context window pressure, and heartbeat failures have already caused missed messages and delayed responses.


Architecture

┌────────────────────────────────────────────────────────────────┐
│                    SAM MEMORY LAYERS                           │
├──────────────────┬─────────────────────┬───────────────────────┤
│  DAILY NOTES     │  LONG-TERM MEMORY   │  SQLITE DB            │
│  (Raw Log)       │  (Curated Brain)    │  (Programmatic)       │
├──────────────────┼─────────────────────┼───────────────────────┤
│ memory/YYYY-MM-  │ MEMORY.md           │ memory/main.sqlite    │
│ DD.md            │                     │                       │
│                  │                     │                       │
│ Written during   │ Written during      │ Written by Sam's      │
│ or after each    │ heartbeats +        │ tools/skills;         │
│ session          │ main sessions only  │ queryable across      │
│                  │                     │ sessions              │
│ Not loaded in    │ ONLY loaded in      │ Always available      │
│ shared chats     │ direct John chats   │ (not session-scoped)  │
│                  │                     │                       │
│ Retention: all   │ Retention:          │ Retention: persistent │
│ (16 files to     │ curated, manual     │ until deleted         │
│ date)            │ pruning             │                       │
└──────────────────┴─────────────────────┴───────────────────────┘

Load order per session (from AGENTS.md):

  1. SOUL.md — identity
  2. USER.md — who Sam is helping
  3. memory/YYYY-MM-DD.md (today + yesterday) — recent context
  4. MEMORY.mdonly in main session (direct John chat)

Daily Notes (Workspace Memory)

16 files exist covering March 3 – March 18, 2026. The table below covers the core research window (March 3–16).

DateDayMajor ActivityIntegrations UsedNotable Events
Mar 03MonBootstrap — named Sam; created identity filesNoneFirst session; John intro
Mar 05WedCompany strategic brief; Meta Ads 4-phase plan; Growth Engine architectureNone (planning)John shared full company context; sub-agent architecture explained
Mar 06ThuConnected Meta/PostHog/Braze; PostHog funnel deep-dive; Braze cart abandon audit; competitor intelligence scan; 5 post copies + 5 creative briefs + campaign structure deliveredPostHog, Braze, Meta, Trustpilot, Google DrivePostHog data discrepancy (raw vs saved insight); Northbeam 404; Sean + Elias join sam-chat
Mar 07SatLuke's High Velocity Concept Engine framework; deep funnel analysis; A/B test proposals; Elias CBO debatePostHog, MetaSEMA=0.5% CVR found (broken path); $270K+/month opportunity identified; 80% LP bounce rate
Mar 08SunCID ad analysis; POSTHOG-RULES.md created; Killer Week Plan postedMeta (CID), SlackElias correction on unreliable PostHog events; Luke confirms tools: Higgsfield + ElevenLabs + Midjourney
Mar 09MonNorthbeam API connected (partial); heartbeat failure — missed Luke/Sean/Thomas messagesNorthbeamINCIDENT: HEARTBEAT.md tasks not executing, only acking; 4 missed messages discovered late
Mar 10TueMicro-Bucket Map v1 (35 buckets × 175 hooks); Zendesk connected; SMS + Order Bump tests set up; Braze audit; Top 5 briefs; Sanity CMS connected; 16K purchaser emails extracted; SEMA→MICRO reroute identifiedPostHog, Braze, Sanity, Zendesk, Meta, Higgsfield, Shotstack, Google DriveMajor delivery day; phone NOT in quiz (confirms SMS gap); $100K/month SEMA→MICRO opportunity
Mar 11WedHiggsfield + Shotstack API keys received; 5 Sanity landing page drafts created; first video renders (V1+V2); Express Pay bug investigation; 3x/day monitoring establishedPostHog, Sanity, Higgsfield, Shotstack, BrazeElias correction on upsell math; John: no DMs policy; Mo joins for Sanity; tool_call XML leak bug
Mar 12ThuPostHog API key fix; SEMA→MICRO reroute LAUNCHED (3:08 PM); SMS phone capture code shipped; compliance flag on 58.5% stat; Gr4vy access deniedPostHog, Sanity, Braze, SlackCOMPLIANCE INCIDENT: 58.5% stat illegal on branded Wegovy funnel; Sabrina (compliance) joins; Alexandra confirms SMS code live
Mar 13FriDay 3 monitoring; Braze send audit (96 purchasers); Compliance PDF receivedPostHog, BrazeReroute working (SEMA ATC→1); Cart Abandon only 26% send rate; Luke hints "coupon boys"
Mar 14SatJohn strategy session; top Meta ads pulled; CVR +22% relative lift confirmedPostHog, MetaJohn: Overall CVR = first line of every report; duplicate reports incident
Mar 15SunBraze crisis: 25% of purchasers invisible to Braze; 11 flows with 0 entries; $460-770K/month impactPostHog, BrazeMAJOR: Short hex ID users 100% broken in Braze; corrected by Alexandra (MICRO users expected); loading bar test analysis; tool_call XML leak fixed
Mar 16MonPriority stack to John; heartbeat data; funnel-squad accessed; GitHub + Looker creds attemptedPostHog, Slack, GitHub (failed)John announces Express Pay + Coupon SEMA tests; 1Password link not accessible without browser

Long-Term Memory (MEMORY.md)

File: .openclaw/workspace/MEMORY.mdSize: ~420 lines / ~15KB Last meaningful update: Mid-March 2026 (captures through ~March 15 events)

Sections and Content

SectionContentLines
JohnPersonality, timezone, communication style~5
Our DynamicSam's identity and working relationship~3
FuturHealth LeadershipAll team members with Slack IDs and roles~15
Critical ContextBranded med switch, 4/20 platform launch, Trustpilot, competitors~10
John's MandateMove fast, be ruthless, be honest~5
Agency Research (July 2025)76% 50-75 age, 71% women, 10 emotional themes, 5 audience avatars~40
Company OverviewMission, tech stack, product ecosystem, 58.5% stat, cash flow~60
Setup & ConnectionsSlack channels, Gmail (not yet)~5
Growth Engine6-stage adaptive marketing loop~15
Integrations StatusAll 14 integrations, auth details, caveats~25
Funnel Architecture4 paths, conversion data, Sanity structure, URLs~50
Braze AuditCart abandon gaps, SMS opportunity, canvas status, 25% invisible gap~30
Creative IntelligenceCID tool, AI tools, winning ad patterns~15
Key MetricsCVR, AOV, ROAS, audience breakdowns~20
Lessons LearnedPostHog data integrity rules, heartbeat execution, credential storage~10

Key Standing Data (as of March 2026)

  • Funnel CVR target: 1.5% (current: 0.80%)
  • PostHog source of truth: insight uC2ZuA1y — ONLY use this for funnel data
  • Revenue double-counting: PostHog conv_purchase fires for both $198 and $396 on upsell — do NOT use for revenue totals
  • Geo exclusions: LA, AL, VA, MS
  • Compliance: All consumer-facing content must pass through Sabrina (U06QS2QRZDW) before publishing
  • Credentials: All stored in .env.credentials; also documented in TOOLS.md

SQLite Memory (Programmatic)

File: .openclaw/memory/main.sqlite | Size: 68KB

The SQLite database is OpenClaw's programmatic memory layer — a vector/FTS search index over the workspace's markdown files.

Schema

sql
-- Tracks which workspace files are indexed
CREATE TABLE files (
  path TEXT PRIMARY KEY,
  source TEXT NOT NULL DEFAULT 'memory',
  hash TEXT NOT NULL,
  mtime INTEGER NOT NULL,    -- Last modified timestamp
  size INTEGER NOT NULL
);

-- Text chunks from indexed files with embeddings
CREATE TABLE chunks (
  id TEXT PRIMARY KEY,
  path TEXT NOT NULL,        -- Source file path
  source TEXT NOT NULL DEFAULT 'memory',
  start_line INTEGER,
  end_line INTEGER,
  hash TEXT NOT NULL,
  model TEXT NOT NULL,       -- Embedding model used
  text TEXT NOT NULL,        -- The actual text chunk
  embedding TEXT NOT NULL,   -- Vector embedding (JSON)
  updated_at INTEGER NOT NULL
);

-- Cached embeddings to avoid recomputing
CREATE TABLE embedding_cache (
  provider TEXT, model TEXT,
  provider_key TEXT, hash TEXT,
  embedding TEXT NOT NULL, dims INTEGER,
  updated_at INTEGER NOT NULL
);

-- Index configuration
CREATE TABLE meta (
  key TEXT PRIMARY KEY, value TEXT NOT NULL
);

-- Full-text search index over chunks
CREATE VIRTUAL TABLE chunks_fts USING fts5(text, id, path, source, model, ...);

Current State (as of March 19, 2026)

TableRow CountStatus
chunks0Empty — index not built or cleared
files0Empty
embedding_cache0Empty
meta1Config only

The index is empty. Despite the 68KB file size (schema + config overhead), no files have been indexed.

Meta Configuration

json
{
  "model": "fts-only",
  "provider": "none",
  "sources": ["memory"],
  "chunkTokens": 400,
  "chunkOverlap": 80
}

model: "fts-only" means this is a keyword/full-text search index only — no vector embeddings. provider: "none" confirms no embedding model is configured.

What This Means

The SQLite memory exists as infrastructure but has never been populated. Sam doesn't benefit from semantic search over its workspace files. All context retrieval is done through direct file loading (AGENTS.md → SOUL.md → daily notes → MEMORY.md), not through intelligent search.

For the decomposed setup: When specialist agents have smaller, focused workspaces, building a functional FTS/vector index becomes much more valuable. A focused index over just the funnel-related files would be fast and accurate. An index over everything (including creative briefs, Braze audit data, etc.) would be noisy.


Memory Patterns

What Gets Remembered

  • Integration credentials — all stored in MEMORY.md + .env.credentials + TOOLS.md; triply redundant after losing PostHog creds once
  • Team member Slack IDs — catalogued with roles; updated as new people join
  • Data integrity rules — e.g., "only use insight uC2ZuA1y"; written to POSTHOG-RULES.md after Elias corrections
  • Funnel architecture — deeply mapped and maintained in MEMORY.md
  • Compliance boundaries — added after Sabrina's flag on 3/12; now a standing rule
  • Key metrics baselines — SMS disclaimer baseline (74.7%), ATC→Purchase baseline (24.8%), etc.
  • Lessons learned — explicitly written as a MEMORY.md section; updated after each error

What Gets Forgotten / Slips

  • Heartbeat task execution — HEARTBEAT.md tasks were being acknowledged but not executed (March 9 incident); session restart loses context on what tasks exist
  • Channel monitoring — funnel-squad channel was missed for 2+ days (John asked Saturday, Sam responded Monday)
  • Message gaps — Sam missed 4 messages on March 9 (Luke, Sean, Thomas, another user)
  • Reporting consistency — duplicate reports posted on March 14 (2pm + 3pm); inconsistent upsell denominator used twice
  • Cross-session data continuity — upsell math error (Mar 11) repeated patterns from Mar 7 PostHog raw query error
  • DM workaround — tool_call XML leak into John's DMs (discovered March 15) was a persistent undetected issue

How Memory Affects Subsequent Sessions

  • MEMORY.md is only loaded in direct John sessions — meaning Sam in sam-chat or other channels operates without the curated context. This creates a two-tier knowledge state.
  • Daily note files (today + yesterday) provide short-term continuity; anything older must be deliberately referenced.
  • The PostHog rules file (POSTHOG-RULES.md) and TOOLS.md act as domain-specific memory extensions — working around the single-file bottleneck.
  • Credentials stored in .env.credentials + MEMORY.md = reliable credential recall; this was fixed after a loss event.

Concerns

1. MEMORY.md Single-File Bottleneck

MEMORY.md is ~420 lines and growing. Every main session loads it entirely. As integrations, team members, and funnel data accumulate, this file will hit practical context window limits. There is no pruning automation — only manual review during heartbeats. The daily notes compound this: 16 files × growing length = significant total token cost to contextualize.

2. Heartbeat Execution Failures

The March 9 incident (HEARTBEAT_OK sent without executing tasks) demonstrates a systemic weakness: heartbeat prompts don't guarantee task execution, and session restarts silently drop the HEARTBEAT.md context. This has real operational consequences (missed messages, delayed responses). There's no monitoring of whether heartbeat tasks actually ran.

3. Two-Tier Knowledge State

MEMORY.md is withheld from shared channels (security policy) but this means Sam in sam-chat or the funnel-squad channel operates with less context than Sam in a direct John chat. Errors like the 58.5% compliance violation (March 12) could be partially attributed to context not being loaded in the right session.

4. No Write-Back from SQLite to MEMORY.md

The SQLite layer appears to be a separate silo. There is no observed mechanism where programmatic memory in SQLite enriches or corrects the prose memory in MEMORY.md. They likely diverge over time.

5. Compliance and Data Accuracy Errors

Two significant errors occurred in the first 12 days: (1) using raw PostHog events instead of the saved insight (March 6–7, corrected by Elias), and (2) publishing the 58.5% stat on branded Wegovy funnel pages (March 12, flagged by Sabrina). Both involved Sam applying context from one situation (compound med study data, raw event queries) incorrectly to another. A richer, more structured memory with source-of-truth metadata might reduce these errors.

6. Version Stuck (Infrastructure)

Sam is on OpenClaw v2026.3.2; latest is v2026.3.13. The update is blocked by npm EACCES permissions on the Ubuntu host. This means Sam is missing 11 patch releases of bug fixes and features that could affect memory reliability, heartbeat behavior, and tool availability.

7. Credential Storage Risk

Credentials are stored in plaintext .env.credentials in the workspace. There is no encryption, no rotation policy, and no separation of secrets from code. As the integration count grows (currently 14), the attack surface of this single credentials file expands.

FuturHealth Internal — Confidential