feat(agentctl): externalize governance policy to JSON

Load configs/agent-governance.json from the main worktree with fail-closed
POLICY_* codes, and keep test fixtures writing the same contract file.
This commit is contained in:
WeiCHEN
2026-09-23 14:50:56 +08:00
parent 1cb8c6f4b3
commit 33c7b9a260
9 changed files with 287 additions and 14 deletions
+1
View File
@@ -18,6 +18,7 @@
| owner | task | branch | worktree | mutex | status |
|---|---|---|---|---|---|
| Cursor | agent-governance-config-2026-09-23 | feature/agent-governance-config-2026-09-23 | .worktrees/agent-governance-config-2026-09-23 | agent-governance-config | in_progress |
| Cursor | coordination-db-daemon-impl-plan-2026-09-23 | feature/coordination-db-daemon-impl-plan-2026-09-23 | .worktrees/coordination-db-daemon-impl-plan-2026-09-23 | coordination-db-daemon-impl-plan | done |
| Cursor | coordination-db-daemon-2026-09-23 | feature/coordination-db-daemon-2026-09-23 | .worktrees/coordination-db-daemon-2026-09-23 | coordination-db-daemon | done |
| Cursor | integrate-pi-runner-response-size-r2-2026-09-23 | feature/integrate-pi-runner-response-size-2026-09-23 | .worktrees/integrate-pi-runner-response-size-2026-09-23 | git:dev | done |
@@ -0,0 +1,45 @@
---
title: "W1-U2:治理策略外部化为 agent-governance.json"
task_id: agent-governance-config-2026-09-23
status: in_progress
created: 2026-09-23
updated: 2026-09-23
owner: Cursor
task_type: implementation
task_tier: single
policy_revision: "agent-governance-2026-09-21-r1 @ 1cb8c6f4b3379ef1136972ab36c5e120829d11f8"
branch: feature/agent-governance-config-2026-09-23
worktree: .worktrees/agent-governance-config-2026-09-23
base_dev_sha: "1cb8c6f4b3379ef1136972ab36c5e120829d11f8"
write_scope: ["scripts", "configs", ".doc"]
allowed_environments: []
mutex: agent-governance-config
review_state: pending
integration_state: pending
deployment: not_required
cleanup: pending
cleanup_owner: "独立维护者"
cleanup_trigger: "合入 local_dev 且无进程占用后复查"
remote_sync: not_requested
---
# W1-U2:治理策略外部化
## 用户目标与授权
- 用户目标:`configs/agent-governance.json`(stdlib JSON)外部化 SHARED_DOCS / JOB_KINDS / doc_rules 等;`load_policy` fail-closed。
- 授权:W1 波次 U2;不 push。
- 交付终点:合入 local_dev;负例三类拒绝码可测。
## 步骤
1. [x] worktree + register + CURRENT 认领
2. [ ] 新建 `configs/agent-governance.json`
3. [ ] `load_policy` + 写路径前置校验;只读不创建
4. [ ] 测试 fixture 写入策略文件
5. [ ] 负例测试 + unittest 全绿 + integrate
## 相关链接
- [实施承接计划](../../remediation/2026-09-23-coordination-db-daemon-implementation-undertaking-plan.md)
- 前序 U1r tip:`1cb8c6f4`