Loveca db02b77837
feat(plugins): add evidence-gated skill self-evolution example (#7984)
* feat(plugins): add evidence-gated skill self-evolution example

Demonstrates the #7884 roadmap deliverable: a proposed change, the regression
case it fixes, the old and new results, and a rollback to a known-good version,
driven only through the public SkillMutationService contract merged in #5645.

The example stages a candidate against a sealed completed-run evidence anchor,
evaluates recorded JSON regression cases against both frozen bundles with a
deterministic static evaluator (never executing package content), and commits
only a "justified" verdict with an AssessmentRef binding the report to the
exact candidate hash and base revision. Unjustified or failed proposals are
discarded; revert stays append-only. Ships an HTTP walkthrough surface, an
offline lifecycle test against a contract-faithful fake host, and a README
section proposing a concrete evidence standard for the automatic-publication
discussion.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix(skill-evolution): resolve request models and honor APPLIED publication

The walkthrough routes had never been exercised through FastAPI. With
`from __future__ import annotations`, request models defined inside
`build_router` are unresolvable forward references, so FastAPI read `body`
as a query parameter and every POST answered 422. Move the models to module
scope and cover the routes through TestClient.

A committed operation reports `publication == "APPLIED"`; `READY` is a
`views` state. The committed check listed READY, so a successful apply never
flipped `record.committed` and the ALREADY_COMMITTED guard never fired. Fix
the check, mirror the real literals in the lifecycle fake host, and assert
both the flag and the second-apply refusal.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix(skill-evolution): address review feedback and register the example catalog

- Bind walkthrough routes to the authenticated principal: owner checks on propose/apply/revert, owner-scoped listing, and non-disclosing 404s.
- Map unknown skills, proposals and operations to 404 for both NOT_FOUND and the real host's NOT_FOUND_OR_FORBIDDEN; map broken case files to 400.
- Ignore URL paths and trim sentence punctuation when extracting in-package references.
- Validate config.enabled's type instead of treating any non-False value as on.
- Soften the README claim about report persistence and add CHANGELOG entries.
- Register the example in the frontend extension catalog, fixing frontend-unit-tests.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix(skill-evolution): narrow case-file error mapping and cover run visibility

- Label ValueError as CASE_INVALID only on POST /proposals, the route that actually loads case files; apply and revert now surface host bugs as 500 instead of pointing at the case directory.
- Cover the request-scoped run-evidence reader the real Gateway installs: hidden anchor returns 403 SOURCE_NOT_VISIBLE before the host is touched, a denied resolver returns 403, and a visible anchor still proceeds.
- Add regressions pinning host ValueError on apply/revert to 500.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* docs(changelog): drop contributor changelog entry per policy

Contributor PRs no longer modify CHANGELOG.md or CHANGELOG_zh.md (#8202);
maintainers add the entry at merge time.

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Nan Gao <thunderggnn@gmail.com>
2026-11-16 16:04:42 +08:00

52 lines
2.6 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"schema_version": 1,
"id": "catalog/skillEvolution",
"locales": {
"zh-CN": {
"title": "证据驱动的技能进化",
"description": "在回归用例与宿主校验通过后才提议技能修改,对比新旧结果,并可回滚到已确认的版本。",
"usage": [
{
"title": "安装并授权",
"description": "通过 make extension-install 安装示例,在 config.yaml 中配置 skill mutation 与 evidence 授权后重启 Gateway。"
},
{
"title": "记录回归用例",
"description": "在包的 cases 目录添加 JSON 用例,用 file_exists、text_contains、text_not_contains 等静态检查描述这次修改要修复什么。"
},
{
"title": "提出、评估、应用与回滚",
"description": "调用 /api/extension-skill-evolution/proposals 提交候选版本,查看 justified、unjustified 或 failed 结论;通过后 apply,必要时 revert 到已确认版本。"
}
],
"requirements": [
"需要支持 skill_mutations 的持久化数据库、run_events.backend: db,以及单实例 POSIX 本地磁盘。",
"需要在 config.yaml 中显式授予 skill mutation 与 evidence 访问权限。"
]
},
"en-US": {
"title": "Evidence-gated skill evolution",
"description": "Propose skill edits only after a regression case and host checks pass, compare old and new results, and roll back to a known-good revision.",
"usage": [
{
"title": "Install and grant access",
"description": "Install the example with make extension-install, configure the skill mutation and evidence grants in config.yaml, then restart Gateway."
},
{
"title": "Record a regression case",
"description": "Add a JSON case under the package's cases directory using static checks such as file_exists, text_contains and text_not_contains to state what the change fixes."
},
{
"title": "Propose, evaluate, apply and roll back",
"description": "Submit a candidate to /api/extension-skill-evolution/proposals, inspect the justified, unjustified or failed verdict, apply an accepted revision, and revert when needed."
}
],
"requirements": [
"Requires a durable database backend, run_events.backend: db, and a single POSIX host with local disk.",
"Requires explicit skill mutation and evidence grants in config.yaml."
]
}
},
"docs_url": "https://github.com/bytedance/deer-flow/tree/main/examples/deerflow-extension-skill-evolution#readme"
}