Agent Skillsmonotykamary/pi-fabric › fabric-schema

fabric-schema

GitHub

基于Fabric Schema的受控代码变更流程,通过假设-验证-提交循环确保修改安全。适用于需显式后置条件和突变声明的场景,防止意外计划失效。

skillsets/python/fabric-schema/SKILL.md monotykamary/pi-fabric

Trigger Scenarios

需要对代码进行安全、可验证的编辑或删除操作 需要执行带有明确前置和后置条件的本地文件事务

Install

npx skills add monotykamary/pi-fabric --skill fabric-schema -g -y
More Options

Non-standard path

npx skills add https://github.com/monotykamary/pi-fabric/tree/main/skillsets/python/fabric-schema -g -y

Use without installing

npx skills use monotykamary/pi-fabric@fabric-schema

指定 Agent (Claude Code)

npx skills add monotykamary/pi-fabric --skill fabric-schema -a claude-code -g -y

安装 repo 全部 skill

npx skills add monotykamary/pi-fabric --all -g -y

预览 repo 内 skill

npx skills add monotykamary/pi-fabric --list

SKILL.md

Frontmatter
{
    "name": "fabric-schema",
    "description": "Uses Fabric's typed Schema evidence loop and, when enabled, its bounded local-file transaction channel. Use when surprise must void a plan and mutation claims need explicit postconditions.",
    "disable-model-invocation": true
}

Fabric Schema — Python

Start with await schema.status(). off leaves state discipline optional; audit reports would-block events without changing authorization; enforce permits protected changes only through one same-fabric_exec hypothesis → verification → commit. Direct mutations, agents, state/mesh writes, compaction, MCP, extensions, and external providers are blocked. Evidence is not proof of general semantic correctness.

Adapt the literal edit, project-relative path, and host-configured trusted-command name to the observed task. Read source first; never invent command shell text or arguments.

await pi.read(path="src/parser.ts")
hypothesis = await schema.hypothesize(label="parser-local-form", summary="The declared parser edit accepts the local form while focused checks remain green", evidence=[
    {"kind": "file_contains", "path": "src/parser.ts", "literal": "old literal"},
    {"kind": "trusted_command", "name": "parser-focused-tests"},
])
verification = await schema.verify(hypothesisId=hypothesis["hypothesisId"])
safe_verification = {key: value for key, value in verification.items() if key != "certificate"}
certificate = verification.get("certificate")
if not verification["verified"] or not certificate:
    if certificate:
        await schema.abort(hypothesisId=hypothesis["hypothesisId"], certificate=certificate)
    return {"status": "failed", "verification": safe_verification}
observed = None
for result in verification["results"]:
    if result["evidence"].get("path") == "src/parser.ts" and result.get("observedSha256"):
        observed = result["observedSha256"]
        break
if not observed:
    await schema.abort(hypothesisId=hypothesis["hypothesisId"], certificate=certificate)
    return {"status": "failed", "reason": "missing observed SHA-256", "verification": safe_verification}
commit = await schema.commit(hypothesisId=hypothesis["hypothesisId"], certificate=certificate, operations=[
    {"kind": "edit", "path": "src/parser.ts", "oldText": "old literal", "newText": "new literal", "expectedSha256": observed}
], postconditions=[
    {"kind": "file_contains", "path": "src/parser.ts", "literal": "new literal"},
    {"kind": "trusted_command", "name": "parser-focused-tests"},
])
return {"status": "success" if commit["outcome"] == "committed" else "failed", "commit": commit}

The certificate is single-use, invocation-bound, short-lived, and bound to the workspace fingerprint, hypothesis and generation. Never return it for later use. If stopping after successful verification, call await schema.abort(hypothesisId=hypothesis["hypothesisId"], certificate=certificate) in the same invocation. Missing, stale, failed, timed-out, cancelled, or workspace-changing evidence voids the plan.

Operations are local regular files: edit/delete require expectedSha256; writes require expected={"absent": True} or expected={"sha256": observed}. Path/symlink escape is rejected. Only committed is success; preserve rollback and quarantine details. Evidence forms are file_exists, file_absent, file_contains (literal), file_sha256, and trusted_command. Remote effects are not transactional. complexityReduction=True also needs scoped behavior-preservation postconditions; it is not an objective complexity measurement.

Off-mode state discipline

transition = await state.transition(label="claim", to="claim-stated", summary="A falsifiable delta", evidence=["bun run test -- tests/focused.test.ts"])
verification = await state.verify()
return {"status": "success" if verification["certified"] else "failed", "transition": transition, "verification": verification}

This is workflow discipline, not enforcement. Soft pointers: <skill-dir>/../../../docs/schema-enforcement.md and <skill-dir>/../../../docs/state-layer.md explain the host guarantees. Audit summaries require an actually inspected trace; do not claim that audit authorizes changes.

Version History

  • 88c505b Current 2026-09-08 19:27

Same Skill Collection

skills/fabric-advisor/SKILL.md
skills/fabric-ambient/SKILL.md
skills/fabric-council/SKILL.md
skills/fabric-exec/SKILL.md
skills/fabric-fusion/SKILL.md
skills/fabric-guide/SKILL.md
skills/fabric-rlm/SKILL.md
skills/fabric-schema/SKILL.md
skills/fabric-spec/SKILL.md
skills/fabric-supervisor/SKILL.md
skills/fabric-swarm/SKILL.md
skills/fabric-workflow/SKILL.md
skillsets/python/fabric-advisor/SKILL.md
skillsets/python/fabric-ambient/SKILL.md
skillsets/python/fabric-council/SKILL.md
skillsets/python/fabric-exec/SKILL.md
skillsets/python/fabric-fusion/SKILL.md
skillsets/python/fabric-guide/SKILL.md
skillsets/python/fabric-rlm/SKILL.md
skillsets/python/fabric-spec/SKILL.md
skillsets/python/fabric-supervisor/SKILL.md
skillsets/python/fabric-swarm/SKILL.md
skillsets/python/fabric-workflow/SKILL.md
skillsets/typescript/fabric-advisor/SKILL.md
skillsets/typescript/fabric-ambient/SKILL.md
skillsets/typescript/fabric-council/SKILL.md
skillsets/typescript/fabric-exec/SKILL.md
skillsets/typescript/fabric-fusion/SKILL.md
skillsets/typescript/fabric-guide/SKILL.md
skillsets/typescript/fabric-rlm/SKILL.md
skillsets/typescript/fabric-schema/SKILL.md
skillsets/typescript/fabric-spec/SKILL.md
skillsets/typescript/fabric-supervisor/SKILL.md
skillsets/typescript/fabric-swarm/SKILL.md
skillsets/typescript/fabric-workflow/SKILL.md

Metadata

Files
0
Version
88c505b
Hash
7eb2eafe
Indexed
2026-09-08 19:27

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-09 01:16
浙ICP备14020137号-1 $mapa de visitantes$