治理 checklist · 更新 2026-06-27

Agentic Coding Governance Checklist:Repo Access、Command Policy、Hooks、MCP、PR Review、Secrets 与 Audit Logs

当 bakeoff 证明 Claude Code、OpenAI Codex CLI 等 coding agents 有用之后,团队采用前需要的一份实用 rollout policy。

成功的 agentic coding bakeoff 回答的是工具能否产出有用的 reviewed diffs。治理要回答更难的问题:它被允许在哪些 repo 使用、能做什么、谁 review、必须记录什么,以及什么时候必须停止。

这份 checklist 把 agentic coding 从个人效率习惯转成团队 policy,覆盖 repository access、command authority、hooks、MCP servers、plugins、secrets、prompt injection、branch protection、PR review、audit logs 和 incident response。

RepoDaily 判断

在没有 written policy 之前,不要大规模 rollout coding agents。Policy 至少要覆盖 allowed repositories、denied paths、command approvals、hooks/MCP servers、secret handling、PR review、logging 和 rollback。Coding agent 应该产出 reviewed engineering artifacts,而不是不可见的 local automation。

快速矩阵

治理区域默认规则何时升级审批保留证据
Repository access从低风险 repo 和显式 opt-in 开始涉及 production、regulated data、infra、auth、billing 或 secretsAllowed repo list、owner approval、risk tier
Command policy允许 read/build/test;mutation 或 network operations 需审批命令可能 delete、deploy、migrate、exfiltrate、install 或改 credentialsCommand log、approval trace、denied-command list
Sensitive paths默认阻止 secrets、deploy scripts、migrations、IaC、lockfiles 和 data dumps任务确实需要这些路径Path exception、reviewer、final diff
Hooks and plugins启用前 review 并 pin source/versionHook 会运行 commands、call services 或自动改文件Hook source、config、owner、review notes
MCP servers and tools按 server 最小权限审批Server 可访问 browser、files、databases、tickets、email 或 cloud APIsServer inventory、scopes、tokens、owner
PR review每个 generated patch 都要 human owner 和 CIPatch 改 security、dependencies、schema、infra 或 user dataPR link、CI result、reviewer comments
Secrets and dataAgent workspace 不放 unmanaged secretsAgent 需要 customer data、prod logs、API keys 或 private datasetsData approval、redaction notes、retention decision
Audit logs记录 task、prompt、tool、commands、diffs、tests、approvals、reviewer decision发生 incident、rollback 或 policy exceptionImmutable run report 或 PR checklist

治理成熟度评分卡

从 pilot 扩展为团队标准前,先用这张表评分。

控制项0 分1 分2 分Owner 问题
Repo tiering没有分级非正式分级明确 low/medium/high-risk repo policy今天哪些 repo 允许 agent 写入?
Command approvalsAd hoc prompts有部分 denied commands有文档化 allow/deny/approval list哪个 command 会终止运行?
Tool inventoryhooks/plugins/MCP 未知部分记录Owner、scope、token、version 均跟踪每个 external tool 谁负责?
Secret hygieneworkspace 可能有 secrets部分 cleanup无 unmanaged secrets,redaction rules 明确Agent 本地能看到什么?
Review workflowGenerated patches self-merged偶尔 human reviewCI + human owner 必需谁对 merge 负责?
Incident response无 rollback plan手动 rollback已有 stop/revoke/revert/report playbookAgent 做坏事后怎么办?

30 分钟治理 Rollout 测试计划

在 coding agent 超出个人 pilot 前使用。

0–5 分钟:choose scope

选择一个 tool、一个 repository tier、一个 allowed task class 和一个 owner。

成功标准Pilot 有明确 written boundary。

5–10 分钟:write policy stub

列出 allowed commands、denied paths、approval triggers 和 required PR checks。

成功标准Reviewer 能根据书面规则停止运行。

10–18 分钟:tool inventory

记录 hooks、plugins、MCP servers、package versions、tokens 和 external services。

成功标准每个 external capability 都有 owner 和理由。

18–24 分钟:run one governed task

执行一个低风险任务,同时收集 commands、diff、tests、approvals 和 reviewer comments。

成功标准Run 产出可 review artifact 和 policy evidence。

24–30 分钟:rollout decision

决定 expand、repeat、restrict 或 stop,并记录 policy gaps 和下次 review date。

成功标准下一步基于 evidence 和 owner sign-off。

