chore: template 1.9.x 知識庫遷移 → system-dev/

把 system-dev-template 1.9.x 的知識庫基建搬進 git(從功能 PR 拆出,獨立成筆):
- system-dev/wiki/:LLM 記憶系統(principles 鐵律 + 5 張 ingest 卡 + INDEX/TAXONOMY + status/mistakes)
- system-dev/docs/:SDD 新家(3-specs/ + 2-architecture/ + README/SKILL);ingest-pipeline SDD 從 docs/3-specs/ 搬來
- system-dev/scripts/:install/update
- .claude/:wiki/SDD harness(commands + hooks:session-recall / sdd-guard / wiki-secret-scan)

SDD 位置統一:docs/3-specs/ingest-pipeline → system-dev/docs/3-specs/ingest-pipeline
(對齊 SDD guard hook 預期路徑 + template 1.9.x 規約)。

純基建遷移,不含任何功能程式碼(src/tests/contracts 在功能 PR #3)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-26 20:45:18 +08:00
parent dffefdcdc2
commit 06e901f590
36 changed files with 2635 additions and 45 deletions
@@ -0,0 +1,48 @@
# ingest pipeline — Tasks
> 唯一進度來源。狀態:[ ] 未開始 [🔄] 進行中 [x] 完成 [⏸] 卡住
> 跨專案藍圖:InkStoneCo `docs/3-specs/mira-dissolve/`。
> 實作分支:`claude/ingest-t1-t5-implementation`vitest 28 passed / tsc clean / dry-run 乾淨)。
## T0 repo 骨架
- [x] 0.1 建 public repo `uncle6me-web/kbdb-ingest-plugin`
- [x] 0.2 CLAUDE.md(上游指針 + ingest 鐵律)+ README + .gitignore
- [x] 0.3 `contracts/ingest-candidate.json`(從頂層 SDD 複製,凍結契約)
- [x] 0.4 SDD 三件式骨架(本輪搬到 `system-dev/docs/3-specs/`,對齊 SDD guard hook
- [x] 0.5 package.json / tsconfig / wrangler.toml / vitest.config(參考 kbdb-graph-pluginHono + zod-openapi,無 D1/Vectorize/AI 綁定)
## T1 SourceAdapterR1)— `src/lib/source-adapter.ts`
- [x] 1.1 GitHub 拉 reporuntime git/trees + contents API,非 Actions);GitHubFetcher 介面(測試走 mock
- [x] 1.2 content-hashper-file sha256source.uri = github:owner/repo@pathmakeSourceUri/parseSourceUri round-trip
- [x] 1.3 被 graph `POST /graph/refresh` 代轉觸發的受理端:`POST /refresh``src/index.ts`,被動代轉、無排程)
## T2 採取(R2,路徑 A 優先)— `src/lib/harvest.ts`
- [x] 2.1 採取本地 CC 已建三元組 + glosstemplate 1.8.0+ 格式:frontmatter gloss、`## 實體``## 關聯` typed-edge;卡對卡 vs 內文端點分流)
- [x] 2.2 cherry-pick `_kbdb_client.py` → 改純餵食器 `src/lib/graph-client.ts`POST envelope**不寫 KBDB/base**
## T3 extractR3,路徑 B fallback)— `src/lib/extract.ts`
- [x] 3.1 cherry-pick `wiki_synthesis.yaml` classify 模式 → extract promptJSON nodes[]+triplets[]
- [x] 3.2 模型用戶可選(意圖非型號,LlmCaller 介面,預設 shallow/Haiku、deep/Claude via CC
- [ ] 3.3 模型測試集(中文 + 人類暗示樣本,轉回歸測試)— **deferred**(先跑預設;護欄 + parse 已有單元測試)
- [x] 3.4 JSON-fail 升級閘(淺萃 fail/過稀 → 升 deep 一次)
- [x] 3.5 第一版不 embed(仍【打標】embed/predicate_embed 供未來 base 讀標;embed 動作等 Arcrun #7
- [x] 3.x 端點對齊硬自檢護欄(`src/lib/endpoint-check.ts`leo 壓測 14→0;自檢 + autoAlign 補齊)
## T4 跨 repo 織網(R4,主職)— `src/lib/weave.ts`
- [x] 4.1 匯總多 repo 三元組 → 偵測跨庫橋(同名 node 跨 ≥2 repo)+ 異見(同 s/o 對、不同謂詞);**不算 bridge_score**graph 領域,禁送)
## T5 輸出 + CLIR5/R6
- [x] 5.1 POST envelope 給 graph `POST /triplets/ingest`(嚴格符合 contractbuildEnvelope strict + 顯式禁送欄位自檢提早攔)。對齊【full contract】(含 embed/id/aliases/predicate_embed,總管裁定 ingest 不退)
- [x] 5.2 薄 ops CLI`scripts/ingest-cli.mjs`refresh 經 Worker / pull dry-run);**不帶查詢 MCP**
## 阻擋項 / 誠實標記
1.**端到端 ingest→graph 走通**:依賴 graph receiver 補對齊 full contractgraph#1 補對齊任務,**現 .strict() 會 422 新向量化欄位**+ ingest 部署 + `GRAPH_BASE_URL` 設定 → **待部署驗**,未假綠。
2. ⏸ embed 依賴 base vectorizeArcrun #7)。第一版不 embed(只打標)已動。
3. T3.3 模型測試集 deferredrefresh 端 extractWorkers AI)第一版只走採取,深萃留 CLI/CC。