plugins/agent-recap/skills/agent-recap/SKILL.md
Mine local Claude/Codex session history to produce a structured work recap for the past 1-7 days, with optional sync to GitHub Issues. Trigger when the user asks to summarize their recent work, generate a daily/weekly report, or wants to see what they solved/researched/reviewed/was blocked on. Default range is 1 day.
npx skillsauth add primatrix/skills agent-recapInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Scan local Claude Code and Codex CLI session jsonl files, classify each session into one of five work types (solved / researched / reviewed / blocked / misc), present the result as a Markdown checklist for the user to review, and optionally sync each entry to GitHub via gh issue comment or /beaver-create.
One optional natural-language time-range argument. Resolve to an integer N (days) and clamp to [1, 7]. If the user asks for > 7 days, silently cap at 7 and note it in the recap header.
| User input | N |
|---|---|
| (no argument) / 今天 / today | 1 |
| 昨天和今天 / yesterday and today | 2 |
| 本周 / this week | 7 |
| 过去 N 天 / N days / Nd | N |
Run the deterministic scanner with the resolved N:
python3 ${CLAUDE_PLUGIN_ROOT}/skills/agent-recap/scripts/scan_sessions.py --since <N>d
Output is one JSON document with sessions[] and errors[]. Per-session fields are documented in references/jsonl-schema.md.
Filter out trivial sessions before Phase 2:
user_msg_count == 0size_bytes < 1024If the scanner exits non-zero, print its stderr to the user and stop.
For each filtered session, dispatch one Agent tool call with subagent_type: "Explore". Dispatch ALL subagents in parallel — multiple Agent tool calls in a single message — so they run concurrently.
Subagent prompt template:
Read these reference files first:
- ${CLAUDE_PLUGIN_ROOT}/skills/agent-recap/references/jsonl-schema.md
- ${CLAUDE_PLUGIN_ROOT}/skills/agent-recap/references/classification-rubric.md
Then analyze the session jsonl at <path> and any subagent paths: <subagent_paths>.
For jsonls larger than ~200 KB, use Bash `head` / `tail` / `grep` to sample
instead of `Read`-ing the whole file. Useful grep patterns: git commit /
gh pr / Edit / Write tool_use lines, plus tone cues like "完美" "搞定"
"还是不行" "为什么没用".
Classify per the rubric and return ONLY the JSON object specified at the
end of classification-rubric.md. Do NOT extract any GitHub issue / PR
reference — issue linkage is decided interactively in Phase 5.
Session metadata for context:
cwd: <cwd>
git_branch: <git_branch>
tool_stats: <tool_stats>
user_msg_count: <user_msg_count>
first_user_msg: <first_user_msg>
last_user_msg: <last_user_msg>
When a subagent returns:
Group classified sessions by type in this fixed order: solved, researched, reviewed, blocked, misc. Within each group, sort by ended_at ascending. Render as Markdown:
## Recap: 过去 <N> 天(<YYYY-MM-DD>)
### ✅ 解决(<count>)
**1. <topic>**(<session.id[:8]>, <project>, <ended_at>)
- **目的**: <subagent.purpose>
- **过程**: <subagent.process>
- **结果**: <subagent.outcome>
...
### 🔎 调研(<count>)
(same per-entry shape)
### 👀 Review(<count>)
(same per-entry shape)
### 🚧 被 Block(<count>)
(same per-entry shape)
### 🗒️ 杂项(<count>)— 默认不进同步候选
- **<session.id[:8]>** (<ended_at>, <project>) — <subagent.topic>
### ⚠️ 解析失败(<count>)
- session <id> — <one-line reason>
Rules:
(0) in the count and (empty) in the body.(empty) if no failures.purpose / process / outcome are reproduced verbatim from the subagent JSON. Do NOT paraphrase or compress.After printing the recap, prompt the user:
请审阅以上清单。可以说:删掉第 X 条、第 Y 条改成 ...、合并第 A 和 B、确认无误。
Apply edits in memory only (no disk writes yet). Loop until the user confirms or refuses sync.
If the user declines sync ("不同步" / "我先不发" / similar), skip Phase 5 entirely.
Always run first:
mkdir -p ~/.agent-recap
find ~/.agent-recap -name "*-intents.json" -type f -mtime +30 -delete 2>/dev/null || true
Files named keep-*.json are exempt (the *-intents.json glob excludes them).
Present a per-entry decision table for every confirmed entry in {solved, researched, reviewed, blocked}. misc entries are excluded by default; only include them if the user explicitly opts them in.
📌 issue 关联 / 创建 决策
| 编号 | 摘要 | 选项 |
|---|---|---|
| ✅1 | <topic> | skip / 关联 issue # / 创建新 issue |
| ✅2 | <topic> | skip / 关联 issue # / 创建新 issue |
| ... | ... | ... |
请按编号告诉我每条的处理方式:
- **skip** — 不进同步
- **关联 <owner/repo>#<N>** — 用 `gh issue comment` 在该 issue 下贴一条进展评论
- **创建新 issue** — 主动调用 `/beaver-create` skill 走完整 Beaver 流程
(含 brainstorming QA + 自动 Status / Type / Size 字段填写 + 自动 commit/PR 钩子)
回复格式举例:
1: skip
2: 关联 sgl-project/sglang-jax#1234
3: 创建新 issue
或一句话:全 skip / 我先不同步,只看清单
Map each user reply to one kind:
skip — no action.comment_on_issue — user supplied owner/repo#N. Phase 5.3 will gh issue comment there.create_issue — user wants a new issue. Phase 5.3 will invoke /beaver-create (NOT raw gh issue create).Write ~/.agent-recap/<ISO-8601-timestamp>-intents.json:
{
"generated_at": "<ISO 8601>",
"actions": [
{"kind": "comment_on_issue", "issue": "<owner/repo#N>", "body": "<...>", "source_sessions": ["<id>", ...]},
{"kind": "create_issue", "repo": "<owner/repo>", "title": "<...>", "body": "<...>", "source_sessions": ["<id>", ...]},
{"kind": "skip", "reason": "user_skipped", "topic": "<...>", "source_sessions": ["<id>", ...]}
]
}
When multiple entries share the same target issue (comment_on_issue kind), aggregate them into a single comment with bullet points per entry.
Print the dry-run preview and prompt for the final confirmation:
即将执行:
1. gh issue comment <owner/repo>#<N> (body 前 80 chars...)
2. gh issue comment <owner/repo>#<N> ...
3. /beaver-create <owner/repo> ...
⚠️ 这些内容将以你的 GitHub 身份发到对应 Issue/PR,请确认无误。
intents 已保存到 ~/.agent-recap/<filename>(30 天后自动清理;
改名为 keep-*.json 可永久保留)。
回复:全部执行 / 只执行 1,3 / 取消。
For each chosen action:
kind == "comment_on_issue" — NEVER inline the body into the shell command (body is Markdown and almost certainly contains " / ` / $ / \ / newlines). Use a temp file:
tmp=$(mktemp); printf '%s' "$BODY" > "$tmp"
gh issue comment <owner/repo>#<N> --body-file "$tmp"
rm -f "$tmp"
Or equivalently, a stdin heredoc with a sentinel that does not appear in the body:
gh issue comment <owner/repo>#<N> --body-file - <<'AGENT_RECAP_EOF'
<body>
AGENT_RECAP_EOF
kind == "create_issue" — ALWAYS invoke the /beaver-create skill. /beaver-create runs the full Beaver lifecycle: brainstorming QA, Project V2 #14 Status / Type / Size field population, label hygiene, and engine guardrails. Pass the repo, title, and pre-rendered body. The same temp-file rule applies if /beaver-create shells out to gh. Do NOT call gh issue create directly.
kind == "skip" — no action.
Capture each action's exit status. Append a result field to the on-disk intents.json per action so the user can retry failures by hand. Do NOT auto-retry.
Summarize at the end:
✅ 成功 X 条
❌ 失败 Y 条
- 第 N 条: <stderr reason>
Format: ⚠️ <phase>: <one-line reason> (<locator>)
| Phase | Failure | Action |
|---|---|---|
| 1 | scanner exits non-zero | Print stderr, stop. |
| 2 | one subagent fails | List in ⚠️ section, continue. |
| 2 | ALL subagents fail | Still emit recap (empty groups + populated ⚠️). |
| 5 | gh / /beaver-create non-zero | Per-action failure recorded in intents.json, continue, no retry. |
purpose / process / outcome are reproduced verbatim from subagent JSON in Phase 3. Do not paraphrase.--body-file with mktemp or stdin heredoc.~/.agent-recap/*-intents.json files older than 30 days are auto-deleted at Phase 5.0. Rename to keep-*.json to preserve.Agent dispatch vs sequential) are absorbed by the runtime, not by branching in this file.development
Use when analyzing TPU pretraining HBM occupancy from a profile directory — locates the static HBM peak (the same number TensorBoard's Memory Viewer shows), enumerates every buffer alive at the peak schedule moment with size / HLO instruction / opcode / op_name, and rolls the alive set up by opcode and op_name. Reads compile-time `*.hlo_proto.pb` (BufferAssignmentProto) as the primary source; runtime `*.xplane.pb` allocator events are a secondary, often-truncated signal.
testing
Use when analyzing TPU pretraining compute efficiency from xplane.pb — produces source-line-aggregated HLO duration tables, layer-scoped breakdowns, non-compute (padding/cast/copy) audits, and v7x roofline shortfall vs theoretical peak. Reads schema documented by profile-anatomy.
tools
--- name: comm-analysis description: Use when analyzing communication on a TPU pretraining profile — extracts every comm primitive (async + sync, TC + SparseCore), attributes axes via HLO replica_groups, computes per-row NCCL bus BW vs per-axis peak ICI BW (peak_link × k_torus_dims × directions_per_dim; TPUv7x: 200 GB/s bidir per link on a 3D torus; util% requires `--mesh-spec` with topology), and reports per-step compute/comm overlap. Builds on profile-anatomy. --- # Communication Analysis **
documentation
Use when reading TPU pretraining profiles (xplane.pb, trace.json.gz) — describes the on-disk layout, the XSpace/XPlane/XLine/XEvent/XStat hierarchy, and provides reference scripts that future tpu-perf skills can read as schema documentation.