Rollout 决策流程

  1. 从 bakeoff 结果开始:只治理那些在低风险 repo 上产出有用 reviewed diffs 的工具。
  2. 把 repositories 分级:read-only、low-risk write、medium-risk approval、high-risk restricted 和 prohibited。
  3. 定义 allowed commands、denied commands、approval triggers、sensitive paths 和 network/tool-use boundaries。
  4. 盘点 hooks、plugins、MCP servers、browser tools、file tools、ticketing tools 和 cloud/API integrations。
  5. 定义 PR policy:branch protection、required CI、human owner、reviewer checklist、dependency/security review 和 rollback owner。
  6. 运行 limited pilot,每周 review logs,然后按 repository class 扩展,而不是按热情扩展。

场景表

Use case允许策略Required review
Read-only explanation多数 repo 允许,regulated/customer-data areas 除外Reviewer 检查 explanations 不泄露 secrets、不编造 behavior
Docs update低风险 repo 允许,tests 可选Human review factual accuracy 和 unsupported claims
Test additionLow/medium-risk repos 允许,CI 必需Reviewer 检查 tests 断言真实 behavior,不只是 snapshots
Small bug fixBakeoff 成功后允许,需 focused testsHuman owner、CI、changed-file review、rollback path
Dependency update需要 approvalSecurity/license review、lockfile review、changelog check
Database migration默认 restrictedSenior reviewer、migration rollback、data safety review
Infrastructure/IaC changePolicy 成熟前 restricted 或 read-onlyInfra owner approval、plan output、secret scan、rollback owner
Website cloning benchmark仅允许 approved reference pagesCopyright/asset scope review,未获 owner approval 不部署生产

治理风险清单

Invisible local automation

如果 commands 和 diffs 不记录,组织就无法学习或调查 agent behavior。

Prompt injection in repo content

README、issues、comments、docs 和 fixtures 都可能包含与团队 policy 冲突的指令。

Hook and MCP sprawl

Hooks、plugins、MCP servers 可能悄悄把 coding assistant 变成广泛自动化平台。

Secret bleed

除非准备 workspace 和 shell,否则 agents 可能读取 local files、env vars、logs 或 configs。

Review laundering

人类点 merge 不够;reviewer 必须理解 diff 并承担 outcome。

Policy drift

Agent versions、settings、hooks 和 repository risk 都会变化,治理需要周期性 review。

治理实施模式

Repository risk tiers

把 repo 标为 read-only、low-risk write、medium-risk approval、high-risk restricted 或 prohibited。

Allowed command baseline

先允许 read、format、lint、unit-test、typecheck;install、network、delete、deploy、migrate 或 credential operations 需审批。

Sensitive-path guardrails

阻止或审批 `.env`、secrets、infra、migrations、auth、billing、production configs 和 large data dumps。

Tool inventory

跟踪 hooks、plugins、MCP servers、browser tools、file tools、package managers 和 external APIs 的 owner 与 scope。

PR checklist

要求 generated-code label、tests、changed-file review、data/secrets check、dependency check 和 reviewer ownership。

Incident playbook

定义 stop、revoke token、revert commit、rotate secret、notify owner 和 update policy steps。

常见问题

给把 agentic coding pilots 转成 policy 的团队提供简短答案。

Coding agent 什么时候能团队 rollout?

通过真实 bakeoff,并且团队有 repository access、command approvals、secrets、tool integrations、PR review、logging 和 rollback 的书面规则之后。

Hooks 和 MCP servers 应该默认启用吗?

不应该。按一个一个启用,并记录 owner、scope、token、version 和 review notes。

Agents 能改 infrastructure repositories 吗?

先 read-only。写入 infra 需要 senior owner approval、plan output、CI、rollback path 和明确 command policy。

最小 audit record 是什么?

Task prompt、tool/version、repository、commands、changed files、tests、approvals、reviewer、merge decision,以及任何 policy exception。

相关雷达

Infrastructure & Runtime 雷达

相关 RepoDaily 解读

来源

  1. Claude Code official docs
  2. Claude Code settings docs
  3. Claude Code hooks docs
  4. Claude Code MCP docs
  5. OpenAI Codex CLI docs
  6. OpenAI Codex security docs
  7. anthropics/claude-code
  8. openai/codex

Feedback

这页是否帮助你做出决定?

匿名反馈只用于判断内容是否真正有用。

报告过期或缺失的证据