@tea-agent/loop-agent 0.1.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 (143) hide show
  1. package/AGENTS.md +62 -45
  2. package/CHANGELOG.md +60 -28
  3. package/README.md +160 -124
  4. package/bin/loop-agent.js +21 -21
  5. package/dist/adapters/index.js +3 -2
  6. package/dist/adapters/loop-agent.js +44 -2
  7. package/dist/application/dag/args.js +420 -0
  8. package/dist/application/dag/generate-task-dag.js +280 -0
  9. package/dist/application/dag/report-dag.js +14 -0
  10. package/dist/application/dag/run-dag.js +106 -0
  11. package/dist/application/dag/validate-dag.js +102 -0
  12. package/dist/application/loop/run-action.js +23 -0
  13. package/dist/cli/catalog.js +2 -237
  14. package/dist/cli/command-definitions.js +571 -0
  15. package/dist/cli/index.js +2 -0
  16. package/dist/cli/program.js +65 -1
  17. package/dist/cli/router.js +13 -0
  18. package/dist/cli-governance/active-residue-check.js +38 -0
  19. package/dist/commands/dag-report.js +6 -107
  20. package/dist/commands/dag-run-task.js +8 -466
  21. package/dist/commands/dag-validate.js +7 -179
  22. package/dist/commands/examples.js +90 -0
  23. package/dist/commands/init.js +1518 -0
  24. package/dist/commands/loop.js +57 -31
  25. package/dist/commands/pi-prompt.js +2 -9
  26. package/dist/commands/run-dag.js +7 -180
  27. package/dist/executors/cursor-executor-artifacts.js +3 -4
  28. package/dist/executors/cursor-worker-client.js +13 -3
  29. package/dist/executors/dag-cursor-executor.js +2 -3
  30. package/dist/executors/dag-pi-executor.js +3 -4
  31. package/dist/executors/dag-static-executor.js +2 -5
  32. package/dist/executors/pi-defaults.js +9 -0
  33. package/dist/executors/shell-executor.js +12 -20
  34. package/dist/governance/manifest-types.js +1 -0
  35. package/dist/infrastructure/harness/active-residue-policy.js +73 -0
  36. package/dist/infrastructure/harness/artifact-store.js +72 -0
  37. package/dist/infrastructure/harness/atomic-write.js +49 -0
  38. package/dist/infrastructure/harness/completed-facts-guard.js +40 -0
  39. package/dist/infrastructure/harness/loop-action-store.js +23 -0
  40. package/dist/infrastructure/harness/loop-store.js +41 -0
  41. package/dist/infrastructure/harness/one-shot-run-store.js +94 -0
  42. package/dist/infrastructure/harness/task-store.js +77 -0
  43. package/dist/records/one-shot-runs.js +26 -61
  44. package/dist/records/promotion.js +3 -4
  45. package/dist/shared/artifacts-core.js +5 -5
  46. package/dist/shared/logger.js +9 -15
  47. package/dist/task/delegate.js +4 -4
  48. package/dist/task/runtime.js +5 -7
  49. package/dist/task/state.js +6 -20
  50. package/dist/workflows/dag/convergence/controller.js +277 -0
  51. package/dist/workflows/dag/dynamic-runtime/condition.js +48 -0
  52. package/dist/workflows/dag/dynamic-runtime/loop-until.js +156 -0
  53. package/dist/workflows/dag/dynamic-runtime/map.js +185 -0
  54. package/dist/workflows/dag/dynamic-runtime/reduction.js +72 -0
  55. package/dist/workflows/dag/dynamic-runtime/shared.js +133 -0
  56. package/dist/workflows/dag/failure-routing.js +82 -0
  57. package/dist/workflows/dag/lifecycle.js +101 -8
  58. package/dist/workflows/dag/node-execution.js +262 -0
  59. package/dist/workflows/dag/report.js +73 -1
  60. package/dist/workflows/dag/run-store.js +36 -0
  61. package/dist/workflows/dag/runner.js +82 -1341
  62. package/dist/workflows/dag/scheduler.js +84 -0
  63. package/dist/workflows/dag/upstream-artifacts.js +20 -18
  64. package/dist/workflows/loop/actions/cursor-fix.js +191 -0
  65. package/dist/workflows/loop/actions/dag-action.js +130 -0
  66. package/dist/workflows/loop/actions/pi-review.js +267 -0
  67. package/dist/workflows/loop/actions/shared.js +157 -0
  68. package/dist/workflows/loop/actions/shell-verify.js +82 -0
  69. package/dist/workflows/loop/actions/types.js +1 -0
  70. package/dist/workflows/loop/actions/workflow-action.js +255 -0
  71. package/dist/workflows/loop/actions.js +55 -1212
  72. package/dist/workflows/loop/closeout.js +5 -4
  73. package/dist/workflows/loop/context.js +2 -3
  74. package/dist/workflows/loop/events.js +3 -2
  75. package/dist/workflows/loop/policy/auto-policy.js +104 -0
  76. package/dist/workflows/loop/policy/cursor-fix-policy.js +31 -0
  77. package/dist/workflows/loop/rounds.js +3 -3
  78. package/dist/workflows/loop/signals.js +4 -7
  79. package/dist/workflows/loop/state.js +11 -11
  80. package/docs/README.md +47 -44
  81. package/docs/agent-dag-recovery-playbook.md +32 -6
  82. package/docs/agent-dag-runner.md +17 -17
  83. package/docs/architecture/runtime-boundaries.md +147 -0
  84. package/docs/cursor-executor-usage.md +5 -5
  85. package/docs/decisions/README.md +2 -2
  86. package/docs/design/README.md +24 -24
  87. package/docs/development-principles.md +50 -50
  88. package/docs/dynamic-workflow-dag-engine-roadmap.md +6 -6
  89. package/docs/exec-plans/README.md +4 -4
  90. package/docs/exec-plans/active/README.md +10 -5
  91. package/docs/exec-plans/completed/README.md +9 -5
  92. package/docs/feature-workflow.md +111 -109
  93. package/docs/harness-methodology-verification.md +18 -18
  94. package/docs/loop-agent-harness.md +36 -36
  95. package/docs/production-readiness.md +96 -0
  96. package/docs/progress/README.md +2 -2
  97. package/docs/reports/README.md +4 -2
  98. package/docs/templates/agent-dag-decision-gate-dogfood-report.md +1 -1
  99. package/docs/templates/agent-dag-process-supervisor.prompt.md +2 -2
  100. package/docs/templates/agent-dag-report.schema.json +33 -2
  101. package/docs/templates/agent-dag-review-verdict.prompt.md +1 -1
  102. package/docs/templates/agent-dag.base.json +195 -195
  103. package/docs/templates/agent-dag.final-verification.json +190 -190
  104. package/docs/templates/agent-dag.schema.json +17 -17
  105. package/docs/templates/agent-dag.supervised-implementation.json +500 -500
  106. package/docs/templates/hybrid-dag.json +193 -193
  107. package/docs/templates/production-readiness-checklist.md +57 -0
  108. package/docs/templates/progress-log.md +7 -7
  109. package/docs/templates/project-start-checklist.md +8 -8
  110. package/docs/templates/qa-report.md +17 -11
  111. package/docs/templates/sprint-contract.md +19 -19
  112. package/docs/verification-matrix.md +37 -26
  113. package/examples/example-dag.json +51 -51
  114. package/examples/hybrid-loop-agent-dag.json +194 -194
  115. package/harness.json +5 -5
  116. package/package.json +62 -61
  117. package/skills/ai-engineering-context/SKILL.md +21 -21
  118. package/skills/loop-agent/SKILL.md +56 -171
  119. package/skills/loop-agent/references/README.md +6 -2
  120. package/skills/loop-agent/references/command-reference.md +107 -65
  121. package/skills/loop-agent/references/harness-policy.md +115 -115
  122. package/skills/loop-agent/references/hybrid-dag.md +30 -30
  123. package/skills/loop-agent/references/learned/README.md +13 -13
  124. package/skills/loop-agent/references/long-running-loop.md +59 -0
  125. package/skills/loop-agent/references/model-routing.md +1 -1
  126. package/skills/loop-agent/references/orchestrator-and-interventions.md +1 -1
  127. package/skills/loop-agent/references/pi-prompt.md +9 -9
  128. package/skills/loop-agent/references/pi-subagent-assisted-mode.md +0 -2
  129. package/skills/loop-agent/references/post-implementation-and-patterns.md +7 -7
  130. package/skills/loop-agent/references/task-workflow.md +19 -19
  131. package/skills/loop-agent/references/verification-and-failure-handling.md +54 -0
  132. package/skills/requesting-code-review/SKILL.md +40 -40
  133. package/skills/requesting-code-review/code-reviewer.md +4 -4
  134. package/skills/systematic-debugging/CREATION-LOG.md +43 -43
  135. package/skills/systematic-debugging/SKILL.md +113 -113
  136. package/skills/systematic-debugging/condition-based-waiting.md +20 -20
  137. package/skills/systematic-debugging/defense-in-depth.md +27 -27
  138. package/skills/systematic-debugging/root-cause-tracing.md +38 -38
  139. package/skills/systematic-debugging/test-academic.md +6 -6
  140. package/skills/systematic-debugging/test-pressure-1.md +6 -6
  141. package/skills/systematic-debugging/test-pressure-2.md +2 -2
  142. package/skills/systematic-debugging/test-pressure-3.md +6 -6
  143. package/skills/verification-before-completion/SKILL.md +37 -37
