feat(skill): add pre-flight checklist harness to SKILL.md and all molecules

This commit is contained in:
Research Assistant 2026-05-19 15:28:37 +08:00
parent 5ffcbde139
commit 8eb02ebdd4
7 changed files with 137 additions and 8 deletions

85
_temp_bootstrap_vec.py Normal file
View file

@ -0,0 +1,85 @@
"""Verify bootstrap and vector availability."""
import subprocess, json, sys
from pathlib import Path
VAULT = r"D:\L\OB\Literature-hub"
SCRIPT = Path(r"D:\L\OB\Literature-hub\.opencode\skills\paperforge\scripts\pf_bootstrap.py")
PYTHON = sys.executable
def run(*args):
r = subprocess.run(args, capture_output=True, text=False, timeout=15)
return r.stdout.decode("utf-8", errors="replace")
print("=" * 50)
print("PHASE 0: BOOTSTRAP (SKILL.md Section 1)")
print("=" * 50)
# Run bootstrap AS AN AGENT would
result = run(PYTHON, str(SCRIPT), "--vault", VAULT)
print(result[:2000])
boot = json.loads(result)
print(f"\n--- Bootstrap Results ---")
print(f"ok: {boot.get('ok')}")
print(f"vault: {boot.get('vault_root')}")
paths = boot.get('paths', {})
for k, v in paths.items():
print(f" {k}: {v}")
caps = boot.get('capabilities', {})
print(f"\n--- Capabilities ---")
for k, v in caps.items():
print(f" {k}: {v}")
mem = boot.get('memory_layer', {})
print(f"\n--- Memory Layer ---")
for k, v in mem.items():
print(f" {k}: {v}")
print(f"\nDomains: {boot.get('domains')}")
print(f"Python verified: {boot.get('python_verified')}")
print(f"Methods: {len(boot.get('methodology_index', []))} cards")
print(f"\n{'=' * 50}")
print("PHASE 0.5: CAPABILITY AWARE ROUTING TEST")
print("=" * 50)
print(f"""
Scenario: User asks "找 Piezo1 和软骨基质降解的证据"
Retrieval routing decision (atoms/retrieval-routing.md):
semantic_enabled={caps.get('semantic_enabled')}
semantic_ready={caps.get('semantic_ready')}
Since this is an EVIDENCE query (not candidate expansion):
-> Ladder B (rg) is primary path
-> Ladder D (semantic) is available as supplementary only
Agent decision:
rg available: {caps.get('rg')}
Agent uses Ladder B for primary evidence retrieval
Agent does NOT use Ladder D as primary path (correct per retrieval-routing.md)
Agent CAN use Ladder D for candidate expansion AFTER rg verification
Vector DB status:
Enabled: {caps.get('semantic_enabled')}
Ready: {caps.get('semantic_ready')}
{'Agent may use semantic for candidate expansion' if caps.get('semantic_ready') else 'Agent must not use semantic'}
Agent must verify all semantic hits with rg/fulltext before use
""")
print("--- runtime-health authoritative check ---")
rh = run(PYTHON, "-m", "paperforge", "--vault", VAULT, "runtime-health", "--json")
try:
rh_data = json.loads(rh)
vec = rh_data.get("data", {}).get("layers", {}).get("vector", {})
print(f" runtime-health vector status: {vec.get('status')}")
print(f" bootstrap semantic_ready: {caps.get('semantic_ready')}")
match = (vec.get('status') == 'ok') == (caps.get('semantic_ready') == True)
print(f" {'[PASS] bootstrap and runtime-health agree' if match else '[INFO] bootstrap is convenience layer, runtime-health is authoritative'}")
except:
print(f" [INFO] could not parse runtime-health")
# Clean
if Path("_temp_bootstrap_vec.py").exists():
Path("_temp_bootstrap_vec.py").unlink()

View file

