# 恒天 Agent 规约合并与审计整改 Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** 将项目运行规约并入唯一的 `AGENTS.md`，同步本地审计整改并保留候选 Ledger 的未可用状态。

**Architecture:** 根 `AGENTS.md` 承担元数据、加载路由、项目事实证据状态门和全部运行铁律。项目 KB、README 与 SC 检索指引只引用根入口；候选 Ledger 仅记录为 `ht-ops-2607`，不进行远程、Registry 或 Issue 写入。

**Tech Stack:** Markdown、CSV、PowerShell、ripgrep、Git 只读状态检查。

---

### Task 1: 合并运行规约到根入口

**Files:**
- Modify: `C:\Users\zx447\Desktop\项目KB\恒天\AGENTS.md`
- Delete: `C:\Users\zx447\Desktop\项目KB\恒天\PROMPT_恒天项目运行规约.md`

- [ ] **Step 1: 建立合并前控制清单**

Run:

```powershell
$rules = @('Cloud Public Edition','A-知识查询','D/T/P','诊断走四步','给客户的信息','样例值不进 P 系统','Session 到 Issue Ledger 回写')
$rules | ForEach-Object { if (-not (rg -l --fixed-strings $_ AGENTS.md PROMPT_恒天项目运行规约.md)) { throw "缺失控制：$_" } }
```

Expected: every required control is found before the merge.

- [ ] **Step 2: 写入唯一运行入口**

Move the complete Prompt rule set into `AGENTS.md` after the project KB navigation. Add the project-fact evidence gate and set the candidate Ledger ID to `ht-ops-2607` with state `候选，未可用`.

- [ ] **Step 3: 删除已合并 Prompt**

Run:

```powershell
Remove-Item -LiteralPath 'PROMPT_恒天项目运行规约.md'
```

Expected: only `AGENTS.md` remains as the runtime rule source.

### Task 2: 同步运行期引用和审计资产

**Files:**
- Modify: `C:\Users\zx447\Desktop\项目KB\恒天\README.md`
- Modify: `C:\Users\zx447\Desktop\项目KB\恒天\KB_恒天奥特发系统\01_项目概况与范围.md`
- Modify: `C:\Users\zx447\Desktop\项目KB\恒天\KB_恒天奥特发系统\acceptance_tests.md`
- Modify: `C:\Users\zx447\Desktop\项目KB\恒天\KB_SC\KB_Retrieval_Guide_SC_Agent.md`
- Modify: `C:\Users\zx447\Desktop\项目KB\恒天\docs\superpowers\specs\2026-07-21-hengtian-agent-consolidation-design.md`

- [ ] **Step 1: 更新 README 和运行期文档引用**

Replace the standalone Prompt link with the root Agent entry. Replace operational references to `PROMPT_恒天项目运行规约.md` with `AGENTS.md` and the applicable named rule.

- [ ] **Step 2: 更新验收题库**

Replace every “运行规约铁律” evidence reference with `AGENTS.md` named rules. Add test `T-29` requiring an unverified summary to be rejected as a D/T/P write input.

- [ ] **Step 3: 保留历史文档但注明迁移**

Add one migration note to the new design document. Do not rewrite prior dated plan/spec history or any customer facts.

### Task 3: 验证本地整改

**Files:**
- Verify: all files in Tasks 1–2

- [ ] **Step 1: 验证运行控制与候选 Ledger 状态**

Run:

```powershell
rg -n 'A-知识查询|D/T/P|给客户的信息|给顾问的内部分析|项目事实证据状态门|ht-ops-2607|候选.*未可用' AGENTS.md
if (Test-Path -LiteralPath 'PROMPT_恒天项目运行规约.md') { throw 'Prompt file still exists.' }
```

Expected: all controls are in `AGENTS.md`; the Prompt file is absent.

- [ ] **Step 2: 验证引用、链接和隔离**

Run:

```powershell
rg -n --glob '*.md' 'PROMPT_恒天项目运行规约\.md' AGENTS.md README.md KB_恒天奥特发系统 KB_SC
rg -n --glob '*.md' '正式 Ledger|已闭环|可回写' AGENTS.md README.md KB_恒天奥特发系统
```

Expected: no runtime references to the removed Prompt; any Ledger reference remains explicitly conditional or unavailable.

- [ ] **Step 3: 验证工作区范围**

Run:

```powershell
git status --short
git diff --check
```

Expected: only the planned documentation changes are attributable to this task; no remote operation or Issue object exists.
