Overview
context-capture is the only skill the user never invokes directly. The Claude Code post-commit hook combined with the SKILL.md enforcement message activates it automatically right after every commit — the agent summarizes its own conversation context, and capture.js writes the body directly into the aiflare/timeline/v1 orphan branch (entries/<commitHash>.json) in the user's git repo. Backend delivery is consolidated into a single sync trigger at git push time.
What gets captured
A single commit produces one Timeline Entry that bundles the seven fields below.
| Field | Type | Description |
|---|---|---|
| title | string | Work title under 50 chars. Defaults to the commit message's subject line. |
| intent | markdown | Why this change was needed, written as Problem → Solution → Effect. The rule is to make decision context survive six months from now. |
| alternatives | markdown | Only alternatives explicitly raised in the conversation and the reason they were rejected. Empty string if no signal — speculation is forbidden. |
| diffSummary | markdown | Per-file summary of key changes. Excludes incidental noise like import cleanup or formatting. |
| tag | enum | One of FEATURE · BUGFIX · REFACTORING · TEST · DOCS. Used to filter the dashboard by change type. |
| changedFiles | string[] | Changed-file list pulled verbatim from git diff --name-only HEAD~1 HEAD. |
| conversationSnippet | jsonl | JSONL of user + AI conversation since the previous capture. Extracted by line-count (message-index) delta and stored alongside the Entry. |
How it works
A seven-stage pipeline: Hook → Skill → server → grouping → push. There is nothing the user has to invoke.
On session start, exports CLAUDE_SESSION_ID into $CLAUDE_ENV_FILE so capture.js can deterministically resolve the current session — required for correct routing under parallel Claude Code sessions.
Appends user prompts and AI responses as JSONL lines into .claude-prompts-{SESSION_ID}.
Right after AskUserQuestion, drops a .pending-question flag file. Used as the next commit's continuation signal so grouping isn't broken.
Right after git commit: ① PUT the full conversation JSONL to /work-sessions/prompt, ② extract only new lines since the previous capture into a delta file, ③ emit the Skill enforcement message.
The agent analyzes its own context to generate title/intent/alternatives/diffSummary/tag, then runs capture.js. The delta file is auto-read and attached as conversationSnippet. No backend transmission — the body is written to the git tree in the next phase.
capture.js writes the body to entries/<commitHash>.json on the aiflare/timeline/v1 orphan branch. No backend call at this point (works offline); grouping (group_root_id) is decided on the next push during backend sync.
The pre-push hook pushes the aiflare/timeline/v1 branch to the user's git remote (force-with-lease), then sync-captures.js calls POST /api/v1/captures/sync (no body). The backend fetches the timeline branch via the registered git remote credential using standard git protocol, then reconciles DB metadata and resolves group_root_id (based on the previous entry and the continuation flag). POST /captures and POST /captures/batch were permanently removed (410 Gone) in Phase 6.
How other skills use it
The Timeline Entries and EntryConversations produced by context-capture are consumed directly by the skills below. If this skill stops working, every other skill loses its input.
Joins captured intent and alternatives with git log -L by line, producing a chronological timeline of why this single line was written that way.
Aggregates one session's captures into a one-page report of goal, considered alternatives, and final changes, then saves it on the server.
Re-injects the report saved by summarize into a new session's LLM context, carrying the decision context over verbatim.
Auto-compiles a day's worth of captures into a Markdown report covering commits, sessions, tag distribution, and key decisions.
Aggregates a week's captures by member and area to produce a team-perspective weekly report.
Compares two sessions' captures side by side on intent, approach, and outcomes.
Grades captured user prompts against Claude Code best practices and proposes improvements.
Troubleshooting
Five most common reasons capture doesn't fire.