From agent-almanac
Reads a CONTINUE_HERE.md continuation file at session start and resumes from where a prior session left off, detecting freshness, parsing structured handoff, and cleaning up after consumption.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agent-almanac:read-continue-hereThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Read a structured continuation file and resume work from where the prior session left off.
Read a structured continuation file and resume work from where the prior session left off.
Check for CONTINUE_HERE.md in the project root:
ls -la CONTINUE_HERE.md 2>/dev/null
If absent, exit gracefully — there is nothing to continue from.
If present, read the file contents. Parse the 5 sections: Objective, Completed, In Progress, Next Steps, Context. Extract the timestamp and branch from the header line.
Expected: The file is read and its sections are parsed into a clear mental model of the prior session's state.
On failure: If the file exists but is malformed (missing sections, empty), treat it as a partial signal — extract whatever is present and note what is missing to the user.
Compare the file's timestamp against the current time:
# File modification time
stat -c '%Y' CONTINUE_HERE.md 2>/dev/null || stat -f '%m' CONTINUE_HERE.md
# Current time
date +%s
Classify freshness:
Check branch alignment:
git branch --show-current
git log --oneline --since="$(stat -c '%Y' CONTINUE_HERE.md | xargs -I{} date -d @{} --iso-8601=seconds)" 2>/dev/null
Expected: A freshness assessment with classification (fresh, stale, or superseded) and supporting evidence.
On failure: If not in a git repo, skip branch and commit checks. Rely on the timestamp in the file header alone.
Present the continuation state to the user concisely:
If freshness is "stale" or "superseded", present the evidence and ask whether to proceed with the handoff or start fresh.
If any Next Steps items are tagged **[USER]**, surface those explicitly — they require user decisions before work can proceed.
Expected: The user confirms the resumption plan, possibly with adjustments. The agent has a clear mandate for what to do next.
On failure: If the user says "start fresh" or "ignore that file", acknowledge and proceed without the continuation context. Offer to delete the file to prevent future confusion.
Begin working from Next Steps item 1 (or wherever the user directed):
Expected: The agent is productively working on the right task, informed by the continuation file.
On failure: If the Next Steps are ambiguous or the In Progress state is unclear, ask the user for clarification rather than guessing.
After the handoff is consumed and work is underway, delete CONTINUE_HERE.md:
rm CONTINUE_HERE.md
Stale continuation files cause confusion in future sessions.
Expected: The file is removed. The project root is clean.
On failure: If the user wants to keep the file (e.g., as a reference during the session), leave it but note that it should be deleted before session end to prevent the next session from re-consuming it.
If not already configured, set up automatic reading of CONTINUE_HERE.md on session start.
Create the hook script:
mkdir -p ~/.claude/hooks/continue-here
cat > ~/.claude/hooks/continue-here/read-continuation.sh << 'SCRIPT'
#!/bin/bash
# SessionStart hook: inject CONTINUE_HERE.md into session context
# OS-aware: works on native Linux, WSL, macOS, and Windows (Git Bash/MSYS)
set -uo pipefail
# --- Platform detection ---
detect_platform() {
case "$(uname -s)" in
Darwin) echo "mac" ;;
Linux)
if grep -qi microsoft /proc/version 2>/dev/null; then
echo "wsl"
else
echo "linux"
fi ;;
MINGW*|MSYS*|CYGWIN*) echo "windows" ;;
*) echo "unknown" ;;
esac
}
PLATFORM=${PLATFORM:-$(detect_platform)}
CONTINUE_FILE="$PWD/CONTINUE_HERE.md"
if [ ! -f "$CONTINUE_FILE" ]; then
exit 0
fi
# Strip CRLF (files on NTFS often have Windows line endings)
CONTENT=$(sed 's/\r$//' "$CONTINUE_FILE")
# JSON-escape: prefer jq, fall back to portable awk
if command -v jq >/dev/null 2>&1; then
ESCAPED=$(printf '%s' "$CONTENT" | jq -Rsa .)
else
ESCAPED=$(printf '%s' "$CONTENT" | awk '
BEGIN { ORS=""; print "\"" }
{
gsub(/\\/, "\\\\")
gsub(/"/, "\\\"")
gsub(/\t/, "\\t")
if (NR > 1) print "\\n"
print
}
END { print "\"" }
')
fi
cat << EOF
{"hookSpecificOutput":{"sessionStartContext":{"additionalContext":$ESCAPED}}}
EOF
SCRIPT
chmod +x ~/.claude/hooks/continue-here/read-continuation.sh
Add to ~/.claude/settings.json in the SessionStart hooks array:
{
"type": "command",
"command": "~/.claude/hooks/continue-here/read-continuation.sh",
"timeout": 5
}
Expected: The hook script exists, is executable, and is registered in settings.json. On next session start, if CONTINUE_HERE.md exists, its content is injected into the session context.
On failure: Check that settings.json is valid JSON after editing. Test the hook manually: cd /your/project && ~/.claude/hooks/continue-here/read-continuation.sh. The script falls back to awk if jq is not installed, so jq is recommended but not required.
Add a brief instruction to the project's CLAUDE.md so Claude understands the file's purpose:
## Session Continuity
If `CONTINUE_HERE.md` exists in the project root, read it at session start. It contains a structured handoff from a prior session: objective, completed work, in-progress state, next steps, and context. Act on it — acknowledge the continuation, summarize prior state, and propose resuming from the Next Steps section. If the file is older than 24 hours, flag this to the user before proceeding. After the handoff is consumed, the file can be deleted.
Expected: CLAUDE.md contains the instruction. Future sessions will read and act on CONTINUE_HERE.md even if the SessionStart hook is not configured.
On failure: If CLAUDE.md does not exist, create it with just this section. If the file is too long, add the instruction near the top where it will not be truncated.
write-continue-here — the complement: writing the continuation file at session endbootstrap-agent-identity — full identity reconstruction that includes continuation detection as one heuristicmanage-memory — durable cross-session knowledge (complements this ephemeral handoff)write-claude-md — project instructions where the optional continuity guidance livesnpx claudepluginhub pjt222/agent-almanacWrites a CONTINUE_HERE.md file capturing session state so a fresh Claude Code session can pick up where the last one left off. Use when ending a session with unfinished work or handing off context between sessions.
Restores context, todos, and work state from a previous session that hit the context threshold. Reads handoff files to continue work seamlessly.
Resumes prior AI coding-agent work by reconstructing context from transcripts, chat logs, or session summaries before continuing from the actual stopping point.