ECC’s memory-persistence hooks form a lifecycle contract that keeps agent context coherent across session restarts and context compactions. Rather than starting each session cold, theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/affaan-m/ECC/llms.txt
Use this file to discover all available pages before exploring further.
session:start hook loads a bounded snapshot of prior state — active work items, recent decisions, session metadata — while pre:compact saves a fresh snapshot before the harness truncates history. This design prevents context loss without flooding the context window.
Lifecycle Contract
The full memory-persistence hook table, sourced fromhooks/memory-persistence/:
| Event | Hook ID | Purpose | Blocking |
|---|---|---|---|
SessionStart | session:start | Load bounded prior context and project metadata | No |
PreCompact | pre:compact | Save state before compaction | No |
PreToolUse | pre:observe:continuous-learning | Capture tool intent for learning signals | No |
PostToolUse | post:observe:continuous-learning | Capture tool result for learning signals | No |
PostToolUse | post:session-activity-tracker | Record tool and file activity for ECC2 metrics | No |
Stop | stop:format-typecheck | Batch quality gate after edits | Yes (on hook failure) |
Stop | stop:check-console-log | Audit modified files for debug logging | Warn/error by hook output |
Session Execution Flow
Bounded Context Loading
Thesession:start hook loads only a relevant snapshot — not the full history. This is the key design choice that prevents context window exhaustion in long-running or frequently-restarted sessions.
What Gets Persisted
Session snapshot (PreCompact / SessionEnd)
Session snapshot (PreCompact / SessionEnd)
The
pre:compact and session-end hooks save:- Session ID, harness, repo root, start time
- Active skill runs (in-progress, with tokens used)
- Pending decisions (title, rationale, alternatives)
- Current work items (linked Linear, GitHub, handoff items)
- Recent tool-use observations (for continuous learning)
Tool observations (PostToolUse)
Tool observations (PostToolUse)
The
post:observe:continuous-learning hook captures:- Tool name and input (truncated for token safety)
- Tool output summary
- Timestamp and session ID
Activity metrics (PostToolUse)
Activity metrics (PostToolUse)
The
post:session-activity-tracker hook records for ECC2 metrics:- Tool name and invocation count
- File paths touched
- Session ID reference
- Timestamp
npx ecc status and the ECC2 control pane.Script Implementations
The hooks delegate to scripts inscripts/hooks/:
| Script | Role |
|---|---|
session-start.js | Loads bounded prior context, detects project state |
pre-compact.js | Captures state snapshot before context compaction |
session-end.js | Persists session-end summaries from transcript metadata |
observe-runner.js | Records tool-use observations for continuous learning |
session-activity-tracker.js | Records tool usage and file activity for ECC2 |
Installation
Memory-persistence hooks are part of thehooks-runtime module, included in the core profile and above:
Operator Privacy Defaults
ECC’s memory-persistence design follows these defaults:- Local only — all persistence goes to the local SQLite state store, never to hosted services unless you explicitly enable an integration
- Transcript-safe — no raw transcripts are exported; only structured summaries and observations
- Opt-out available — disable via
ECC_SESSION_START_CONTEXT=offorECC_DISABLED_HOOKS - Profile-gated — all hooks respect
ECC_HOOK_PROFILE(minimal/standard/strict)