@tea-agent/loop-agent 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/AGENTS.md +62 -45
  2. package/CHANGELOG.md +59 -43
  3. package/README.md +180 -179
  4. package/bin/loop-agent.js +21 -21
  5. package/dist/application/dag/generate-task-dag.js +3 -3
  6. package/dist/application/dag/run-dag.js +14 -1
  7. package/dist/application/dag/validate-dag.js +1 -0
  8. package/dist/commands/init.js +482 -459
  9. package/dist/workflows/dag/failure-routing.js +82 -0
  10. package/dist/workflows/dag/lifecycle.js +95 -3
  11. package/dist/workflows/dag/report.js +73 -1
  12. package/docs/README.md +47 -45
  13. package/docs/agent-dag-recovery-playbook.md +32 -6
  14. package/docs/agent-dag-runner.md +17 -17
  15. package/docs/architecture/runtime-boundaries.md +1 -1
  16. package/docs/cursor-executor-usage.md +5 -5
  17. package/docs/decisions/README.md +2 -2
  18. package/docs/design/README.md +24 -24
  19. package/docs/development-principles.md +50 -50
  20. package/docs/dynamic-workflow-dag-engine-roadmap.md +6 -6
  21. package/docs/exec-plans/README.md +4 -4
  22. package/docs/exec-plans/active/README.md +10 -9
  23. package/docs/exec-plans/completed/README.md +8 -8
  24. package/docs/feature-workflow.md +111 -109
  25. package/docs/harness-methodology-verification.md +18 -18
  26. package/docs/loop-agent-harness.md +36 -36
  27. package/docs/production-readiness.md +96 -0
  28. package/docs/progress/README.md +2 -2
  29. package/docs/reports/README.md +4 -2
  30. package/docs/templates/agent-dag-decision-gate-dogfood-report.md +1 -1
  31. package/docs/templates/agent-dag-process-supervisor.prompt.md +2 -2
  32. package/docs/templates/agent-dag-report.schema.json +33 -2
  33. package/docs/templates/agent-dag-review-verdict.prompt.md +1 -1
  34. package/docs/templates/agent-dag.base.json +195 -195
  35. package/docs/templates/agent-dag.final-verification.json +190 -190
  36. package/docs/templates/agent-dag.schema.json +17 -17
  37. package/docs/templates/agent-dag.supervised-implementation.json +500 -500
  38. package/docs/templates/hybrid-dag.json +193 -193
  39. package/docs/templates/production-readiness-checklist.md +57 -0
  40. package/docs/templates/progress-log.md +7 -7
  41. package/docs/templates/project-start-checklist.md +8 -8
  42. package/docs/templates/qa-report.md +17 -11
  43. package/docs/templates/sprint-contract.md +19 -19
  44. package/docs/verification-matrix.md +37 -26
  45. package/examples/example-dag.json +51 -51
  46. package/examples/hybrid-loop-agent-dag.json +194 -194
  47. package/harness.json +5 -5
  48. package/package.json +62 -62
  49. package/skills/loop-agent/SKILL.md +35 -35
  50. package/skills/loop-agent/references/command-reference.md +107 -65
  51. package/skills/loop-agent/references/harness-policy.md +30 -30
  52. package/skills/loop-agent/references/hybrid-dag.md +30 -30
  53. package/skills/loop-agent/references/model-routing.md +1 -1
  54. package/skills/loop-agent/references/orchestrator-and-interventions.md +1 -1
  55. package/skills/loop-agent/references/pi-prompt.md +9 -9
  56. package/skills/loop-agent/references/post-implementation-and-patterns.md +7 -7
  57. package/skills/loop-agent/references/task-workflow.md +19 -19
  58. package/skills/loop-agent/references/verification-and-failure-handling.md +36 -0
@@ -1,8 +1,8 @@
1
- # Cursor Executor Usage
1
+ # Cursor Executor 用法
2
2
 
3
- Cursor is used for bounded write implementation. Every Cursor write task must define scope explicitly.
3
+ Cursor 用于有界写实现。每个 Cursor 写任务必须显式定义 scope
4
4
 
5
- ## Required Prompt Fields
5
+ ## Prompt 必填字段
6
6
 
7
7
  - task id
8
8
  - objective
@@ -10,7 +10,7 @@ Cursor is used for bounded write implementation. Every Cursor write task must de
10
10
  - forbidden paths
11
11
  - constraints
12
12
  - expected verification
13
- - instruction to preserve unrelated changes
13
+ - 保留无关变更的指令
14
14
 
15
15
  ## One-Shot Helper
16
16
 
@@ -22,4 +22,4 @@ loop-agent cursor-prompt \
22
22
  "<bounded task prompt>"
