Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Reconstruct

БесплатноБез исполняемых скриптовНе проверен

Retroactively create session notes from JSONL transcripts and git history when automatic capture failed or was incomplete. USE WHEN user says 'reconstruct…

mnottот mnott★ 74 звезды на GitHub

Об этом скилле

Reconstruct Skill

USE WHEN user says 'reconstruct sessions', 'rebuild session notes', 'recover session notes', 'retroactively create notes', 'create notes from git history', 'notes are missing', 'backfill session notes', 'reconstruct what we did', OR /reconstruct.

What This Skill Does

Reconstructs session notes for a PAI-registered project by reading:

  1. Git commit history (authoritative record of what was built)
  2. JSONL transcripts (user messages reveal intent, decisions, and context)

Generates one session note per day (or per logical session if multiple sessions existed in a day), numbered sequentially from the highest existing note number.

ONLY include what can be verified from git log and JSONL. Never invent or embellish content.


Arguments

Argument Default Description
--days N 7 Reconstruct notes for the last N days
--since YYYY-MM-DD — Reconstruct from this date forward
--until YYYY-MM-DD today Reconstruct up to this date
--dry-run false Show what would be created without writing files
--commit false Git commit the created notes after writing

Pre-Action Check

Before starting, verify:

  1. Project is registered: Run pai project detect (or pai project list) to confirm the current project is known to PAI and get its Notes directory path.
  2. Notes directory exists: The target directory should be Notes/YYYY/MM/. Create it if absent.
  3. Find highest existing note number: Scan all Notes/**/*.md files for the pattern ^NNNN to find max note number. New notes continue from there.
  4. NEVER overwrite existing notes: If a note file already exists for that date/session, skip it and warn the user.

Step 1 — Find JSONL Files

Claude Code encodes project paths lossily: /, spaces, dots, hyphens all become -. A project may have been accessed from multiple base directories (e.g., ~/Cloud/Development/PAI and ~/dev/PAI both encode to different paths).

Search strategy — use glob patterns, not exact paths:

# Find all encoded project directories that might match this project
ls ~/.claude/projects/ | grep -i "<project-slug-fragment>"

# For each candidate, look for JSONL files
ls ~/.claude/projects/<encoded-path>/*.jsonl 2>/dev/null

# Also check the dev copy if the project has one
# Example: if cwd is ~/dev/PAI, also check ~/Cloud/Development/PAI encoding

Collect ALL JSONL files from ALL matching encoded paths. A session may have been started from either location.


Step 2 — Determine Time Range

Calculate the date range from arguments:

  • --days 7 → from (today - 7 days) to today
  • --since 2026-03-01 → from that date to today (or --until date)
  • Default: last 7 days

Step 3 — Extract Git History

For each day in the range:

git -C <project-dir> log \
  --after="YYYY-MM-DD 00:00:00" \
  --before="YYYY-MM-DD 23:59:59" \
  --format="%H|%ad|%s" \
  --date=short \
  --stat

Group commits by day. If no commits on a day, skip that day (no note to reconstruct).

Also capture:

  • Files changed per commit (--stat)
  • Author date (not committer date) for accurate day grouping

Step 4 — Extract User Messages from JSONL

For each JSONL file, parse messages where type == "user" AND message.role == "user":

Each line is a JSON object. Look for:
{
  "type": "user",
  "message": {
    "role": "user",
    "content": "..." | [{"type": "text", "text": "..."}]
  },
  "timestamp": "2026-03-15T10:23:45.000Z"
}

Filter messages by timestamp to match the day being reconstructed.

Extract:

  • The text content of user messages (ignore tool_result entries)
  • Timestamps for ordering
  • Session ID (sessionId field) to group messages per session

SKIP messages that are:

  • Tool results (content is array with type: "tool_result")
  • System-generated (very short single-word messages like "go", "continue")
  • Pure confirmations ("yes", "ok", "sounds good")

KEEP messages that reveal:

  • Intent ("build a feature that...", "I need X to do Y")
  • Decisions ("let's use approach A instead of B")
  • Architectural choices
  • Problem descriptions
  • Requirements changes

Step 5 — Identify Logical Sessions

A "logical session" is a continuous work block. Use these signals to split a day into multiple sessions:

  • Gap of more than 3 hours between messages
  • Different JSONL session IDs with significant time gaps
  • Commits with clearly different themes separated by time

If only one logical session exists for a day, create one note. If multiple exist, create one note per session with a suffix: NNNN - YYYY-MM-DD - Title.md, NNNN+1 - YYYY-MM-DD - Title (2).md.


Step 6 — Generate Note Title

The note title comes from synthesizing git commits for that session:

  • If commits share a theme: use that theme ("Implement vault indexer")
  • If commits are varied: use the primary/largest change ("Refactor session not
Полный SKILL.md на GitHub

Установить Reconstruct в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Reconstruct?

Retroactively create session notes from JSONL transcripts and git history when automatic capture failed or was incomplete. USE WHEN user says 'reconstruct sessions', 'rebuild session notes', 'recover session notes', 'retroactively create notes', 'create notes from git history', 'notes are missing', 'backfill session notes', 'reconstruct what we did', OR /reconstruct.

Как установить скилл Reconstruct?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Reconstruct запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Reconstruct с