| name | cf-session |
| description | Save the current Claude Code session to docs/sessions/ for cross-machine resume. Use when the user wants to save their session — e.g. "save this session", "I want to continue on another machine", "save my progress", "export this conversation", "sync this session", "bookmark this session". Pairs with `cf session load` + `claude --resume` on the target machine.
|
| disable-model-invocation | true |
| model | haiku |
| allowed-tools | ["Bash","Read"] |
| created | 2026-03-05T00:00:00.000Z |
| updated | 2026-07-04T00:00:00.000Z |
| state | beta |
/cf-session
CLI Requirement: NONE — Works without coding-friend-cli. See CLI requirements for the full matrix.
Save the current Claude Code session to docs/sessions/ so it can be restored on another machine.
Label: $ARGUMENTS
Workflow
Step 0: Custom Guide
Custom guide — auto-loaded below (if the raw command shows instead of its output, run it yourself):
bash "${CLAUDE_PLUGIN_ROOT}/lib/load-custom-guide.sh" cf-session
If output is not empty, integrate returned sections: ## Before → before first step, ## Rules → apply throughout, ## After → after final step.
Step 1: Resolve Sessions Folder
Output goes to {docsDir}/sessions/ (default: docs/sessions/). Check .coding-friend/config.json for custom docsDir if it exists.
- Use
MAIN_REPO_ROOT from the SessionStart bootstrap context (injected via session-init.sh). If absent, fall back to running pwd for $CWD and use $CWD as MAIN_REPO_ROOT.
- Read config from
CF_CONFIG_FILE (= $MAIN_REPO_ROOT/.coding-friend/config.json) — do NOT search sub-folders
- Use
CF_DOCS_ROOT as the docs base dir (= $MAIN_REPO_ROOT/{docsDir} where docsDir comes from config, default docs)
- Always resolve the sessions path as an absolute path:
{CF_DOCS_ROOT}/sessions/
Create the folder if it doesn't exist:
mkdir -p "{CF_DOCS_ROOT}/sessions"
Step 2: Detect Active Session
Run the detection script. It outputs two lines: the full JSONL path and the session ID.
CF_SESSION_SCRIPTS="${CLAUDE_PLUGIN_ROOT}/skills/cf-session/scripts"
OUTPUT=$(bash "$CF_SESSION_SCRIPTS/detect-session.sh")
LATEST=$( | -1)
SESSION_ID=$( | -1)