ai-sdlc-policy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ai-sdlc-policy: Explainable Delivery Controls

ai-sdlc-policy:可解释的交付管控

Internal AI SDLC skill, not client-facing by default. Every rule below is important to follow. None of it can be skipped. Unknown or invalid policy inputs fail closed when they could weaken protection.
内部AI SDLC技能,默认不面向客户。 以下每条规则均需严格遵循,不可跳过任何一条。 可能削弱防护能力的未知或无效策略输入将直接判定失败。

0. Skill Card

0. 技能卡片

  • Skill name:
    ai-sdlc-policy
  • Primary audience: Delivery, Security, Architecture, Release
  • Supporting audience: Dev, QA, PM, BA
  • Audience tags: Delivery, Security, Architecture, Release, Dev
  • SDLC stage: Governance and control evaluation
  • Purpose: Resolve policy layers with provenance and evaluate actions against protected, versioned, waiver-aware rules.
  • Output:
    _ai_sdlc/policy-resolution.{toon,json}
    or fingerprint-addressed TOON/JSON records below
    _ai_sdlc/policy-decisions/
    when
    --write
    is requested
  • 技能名称:
    ai-sdlc-policy
  • 核心受众:交付、安全、架构、发布团队
  • 支持受众:开发、QA、产品经理、业务分析师
  • 受众标签:交付、安全、架构、发布、开发
  • SDLC阶段:治理与管控评估
  • 用途:解析带溯源信息的策略层级,针对受保护的、版本化的、支持豁免的规则评估操作。
  • 输出:当使用
    --write
    参数时,输出
    _ai_sdlc/policy-resolution.{toon,json}
    ,或在
    _ai_sdlc/policy-decisions/
    路径下生成带指纹标识的TOON/JSON记录

0.1 Required Inputs

0.1 必填输入

  • Action name and JSON context for evaluation.
  • Base policy plus optional organization profile, project, and user layers.
  • Explicit owner-approved waiver record when an allowed exception is requested.
  • 待评估的操作名称及JSON上下文。
  • 基础策略,可选的组织配置文件、项目及用户层级策略。
  • 当申请允许的例外情况时,需提供明确的所有者批准豁免记录。

0.2 Clarification Rules

0.2 澄清规则

  • Ask when action identity, subject, accountable waiver owner, or decision reference is missing.
  • Reject unknown fields, operators, layer scopes, and ambiguous rule identity.
  • Never infer approval or create a waiver on the requester's behalf.
  • 当操作标识、主体、负责豁免的所有者或决策参考缺失时,需主动询问。
  • 拒绝未知字段、操作符、层级范围及模糊的规则标识。
  • 绝不能自行推断批准或为请求者创建豁免。

0.2.1 Flow Mode Flags

0.2.1 流程模式标识

  • Support
    --quick-flow
    and
    --full-flow
    ; full flow takes precedence.
  • Both modes use the same fail-closed evaluator and protected-rule semantics.
  • Full flow requires explicit review of every matched rule, rejected override, required gate, and waiver result.
  • 支持
    --quick-flow
    --full-flow
    ;全流程模式优先级更高。
  • 两种模式均使用相同的默认失败评估器和受保护规则语义。
  • 全流程模式要求对每一条匹配规则、被拒绝的覆盖项、必填关卡及豁免结果进行明确审核。

0.3 Output Rules

0.3 输出规则

  • Report resolved policy fingerprint, layer provenance, action decision, matched rules, required gates, reason codes, and applied or rejected waivers.
  • Return validation and handoff summaries directly in the Codex response.
  • Emit
    ai-sdlc-handoff/v1
    with
    result
    ,
    blockers
    ,
    next_required
    , and
    next_optional
    ; actions include
    reason
    ,
    command
    , and
    expected_artifact
    .
  • Do not create
    summary.txt
    ,
    *-summary.txt
    , or another standalone summary file.
  • 报告解析后的策略指纹、层级溯源、操作决策、匹配规则、必填关卡、原因代码,以及已应用或被拒绝的豁免。
  • 在Codex响应中直接返回验证及交接摘要。
  • 生成包含
    result
    blockers
    next_required
    next_optional
    ai-sdlc-handoff/v1
    ;操作信息包含
    reason
    command
    expected_artifact
  • 禁止创建
    summary.txt
    *-summary.txt
    或其他独立的摘要文件。