@@ -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/`,以便下一会话不依赖聊天历史。
@@ -1,27 +1,27 @@
1
- # Verification Methodology
1
+ # 验证方法论
2
2
 
3
- Completion claims require current evidence.
3
+ 完成声明需要当前证据。
4
4
 
5
- ## Gate Function
5
+ ## 门禁函数
6
6
 
7
- 1. Identify the command that proves the claim.
8
- 2. Run the full command.
9
- 3. Read the output and exit code.
10
- 4. Fix failures or report the exact failing state.
11
- 5. Only then claim the result.
7
+ 1. 确定能证明声明的命令
8
+ 2. 完整运行该命令
9
+ 3. 读输出与 exit code
10
+ 4. 修失败或报告确切失败状态
11
+ 5. 然后再声明结果
12
12
 
13
- ## Common Gates
13
+ ## 常见门禁
14
14
 
15
- | Claim | Command |
15
+ | 声明 | 命令 |
16
16
  |---|---|
17
- | Governance is valid | `bash scripts/check-repo.sh` |
18
- | TypeScript compiles | `npm run typecheck` |
19
- | Behavior is covered | `npm test` |
20
- | Full local delivery is valid | `bash scripts/ci.sh` |
17
+ | 治理有效 | `bash scripts/check-repo.sh` |
18
+ | TypeScript 编译通过 | `npm run typecheck` |
19
+ | 行为有覆盖 | `npm test` |
20
+ | 完整本地交付有效 | `bash scripts/ci.sh` |
21
21
 
22
22
  ## Red Flags
23
23
 
24
- - claiming completion from intent
25
- - relying on stale command output
26
- - using a narrow check for a broad claim
27
- - skipping failed command details
24
+ - 凭意图声明完成
25
+ - 依赖陈旧命令输出
26
+ - 用窄检查支撑宽声明
27
+ - 跳过失败命令的细节
@@ -1,41 +1,41 @@
1
1
  # loop-agent Harness
2
2
 
3
- loop-agent provides a local harness for structured agent work.
4
-
5
- ## Runtime Areas
6
-
7
- - `.harness/tasks/` stores task source, constraints, state, and loop facts.
8
- - `.harness/dag-runs/` stores DAG run state and artifacts.
9
- - `.harness/runs/` stores one-shot tool run evidence.
10
- - `.harness/cache/` stores local runtime cache.
11
- - `.harness/live/` stores transient live-session files.
12
-
13
- ## Skill Instructions
14
-
15
- - `skills/loop-agent/` stores loop-agent's repo-owned skill instructions and references.
16
- - `skills/<skill-name>/` stores local copies of skills referenced by DAG templates, including supervised implementation roles.
17
- - Historical `skill/` is no longer a required repository path; runtime lookup keeps it only as a compatibility fallback for `loop-agent`.
18
-
19
- ## Package Assets
20
-
21
- The npm package includes static capability assets needed to run and explain the harness: `bin/`, `dist/`, `skills/`, top-level `docs/*.md`, `docs/templates/`, `examples/`, `harness.json`, `AGENTS.md`, `README.md`, and `CHANGELOG.md`.
22
-
23
- Generated or historical task facts are not package assets. Existing files under `docs/progress/`, `docs/reports/`, `docs/exec-plans/`, and `docs/decisions/` belong to the target repository's history; the package carries only the directory README files for those areas.
24
-
25
- When `loop-agent` is installed from npm and used against another project, DAG skill instructions resolve from configured, user, or target-local skill directories when present, then fall back to the package-bundled `skills/`. A target project may add local skills, but it does not need loop-agent's source history or a copied `skills/` directory to use the default DAG workflow.
26
-
27
- ## Command Surfaces
28
-
29
- - `new-task`, `status`, `inspect`, `doctor`
30
- - `dag run-task`, `dag validate`, `run-dag`, `dag report`, `dag resume`
31
- - `delegate`, `harvest`, `promote-run`, `closeout`
32
- - `loop init`, `loop run`, `loop status`, `loop closeout`
33
- - `pi-prompt`, `cursor-prompt`
34
- - `docs audit`, `handoff check`, `spine audit`, `knowledge curate`
35
-
36
- ## Verification Preset
37
-
38
- The shell preset `loop-agent-standard-verify` runs typecheck and focused DAG tests. Full delivery should still use:
3
+ loop-agent 提供结构化 agent 工作的本地 harness
4
+
5
+ ## Runtime 区域
6
+
7
+ - `.harness/tasks/` task source、约束、stateloop facts
8
+ - `.harness/dag-runs/` DAG run state artifacts
9
+ - `.harness/runs/` one-shot tool run 证据
10
+ - `.harness/cache/` 本地 runtime 缓存
11
+ - `.harness/live/` 瞬态 live-session 文件
12
+
13
+ ## Skill 指令
14
+
15
+ - `skills/loop-agent/` loop-agent 仓库自有的 skill 指令与参考资料
16
+ - `skills/<skill-name>/` DAG 模板引用的 skill 本地副本,含 supervised implementation 角色
17
+ - 历史 `skill/` 不再是必需仓库路径;runtime 查找仅为 `loop-agent` 保留兼容 fallback
18
+
19
+ ## Package 资产
20
+
21
+ npm 包包含运行与说明 harness 所需的静态能力资产:`bin/`、`dist/`、`skills/`、顶层 `docs/*.md`、`docs/templates/`、`examples/`、`harness.json`、`AGENTS.md`、`README.md`、`CHANGELOG.md`。
22
+
23
+ 生成或历史的 task facts 不是 package 资产。`docs/progress/`、`docs/reports/`、`docs/exec-plans/`、`docs/decisions/` 下现有文件属于目标仓库历史;包只携带这些目录的 README
24
+
25
+ npm 安装 `loop-agent` 并在其他项目使用时,DAG skill 指令按配置、用户或目标本地 skill 目录解析(若存在),再回退到包内 `skills/`。目标项目可添加本地 skills,但不必复制 loop-agent 源码历史或 `skills/` 目录即可使用默认 DAG 工作流。
26
+
27
+ ## Command Surface
28
+
29
+ - `new-task`、`status`、`inspect`、`doctor`
30
+ - `dag run-task`、`dag validate`、`run-dag`、`dag report`、`dag resume`
31
+ - `delegate`、`harvest`、`promote-run`、`closeout`
32
+ - `loop init`、`loop run`、`loop status`、`loop closeout`
33
+ - `pi-prompt`、`cursor-prompt`
34
+ - `docs audit`、`handoff check`、`spine audit`、`knowledge curate`
35
+
36
+ ## 验证 Preset
37
+
38
+ Shell preset `loop-agent-standard-verify` typecheck 与聚焦 DAG 测试。完整交付仍应使用:
39
39
 
40
40
  ```bash
41
41
  bash scripts/ci.sh
@@ -0,0 +1,96 @@
1
+ # Production Readiness v0.1
2
+
3
+ 本文档冻结 2026-07-06 至 2026-07-12 hardening sprint 的单任务 production readiness 标准。
4
+
5
+ `loop-agent` production readiness v0.1 指:低/中风险的仓库本地 DAG 任务能以稳定、可解释、可验证、可恢复的方式运行。这不是组织级平台 readiness 声明。
6
+
7
+ ## 支持范围
8
+
9
+ - 单仓库
10
+ - 单任务或小范围有边界任务
11
+ - 低/中风险的代码与文档变更
12
+ - 显式 task source
13
+ - 显式 `allowedPaths`、`forbiddenPaths`、`writeSet`
14
+ - shell 验证命令
15
+ - 通过 `dag report`、`dag doctor`、`promote-run`、`closeout` 交接
16
+
17
+ ## 非目标
18
+
19
+ - 自动 merge
20
+ - 自动 release
21
+ - 生产 secrets
22
+ - 生产数据库访问
23
+ - 高风险 migration
24
+ - 在线 Worker Pool
25
+ - 多仓库 feature 编排
26
+ - 可写的 Dynamic Workflow sharded migration
27
+ - DAG runtime 之外的第二套 runner
28
+
29
+ ## 必需证据
30
+
31
+ 每个 production-ready v0.1 任务必须保留或产出以下证据:
32
+
33
+ | 证据 | 要求 |
34
+ |---|---|
35
+ | DAG spec path | 生成的 DAG JSON 路径记录在 CLI 输出、report 或 task artifacts 中 |
36
+ | DAG validation result | `dag validate --strict-models --strict-governance` 有新鲜输出 |
37
+ | Run id | `run-dag` 打印或记录 run id |
38
+ | Shell verification output | 完成声明引用新鲜命令输出,而非 model 自报 |
39
+ | Failure category | 失败 run 在可用时具备 raw、normalized、product-line 与 recommended follow-up 字段 |
40
+ | Closeout 或 failure handoff | 成功 run 可 promote 并 closeout;失败 run 产出 failure handoff 证据而非成功 closeout |
41
+
42
+ ## 必需命令
43
+
44
+ 标准任务路径:
45
+
46
+ ```bash
47
+ loop-agent new-task <task-id> "Task title"
48
+ loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
49
+ loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
50
+ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
51
+ loop-agent dag report --run-id <run-id> --markdown
52
+ loop-agent dag doctor --run-id <run-id>
53
+ loop-agent promote-run <task-id> --run-id <run-id>
54
+ loop-agent closeout task <task-id>
55
+ ```
56
+
57
+ `<temp-dir>` 使用平台原生临时目录。
58
+
59
+ ## 必需标准
60
+
61
+ | ID | 标准 | 验收 |
62
+ |---|---|---|
63
+ | PRD-01 | 新任务仅推荐 DAG 路径 | README、docs、website、skills 不把已移除的 Level 1 顺序命令当作 fallback |
64
+ | PRD-02 | 写任务有显式边界 | strict DAG governance 在需要时拒绝缺失 `allowedPaths`、`forbiddenPaths` 或 `writeSet` |
65
+ | PRD-03 | 每次 DAG run 有可读 report | `loop-agent dag report --latest --markdown` 显示 status、failure summary 与 next step |
66
+ | PRD-04 | 失败 run 可诊断 | `loop-agent dag doctor` 报告 category 与 recommended follow-up |
67
+ | PRD-05 | Shell 验证是完成权威 | closeout 不接受 model 自报替代新鲜命令输出 |
68
+ | PRD-06 | Failure category 覆盖失败 fixture | validation、write guard、shell、timeout、auth、unknown fixture 均有映射 |
69
+ | PRD-07 | 已完成 DAG facts 不可变 | completed facts guard 仍由测试覆盖 |
70
+ | PRD-08 | CLI 主路径输出指引下一步 | `dag run-task`、`dag validate`、`run-dag`、`dag report` 打印 operator next commands |
71
+ | PRD-09 | 文档面一致 | doc 更新后 `bash scripts/check-repo.sh` 与 `npm run docs:build` 通过 |
72
+ | PRD-10 | sprint 完成前完整本地门禁通过 | 最终 hardening closeout 时 `bash scripts/ci.sh` 通过 |
73
+
74
+ ## Failure Routing
75
+
76
+ Failure category 是路由字段,不是主任务状态。保留 raw DAG facts,仅在 report、doctor 输出、closeout draft、task artifacts 或后续 Task Pool 记录中追加派生字段。
77
+
78
+ 四层结构:
79
+
80
+ ```text
81
+ raw_failure_category
82
+ dag_normalized_failure_category
83
+ product_line_failure_category
84
+ recommended_follow_up
85
+ ```
86
+
87
+ Product-line category 事实源:`docs/design/state-and-failure-taxonomy.md`。
88
+
89
+ ## Sprint Gate
90
+
91
+ 2026-07-06 sprint 仅在 active execution plan 记录以下内容时视为完成:
92
+
93
+ - M1–M4 最终状态
94
+ - 必需验证门禁的命令输出
95
+ - 成功、write-guard、shell-failure 场景的 dogfood 证据
96
+ - 剩余风险与后续工作
@@ -1,3 +1,3 @@
1
- # Progress Logs
1
+ # 进度日志
2
2
 
3
- Use this directory for concise handoff logs that should survive chat context.
3
+ 本目录存放应超越聊天上下文的简洁 handoff 日志。
@@ -1,3 +1,5 @@
1
- # Reports
1
+ # 报告
2
2
 
3
- Use this directory for verification, audit, benchmark, and closeout reports.
3
+ 本目录存放验证、审计、benchmark closeout 报告。
4
+
5
+ - [`2026-07-12-production-readiness-hardening.md`](2026-07-12-production-readiness-hardening.md)
@@ -8,7 +8,7 @@
8
8
  |---|---|
9
9
  | Date | YYYY-MM-DD |
10
10
  | Topic | |
11
- | DAG input | `<temp-dir>/<topic>-decision-gate-dag.json` |
11
+ | DAG input | `<temp-dir>/<topic>-decision-gate-dag.json` |
12
12
  | Run ID | |
13
13
  | Run facts | `.harness/dag-runs/completed/<run-id>/` |
14
14
  | Gate type | `acceptance-gate` |
@@ -11,7 +11,7 @@ Do **not** create `executor: supervisor`. Supervisor is a **role** on `executor:
11
11
  ```json
12
12
  {
13
13
  "id": "process-supervisor-pi",
14
- "depends_on": ["soft-verify-shell", "implement-pi"],
14
+ "depends_on": ["soft-verify-shell", "implement-pi"],
15
15
  "complexity": "HIGH",
16
16
  "executor": "pi",
17
17
  "role": "supervisor",
@@ -80,7 +80,7 @@ Rules:
80
80
 
81
81
  - `verdict` must match the first line.
82
82
  - `failureClass` must be one of `syntax`, `runtime`, `logic`, `boundary`, `environment`, `governance`, `unknown`.
83
- - For `request-revision`, `fixScope` must name the smallest repair paths/components and stay inside the downstream `repair-pi` writeSet/allowedPaths.
83
+ - For `request-revision`, `fixScope` must name the smallest repair paths/components and stay inside the downstream `repair-pi` writeSet/allowedPaths.
84
84
  - For `pass`, `fixScope` must be an empty array.
85
85
  - `invariant` must state the behavior or contract the repair must preserve.
86
86
  - `evidenceRefs` must name node ids or relative artifact paths consulted.
@@ -58,6 +58,21 @@
58
58
  "commandHint": { "type": "string" }
59
59
  }
60
60
  },
61
+ "dagProductLineFailureCategory": {
62
+ "type": "string",
63
+ "enum": [
64
+ "SpecUnclear",
65
+ "ContractMismatch",
66
+ "ProductBug",
67
+ "TestBug",
68
+ "EnvFailure",
69
+ "FlakyTest",
70
+ "RiskyChange",
71
+ "DependencyFailure",
72
+ "NeedsHuman",
73
+ "Unknown"
74
+ ]
75
+ },
61
76
  "dagReportPrimaryFailure": {
62
77
  "type": "object",
63
78
  "additionalProperties": false,
@@ -87,7 +102,11 @@
87
102
  "skipped",
88
103
  "unknown"
89
104
  ]
90
- }
105
+ },
106
+ "productLineFailureCategory": {
107
+ "$ref": "#/$defs/dagProductLineFailureCategory"
108
+ },
109
+ "recommendedFollowUp": { "type": "string" }
91
110
  }
92
111
  },
93
112
  "dagReportPrimaryRecovery": {
@@ -117,7 +136,11 @@
117
136
  "skipped",
118
137
  "unknown"
119
138
  ]
120
- }
139
+ },
140
+ "productLineFailureCategory": {
141
+ "$ref": "#/$defs/dagProductLineFailureCategory"
142
+ },
143
+ "recommendedFollowUp": { "type": "string" }
121
144
  }
122
145
  },
123
146
  "dagNodeDecisionEnvelope": {
@@ -333,6 +356,10 @@
333
356
  "unknown"
334
357
  ]
335
358
  },
359
+ "productLineFailureCategory": {
360
+ "$ref": "#/$defs/dagProductLineFailureCategory"
361
+ },
362
+ "recommendedFollowUp": { "type": "string" },
336
363
  "recoveryRecommendation": {
337
364
  "$ref": "#/$defs/dagRecoveryRecommendation"
338
365
  },
@@ -400,6 +427,10 @@
400
427
  "unknown"
401
428
  ]
402
429
  },
430
+ "productLineFailureCategory": {
431
+ "$ref": "#/$defs/dagProductLineFailureCategory"
432
+ },
433
+ "recommendedFollowUp": { "type": "string" },
403
434
  "recoveryRecommendation": {
404
435
  "$ref": "#/$defs/dagRecoveryRecommendation"
405
436
  },
@@ -9,7 +9,7 @@ Use this prompt for a read-only **review verdict** node after hard verification:
9
9
  ```json
10
10
  {
11
11
  "id": "review-pi",
12
- "depends_on": ["hard-verify-shell", "repair-pi"],
12
+ "depends_on": ["hard-verify-shell", "repair-pi"],
13
13
  "complexity": "HIGH",
14
14
  "executor": "pi",
15
15
  "role": "reviewer",