@tea-agent/loop-agent 0.3.0 → 0.4.0

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 (119) hide show
  1. package/AGENTS.md +135 -133
  2. package/CHANGELOG.md +88 -63
  3. package/README.md +171 -168
  4. package/bin/agent-worker.js +22 -0
  5. package/bin/loop-agent.js +21 -21
  6. package/dist/commands/init.js +457 -457
  7. package/dist/commands/loop-benchmark.js +11 -11
  8. package/dist/commands/pi-reuse-benchmark.js +16 -16
  9. package/dist/executors/cursor-executor.js +1 -1
  10. package/dist/executors/dag-pi-executor.js +8 -1
  11. package/dist/task/runtime.js +27 -27
  12. package/dist/worker/cli.js +119 -0
  13. package/dist/worker/loop-agent/command-result.js +1 -0
  14. package/dist/worker/loop-agent/loop-agent-client.js +105 -0
  15. package/dist/worker/loop-agent/parse-json.js +14 -0
  16. package/dist/worker/materialize/harness-task-materializer.js +157 -0
  17. package/dist/worker/pool/failure-routing.js +98 -0
  18. package/dist/worker/pool/run-store.js +117 -0
  19. package/dist/worker/pool/types.js +1 -0
  20. package/dist/worker/preflight.js +108 -0
  21. package/dist/worker/profile-mapping.js +76 -0
  22. package/dist/worker/progress-reporter.js +81 -0
  23. package/dist/worker/report/morning-report.js +69 -0
  24. package/dist/worker/repos/repo-resolver.js +23 -0
  25. package/dist/worker/run-task/run-task.js +359 -0
  26. package/dist/worker/runner/run-ready.js +216 -0
  27. package/dist/worker/task-graph/acceptance-schema.js +25 -0
  28. package/dist/worker/task-graph/ready-queue.js +23 -0
  29. package/dist/worker/task-graph/task-graph-schema.js +28 -0
  30. package/dist/worker/task-graph/types.js +1 -0
  31. package/dist/worker/task-graph/validate.js +188 -0
  32. package/dist/worker/task-spec/complexity-mapping.js +8 -0
  33. package/dist/worker/task-spec/schema.js +116 -0
  34. package/dist/worker/task-spec/types.js +1 -0
  35. package/dist/worker/task-spec/validate.js +352 -0
  36. package/dist/workflows/dag/canvas-observer.js +275 -275
  37. package/docs/README.md +65 -61
  38. package/docs/agent-dag-recovery-playbook.md +184 -184
  39. package/docs/agent-dag-runner.md +42 -42
  40. package/docs/architecture/runtime-boundaries.md +147 -147
  41. package/docs/cursor-executor-usage.md +25 -25
  42. package/docs/decisions/README.md +3 -3
  43. package/docs/design/README.md +36 -36
  44. package/docs/development-principles.md +73 -71
  45. package/docs/dynamic-workflow-dag-engine-roadmap.md +1749 -1749
  46. package/docs/exec-plans/README.md +6 -6
  47. package/docs/exec-plans/active/README.md +7 -7
  48. package/docs/exec-plans/completed/README.md +19 -11
  49. package/docs/feature-workflow.md +186 -186
  50. package/docs/harness-methodology-debugging.md +153 -153
  51. package/docs/harness-methodology-tdd.md +130 -130
  52. package/docs/harness-methodology-verification.md +27 -27
  53. package/docs/loop-agent-harness.md +42 -42
  54. package/docs/production-readiness.md +96 -96
  55. package/docs/progress/README.md +3 -3
  56. package/docs/reports/README.md +5 -5
  57. package/docs/skills/README.md +6 -6
  58. package/docs/skills/vetted-skill-registry.md +22 -22
  59. package/docs/templates/adr.md +60 -60
  60. package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -94
  61. package/docs/templates/agent-dag-decision-envelope.schema.json +213 -213
  62. package/docs/templates/agent-dag-decision-gate-dogfood-report.md +117 -117
  63. package/docs/templates/agent-dag-decision-gate.prompt.md +246 -246
  64. package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -98
  65. package/docs/templates/agent-dag-report.schema.json +454 -454
  66. package/docs/templates/agent-dag-review-verdict.prompt.md +68 -68
  67. package/docs/templates/agent-dag.base.json +195 -195
  68. package/docs/templates/agent-dag.final-verification.json +190 -190
  69. package/docs/templates/agent-dag.schema.json +316 -316
  70. package/docs/templates/agent-dag.supervised-implementation.json +500 -500
  71. package/docs/templates/exec-plan.md +64 -64
  72. package/docs/templates/feature-spec.md +53 -53
  73. package/docs/templates/hybrid-dag.json +193 -193
  74. package/docs/templates/production-readiness-checklist.md +57 -57
  75. package/docs/templates/progress-log.md +17 -17
  76. package/docs/templates/project-start-checklist.md +9 -9
  77. package/docs/templates/qa-report.md +48 -48
  78. package/docs/templates/sprint-contract.md +29 -29
  79. package/docs/verification-matrix.md +41 -41
  80. package/examples/decision-gate-agent-dag.json +123 -123
  81. package/examples/example-dag.json +51 -51
  82. package/examples/hybrid-loop-agent-dag.json +194 -194
  83. package/harness.json +89 -89
  84. package/package.json +60 -58
  85. package/skills/ai-engineering-context/SKILL.md +48 -48
  86. package/skills/code-review-core/SKILL.md +20 -20
  87. package/skills/codebase-scout/SKILL.md +19 -19
  88. package/skills/loop-agent/SKILL.md +147 -145
  89. package/skills/loop-agent/references/README.md +67 -67
  90. package/skills/loop-agent/references/command-reference.md +368 -340
  91. package/skills/loop-agent/references/harness-policy.md +259 -258
  92. package/skills/loop-agent/references/hybrid-dag.md +216 -216
  93. package/skills/loop-agent/references/learned/README.md +21 -21
  94. package/skills/loop-agent/references/long-running-loop.md +59 -59
  95. package/skills/loop-agent/references/model-routing.md +36 -36
  96. package/skills/loop-agent/references/multi-worktree.md +54 -54
  97. package/skills/loop-agent/references/one-shot-runs.md +85 -85
  98. package/skills/loop-agent/references/orchestrator-and-interventions.md +169 -169
  99. package/skills/loop-agent/references/pi-prompt.md +23 -23
  100. package/skills/loop-agent/references/pi-subagent-assisted-mode.md +81 -81
  101. package/skills/loop-agent/references/post-implementation-and-patterns.md +44 -44
  102. package/skills/loop-agent/references/task-workflow.md +84 -84
  103. package/skills/loop-agent/references/verification-and-failure-handling.md +128 -128
  104. package/skills/requesting-code-review/SKILL.md +101 -101
  105. package/skills/requesting-code-review/code-reviewer.md +168 -168
  106. package/skills/systematic-debugging/CREATION-LOG.md +119 -119
  107. package/skills/systematic-debugging/SKILL.md +296 -296
  108. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
  109. package/skills/systematic-debugging/condition-based-waiting.md +115 -115
  110. package/skills/systematic-debugging/defense-in-depth.md +122 -122
  111. package/skills/systematic-debugging/find-polluter.sh +63 -63
  112. package/skills/systematic-debugging/root-cause-tracing.md +169 -169
  113. package/skills/systematic-debugging/test-academic.md +14 -14
  114. package/skills/systematic-debugging/test-pressure-1.md +58 -58
  115. package/skills/systematic-debugging/test-pressure-2.md +68 -68
  116. package/skills/systematic-debugging/test-pressure-3.md +69 -69
  117. package/skills/test-driven-development/SKILL.md +20 -20
  118. package/skills/verification-before-completion/SKILL.md +154 -154
  119. package/skills/webapp-testing/SKILL.md +19 -19
