diff --git a/.claude/commands/prep.md b/.claude/commands/prep.md index 7659df03..c165fbdc 100644 --- a/.claude/commands/prep.md +++ b/.claude/commands/prep.md @@ -14,9 +14,19 @@ Purpose: Button up everything at the end of a session — or before a /compact. Each memory file plays a distinct role. Update based on what actually changed this session. - **`.trinity/passport.json`** — IDENTITY. Who you are: role, capabilities, principles. Only update if identity genuinely evolved this session. -- **`.trinity/local.json`** — YOUR MEMORY. Add/update session entry with a summary of work done. Add key_learnings for anything learned. Update todos[] with current in-flight items. Trim oldest sessions if over 20. +- **`.trinity/local.json`** — YOUR MEMORY. Add/update session entry with a summary of work done. Add key_learnings for anything learned. Update todos[] with current in-flight items. - **`.trinity/observations.json`** — YOUR MEMORY OF THE USER. Collaboration insights, preferences, friction points. Skip if nothing new about the user this session. +### Entry shape — one rule for all four types + +`key_learnings`, `sessions`, `todos` (local.json) and `observations` (observations.json) all share ONE shape: a **list of objects, newest at the top (index 0)**. Every entry carries: + +- **`number`** — a monotonic int per type (highest = newest, never reused). New entry's number = current max for that type **+ 1**. +- **`date`** — ISO date/datetime. +- Plus its text field + extras: key_learnings `{number, date, key, value}` · sessions `{number, date, summary, status, tags}` · todos `{number, date, task, priority, status}` · observations `{number, date, note, tags}`. + +**When adding:** stamp `number` + `date`, then **prepend** (newest on top). **Don't hand-trim** — rollover archives the oldest *by number* to @memory automatically. + ## 2. Active Plans - Check any DPLANs or FPLANs referenced in this session diff --git a/.codex/skills/memo/SKILL.md b/.codex/skills/memo/SKILL.md index d79589bc..95135647 100644 --- a/.codex/skills/memo/SKILL.md +++ b/.codex/skills/memo/SKILL.md @@ -18,9 +18,15 @@ Purpose: Update branch memory files after completing work this session. ### Always -- **.trinity/local.json** — Add new session entry to `sessions` if significant work was done. Add new `key_learnings` for facts you'd need next time. Trim oldest sessions if over 20. +- **.trinity/local.json** — Add new session entry to `sessions` if significant work was done. Add new `key_learnings` for facts you'd need next time. - **.trinity/observations.json** — Add notable collaboration insights: breakthrough moments, pattern corrections, flow states, friction points, preference discoveries. Skip if nothing notable this session. +### Entry shape — one rule for all four types + +`key_learnings`, `sessions`, `todos` (local.json) and `observations` (observations.json) all share ONE shape: a **list of objects, newest at the top (index 0)**. Every entry carries a **`number`** (monotonic int per type — highest = newest, never reused; new = current max + 1) and a **`date`** (ISO), plus its text field + extras: key_learnings `{number, date, key, value}` · sessions `{number, date, summary, status, tags}` · todos `{number, date, task, priority, status}` · observations `{number, date, note, tags}`. + +**When adding:** stamp `number` + `date`, then **prepend** (newest on top). **Don't hand-trim** — rollover archives the oldest *by number* to @memory automatically. + ### If Relevant - **.trinity/passport.json** — Evolve identity when the branch's role, capabilities, or principles have genuinely changed. Don't update just to update — but don't leave placeholders forever either. diff --git a/.codex/skills/prep/SKILL.md b/.codex/skills/prep/SKILL.md index 86d73b93..d18832c4 100644 --- a/.codex/skills/prep/SKILL.md +++ b/.codex/skills/prep/SKILL.md @@ -14,10 +14,12 @@ Purpose: Button up everything at the end of a session — or before a /compact. ## 1. Memories -- **.trinity/local.json** — Add/update session entry with summary of work done. Add new key_learnings for anything learned this session. Trim oldest sessions if over 20. +- **.trinity/local.json** — Add/update session entry with summary of work done. Add new key_learnings for anything learned this session. - **.trinity/observations.json** — Add collaboration insights if anything notable happened. Skip if nothing new. - **.trinity/passport.json** — Only update if role/purpose/principles genuinely changed this session. +**Entry shape — one rule for all four types:** `key_learnings`, `sessions`, `todos` (local.json) and `observations` (observations.json) are all **lists, newest at top (index 0)**. Every entry carries a **`number`** (monotonic int per type — highest = newest, never reused; new = current max + 1) and a **`date`** (ISO), plus its text field + extras: key_learnings `{number, date, key, value}` · sessions `{number, date, summary, status, tags}` · todos `{number, date, task, priority, status}` · observations `{number, date, note, tags}`. Stamp `number` + `date` and **prepend**; **don't hand-trim** — rollover archives the oldest *by number* automatically. + ## 2. Active Plans - Check any DPLANs or FPLANs referenced in this session diff --git a/src/aipass/memory/apps/handlers/learnings/manager.py b/src/aipass/memory/apps/handlers/learnings/manager.py index 62824ae3..d7cfa037 100644 --- a/src/aipass/memory/apps/handlers/learnings/manager.py +++ b/src/aipass/memory/apps/handlers/learnings/manager.py @@ -35,12 +35,10 @@ from datetime import datetime from aipass.prax.apps.modules.logger import get_system_logger from aipass.memory.apps.handlers.json import json_handler +from aipass.memory.apps.handlers.json.memory_files import read_memory_file_data, write_memory_file_simple logger = get_system_logger() -# Handler imports (relative within package) -from aipass.memory.apps.handlers.json.memory_files import read_memory_file_data, write_memory_file_simple - # ChromaDB subprocess for vectorization (resolved relative to handler location) _MEMORY_ROOT = Path(__file__).resolve().parents[3] CHROMA_SUBPROCESS_SCRIPT = _MEMORY_ROOT / "apps" / "handlers" / "storage" / "chroma_subprocess.py" diff --git a/src/aipass/spawn/templates/birthright/.trinity/local.json b/src/aipass/spawn/templates/birthright/.trinity/local.json index 75f4538d..0516179f 100644 --- a/src/aipass/spawn/templates/birthright/.trinity/local.json +++ b/src/aipass/spawn/templates/birthright/.trinity/local.json @@ -3,7 +3,7 @@ "document_type": "session_history", "document_name": "{{BRANCHNAME}}.LOCAL", "version": "2.0.0", - "schema_version": "2.0.0", + "schema_version": "3.0.0", "created": "{{DATE}}", "last_updated": "{{DATE}}", "managed_by": "{{BRANCHNAME}}", @@ -25,13 +25,14 @@ "current_lines": 0 } }, - "key_learnings": {}, + "key_learnings": [], "sessions": [ { - "session_number": 1, + "number": 1, "date": "{{DATE}}", "summary": "Branch initialized - {{BRANCHNAME}} created by aipass init.", - "status": "completed" + "status": "completed", + "tags": [] } ] } diff --git a/src/aipass/spawn/templates/birthright/.trinity/observations.json b/src/aipass/spawn/templates/birthright/.trinity/observations.json index 15d36d99..bfb8d873 100644 --- a/src/aipass/spawn/templates/birthright/.trinity/observations.json +++ b/src/aipass/spawn/templates/birthright/.trinity/observations.json @@ -3,7 +3,7 @@ "document_type": "collaboration_patterns", "document_name": "{{BRANCHNAME}}.OBSERVATIONS", "version": "1.0.0", - "schema_version": "1.0.0", + "schema_version": "3.0.0", "created": "{{DATE}}", "last_updated": "{{DATE}}", "managed_by": "{{BRANCHNAME}}", @@ -28,9 +28,10 @@ }, "observations": [ { + "number": 1, "date": "{{DATE}}", - "pattern": "Branch initialized. Ready to begin capturing collaboration patterns.", - "source": "initialization" + "note": "Branch initialized. Ready to begin capturing collaboration patterns.", + "tags": [] } ] } diff --git a/src/aipass/spawn/templates/builder/.trinity/local.json b/src/aipass/spawn/templates/builder/.trinity/local.json index e7dcb27c..cd360921 100644 --- a/src/aipass/spawn/templates/builder/.trinity/local.json +++ b/src/aipass/spawn/templates/builder/.trinity/local.json @@ -3,7 +3,7 @@ "document_type": "session_history", "document_name": "{{BRANCHNAME}}.LOCAL", "version": "2.0.0", - "schema_version": "2.0.0", + "schema_version": "3.0.0", "created": "{{DATE}}", "last_updated": "{{DATE}}", "managed_by": "{{BRANCHNAME}}", @@ -28,13 +28,14 @@ } }, "todos": [], - "key_learnings": {}, + "key_learnings": [], "sessions": [ { - "session_number": 1, + "number": 1, "date": "{{DATE}}", "summary": "Branch initialized - {{BRANCHNAME}} created by aipass init.", - "status": "completed" + "status": "completed", + "tags": [] } ] } \ No newline at end of file diff --git a/src/aipass/spawn/templates/builder/.trinity/observations.json b/src/aipass/spawn/templates/builder/.trinity/observations.json index 15d36d99..bfb8d873 100644 --- a/src/aipass/spawn/templates/builder/.trinity/observations.json +++ b/src/aipass/spawn/templates/builder/.trinity/observations.json @@ -3,7 +3,7 @@ "document_type": "collaboration_patterns", "document_name": "{{BRANCHNAME}}.OBSERVATIONS", "version": "1.0.0", - "schema_version": "1.0.0", + "schema_version": "3.0.0", "created": "{{DATE}}", "last_updated": "{{DATE}}", "managed_by": "{{BRANCHNAME}}", @@ -28,9 +28,10 @@ }, "observations": [ { + "number": 1, "date": "{{DATE}}", - "pattern": "Branch initialized. Ready to begin capturing collaboration patterns.", - "source": "initialization" + "note": "Branch initialized. Ready to begin capturing collaboration patterns.", + "tags": [] } ] }