关于 summarize
summarize 是一项借助采样和迭代分析来探索大型文本录制内容的 AI 技能,可引导 Agent 聚焦主题、查看相关片段,并按所需深度整理发现。
主要功能
- 01对大型文本文件进行引导式采样
- 02按主题关键词抽取片段
- 03迭代探索相关内容
- 04支持快速、中等和深入分析
- 05可将结果保存为 Markdown
适用场景
- 01探索大型会话录制文本
- 02查找特定主题的决策或发现
- 03调查录制内容中的错误
- 04根据抽样内容生成报告
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ terrylica/ cc-skills --skill summarize安装后在 Claude Code 中输入/summarize确认已加载。
附带文件references/evolution-log.md
详细介绍
/asciinema-tools:summarize
面向大型 .txt 录制文件的 AI 驱动迭代式深入分析。使用引导式抽样和 AskUserQuestion,逐步探索内容。
自我进化技能:此技能会在使用中不断改进。如果指令有误、参数发生偏移,或需要采用变通方案,请立即修复此文件,不要拖延。仅针对真实且可复现的问题进行更新。
理念
无法完整读取大型录制文件(1GB 以上)。此命令采用以下方式:
- 初始引导 — 你想查找什么?
- 策略性抽样 — 开头、中间、结尾,以及针对关键词的片段
- 迭代式细化 — 使用 AskUserQuestion 深入探查发现
- 渐进式综合 — 通过多轮分析逐步建立理解
参数
| 参数 | 描述 |
|---|---|
file | .txt 文件路径(由 .cast 转换而来) |
--topic | 初始关注领域(例如,“ML 训练”、“错误”) |
--depth | 分析深度:quick、medium、deep |
--output | 将发现保存到 Markdown 文件 |
工作流
阶段 1:初始引导
AskUserQuestion:
question: "What are you trying to understand from this recording?"
header: "Focus"
options:
- label: "General overview"
description: "What happened in this session? Key activities and outcomes"
- label: "Key findings/decisions"
description: "Important discoveries, conclusions, or decisions made"
- label: "Errors and debugging"
description: "What went wrong? How was it resolved?"
- label: "Specific topic"
description: "I'll specify what I'm looking for"
阶段 2:文件统计信息
/usr/bin/env bash << 'STATS_EOF'
FILE="$1"
echo "=== File Statistics ==="
SIZE=$(ls -lh "$FILE" | awk '{print $5}')
LINES=$(wc -l < "$FILE")
echo "Size: $SIZE"
echo "Lines: $LINES"
echo ""
echo "=== Content Sampling ==="
echo "First 20 lines:"
head -20 "$FILE"
echo ""
echo "Last 20 lines:"
tail -20 "$FILE"
echo ""
echo "=== Keyword Density ==="
echo "Errors/failures:"
grep -c -i "error\|fail\|exception" "$FILE" || echo "0"
echo "Success indicators:"
grep -c -i "success\|complete\|done\|pass" "$FILE" || echo "0"
echo "Key decisions:"
grep -c -i "decision\|chose\|selected\|using" "$FILE" || echo "0"
STATS_EOF
阶段 3:策略性抽样
根据文件大小进行策略性抽样:
对于小于 100MB 的文件:
# Sample head, middle, tail (1000 lines each)
head -1000 "$FILE" > /tmp/sample_head.txt
tail -1000 "$FILE" > /tmp/sample_tail.txt
TOTAL=$(wc -l < "$FILE")
MIDDLE=$((TOTAL / 2))
sed -n "${MIDDLE},$((MIDDLE + 1000))p" "$FILE" > /tmp/sample_middle.txt
对于大于 100MB 的文件:
# Keyword-targeted sampling
grep -B5 -A20 -i "$TOPIC_KEYWORDS" "$FILE" | head -5000 > /tmp/sample_targeted.txt
阶段 4:初步分析
阅读样本并提供初步发现。然后询问:
AskUserQuestion:
question: "Based on initial analysis, what would you like to explore deeper?"
header: "Drill down"
multiSelect: true
options:
- label: "Specific timeframe"
description: "Jump to a particular section (e.g., 'around line 50000')"
- label: "Follow keyword trail"
description: "Search for specific patterns and expand context"
- label: "Error investigation"
description: "Deep dive into errors and their resolution"
- label: "Success moments"
description: "What worked? What were the wins?"
- label: "Generate summary"
description: "Synthesize findings into a report"
阶段 5:迭代式深入分析
针对每个选定的关注领域:
- 提取相关片段,使用带上下文的 grep
- 阅读并分析提取的内容
- 向用户报告发现
- 通过 AskUserQuestion 询问下一步操作
AskUserQuestion:
question: "Found {N} relevant sections. What next?"
header: "Continue"
options:
- label: "Show me the most significant"
description: "Display top 3 most relevant excerpts"
- label: "Search for related patterns"
description: "Expand search to related keywords"
- label: "Move on"
description: "I have enough on this topic"
阶段 6:综合
AskUserQuestion:
question: "Ready to generate summary. What format?"
header: "Output"
options:
- label: "Concise bullet points"
description: "Key findings in 10-15 bullets"
- label: "Detailed markdown report"
description: "Full report with sections and evidence"
- label: "Executive summary"
description: "1-paragraph high-level summary"
- label: "Save to file"
description: "Write findings to markdown file"
关键词库
交易/ML 领域
sharpe|drawdown|backtest|overfitting|regime|validation
model|training|loss|epoch|gradient|convergence
feature|indicator|signal|position|portfolio
开发领域
error|exception|fail|bug|fix|debug
commit|push|merge|branch|deploy
test|assert|verify|validate|check
Claude Code 领域
tool|bash|read|write|edit|grep
task|agent|subagent|spawn
permission|approve|reject|block
使用示例
# Interactive exploration
/asciinema-tools:summarize session.txt
# Focused on ML findings
/asciinema-tools:summarize session.txt --topic "ML training results"
# Quick overview
/asciinema-tools:summarize session.txt --depth quick
# Full analysis with report
/asciinema-tools:summarize session.txt --depth deep --output findings.md
输出示例
# Session Summary: research-repo-research_20251226
## Overview
- **Duration**: 4 days (Dec 26-30, 2025)
- **Size**: 12GB recording → 3.2GB text
- **Primary Focus**: ML robustness research
## Key Findings
### 1. Training-Evaluation Mismatch (CRITICAL)
- MSE loss optimizes magnitude, but Sharpe evaluates direction
- Result: 80% Sharpe collapse from 2024 to 2025
### 2. Fishr λ=0.1 Solution (BREAKTHROUGH)
- Gradient variance penalty solves V-REx binary threshold
- Feb'24 Sharpe: -6.14 → +6.14
### 3. Model Rankings
| Model | Window | Sharpe |
| ------ | ------ | ------ |
| TFT | 15mo | 1.02 |
| BiLSTM | 12mo | 0.50 |
## Evidence Locations
- Line 15234: "Fishr λ=0.1 SOLVES the V-REx binary threshold problem"
- Line 48102: Phase 4 results summary table
## Next Steps Identified
1. TFT 15mo + Fishr training
2. PSR/PBO statistical validation
3. Agent research synthesis
故障排除
| 问题 | 原因 | 解决方案 |
|---|---|---|
| 文件过大 | 录制文件超出内存限制 | 使用 --depth quick 仅进行抽样 |
| 未找到关键词 | 领域不符或内容稀疏 | 尝试更换 --topic 关注领域 |
| 抽样超时 | 文件非常大 | 延长终端超时时间或使用 grep |
| grep 上下文错误 | 缺少 GNU grep | brew install grep(BSD grep 有限制) |
| 未保存输出文件 | 权限被拒绝 | 检查 --output 的写入权限 |
相关命令
/asciinema-tools:convert- 先将 .cast 转换为 .txt/asciinema-tools:analyze- 基于关键词的分析(更快,深度较浅)/asciinema-tools:finalize- 处理孤立的录制文件
执行后复盘
此技能完成后,在结束任务前进行复盘:
- 确认文件位置。 — 编辑前找到此 SKILL.md 的规范路径。
- 哪里失败了? — 修复导致问题的指令。
- 哪些地方比预期更有效? — 将其提升为推荐实践。
- 哪些内容发生了偏移? — 修复与实际情况不再相符的脚本、引用或依赖项。
- 记录下来。 — 添加进化日志条目,注明触发原因、修复内容和证据。
不要拖延。下一次调用会继承你留下的一切。
评论
支持 Markdown