@@ -1,147 +1,147 @@
1
- # Runtime Boundaries
2
-
3
- 本文定义 loop-agent 各 runtime 层的 module interface、允许的依赖方向,以及治理检查 hook。目标是把「命令、文档、import 架构」从多处维护收敛为可机器校验的边界契约,而不在本阶段改变 runtime 行为。
4
-
5
- ## 分层概览
6
-
7
- ```text
8
- Skill layer
9
- └─ 入口策略、reference 路由、硬规则(skills/loop-agent/SKILL.md + references/)
10
-
11
- CLI layer (src/cli/)
12
- └─ argv 解析、adapter 解析、调用 application / command handler、格式化输出
13
-
14
- Application layer (src/application/,逐步引入)
15
- └─ 一次用户意图的 typed use-case interface,供 CLI、Loop、Workflow 复用
16
-
17
- Workflow runtime (src/workflows/)
18
- └─ DAG / Dynamic / Loop 核心执行规则;不应依赖 commands
19
-
20
- Executors (src/executors/)
21
- └─ Cursor / Pi / Shell 等外部工具适配;不应依赖 commands 或 CLI formatting
22
-
23
- Infrastructure / Store (src/infrastructure/,逐步引入)
24
- └─ .harness 文件系统副作用、run lifecycle、原子写入规则
25
-
26
- Governance (scripts/check-*.sh, src/governance/)
27
- └─ 防止 command registry、skill entry、import architecture 漂移
28
- ```
29
-
30
- ## 各层职责
31
-
32
- ### Skill layer
33
-
34
- - **位置**:`skills/loop-agent/SKILL.md` 及 `skills/loop-agent/references/**`
35
- - **职责**:定义 agent 何时启用 loop-agent、默认执行路径(Agent DAG)、硬规则与 reference 路由;不承载完整操作手册。
36
- - **禁止**:在入口 skill 中重复维护 CLI command 列表或与 `src/cli/catalog.ts` 冲突的事实源。
37
-
38
- ### CLI layer
39
-
40
- - **位置**:`src/cli.ts`、`src/cli/**`
41
- - **职责**:解析全局 flag(如 `--repo-root`)、解析 top-level / subcommand、调用 command handler、输出 help / JSON / Markdown。
42
- - **允许依赖**:`src/commands/**`(handler wiring)、`src/adapters/**`、`src/shared/**`、逐步引入的 `src/application/**`。
43
- - **禁止**:在 router 中维护与 catalog 独立的 command 事实源(Phase 1 整改目标)。
44
-
45
- ### Application layer
46
-
47
- - **位置**:`src/application/**`(按计划逐步引入)
48
- - **职责**:封装一次用户意图的 typed result(如 validate DAG、run DAG、report),供 CLI 与 workflow runtime 共用。
49
- - **允许依赖**:`src/workflows/**`、`src/infrastructure/**`、`src/task/**`、`src/records/**`。
50
- - **禁止**:直接承担 CLI formatting 或 argv 解析。
51
-
52
- ### Workflow runtime
53
-
54
- - **位置**:`src/workflows/dag/**`、`src/workflows/dynamic/**`、`src/workflows/loop/**`
55
- - **职责**:DAG spec 校验与执行、dynamic workflow 编译与 expansion、Loop 状态机与 action 编排。
56
- - **允许依赖**:`src/executors/**`、`src/task/**`、`src/records/**`、`src/shared/**`、application use-case(目标态)。
57
- - **禁止**:`import` 来自 `src/commands/**`(见下方过渡例外)。
58
-
59
- ### Executors
60
-
61
- - **位置**:`src/executors/**`
62
- - **职责**:封装 Cursor SDK/CLI、Pi SDK/CLI、shell 执行与 write guard。
63
- - **允许依赖**:`src/shared/**`、外部 SDK。
64
- - **禁止**:依赖 `src/commands/**` 或 CLI 输出格式。
65
-
66
- ### Infrastructure / Store
67
-
68
- - **位置**:`src/infrastructure/harness/**`(按计划逐步引入);过渡期部分逻辑仍在 `src/workflows/dag/lifecycle.ts`、`src/records/**`。
69
- - **职责**:`.harness/tasks`、`.harness/dag-runs`、`.harness/runs`、loop state 的集中读写;completed run facts 只读约束。
70
- - **禁止**:把 raw path mutation 扩散给 runner、loop action 或 command handler。
71
-
72
- ### Governance
73
-
74
- - **位置**:`scripts/check-repo.sh` 及子脚本、`src/governance/**`、相关 Vitest。
75
- - **职责**:在 CI / in-flight DAG 中检测文档链接、exec plan 状态、架构 import、command registry 漂移、skill entry 完整性。
76
-
77
- ## 允许的依赖方向
78
-
79
- ```text
80
- Skill (docs) ──advisory──> CLI catalog / command-reference(人类可读,机器 drift check)
81
-
82
- CLI ──────────> Application (目标态)
83
- CLI ──────────> Commands (handler 薄层)
84
- Commands ──────────> Application / Workflows / Infrastructure
85
-
86
- Workflow runtime ──────────> Executors / Task / Records / Application (目标态)
87
- Workflow runtime ──X──> Commands (目标态禁止;见过渡例外)
88
-
89
- Executors ──────────> Shared / 外部 SDK
90
- Executors ──X──> Commands / CLI
91
-
92
- Application ──────────> Workflows / Infrastructure / Task / Records
93
- Application ──X──> CLI formatting
94
-
95
- Infrastructure ──────────> Shared / node:fs
96
- Runner / Loop ──(迁移中)──> 逐步改为仅经 Store / Application
97
- ```
98
-
99
- **规则摘要**
100
-
101
- | From | May import | Must not import |
102
- |------|------------|-----------------|
103
- | `src/commands/**` | application, workflows, infrastructure, task, records, executors, shared | — |
104
- | `src/workflows/**` | executors, task, records, shared, application(目标) | `src/commands/**` |
105
- | `src/executors/**` | shared, 外部 SDK | `src/commands/**`, `src/cli/**` |
106
- | `src/cli/**` | commands, adapters, shared, application(目标) | — |
107
- | `skills/**` | (Markdown 引用,非 TS import) | 运行时 TS 模块 |
108
-
109
- ## 已知过渡耦合
110
-
111
- 当前没有允许的 `src/workflows/**` 或 `src/executors/**` → `src/commands/**` TypeScript import。
112
-
113
- `scripts/check-architecture-boundaries.sh` 的 transitional allowlist 保持为空。任何新增的 `workflows/executors -> commands` import 必须导致检查 **exit 1**;如果未来确有临时例外,必须先写入 active exec plan,说明移除时间和验证门禁。
114
-
115
- ## Governance 钩子
116
-
117
- 以下脚本由 `scripts/check-repo.sh` 调用(Phase 0 起):
118
-
119
- | Script | 检查内容 | 失败条件 |
120
- |--------|----------|----------|
121
- | `scripts/check-architecture-boundaries.sh` | `workflows` / `executors` → `commands` import | 新的未 allowlist violation |
122
- | `scripts/check-command-registry-drift.sh` | `command-reference.md` 中的 top-level command vs `src/cli/catalog.ts` | 文档引用未注册 command |
123
- | `scripts/check-skill-entry.sh` | `SKILL.md` reference 文件存在、行数阈值 | reference 缺失(fail);行数 > 220(warn) |
124
-
125
- 相关 exec plan:`docs/exec-plans/active/2026-07-04-runtime-boundary-remediation.md`。
126
-
127
- ### 验证命令
128
-
129
- ```bash
130
- bash scripts/check-repo.sh
131
- bash scripts/check-architecture-boundaries.sh
132
- bash scripts/check-command-registry-drift.sh
133
- bash scripts/check-skill-entry.sh
134
- ```
135
-
136
- Runtime 变更另需 `npm run typecheck` 及对应 targeted Vitest(见 exec plan 各 Phase 验证关口)。
137
-
138
- ## 演进里程碑
139
-
140
- | Phase | 边界变化 |
141
- |-------|----------|
142
- | 0(当前) | 文档 + 机器 guard;已知 loop/actions.ts 耦合 advisory |
143
- | 1 | CLI command definition 单源 |
144
- | 2 | Skill entry 瘦身 + frontmatter references |
145
- | 3 | DAG application use-case;Loop 开始脱离 command JSON |
146
- | 6 | `workflows → commands` import check 已从 advisory 改为 **fail** |
147
- | 7 | Harness Store / Repository 集中 `.harness` 副作用 |
1
+ # Runtime Boundaries
2
+
3
+ 本文定义 loop-agent 各 runtime 层的 module interface、允许的依赖方向,以及治理检查 hook。目标是把「命令、文档、import 架构」从多处维护收敛为可机器校验的边界契约,而不在本阶段改变 runtime 行为。
4
+
5
+ ## 分层概览
6
+
7
+ ```text
8
+ Skill layer
9
+ └─ 入口策略、reference 路由、硬规则(skills/loop-agent/SKILL.md + references/)
10
+
11
+ CLI layer (src/cli/)
12
+ └─ argv 解析、adapter 解析、调用 application / command handler、格式化输出
13
+
14
+ Application layer (src/application/,逐步引入)
15
+ └─ 一次用户意图的 typed use-case interface,供 CLI、Loop、Workflow 复用
16
+
17
+ Workflow runtime (src/workflows/)
18
+ └─ DAG / Dynamic / Loop 核心执行规则;不应依赖 commands
19
+
20
+ Executors (src/executors/)
21
+ └─ Cursor / Pi / Shell 等外部工具适配;不应依赖 commands 或 CLI formatting
22
+
23
+ Infrastructure / Store (src/infrastructure/,逐步引入)
24
+ └─ .harness 文件系统副作用、run lifecycle、原子写入规则
25
+
26
+ Governance (scripts/check-*.sh, src/governance/)
27
+ └─ 防止 command registry、skill entry、import architecture 漂移
28
+ ```
29
+
30
+ ## 各层职责
31
+
32
+ ### Skill layer
33
+
34
+ - **位置**:`skills/loop-agent/SKILL.md` 及 `skills/loop-agent/references/**`
35
+ - **职责**:定义 agent 何时启用 loop-agent、默认执行路径(Agent DAG)、硬规则与 reference 路由;不承载完整操作手册。
36
+ - **禁止**:在入口 skill 中重复维护 CLI command 列表或与 `src/cli/catalog.ts` 冲突的事实源。
37
+
38
+ ### CLI layer
39
+
40
+ - **位置**:`src/cli.ts`、`src/cli/**`
41
+ - **职责**:解析全局 flag(如 `--repo-root`)、解析 top-level / subcommand、调用 command handler、输出 help / JSON / Markdown。
42
+ - **允许依赖**:`src/commands/**`(handler wiring)、`src/adapters/**`、`src/shared/**`、逐步引入的 `src/application/**`。
43
+ - **禁止**:在 router 中维护与 catalog 独立的 command 事实源(Phase 1 整改目标)。
44
+
45
+ ### Application layer
46
+
47
+ - **位置**:`src/application/**`(按计划逐步引入)
48
+ - **职责**:封装一次用户意图的 typed result(如 validate DAG、run DAG、report),供 CLI 与 workflow runtime 共用。
49
+ - **允许依赖**:`src/workflows/**`、`src/infrastructure/**`、`src/task/**`、`src/records/**`。
50
+ - **禁止**:直接承担 CLI formatting 或 argv 解析。
51
+
52
+ ### Workflow runtime
53
+
54
+ - **位置**:`src/workflows/dag/**`、`src/workflows/dynamic/**`、`src/workflows/loop/**`
55
+ - **职责**:DAG spec 校验与执行、dynamic workflow 编译与 expansion、Loop 状态机与 action 编排。
56
+ - **允许依赖**:`src/executors/**`、`src/task/**`、`src/records/**`、`src/shared/**`、application use-case(目标态)。
57
+ - **禁止**:`import` 来自 `src/commands/**`(见下方过渡例外)。
58
+
59
+ ### Executors
60
+
61
+ - **位置**:`src/executors/**`
62
+ - **职责**:封装 Cursor SDK/CLI、Pi SDK/CLI、shell 执行与 write guard。
63
+ - **允许依赖**:`src/shared/**`、外部 SDK。
64
+ - **禁止**:依赖 `src/commands/**` 或 CLI 输出格式。
65
+
66
+ ### Infrastructure / Store
67
+
68
+ - **位置**:`src/infrastructure/harness/**`(按计划逐步引入);过渡期部分逻辑仍在 `src/workflows/dag/lifecycle.ts`、`src/records/**`。
69
+ - **职责**:`.harness/tasks`、`.harness/dag-runs`、`.harness/runs`、loop state 的集中读写;completed run facts 只读约束。
70
+ - **禁止**:把 raw path mutation 扩散给 runner、loop action 或 command handler。
71
+
72
+ ### Governance
73
+
74
+ - **位置**:`scripts/check-repo.sh` 及子脚本、`src/governance/**`、相关 Vitest。
75
+ - **职责**:在 CI / in-flight DAG 中检测文档链接、exec plan 状态、架构 import、command registry 漂移、skill entry 完整性。
76
+
77
+ ## 允许的依赖方向
78
+
79
+ ```text
80
+ Skill (docs) ──advisory──> CLI catalog / command-reference(人类可读,机器 drift check)
81
+
82
+ CLI ──────────> Application (目标态)
83
+ CLI ──────────> Commands (handler 薄层)
84
+ Commands ──────────> Application / Workflows / Infrastructure
85
+
86
+ Workflow runtime ──────────> Executors / Task / Records / Application (目标态)
87
+ Workflow runtime ──X──> Commands (目标态禁止;见过渡例外)
88
+
89
+ Executors ──────────> Shared / 外部 SDK
90
+ Executors ──X──> Commands / CLI
91
+
92
+ Application ──────────> Workflows / Infrastructure / Task / Records
93
+ Application ──X──> CLI formatting
94
+
95
+ Infrastructure ──────────> Shared / node:fs
96
+ Runner / Loop ──(迁移中)──> 逐步改为仅经 Store / Application
97
+ ```
98
+
99
+ **规则摘要**
100
+
101
+ | From | May import | Must not import |
102
+ |------|------------|-----------------|
103
+ | `src/commands/**` | application, workflows, infrastructure, task, records, executors, shared | — |
104
+ | `src/workflows/**` | executors, task, records, shared, application(目标) | `src/commands/**` |
105
+ | `src/executors/**` | shared, 外部 SDK | `src/commands/**`, `src/cli/**` |
106
+ | `src/cli/**` | commands, adapters, shared, application(目标) | — |
107
+ | `skills/**` | (Markdown 引用,非 TS import) | 运行时 TS 模块 |
108
+
109
+ ## 已知过渡耦合
110
+
111
+ 当前没有允许的 `src/workflows/**` 或 `src/executors/**` → `src/commands/**` TypeScript import。
112
+
113
+ `scripts/check-architecture-boundaries.sh` 的 transitional allowlist 保持为空。任何新增的 `workflows/executors -> commands` import 必须导致检查 **exit 1**;如果未来确有临时例外,必须先写入 active exec plan,说明移除时间和验证门禁。
114
+
115
+ ## Governance 钩子
116
+
117
+ 以下脚本由 `scripts/check-repo.sh` 调用(Phase 0 起):
118
+
119
+ | Script | 检查内容 | 失败条件 |
120
+ |--------|----------|----------|
121
+ | `scripts/check-architecture-boundaries.sh` | `workflows` / `executors` → `commands` import | 新的未 allowlist violation |
122
+ | `scripts/check-command-registry-drift.sh` | `command-reference.md` 中的 top-level command vs `src/cli/catalog.ts` | 文档引用未注册 command |
123
+ | `scripts/check-skill-entry.sh` | `SKILL.md` reference 文件存在、行数阈值 | reference 缺失(fail);行数 > 220(warn) |
124
+
125
+ 相关 exec plan:`docs/exec-plans/active/2026-07-04-runtime-boundary-remediation.md`。
126
+
127
+ ### 验证命令
128
+
129
+ ```bash
130
+ bash scripts/check-repo.sh
131
+ bash scripts/check-architecture-boundaries.sh
132
+ bash scripts/check-command-registry-drift.sh
133
+ bash scripts/check-skill-entry.sh
134
+ ```
135
+
136
+ Runtime 变更另需 `npm run typecheck` 及对应 targeted Vitest(见 exec plan 各 Phase 验证关口)。
137
+
138
+ ## 演进里程碑
139
+
140
+ | Phase | 边界变化 |
141
+ |-------|----------|
142
+ | 0(当前) | 文档 + 机器 guard;已知 loop/actions.ts 耦合 advisory |
143
+ | 1 | CLI command definition 单源 |
144
+ | 2 | Skill entry 瘦身 + frontmatter references |
145
+ | 3 | DAG application use-case;Loop 开始脱离 command JSON |
146
+ | 6 | `workflows → commands` import check 已从 advisory 改为 **fail** |
147
+ | 7 | Harness Store / Repository 集中 `.harness` 副作用 |
@@ -1,25 +1,25 @@
1
- # Cursor Executor 用法
2
-
3
- Cursor 用于有界写实现。每个 Cursor 写任务必须显式定义 scope。
4
-
5
- ## Prompt 必填字段
6
-
7
- - task id
8
- - objective
9
- - allowed paths
10
- - forbidden paths
11
- - constraints
12
- - expected verification
13
- - 保留无关变更的指令
14
-
15
- ## One-Shot Helper
16
-
17
- ```bash
18
- loop-agent cursor-prompt \
19
- --cwd . \
20
- --timeout 1800000 \
21
- --model composer-2.5 \
22
- "<bounded task prompt>"
23
- ```
24
-
25
- Cursor 返回后,主会话必须检查 diff 并运行相关验证命令。
1
+ # Cursor Executor 用法
2
+
3
+ Cursor 用于有界写实现。每个 Cursor 写任务必须显式定义 scope。
4
+
5
+ ## Prompt 必填字段
6
+
7
+ - task id
8
+ - objective
9
+ - allowed paths
10
+ - forbidden paths
11
+ - constraints
12
+ - expected verification
13
+ - 保留无关变更的指令
14
+
15
+ ## One-Shot Helper
16
+
17
+ ```bash
18
+ loop-agent cursor-prompt \
19
+ --cwd . \
20
+ --timeout 1800000 \
21
+ --model composer-2.5 \
22
+ "<bounded task prompt>"
23
+ ```
24
+
25
+ Cursor 返回后,主会话必须检查 diff 并运行相关验证命令。
@@ -1,3 +1,3 @@
1
- # 决策
2
-
3
- 本目录存放架构决策记录(ADR)。
1
+ # 决策
2
+
3
+ 本目录存放架构决策记录(ADR)。
@@ -1,36 +1,36 @@
1
- # 设计笔记
2
-
3
- `docs/design/` 存放将 `loop-agent` 作为更大产品线 agent 平台内仓库本地 runtime 的规划笔记。这些是设计输入,不是 `src/` 已具备该能力的证明。
4
-
5
- ## 文档
6
-
7
- | 文档 | 用途 |
8
- |---|---|
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
-
17
- ## 当前实现边界
18
-
19
- `loop-agent` 当前拥有:仓库本地 harness、Agent DAG 生成/验证/执行、shell 验证、artifacts、reports、Loop state。它不是产品线 Task Pool、Orchestrator、docs-sync 服务、Git/CI 平台或 artifact store。
20
-
21
- 设计文档使用两类 profile 名称:
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`
25
-
26
- 除非 CLI 显式扩展支持,否则不要把 business task profile 直接传给 `loop-agent dag run-task --profile`。用 `taskspec-to-loop-agent-mapping.md` 将 business profile 路由到当前 governance profile。
27
-
28
- ## 维护规则
29
-
30
- 设计笔记变更时:
31
-
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
+ # 设计笔记
2
+
3
+ `docs/design/` 存放将 `loop-agent` 作为更大产品线 agent 平台内仓库本地 runtime 的规划笔记。这些是设计输入,不是 `src/` 已具备该能力的证明。
4
+
5
+ ## 文档
6
+
7
+ | 文档 | 用途 |
8
+ |---|---|
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
+
17
+ ## 当前实现边界
18
+
19
+ `loop-agent` 当前拥有:仓库本地 harness、Agent DAG 生成/验证/执行、shell 验证、artifacts、reports、Loop state。它不是产品线 Task Pool、Orchestrator、docs-sync 服务、Git/CI 平台或 artifact store。
20
+
21
+ 设计文档使用两类 profile 名称:
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`
25
+
26
+ 除非 CLI 显式扩展支持,否则不要把 business task profile 直接传给 `loop-agent dag run-task --profile`。用 `taskspec-to-loop-agent-mapping.md` 将 business profile 路由到当前 governance profile。
27
+
28
+ ## 维护规则
29
+
30
+ 设计笔记变更时:
31
+
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,73 @@
1
- # 开发原则
2
-
3
- loop-agent 是面向 agentic coding 的工作流 runtime。仓库应保持小而显式、可验证。
4
-
5
- ## 操作立场
6
-
7
- 项目采用「人类掌舵、智能体执行」的工程模型。Agent 可实现、验证与总结,但持久意图与完成证据必须落在仓库中。
8
-
9
- - 仓库是记录系统。决策、契约、计划、测试、报告与交接属于 tracked files。
10
- - `AGENTS.md` 是操作地图,不是知识 dump。长期方法论与决策属于 `docs/`。
11
- - 工作以小步、可逆、可验证的增量推进。
12
- - 状态不确定时,先跑基线验证再开新工。
13
- - 完成由新鲜证据定义,而非意图或信心。
14
-
15
- ## 原则
16
-
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
-
28
- ## 仓库结构
29
-
30
- - 源码:`src/`
31
- - 测试:`test/`
32
- - Skill 指令:`skills/`
33
- - 验证与维护脚本:`scripts/`
34
- - 治理与交接产物:`docs/`
35
-
36
- ## 变更纪律
37
-
38
- 行为变更要更新测试;工作流或命令变更要更新文档与示例;治理变更要更新 `harness.json` 与相关检查脚本。
39
-
40
- 当工作影响需求、行为、跨命令契约或 harness 规则时,更新对应持久产物:
41
-
42
- - 设计/契约文档 — 变更后的预期
43
- - 测试或验证脚本 — 变更后的行为
44
- - progress log 或 report 非平凡交接证据
45
- - ADR架构或公开契约决策
46
- - 模板重复流程可复用时
47
-
48
- 除非 contract 明确说明必须一起移动,否则不要在一个工作块里混合无关重构、新功能与大规模文档迁移。
49
-
50
- ## 搜索与复用
51
-
52
- 实现前先检视现有系统:
53
-
54
- - 仓库已索引且任务需要理解代码时,优先用 CodeGraph。
55
- - 可用时用 `rg` 做文本搜索、`fd` 找文件。
56
- - 引入新 helper 前先读邻近测试与 helper
57
- - 优先结构化 parser 与现有本地 API,避免 ad hoc 字符串处理。
58
-
59
- 在搜索证明否则之前,假设系统可能已有部分解法。
60
-
61
- ## 完成纪律
62
-
63
- 完成声明必须回答:
64
-
65
- - 改了什么
66
- - 为何选此方案
67
- - 哪条命令验证、结果如何
68
- - 是否影响契约、文档、测试或脚本
69
- - 剩余风险或后续项
70
-
71
- 验证失败时,报告失败命令与观察到的状态,而不是软化完成定义。
1
+ # 开发原则
2
+
3
+ loop-agent 是面向 agentic coding 的工作流 runtime。仓库应保持小而显式、可验证。
4
+
5
+ ## 操作立场
6
+
7
+ 项目采用「人类掌舵、智能体执行」的工程模型。Agent 可实现、验证与总结,但持久意图与完成证据必须落在仓库中。
8
+
9
+ 这个模型吸收了 Anthropic 长时运行 agent harness、OpenAI Codex harness engineering、腾讯端到端 Harness Engineering 和社区 agent harness 实践中的共同经验:用短入口文档导航长期知识,用结构化任务状态和 handoff artifact 跨 session 传递事实,用独立验证和评审回路约束 agent 输出,并把人类注意力集中在意图、边界、架构和反馈系统上。面向使用者的背景资料收录在 `website/docs/practices/`。
10
+
11
+ - 仓库是记录系统。决策、契约、计划、测试、报告与交接属于 tracked files。
12
+ - `AGENTS.md` 是操作地图,不是知识 dump。长期方法论与决策属于 `docs/`。
13
+ - 工作以小步、可逆、可验证的增量推进。
14
+ - 状态不确定时,先跑基线验证再开新工。
15
+ - 完成由新鲜证据定义,而非意图或信心。
16
+
17
+ ## 原则
18
+
19
+ 1. 一次任务只推进一个有边界的工作块。
20
+ 2. 设计新行为前先搜索现有代码、文档、脚本与测试。
21
+ 3. Shell 验证是完成权威。
22
+ 4. Runtime 状态在 `.harness/`;持久决策在 `docs/`。
23
+ 5. Pi writer 节点与可选 Cursor 写执行必须由显式 allowed/forbidden paths 约束。
24
+ 6. Pi review/planning 路径是 advisory,除非后跟确定性验证。
25
+ 7. 反复出现的约束应固化为文档、测试、脚本、检查或模板。
26
+ 8. 不要把隐藏流程状态只留在聊天里。
27
+ 9. 不要把占位实现当作已完成交付。
28
+ 10. 新增抽象前先沿用现有局部模式。
29
+
30
+ ## 仓库结构
31
+
32
+ - 源码:`src/`
33
+ - 测试:`test/`
34
+ - Skill 指令:`skills/`
35
+ - 验证与维护脚本:`scripts/`
36
+ - 治理与交接产物:`docs/`
37
+
38
+ ## 变更纪律
39
+
40
+ 行为变更要更新测试;工作流或命令变更要更新文档与示例;治理变更要更新 `harness.json` 与相关检查脚本。
41
+
42
+ 当工作影响需求、行为、跨命令契约或 harness 规则时,更新对应持久产物:
43
+
44
+ - 设计/契约文档变更后的预期
45
+ - 测试或验证脚本变更后的行为
46
+ - progress log 或 report 非平凡交接证据
47
+ - ADR — 架构或公开契约决策
48
+ - 模板 — 重复流程可复用时
49
+
50
+ 除非 contract 明确说明必须一起移动,否则不要在一个工作块里混合无关重构、新功能与大规模文档迁移。
51
+
52
+ ## 搜索与复用
53
+
54
+ 实现前先检视现有系统:
55
+
56
+ - 仓库已索引且任务需要理解代码时,优先用 CodeGraph
57
+ - 可用时用 `rg` 做文本搜索、`fd` 找文件。
58
+ - 引入新 helper 前先读邻近测试与 helper。
59
+ - 优先结构化 parser 与现有本地 API,避免 ad hoc 字符串处理。
60
+
61
+ 在搜索证明否则之前,假设系统可能已有部分解法。
62
+
63
+ ## 完成纪律
64
+
65
+ 完成声明必须回答:
66
+
67
+ - 改了什么
68
+ - 为何选此方案
69
+ - 哪条命令验证、结果如何
70
+ - 是否影响契约、文档、测试或脚本
71
+ - 剩余风险或后续项
72
+
73
+ 验证失败时,报告失败命令与观察到的状态,而不是软化完成定义。