mcpField
S
specstory-link-trail

specstory-link-trail

github.com/specstoryaiAgent 工作流35249 次安装39 周前更新
代码仓库

关于 specstory-link-trail

SpecStory Link Trail 用于分析 `.specstory/history` 会话,并汇总 WebFetch 访问过的 URL,帮助开发者审查外部资源、找回链接并查看失败请求。

主要功能

  1. 01提取 URL、状态码和上下文
  2. 02按会话及时间戳分组
  3. 03区分成功与失败的抓取
  4. 04去重 URL 并统计抓取次数
  5. 05按日期、会话或 glob 选择

适用场景

  1. 01审查开发期间访问的外部资源
  2. 02找回之前查看过的文档页面
  3. 03检查可能需要重试的失败请求

安装

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

$npx skills add https://github.com/specstoryai/agent-skills --skill specstory-link-trail

安装后在 Claude Code 中输入/specstory-link-trail确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

extract_urls_context.py
generate_report.py
LICENSE.txt
parse_webfetch.py

详细介绍

SpecStory 链接追踪

检查你的 .specstory/history 会话,并汇总通过 WebFetch 工具调用获取的所有 URL。适用于审计开发期间访问过的外部资源。

工作原理

  1. 解析 SpecStory 历史文件中的 WebFetch 工具调用
  2. 提取 URL、状态码和上下文
  3. 按会话分组并附上时间戳
  4. 区分成功和失败的获取操作
  5. 去重重复的 URL,并统计获取次数

为什么要追踪链接?

在 AI 辅助编码过程中,助手会代你获取文档、API 和资源。链接追踪可帮助你:

  • 审计访问过的外部资源
  • 找到之前查看过的文档页面
  • 查看可能需要重试的失败获取操作
  • 了解你的研究模式

用法

斜杠命令
用户输入脚本行为
/specstory-link-trail历史记录中的所有会话
/specstory-link-trail today仅今天的会话
/specstory-link-trail last session最近的会话
/specstory-link-trail 2026-01-22指定日期的会话
/specstory-link-trail *.md自定义 glob 模式
直接使用脚本
# All sessions
python skills/specstory-link-trail/parse_webfetch.py .specstory/history/*.md | \
  python skills/specstory-link-trail/generate_report.py -

# Specific session
python skills/specstory-link-trail/parse_webfetch.py .specstory/history/2026-01-22*.md | \
  python skills/specstory-link-trail/generate_report.py -

# Sessions from a date range
python skills/specstory-link-trail/parse_webfetch.py .specstory/history/2026-01-2*.md | \
  python skills/specstory-link-trail/generate_report.py -

输出

Link Trail Report
=================

Sessions analyzed: 5
Total URLs fetched: 23 (18 successful, 5 failed)

Session: fix-authentication-bug (2026-01-22)
--------------------------------------------
Successful fetches:
  - https://docs.github.com/en/rest/authentication (×2)
  - https://jwt.io/introduction
  - https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401

Failed fetches:
  - https://internal.company.com/api/docs (403 Forbidden)

Session: add-caching-layer (2026-01-21)
---------------------------------------
Successful fetches:
  - https://redis.io/docs/latest/commands
  - https://docs.python.org/3/library/functools.html#functools.lru_cache
  - https://stackoverflow.com/questions/... (×3)

Summary by Domain
-----------------
  github.com: 5 fetches
  stackoverflow.com: 4 fetches
  docs.python.org: 3 fetches
  redis.io: 2 fetches
  (9 other domains): 9 fetches

向用户展示结果

脚本输出就是报告。直接展示,无需添加其他说明,但你可以:

  1. 突出关键发现 —— 访问最频繁的域名、失败的获取操作
  2. 提供后续操作 —— “需要我重试失败的获取操作吗?”或“需要了解其中某项的详细信息吗?”
回复示例
Here's your link trail from recent sessions:

[script output here]

I noticed 5 failed fetches - mostly internal URLs that require authentication.
The most accessed domain was github.com (5 fetches), mostly for their REST API docs.

Would you like me to:
- Retry any of the failed fetches?
- Open any of these links?
- Filter to a specific session?

备注

  • 使用流式解析处理大型历史文件
  • 从历史记录中的 WebFetch 工具调用提取 URL
  • 获取次数表示同一 URL 被访问的次数
  • 失败的获取操作会在可用时包含 HTTP 状态码

评论

支持 Markdown