agentleFS
Tod8CruzTod8Cruz/claude-session-share/skills/session-import/skill.md

session-import

Skill0 starsChanged 6 months agoMITView on GitHub

Import a shared JSONL session file into Claude Code's session list for the current project. Makes someone else's exported conversation available to continue or review here. Use when asked to "import session", "load session", "add session", "불러와", "세션에 불러와", "load this jsonl", or "/session-import filename.jsonl".

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Import a JSONL session file so it appears in this project's Claude Code session history.

    line 24
  2. Very specific:

    If the file doesn't look like a Claude Code session JSONL (should contain queue-operation or sessionId), warn the user and confirm before …

    line 44
  3. Distinctive:

    Ask the user if they want to overwrite, unless it's clearly safe (e.g., file sizes differ significantly).

    line 98
  4. Distinctive:

    If the imported session was from a different project path, the conversation context will still be readable but code references may not map …

    line 114

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

Instructions

Import a JSONL session file so it appears in this project's Claude Code session history.

Step 1 — Validate the file

Get the filename from the user's argument or ask for it.

IMPORT_FILE="<filename from user>"

# Check file exists
if [ ! -f "$IMPORT_FILE" ]; then
  echo "ERROR: File not found: $IMPORT_FILE"
  exit 1
fi

# Preview first few lines to confirm it's a valid session
head -3 "$IMPORT_FILE"
wc -l "$IMPORT_FILE"

If the file doesn't look like a Claude Code session JSONL (should contain queue-operation or sessionId), warn the user and confirm before proceeding.

Step 2 — Find sessions directory

ENCODED=$(echo "$PWD" | sed 's|/|-|g; s| |-|g; s|~|-|g')
SESSION_DIR=~/.claude/projects/"$ENCODED"
mkdir -p "$SESSION_DIR"
echo "Target sessions dir: $SESSION_DIR"

Step 3 — Extract or generate session ID

# Try to extract sessionId from the JSONL
SESSION_ID=$(python3 -c "
import sys, json
for line in open('$IMPORT_FILE'):
    try:
        obj = json.loads(line)
        sid = obj.get('sessionId') or obj.get('session_id')
        if sid:
            print(sid)
            break
    except: pass
" 2>/dev/null)

# Fallback: use the filename stem if it looks like a UUID
if [ -z "$SESSION_ID" ]; then
  STEM=$(basename "$IMPORT_FILE" .jsonl)
  if echo "$STEM" | grep -qE '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'; then
    SESSION_ID="$STEM"
  fi
fi

# Last resort: generate a new UUID
if [ -z "$SESSION_ID" ]; then
  SESSION_ID=$(uuidgen 2>/dev/null | tr '[:upper:]' '[:lower:]' || python3 -c "import uuid; print(uuid.uuid4())")
fi

echo "Session ID: $SESSION_ID"
DEST="$SESSION_DIR/$SESSION_ID.jsonl"
echo "Destination: $DEST"

Step 4 — Warn if session already exists

if [ -f "$DEST" ]; then
  echo "WARNING: A session with ID $SESSION_ID already exists at $DEST"
  echo "Overwrite? (If yes, continue; if no, stop here)"
fi

Ask the user if they want to overwrite, unless it's clearly safe (e.g., file sizes differ significantly).

Step 5 — Copy to sessions directory

cp "$IMPORT_FILE" "$DEST"
ls -lh "$DEST"
echo "Import complete."

Step 6 — Confirm and guide the user

Tell the user:

  • Session ID that was imported
  • Full path of the destination file
  • How to access it: In Claude Code, use the session picker (the history list) — the imported session should appear with its original timestamp. You may need to restart Claude Code or open a new window for it to appear.
  • If the imported session was from a different project path, the conversation context will still be readable but code references may not map to local files.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.