Artifact Contract Auditor
Purpose: make each workspace auditable and shareable.
This skill checks two contracts:
1) Units contract: if a unit is marked DONE, its required outputs must exist.
2) Pipeline contract: the pipeline’s target_artifacts (from the pipeline spec referenced by PIPELINE.lock.md) should exist for a complete run.
It always writes a report so workspaces can serve as regression baselines.
Inputs
- - INLINECODE3
- INLINECODE4
- Pipeline spec referenced by
PIPELINE.lock.md (under pipelines/*.pipeline.md; reads YAML target_artifacts)
Outputs
Workflow (analysis-only)
1) Read UNITS.csv and validate DONE outputs
- - For every unit with
status=DONE, verify each required output exists. - Outputs prefixed with
? are treated as optional and do not fail the contract.
2) Read PIPELINE.lock.md and validate pipeline target artifacts
- - Resolve the pipeline spec under
pipelines/*.pipeline.md and load target_artifacts from its YAML front matter. - Resolve the pipeline spec path and load
target_artifacts from its YAML front matter. - If the pipeline is complete (all units are
DONE/SKIP), verify each required target_artifacts file exists.
3) Write output/CONTRACT_REPORT.md (always)
- - Include missing DONE outputs (unit-level drift) and missing pipeline targets (pipeline-level completeness drift).
Status semantics
- -
PASS: pipeline complete (all units DONE/SKIP) AND all required target artifacts exist AND no DONE unit is missing required outputs. - INLINECODE21 : pipeline incomplete (still running) BUT DONE unit outputs are consistent; missing targets are expected.
- INLINECODE22 : at least one DONE unit is missing required outputs OR pipeline is complete but required target artifacts are missing.
How to use this report (self-loop routing)
- - If DONE outputs are missing: fix the contract drift (regenerate the missing artifacts, or revert the unit status to TODO/BLOCKED).
- If the pipeline is complete but target artifacts are missing: find which unit/skill owns each missing artifact and rerun that unit.
Script
Quick Start
All Options
- - INLINECODE24
- INLINECODE25 (optional)
- INLINECODE26 (unused; runner compatibility)
- INLINECODE27 (unused; runner compatibility)
- INLINECODE28 (optional)
Examples
- - End-of-run audit (recommended before sharing a workspace):
- INLINECODE29
技能名称: artifact-contract-auditor
详细描述:
制品合约审计器
目的:使每个工作空间可审计且可共享。
该技能检查两个合约:
1) 单元合约:如果某个单元标记为DONE,则其必需输出必须存在。
2) 流水线合约:对于完整运行,流水线的target_artifacts(来自PIPELINE.lock.md引用的流水线规范)应存在。
它始终会写入一份报告,以便工作空间可作为回归基线。
输入
- - UNITS.csv
- PIPELINE.lock.md
- PIPELINE.lock.md引用的流水线规范(位于pipelines/*.pipeline.md下;读取YAML格式的target_artifacts)
输出
- - output/CONTRACT_REPORT.md
工作流程(仅分析)
1) 读取UNITS.csv并验证DONE状态的输出
- - 对于每个status=DONE的单元,验证每个必需输出是否存在。
- 以?为前缀的输出被视为可选,不会导致合约失败。
2) 读取PIPELINE.lock.md并验证流水线目标制品
- - 解析pipelines/*.pipeline.md下的流水线规范,并从其YAML前置元数据中加载targetartifacts。
- 解析流水线规范路径,并从其YAML前置元数据中加载targetartifacts。
- 如果流水线已完成(所有单元均为DONE/SKIP状态),则验证每个必需的target_artifacts文件是否存在。
3) 写入output/CONTRACT_REPORT.md(始终执行)
- - 包含缺失的DONE输出(单元级漂移)和缺失的流水线目标(流水线级完整性漂移)。
状态语义
- - PASS:流水线完成(所有单元均为DONE/SKIP状态)且所有必需的目标制品都存在,且没有DONE单元缺少必需输出。
- OK:流水线未完成(仍在运行)但DONE单元输出一致;缺失目标是预期情况。
- FAIL:至少一个DONE单元缺少必需输出,或流水线已完成但缺少必需的目标制品。
如何使用此报告(自循环路由)
- - 如果DONE输出缺失:修复合约漂移(重新生成缺失的制品,或将单元状态恢复为TODO/BLOCKED)。
- 如果流水线已完成但目标制品缺失:找出每个缺失制品所属的单元/技能,并重新运行该单元。
脚本
快速开始
- - python scripts/run.py --workspace workspaces/
所有选项
- - --workspace
- --unit-id (可选)
- --inputs <分号分隔>(未使用;运行器兼容性)
- --outputs <分号分隔>(未使用;运行器兼容性)
- --checkpoint (可选)
示例
- python scripts/run.py --workspace workspaces/