23
23
  ```
24
24
 
25
- After Cursor returns, the main session must inspect the diff and run the relevant verification commands.
25
+ Cursor 返回后,主会话必须检查 diff 并运行相关验证命令。
@@ -1,3 +1,3 @@
1
- # Decisions
1
+ # 决策
2
2
 
3
- Use this directory for architecture decision records.
3
+ 本目录存放架构决策记录(ADR)。
@@ -1,36 +1,36 @@
1
- # Design Notes
1
+ # 设计笔记
2
2
 
3
- `docs/design/` contains planning notes for using `loop-agent` as the repo-local runtime inside a larger product-line agent platform. These documents are design inputs, not proof that the capability already exists in `src/`.
3
+ `docs/design/` 存放将 `loop-agent` 作为更大产品线 agent 平台内仓库本地 runtime 的规划笔记。这些是设计输入,不是 `src/` 已具备该能力的证明。
4
4
 
5
- ## Documents
5
+ ## 文档
6
6
 
7
- | Document | Purpose |
7
+ | 文档 | 用途 |
8
8
  |---|---|
9
- | `产品线共享知识库.md` | Product-line docs repository as the upstream source of truth |
10
- | `研发模式.md` | 10-working-day Feature team workflow |
11
- | `1个月规划.md` | First-month landing plan |
12
- | `1月wbs.md` | First-month WBS and ownership |
13
- | `六个月规划.md` | Six-month roadmap and target architecture |
14
- | `taskspec-to-loop-agent-mapping.md` | Contract for adapting product-line TaskSpec into `loop-agent` tasks |
15
- | `state-and-failure-taxonomy.md` | Canonical status and failure taxonomy across docs, Task Pool, DAG, and Loop |
9
+ | `产品线共享知识库.md` | 产品线文档仓库作为上游事实源 |
10
+ | `研发模式.md` | 10 个工作日 Feature 团队工作流 |
11
+ | `1个月规划.md` | 首月落地计划 |
12
+ | `1月wbs.md` | 首月 WBS 与分工 |
13
+ | `六个月规划.md` | 六个月路线图与目标架构 |
14
+ | `taskspec-to-loop-agent-mapping.md` | 将产品线 TaskSpec 适配为 `loop-agent` task 的契约 |
15
+ | `state-and-failure-taxonomy.md` | 文档、Task Pool、DAG、Loop 共用的 canonical status failure taxonomy |
16
16
 
17
- ## Current Implementation Boundary
17
+ ## 当前实现边界
18
18
 
19
- `loop-agent` currently owns a repo-local harness, Agent DAG generation/validation/execution, shell verification, artifacts, reports, and Loop state. It is not the product-line Task Pool, Orchestrator, docs-sync service, Git/CI platform, or artifact store.
19
+ `loop-agent` 当前拥有:仓库本地 harnessAgent DAG 生成/验证/执行、shell 验证、artifactsreportsLoop state。它不是产品线 Task PoolOrchestratordocs-sync 服务、Git/CI 平台或 artifact store
20
20
 
21
- The design documents use two kinds of profile names:
21
+ 设计文档使用两类 profile 名称:
22
22
 
23
- - Business task profiles: `backend-feature`, `frontend-feature`, `qa-casegen`, `qa-testcode`, `reviewer-gate`.
24
- - `loop-agent dag run-task --profile` governance profiles: `auto`, `minimal`, `standard`, `reviewed`, `supervised`.
23
+ - **Business task profiles**:`backend-feature`、`frontend-feature`、`qa-casegen`、`qa-testcode`、`reviewer-gate`
24
+ - **`loop-agent dag run-task --profile` governance profiles**:`auto`、`minimal`、`standard`、`reviewed`、`supervised`
25
25
 
26
- Do not pass business task profiles directly to `loop-agent dag run-task --profile` unless the CLI is explicitly extended to support them. Use `taskspec-to-loop-agent-mapping.md` to route business profiles to current governance profiles.
26
+ 除非 CLI 显式扩展支持,否则不要把 business task profile 直接传给 `loop-agent dag run-task --profile`。用 `taskspec-to-loop-agent-mapping.md` business profile 路由到当前 governance profile。
27
27
 
28
- ## Maintenance Rules
28
+ ## 维护规则
29
29
 
30
- When these design notes change:
30
+ 设计笔记变更时:
31
31
 
32
- 1. Keep TaskSpec fields, status names, failure categories, and command examples consistent with the contract docs.
33
- 2. Mark future platform components as target architecture unless they exist in `src/` or `scripts/`.
34
- 3. Update `taskspec-to-loop-agent-mapping.md` whenever `src/task/config-types.ts` or DAG profile routing changes.
35
- 4. Update `state-and-failure-taxonomy.md` whenever DAG report categories, Loop failure classes, or Task Pool states change.
36
- 5. Run `bash scripts/check-repo.sh`.
32
+ 1. 保持 TaskSpec 字段、status 名称、failure category 与命令示例与契约文档一致
33
+ 2. 未来平台组件标为目标架构,除非已存在于 `src/` `scripts/`
34
+ 3. `src/task/config-types.ts` DAG profile routing 变更时更新 `taskspec-to-loop-agent-mapping.md`
35
+ 4. DAG report category、Loop failure class Task Pool state 变更时更新 `state-and-failure-taxonomy.md`
36
+ 5. 运行 `bash scripts/check-repo.sh`
@@ -1,71 +1,71 @@
1
- # Development Principles
1
+ # 开发原则
2
2
 
3
- loop-agent is a workflow runtime for agentic coding work. The repository should stay small, explicit, and verifiable.
3
+ loop-agent 是面向 agentic coding 的工作流 runtime。仓库应保持小而显式、可验证。
4
4
 
5
- ## Operating Stance
5
+ ## 操作立场
6
6
 
7
- The project uses a human-led, agent-executed engineering model. Agents may implement, verify, and summarize, but durable intent and completion evidence must live in the repository.
7
+ 项目采用「人类掌舵、智能体执行」的工程模型。Agent 可实现、验证与总结,但持久意图与完成证据必须落在仓库中。
8
8
 
9
- - The repository is the record system. Decisions, contracts, plans, tests, reports, and handoffs belong in tracked files.
10
- - `AGENTS.md` is an operating map, not a knowledge dump. Long-lived methodology and decisions belong under `docs/`.
11
- - Work advances in small, reversible, verifiable increments.
12
- - Baseline verification comes before new work when the current state is uncertain.
13
- - Completion is defined by fresh evidence, not by intent or confidence.
9
+ - 仓库是记录系统。决策、契约、计划、测试、报告与交接属于 tracked files
10
+ - `AGENTS.md` 是操作地图,不是知识 dump。长期方法论与决策属于 `docs/`。
11
+ - 工作以小步、可逆、可验证的增量推进。
12
+ - 状态不确定时,先跑基线验证再开新工。
13
+ - 完成由新鲜证据定义,而非意图或信心。
14
14
 
15
- ## Principles
15
+ ## 原则
16
16
 
17
- 1. One task advances one bounded work block.
18
- 2. Search existing code, docs, scripts, and tests before designing new behavior.
19
- 3. Shell verification is the completion authority.
20
- 4. Runtime state belongs in `.harness/`; durable decisions belong in `docs/`.
21
- 5. Pi writer nodes and optional Cursor write execution must be bounded by explicit allowed and forbidden paths.
22
- 6. Pi review/planning paths are advisory unless followed by deterministic verification.
23
- 7. Repeated constraints should become docs, tests, scripts, checks, or templates.
24
- 8. Do not keep hidden process state only in chat.
25
- 9. Do not add placeholders as completed implementation.
26
- 10. Prefer existing local patterns before adding new abstractions.
17
+ 1. 一次任务只推进一个有边界的工作块。
18
+ 2. 设计新行为前先搜索现有代码、文档、脚本与测试。
19
+ 3. Shell 验证是完成权威。
20
+ 4. Runtime 状态在 `.harness/`;持久决策在 `docs/`。
21
+ 5. Pi writer 节点与可选 Cursor 写执行必须由显式 allowed/forbidden paths 约束。
22
+ 6. Pi review/planning 路径是 advisory,除非后跟确定性验证。
23
+ 7. 反复出现的约束应固化为文档、测试、脚本、检查或模板。
24
+ 8. 不要把隐藏流程状态只留在聊天里。
25
+ 9. 不要把占位实现当作已完成交付。
26
+ 10. 新增抽象前先沿用现有局部模式。
27
27
 
28
- ## Repository Shape
28
+ ## 仓库结构
29
29
 
30
- - Source lives in `src/`.
31
- - Tests live in `test/`.
32
- - Skill instructions live in `skills/`.
33
- - Verification and maintenance scripts live in `scripts/`.
34
- - Governance and handoff artifacts live in `docs/`.
30
+ - 源码:`src/`
31
+ - 测试:`test/`
32
+ - Skill 指令:`skills/`
33
+ - 验证与维护脚本:`scripts/`
34
+ - 治理与交接产物:`docs/`
35
35
 
36
- ## Change Discipline
36
+ ## 变更纪律
37
37
 
38
- For behavior changes, update tests. For workflow or command changes, update docs and examples. For governance changes, update `harness.json` and the relevant check scripts.
38
+ 行为变更要更新测试;工作流或命令变更要更新文档与示例;治理变更要更新 `harness.json` 与相关检查脚本。
39
39
 
40
- When work affects requirements, behavior, cross-command contracts, or harness rules, update the corresponding durable artifact:
40
+ 当工作影响需求、行为、跨命令契约或 harness 规则时,更新对应持久产物:
41
41
 
42
- - design or contract docs for changed expectations
43
- - tests or verification scripts for changed behavior
44
- - progress logs or reports for non-trivial handoff evidence
45
- - ADRs for architecture or public contract decisions
46
- - templates when a repeated process becomes reusable
42
+ - 设计/契约文档 变更后的预期
43
+ - 测试或验证脚本 变更后的行为
44
+ - progress log report 非平凡交接证据
45
+ - ADR 架构或公开契约决策
46
+ - 模板 重复流程可复用时
47
47
 
48
- Do not mix unrelated refactors, new features, and broad documentation migration in one work block unless the contract explicitly says why they must move together.
48
+ 除非 contract 明确说明必须一起移动,否则不要在一个工作块里混合无关重构、新功能与大规模文档迁移。
49
49
 
50
- ## Search And Reuse
50
+ ## 搜索与复用
51
51
 
52
- Before implementing, inspect the existing system:
52
+ 实现前先检视现有系统:
53
53
 
54
- - Use CodeGraph first when the repository is indexed and the task needs code understanding.
55
- - Use `rg` for text search and `fd` for file discovery when available.
56
- - Read nearby tests and helpers before introducing new helpers.
57
- - Prefer structured parsers and existing local APIs over ad hoc string manipulation.
54
+ - 仓库已索引且任务需要理解代码时,优先用 CodeGraph
55
+ - 可用时用 `rg` 做文本搜索、`fd` 找文件。
56
+ - 引入新 helper 前先读邻近测试与 helper。
57
+ - 优先结构化 parser 与现有本地 API,避免 ad hoc 字符串处理。
58
58
 
59
- Assume the system may already contain a partial solution until search proves otherwise.
59
+ 在搜索证明否则之前,假设系统可能已有部分解法。
60
60
 
61
- ## Completion Discipline
61
+ ## 完成纪律
62
62
 
63
- A completion claim must answer:
63
+ 完成声明必须回答:
64
64
 
65
- - what changed
66
- - why this approach was chosen
67
- - which command verified it and what the result was
68
- - whether contracts, docs, tests, or scripts were affected
69
- - what risk or follow-up remains
65
+ - 改了什么
66
+ - 为何选此方案
67
+ - 哪条命令验证、结果如何
68
+ - 是否影响契约、文档、测试或脚本
69
+ - 剩余风险或后续项
70
70
 
71
- If verification fails, report the failing command and observed state instead of softening the completion definition.
71
+ 验证失败时,报告失败命令与观察到的状态,而不是软化完成定义。
@@ -147,11 +147,11 @@ LLM / profile 生成 WorkflowSpec JSON
147
147
 
148
148
  本次复核依据的关键代码与文档:
149
149
 
150
- - `docs/feature-workflow.md`
151
- - 源码仓库历史 completed execution plan: remove-level1-fallback
152
- - `src/workflows/dag/types.ts`
153
- - `src/workflows/dag/validate.ts`
154
- - `src/workflows/dag/runner.ts`
150
+ - `docs/feature-workflow.md`
151
+ - 源码仓库历史 completed execution plan: remove-level1-fallback
152
+ - `src/workflows/dag/types.ts`
153
+ - `src/workflows/dag/validate.ts`
154
+ - `src/workflows/dag/runner.ts`
155
155
  - `src/workflows/dag/lifecycle.ts`
156
156
  - `src/workflows/dag/report.ts`
157
157
  - `src/workflows/dag/init-hybrid.ts`
@@ -1744,6 +1744,6 @@ https://code.claude.com/docs/en/workflows
1744
1744
 
1745
1745
  [3] 用户上传文档:`2026-07-02-repository-analysis.md`,关于当前 `loop-agent` 仓库结构、DAG 主路径、Loop 语义、治理边界与健康度的分析报告。
1746
1746
 
1747
- [4] 当前源码仓库历史 completed execution plan,关于删除 Level 1 fallback、抽取 shell verification、建立 DAG-oriented task read model 的完成记录;发布包只携带 execution plan 目录说明,不携带具体历史计划正文。
1747
+ [4] 当前源码仓库历史 completed execution plan,关于删除 Level 1 fallback、抽取 shell verification、建立 DAG-oriented task read model 的完成记录;发布包只携带 execution plan 目录说明,不携带具体历史计划正文。
1748
1748
 
1749
1749
  [5] 当前源码复核:`src/workflows/dag/types.ts`、`src/workflows/dag/validate.ts`、`src/workflows/dag/runner.ts`、`src/workflows/loop/actions.ts`、`src/task/read-model.ts`、`src/cli/catalog.ts`。
@@ -1,6 +1,6 @@
1
- # Execution Plans
1
+ # 执行计划
2
2
 
3
- - `active/README.md` lists currently active plans.
4
- - `completed/README.md` lists completed plans.
3
+ - `active/README.md` 当前进行中的计划
4
+ - `completed/README.md` 已完成的计划
5
5
 
6
- Use an execution plan for changes that affect multiple files, public command behavior, or repository governance.
6
+ 影响多文件、公开命令行为或仓库治理的变更应使用 execution plan
@@ -1,9 +1,10 @@
1
- # Active Execution Plans
2
-
3
- Use this directory for execution plans that are currently in progress.
4
-
5
- Source repositories may keep concrete active plan files next to this README. The npm package carries this README as a directory contract and does not copy loop-agent source-history active plans; target repositories generate their own active plans.
6
-
7
- Current active plans:
8
-
9
- - [2026-07-04-dag-role-skill-alignment.md](2026-07-04-dag-role-skill-alignment.md)
1
+ # 进行中的执行计划
2
+
3
+ 本目录存放当前进行中的 execution plan。
4
+
5
+ 源码仓库可在本 README 旁保留具体 active plan 文件。npm 包只携带本 README 作为目录契约,不复制 loop-agent 源码历史的 active plan;目标仓库自行生成 active plan。
6
+
7
+ 当前 active plan:
8
+
9
+ - [2026-07-04-dag-role-skill-alignment.md](2026-07-04-dag-role-skill-alignment.md)
10
+ - [2026-07-06-production-readiness-hardening.md](2026-07-06-production-readiness-hardening.md)
@@ -1,9 +1,9 @@
1
- # Completed Execution Plans
1
+ # 已完成的执行计划
2
2
 
3
- Completed plans are moved here after their implementation and verification finish.
4
-
5
- The npm package carries this README as a directory contract. Concrete completed plans are target-repository history and are not copied from loop-agent's source history.
6
-
7
- - [`2026-07-02-loop-agent-subject-restructure.md`](2026-07-02-loop-agent-subject-restructure.md) — promoted the former `tools/code-agent` runtime to the repository root, renamed it to `loop-agent`, and removed the old memory plugin product lines.
8
- - [`2026-07-04-remove-level1-fallback.md`](2026-07-04-remove-level1-fallback.md) — removed the historical sequential Level 1 fallback and converged the runtime, docs, and command surface on DAG execution.
9
- - [`2026-07-04-runtime-boundary-remediation.md`](2026-07-04-runtime-boundary-remediation.md) — consolidated CLI/skill/runtime boundaries, extracted DAG/Loop runtime seams, and centralized harness store/guard policy.
3
+ 实现与验证结束后,已完成计划移入此目录。
4
+
5
+ npm 包携带本 README 作为目录契约。具体 completed plan 属于目标仓库历史,不从 loop-agent 源码历史复制。
6
+
7
+ - [`2026-07-02-loop-agent-subject-restructure.md`](2026-07-02-loop-agent-subject-restructure.md) — 将原 `tools/code-agent` runtime 提升到仓库根、重命名为 `loop-agent`,移除旧 memory plugin 产品线
8
+ - [`2026-07-04-remove-level1-fallback.md`](2026-07-04-remove-level1-fallback.md) — 移除历史顺序 Level 1 fallbackruntime、文档与 command surface 收敛到 DAG 执行
9
+ - [`2026-07-04-runtime-boundary-remediation.md`](2026-07-04-runtime-boundary-remediation.md) — 整合 CLI/skill/runtime 边界,抽出 DAG/Loop runtime seam,集中 harness store/guard 策略
@@ -1,117 +1,117 @@
1
- # Feature Workflow
1
+ # 功能工作流
2
2
 
3
- This document separates two layers:
3
+ 本文档区分两层:
4
4
 
5
- - Session governance: how the supervising human/agent should structure a work session.
6
- - Runtime workflows: what the code actually executes under `src/workflows/`.
5
+ - **Session governance**:监督方(人/agent)如何组织一次工作会话
6
+ - **Runtime workflows**:`src/workflows/` 下代码实际执行的内容
7
7
 
8
- ## Default Session Protocol
8
+ ## 默认会话协议
9
9
 
10
- 1. Orient: read `README.md`, `harness.json`, and this docs index.
11
- 2. Select: choose one bounded work block.
12
- 3. Contract: state deliverables, non-goals, completion criteria, verification commands, and failure conditions.
13
- 4. Implement: make the smallest coherent change and update required docs, scripts, and tests.
14
- 5. Verify: run commands from `verification-matrix.md`; use fresh output for any completion claim.
15
- 6. Handoff: record evidence in `docs/progress/`, `docs/reports/`, an exec plan, or an ADR when useful.
10
+ 1. **Orient**:读 `README.md`、`harness.json` 与本 docs 索引
11
+ 2. **Select**:选一个有限边界的工作块
12
+ 3. **Contract**:写明交付物、非目标、完成标准、验证命令、失败条件
13
+ 4. **Implement**:做最小连贯变更,同步更新必要文档、脚本与测试
14
+ 5. **Verify**:按 `verification-matrix.md` 跑命令;完成声明用新鲜输出
15
+ 6. **Handoff**:在 `docs/progress/`、`docs/reports/`、exec plan ADR 中记录证据
16
16
 
17
17
  ## Orient
18
18
 
19
- Start by understanding the current system rather than assuming absence:
19
+ 先理解当前系统,不要默认「没有」:
20
20
 
21
- - read the repository entrypoints listed in `harness.json`
22
- - check `git status --short --branch` and recent commits
23
- - search existing source, tests, scripts, docs, and templates before adding new structure
24
- - run the smallest baseline check if the task depends on a healthy baseline
25
- - read methodology docs when the task involves TDD, verification claims, or debugging
21
+ - `harness.json` 列出的仓库入口
22
+ - `git status --short --branch` 与最近提交
23
+ - 新增结构前搜索现有源码、测试、脚本、文档与模板
24
+ - 任务依赖健康基线时跑最小基线检查
25
+ - 涉及 TDD、完成声明或调试时读方法论文档
26
26
 
27
- If the baseline is already broken, record the failing command and decide whether the current work block is to repair the baseline or to proceed with a clearly scoped known failure.
27
+ 基线已坏时,记录失败命令,并决定当前块是修基线还是在明确范围内接受已知失败。
28
28
 
29
29
  ## Select
30
30
 
31
- Keep a work block narrow enough to verify. Avoid combining unrelated refactors, features, and documentation migrations.
31
+ 工作块要窄到可验证。避免无关重构、功能与文档迁移混在一起。
32
32
 
33
- A selected block should have:
33
+ 选中的块应有:
34
34
 
35
- - a single user-visible or maintainer-visible outcome
36
- - explicit allowed paths when delegating write work
37
- - known non-goals
38
- - a verification command that can prove the result
35
+ - 单一用户可见或维护者可见结果
36
+ - 委托写工作时显式 allowed paths
37
+ - 已知非目标
38
+ - 能证明结果的验证命令
39
39
 
40
40
  ## Contract
41
41
 
42
- For non-trivial work, write or update an execution plan, sprint contract, progress log, or issue-sized note before implementation. The contract should state:
42
+ 非平凡工作应在实现前写或更新 execution plansprint contractprogress log issue 级笔记。Contract 应包含:
43
43
 
44
- - deliverables
45
- - non-goals
46
- - acceptance criteria
47
- - verification commands
48
- - failure conditions
49
- - expected artifacts to update
44
+ - 交付物
45
+ - 非目标
46
+ - 验收标准
47
+ - 验证命令
48
+ - 失败条件
49
+ - 预期更新的 artifacts
50
50
 
51
- For bug fixes, the contract should include the reproduction path and the regression test or smoke check that proves the fix.
51
+ Bug 修复的 contract 应含复现路径,以及证明修复的回归测试或 smoke check
52
52
 
53
53
  ## Implement
54
54
 
55
- Make the smallest coherent change that satisfies the contract.
55
+ 做满足 contract 的最小连贯变更。
56
56
 
57
- - Prefer existing helpers and directory boundaries.
58
- - Update tests for behavior changes.
59
- - Update docs and examples for workflow or command changes.
60
- - Update `harness.json`, check scripts, or templates for governance changes.
61
- - Do not submit placeholder implementations as completed work.
62
- - When a repeated constraint appears, promote it into a durable artifact.
57
+ - 优先现有 helper 与目录边界
58
+ - 行为变更更新测试
59
+ - 工作流或命令变更更新文档与示例
60
+ - 治理变更更新 `harness.json`、检查脚本或模板
61
+ - 不把占位实现当作已完成
62
+ - 重复约束出现时固化为持久产物
63
63
 
64
64
  ## Verify
65
65
 
66
- Verification is the completion authority.
66
+ 验证是完成权威。
67
67
 
68
- - Use `docs/verification-matrix.md` to choose the narrowest proving command.
69
- - Run the full command fresh.
70
- - Read the exit code and output.
71
- - Fix failures or report the exact failing state.
72
- - Do not claim completion from stale output or partial checks.
68
+ - `docs/verification-matrix.md` 选最窄的证明命令
69
+ - 完整重跑命令
70
+ - exit code 与输出
71
+ - 修失败或报告确切失败状态
72
+ - 不用陈旧输出或部分检查声明完成
73
73
 
74
74
  ## Agent DAG First
75
75
 
76
- For complex implementation work, prefer the DAG workflow:
77
-
78
- ```bash
79
- loop-agent new-task <task-id> "Task title"
80
- loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
81
- loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
82
- loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
83
- ```
84
-
85
- `<temp-dir>` means the platform-native temp directory. Use native paths for actual file operations on macOS and Windows; use `/` only for stable repo refs, JSON/Markdown evidence refs, and glob conventions.
86
-
87
- This is not a linear OS-CIVH runtime state machine. In code, DAG has three command phases:
88
-
89
- 1. `dag run-task` loads `.harness/tasks/<task-id>/source/需求.md`, optional `执行约束.md`, `task.json`, and adapter verification commands, then writes a DAG spec.
90
- 2. `dag validate` validates schema, dependencies, governance profile, write boundaries, model routing, and shell verification metadata.
91
- 3. `run-dag` loads the DAG, topologically sorts tasks into ranks, executes runnable nodes with bounded concurrency, persists `.harness/dag-runs/<lifecycle>/<run-id>/`, and transfers the run to `completed` or `paused`.
92
-
93
- The standard generated hybrid DAG defaults to no-Cursor execution:
94
-
95
- ```text
96
- contract-pi
97
- -> scout-src + scout-tests
98
- -> plan-pi
99
- -> implement-pi
100
- -> verify-pi
101
- -> closeout-pi
102
- ```
103
-
104
- `implement-pi` uses `executor: "pi"` with `toolProfile: "write"`. When `harness.json` explicitly disables Pi and enables Cursor, the implementation and repair writer nodes use `implement-cursor` / `repair-cursor` instead.
105
-
106
- The review-gated template inserts:
76
+ 复杂实现优先 DAG 工作流:
77
+
78
+ ```bash
79
+ loop-agent new-task <task-id> "Task title"
80
+ loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
81
+ loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
82
+ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
83
+ ```
84
+
85
+ `<temp-dir>` 为平台原生临时目录。macOS/Windows 上实际文件操作用原生路径;`/` 仅用于稳定 repo 引用、JSON/Markdown 证据引用和 glob 约定。
86
+
87
+ 这不是线性 OS-CIVH runtime 状态机。代码里 DAG 有三个命令阶段:
88
+
89
+ 1. `dag run-task` 加载 `.harness/tasks/<task-id>/source/需求.md`、可选 `执行约束.md`、`task.json` adapter 验证命令,写出 DAG spec
90
+ 2. `dag validate` 校验 schema、依赖、governance profile、写边界、model routingshell 验证元数据
91
+ 3. `run-dag` 加载 DAG、按拓扑排序为 ranks、有界并发执行可运行节点、持久化到 `.harness/dag-runs/<lifecycle>/<run-id>/`,并转入 `completed` `paused`
92
+
93
+ 标准生成的 hybrid DAG 默认无 Cursor
94
+
95
+ ```text
96
+ contract-pi
97
+ -> scout-src + scout-tests
98
+ -> plan-pi
99
+ -> implement-pi
100
+ -> verify-pi
101
+ -> closeout-pi
102
+ ```
103
+
104
+ `implement-pi` 使用 `executor: "pi"` `toolProfile: "write"`。当 `harness.json` 显式禁用 Pi 并启用 Cursor 时,实现与修复 writer 节点改用 `implement-cursor` / `repair-cursor`。
105
+
106
+ review-gated 模板插入:
107
107
 
108
108
  ```text