0.4 Artifact Routing

0.4 制品路由

  • Keep approved policy layers in visible repository-owned paths.
  • Write generated resolution and decision records only below
    _ai_sdlc/
    .
  • Never overwrite a source policy or waiver during evaluation.
  • 将已批准的策略层级保存在可见的仓库所属路径中。
  • 仅在
    _ai_sdlc/
    路径下写入生成的解析及决策记录。
  • 评估过程中绝不能覆盖源策略或豁免文件。

0.5 Feature State Machine

0.5 特性状态机

  • Read canonical
    _ai_sdlc/state.toon
    before applying a decision to feature work. Policy evaluation does not create or advance feature
    state.toon
    .
  • A deny or unsatisfied required gate blocks the owning workflow transition.
  • 在对特性工作应用决策前,读取标准的
    _ai_sdlc/state.toon
    文件。策略评估不会创建或推进特性的
    state.toon
  • 拒绝决策或未满足必填关卡会阻止所属工作流的流转。

0.6 Artifact Metadata And Metatags

0.6 制品元数据与元标签

  • Policy-related Markdown uses canonical
    artifact_metadata
    and
    metatags
    .
  • Machine records use
    ai-sdlc-policy-layer/v1
    ,
    ai-sdlc-policy-waiver/v1
    ,
    ai-sdlc-policy-resolution/v1
    , and
    ai-sdlc-policy-decision/v1
    .
  • 策略相关的Markdown使用标准的
    artifact_metadata
    metatags
  • 机器记录使用
    ai-sdlc-policy-layer/v1
    ai-sdlc-policy-waiver/v1
    ai-sdlc-policy-resolution/v1
    ai-sdlc-policy-decision/v1

0.7 Specs Index

0.7 规范索引

  • Read
    _ai_sdlc/specs-index.toon
    first and use
    specs-index.md
    for human discovery when evaluation context refers to feature artifacts.
  • Policy evaluation does not refresh either specs index.
  • 当评估上下文涉及特性制品时,优先读取
    _ai_sdlc/specs-index.toon
    ,并使用
    specs-index.md
    供人工查阅。
  • 策略评估不会刷新任何一个规范索引。

References

参考资料

  • Read
    references/policy-contract.md
    before resolving or evaluating policy.
  • Validate source layers with
    references/policy-layer.schema.json
    , waivers with
    references/policy-waiver.schema.json
    , and decisions with
    references/policy-decision.schema.json
    .
  • Reuse organization profiles from
    references/profiles/
    .
  • Use
    scripts/policy.py
    for resolution, evaluation, and explain output.
  • 在解析或评估策略前,阅读
    references/policy-contract.md
  • 使用
    references/policy-layer.schema.json
    验证源层级,
    references/policy-waiver.schema.json
    验证豁免,
    references/policy-decision.schema.json
    验证决策。
  • references/profiles/
    复用组织配置文件。
  • 使用
    scripts/policy.py
    进行解析、评估及可解释输出。

Script Usage

脚本使用示例

bash
python3 skills/ai-sdlc-policy/scripts/policy.py . --resolve --profile high-assurance --format toon
python3 skills/ai-sdlc-policy/scripts/policy.py . --evaluate change.apply --context policy-context.json --profile regulated --format toon
python3 skills/ai-sdlc-policy/scripts/policy.py . --explain release.publish --context release-context.json --waiver waiver.json --format markdown
bash
python3 skills/ai-sdlc-policy/scripts/policy.py . --resolve --profile high-assurance --format toon
python3 skills/ai-sdlc-policy/scripts/policy.py . --evaluate change.apply --context policy-context.json --profile regulated --format toon
python3 skills/ai-sdlc-policy/scripts/policy.py . --explain release.publish --context release-context.json --waiver waiver.json --format markdown

Purpose

核心目标

Make delivery governance reproducible and inspectable while allowing bounded, accountable, expiring exceptions without silently weakening organization rules.
在允许有边界、可追溯、过期失效的例外情况的同时,确保交付治理可复现、可审计,且不会暗中弱化组织规则。

Inputs

