From 92bff5118ae4f092b75285bf2bd0acc7a695108f Mon Sep 17 00:00:00 2001 From: che cheng Date: Sat, 18 Jul 2026 14:16:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20/idd-ask=20=E2=80=94=20grounded=20QA=20?= =?UTF-8?q?over=20the=20issue=20corpus=20(surfacing=20family=204th=20membe?= =?UTF-8?q?r)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors /spectra-ask for IDD's knowledge base (issues + comments + linked PRs, open+closed): natural-language question -> decide-to-search gate (greetings/meta skip; bug-shaped questions NEVER trigger diagnose) -> retrieval delegating idd-find's search backend (family rule: never rebuild a read-only query) -> full-text read of top-N hits (default 5, --limit capped at 10 — the honest token-cost boundary) -> grounded synthesis: first line blockquotes the question, every claim carries an issue/comment citation, source priority closed-with-PR > open > orphaned comment with conflicts surfaced, ending with Referenced Issues. Corpus silence is reported, never filled from training memory. First live run of the #140 fourth-member procedure: three-question gate recorded honestly (Q3 delegate-consumer is a weak hit — ask-type skills serve humans, per the spectra-ask isomorph) and the family member table updated. Discoverability: plugin CLAUDE.md row + usecase-routing scenario 30. TDD: new suite idd-ask RED 0/17 -> GREEN 17/0; sweep 37 suites 0 fail; Spectra change idd-ask-skill 4/4 tasks, validate clean. Refs #72 --- openspec/changes/idd-ask-skill/.openspec.yaml | 3 + openspec/changes/idd-ask-skill/design.md | 37 +++++++ openspec/changes/idd-ask-skill/proposal.md | 34 ++++++ .../idd-ask-skill/specs/idd-ask/spec.md | 35 ++++++ openspec/changes/idd-ask-skill/tasks.md | 9 ++ plugins/issue-driven-dev/CLAUDE.md | 1 + .../references/surfacing-primitives.md | 5 +- .../references/usecase-routing.md | 1 + .../scripts/tests/idd-ask/test.sh | 53 ++++++++++ .../issue-driven-dev/skills/idd-ask/SKILL.md | 100 ++++++++++++++++++ 10 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 openspec/changes/idd-ask-skill/.openspec.yaml create mode 100644 openspec/changes/idd-ask-skill/design.md create mode 100644 openspec/changes/idd-ask-skill/proposal.md create mode 100644 openspec/changes/idd-ask-skill/specs/idd-ask/spec.md create mode 100644 openspec/changes/idd-ask-skill/tasks.md create mode 100644 plugins/issue-driven-dev/scripts/tests/idd-ask/test.sh create mode 100644 plugins/issue-driven-dev/skills/idd-ask/SKILL.md diff --git a/openspec/changes/idd-ask-skill/.openspec.yaml b/openspec/changes/idd-ask-skill/.openspec.yaml new file mode 100644 index 0000000..2c990ac --- /dev/null +++ b/openspec/changes/idd-ask-skill/.openspec.yaml @@ -0,0 +1,3 @@ +schema: spec-driven +created: 2026-07-18 +created_by: che cheng diff --git a/openspec/changes/idd-ask-skill/design.md b/openspec/changes/idd-ask-skill/design.md new file mode 100644 index 0000000..5a43cdc --- /dev/null +++ b/openspec/changes/idd-ask-skill/design.md @@ -0,0 +1,37 @@ +# Design: idd-ask-skill + +## D1 — 與 find 的分工:lookup vs QA(防第 4 員定位稀釋) + +| | `idd-find` | `idd-ask` | +|---|---|---| +| 問題 | 「有沒有處理過類似 X、在哪」 | 「當時為什麼這樣決定 / X 是怎麼運作的」 | +| 輸出 | ranked hits(人自己去讀) | **合成答案**(AI 讀完引用回答) | +| 讀取深度 | metadata + overlay(O(1)/hit) | top-N 命中的**全文**(body + comments) | +| Token 成本 | 低 | 高(有界:top-N 預設 5、`--limit` 可調) | + +ask 的輸出**必附** `### Referenced Issues`,讓人可以 fall through 到 find 式的自行閱讀 — 兩員互補成「先問、不滿意再自己翻」的鏈。 + +## D2 — Retrieval delegate idd-find backend(family 慣例:不重造唯讀查詢) + +Step「搜尋」直接沿用 `idd-find` 的 search backend 契約:`gh search issues`(relevance、`--state all` 全語料)主 + `gh issue list --search` fallback。**引用 idd-find SKILL 的 backend 段落,不內嵌分歧副本**(同 #137 反 typo-drift 紀律)。ask 疊加自己的第二步:對 top-N hits `gh issue view --json body,comments` 抓全文。跨措辭限制同界(詞法檢索),輸出尾端同樣揭露。 + +## D3 — Grounded 回答契約(spectra-ask 規矩移植) + +1. 首行 blockquote 引用使用者原問題 +2. 每個 claim 附來源(`#N` + comment 錨點或區段名);**語料裡沒有的不寫**(查無 → 誠實說查無 + 建議換 phrasing 或 `/idd-find` 自行翻) +3. **Source priority**:closed-with-PR > open > orphaned comment。衝突時取高優先源,並標注低優先源的分歧(「#A(closed)採 X;#B(open,進行中)傾向 Y」) +4. 結尾 `### Referenced Issues`:`#N (title) — URL`,只列實際引用的 + +## D4 — Decide-to-search gate(不是每個輸入都搜) + +greeting / 純 meta-tool 問題(「idd-ask 怎麼用」)→ 不搜,直接答或引導。問題長得像 bug report → **不觸發 diagnose**,回答已知歷史後附一行「要立案 → `/idd-issue`」。無 question 且對話 context 可推 → 確認後搜;推不出 → 要求明確問題。 + +## D5 — #140 boilerplate checklist 逐項(第 4 員首戰) + +Step 0 TaskCreate bootstrap ✓;config-protocol(`--repo` override;group 搜尋 = `--target group: