Files
Agent-System/.cursor/skills/agentctl-lease-write/SKILL.md
T
weichen 510b46636a feat(gov): add codegraph hooks and read-only cleanup/MATRIX audits
Wire CodeGraph into agentctl init/create/sync and expose cleanup report
plus docs drift so agents can inventory stale worktrees and MATRIX
regressions without auto-deleting or auto-promoting done.
2026-09-23 17:51:04 +00:00

1.8 KiB
Raw Blame History

name, description
name description
agentctl-lease-write Write under agentctl leases and docs apply CAS. Use before any git write, shared-doc edit, or when hitting UNMANAGED_DOCUMENT_CHANGE / EVIDENCE_REQUIRED.

agentctl 租约写回

权威:AGENTS §3–5、操作规范。

原则

  • 任何仓库写(含 git add/commit)必须在 agentctl with / MCP lease_run 租约内
  • CURRENT / FEATURE-MATRIX 只能 docs apply(行级 CAS;MATRIX 键为 record_id)
  • 直接 git commit 会被 agentctl-managed pre-commit hook 拒绝

lease_run(CLI)

python3 scripts/agentctl.py with \
  --task "$ID" \
  --resource path:scripts --resource path:.doc --resource git:index \
  -- bash -lc 'git add … && git commit -m "…"'

MCP:lease_run 的 command 为 argv 数组(无额外 shell)。

docs apply(行级)

python3 scripts/agentctl.py docs snapshot --file .doc/ops/CURRENT.md --record "$RID"
# expected_sha256 = snapshot.sha256;改 replacement 后:
python3 scripts/agentctl.py docs apply --task "$ID" --request /tmp/req.json

FEATURE-MATRIX 升 done 需要 docs:approve + 可核验 evidence(git cat-file -e),否则 EVIDENCE_REQUIRED。 收口或合入含 MATRIX 的变更后跑 python3 scripts/agentctl.py docs drift:硬告警仅 done→非 done;不因任务结束自动升 done。

常见拒绝

码 处置
UNMANAGED_DOCUMENT_CHANGE 保留现场,先 snapshot/reconcile,勿覆盖
BASE_CHANGED 重新 snapshot,基于新 sha 再 apply
AMBIGUOUS_RECORD 修重复 record_id / 模块名
CAPABILITY_REQUIRED 任务缺 docs:admin / docs:approve
DOCUMENT_RECEIPT_REQUIRED 共享文档须经 apply 收据后再 commit