@ -40,6 +40,18 @@ python $SKILL_DIR/scripts/pf_bootstrap.py --vault "$VAULT"
bootstrap 现在也返回一个 `capabilities`rg, semantic, metadata 等)。
## 1a. Pre-flight Checklist
**进入任何 molecule 之前,必须完成以下检查。标记为 `[x]` 后才可前进。**
- [ ] **bootstrap completed**`$VAULT`、`$PYTHON`、`$LIT_DIR`、`$SKILL_DIR` 已定义
- [ ] **capabilities**:已读取 `capabilities` 块中的 `rg`、`metadata_search`、`paper_context`、`semantic_enabled`、`semantic_ready`
- [ ] **runtime-health passed**`safe_read`、`safe_write` 已知vector 状态已知
- [ ] **intent identified**:用户意图已映射到一个顶层 research intent
- [ ] **molecule selected**:已路由到对应的 `molecules/<intent>.md`
如果任一检查未通过,先执行对应的步骤,**不跳过**。
---
## 2. Agent Context — bootstrap 成功后执行

View file

@ -2,6 +2,15 @@
捕获和持久化从阅读中获得的知识到项目记忆。
## Pre-flight Checklist
- [ ] SKILL.md Section 1a Pre-flight 全部通过
- [ ] `$VAULT`、`$PYTHON` 已从 bootstrap 获取
- [ ] 待保存的内容已就绪(证据/讨论/方法论)
- [ ] intent 已确定为 `capture_project_knowledge`
或作为 post-action在其他 molecule 输出后用户要求保存)
---
## 触发模式

View file

@ -13,7 +13,15 @@ Keshav 三阶段精读。在 formal note 中写入结构化的 `## 精读` 区
---
## 前置检查
## Pre-flight Checklist
- [ ] SKILL.md Section 1a Pre-flight 全部通过
- [ ] `$VAULT`、`$PYTHON` 已从 bootstrap 获取
- [ ] 已确定唯一 paperzotero_key
- [ ] OCR status 为 `done`(否则无法精读)
- [ ] intent 已确定为 `deep_analyze_paper`
---
### Step 0: paper-context必须

View file

@ -4,9 +4,14 @@
---
## 前置条件
## Pre-flight Checklist
- bootstrap 已完成(有 `$VAULT`、`$PYTHON`、`$LIT_DIR`
进入此 molecule 前,确认以下检查已完成。每项完成后标记 `[x]`
- [ ] SKILL.md Section 1a Pre-flight 全部通过
- [ ] `$VAULT`、`$PYTHON`、`$LIT_DIR` 已从 bootstrap 获取
- [ ] `capabilities` 已读取(至少确认 `metadata_search` 可用)
- [ ] intent 已确定为 `discover_papers`
---

View file

@ -4,10 +4,15 @@
---
## 前置条件
## Pre-flight Checklist
- bootstrap 已完成(有 `$VAULT`、`$PYTHON`、`$LIT_DIR`
- `atoms/retrieval-routing.md` 已就绪(提供检索梯级选择)
进入此 molecule 前,确认以下检查已完成:
- [ ] SKILL.md Section 1a Pre-flight 全部通过
- [ ] `$VAULT`、`$PYTHON`、`$LIT_DIR` 已从 bootstrap 获取
- [ ] `capabilities` 已读取(关键:`rg`、`semantic_enabled`、`semantic_ready`
- [ ] `atoms/retrieval-routing.md` 已就绪(提供检索梯级选择)
- [ ] intent 已确定为 `find_supporting_evidence`
---

View file

@ -10,9 +10,14 @@
---
## 前置条件
## Pre-flight Checklist
- bootstrap 已完成(有 `$VAULT`、`$PYTHON`
进入此 molecule 前,确认以下检查已完成:
- [ ] SKILL.md Section 1a Pre-flight 全部通过
- [ ] `$VAULT`、`$PYTHON` 已从 bootstrap 获取
- [ ] 已确定唯一 paperzotero_key / DOI / 标题)
- [ ] intent 已确定为 `read_known_paper`
---