From 486b8628d8ed3a9bcdb6bb7f6b78b31446f771be Mon Sep 17 00:00:00 2001 From: CEO Agent Date: Wed, 9 Sep 2026 23:58:23 +0800 Subject: [PATCH 1/5] =?UTF-8?q?chore(governance):=20=E9=80=80=E5=BD=B9=20s?= =?UTF-8?q?tandards/agent=20=E5=A3=B0=E6=98=8E=E5=B1=82=E4=BA=94=20schema?= =?UTF-8?q?=20=E5=B9=B6=E6=9B=B4=E6=96=B0=20REPOS.yaml=20key=5Fpaths?= =?UTF-8?q?=EF=BC=88ADR-0119=20Phase=202=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- governance/REPOS.yaml | 2 +- standards/agent/agent.schema.yaml | 134 ------------------ standards/agent/event.schema.yaml | 216 ------------------------------ standards/agent/skill.schema.yaml | 45 ------- standards/agent/team.schema.yaml | 141 ------------------- standards/agent/tool.schema.yaml | 45 ------- 6 files changed, 1 insertion(+), 582 deletions(-) delete mode 100644 standards/agent/agent.schema.yaml delete mode 100644 standards/agent/event.schema.yaml delete mode 100644 standards/agent/skill.schema.yaml delete mode 100644 standards/agent/team.schema.yaml delete mode 100644 standards/agent/tool.schema.yaml diff --git a/governance/REPOS.yaml b/governance/REPOS.yaml index abfb76e..fca84d3 100644 --- a/governance/REPOS.yaml +++ b/governance/REPOS.yaml @@ -23,7 +23,7 @@ repos: visibility: public status: active role: 治理总仓——GOVERNANCE/rulesets/expected-state/policies/agent 标准 schema/初始化与漂移脚本 - key_paths: [governance/, standards/agent/, scripts/, specs/] + key_paths: [governance/, scripts/, specs/] entry_protocol: true # AGENTS.md 携带统一入口协议块(宪法 §11;drift §17 对账,ADR-0055) - name: CI-Workflows diff --git a/standards/agent/agent.schema.yaml b/standards/agent/agent.schema.yaml deleted file mode 100644 index 74ec6f1..0000000 --- a/standards/agent/agent.schema.yaml +++ /dev/null @@ -1,134 +0,0 @@ -$schema: "https://json-schema.org/draft/2020-12/schema" -$id: "cloudbird/agent-standard/agent@2" -title: Agent Declaration (v2, ADR-0010) -description: | - 单智能体声明。Agent = Identity + Model + Capabilities(白名单) + Isolation/Approval + Memory + Workspace + IO Contract。 - 条目落盘 agent-registry/registry/agents/.yaml。 - v2 要点:只可实例化 LLM 原型(机制原型不实例化);副作用白名单 fail-closed; - isolation 与 approval 拆分(v1 strict 双义废弃);族级独立性。 - 约束:所有引用一律用注册表 id(model 用 alias),禁止内联实现细节与密钥。 -type: object -required: [id, version, role, archetype, trust_zone, model, capabilities, guardrails, isolation, approval] -allOf: - - if: {properties: {archetype: {enum: [judge, adversary]}}} - then: {properties: {expose: {properties: {as_tool: {const: false}}}}} - description: "judge/adversary 不得作为工具被调用(独立性——CodeRabbit #13)" -properties: - id: {type: string, pattern: "^[a-z0-9][a-z0-9-]*$", description: "引用形式 agent:"} - version: {type: string, pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$"} - status: {enum: [proposed, approved, deprecated, rejected]} - archetype: - enum: [builder, planner, test-author, judge, curator, adversary, researcher, deployer, responder] - description: | - LLM 原型(ADR-0010,九分类)。机制原型(verifier/integrator/scheduler/evidence-pack/ - interface-gateway/metrics-aggregator)不实例化为 agent——它们是 CI/服务,声明于 - agent-registry 仓 standards/archetype-profiles.yaml 的 mechanism 段(本仓不放 - profiles,单一真源在 agent-registry——REPOS.yaml L1 role)。owner 为伪原型(信任根,非 agent)。 - builder 生产者:写实现+tests/unit/**(设计工具);tests/acceptance/** 只读;交付由 verifier 机制判卷 - planner 计划者:意图→owner 已批验收示例→波次计划+工作卡+测试规格;只写 plans|cards|specs/ - test-author 出题者:规格→acceptance 测试;实现前冻结测试树;不判卷(判卷=verifier 机制);族≠builder - judge 仲裁者:域内分歧(机械可判不受理);只读仓内固定材料+evidence-pack;判例非规范;族≠争议双方 - curator 保管者:归档审核/漂移响应/ADR 提炼;对 standards/validator 只有提案权(owner-only 路径) - adversary 红队:执行 control-tests(期望越权失败);premortem;findings 只进数据层 - researcher 检索者:唯一 untrusted_ingest;findings 必须 schema+provenance+source_class;无写路径 - deployer 前进变更:部署/迁移;逐动作人签;无回滚权(回滚属 responder) - responder 恢复者:预授权恢复动作(回滚/降级/开关);先做后报全留痕;24h retro 债 - 约束:同一声明单 archetype;builder 与 test-author 不得同一声明;planner 与 builder 不得同一声明 - trust_zone: {enum: [untrusted_ingest, trusted_control], description: "= profile(validate 强制);untrusted_ingest 仅 researcher"} - role: {type: string, description: "一句话职责;决定团队装配"} - identity: - type: object - required: [prompt_ref] - properties: - prompt_ref: {type: string, description: "提示词文件(registry 内路径);提示词版本随本声明 PR 一起评审"} - style: {type: string, description: "交互风格提示,可缺省"} - model: - type: object - required: [alias] - properties: - alias: {type: string, description: "必须存在于 registry/models.yaml 且带 family;运行时经 LLM Gateway 路由(AR-3)"} - temperature: {type: number, maximum: 1} - reasoning_level: {enum: [off, low, medium, high]} - capabilities: - type: object - description: "白名单制(fail-closed,ADR-0010):allow 外的副作用一律禁止;未列出的工具不可见" - properties: - skills: {type: array, items: {type: string, pattern: "^skill:"}, description: "引用 skill:"} - tools: {type: array, items: {type: string, pattern: "^tool:"}, description: "工具面;validate 强制其 side_effects ⊆ allow"} - allow: - type: array - description: "副作用白名单,取值域=side-effects.yaml v2 词表;必须 ⊆ profile.allow" - items: {type: string} - agent_tools: - type: object - description: "agent-as-tool 引用;受 profile {allow(原型白名单), max} 约束(v1 黑名单废弃)" - properties: - refs: {type: array, items: {type: string, pattern: "^agent:"}} - isolation: {enum: [private, hermetic, team], description: "工作区隔离:private 独立 / hermetic 密闭(连共享记忆也无)/ team 共享——= profile"} - approval: {enum: [auto, ask_risky, ask_per_action, async_notify], description: "审批模式(与 isolation 正交;v1 permissions.mode 双义拆分,ADR-0010)——= profile"} - independence: - type: object - description: "族级独立性(models.yaml family;别名级太弱——自偏好偏差同族同样存在)" - properties: - distinct_model_family_from: {type: array, items: {type: string}} - permissions: - type: object - description: "路径/参数级收窄(继承 openjiuwen tiered_policy);宏观权限由 allow/isolation/approval 承担" - properties: - inherit: {type: string, description: "继承的策略基线(如 org-default)"} - overrides: - type: array - items: - type: object - required: [tools] - properties: - tools: {type: array, items: {type: string}} - pattern: {type: string, description: "glob 或 re: 前缀正则"} - severity: {enum: [LOW, MEDIUM, HIGH, CRITICAL]} - action: {enum: [allow, ask, deny]} - credential: - type: object - additionalProperties: false - description: "凭据引用:只写 env 变量名,绝不写值(AR-4 最小权限);锁死字段防内联凭据(CodeRabbit #13)" - properties: - github_app: {type: string, description: "如 cloudbrid-agent(线上真实 slug,expected-state.json#github_app);作用域见 GOVERNANCE AG-1"} - secrets: {type: array, items: {type: string, pattern: "^[A-Z_]+$", description: "运行时注入的 env 名"}} - memory: - type: object - properties: - types: {type: array, items: {enum: [user_profile, episodic, semantic]}, description: "记忆类别;敏感信息过滤默认开启;记忆不是规范来源"} - retention: {type: string, description: "如 30d;episodic 默认随 ephemeral team 归档"} - guardrails: - type: object - description: "输出侧硬约束(第一层):交付前置条件,由编排框架在产出提交前强制" - properties: - output_schema_strict: {type: boolean} - must_run: {type: array, items: {type: string}} - forbidden: - type: array - items: {enum: [no-self-acceptance-test, no-force-push, no-secret-output, no-bypass-gate, no-test-weakening]} - description: | - 禁则(v2): - no-self-acceptance-test 不得写 tests/acceptance/**(v1 no-self-test 细化:unit 归 builder) - no-force-push 不得改写已推送历史 - no-secret-output 输出/artifacts 不得含密钥 - no-bypass-gate 不得跳过或降级 gate - no-test-weakening 减弱型测试变更须特权卡(新卡+owner 批+test_weakening 事件) - post_conditions: {type: array, items: {type: string}} - io_contract: - type: object - description: "被作为 tool / A2A 调用时必需;未声明则不可被 expose" - properties: - input: {type: object, required: [schema_ref], properties: {schema_ref: {type: string}}} - output: {type: object, required: [schema_ref], properties: {schema_ref: {type: string}}} - expose: - type: object - additionalProperties: false - properties: - as_tool: {type: boolean, description: "agent-as-tool:被其他 agent 调用(judge/adversary 恒 false——独立性)"} - a2a_card: {enum: [auto, none], description: "auto=对外发布 Agent Card"} - workspace: - type: object - properties: - scope: {enum: [private, team]} - root: {type: string, description: "private 工作区根;team 则写相对团队共享根的子路径"} diff --git a/standards/agent/event.schema.yaml b/standards/agent/event.schema.yaml deleted file mode 100644 index a7e0994..0000000 --- a/standards/agent/event.schema.yaml +++ /dev/null @@ -1,216 +0,0 @@ -$schema: "https://json-schema.org/draft/2020-12/schema" -$id: "cloudbird/agent-standard/event@1.1" -title: Agent Process Event -description: | - 过程数据的事件标准。所有事件 append-only 写入数据层(JSONL 起步,见 ADR-0003), - 不进任何 git 仓库。事件覆盖 agent 运行全过程;沉淀/审计/用量统计均从事件流派生。 - 原始轨迹(完整对话、工具入出参全文)不属于本 schema,按 trace_id 关联存放于对象存储/本地滚动目录。 - v1.1(ADR-0016,红队 #20):五类基础事件之外补齐治理审计缺口——handoff 交接 - (AR-6 归档审计)、approval 审批流(AR-4/预授权追溯)、credential 凭据使用 - (AR-4 最小权限审计)、budget 预算消耗(team-collaboration PART 4)、team 生命周期 - (AR-6 ephemeral 销毁凭证)、judge 仲裁(AR-8 独立性审计)。枚举只增不改, - v1 消费方向后兼容。 - 载荷绑定(评审项):payload 按 event 类型经 allOf/if/then 强制匹配对应 $def—— - 六类 v1.1 新事件 payload 必填(无 v1 兼容包袱,空对象不再合法);五类基础事件 - payload 可缺省(v1 存量记录兼容),出现即须匹配对应 $def。条件必填: - status=failed→reason、ok=false→reason、pool=per_card→card、 - transition=destroyed→handoff_ref。 -type: object -required: [event, ts, trace_id] -properties: - event: - enum: - - run_started - - tool_called - - skill_used - - decision_made - - run_finished - - handoff_step - - approval - - credential_used - - budget_consumed - - team_lifecycle - - judge_verdict - ts: {type: string, format: date-time} - trace_id: {type: string, description: "贯穿一次任务全链路"} - session_id: {type: string} - team_id: {type: string, description: "team:;单 agent 任务可缺省"} - agent_id: {type: string, description: "agent:[@version]"} - parent_trace_id: {type: string, description: "子任务派生时回链"} - payload: {type: object, description: "按 event 类型绑定 $defs(见 allOf;六类 v1.1 治理事件必填)"} -# 载荷绑定(评审项:根 schema 此前只有泛化 payload:object,$defs 从未参与校验, -# 六类治理事件可带任意 payload 甚至缺省通过)。本节把 $defs 接入根校验路径: -# 六类 v1.1 新事件 required payload;五类 v1 基础事件 payload 出现即校验(后兼容)。 -allOf: - - if: {required: [event], properties: {event: {const: run_started}}} - then: {properties: {payload: {$ref: '#/$defs/run_started'}}} - - if: {required: [event], properties: {event: {const: tool_called}}} - then: {properties: {payload: {$ref: '#/$defs/tool_called'}}} - - if: {required: [event], properties: {event: {const: skill_used}}} - then: {properties: {payload: {$ref: '#/$defs/skill_used'}}} - - if: {required: [event], properties: {event: {const: decision_made}}} - then: {properties: {payload: {$ref: '#/$defs/decision_made'}}} - - if: {required: [event], properties: {event: {const: run_finished}}} - then: {properties: {payload: {$ref: '#/$defs/run_finished'}}} - - if: {required: [event], properties: {event: {const: handoff_step}}} - then: - properties: {payload: {$ref: '#/$defs/handoff_step'}} - required: [payload] - - if: {required: [event], properties: {event: {const: approval}}} - then: - properties: {payload: {$ref: '#/$defs/approval'}} - required: [payload] - - if: {required: [event], properties: {event: {const: credential_used}}} - then: - properties: {payload: {$ref: '#/$defs/credential_used'}} - required: [payload] - - if: {required: [event], properties: {event: {const: budget_consumed}}} - then: - properties: {payload: {$ref: '#/$defs/budget_consumed'}} - required: [payload] - - if: {required: [event], properties: {event: {const: team_lifecycle}}} - then: - properties: {payload: {$ref: '#/$defs/team_lifecycle'}} - required: [payload] - - if: {required: [event], properties: {event: {const: judge_verdict}}} - then: - properties: {payload: {$ref: '#/$defs/judge_verdict'}} - required: [payload] -$defs: - run_started: - type: object - properties: - goal: {type: string} - team_snapshot: {type: string, description: "实例化所用 team 声明+版本的摘要"} - tool_called: - type: object - properties: - tool: {type: string, description: "tool:"} - ok: {type: boolean} - duration_ms: {type: integer} - severity: {enum: [LOW, MEDIUM, HIGH, CRITICAL]} - denied_by: {type: string, description: "被权限引擎拦截时记录命中的规则 id(硬控制审计依据)"} - cost: {type: number, description: "计费工具的计量值"} - skill_used: - type: object - properties: - skill: {type: string, description: "skill:@"} - acceptance_results: - type: array - description: 验收断言逐条结果 - items: - type: object - properties: - check: {type: string} - kind: {enum: [ci, llm]} - passed: {type: boolean} - decision_made: - type: object - description: 开发过程中的认识与决策数据(为什么这么做) - properties: - question: {type: string} - choice: {type: string} - alternatives: {type: array, items: {type: string}} - rationale: {type: string} - adr_ref: {type: string, description: "若升级为正式决策,指向 registry decisions/ 编号"} - run_finished: - type: object - properties: - status: {enum: [success, failed, aborted]} - model_alias: {type: string} - tokens_in: {type: integer} - tokens_out: {type: integer} - duration_ms: {type: integer} - handoff_done: {type: boolean, description: "ephemeral team:team 侧 handoff 是否全部完成(销毁前置语义——评审项:单一布尔只表达 team 侧;stewardship 侧异步完成态由 handoff_step(side=stewardship_side) 事件逐项审计)"} - handoff_step: - type: object - description: | - handoff 交接项逐项审计(AR-6:ephemeral 销毁前置凭证;红队 #20)。 - 每项 team_side/stewardship_side 动作开始/完成/失败各发一条—— - 销毁审计从"retrospective 自述"升级为事件级可追溯(P1-08 部分覆盖)。 - required: [item, side, status] - properties: - item: - enum: [artifacts-pr, memory-distill, skill-extract, adr-write, trace-archive, retrospective, incident_report, retro_24h, followup_backlog_merge, retro_debt_tracking] - description: "team.schema lifecycle.handoff 同枚举(同步维护:两处枚举必须一致——评审项:任意字符串会把未知交接项计为已完成)" - side: {enum: [team_side, stewardship_side], description: "执行侧(team-collaboration PART 2 lifecycle.handoff)"} - status: {enum: [started, done, failed], description: "failed 须附 reason"} - by: {type: string, description: "执行者(seat:xxx / mechanism:xxx)"} - reason: {type: string, description: "status=failed 时必填"} - allOf: - - if: {required: [status], properties: {status: {const: failed}}} - then: {required: [reason]} - approval: - type: object - description: | - 审批流事件(AR-4 ask_risky/ask_per_action 语义、incident_cell 条件预授权、 - flag 开启 owner-only 等人类/升级决策的追溯;红队 #20)。 - requested 起始态由 approval.decision=requested 表达,终态 granted/denied/timeout。 - required: [action, decision] - properties: - action: {type: string, description: "申请执行的副作用(side-effects 词表值)"} - decision: {enum: [requested, granted, denied, timeout], description: "timeout=审批人 SLA 未响应(incident_cell owner ack 窗口语义)"} - asked_by: {type: string, description: "发起者(agent: 或 seat:xxx)"} - decided_by: {type: string, description: "决策者(owner / 预授权规则 id);预授权 granted 时写规则 id"} - context: {type: string, description: "申请理由/证据引用(evidence-pack 路径等)"} - risk_class: {type: string, description: "卡风险级(GOVERNANCE risk_posture 分级)"} - credential_used: - type: object - description: | - 凭据使用审计(AR-4 最小权限:每次凭据换取/使用留痕;红队 #20)。 - 只记凭据引用名(绝不记值——no-secret-output 同语义); - ok=false 覆盖"凭据被拒/异常暴露告警"场景(severity 升级语义沿 tool_called)。 - required: [kind, ref, ok] - properties: - kind: {enum: [github_app, env_secret, oidc], description: "凭据类别"} - ref: {type: string, description: "凭据引用名(如 cloudbrid-agent / GH_TOKEN);禁止出现凭据值"} - scope: {type: string, description: "作用域(repo:name / org / team)"} - ok: {type: boolean, description: "false=换取/使用失败(含疑似暴露——须附 reason)"} - reason: {type: string, description: "ok=false 时必填"} - duration_ms: {type: integer, description: "令牌有效期内使用时长(github_app 1h 令牌审计)"} - allOf: - - if: {required: [ok], properties: {ok: {const: false}}} - then: {required: [reason]} - budget_consumed: - type: object - description: | - 预算消耗事件(team-collaboration PART 4:预算有归属不变式的数据侧)。 - 每笔消耗记 pool+金额+累计;exhausted=true 即预算耗尽熔断信号 - (升级通道 overhead_pool 永不冻结的语义由 pool 区分)。 - required: [pool, usd, cumulative] - properties: - pool: {enum: [team_envelope, per_card, overhead_pool], description: "预算池(team.schema budget 同枚举)"} - usd: {type: number, description: "本笔消耗"} - cumulative: {type: number, description: "该池累计消耗"} - exhausted: {type: boolean, description: "true=该池已耗尽(熔断/升级信号)"} - card: {type: string, description: "归属工作卡(per_card 池必填)"} - allOf: - - if: {required: [pool], properties: {pool: {const: per_card}}} - then: {required: [card]} - team_lifecycle: - type: object - description: | - 团队生命周期转移(AR-6:组队/归档/销毁/冻结的时序凭证;红队 #20)。 - ephemeral 销毁须先有全量 handoff_step(done, team_side) 事件—— - 审计侧可机器校验"销毁前置满足"(P0-06/P1-21 的数据基础)。 - required: [team, transition] - properties: - team: {type: string, description: "team:"} - transition: {enum: [created, archived, destroyed, frozen], description: "frozen=TTL 到期冻结(escalate_to_owner 语义)"} - reason: {type: string, description: "转移依据(intent.received / handoff 完成 / ttl 到期…)"} - handoff_ref: {type: string, description: "destroyed 时指向末条 handoff_step(done) 的 trace 位置"} - allOf: - - if: {required: [transition], properties: {transition: {const: destroyed}}} - then: {required: [handoff_ref]} - judge_verdict: - type: object - description: | - 仲裁事件(AR-8 judge 独立性审计:每案裁决/回避留痕;红队 #20)。 - recused=true 即 judge 回避(利益冲突声明),争议转入 owner 或换任 judge。 - required: [dispute, outcome, judge] - properties: - dispute: {type: string, description: "争议标识(dispute-in schema 的 id)"} - outcome: {type: string, description: "裁决结论(机械可判争议不受理——受理即附理由)"} - recused: {type: boolean, description: "true=回避(利益冲突);此时 outcome 为回避声明"} - rationale_ref: {type: string, description: "裁决理由引用(evidence-pack/判例路径;判例非规范)"} - judge: {type: string, description: "agent:(审计侧比对族级独立性)"} diff --git a/standards/agent/skill.schema.yaml b/standards/agent/skill.schema.yaml deleted file mode 100644 index 5c87a69..0000000 --- a/standards/agent/skill.schema.yaml +++ /dev/null @@ -1,45 +0,0 @@ -$schema: "https://json-schema.org/draft/2020-12/schema" -$id: "cloudbird/agent-standard/skill@1" -title: Skill Declaration (SKILL.md frontmatter) -description: | - 流程性知识。skill = 可复用的专业操作规程,载体为 SKILL.md: - YAML frontmatter(本 schema 校验)+ Markdown 正文(给 LLM 的执行指令,不做结构化)。 - 声明段管治理(检索/权限/编排/验收),正文管执行。目录落盘 agent-registry/registry/skills//SKILL.md。 -type: object -required: [name, version, description, allowed_tools, acceptance] -properties: - name: - type: string - pattern: "^[a-z0-9][a-z0-9-]*$" - description: 唯一 id(即目录名);引用形式 "skill:" - version: {type: string, pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$"} - author: {type: string} - description: - type: string - description: 一句话用途说明;不得含 "<" ">";供技能检索与编排消费 - tags: - description: 检索标签;列表或逗号分隔字符串 - oneOf: - - {type: array, items: {type: string}} - - {type: string} - allowed_tools: - description: 本技能执行中允许调用的工具,引用 "tool:";实际生效以 agent 工具面与权限引擎取交集 - oneOf: - - {type: array, items: {type: string}} - - {type: string} - requires: - type: array - items: {type: string} - description: 前置技能(skill:)或能力声明 - acceptance: - type: array - minItems: 1 - items: {type: string} - description: | - 验收断言。分两类,前缀标注: - [ci] 机器可判定 → 对应 CI 检查项(gate) - [llm] 需语义判定 → 由 reviewer agent / 人复核 - 无前缀视为 [llm]。 - status: - enum: [proposed, approved, deprecated, rejected] - description: 与 tool.status 同语义;默认 proposed,PR 评审后 approved diff --git a/standards/agent/team.schema.yaml b/standards/agent/team.schema.yaml deleted file mode 100644 index 6a74485..0000000 --- a/standards/agent/team.schema.yaml +++ /dev/null @@ -1,141 +0,0 @@ -$schema: "https://json-schema.org/draft/2020-12/schema" -$id: "cloudbird/agent-standard/team@2" -title: Team (Swarm) Declaration (v2, ADR-0012) -description: | - 多智能体团队声明。Team = Members(seats) + Topology + Orchestration + Verification - + Workspace + Storage + Budget + Lifecycle。 - 条目落盘 agent-registry/registry/teams/.yaml;团队原型(delivery_squad/stewardship/ - incident_cell)语义单一真源 = agent-registry standards/team-collaboration.yaml PART 2。 - 核心规则:团队必须声明 lifecycle;ephemeral 团队销毁 = after-handoff AND destroy_condition - (AR-6:移交完成且语义条件满足才允许销毁);销毁范围 = agent 实例与临时 workspace, - 数据层制品/事件不随队销毁(destroy_scope,ADR-0011)。 - v2(ADR-0012):对齐 team-collaboration v1.0 实例语义——lifecycle 增 trigger/ttl/ - on_ttl_expiry/destroy_condition;coverage 枚举增 re-check-sample;topology/frequency/ - handoff 枚举补齐;顶层增 archetype/scope/budget/backlog_role;members 增 seat。 -type: object -required: [id, goal, members, topology, lifecycle] -properties: - id: {type: string, pattern: "^[a-z0-9][a-z0-9-]*$", description: "引用形式 team:"} - version: {type: string, pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$"} - status: {enum: [proposed, approved, active, archived, deprecated]} - archetype: - type: string - description: "团队原型(team-collaboration PART 2 teams.*:delivery_squad | stewardship | incident_cell);新增原型须 ADR 论证" - scope: - enum: [delivery, knowledge, adversarial, operational] - description: "权限域(边界公理:权限边界切团队,不按功能切);跨域动作走 escalation" - goal: {type: string, description: "团队目标;persistent 团队写持续职责"} - members: - type: array - minItems: 1 - items: - type: object - required: [agent] - properties: - agent: {type: string, pattern: "^(registry:)?agent:", description: "agent:[@version],缺省 latest approved"} - seat: - type: string - description: "座位(时序成员位);须属于原型 seats 声明——多相位在场的成员占实体座位(as_tool=false),单次往返走 as_tool" - count: {type: integer, minimum: 1, description: "同型多实例"} - as_tool: {type: boolean, description: "该成员以 agent-as-tool 方式被 leader 调用"} - role_override: {type: [string, "null"], description: "实例级角色覆盖"} - topology: - type: string - pattern: "^(leader-teammate|flat|hub-spoke|single-seat)" - description: "标准值开头,可附括号尾注:leader-teammate(leader 可为 mechanism:scheduler——openjiuwen 形态)/ flat / hub-spoke / single-seat(常驻单座位团队:stewardship、incident_cell)" - orchestration: - type: object - properties: - assign: {type: string, description: "分派机制(机制名+关键规则;如 scheduler 状态机按 capability_tags 路由、预算熔断)——v1 三选一枚举废弃:实例语义是机制描述"} - merge: {type: string, description: "合并机制(如 integrator:gate.pass AND review.approve,无 agent 持合并权;治理仓 owner 手合)"} - release: {type: string, description: "发布执行者(release_bot 部署 behind flag 并写 release_record——无 agent 持发布权)"} - phases_ref: {type: string, description: "相位状态机单一真源引用(standards/team-collaboration.yaml#flow.phases;不在此重复)"} - authorization_ref: {type: string, description: "条件预授权单一真源引用(incident_cell.authorization)"} - workflow_ref: {type: string, description: "团队级流程文件(阶段/波次/验收门);复杂流程引用,不在此内联"} - verification: - type: object - description: "验证链(AR-9 v2,ADR-0010)三层:agent 内 guardrails → team 内 test-author 出题 + verifier 机制判卷 → team 外周期审计;含 builder 成员的团队必须声明" - properties: - test_authors: - type: array - items: {type: string} - description: "出题者 agent 引用;必须 archetype=test-author、与 builder 不同声明且不同模型族(models.yaml family)" - verdict_by: - type: string - pattern: "^mechanism:verifier" - description: "判卷机制(required status check,跑冻结测试树 test_tree_sha);判卷不是 agent 职责" - coverage: - enum: [all-outputs, sampled, re-check-sample] - description: "验收覆盖(声明位:含 builder 的团队):all-outputs=每件产出必验收;sampled=抽样(附比例说明);re-check-sample=前道全审+后道抽检复核(attention-ledger.sampled 语义——如 curator 全审在前、owner 抽检 10% 复核)" - in_team_check: - type: object - description: "team 内检查(声明位:无 builder 的治理/运营团队;与顶层 coverage 同枚举)" - properties: - checkers: {type: array, items: {type: string}, description: "遗留字段:等价 test_authors;新声明用 test_authors"} - coverage: {enum: [all-outputs, sampled, re-check-sample], description: "同顶层 coverage 枚举(ADR-0012 增 re-check-sample)"} - note: {type: string, description: "验证模式说明(如:产出走平台防线、跨团队可审)"} - external_audit: - type: object - properties: - team: {type: string, description: "审计方 persistent 团队(如 team:stewardship;治理团队自身用 null:owner)"} - frequency: {enum: [per-delivery, weekly, monthly, per-incident], description: "per-incident=事故后 retro 审计(incident_cell:预授权动作 24h 审计)"} - method: {type: array, items: {enum: [metrics-anomaly, re-check-sample, drift-review, retrospective-review, escape-review, control-test-report]}, description: "指标异常/抽样复检/漂移复盘/回溯评审/逃逸归因/控制测试报告"} - note: {type: string, description: "审计安排说明(如 owner 周审三件套+归档抽检比例)"} - workspace: - type: object - description: "团队共享工作区;中间产物可追溯" - properties: - shared: - type: object - properties: - root: {type: string, description: "共享根路径或 env: 引用;分布式部署须各方可见(如 NFS)"} - version_control: {type: boolean} - layout: {type: object, description: "约定子目录", properties: {inbox: {type: string}, artifacts: {type: string}, decisions: {type: string}, contracts: {type: string, description: "跨卡契约(delivery_squad wave_consistency)"}, findings: {type: string, description: "adversary findings(stewardship)"}, backlog: {type: string, description: "backlog proposals 归并(stewardship 单写者)"}}} - storage: - type: object - properties: - type: {enum: [local, postgresql]} - ref: {type: string, description: "env: 变量引用(如 env:TEAM_DB_DSN);禁止明文连接串;各队独占 DSN——销毁语义清晰"} - budget: - type: object - description: "预算包络(不变式单一真源 team-collaboration PART 4 budget.invariants:升级通道永不冻结)" - properties: - team_envelope: - type: object - properties: - usd: {type: string, description: "金额或 env: 引用"} - wall_clock: {type: string, description: "时长上限或 env: 引用(incident_cell 此项即 TTL)"} - per_card: {type: string, description: "按 card.risk_class(卡字段声明)"} - overhead_pool: - type: object - properties: - usd: {type: string, description: "升级/evidence-pack 走池(env: 引用);永不冻结"} - invariants_ref: {type: string, description: "预算不变式单一真源引用"} - backlog_role: - type: string - description: "backlog 角色(proposals 多写者 → 单写者归并排序;单一真源 team-collaboration PART 3 interfaces.backlog)" - lifecycle: - type: object - required: [type] - properties: - type: {enum: [ephemeral, persistent], description: "persistent=常设,持有仓库/治理职责;ephemeral=任务制,完成即归档"} - trigger: - type: string - description: "ephemeral 组队触发事件(delivery_squad: intent.received——组队即 planner 入场;incident_cell: incident.sev_alert——外部告警/移交/owner 呼叫)" - ttl: {type: string, description: "存续上限(incident_cell: 72h);到期绝不 auto-destroy"} - on_ttl_expiry: {type: string, description: "TTL 到期动作(escalate_to_owner + extension_requires_owner——冻结现场持续升级,不销毁)"} - archive_to: - type: string - description: "ephemeral 必填:资产沉淀目标 persistent 团队(team:)" - handoff: - type: array - description: "销毁前强制移交动作(AR-6)。销毁前置=team 侧项全部完成(after-handoff(team_side)——team-collaboration PART 2 对应原型 lifecycle.handoff);stewardship 侧项(memory-distill/adr-write 等)由 curator 消费归档资产异步执行,不阻塞销毁(destroy_scope:数据层制品/事件不随队销毁)。红队 #18:措辞对齐单一真源,消除 owner 依赖项卡死归档的假想死锁" - items: {enum: [artifacts-pr, memory-distill, skill-extract, adr-write, trace-archive, retrospective, incident_report, retro_24h, followup_backlog_merge, retro_debt_tracking]} - destroy_policy: {enum: [after-handoff, manual], description: "after-handoff=移交完成自动销毁;persistent 团队用 manual"} - destroy_condition: - type: string - description: "销毁语义条件(ADR-0012 增;与 destroy_policy=after-handoff 是 AND 关系):delivery_squad 如 released_behind_flag OR reverted;incident_cell 如 exit_criteria 满足(service_restored AND root_cause_hypothesis AND followup_cards_created)。销毁范围(destroy_scope)=agent 实例与临时 workspace;数据层制品/事件不随队销毁" - channels: - type: array - description: "对外通道(web/tui/a2a/频道/pager 值班);缺省仅内部" - items: {type: string} diff --git a/standards/agent/tool.schema.yaml b/standards/agent/tool.schema.yaml deleted file mode 100644 index 42a85ac..0000000 --- a/standards/agent/tool.schema.yaml +++ /dev/null @@ -1,45 +0,0 @@ -$schema: "https://json-schema.org/draft/2020-12/schema" -$id: "cloudbird/agent-standard/tool@1" -title: Tool Declaration -description: | - 能力原子。tool = agent 可调用的最小能力单元(内置函数/MCP/Shell/脚本/A2A端点)。 - 治理关注点:副作用、严重度基线、I/O 契约、实现位置、生命周期状态。 - 条目落盘于 agent-registry/registry/tools/.yaml。 -type: object -required: [id, version, kind, severity, side_effects, status] -properties: - id: - type: string - pattern: "^[a-z0-9][a-z0-9-]*$" - description: 全局唯一 id;注册表内一切引用(agent.allowed_tools 等)使用 "tool:" - version: {type: string, pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$"} - kind: {enum: [builtin, mcp, a2a, shell, script, api]} - severity: - enum: [LOW, MEDIUM, HIGH, CRITICAL] - description: 默认严重度基线;权限引擎按 tiered_policy(normal/strict 模式)映射 allow/ask/deny - side_effects: - type: array - items: {enum: [none, filesystem_write, vcs_write, network, shell_exec, cost, mutation_external]} - description: 只读工具必须显式声明 [none];有 cost 的按配额计量 - input: {$ref: "#/$defs/schemaRef"} - output: {$ref: "#/$defs/schemaRef"} - implementation: {$ref: "#/$defs/implRef"} - status: - enum: [proposed, approved, deprecated, rejected] - description: "approved 才可被 agent/skill 引用(CI gate 强制,见 GOVERNANCE AR-2)" - owner: - type: string - description: 负责审批与维护的持久团队(team id)或人 -$defs: - schemaRef: - type: object - required: [schema_ref] - properties: - schema_ref: {type: string, description: "相对 registry 的 JSON Schema 路径"} - implRef: - type: object - required: [repo, path] - properties: - repo: {type: string} - path: {type: string} - ref: {type: string, description: "缺省跟随默认分支"} From 8f18f1e0940a805f8bc04bf7562f74d8aeba732c Mon Sep 17 00:00:00 2001 From: CEO Agent Date: Thu, 10 Sep 2026 00:25:43 +0800 Subject: [PATCH 2/5] chore(gov): update cnb-private status, add github-mirror and stronghold to REPOS.yaml --- governance/REPOS.yaml | 18 ++++++++++++++++++ governance/providers.yaml | 6 +++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/governance/REPOS.yaml b/governance/REPOS.yaml index fca84d3..5fa82ed 100644 --- a/governance/REPOS.yaml +++ b/governance/REPOS.yaml @@ -9,6 +9,7 @@ org: Cloudbird-Software # - status: active 的仓必须存在且 visibility 一致(drift-check §7a) # - status: planned = 尚未建仓(不参与检测);exempt = 申报但不治理(仅豁免治理基线,不豁免可见性) # - 全仓公开政策(ADR-0020):一切仓 visibility 必须 public(drift-check §7a 申报侧 + §7c 线上全量侧,含未申报仓) +# - CNB 私有阵地(stronghold)visibility=private 属三阵地结构例外(ADR-0108),不计入 ADR-0020 公开政策 # - 新仓初始化后必须申报入图(flows.new_repo step 4) # ============================================================================ layers: @@ -26,6 +27,14 @@ repos: key_paths: [governance/, scripts/, specs/] entry_protocol: true # AGENTS.md 携带统一入口协议块(宪法 §11;drift §17 对账,ADR-0055) + - name: github-mirror + layer: L0 + visibility: public + status: active + role: CNB 公开镜像——.github 仓的 CNB 侧映射(CNB 命名规则:前导点仓去点,.github→github-mirror);内容由 cnb-public-mirror 工作流同步,不单独治理 + key_paths: [governance/, scripts/, specs/] + entry_protocol: false # 镜像仓,非治理主源(drift §17 不适用) + - name: CI-Workflows layer: L0 visibility: public @@ -169,6 +178,15 @@ repos: key_paths: [entries/, schema/, canary/] entry_protocol: true # ADR-0095:协议块 v2 全仓下发(drift §17 逐字节对账) + - name: stronghold + layer: L1 + visibility: private + status: active + role: CNB 私有阵地(真值区,ADR-0108/S-7)——holdout 答案层+evalsets 答案域+判分 rubric+私有 spec;写权=P11(INV-04);引用纪律 sealed_sha256 指针(id@sha8) + key_paths: [answers/, ledger/stronghold.jsonl] + entry_protocol: false # CNB 私有仓,无 GitHub 协议块(drift §17 不适用);visibility=private 属三阵地结构例外,不计入 ADR-0020 公开政策 + note: 阵地丢失=台账+Gitee 密文 bundle 重建(ADR-0108 失效语义节) + - name: cnb-bridge layer: L2 visibility: public diff --git a/governance/providers.yaml b/governance/providers.yaml index 25d7192..36fcb96 100644 --- a/governance/providers.yaml +++ b/governance/providers.yaml @@ -66,9 +66,9 @@ entries: # ---- IR-0010 卡 B1/B8b:新增登记 ------------------------------------------- - name: cnb-private - kind: repo-private # CNB 私有阵地(stronghold,真值区——ADR-0108 proposed) - entry: 待卡 B1 实测核验通过后启用(创建+API 权限+配额+不可枚举四项) - secrets: [] # 专用分域 token(INV-04 延伸)——B1 核验后经 owner 面注入 + kind: repo-private # CNB 私有阵地(stronghold,真值区——ADR-0108 accepted) + entry: stronghold 已建成并启用(P11 建仓 201,run 34027551317;XUEMEI 403/P11 201 权限矩阵实测;API/配额/不可枚举四项已核验通过) + secrets: [CNB_TOKEN_P11] # 专用分域 token(INV-04 延伸)——stronghold 写权账号=P11 removal: ADR-0108 失效语义节(阵地丢失=台账+Gitee 密文 bundle 重建) trust_level: E1 data_classes_allowed: [D-公开, D-内部] # 注意:不含 D-客户敏感(宪法触发器,test-providers-schema 执法) From b3337041ff4fe198008fe547bfae7587f0b7325c Mon Sep 17 00:00:00 2001 From: CEO Agent Date: Thu, 10 Sep 2026 01:07:40 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feat(governance):=20DGA=20=E5=85=AD?= =?UTF-8?q?=E5=85=83=E7=BB=84=20schema+=E6=A0=A1=E5=87=86=E5=9F=9F+evidenc?= =?UTF-8?q?e=20v2+IR-0012~0014=EF=BC=88ADR-0119=20Phase=204=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- governance/dga/calibration-domain.yaml | 34 +++++++++++++ governance/dga/closed-loop-schema.yaml | 67 ++++++++++++++++++++++++++ specs/IR-0012/spec.md | 21 ++++++++ specs/IR-0013/spec.md | 23 +++++++++ specs/IR-0014/spec.md | 27 +++++++++++ standards/evidence/README.md | 48 +++++++++++++++++- 6 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 governance/dga/calibration-domain.yaml create mode 100644 governance/dga/closed-loop-schema.yaml create mode 100644 specs/IR-0012/spec.md create mode 100644 specs/IR-0013/spec.md create mode 100644 specs/IR-0014/spec.md diff --git a/governance/dga/calibration-domain.yaml b/governance/dga/calibration-domain.yaml new file mode 100644 index 0000000..e61ca81 --- /dev/null +++ b/governance/dga/calibration-domain.yaml @@ -0,0 +1,34 @@ +version: 1 +org: Cloudbird-Software +title: 校准域三快照 schema +description: | + DGA-human-v1.1 §2.2 扩展二:校准域实体。 + 能力组合 / 规格版本 / 本体版本三快照。 +calibration_domain: + capability_profile: + definition: "当前可用能力组合(工具/模型/环境)" + required_fields: [tools, models, environments] + snapshot_fields: [name, version, hash] + carriers: + - repo: CI-Workflows + path: .github/workflows/*.yml + - repo: env-defs + path: environments/*.yaml + specification_version: + definition: "规格版本快照" + required_fields: [ir_version, contract_version, policy_version] + snapshot_fields: [id, semver, sha256] + carriers: + - repo: .github + path: specs/IR-*/spec.md + - repo: .github + path: governance/policy/*.yaml + ontology_version: + definition: "本体版本快照" + required_fields: [schema_version, taxonomy_version, mapping_version] + snapshot_fields: [id, semver, sha256] + carriers: + - repo: .github + path: governance/dga/*.yaml + - repo: dga-theory + path: DGA-*.md diff --git a/governance/dga/closed-loop-schema.yaml b/governance/dga/closed-loop-schema.yaml new file mode 100644 index 0000000..371bbbd --- /dev/null +++ b/governance/dga/closed-loop-schema.yaml @@ -0,0 +1,67 @@ +version: 1 +org: Cloudbird-Software +title: DGA 六元组闭环 schema +description: | + DGA-human-v1.1 §2.1:六元组闭环单元定义。每元含定义、必填字段、 + 机器可验证载体映射(仓/路径)。六元齐备为 A-10 开工核查前提。 +elements: + Intent: + definition: "闭环类型 + 责任人关系" + required_fields: [type, owner, goal] + carriers: + - repo: .github + path: governance/GOVERNANCE.yaml + field: risk_posture + - repo: .github + path: specs/IR-*/spec.md + field: taskId + Context: + definition: "上下文资产 + 校准域实体" + required_fields: [calibration_domain, models, environments] + carriers: + - repo: .github + path: governance/role-dga-incidence.yaml + field: roles + - repo: env-defs + path: environments/*.yaml + field: environment + Capability: + definition: "能力实体(执行器/工具)" + required_fields: [registered_tools, permissions] + carriers: + - repo: CI-Workflows + path: .github/workflows/*.yml + field: jobs + - repo: template-service + path: Makefile + field: targets + Action: + definition: "类型化写操作" + required_fields: [type, scope, approval] + carriers: + - repo: .github + path: state/inbox/*/task-*.md + field: schema + - repo: arbiter + path: CAS + field: lease + Evidence: + definition: "证据实体(回执/审计/校准事件)" + required_fields: [receipt, audit_trail, calibration_event] + carriers: + - repo: archive + path: evidence/*.jsonl + field: record + - repo: .github + path: state/outbox/**/*.md + field: status + Accountability: + definition: "责任挂接关系(必填约束)" + required_fields: [named_owner, review_rule, S5_role] + carriers: + - repo: .github + path: CODEOWNERS + field: pattern + - repo: .github + path: governance/GOVERNANCE.yaml + field: risk_posture diff --git a/specs/IR-0012/spec.md b/specs/IR-0012/spec.md new file mode 100644 index 0000000..4c2d2c9 --- /dev/null +++ b/specs/IR-0012/spec.md @@ -0,0 +1,21 @@ +--- +taskId: IR-0012 +specVersion: 1 +title: DGA 本体论 schema 定案 +irRef: Cloudbird-Software/.github#? +adr: ADR-0119 +acceptanceCriteria: + - id: AC-1 + given: _repos/.github/governance/dga/closed-loop-schema.yaml + when: python -m jsonschema 校验 + then: exit 0 + - id: AC-2 + given: _repos/.github/governance/dga/calibration-domain.yaml + when: python -m jsonschema 校验 + then: exit 0 +nonGoals: + - 不改 DGA-human-v1.1 正本 + - 不改 runtime/bin/verify_receipt.py 既有判定 +blastRadius: + - repo: Cloudbird-Software/.github + path: governance/dga/ diff --git a/specs/IR-0013/spec.md b/specs/IR-0013/spec.md new file mode 100644 index 0000000..263f581 --- /dev/null +++ b/specs/IR-0013/spec.md @@ -0,0 +1,23 @@ +--- +taskId: IR-0013 +specVersion: 1 +title: 退役清单执行波次 +irRef: Cloudbird-Software/.github#? +adr: ADR-0119 +acceptanceCriteria: + - id: AC-1 + given: Phase 1 快照完成 + when: 删除 standards/agent/ 五 schema + then: ls 返回 exit 2 + - id: AC-2 + given: Phase 2 完成 + when: 修正 agent-tools/README.md 首行 + then: head -1 输出 # agent-tools +nonGoals: + - 不删除 archive/retired 快照 + - 不改 ADR-0119 正文 +blastRadius: + - repo: Cloudbird-Software/.github + path: standards/agent/ + - repo: Cloudbird-Software/agent-tools + path: README.md diff --git a/specs/IR-0014/spec.md b/specs/IR-0014/spec.md new file mode 100644 index 0000000..32343cd --- /dev/null +++ b/specs/IR-0014/spec.md @@ -0,0 +1,27 @@ +--- +taskId: IR-0014 +specVersion: 1 +title: 新治理体系验收 spec +irRef: Cloudbird-Software/.github#? +adr: ADR-0119 +acceptanceCriteria: + - id: AC-1 + given: verify_all.py 全绿 + when: py -3 -X utf8 runtime/bin/verify_all.py + then: rc=0 + - id: AC-2 + given: verify_receipt_dga.py 全绿 + when: py -3 -X utf8 runtime/bin/test_verify_receipt_dga.py + then: rc=0 + - id: AC-3 + given: drift_probe.py 全绿 + when: py -3 -X utf8 runtime/bin/test_drift_probe.py + then: rc=0 +nonGoals: + - 不推送 GitHub + - 不改 EX-1/cnb-bridge +blastRadius: + - repo: Cloudbird-Software/.github + path: specs/IR-0014/ + - repo: Cloudbird-Software/archive + path: evidence/ diff --git a/standards/evidence/README.md b/standards/evidence/README.md index 405e223..7bedae4 100644 --- a/standards/evidence/README.md +++ b/standards/evidence/README.md @@ -1,4 +1,4 @@ -# 统一证据账本·标准(v1) +# 统一证据账本·标准(v1 + v2 扩展 profile) > IR-0006 W1-B1 / ADR-0103。判定层记录 schema:[record.schema.yaml](record.schema.yaml) > (`$id: cloudbird/evidence-standard/record@1`);轨迹层指针协议: @@ -58,3 +58,49 @@ OTel 采集面,无需字段翻译层。 - cost-check 波次视图(W2-C3):`subject` 聚合自本账本。 - 三源统一查询(W1-B2):`subject.card` 为 join key。 - 飞书投影/SLI 周报(W3/W4):只读消费。 + +## Evidence schema v2 — DGA 六元组扩展 profile + +> DGA-human-v1.1 §2.1 / §2.2;`runtime/bin/verify_receipt_dga.py` 执法。 + +v2 在 v1 判定层/轨迹层/丢弃层之上,新增**六元组扩展 profile**: +回执(receipt)或契约卡(contract card)可附加 `dga` 映射块, +将 DGA 六元组显式绑定到证据实体。机器门 `verify_receipt_dga.py` +按本 profile 校验映射齐备性;无 `dga` 块时回退为 legacy PASS +(不阻断既有四字段回执)。 + +### 回执 JSON/DGA 字段映射 + +在回执 Markdown 中,可在既有 `status / evidence / escalate / next` +四字段之后追加 `dga` 块(YAML-like 映射): + +```markdown +status: ok +evidence: + - 写 runtime/bin/verify_receipt_dga.py +escalate: none +next: archive +dga: + Intent: "校验回执六元组映射存在性" + Context: "runtime/bin 已有 verify_receipt v1.8 四字段门" + Capability: "verify_receipt_dga.py 六元组校验脚本" + Action: "写新脚本 + 测试 + 接入 verify_all 套件" + Evidence: "test_verify_receipt_dga.py 全绿 + verify_all rc=0" + Accountability: "CEO Agent 负责实现;失败升级董事长" +``` + +- **必填**:`Intent / Context / Capability / Action / Evidence / Accountability` + 六键全齐。 +- **可选**:`dga` 块缺失时,`verify_receipt_dga.py` 输出 `PASS (legacy)`。 +- **校验粒度**:`verify_receipt_dga.py` 只校验六键存在性与非空值, + 不校验语义内容(语义由人工/上层 spec 负责)。 +- **契约卡复用**:契约卡已有 `## 六事映射` 小节, + `verify_receipt_dga.py` 复用 `six_element_check.py` 的小节截取逻辑 + 校验六元齐备;小节缺失或缺元均 FAIL。 + +### 与 v1 schema 的关系 + +- v1 `record.schema.yaml` 的 `subject / actor / verdict` 继续有效; + v2 `dga` 块是回执 payload 的扩展元数据,不入 v1 schema 必填。 +- `payload_ref` 仍指向轨迹层大体积原始数据;`dga` 块只含轻量文本映射, + 内联在回执 Markdown 中,不受 4096 字节 payload 软上限约束。 From 850566a8874810d1fdc68ffde940e10779c874e8 Mon Sep 17 00:00:00 2001 From: CEO Agent Date: Thu, 10 Sep 2026 11:57:56 +0800 Subject: [PATCH 4/5] =?UTF-8?q?chore(governance):=20=E6=92=A4=E9=94=80=20E?= =?UTF-8?q?X-1=20=E5=B9=B6=E6=8B=86=E9=99=A4=20cnb-bridge=20=E4=B8=89?= =?UTF-8?q?=E6=8E=A5=E7=BC=9D=EF=BC=88ADR-0119=20Phase=203=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cnb-audit.yml | 204 ----------------------- .github/workflows/cnb-dispatch.yml | 177 -------------------- governance/GOVERNANCE.yaml | 11 -- governance/REPOS.yaml | 10 -- governance/evidence-query.sh | 3 +- governance/expected-state.json | 13 +- governance/policy/automation-limits.yaml | 13 -- governance/providers.yaml | 20 +-- scripts/ghcb | 22 +-- scripts/sli-report.sh | 2 +- 10 files changed, 15 insertions(+), 460 deletions(-) delete mode 100644 .github/workflows/cnb-audit.yml delete mode 100644 .github/workflows/cnb-dispatch.yml diff --git a/.github/workflows/cnb-audit.yml b/.github/workflows/cnb-audit.yml deleted file mode 100644 index 48522f7..0000000 --- a/.github/workflows/cnb-audit.yml +++ /dev/null @@ -1,204 +0,0 @@ -name: cnb-audit -# ============================================================================= -# CNB 周审计 + 三接缝隔离审计(IR-0004 AC-14/AC-19,BEH-17 周审计项之一) -# -# 硬注释(改动前必读): -# - 本工作流是治理仓 CNB 三接缝之一(GOVERNANCE EX-1 声明条目 / IFACE-01, -# ADR-0085 决策 6 / IR-0004):与 cnb-dispatch.yml、GOVERNANCE 声明条目 -# 共同构成治理仓对 CNB 的全部合法引用面。 -# - 判定永不外置(INV-02):本审计只核资源面(配额/窗口/隔离),不消费 -# NPC 输出作为任何 gate 输入;沙箱自报数字不采信(INV-01)。 -# - 凭据纪律(INV-06):token 只经 org secret 注入,不落日志/摘要/issue; -# 配额数字与窗口状态不含敏感值,可进审计面。 -# - 无人值守护栏适用(ADR-0040):本审计产出即护栏输入——配额告警开 -# cost 类 issue(cost-infra),供派单前置检查消费。 -# - ADR-0085 决策 6 审计口径:第③步 grep 匹配**操作性引用** -# (endpoint=cnb.cool / token 名=CNB_TOKEN / 派单协议=@CodeBuddy), -# 目录导航性提及(如仓库名 cnb-bridge、工作流名)不计入——故 pattern -# 刻意只列三样;排除清单=接缝本体+既有声明/登记面(逐项依据见第③步注释)。 -# - fail-closed(INV-04):配额查询失败、账号清单不可读、隔离 grep 非 0 -# 一律红;窗口停摆仅 WARN(观测面非判定面)。 -# ============================================================================= -on: - schedule: - - cron: "41 3 * * 1" # 周一 03:41 UTC 错峰(避 archive gate 周扫 04:23 / runs-digest 04:37 / Scorecard 05:00+,ADR-0011 谱系) - workflow_dispatch: {} - -permissions: - contents: read - -concurrency: - group: cnb-audit - cancel-in-progress: false - -jobs: - audit: - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1(org 白名单 CI-2) - with: - persist-credentials: false - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Cloudbird-Software/cnb-bridge # L2 可删除层(ADR-0085 决策 6) - ref: main - path: cnb-bridge - persist-credentials: false - # ------------------------------------------------------------------ - # ①配额活性:逐账号查余量;任一低于 policy 阈值(cnb.quota_alert_pct,现值 20) - # → LOW=1(下一步开 cost 类 issue);配额查询失败(含 org secret 缺失) - # = fail-closed 红(INV-04/AC-15)。 - # secret 经 env 映射静态引用(GH Actions 无法动态索引 secrets); - # 加账号 = owner 加 org secret + 本映射加一行(C1 PR)。 - # ------------------------------------------------------------------ - - name: quota(配额活性,fail-closed) - env: - CNB_TOKEN_XUEMEI: ${{ secrets.CNB_TOKEN_XUEMEI }} - CNB_TOKEN_P11: ${{ secrets.CNB_TOKEN_P11 }} - run: | - set -euo pipefail - # 账号清单真源 = cnb-bridge/accounts.yaml(无明文 token,ADR-0085 决策 6) - mapfile -t ACCOUNTS < <(python3 - <<'EOF' - import sys, yaml - with open('cnb-bridge/accounts.yaml', encoding='utf-8') as f: - doc = yaml.safe_load(f) - aliases = [a['alias'] for a in (doc.get('accounts') or [])] - if not aliases: - print('::error::accounts.yaml 无账号条目——清单不可读即红(fail-closed)', file=sys.stderr) - sys.exit(1) - print('\n'.join(aliases)) - EOF - ) - # 进程替换不传递 python 退出码——空清单兜底再拦一次(fail-closed,堵 fail-open) - [[ ${#ACCOUNTS[@]} -gt 0 ]] || { echo '::error::账号清单为空/不可读——fail-closed 红'; exit 1; } - FAIL=0 - : > quota-report.txt - for A in "${ACCOUNTS[@]}"; do - VAR="CNB_TOKEN_$(printf '%s' "$A" | tr '[:lower:]' '[:upper:]')" - TOKEN="${!VAR:-}" - if [[ -z "$TOKEN" ]]; then - echo "::error::org secret ${VAR} 缺失(账号 ${A} 无法查配额)——fail-closed 红" - FAIL=1; continue - fi - # token 已按池契约注入 step env(CNB_TOKEN_,cnb_pool.py 直接读 - # os.environ[secret_ref])——不做二次中转,零冗余变量(INV-06) - if ! python3 cnb-bridge/cnb_pool.py quota --account "$A" | tee -a quota-report.txt; then - echo "::error::账号 ${A} 配额查询失败——fail-closed 红(INV-04:平台失效必须可见)" - FAIL=1 - fi - done - [[ $FAIL -eq 0 ]] || exit 1 - # 告警阈值真源 = automation-limits.yaml cnb.quota_alert_pct(当前 20,IR-0004 AC-15); - # cnb 节缺失即红(policy 为准,不内置缺省) - ALERT_PCT=$(python3 - <<'EOF' - import sys, yaml - with open('governance/policy/automation-limits.yaml', encoding='utf-8') as f: - cnb = (yaml.safe_load(f) or {}).get('cnb') - if not isinstance(cnb, dict): - print('::error::automation-limits.yaml 缺 cnb 节——阈值真源不可少(fail-closed)', file=sys.stderr) - sys.exit(1) - print(int(cnb.get('quota_alert_pct', 20))) - EOF - ) || exit 1 - # 余量 <阈值 → LOW=1;quota 行契约:account= remaining_pct= - grep -E 'remaining_pct=[0-9]+' quota-report.txt | awk -F'remaining_pct=' -v pct="$ALERT_PCT" '{split($2,a," "); if (a[1]+0 < pct) print}' > quota-low.txt || true - LOW=0; [[ -s quota-low.txt ]] && LOW=1 - echo "LOW=$LOW" >> "$GITHUB_ENV" - { - echo '## CNB 周审计(配额活性)' - echo - echo '```'; cat quota-report.txt; echo '```' - echo - [[ $LOW -eq 1 ]] && echo '**告警**:以下账号余量 <20%——已开 cost 类 issue:' && sed 's/^/- /' quota-low.txt || echo '全部账号余量 ≥20%' - } >> "$GITHUB_STEP_SUMMARY" - echo "AUDIT | cnb-audit | quota | accounts=${#ACCOUNTS[@]} | low=$LOW" - # ------------------------------------------------------------------ - # 开 cost 类 issue(.github 仓,cloudbrid-agent App 令牌——archive 仓 - # runs-digest.yml 同款铸币模式:CB_APP_ID/AGENT_APP_SECRET org secrets, - # REPO=.github;本仓即 .github,脚本取自本 checkout,无需二次 sparse)。 - # 开 issue 失败 = 红(消费链停摆必须可见,fail-closed)。 - # ------------------------------------------------------------------ - - name: open-cost-issue(余量 <20% 时) - if: env.LOW == '1' - env: - CB_APP_ID: ${{ secrets.CB_APP_ID }} - AGENT_APP_SECRET: ${{ secrets.AGENT_APP_SECRET }} - run: | - set -euo pipefail - TOKEN=$(REPO=".github" CB_APP_ID="$CB_APP_ID" AGENT_APP_SECRET="$AGENT_APP_SECRET" \ - bash scripts/gh-app-token.sh) - { - echo '## CNB 配额告警(cnb-audit 周审计自动开出,IR-0004 AC-15)' - echo - echo '以下账号余量 <20%(处置前 cnb-dispatch 对该账号降频/换账号):' - echo - sed 's/^/- /' quota-low.txt - echo - echo '---' - echo '来源:.github 仓 cnb-audit 周一 03:41 UTC run(本 issue 存在期间,' - echo 'AGENTS.md 无人值守护栏 (d) 视为存在未决 cost issue——派单前置检查会拦)。' - } > cost-body.md - GH_TOKEN="$TOKEN" gh issue create -R Cloudbird-Software/.github \ - -t 'CNB 配额告警:账号余量 <20%(周审计)' -b "$(cat cost-body.md)" -l cost-infra \ - || { echo '::error::cost issue 创建失败——审计消费链停摆,fail-closed'; exit 1; } - # ------------------------------------------------------------------ - # ②窗口停扰扫描:占用中窗口数与 build logs 交叉(IFACE-05 对账真源=平台 - # build logs,交叉在 cnb_pool.py windows 内完成,本步只消费产出); - # 占用率 ≥阈值(policy cnb.window_warn_pct,缺省 80)→ 输出 WARN 行 - # (观测面非判定面,不红)。脚本失败本身=红(INV-04)。 - # ------------------------------------------------------------------ - - name: windows(停摆扫描,WARN 口径) - run: | - set -euo pipefail - python3 cnb-bridge/cnb_pool.py windows | tee windows.out - TOTAL=$(grep -cE '^window=[0-9]+ status=' windows.out || true) - OCCUPIED=$(grep -cE '^window=[0-9]+ status=occupied' windows.out || true) - WARN_PCT=$(python3 - <<'EOF' - import yaml - try: - with open('governance/policy/automation-limits.yaml', encoding='utf-8') as f: - cnb = (yaml.safe_load(f) or {}).get('cnb') or {} - print(int(cnb.get('window_warn_pct', 80))) - except Exception: - print(80) # 巡检旋钮(warn 不红,非判定面);policy 可加 window_warn_pct 覆盖 - EOF - ) - if [[ "$TOTAL" -gt 0 && $(( OCCUPIED * 100 / TOTAL )) -ge "$WARN_PCT" ]]; then - echo "::warn::WARN | cnb-audit | windows | occupied=${OCCUPIED}/${TOTAL}(≥${WARN_PCT}%,池近饱和——派单侧降频或等回收)" - echo "WARN | cnb-audit | windows | occupied=${OCCUPIED}/${TOTAL} >= ${WARN_PCT}% 池近饱和" >> "$GITHUB_STEP_SUMMARY" - else - echo "AUDIT | cnb-audit | windows | occupied=${OCCUPIED}/${TOTAL}(阈值 ${WARN_PCT}%)" - fi - # ------------------------------------------------------------------ - # ③三接缝隔离 grep(IFACE-01,ADR-0085 决策 6 审计口径): - # 治理仓内操作性引用(cnb.cool / CNB_TOKEN / @CodeBuddy)只允许出现在 - # 接缝本体与既有声明/登记面;命中数必须为 0,非 0 即红并列出命中文件。 - # 排除清单(逐项依据,ADR-0085 决策 6"目录导航性/声明性提及不计入"): - # - governance/GOVERNANCE.yaml EX-1 声明条目本体(三接缝之一) - # - .github/workflows/cnb-dispatch.yml 接缝之二(派单经纪人) - # - .github/workflows/cnb-audit.yml 接缝之三(本审计) - # - governance/expected-state.json secret/工作流登记表(声明面:登记名非使用点) - # - governance/policy/automation-limits.yaml cnb 配置节(EX-1 政策面:加账号=改配置零代码) - # - governance/providers.yaml 工具目录(声明面:secret_ref 登记名非值/非使用点,ADR-0085 决策 7) - # - specs/IR-0004/spec.md 制度文本(DECISION-06 对 token 形态的规范性条款) - # 新增排除项必须走 ADR(C1)——本清单是被审计对象的一部分。 - # ------------------------------------------------------------------ - - name: isolation-grep(三接缝隔离,命中非 0 即红) - run: | - set -euo pipefail - HITS=$(git grep -nE 'cnb\.cool|CNB_TOKEN|@CodeBuddy' -- \ - ':!governance/GOVERNANCE.yaml' \ - ':!.github/workflows/cnb-dispatch.yml' \ - ':!.github/workflows/cnb-audit.yml' \ - ':!governance/expected-state.json' \ - ':!governance/policy/automation-limits.yaml' \ - ':!governance/providers.yaml' \ - ':!specs/IR-0004/spec.md' || true) - if [[ -n "$HITS" ]]; then - echo "$HITS" - echo "::error::操作性引用越界(IFACE-01 接缝与声明面之外,命中 $(echo "$HITS" | grep -c '' ) 行)——上列文件须收敛引用或走 ADR 修订接缝定义" - exit 1 - fi - echo 'AUDIT | cnb-audit | isolation | grep hits=0(接缝与声明面外零操作性引用)' >> "$GITHUB_STEP_SUMMARY" - echo 'AUDIT | cnb-audit | isolation | grep hits=0' diff --git a/.github/workflows/cnb-dispatch.yml b/.github/workflows/cnb-dispatch.yml deleted file mode 100644 index 5a72d52..0000000 --- a/.github/workflows/cnb-dispatch.yml +++ /dev/null @@ -1,177 +0,0 @@ -name: cnb-dispatch -# ============================================================================= -# CNB 派单经纪人(PM 默认实现主力入口,ADR-0085 裁决 2 / 决策 6;IR-0004 AC-14) -# -# 硬注释(改动前必读): -# - 本工作流是治理仓 CNB 三接缝之一(GOVERNANCE EX-1 声明条目 / IFACE-01, -# ADR-0085 决策 6 / IR-0004):治理仓对 CNB 的操作性引用收敛于 -# GOVERNANCE.yaml + org secrets + cnb-dispatch/cnb-audit 两工作流; -# cnb-audit 第③步隔离 grep 在本文件之外的命中即红。 -# - 判定永不外置(INV-02):本经纪人只派发生成侧任务,NPC 产物进任何判定链 -# 前必经机械核对(INV-03:基准 SHA/差异可应用/格式校验)——沙箱自报数字不采信。 -# - 任务文本禁止包含任何凭据(INV-06):token 只经 org secret 注入本经纪人, -# 永不进入 PM 上下文/任务文本/沙箱环境(DECISION-01 缓解条款)。 -# - 无人值守护栏适用(ADR-0040):派单前查 org 变量 AUTO_MERGE_DISABLED, -# 置位即停(fail-closed,禁止任何绕过尝试)。 -# -# 异步派单:不等待 NPC 回复;产物回收走 cnb-bridge `cnb_pool.py collect` -# 或 cnb-audit 周审计。actions 只用 org 白名单内的 checkout(CI-2), -# 其余逻辑一律 python3/bash——不引入新第三方 Action。 -# ============================================================================= -on: - workflow_dispatch: - inputs: - task: - description: '任务文本(机器可读,IFACE-02:必含清单 ID;std/heavy 须带 tier-reason:/tier-adr: 行)' - required: true - type: string - card: - description: 关联卡 issue 编号(选填,写进派单回执审计面) - required: false - type: string - default: '' - tier: - description: '核时档位:light=1C(默认)/ std=2C / heavy=4C;8C 禁用(BUDGET-01)' - required: false - type: string - default: light - account: - description: 'CNB 池账号别名:xuemei(默认)/ p11' - required: false - type: string - default: xuemei - repository_dispatch: - types: [cnb-dispatch] - -permissions: - contents: read - -concurrency: - group: cnb-dispatch - cancel-in-progress: false # 派单不互相挤占——排队而非取消(审计面完整) - -jobs: - dispatch: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1(org 白名单 CI-2) - with: - persist-credentials: false - # ------------------------------------------------------------------ - # 步骤 1:归一化双入口入参 + 派单前置检查(ADR-0040 护栏 / INV-06 凭据红线) - # ------------------------------------------------------------------ - - name: preflight(入参归一化 + AUTO_MERGE_DISABLED + 凭据嗅探) - env: - I_TASK: '${{ inputs.task || github.event.client_payload.task }}' - I_CARD: '${{ inputs.card || github.event.client_payload.card }}' - I_TIER: '${{ inputs.tier || github.event.client_payload.tier }}' - I_ACCOUNT: '${{ inputs.account || github.event.client_payload.account }}' - # org Actions 变量(visibility=all,全仓可读,automation-limits.yaml circuit_breaker 节) - AUTO_MERGE_DISABLED: '${{ vars.AUTO_MERGE_DISABLED }}' - run: | - set -euo pipefail - [[ -n "${I_TASK:-}" ]] || { echo '::error::task 缺失(必填)——拒发'; exit 1; } - : "${I_TIER:=light}" - : "${I_ACCOUNT:=xuemei}" - : "${I_CARD:=}" - # ADR-0040:熔断标志置位即停一切派发(空=未置位;fail-closed,禁绕过) - if [[ "${AUTO_MERGE_DISABLED,,}" =~ ^(true|1|yes)$ ]]; then - echo '::error::AUTO_MERGE_DISABLED 已置位——成本熔断中,停止一切 CNB 派单(ADR-0040)' - exit 1 - fi - # INV-06:任务文本禁含凭据字样——机械预检,命中即红(拒发即止损) - if grep -qiE 'CNB_TOKEN|ghp_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|-----BEGIN [A-Z ]*PRIVATE KEY' <<<"$I_TASK"; then - echo '::error::任务文本疑似包含凭据(INV-06)——拒发;重写任务文本,凭据只走 org secret' - exit 1 - fi - # 多行 TASK 用 heredoc 定界符写入环境面(GITHUB_ENV 多行语法) - { - printf 'TASK<> "$GITHUB_ENV" - # ------------------------------------------------------------------ - # 步骤 2:档位校验——真源 governance/policy/automation-limits.yaml cnb 节 - # (已落地:tiers {light:1, std:2, heavy:4} / default_tier: light,IR-0004 AC-15; - # cnb 节缺失即红:fail-closed,不内置缺省档位——同 test_integrity - # “本节拉取失败 = gate 红”先例,BUDGET-01) - # ------------------------------------------------------------------ - - name: 档位校验(policy 为准,fail-closed) - run: | - python3 - <<'EOF' - import os, re, sys, yaml - with open('governance/policy/automation-limits.yaml', encoding='utf-8') as f: - policy = yaml.safe_load(f) - cnb = policy.get('cnb') - if not isinstance(cnb, dict) or not cnb.get('tiers'): - print('::error::automation-limits.yaml 缺 cnb.tiers 节——IR-0004 D 组落地前 fail-closed,' - '不得内置缺省档位(policy 为准原则)') - sys.exit(1) - tiers = cnb['tiers'] # 期望形如 {light: 1, std: 2, heavy: 4} - tier = os.environ['TIER'] - if tier not in tiers: - print(f'::error::未知/禁用档位 tier={tier};允许集={sorted(tiers)}(8C 禁用,BUDGET-01)') - sys.exit(1) - task = os.environ['TASK'] - if tier == 'std' and not re.search(r'tier-reason:\s*\S.{4,}', task): - print('::error::std=2C 须在任务文本带 tier-reason: <一句话理由>(BUDGET-01)') - sys.exit(1) - if tier == 'heavy' and not re.search(r'tier-adr:\s*ADR-\d{4}', task): - print('::error::heavy=4C 须在任务文本带 tier-adr: ADR-NNNN(BUDGET-01)') - sys.exit(1) - cpus = tiers[tier] - if int(cpus) >= 8: - print(f'::error::档位 {tier}={cpus}C 达禁用线(8C 禁用,BUDGET-01)') - sys.exit(1) - with open(os.environ['GITHUB_ENV'], 'a', encoding='utf-8') as f: - f.write(f'CPUS={cpus}\n') - print(f'tier={tier} cpus={cpus}C(policy cnb.tiers 校验通过)') - EOF - # ------------------------------------------------------------------ - # 步骤 3:checkout cnb-bridge(L2 可删除层,ADR-0085 决策 6;main) - # ------------------------------------------------------------------ - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Cloudbird-Software/cnb-bridge - ref: main - path: cnb-bridge - persist-credentials: false - # ------------------------------------------------------------------ - # 步骤 4:选定账号令牌 + 派单。 - # secret 引用必须在表达式中静态出现(GH Actions 无法动态索引 secrets)—— - # 故用 env 映射落地 "account=xuemei→CNB_TOKEN_XUEMEI / p11→CNB_TOKEN_P11"; - # 两个 secret 均按 org 侧 required: false 声明(缺失不阻断表达式求值), - # 运行时缺失即 fail-closed 红。加账号 = owner 加 org secret + 本映射加一行(C1 PR)。 - # 令牌只在本步进程内 export,不落 GITHUB_ENV/日志/摘要。 - # ------------------------------------------------------------------ - - name: dispatch(token 仅本步内存面) - env: - CNB_TOKEN_XUEMEI: ${{ secrets.CNB_TOKEN_XUEMEI }} - CNB_TOKEN_P11: ${{ secrets.CNB_TOKEN_P11 }} - run: | - set -euo pipefail - case "$ACCOUNT" in - xuemei) export CNB_TOKEN="${CNB_TOKEN_XUEMEI:-}" ;; - p11) export CNB_TOKEN="${CNB_TOKEN_P11:-}" ;; - *) echo "::error::未知账号 $ACCOUNT(池内:xuemei/p11;新增=owner 加 org secret + 本 env 映射一行,C1)"; exit 1 ;; - esac - [[ -n "${CNB_TOKEN:-}" ]] || { echo "::error::org secret CNB_TOKEN_${ACCOUNT^^} 缺失——fail-closed 红(令牌通道唯一=org secret,INV-06)"; exit 1; } - # [run:] 锚由 cnb_pool.py 在任务文本内附加(IFACE-02:run-id 前缀落 payload.run_id); - # CLI 契约=位置参数 body + --account/--tier(档位→核数映射与 build logs 对账在 cnb-audit 侧) - set -- python3 cnb-bridge/cnb_pool.py dispatch "$TASK" --account "$ACCOUNT" --tier "$TIER" - "$@" | tee dispatch.out - # 审计面:窗口/账号/run_id 回执同步落 run 日志与 step summary(异步派单不等待 NPC) - RUN_ID=$(grep -oE 'run_id=[^ ]+' dispatch.out | head -1 || true) - WINDOW=$(grep -oE 'window=[^ ]+' dispatch.out | head -1 || true) - { - echo '## CNB 派单回执(异步——回收走 collect / cnb-audit 周审计)' - echo - echo "- account=$ACCOUNT tier=$TIER cpus=$CPUS card=${CARD:-(无)} ${WINDOW} ${RUN_ID}" - echo - echo '```' - sed -n '1,60p' dispatch.out - echo '```' - } >> "$GITHUB_STEP_SUMMARY" - echo "AUDIT | cnb-dispatch | account=$ACCOUNT | tier=$TIER | cpus=$CPUS | card=${CARD:-none} | ${WINDOW:-window=n/a} | ${RUN_ID:-run_id=n/a}" diff --git a/governance/GOVERNANCE.yaml b/governance/GOVERNANCE.yaml index f3c669b..a41b57f 100644 --- a/governance/GOVERNANCE.yaml +++ b/governance/GOVERNANCE.yaml @@ -169,17 +169,6 @@ domains: platform: {github: {mechanism: ruleset-required-status, context: "adversary", workflow: "CI-Workflows/.github/workflows/adversary*.yml"}} verify: {method: adversary-run, on: PR} - external_compute: - # ADR-0085 / IR-0004 D 组(cnb-bridge-design 三平面):发散与执行侧可外置免费算力; - # 判定与裁决永不外置。CNB=当前唯一实例(cnb-bridge 仓,可删除层)。 - measures: - - id: EX-1 - intent: "外部免费算力(当前=CNB CodeBuddy NPC 沙箱池)仅用于生成与执行侧(默认实现引擎:常规卡优先派发,强模型 PM 处理 gate 红/语义敏感);判定锚点全部在 GitHub CI(沙箱自报数字不采信,INV-01/02 语义)" - strength: enforced - platform: {external: {bridge: cnb-bridge, removable: true, - removal_drill: "cnb-bridge/REMOVAL.md 单页清单;删除后 gate/org-gate/conductor 语义不变(ADR-0085 决策 6 断言)", - seams: "GOVERNANCE 本条目 + org secrets CNB_TOKEN_ + .github cnb-dispatch/cnb-audit 两工作流(隔离审计=cnb-audit 周扫,操作性引用越界即红)"}} - evidence_ledger: # IR-0006 / ADR-0103:证据账本统一(判定/轨迹/丢弃三层)+ 保留策略。 # 声明先行——enforcement 载体(evidence/ 目录、checkpoint 复算脚本)随 diff --git a/governance/REPOS.yaml b/governance/REPOS.yaml index 5fa82ed..deed557 100644 --- a/governance/REPOS.yaml +++ b/governance/REPOS.yaml @@ -187,16 +187,6 @@ repos: entry_protocol: false # CNB 私有仓,无 GitHub 协议块(drift §17 不适用);visibility=private 属三阵地结构例外,不计入 ADR-0020 公开政策 note: 阵地丢失=台账+Gitee 密文 bundle 重建(ADR-0108 失效语义节) - - name: cnb-bridge - layer: L2 - visibility: public - status: active - role: CNB 免费算力桥接仓(可删除层,EX-1/ADR-0085/IR-0004 D 组)——多账号池 - accounts.yaml(无明文 token)+派单协议 cnb_pool.py+work-inbox PM 自起协议+ - REMOVAL.md 单页删除清单;判定永不外置(INV-02) - key_paths: [accounts.yaml, cnb_pool.py, work-inbox.yaml, REMOVAL.md] - entry_protocol: true # ADR-0095:协议块 v2 全仓下发(drift §17 逐字节对账) - - name: env-defs layer: L0 visibility: public diff --git a/governance/evidence-query.sh b/governance/evidence-query.sh index 7272580..2ab537b 100644 --- a/governance/evidence-query.sh +++ b/governance/evidence-query.sh @@ -11,6 +11,7 @@ # 源 5 tickets Cloudbird-Software/cnb-bridge @ tickets-ledger tickets.jsonl # (W2-C1 内网调度器短票据 grant/revoke——AC-5b 统一账本;Go 发射器产出, # 链形态与 evidence_shadow.py 逐字节兼容,金向量锚定) +# 【已退役(ADR-0119)】cnb-bridge 仓与 selfcloud 调度器已退役,tickets-ledger 源永久关闭。 # 源 6 feishu Cloudbird-Software/.github @ feishu-ledger governance/feishu/shadow-evidence.jsonl # (W3-F1 飞书多维表格投影同步/对账/重建演练事件——payload 带每轮 api_calls # 计数=AC-7a 调用账本可查询锚点;日常 15min 轮影子随 runner 销毁=丢弃层, @@ -87,7 +88,7 @@ fi DRILL_OK=0; fetch_file "Cloudbird-Software/.github" "drill-ledger" "governance/drill/shadow-evidence.jsonl" "$TMP/drill.jsonl" && DRILL_OK=1 || [[ $? -eq 1 ]] || exit 2 BUTLER_OK=0; fetch_file "Cloudbird-Software/.github" "butler-ledger" "governance/butler/shadow-evidence.jsonl" "$TMP/butler.jsonl" && BUTLER_OK=1 || [[ $? -eq 1 ]] || exit 2 ELEV_OK=0; fetch_file "Cloudbird-Software/.github" "elevation-ledger" "governance/elevation/shadow-evidence.jsonl" "$TMP/elev.jsonl" && ELEV_OK=1 || [[ $? -eq 1 ]] || exit 2 -TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2 +TICKET_OK=0 # cnb-bridge 已退役(ADR-0119),tickets-ledger 源永久关闭 FEISHU_OK=0; fetch_file "Cloudbird-Software/.github" "feishu-ledger" "governance/feishu/shadow-evidence.jsonl" "$TMP/feishu.jsonl" && FEISHU_OK=1 || [[ $? -eq 1 ]] || exit 2 ENVD_OK=0; fetch_file "Cloudbird-Software/.github" "env-ledger" "governance/env/shadow-evidence.jsonl" "$TMP/envd.jsonl" && ENVD_OK=1 || [[ $? -eq 1 ]] || exit 2 diff --git a/governance/expected-state.json b/governance/expected-state.json index 3a641c8..02d1e39 100644 --- a/governance/expected-state.json +++ b/governance/expected-state.json @@ -101,9 +101,7 @@ "CB_APP_ID", "AGENT_APP_SECRET", "GOVERNANCE_TOKEN", - "LLM_API_KEY1", - "CNB_TOKEN_XUEMEI", - "CNB_TOKEN_P11" + "LLM_API_KEY1" ], "github_app": { "name": "cloudbrid-agent", @@ -132,7 +130,6 @@ "agent-tools", "arbiter", "archive", - "cnb-bridge", "mutual", "template-service" ], @@ -168,8 +165,7 @@ "Use-up-Plan", "AI_Web_School", "mutual", - "holdout", - "cnb-bridge" + "holdout" ] }, "direct_push_exemptions": { @@ -285,9 +281,6 @@ "c1d31e10e7798e82f1d0de022f58ae15382af1fe", "be94906f09b8e810449be11be63aff8ecf1bdf0f" ], - "cnb-bridge": [ - "6a43a24ba859a64ca9770c18fb1254050917984b" - ], "holdout": [ "63360c581524510ef37150dd7540cb333d283014" ], @@ -319,6 +312,6 @@ ] }, "notes": { - "adr_0085": "ADR-0085:agent-registry/agent-platform/agent-tools 退役(GitHub 归档只读);CNB 双账号 secret 登记(EX-1 三接缝);cnb-bridge 入 verifier 挂载面" + "adr_0085": "ADR-0085:agent-registry/agent-platform/agent-tools 退役(GitHub 归档只读);EX-1 三接缝已随 ADR-0119 拆除(2026-09-10);cnb-bridge 退役归档" } } diff --git a/governance/policy/automation-limits.yaml b/governance/policy/automation-limits.yaml index 8bb196c..53d96e8 100644 --- a/governance/policy/automation-limits.yaml +++ b/governance/policy/automation-limits.yaml @@ -75,16 +75,3 @@ circuit_breaker: # 人工复位:owner PATCH org 变量为 false(或 DELETE)+ 在 P0 issue 留复位评论(留痕); # cost-check 确认"变量已复位且用量 <100%"后自动关闭 P0 issue reset_by: randypanding - -# ---- CNB 免费算力池参数(EX-1 / ADR-0085 / IR-0004 AC-15;配置面:加账号=改配置零代码)---- -cnb: - accounts: # 与 cnb-bridge/accounts.yaml 对账(漂移即红) - - alias: xuemei - secret: CNB_TOKEN_XUEMEI # org secret,仅 cnb-dispatch/cnb-audit 可见 - - alias: p11 - secret: CNB_TOKEN_P11 - tiers: {light: 1, std: 2, heavy: 4} # 核数;8C 禁用;heavy 须 ADR - default_tier: light - max_concurrent_per_account: 8 - quota_alert_pct: 20 # 余量低于此值自动开 cost 类 issue - ledger_reconcile_deviation_pct: 10 # 快照差分 vs build logs 实耗对账偏差告警线 diff --git a/governance/providers.yaml b/governance/providers.yaml index 36fcb96..2b31af6 100644 --- a/governance/providers.yaml +++ b/governance/providers.yaml @@ -5,20 +5,9 @@ version: 1 # 永不进 agent/PM 上下文。调用一律借道 dispatch 经纪人工作流(工作流内取 # org secret → 调用 → 产物写回 run 日志/issue/artifact)。 # 加工具 = owner 加一条 org secret + 本目录一条登记,零代码。 -# CNB 池的账号级配置在 cnb-bridge/accounts.yaml(可删除层,EX-1 隔离);本目录 -# 只登记入口(三接缝口径:目录条目属导航性提及,不计入操作性引用)。 +# 本目录只登记入口(三接缝口径:目录条目属导航性提及,不计入操作性引用)。 # ============================================================================ entries: - - name: cnb-pool - kind: compute # 免费沙箱算力池(默认实现引擎) - entry: cnb-dispatch(.github 仓 workflow)/ ghcb dispatch <卡#> - broker: .github/workflows/cnb-dispatch.yml - secrets: [CNB_TOKEN_XUEMEI, CNB_TOKEN_P11] - catalog: Cloudbird-Software/cnb-bridge accounts.yaml - limits: automation-limits.yaml#cnb(档位 light/std/heavy、并发、配额告警线) - removal: cnb-bridge/REMOVAL.md(可删除层,删除后核心治理语义不变) - trust_level: E3 # FR-08 修订裁决(ADJUDICATION §9)/ IR-0010 卡 B1 - data_classes_allowed: [D-公开] - name: llm-verifier kind: model # 红队/verifier 判定模型(kimi k2.7) entry: adversary 工作流(repository_dispatch / workflow_dispatch) @@ -46,9 +35,9 @@ entries: trust_level: E2 # FR-08 修订裁决(ADJUDICATION §9)/ IR-0010 卡 B1 data_classes_allowed: [D-公开] - name: self-cloud-pool - kind: compute # 自有云内网算力池(公网服务器+云电脑池) - entry: 服务器调度器 v0=cnb-bridge 仓 selfcloud/(W2-C1 已落地:Job Contract - 消费+短票据签发+egress allowlist+无状态约束执法;RUNBOOK §5) + kind: compute # 自有云内网算力池(公网服务器+云电脑池)——已退役(2026-09-10) + entry: 服务器调度器 v0(W2-C1 已落地:Job Contract + 消费+短票据签发+egress allowlist+无状态约束执法;RUNBOOK §5;源码见 archive/retired/ex-1-cnb-bridge-20260910/cnb-bridge/selfcloud/) placement: server-anchored(池化以服务器为锚,ADR-0103 决策 4) secrets: [] # 凭据一律走内网域 Vault(本条目零 org secret——分域边界) catalog: governance/assets-register.yaml(资产归属/额度/license 边界) @@ -56,6 +45,7 @@ entries: note: 执行面基础设施≠harness(自建判据 ≥3 次妥协不变);worker egress allowlist+W2-C1 起执法 trust_level: E2 # FR-08 修订裁决(ADJUDICATION §9)/ IR-0010 卡 B1 data_classes_allowed: [D-公开] + retired: true # ADR-0119:cnb-bridge 退役后 selfcloud 调度器同步退役(2026-09-10) - name: vault kind: secret # 内网 Vault(执行面凭据面) entry: 内网 Vault 实例(物理在内网域;org 不持有其副本) diff --git a/scripts/ghcb b/scripts/ghcb index e40e92b..1f5272a 100644 --- a/scripts/ghcb +++ b/scripts/ghcb @@ -13,8 +13,7 @@ # —— PM 子命令(ADR-0085)—— # ghcb board [repo] # PM 全流水线视图:全部 state:* 的 IR/卡(不只 ready) # ghcb dispatch [repo] [--tier light|std] [--account ] -# # 派 CNB:触发 .github 仓 cnb-dispatch 工作流(EX-1 经纪人, -# # key 永不入 PM 上下文);=卡 issue 号 +# # 【已退役(ADR-0119)】CNB 免费算力桥接已撤销,此命令不再可用 # ghcb accept [repo] # 生成 IR 验收报告骨架(specs/IR-XXXX/acceptance.md)到 stdout # # (ADR-0095:feature IR 开在产品仓,repo=IR 所在仓,缺省 .github) # ghcb report [周号] # 生成运行报告骨架(archive/runs/YYYY-WNN.md 追加段)到 stdout @@ -105,22 +104,9 @@ case "$CMD" in gh issue list --repo "$R" --label type:intent --state open --json number,title,labels --jq '.[] | select([.labels[].name | startswith("state:")] | any | not) | "#\(.number) \(.title)"' 2>/dev/null || true ;; dispatch) - # CNB 派单(EX-1 三接缝的 PM 面):key 留在 org secret,本命令只发 workflow_dispatch - N="${2:?用法: ghcb dispatch [repo] [--tier light|std] [--account ]}" - REPO_ARG="${3:-$(origin_repo)}"; shift 3 2>/dev/null || shift $# - TIER="light"; ACCOUNT="" - while [[ $# -gt 0 ]]; do - case "$1" in - --tier) TIER="$2"; shift 2 ;; - --account) ACCOUNT="$2"; shift 2 ;; - *) shift ;; - esac - done - CARD_REPO="$(norm_repo "$REPO_ARG")" - TITLE=$(gh issue view "$N" --repo "$CARD_REPO" --json title --jq .title 2>/dev/null) || { echo "错误:卡 #$N 读取失败" >&2; exit 2; } - echo "派单 → CNB(卡 #$N「${TITLE}」|档位 $TIER${ACCOUNT:+|账号 $ACCOUNT})" - echo "任务文本=卡正文+本提示;经 .github 仓 cnb-dispatch 经纪人执行(key 永不出 org secret)" - MSYS2_ARG_CONV_EXCL='*' MSYS_NO_PATHCONV=1 gh workflow run cnb-dispatch.yml -R "$ORG/.github" -f card="$CARD_REPO#$N" -f tier="$TIER" ${ACCOUNT:+-f account="$ACCOUNT"} -f task="@card" && echo "已触发(几分钟后在 .github 仓 Actions→cnb-dispatch 看 run;回收=gh workflow run cnb-dispatch.yml -f ... 或 cnb-audit 周扫)" || { echo "错误:workflow 触发失败(检查 gh 凭据对 $ORG/.github 的写权)" >&2; exit 2; } + echo "错误:ghcb dispatch 已退役(ADR-0119:EX-1 CNB 免费算力桥接已于 2026-09-10 撤销)" >&2 + echo "回退方案:常规开发卡默认执行者需回退付费 API 或申请新常驻机器。" >&2 + exit 3 ;; accept) # IR 验收报告骨架(T9 谓词消费 specs//acceptance.md)——PM 填证据后 PR 入仓 diff --git a/scripts/sli-report.sh b/scripts/sli-report.sh index f0272a7..3704d91 100644 --- a/scripts/sli-report.sh +++ b/scripts/sli-report.sh @@ -191,7 +191,7 @@ repos=c if isinstance(c,list) else c.get('repos',c) names=[r['name'] if isinstance(r,dict) else r for r in (repos.values() if isinstance(repos,dict) else repos)] if repos else [] print(' '.join(n for n in names if n))" 2>/dev/null) \ || infra "REPOS.yaml 解析" -[[ -n "$REPOS" ]] || REPOS="Use-up-Plan template-service QW_Arena1 Script_Writer AI_Web_School Shorts_Director mutual cnb-bridge arbiter CI-Workflows" # ADR-0085:退役仓出列、新仓入列(REPOS.yaml 拉取失败时的兜底清单) +[[ -n "$REPOS" ]] || REPOS="Use-up-Plan template-service QW_Arena1 Script_Writer AI_Web_School Shorts_Director mutual arbiter CI-Workflows" # ADR-0085/ADR-0119:退役仓出列、新仓入列(REPOS.yaml 拉取失败时的兜底清单) TMP=$(mktemp -d) for R in $REPOS; do From 26bfb4f62aecef0ff5b052ecb2a8f796bbd4d26c Mon Sep 17 00:00:00 2001 From: CEO Agent Date: Sun, 13 Sep 2026 19:17:14 +0800 Subject: [PATCH 5/5] chore(gov): register governance-kernel in REPOS.yaml (L0 governance class) --- governance/REPOS.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/governance/REPOS.yaml b/governance/REPOS.yaml index deed557..b68b36e 100644 --- a/governance/REPOS.yaml +++ b/governance/REPOS.yaml @@ -224,5 +224,13 @@ repos: key_paths: [README.md, VOCABULARY.md, absorption-map/, patches/] entry_protocol: false # 文档仓无协议块(drift §17 不适用);AGENTS.md 索引块待补(下批 PR) + - name: governance-kernel + layer: L0 + visibility: public + status: active + role: 治理内核主仓——DGA dogfood 实例+自举 speceval+运行报告+红队闭环(runtime/bin 38+ 脚本/state/specs/kernel/ 24 speceval/plans/ 建设方案) + key_paths: [runtime/, state/specs/kernel/, plans/, decisions/, reports/] + entry_protocol: true # 治理内核仓自带 AGENTS.md 入口协议块 + external_upstreams: []