Pain #3: after
/compact(or a new engine session) the agent forgets what is in progress, what was decided, and what is blocked. Fix: dump decisions into the inbox before compact, then load a handoff brief at session start.
This is about work state, not personality. For identity/owner/engine role
use samemind brief / the identity layer. For "what is going on right now" use
samemind handoff / MCP memory_handoff.
┌─ session ─────────────────────────────────────────────┐
│ 1. START → memory_handoff (or samemind handoff) │
│ 2. work → decisions? → memory_write_inbox NOW │
│ 3. END or PRE-COMPACT │
│ → write Session / Decision / Task updates │
│ → (optional) SessionEnd hook stub │
└───────────────────────────────────────────────────────┘
↓ /compact or new engine
┌─ next session ────────────────────────────────────────┐
│ START again → memory_handoff (no re-explaining) │
└───────────────────────────────────────────────────────┘
- Flush decisions — any plan/position agreed this session → MCP
memory_write_inbox(or a fullDecision/Plan/Sessionstub ininbox/). "I'll write it later" = lost to compact. - Update tasks in place — status changes, especially
blocked+blocked_reason. - Session summary —
## Done/## Decided/## Next(seedocs/work-discipline.mdand the SessionEnd hook example).
# CLI
OKF_ROOT=~/samemind npx samemind handoff
# optional focus
OKF_ROOT=~/samemind npx samemind handoff --project lumen --days 14Or via MCP: call memory_handoff with { "project"?: "…", "days"?: 14 }.
Paste or inject the markdown into context. Target size ≤ ~2000 tokens.
Hook event names and payload shape depend on your Claude Code version — treat this as a template, verify against current docs before relying on it.
One-liner that appends a pre-compact reminder into the inbox (does not delete anything; append-only):
OKF_ROOT="${OKF_ROOT:-$HOME/samemind}" sh -c 'mkdir -p "$OKF_ROOT/inbox"; printf "\n## %s — pre-compact\n\nFlush Decision/Session/Task to inbox before compact. Next session: memory_handoff.\n" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$OKF_ROOT/inbox/mcp.md"'OKF_ROOT="${OKF_ROOT:-$HOME/samemind}" npx samemind handoff{
"hooks": {
"PreCompact": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "OKF_ROOT=$HOME/samemind sh -c 'mkdir -p \"$OKF_ROOT/inbox\"; printf \"\\n## %s — pre-compact\\n\\nFlush Decision/Session/Task to inbox before compact. Next session: memory_handoff.\\n\" \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\" >> \"$OKF_ROOT/inbox/mcp.md\"'"
}
]
}
],
"SessionStart": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "OKF_ROOT=$HOME/samemind npx samemind handoff"
}
]
}
]
}
}On session start, run memory_handoff (MCP) or samemind handoff (CLI). See
docs/snippets/ — each paste-ready block includes that line.
| Section | Source |
|---|---|
| Active | Task with status: in-progress or blocked (+ reason) |
| Last decisions | Decision nodes within --days (default 14), newest first |
| Plans in force | Plan with status: agreed or in-progress (superseded skipped) |
| Last session | Freshest Session — Done / Decided / Next (short) |
| Open questions | Blocked tasks + ## Next bullets from last session |
Full type rules: docs/work-discipline.md.
Security: secret-visibility concepts are never loaded into the handoff.