输入项

  • Versioned base, organization, project, and user policy layers.
  • A stable action such as
    change.apply
    ,
    release.publish
    , or
    command.destructive
    and a JSON context object.
  • Optional waiver files tied to exact rule IDs, actions, subjects, constraints, owners, approvers, decisions, issue times, and expiry times.
  • 版本化的基础、组织、项目及用户策略层级。
  • 稳定操作,如
    change.apply
    release.publish
    command.destructive
    ,以及对应的JSON上下文对象。
  • 可选的豁免文件,需绑定精确的规则ID、操作、主体、约束、所有者、审批者、决策、发布时间及过期时间。

Steps

执行步骤

  1. Load the built-in base and optional organization assurance profile.
  2. Validate custom layers and merge them in base, organization, project, user order.
  3. Reject any lower-layer change that weakens a protected effect, gate set, protected flag, or non-waivable boundary.
  4. Match rules using only declared fields and deterministic operators.
  5. Validate waivers against rule eligibility, action, subject, constraints, decision evidence, and the explicit evaluation time.
  6. Combine unwaived rules with deny-first, require-second, allow-third precedence.
  7. Inspect explain output and satisfy every required gate before acting.
  1. 加载内置的基础策略及可选的组织保障配置文件。
  2. 验证自定义层级,并按基础、组织、项目、用户的顺序合并。
  3. 拒绝任何会弱化受保护效果、关卡集、保护标识或不可豁免边界的低层级变更。
  4. 仅使用声明字段及确定性操作符匹配规则。
  5. 针对规则适用性、操作、主体、约束、决策证据及明确的评估时间验证豁免有效性。
  6. 按拒绝优先、必填次之、允许最后的优先级,合并未被豁免的规则。
  7. 检查可解释输出,在执行操作前满足所有必填关卡要求。

Output Spec

输出规范

Complete TOON/JSON resolution records contain normalized rules, provenance, source hashes, protected rule IDs, and a deterministic fingerprint. Decision records contain the exact action and context fingerprint, matched and waived rules, gates, reasons, result, evaluation time, and policy fingerprint.
Quality gate:
  • Pass when all layers are valid, protected rules remain at least as strict, each waiver is current and authorized, and the action result plus gates are understood.
  • Fail closed on invalid policy, unknown action, protected weakening, malformed or expired waiver, and missing context required by a predicate.
完整的TOON/JSON解析记录包含标准化规则、溯源信息、源哈希、受保护规则ID及确定性指纹。决策记录包含精确的操作及上下文指纹、匹配及被豁免的规则、关卡、原因、结果、评估时间及策略指纹。
质量关卡:
  • 当所有层级有效、受保护规则至少保持原有严格性、每个豁免均为当前有效且已授权,且操作结果及关卡要求已明确时,判定通过。
  • 当策略无效、操作未知、受保护规则被弱化、豁免格式错误或已过期,以及谓词所需的上下文缺失时,默认判定失败。

Examples

示例

A high-assurance profile may add
security-review
and
fresh-evidence
gates to
change.apply
. A project layer can add more gates. A user layer cannot remove those gates or turn a protected
require
into
allow
.
高保障配置文件可能会为
change.apply
添加
security-review
fresh-evidence
关卡。项目层级可添加更多关卡,但用户层级无法移除这些关卡,也不能将受保护的
require
规则改为
allow
规则。

Edge Cases

边缘场景

  • Non-matching rules remain visible in explain output only when requested.
  • Multiple matching deny rules remain deny even if another rule allows.
  • A valid waiver suppresses only its named waivable rule, never an entire action.
  • Expiry is evaluated at explicit
    --as-of
    time for reproducible decisions.
  • 未匹配的规则仅在被请求时才会显示在可解释输出中。
  • 多条匹配的拒绝规则仍会判定为拒绝,即使存在允许规则。
  • 有效的豁免仅会屏蔽其指定的可豁免规则,绝不会屏蔽整个操作。
  • 为实现可复现的决策,过期时间需按明确的
    --as-of
    时间进行评估。

Scope Boundary

范围边界

  • Do not edit source policy, issue waivers, record approvals, or satisfy gates.
  • Do not treat
    allow
    as authorization outside the evaluated action and context.
  • Do not let user or project layers weaken protected organization minimums.
  • Do not execute the evaluated action; return the decision to its owning workflow.
  • 不得编辑源策略、签发豁免、记录审批或完成关卡要求。
  • 不得将
    allow
    规则视为超出已评估操作及上下文范围的授权。
  • 不得允许用户或项目层级弱化组织的最低保护标准。
  • 不得执行已评估的操作;需将决策返回给所属工作流。