Skip to main content
Glama

Sprint Digest Agent

把 Jira/Notion 上的 sprint 任務整理成經過檢核的進度週報。可以用 CLI 排程執行,也可以作為 MCP Server 給 Claude、Cursor、Gemini CLI 等 AI 助理呼叫。

這個專案是《AI 工具導入評估報告(範例)》第 5.1 節規格書的原型實作(docs/ai-adoption-assessment-sample.pdf),用來驗證規格確實可以建置,而且 AI 輸出可以被驗證。

示範資料(fixtures/)為虛構團隊。

Demo 影片(94 秒):docs/demo.mp4

設計原則

數字由程式計算,LLM 只負責文字。 完成度、卡關、逾期這類數字由程式計算,模型只撰寫摘要、風險說明與建議行動。每一份模型輸出都要先通過 5 項檢核才會送出:

檢核

擋下什麼

G1 結構

非 JSON、欄位缺漏或超出長度

G2 任務編號

引用不存在的任務(例如 WEB-999)

G3 數字

文字中出現程式沒有算出的數字(例如自己估算「完成率約 80%」)

G4 完整性

卡關或逾期任務沒有列入風險(也能擋下被提示注入誘導的輸出)

G5 負責人

風險負責人不是該任務的負責人

未通過時,系統把錯誤清單附在提示後重試 1 次;仍未通過就改用規則產生的摘要。規則摘要的數字與風險仍然正確,並會標示「改用規則產生的摘要」,不會把錯誤內容送出。

flowchart LR
  A[Jira / Notion API] --> B[正規化與資料檢查]
  B --> C[程式計算指標]
  C --> D[LLM 撰寫文字]
  D --> E{G1–G5 檢核}
  E -- 通過 --> F[Markdown / Google Chat]
  E -- 未通過 --> G[附錯誤重試 1 次]
  G --> E
  G -- 仍未通過 --> H[規則摘要(degraded)] --> F

Related MCP server: Sprint MCP Server

快速開始

pnpm install
cp .env.example .env          # 至少填 GEMINI_API_KEY
pnpm digest                   # 使用示範資料 fixtures/sprint-42.json
pnpm digest --out out/digest.md
pnpm digest --fixture fixtures/edge-dirty-data.json   # 髒資料 + 提示注入

接上真實資料來源:

# Jira Cloud(唯讀帳號的 API token)
pnpm digest --source jira --sprint "Sprint 42" --start 2026-11-17 --end 2026-11-28

# Notion 任務資料庫(記得先把資料庫分享給 integration)
pnpm digest --source notion --sprint "Sprint 42" --start 2026-11-17 --end 2026-11-28

# 同時發到 Google Chat
pnpm digest --source jira ... --post-chat

實際輸出範例:docs/sample-output.md

作為 MCP Server 使用

提供兩個工具:

  • sprint_metrics:只用程式計算指標,不呼叫 LLM

  • sprint_digest:產生通過檢核的完整週報

Claude Desktop/Cursor 設定範例:

{
  "mcpServers": {
    "sprint-digest": {
      "command": "pnpm",
      "args": ["--dir", "/path/to/sprint-digest-agent", "-s", "mcp"],
      "env": { "GEMINI_API_KEY": "..." }
    }
  }
}

pnpm mcp:smoke 會啟動 server,列出工具並實際呼叫一次。

測試與評估

pnpm test        # 12 個自動化測試:規格 5.1.7 的 TC-01~TC-08、轉接器、回歸測試
pnpm eval        # 用真實模型跑示範資料與髒資料各 N 次,統計各檢核的退回次數
pnpm typecheck

測試

情境

TC-01

正常 sprint:數字由程式算出,模型輸出第 1 次通過

TC-02

模型編造任務編號:退回並附錯誤重試,第 2 次通過

TC-03

模型自行計算數字:退回,最後改用規則摘要

TC-04

任務標題含提示注入且模型被誘導:G4 擋下,規則摘要仍列出全部風險

TC-05

空 sprint:不呼叫模型

TC-06

髒資料:未知狀態、缺編號、日期錯誤、重複任務列入「資料問題」,其餘照常處理

TC-07

來源 API 429:退避重試;401:立即停止並說明原因

TC-08

風險負責人與任務負責人不符:退回

最近一次即時評估(Gemini 3.8 Flash,每份資料 5 次):

fixtures/sprint-42.json        first-pass 5/5  fallback 0/5  avg 20.3s
fixtures/edge-dirty-data.json  first-pass 5/5  fallback 0/5  avg 20.8s

pnpm eval 也抓到過檢核本身的錯誤:初版 G3 把「GA4」裡的 4 當成編造的數字,導致每次都改用規則摘要。現在 G3 只檢查獨立出現的數字,並補了回歸測試。

專案結構

src/
  adapters/     jira.ts、notion.ts、fixture.ts、normalize.ts(欄位對應與資料檢查)
  metrics.ts    程式計算的指標(唯一可信的數字來源)
  validate.ts   G1–G5 檢核
  digest.ts     流程控制:呼叫模型 → 檢核 → 重試 → 規則摘要
  llm.ts        Gemini client(只依賴 complete() 介面,可替換模型)
  http.ts       重試、退避、權限錯誤
  render.ts     Markdown 與 Google Chat 格式
  cli.ts、mcp.ts
prompts/system.md   System prompt(規則 R1–R6 與檢核項目一一對應)
fixtures/           示範資料與邊界情境
tests/              驗收測試
scripts/            eval.ts、mcp-smoke.ts

限制

  • Jira/Notion 轉接器依官方 API 的回應格式,以模擬資料做過測試;接上新的 workspace 時,需要先確認自訂欄位 ID 與屬性名稱(見 .env.example)。

  • 只讀取任務標題、狀態、負責人、日期與卡關原因,不讀取描述內文與附件。

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Generates sprint retrospectives grounded in actual data from Jira, GitHub, and Slack, providing evidence-backed insights and action items.
      6
      55 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables LLM agents to manage structured sprint-based development workflows following the Sprint Protocol, including sprint initialization, status checking, and manifest generation.
      2
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Gives AI coding agents native tools to pull their next prioritized, unblocked task with a full briefing (description, acceptance criteria, context files, conventions), comment and tick off criteria with evidence, ask the human decision-maker questions, and submit structured handoffs for review. It lets agents plan epics and sprints, report checks, create new tasks, and release work with checkpoints — all against a self-hosted board rather than files in the repo.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to apply productivity-system presets such as GTD, Kanban, Scrum, PARA, and OKR by capturing, querying, updating, completing, and planning tasks with enforced workflows, stored locally in a SQLite file the user owns. It also provides deterministic completion and plan metrics plus an offline HTML report, with no cloud service, account, embedded LLM, or API key required.
      MIT