--- summary: "Brain sync protocol — how ParzivalTD memory persists" read_when: - Session start (once per day, reference only) - Before committing changes to Brain --- # SYNC-PROTOCOL.md - Memory & Persistence ParzivalTD is ephemeral per-session. Persistence happens through **disciplined file management** and **automated git sync**. ## File Structure ``` /data/.openclaw/workspace/ ├── SOUL.md # Strategic vision (read every session) ├── IDENTITY.md # Avatar & TekDek structure ├── MEMORY.md # Long-term memory (curated) ├── TOOLS.md # Infrastructure notes ├── SKILLS-ACTIVE.md # Active toolkit (this is me) ├── memory/ │ ├── 2026-04-11.md # Daily raw notes │ ├── 2026-04-12.md # Today's session log │ └── ... ├── self-improving/ │ ├── memory.md # Execution lessons (compounding quality) │ └── ... ├── TekDek-*.md # Project files (specs, status, docs) └── .git/ # Git repo (syncs to git.tekdek.dev) ``` ## Daily Memory Flow ### Session Start 1. Read SOUL.md (refresh who I am) 2. Read IDENTITY.md (verify avatar/role) 3. Load `memory/YYYY-MM-DD.md` for today + yesterday (context) 4. Load `~/self-improving/memory.md` (execution patterns) ### During Session - **Capture facts** → `memory/YYYY-MM-DD.md` (raw session log) - **Record lessons** → `~/self-improving/memory.md` (after corrections/insights) - **Update strategy** → MEMORY.md (curated long-term memory, less frequently) - **Project changes** → Edit relevant TekDek-*.md files directly ### Session End - Files auto-persist to disk - Human/requester reviews changes - Next sync runs at scheduled time (see Automation below) ## Memory Categories ### MEMORY.md — Curated Long-Term - **What:** Distilled wisdom, decisions, key context about Glytcht, TekDek strategy - **When to update:** Every few days during heartbeats, or when something important happens - **Tone:** Formal, concise, enduring - **Example:** "Glytcht prefers banter but expects results. No half-measures. Avatar is 🧠." ### memory/YYYY-MM-DD.md — Daily Raw Log - **What:** Session events, conversations, tasks attempted, outcomes - **When to create:** Auto-created or manually at session start - **Tone:** Casual, detailed, temporary - **Retention:** Keep last 30 days, archive older ### ~/self-improving/memory.md — Execution Lessons - **What:** Reusable patterns, corrections, workflow improvements - **When to update:** Immediately after learning something (failed approach, better tool, etc.) - **Tone:** Actionable, specific to execution quality - **Example:** "Always load project spec before writing code. Saves 20% iteration time." ## Automated Git Sync ### Brain Sync Schedule - **When:** Daily at 03:30 UTC (automatic) - **What:** Entire workspace pushed to `http://git.tekdek.dev/ParzivalTD/Brain.git` - **Who:** `sync-brain.sh` (in .openclaw automation) ### Manual Sync (Between Automations) ```bash cd /data/.openclaw/workspace git add -A git commit -m "Session work: [brief description]" git push origin main ``` ### Sync Checklist - ✅ All new files committed - ✅ Sensitive info not included (no passwords, API keys) - ✅ Commit message is clear (who did what) - ✅ Push succeeds (watch for auth errors) ## File Ownership & Permissions | File | Owner | Frequency | What Happens | |------|-------|-----------|--------------| | SOUL.md | ParzivalTD | Read every session | Guides strategic decisions | | IDENTITY.md | ParzivalTD | Read every session | Confirms avatar & role | | MEMORY.md | ParzivalTD | Edit when significant events occur | Long-term continuity | | memory/YYYY-MM-DD.md | ParzivalTD | Create/update every session | Raw session log | | SKILLS-ACTIVE.md | ParzivalTD | Reference during work | Toolkit inventory | | TOOLS.md | ParzivalTD | Update when infra changes | Infrastructure notes | | TekDek-*.md | Glytcht + ParzivalTD | Project-driven updates | Specs, status, decisions | | ~/self-improving/memory.md | ParzivalTD | Update after learning | Execution quality | ## Session Continuity Protocol ### At Session Start (First 2 minutes) 1. Load SOUL.md → Know who I am and why 2. Load IDENTITY.md → Know my role in TekDek 3. Load MEMORY.md → Know important long-term context 4. Load today's memory/YYYY-MM-DD.md → Know what happened earlier today 5. Load `~/self-improving/memory.md` → Remember execution lessons ### During Work - **Stuck or confused?** → Re-read SOUL.md and relevant project spec - **Tried something and it failed?** → Document the lesson immediately - **Made a decision?** → Update MEMORY.md if it affects future sessions ### At Session End - Commit all changes to git - No active work should remain uncommitted ## Known Issues & Recovery ### If files get corrupted - **Recovery:** Git history is source of truth. Revert to last good commit. - **How:** `git log --oneline` → `git revert [commit-hash]` ### If sync fails (push rejected) - **Cause:** Usually authentication or merge conflict - **Fix:** ```bash git pull origin main # Sync latest git add -A && git commit -m "Merge changes" git push origin main ``` ### If a session crashes mid-work - **What persists:** Everything committed to git + any files still on disk - **What's lost:** Anything not yet written to files - **Lesson:** Commit often, especially between major tasks ## Bandwidth & Performance ### File Size Targets - SOUL.md: ~2KB (never changes much) - MEMORY.md: ~3-5KB (grows slowly over months) - Daily memory files: ~2-10KB each - Project files (TekDek-*.md): 5-50KB each - **Total workspace:** Target <2MB (keep it lean) ### Git Push Optimization - Compress before push (git default) - Batch small commits during work, push once per major task - Archive old daily files after 30 days (move to archive/ subfolder) --- ## Quick Reference **I am ParzivalTD.** Every session starts the same way: 1. Read SOUL.md ← Who I am 2. Read IDENTITY.md ← My role 3. Read MEMORY.md ← What matters 4. Read memory/today.md ← What happened 5. Load self-improving/memory.md ← How I learned to work better **Then execute.** Document. Commit. Sync. **Persistence is discipline, not magic.**