feat(skill): add version field to SKILL.md frontmatter and bootstrap, with pre-flight version check

This commit is contained in:
Research Assistant 2026-05-19 15:54:04 +08:00
parent 8d406913b0
commit 3044881aeb
3 changed files with 14 additions and 0 deletions

View file

@ -8,6 +8,7 @@ description: >
"讨论" "记录阅读" "记录工作" "总结会话" "提取方法论"
"记一下" "保存这次" "找证据" "找75 Hz" "找支持" "collection" "库里".
source: paperforge
version: 1.5.9
---
# PaperForge — Research Memory Runtime
@ -45,6 +46,7 @@ bootstrap 现在也返回一个 `capabilities` 块rg, semantic, metadata 等
**进入任何 molecule 之前,必须完成以下检查。标记为 `[x]` 后才可前进。**
- [ ] **bootstrap completed**`$VAULT`、`$PYTHON`、`$LIT_DIR`、`$SKILL_DIR` 已定义
- [ ] **version match**`$PYTHON -m paperforge --version` 输出的版本号与 SKILL.md frontmatter 的 `version` 字段一致;不一致时提示用户运行 `paperforge update`
- [ ] **capabilities**:已读取 `capabilities` 块中的 `rg`、`metadata_search`、`paper_context`、`semantic_enabled`、`semantic_ready`
- [ ] **runtime-health passed**`safe_read`、`safe_write` 已知vector 状态已知
- [ ] **intent identified**:用户意图已映射到一个顶层 research intent

View file

@ -35,6 +35,12 @@ import subprocess
import sys
from pathlib import Path
try:
import paperforge
SKILL_VERSION = paperforge.__version__
except Exception:
SKILL_VERSION = "unknown"
def _find_paperforge_json(start: Path) -> Path | None:
current = start.resolve()
@ -288,6 +294,7 @@ def main() -> None:
}
result["ok"] = True
result["skill_version"] = SKILL_VERSION
json.dump(result, sys.stdout, ensure_ascii=False, indent=2)

View file

@ -75,3 +75,8 @@ def test_bootstrap_capabilities_contract(tmp_path: Path) -> None:
assert "semantic_ready" in caps, "capabilities.semantic_ready missing"
assert isinstance(caps["semantic_ready"], bool), "capabilities.semantic_ready must be bool"
# Skill version
sv = output.get("skill_version")
assert sv is not None, "skill_version missing from bootstrap output"
assert isinstance(sv, str) and sv != "unknown", f"skill_version invalid: {sv}"