Capture a coding session from inside it

A hands-on ENGRAM walkthrough · August 3, 2026

Capturing the ground truth of a work session — the commit, the files you touched, and a short "what we built" note — from inside the session, and handing it to ENGRAM. Works from any agent that reaches ENGRAM over MCP, not just Claude Code.

Pairs with Tutorial 5 (the Build Timeline): git tells ENGRAM what shipped; captured sessions tell it why — even from tools the Watcher can't see.

1. Why this tutorial exists

ENGRAM already has a passive Watcher that ships your Claude Code CLI sessions into your Knowledge Hub by tailing the transcript files on disk. It's automatic and complete — but it has three blind spots, all from the same root: it reconstructs meaning after the fact from one tool's private on-disk format.

  1. It only sees Claude Code CLI. Work done in Cowork, Claude Desktop, a Goose-run agent, or any other coding tool leaves no ~/.claude/projects/*.jsonl for the Watcher to read. Those sessions are invisible.
  2. It can't reach the pruned past. Once a transcript file is deleted, the meaning in it is gone — the Watcher can only re-read files that still exist.
  3. Its signal is thin. A quiet git commit -q prints no SHA for the Watcher to catch, and the auto-captured recap is usually the tool's "this session is being continued…" boilerplate, not a distilled account of what you built.

Session capture fixes all three by capturing at the source. A skill — or a single MCP call — runs inside the live session and gathers ground truth: the exact HEAD SHA, the files you touched (git diff), and a summary you author. No dependence on a transcript file existing, surviving, or being parseable.

Crucially, it's additive: capture and the Watcher both key on the same session_id, so they enrich the same session in the graph — the capture supplies the exact SHA and a good summary, the Watcher (if it also ran) supplies the exhaustive action list. Nothing forks, nothing is duplicated.

2. What you'll do

  1. Capture a coding session with the capture_session MCP tool — the harness-neutral way that works from any MCP-connected agent.
  2. (Optional) Do the same with the /capture-session slash command in Claude Code.
  3. See the captured session appear in Coding Sessions, converge with the Watcher's record, and light up as evidence (◇ N sess) on your Build Timeline components.

3. Prerequisites

RequirementNotes
Session capture enabled on your ENGRAMENGRAM is a shared, multi-user system — features are turned on by your administrator. If the calls below return 404 "Session capture is not enabled", ask your admin to enable it.
An MCP connection to ENGRAMClaude Code (native http + Bearer PAT), Claude Desktop (mcp-remote), Cowork, or any MCP host — the same connection you use for the other ENGRAM tools.
A git repo you're working inCapture reads its git state; nothing is cloned or modified.
A PAT (engram_pat_*)Only needed for the script path; your MCP connection already carries it.

Everything below runs as you — capture is filed under the identity of the PAT behind your MCP connection, and (like every ENGRAM write) is private to you.

Part 1 — Capture with the MCP tool (the harness-neutral way)

This is the primary path: it needs nothing installed beyond the MCP connection you already have, and it works from any agent — Cowork, Claude Desktop, a Goose worker, Claude Code — exactly the surfaces the Watcher is blind to.

At a session boundary (end of a work block, or after a milestone), have the agent gather three things with a shell and call the tool:

# 1. the session id — however your harness names the session
# 2. git ground-truth
head_sha=$(git rev-parse HEAD)
touched=$(git diff --name-only <base>..HEAD)   # <base> = HEAD at session start, or @{u}
repo_url=$(git remote get-url origin)

# 3. author a short "what we built / decided / rejected" summary

Then call capture_session:

capture_session(
    session_id="<your-session-id>",
    summary="Added jitter to the checkout-service token-refresh retry loop; "
            "root-caused the auth-suite flake to a missing backoff. Rejected a "
            "blanket retry-count bump as it masked the real timing bug.",
    head_sha="<head_sha>",
    touched=["services/checkout/auth.py", "services/checkout/tests/test_auth.py"],
    repo_url="git@github.com:your-org/checkout-service.git",
    branch="main",
)
A capture_session MCP tool call with session_id, summary, head_sha, touched files, branch and repo_url, followed by its JSON response showing captured: true, actions_written: 11, recaps_written: 1, session_created: true, errors: []
One capture_session call and its response — the session is written from inside the work, no transcript required.

Part 2 — The /capture-session slash command (Claude Code)

If you're in Claude Code, a slash command wraps the same capture with the gathering done for you:

/capture-session <session-id>

The command's skill gathers the git state, asks the agent to author the summary, and posts the capture — no manual shell steps.

The /capture-session slash command running in Claude Code: the skill gathers the git ground truth — HEAD sha, branch, repo_url, the session id, the session's commits, and the touched files — automatically before capturing.
The /capture-session skill gathering the ground truth for you — HEAD sha, session id, and touched files — before it captures.

Adding the skill. The slash command ships as a small skill folder. Drop it into your project's (or user) .claude/ directory:

.claude/
  commands/capture-session.md          # the /capture-session slash command
  skills/capture-session/
    SKILL.md                           # how to gather + author the summary
    capture.sh                         # git ground-truth + POST to ENGRAM

With the skill present and your ENGRAM MCP connection configured, /capture-session is available in the CLI. (The MCP tool in Part 1 needs none of this — reach for the slash command only for the Claude Code convenience.)

Part 3 — See it in ENGRAM

Open Coding Sessions and select the project. The captured session is there alongside any Watcher-ingested ones:

The Build Timeline Components tab, with captured sessions showing as evidence next to the components they touched.
The Build Timeline's Components tab — captured sessions surface as evidence on the components they touched.
The Build Timeline Features tab, grouping releases into named initiative arcs, with the sessions that built each one.
The Features tab — drill into an initiative to see its releases, components, and the sessions behind them.

What this does and doesn't give you

It gives you:

It doesn't:

Appendix — Gotchas, ranked by how much time they'll cost you

  1. 404 "Session capture is not enabled." The feature is off on your ENGRAM. It's an administrator setting on this shared system — ask your admin to enable it; you can't flip it yourself.
  2. The session filed under the wrong (or no) project. Pass repo_url (git remote get-url origin). Without it, ENGRAM falls back to the working-directory path to name the project — which won't match a project created from git elsewhere.
  3. No touched files → no timeline evidence. The ◇ N sess links come from touched mapping to component paths. A summary-only capture is a valid record but won't attach to components.
  4. The base for "touched since session start." git diff --name-only <base>..HEAD needs a <base> — the HEAD SHA when the session started. If you didn't capture it, @{u} (the upstream) or the merge-base is a good best-effort; recording something beats nothing.
  5. Quiet commits. git commit -q hides the SHA from the Watcher — capturing git rev-parse HEAD yourself is exactly how you get it into ENGRAM anyway.