prompt-commit-linker
v0.1.0
Published
Links every git commit to the exact Claude Code prompt that produced it. Exports the full session to markdown and writes a trailer with a deep link to the prompt anchor.
Maintainers
Readme
Prompt & Commit Linker
Never lose track of which prompt led to which change. After every Claude Code session, this tool exports the full conversation to markdown inside your project, then creates a git commit whose message contains a direct link to the exact prompt that produced the diff.
Install
npm install -g prompt-commit-linker
# or without installing:
npx prompt-commit-linker claude-commitRequires Node.js ≥ 18.
The package ships two CLIs:
claude-commit— interactive commit with Claude-prompt trailers.claude-export-session— JSONL → markdown exporter, standalone.
Manual use
claude-commit
# or, when cloned from the repo:
npm run commit
node scripts/claudeCommit.mjsFlags:
-m, --message "..."— use the given text as the commit subject instead of asking interactively. Useful for non-interactive runs (CI, scripts) or when you already know the subject. Combined with--td, the text is translated before committing.--dry-run— print what would be committed, don't commit.--max-age-min N— ignore sessions older than N min whentranscript_pathisn't passed via stdin (default 60).--td— translate the final commit subject to English via the Anthropic API. ReadsANTHROPIC_API_KEYfrom the environment or from a.envfile at the repo root. On failure, keeps the original subject. Via npm usenpm run commit --td.--t— translate the entire exported session markdown file to English via the Anthropic API. Preserves markdown, code blocks, HTML tags, anchors, UUIDs, and whitespace; only natural-language prose is translated. Uses temperature 0 for maximum precision. ReadsANTHROPIC_API_KEYlike--td. On failure, keeps the original file. Via npm usenpm run commit --t.--auto— silent exit on empty diff (used by the Stop hook).
Environment
Translation flags (--td, --t) read from .env at the repo root (see
.env.example):
ANTHROPIC_API_KEY— required when translation is enabled.CLAUDE_TRANSLATE_MODEL— optional, overrides the default translation model (claude-opus-4-7).
Automatic use (Stop hook)
The repo ships with .claude/settings.json which
runs node scripts/claudeCommit.mjs --auto --td --t on every Stop event.
On empty diff → silent exit. With changes → interactive TUI, subject
translated to English, and exported session file translated to English.
Override per-user settings in .claude/settings.local.json (gitignored).
Commit format
<subject>
Claude-Session: 2a2de356-78f4-4f80-8c87-52b2b322aa66
Claude-Prompt: f5883fb3-5cd1-4ec0-b899-02d41f81cd1b
Claude-Prompt-Link: claude/2026.04.18-18:30_VSCode_..._e6ad8933.md#msg-f5883fb3Claude-Prompt-Link points to an HTML anchor in the exported markdown — the
anchor is rendered by both GitHub and GitLab web UIs.
Files
- scripts/claudeCommit.mjs — orchestrator (stdin → git).
- scripts/exportLastSession.mjs — JSONL →
markdown with
<a id="msg-<uuid>">anchors. Usable standalone vianode scripts/exportLastSession.mjs --transcript <path>.
