mcpField
P
post-session

post-session

github.com/terrylicaAgent 工作流192 次安装今天更新
代码仓库

关于 post-session

用于会话后处理 asciinema 录制文件的技能,涵盖文件收尾、文本转换和分析。提供关键词快速检查及交互式迭代 AI 总结。

主要功能

  1. 01收尾并压缩录制文件
  2. 02将 .cast 转为文本
  3. 03关键词检索与快速总结
  4. 04交互式迭代 AI 分析
  5. 05显示或保存分析结果

适用场景

  1. 01按关键词计数检查 asciinema 会话
  2. 02通过 AI 引导深入分析录制内容
  3. 03分析前收尾未完成的录制文件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/terrylica/cc-skills --skill post-session

安装后在 Claude Code 中输入/post-session确认已加载。

附带文件references/evolution-log.md

详细介绍

/asciinema-tools:post-session

完成会话后工作流:完成孤立录制 → 转换为文本 → AI 驱动的摘要。

自我演进技能:此技能会在使用过程中持续改进。如果说明有误、参数发生偏差,或需要采用变通方法,请立即修复此文件,不要拖延。仅针对真实且可复现的问题进行更新。

参数

参数描述
file.cast 文件的路径(或自动检测)
--finalize包含完成步骤(停止进程、压缩)
-q, --quick快速分析(关键词 grep + 简要摘要)
-f, --full完整分析(转换 + AI 深度摘要)
--summarize包含 AI 摘要步骤(迭代式深度分析)
--output将发现结果保存到 Markdown 文件

工作流模式

快速模式(-q)
[file] → convert → keyword grep → brief summary
完整模式(-f)
[file] → convert → AI summarize (iterative deep-dive)
完整流程模式(--finalize --full)
stop processes → compress → push → convert → AI summarize

执行

阶段 1:发现
AskUserQuestion:
  question: "What would you like to do?"
  header: "Workflow"
  options:
    - label: "Quick analysis (Recommended)"
      description: "Convert + keyword search + brief summary"
    - label: "Full AI analysis"
      description: "Convert + iterative AI deep-dive with guidance"
    - label: "Complete workflow"
      description: "Finalize orphans + convert + AI summarize"
    - label: "Finalize only"
      description: "Stop processes and push to orphan branch"
阶段 2:选择文件

如果未指定文件,则发现可用的录制文件:

/usr/bin/env bash << 'DISCOVER_EOF'
echo "=== Running asciinema processes ==="
ps aux | grep -E "asciinema rec" | grep -v grep | while read -r line; do
  PID=$(echo "$line" | awk '{print $2}')
  CAST=$(echo "$line" | grep -oE '[^ ]+\.cast' | head -1)
  if [[ -n "$CAST" ]]; then
    SIZE=$(ls -lh "$CAST" 2>/dev/null | awk '{print $5}' || echo "?")
    echo "  [RUNNING] PID $PID: $CAST ($SIZE)"
  fi
done

echo ""
echo "=== Recent .cast files ==="
find ~/eon -name "*.cast" -size +1M -mtime -7 2>/dev/null | while read -r f; do
  SIZE=$(ls -lh "$f" | awk '{print $5}')
  MTIME=$(stat -f "%Sm" -t "%m-%d %H:%M" "$f" 2>/dev/null)
  echo "  $f ($SIZE, $MTIME)"
done | head -10

echo ""
echo "=== Recent .txt files (already converted) ==="
find ~/eon -name "*.txt" -size +100M -mtime -7 2>/dev/null | while read -r f; do
  SIZE=$(ls -lh "$f" | awk '{print $5}')
  echo "  $f ($SIZE)"
done | head -5
DISCOVER_EOF
AskUserQuestion:
  question: "Which recording to analyze?"
  header: "Select"
  options:
    # Dynamically populated from discovery
    - label: "{filename} ({size})"
      description: "{path}"
阶段 3:完成(如果已选择)

调用 /asciinema-tools:finalize:

  1. 停止正在运行的 asciinema 进程
  2. 验证文件完整性
  3. 使用 zstd 压缩
  4. 推送到孤立分支
阶段 4:转换
/usr/bin/env bash << 'CONVERT_EOF'
CAST_FILE="$1"
TXT_FILE="${CAST_FILE%.cast}.txt"

echo "Converting: $CAST_FILE"
echo "Output: $TXT_FILE"

if asciinema convert -f txt "$CAST_FILE" "$TXT_FILE"; then
  ORIG=$(ls -lh "$CAST_FILE" | awk '{print $5}')
  CONV=$(ls -lh "$TXT_FILE" | awk '{print $5}')
  echo "✓ Converted: $ORIG → $CONV"
else
  echo "✗ Conversion failed"
  exit 1
fi
CONVERT_EOF
阶段 5:分析

快速模式:关键词 grep + 简要摘要

# Run curated keyword searches
grep -c -i "error\|fail\|exception" "$TXT_FILE"
grep -c -i "success\|complete\|done" "$TXT_FILE"
grep -c -i "sharpe\|drawdown\|backtest" "$TXT_FILE"
# ... summarize counts

完整模式:调用 /asciinema-tools:summarize

  • 通过 AskUserQuestion 获取初始指导
  • 策略性采样(开头/中间/结尾)
  • 根据用户指导进行迭代式深度分析
  • 综合整理为发现报告
阶段 6:输出
AskUserQuestion:
  question: "Analysis complete. What next?"
  header: "Output"
  options:
    - label: "Display summary"
      description: "Show findings in terminal"
    - label: "Save to markdown"
      description: "Write findings to {filename}_findings.md"
    - label: "Continue exploring"
      description: "Deep-dive into specific sections"
    - label: "Done"
      description: "Exit workflow"

使用示例

# Interactive mode - auto-detect and guide
/asciinema-tools:post-session

# Quick analysis on specific file
/asciinema-tools:post-session session.cast -q

# Full AI analysis with output
/asciinema-tools:post-session session.cast -f --output findings.md

# Complete workflow including finalize
/asciinema-tools:post-session --finalize -f

相关命令

  • /asciinema-tools:daemon-status - 查看状态并查找未处理的文件
  • /asciinema-tools:finalize - 完成孤立录制
  • /asciinema-tools:convert - 将 .cast 转换为 .txt
  • /asciinema-tools:summarize - AI 驱动的深度分析
  • /asciinema-tools:analyze - 基于关键词的分析

故障排除

问题原因解决方案
未找到录制文件~/eon 中没有 .cast 文件使用 find ~/eon 检查录制目录
文件发现结果为空搜索路径错误将文件路径作为参数手动指定
转换失败.cast 文件损坏先运行 /asciinema-tools:finalize
AI 摘要超时录制文件过大先使用 -q 进行快速分析
推送孤立分支失败Git 身份验证问题使用 echo $GH_TOKEN 检查 GitHub 令牌

执行后复盘

此技能完成后,在结束任务前进行复盘:

  1. 确定文件位置。 — 编辑前找到此 SKILL.md 的规范路径。
  2. 出了什么问题? — 修复导致问题的说明。
  3. 哪些做法比预期更有效? — 将其列为推荐做法。
  4. 哪些内容发生了偏差? — 修复任何与实际情况不符的脚本、引用或依赖项。
  5. 记录下来。 — 在演进日志中记录触发原因、修复内容和证据。

不要拖延。下一次调用会继承你留下的一切。

评论

支持 Markdown