109
109
  verify-pi -> review-pi -> review-gate-shell -> closeout-pi
110
110
  ```
111
111
 
112
- The supervised template adds write-set audit, soft/hard shell verification, process supervision, bounded repair, decision gates, and optional convergence retry passes around the implementation path.
112
+ supervised 模板在实现路径上增加 write-set auditsoft/hard shell 验证、process supervision、有界 repairdecision gates 与可选 convergence retry
113
113
 
114
- Source references:
114
+ 源码参考:
115
115
 
116
116
  - `src/commands/dag-run-task.ts`
117
117
  - `src/commands/dag-validate.ts`
@@ -119,34 +119,36 @@ Source references:
119
119
  - `src/workflows/dag/init-hybrid.ts`
120
120
  - `src/workflows/dag/runner.ts`
121
121
 
122
- The supervising agent remains responsible for:
122
+ 监督 agent 仍负责:
123
+
124
+ - 写 contract
125
+ - 限定 allowed/forbidden paths
126
+ - 审查 DAG/writeSet 范围
127
+ - 选择验证命令
128
+ - 记录 handoff 证据
123
129
 
124
- - writing the contract
125
- - bounding allowed and forbidden paths
126
- - reviewing DAG/writeSet scope
127
- - selecting verification commands
128
- - recording handoff evidence
130
+ 声称 Production Readiness v0.1 的低/中风险单仓库任务,另须遵循 `docs/production-readiness.md` `docs/templates/production-readiness-checklist.md`。该标准冻结支持范围、非目标、必需 DAG 证据、failure routing 字段与最终验证门禁。
129
131
 
130
- ## Removed Sequential Workflow
132
+ ## 已移除的顺序工作流
131
133
 
132
- The historical Level 1 sequential command surface has been removed from the public workflow. Do not use `loop-agent run analyze|plan|spec|implement|verify|retrospective|auto|loop|continue|study` for new work.
134
+ 历史 Level 1 顺序 command surface 已从公开工作流移除。新工作不要用 `loop-agent run analyze|plan|spec|implement|verify|retrospective|auto|loop|continue|study`。
133
135
 
134
- Use the DAG path instead:
136
+ 改用 DAG 路径:
135
137
 
136
- ```bash
137
- loop-agent new-task <task-id> "Task title"
138
- loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
139
- loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
140
- loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
141
- ```
138
+ ```bash
139
+ loop-agent new-task <task-id> "Task title"
140
+ loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
141
+ loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
142
+ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
143
+ ```
142
144
 
143
- Legacy `.harness/tasks/<task-id>/.workflow_state.json` files may still be read for compatibility until task status is fully migrated to the DAG-oriented read model. They are not the authority for new task completion.
145
+ 遗留 `.harness/tasks/<task-id>/.workflow_state.json` task status 完全迁移到 DAG 导向读模型前仍可读,但不是新任务完成的权威。
144
146
 
145
147
  ## Outer Loop Runtime
146
148
 
147
- The `loop` command is a long-running task-control layer, not the same thing as the session governance protocol. It records rounds and signals, can run shell verification, Pi review, Cursor fixes, or DAG actions, and can choose the next automatic action.
149
+ `loop` 命令是长跑任务控制层,与会话治理协议不是一回事。它记录 rounds signals,可跑 shell 验证、Pi reviewCursor 修复或 DAG action,并选择下一自动 action
148
150
 
149
- Supported loop actions are:
151
+ 支持的 loop actions
150
152
 
151
153
  - `shell-verify`
152
154
  - `pi-review`
@@ -156,29 +158,29 @@ Supported loop actions are:
156
158
  - `add-signal`
157
159
  - `closeout`
158
160
 
159
- Source references:
161
+ 源码参考:
160
162
 
161
163
  - `src/commands/loop.ts`
162
164
  - `src/workflows/loop/actions.ts`
163
165
  - `src/workflows/loop/state.ts`
164
166
  - `src/workflows/loop/rounds.ts`
165
167
 
166
- ## Debugging And TDD
168
+ ## 调试与 TDD
167
169
 
168
- Use the methodology docs when the task demands it:
170
+ 任务需要时使用方法论文档:
169
171
 
170
- - behavior changes and bug fixes: `docs/harness-methodology-tdd.md`
171
- - completion or handoff claims: `docs/harness-methodology-verification.md`
172
- - failures and unexpected behavior: `docs/harness-methodology-debugging.md`
172
+ - 行为变更与 bug 修复:`docs/harness-methodology-tdd.md`
173
+ - 完成或 handoff 声明:`docs/harness-methodology-verification.md`
174
+ - 失败与意外行为:`docs/harness-methodology-debugging.md`
173
175
 
174
176
  ## Handoff
175
177
 
176
- A handoff should state:
178
+ Handoff 应说明:
177
179
 
178
- - what changed
179
- - what was intentionally left out
180
- - which verification commands ran
181
- - whether contracts, docs, tests, or scripts were affected
182
- - any remaining risks or follow-up work
180
+ - 改了什么
181
+ - 有意未做什么
182
+ - 跑了哪些验证命令
183
+ - 是否影响契约、文档、测试或脚本
184
+ - 剩余风险或后续工作
183
185
 
184
- For substantial work, update `docs/progress/`, `docs/reports/`, the active exec plan, or `docs/decisions/` so the next session can resume without relying on chat history.
186
+ 较大工作应更新 `docs/progress/`、`docs/reports/`、active exec plan `docs/decisions/`,以便下一会话不依赖聊天历史。