# Pull Context

> Pull the context of another Claude Code session into the current one. Lists recent sessions (by topic hint), lets the user pick one, distills that session's transcript in a subagent, and injects the digest here. Use when the user says "pull context from", "bring in the other session", "import that session about X", or wants to merge work from a parallel session.

- Skill: `srinivas-dev-stack/pull-context` (Agent Skill, multi-file: 5 files)
- Install (CLI): `npx skillmds@latest add srinivas-dev-stack/pull-context`
- Raw SKILL.md: https://api.skillmd.com/api/skills/srinivas-dev-stack/pull-context/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: srinivas-dev-stack (https://skillmd.com/u/srinivas-dev-stack)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/srinivas-dev-stack/pull-context

---


# Pull context from another session

Retrieval-on-demand: source sessions need no prep — their transcripts already
live on disk at `~/.claude/projects/<encoded-cwd>/<session-id>.jsonl`. This skill
finds the right one, distills it in a **subagent** (so the large transcript never
enters the current session), and drops the digest into this conversation.

## Arguments (free-form, all optional)
- A search term → pre-filter the list (e.g. `/pull-context alerting`).
- `--all` → search across every project, not just the current one.
- `verbatim` → pull the literal recent messages instead of a distilled summary.

## Steps

1. **List candidates.** Run the lister, passing through any search term / `--all`:
   ```
   python3 ~/.claude/skills/pull-context/list_sessions.py [term] [--all]
   ```
   It prints rows of `# | age | msgs | topic` plus each session's transcript path.
   If the current project has no match it **auto-falls back to all projects** and
   prints a `(... showing ALL projects)` notice with `[project]` tags on each row —
   so you usually don't need to pass `--all` yourself.

2. **Pick the source session.**
   - If the user already named the topic clearly and exactly one row matches, use it.
   - Otherwise show the list and ask which number they want.
   - **Never pick the current session.** Identify it by matching the first user
     message in this conversation against the topic hints, and exclude it.

3. **Distill (default) — do this in a subagent so the transcript stays out of
   the main context.** Spawn an `Explore` (or `general-purpose`) agent with the
   chosen transcript path and this instruction:

   > Read this Claude Code session transcript (JSONL, one event per line; user
   > and assistant turns are under `.message.content`): `<PATH>`.
   > Produce a tight digest, no preamble, in this exact structure:
   >
   > - **Goal** — what that session was trying to accomplish.
   > - **Current state** — where it actually ended up (done / in progress / blocked).
   > - **Decisions & why** — choices made and the reasoning, including rejected options.
   > - **Key pointers** — files, paths, PRs, IDs, commands, dashboards referenced.
   > - **Open questions / next steps** — what was unresolved or queued.
   >
   > Favor specifics (exact file paths, identifiers, values) over narration.
   > Omit a section only if the transcript genuinely has nothing for it.

   For `verbatim` mode, skip the subagent and run the extractor to pull the last
   ~15 user/assistant turns (exact text, code, and tool commands preserved):
   ```
   python3 ~/.claude/skills/pull-context/extract_tail.py <PATH> [N]
   ```
   (Heavier and noisier than the digest — use only when the user needs literal
   wording or code from the other session.)

4. **Inject** the result into this conversation inside a clearly labeled block so
   it's obvious where it came from and that it's reference, not new instruction:

   ```
   --- Pulled context: "<topic>" (session <short-id>, <age>) ---
   <digest or verbatim slice>
   --- end pulled context ---
   ```

   Then give a one-line orientation ("That session left off at X; here's how it
   connects to what we're doing") and ask how they want to use it.

## Notes
- The lister marks the current session as `(THIS SESSION — skip)` when
  `CLAUDE_SESSION_ID` is set; if it isn't, fall back to topic-matching (step 2).
- If the user wants context from several sessions, distill each in its own
  subagent and inject them as separate labeled blocks.
- Distilling keeps this session's context budget clean — prefer it unless the
  user explicitly needs exact wording or code (`verbatim`).

