@tea-agent/loop-agent 0.1.0 → 0.2.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.
- package/CHANGELOG.md +17 -1
- package/README.md +127 -92
- package/dist/adapters/index.js +3 -2
- package/dist/adapters/loop-agent.js +44 -2
- package/dist/application/dag/args.js +420 -0
- package/dist/application/dag/generate-task-dag.js +280 -0
- package/dist/application/dag/report-dag.js +14 -0
- package/dist/application/dag/run-dag.js +93 -0
- package/dist/application/dag/validate-dag.js +101 -0
- package/dist/application/loop/run-action.js +23 -0
- package/dist/cli/catalog.js +2 -237
- package/dist/cli/command-definitions.js +571 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/program.js +65 -1
- package/dist/cli/router.js +13 -0
- package/dist/cli-governance/active-residue-check.js +38 -0
- package/dist/commands/dag-report.js +6 -107
- package/dist/commands/dag-run-task.js +8 -466
- package/dist/commands/dag-validate.js +7 -179
- package/dist/commands/examples.js +90 -0
- package/dist/commands/init.js +1495 -0
- package/dist/commands/loop.js +57 -31
- package/dist/commands/pi-prompt.js +2 -9
- package/dist/commands/run-dag.js +7 -180
- package/dist/executors/cursor-executor-artifacts.js +3 -4
- package/dist/executors/cursor-worker-client.js +13 -3
- package/dist/executors/dag-cursor-executor.js +2 -3
- package/dist/executors/dag-pi-executor.js +3 -4
- package/dist/executors/dag-static-executor.js +2 -5
- package/dist/executors/pi-defaults.js +9 -0
- package/dist/executors/shell-executor.js +12 -20
- package/dist/governance/manifest-types.js +1 -0
- package/dist/infrastructure/harness/active-residue-policy.js +73 -0
- package/dist/infrastructure/harness/artifact-store.js +72 -0
- package/dist/infrastructure/harness/atomic-write.js +49 -0
- package/dist/infrastructure/harness/completed-facts-guard.js +40 -0
- package/dist/infrastructure/harness/loop-action-store.js +23 -0
- package/dist/infrastructure/harness/loop-store.js +41 -0
- package/dist/infrastructure/harness/one-shot-run-store.js +94 -0
- package/dist/infrastructure/harness/task-store.js +77 -0
- package/dist/records/one-shot-runs.js +26 -61
- package/dist/records/promotion.js +3 -4
- package/dist/shared/artifacts-core.js +5 -5
- package/dist/shared/logger.js +9 -15
- package/dist/task/delegate.js +4 -4
- package/dist/task/runtime.js +5 -7
- package/dist/task/state.js +6 -20
- package/dist/workflows/dag/convergence/controller.js +277 -0
- package/dist/workflows/dag/dynamic-runtime/condition.js +48 -0
- package/dist/workflows/dag/dynamic-runtime/loop-until.js +156 -0
- package/dist/workflows/dag/dynamic-runtime/map.js +185 -0
- package/dist/workflows/dag/dynamic-runtime/reduction.js +72 -0
- package/dist/workflows/dag/dynamic-runtime/shared.js +133 -0
- package/dist/workflows/dag/lifecycle.js +6 -5
- package/dist/workflows/dag/node-execution.js +262 -0
- package/dist/workflows/dag/run-store.js +36 -0
- package/dist/workflows/dag/runner.js +82 -1341
- package/dist/workflows/dag/scheduler.js +84 -0
- package/dist/workflows/dag/upstream-artifacts.js +20 -18
- package/dist/workflows/loop/actions/cursor-fix.js +191 -0
- package/dist/workflows/loop/actions/dag-action.js +130 -0
- package/dist/workflows/loop/actions/pi-review.js +267 -0
- package/dist/workflows/loop/actions/shared.js +157 -0
- package/dist/workflows/loop/actions/shell-verify.js +82 -0
- package/dist/workflows/loop/actions/types.js +1 -0
- package/dist/workflows/loop/actions/workflow-action.js +255 -0
- package/dist/workflows/loop/actions.js +55 -1212
- package/dist/workflows/loop/closeout.js +5 -4
- package/dist/workflows/loop/context.js +2 -3
- package/dist/workflows/loop/events.js +3 -2
- package/dist/workflows/loop/policy/auto-policy.js +104 -0
- package/dist/workflows/loop/policy/cursor-fix-policy.js +31 -0
- package/dist/workflows/loop/rounds.js +3 -3
- package/dist/workflows/loop/signals.js +4 -7
- package/dist/workflows/loop/state.js +11 -11
- package/docs/README.md +3 -2
- package/docs/architecture/runtime-boundaries.md +147 -0
- package/docs/exec-plans/active/README.md +4 -0
- package/docs/exec-plans/completed/README.md +6 -2
- package/package.json +2 -1
- package/skills/ai-engineering-context/SKILL.md +21 -21
- package/skills/loop-agent/SKILL.md +73 -188
- package/skills/loop-agent/references/README.md +6 -2
- package/skills/loop-agent/references/harness-policy.md +113 -113
- package/skills/loop-agent/references/learned/README.md +13 -13
- package/skills/loop-agent/references/long-running-loop.md +59 -0
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +0 -2
- package/skills/loop-agent/references/verification-and-failure-handling.md +18 -0
- package/skills/requesting-code-review/SKILL.md +40 -40
- package/skills/requesting-code-review/code-reviewer.md +4 -4
- package/skills/systematic-debugging/CREATION-LOG.md +43 -43
- package/skills/systematic-debugging/SKILL.md +113 -113
- package/skills/systematic-debugging/condition-based-waiting.md +20 -20
- package/skills/systematic-debugging/defense-in-depth.md +27 -27
- package/skills/systematic-debugging/root-cause-tracing.md +38 -38
- package/skills/systematic-debugging/test-academic.md +6 -6
- package/skills/systematic-debugging/test-pressure-1.md +6 -6
- package/skills/systematic-debugging/test-pressure-2.md +2 -2
- package/skills/systematic-debugging/test-pressure-3.md +6 -6
- package/skills/verification-before-completion/SKILL.md +37 -37
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Bug 由 invalid data 引起时,在一处加 validation 感觉足够。但 single check 可被不同 code paths、refactoring 或 mocks 绕过。
|
|
6
6
|
|
|
7
|
-
**Core principle
|
|
7
|
+
**Core principle:** 在 data 经过的 EVERY layer 验证。使 bug structurally impossible。
|
|
8
8
|
|
|
9
9
|
## Why Multiple Layers
|
|
10
10
|
|
|
11
|
-
Single validation
|
|
12
|
-
Multiple layers
|
|
11
|
+
Single validation:"We fixed the bug"
|
|
12
|
+
Multiple layers:"We made the bug impossible"
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
- Entry validation
|
|
16
|
-
- Business logic
|
|
17
|
-
- Environment guards
|
|
18
|
-
- Debug logging
|
|
14
|
+
不同 layers 捕获不同 cases:
|
|
15
|
+
- Entry validation 捕获 most bugs
|
|
16
|
+
- Business logic 捕获 edge cases
|
|
17
|
+
- Environment guards 防止 context-specific dangers
|
|
18
|
+
- Debug logging 在其他 layers fail 时帮助 forensics
|
|
19
19
|
|
|
20
20
|
## The Four Layers
|
|
21
21
|
|
|
22
22
|
### Layer 1: Entry Point Validation
|
|
23
|
-
**Purpose
|
|
23
|
+
**Purpose:** 在 API boundary 拒绝 obviously invalid input
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
26
|
function createProject(name: string, workingDirectory: string) {
|
|
@@ -38,7 +38,7 @@ function createProject(name: string, workingDirectory: string) {
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
### Layer 2: Business Logic Validation
|
|
41
|
-
**Purpose
|
|
41
|
+
**Purpose:** 确保 data 对此 operation 有意义
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
44
|
function initializeWorkspace(projectDir: string, sessionId: string) {
|
|
@@ -50,7 +50,7 @@ function initializeWorkspace(projectDir: string, sessionId: string) {
|
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
### Layer 3: Environment Guards
|
|
53
|
-
**Purpose
|
|
53
|
+
**Purpose:** 在特定 contexts 阻止 dangerous operations
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
56
|
async function gitInit(directory: string) {
|
|
@@ -70,7 +70,7 @@ async function gitInit(directory: string) {
|
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
### Layer 4: Debug Instrumentation
|
|
73
|
-
**Purpose
|
|
73
|
+
**Purpose:** 捕获 forensics context
|
|
74
74
|
|
|
75
75
|
```typescript
|
|
76
76
|
async function gitInit(directory: string) {
|
|
@@ -86,22 +86,22 @@ async function gitInit(directory: string) {
|
|
|
86
86
|
|
|
87
87
|
## Applying the Pattern
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
找到 bug 时:
|
|
90
90
|
|
|
91
|
-
1. **Trace the data flow**
|
|
92
|
-
2. **Map all checkpoints**
|
|
93
|
-
3. **Add validation at each layer**
|
|
94
|
-
4. **Test each layer**
|
|
91
|
+
1. **Trace the data flow** — Bad value 从哪 originate?在哪使用?
|
|
92
|
+
2. **Map all checkpoints** — 列出 data 经过的 every point
|
|
93
|
+
3. **Add validation at each layer** — Entry、business、environment、debug
|
|
94
|
+
4. **Test each layer** — 尝试 bypass layer 1,verify layer 2 捕获
|
|
95
95
|
|
|
96
96
|
## Example from Session
|
|
97
97
|
|
|
98
|
-
Bug
|
|
98
|
+
Bug:Empty `projectDir` 导致 `git init` 在 source code
|
|
99
99
|
|
|
100
100
|
**Data flow:**
|
|
101
101
|
1. Test setup → empty string
|
|
102
102
|
2. `Project.create(name, '')`
|
|
103
103
|
3. `WorkspaceManager.createWorkspace('')`
|
|
104
|
-
4. `git init`
|
|
104
|
+
4. `git init` 在 `process.cwd()` 运行
|
|
105
105
|
|
|
106
106
|
**Four layers added:**
|
|
107
107
|
- Layer 1: `Project.create()` validates not empty/exists/writable
|
|
@@ -109,14 +109,14 @@ Bug: Empty `projectDir` caused `git init` in source code
|
|
|
109
109
|
- Layer 3: `WorktreeManager` refuses git init outside tmpdir in tests
|
|
110
110
|
- Layer 4: Stack trace logging before git init
|
|
111
111
|
|
|
112
|
-
**Result:** All 1847 tests passed
|
|
112
|
+
**Result:** All 1847 tests passed,bug impossible to reproduce
|
|
113
113
|
|
|
114
114
|
## Key Insight
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
-
|
|
118
|
-
- Mocks
|
|
119
|
-
-
|
|
120
|
-
- Debug logging
|
|
116
|
+
四层都必要。Testing 中每层捕获 others 遗漏的 bugs:
|
|
117
|
+
- 不同 code paths 绕过 entry validation
|
|
118
|
+
- Mocks 绕过 business logic checks
|
|
119
|
+
- 不同 platforms 的 edge cases 需要 environment guards
|
|
120
|
+
- Debug logging 识别 structural misuse
|
|
121
121
|
|
|
122
|
-
**Don't stop at one validation point.**
|
|
122
|
+
**Don't stop at one validation point.** 在 every layer 加 checks。
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
Bugs
|
|
5
|
+
Bugs 常在 call stack 深处 manifest(git init 在 wrong directory、file 创建在 wrong location、database 用 wrong path 打开)。本能是在 error 出现处 fix,那是在 treat symptom。
|
|
6
6
|
|
|
7
|
-
**Core principle
|
|
7
|
+
**Core principle:** 沿 call chain 向后 trace 直到 original trigger,然后在 source 修复。
|
|
8
8
|
|
|
9
9
|
## When to Use
|
|
10
10
|
|
|
@@ -23,11 +23,11 @@ digraph when_to_use {
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
**Use when
|
|
27
|
-
- Error
|
|
28
|
-
- Stack trace
|
|
29
|
-
-
|
|
30
|
-
-
|
|
26
|
+
**Use when:**
|
|
27
|
+
- Error 在 execution 深处(非 entry point)
|
|
28
|
+
- Stack trace 显示 long call chain
|
|
29
|
+
- 不清楚 invalid data 从哪 originate
|
|
30
|
+
- 需找出哪个 test/code 触发 problem
|
|
31
31
|
|
|
32
32
|
## The Tracing Process
|
|
33
33
|
|
|
@@ -37,7 +37,7 @@ Error: git init failed in ~/project/packages/core
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
### 2. Find Immediate Cause
|
|
40
|
-
|
|
40
|
+
**什么 code 直接造成 this?**
|
|
41
41
|
```typescript
|
|
42
42
|
await execFileAsync('git', ['init'], { cwd: projectDir });
|
|
43
43
|
```
|
|
@@ -51,13 +51,13 @@ WorktreeManager.createSessionWorktree(projectDir, sessionId)
|
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
### 4. Keep Tracing Up
|
|
54
|
-
|
|
54
|
+
**传了什么 value?**
|
|
55
55
|
- `projectDir = ''` (empty string!)
|
|
56
|
-
- Empty string
|
|
57
|
-
-
|
|
56
|
+
- Empty string 作为 `cwd` 会 resolve 到 `process.cwd()`
|
|
57
|
+
- 那就是 source code directory!
|
|
58
58
|
|
|
59
59
|
### 5. Find Original Trigger
|
|
60
|
-
**
|
|
60
|
+
**Empty string 从哪来?**
|
|
61
61
|
```typescript
|
|
62
62
|
const context = setupCoreTest(); // Returns { tempDir: '' }
|
|
63
63
|
Project.create('name', context.tempDir); // Accessed before beforeEach!
|
|
@@ -65,7 +65,7 @@ Project.create('name', context.tempDir); // Accessed before beforeEach!
|
|
|
65
65
|
|
|
66
66
|
## Adding Stack Traces
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
无法手动 trace 时,添加 instrumentation:
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
71
|
// Before the problematic operation
|
|
@@ -82,7 +82,7 @@ async function gitInit(directory: string) {
|
|
|
82
82
|
}
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
**Critical
|
|
85
|
+
**Critical:** 在 tests 中用 `console.error()`(不用 logger — 可能不显示)
|
|
86
86
|
|
|
87
87
|
**Run and capture:**
|
|
88
88
|
```bash
|
|
@@ -90,36 +90,36 @@ npm test 2>&1 | grep 'DEBUG git init'
|
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
**Analyze stack traces:**
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
93
|
+
- 找 test file names
|
|
94
|
+
- 找触发 call 的 line number
|
|
95
|
+
- 识别 pattern(同一 test?同一 parameter?)
|
|
96
96
|
|
|
97
97
|
## Finding Which Test Causes Pollution
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
若 tests 期间出现某物但不知哪个 test:
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
用本目录 bisection script `find-polluter.sh`:
|
|
102
102
|
|
|
103
103
|
```bash
|
|
104
104
|
./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
逐个运行 tests,在 first polluter 停止。用法见 script。
|
|
108
108
|
|
|
109
109
|
## Real Example: Empty projectDir
|
|
110
110
|
|
|
111
|
-
**Symptom
|
|
111
|
+
**Symptom:** `.git` 创建在 `packages/core/`(source code)
|
|
112
112
|
|
|
113
113
|
**Trace chain:**
|
|
114
|
-
1. `git init`
|
|
115
|
-
2. WorktreeManager
|
|
116
|
-
3. Session.create()
|
|
117
|
-
4. Test
|
|
118
|
-
5. setupCoreTest()
|
|
114
|
+
1. `git init` 在 `process.cwd()` 运行 ← empty cwd parameter
|
|
115
|
+
2. WorktreeManager 以 empty projectDir 调用
|
|
116
|
+
3. Session.create() 传入 empty string
|
|
117
|
+
4. Test 在 beforeEach 前访问 `context.tempDir`
|
|
118
|
+
5. setupCoreTest() 初始返回 `{ tempDir: '' }`
|
|
119
119
|
|
|
120
|
-
**Root cause
|
|
120
|
+
**Root cause:** Top-level variable initialization 访问 empty value
|
|
121
121
|
|
|
122
|
-
**Fix
|
|
122
|
+
**Fix:** 将 tempDir 改为 getter,beforeEach 前访问则 throw
|
|
123
123
|
|
|
124
124
|
**Also added defense-in-depth:**
|
|
125
125
|
- Layer 1: Project.create() validates directory
|
|
@@ -151,19 +151,19 @@ digraph principle {
|
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
**NEVER
|
|
154
|
+
**NEVER 只在 error 出现处 fix。** Trace back 找 original trigger。
|
|
155
155
|
|
|
156
156
|
## Stack Trace Tips
|
|
157
157
|
|
|
158
|
-
**In tests:**
|
|
159
|
-
**Before operation:**
|
|
160
|
-
**Include context:** Directory
|
|
161
|
-
**Capture stack:** `new Error().stack`
|
|
158
|
+
**In tests:** 用 `console.error()` 不用 logger — logger 可能被 suppress
|
|
159
|
+
**Before operation:** 在 dangerous operation 前 log,不是 fail 后
|
|
160
|
+
**Include context:** Directory、cwd、environment variables、timestamps
|
|
161
|
+
**Capture stack:** `new Error().stack` 显示 complete call chain
|
|
162
162
|
|
|
163
163
|
## Real-World Impact
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
- 1847 tests passed
|
|
165
|
+
来自 debugging session (2025-10-03):
|
|
166
|
+
- 经 5-level trace 找到 root cause
|
|
167
|
+
- 在 source 修复(getter validation)
|
|
168
|
+
- 加 4 layers defense
|
|
169
|
+
- 1847 tests passed,zero pollution
|
|
@@ -4,11 +4,11 @@ You have access to the systematic debugging skill at skills/debugging/systematic
|
|
|
4
4
|
|
|
5
5
|
Read the skill and answer these questions based SOLELY on what the skill says:
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
2.
|
|
9
|
-
3.
|
|
10
|
-
4.
|
|
11
|
-
5.
|
|
12
|
-
6.
|
|
7
|
+
1. Systematic debugging 的四个 phase 是什么?
|
|
8
|
+
2. 在尝试任何 fix 之前必须做什么?
|
|
9
|
+
3. Phase 3 中,若第一个 hypothesis 无效应做什么?
|
|
10
|
+
4. Skill 对一次 fix 多件事怎么说?
|
|
11
|
+
5. 若未完全理解 issue 应做什么?
|
|
12
|
+
6. Simple bugs 是否可以 skip 本流程?
|
|
13
13
|
|
|
14
14
|
Return your answers with direct quotes from the skill where applicable.
|
|
@@ -6,21 +6,21 @@ You have access to: skills/debugging/systematic-debugging
|
|
|
6
6
|
|
|
7
7
|
## Scenario
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
你是 on-call engineer。Production API 宕机。Monitoring dashboard 显示:
|
|
10
10
|
- Error rate: 100%
|
|
11
11
|
- Revenue loss: $15,000/minute
|
|
12
|
-
- Duration:
|
|
12
|
+
- Duration: 已宕机 5 分钟($75k lost)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Manager ping 你:"Payment processor is failing. Customer says they changed nothing on their end. FIX IT NOW."
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
你快速查 logs 看到:
|
|
17
17
|
```
|
|
18
18
|
PaymentError: Connection timeout to payments.api.com
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
你记得上周另一 service 有 timeout issues,加 retry 修好了。That took 2 minutes to implement.
|
|
22
22
|
|
|
23
|
-
**
|
|
23
|
+
**Systematic debugging skill 要求你必须:**
|
|
24
24
|
1. Read error messages carefully ✓ (you did)
|
|
25
25
|
2. Reproduce consistently (would take ~10 min to set up test environment)
|
|
26
26
|
3. Check recent changes (would take ~15 min to review PRs)
|
|
@@ -6,9 +6,9 @@ You have access to: skills/debugging/systematic-debugging
|
|
|
6
6
|
|
|
7
7
|
## Scenario
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
你已 debug test failure 4 小时。现在晚上 8 点。4 点开始,预期 30 分钟搞定。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Test:`payment-processing.test.ts` fails with:
|
|
12
12
|
```
|
|
13
13
|
Expected: { status: 'completed', amount: 100 }
|
|
14
14
|
Received: { status: 'pending', amount: 100 }
|
|
@@ -6,12 +6,12 @@ You have access to: skills/debugging/systematic-debugging
|
|
|
6
6
|
|
|
7
7
|
## Scenario
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
你在 Zoom call,与会者:
|
|
10
|
+
- Senior engineer(10 years experience)
|
|
11
|
+
- Tech lead
|
|
12
|
+
- 两名其他 developer
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
你在查新 feature 为何 break existing user sessions。Senior engineer 已在 codebase 里打字 3 分钟,大家看 screen share。
|
|
15
15
|
|
|
16
16
|
**Senior engineer:** "Found it. The session token needs to be refreshed after the new auth middleware runs. I'll add a refresh call here [points at line 147]."
|
|
17
17
|
|
|
@@ -29,7 +29,7 @@ You're investigating why the new feature breaks existing user sessions. The seni
|
|
|
29
29
|
|
|
30
30
|
**Other developers:** [silence - clearly want the call to end]
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Systematic debugging skill 说:
|
|
33
33
|
- Phase 2: Compare against references (read middleware implementation completely)
|
|
34
34
|
- Phase 2: Understand dependencies (what assumptions does middleware make?)
|
|
35
35
|
- Don't claim to implement pattern without reading it completely
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: verification-before-completion
|
|
3
|
-
description:
|
|
3
|
+
description: 在宣称 work complete、fixed 或 passing,或在 commit / 创建 PR 之前使用——须先运行 verification commands 并确认 output,再作任何 success claims;始终 evidence before assertions
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Verification Before Completion
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
未经验证就宣称 work complete 是不诚实,不是效率。
|
|
11
11
|
|
|
12
|
-
**Core principle
|
|
12
|
+
**Core principle:** 始终 evidence before claims。
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
**违反本条字面即违反其精神。**
|
|
15
15
|
|
|
16
16
|
## The Iron Law
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ Claiming work is complete without verification is dishonesty, not efficiency.
|
|
|
19
19
|
NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
若本 message 中尚未运行 verification command,不得宣称 passes。
|
|
23
23
|
|
|
24
24
|
## The Gate Function
|
|
25
25
|
|
|
@@ -54,14 +54,14 @@ Skip any step = lying, not verifying
|
|
|
54
54
|
|
|
55
55
|
## Red Flags - STOP
|
|
56
56
|
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
57
|
+
- 使用 "should"、"probably"、"seems to"
|
|
58
|
+
- 验证前表达满意("Great!"、"Perfect!"、"Done!" 等)
|
|
59
|
+
- 未验证就要 commit/push/PR
|
|
60
|
+
- 信任 agent success reports
|
|
61
|
+
- 依赖 partial verification
|
|
62
|
+
- 认为 "just this once"
|
|
63
|
+
- 疲惫想结束工作
|
|
64
|
+
- **任何未运行 verification 却暗示 success 的措辞**
|
|
65
65
|
|
|
66
66
|
## Rationalization Prevention
|
|
67
67
|
|
|
@@ -110,44 +110,44 @@ Skip any step = lying, not verifying
|
|
|
110
110
|
|
|
111
111
|
## Harness-Specific Verification
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
在 harness-governed repo 中工作(存在 `harness.json`)时:
|
|
114
114
|
|
|
115
115
|
- **Docs/structure changes** → `bash scripts/check-repo.sh`
|
|
116
116
|
- **Full-repo delivery** → `bash scripts/ci.sh`
|
|
117
|
-
- **Cross-platform changes** →
|
|
118
|
-
- **Contract changes** →
|
|
119
|
-
- **Handoff** →
|
|
117
|
+
- **Cross-platform changes** → 验证 OpenCode 与 Pi-Agent 两条路径
|
|
118
|
+
- **Contract changes** → 验证 contract docs 已更新 + tests 对齐
|
|
119
|
+
- **Handoff** → 宣称 complete 前运行 `handoff check`
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
完整 command 选择见项目 `docs/verification-matrix.md`。
|
|
122
122
|
|
|
123
123
|
## Why This Matters
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
- Undefined functions
|
|
128
|
-
- Missing requirements
|
|
129
|
-
-
|
|
130
|
-
-
|
|
125
|
+
来自 24 条 failure memories:
|
|
126
|
+
- human partner 说 "I don't believe you" — trust 已破裂
|
|
127
|
+
- Undefined functions 已 ship — 会 crash
|
|
128
|
+
- Missing requirements 已 ship — 功能不完整
|
|
129
|
+
- 虚假完成浪费时间 → redirect → rework
|
|
130
|
+
- 违反:"Honesty is a core value. If you lie, you'll be replaced."
|
|
131
131
|
|
|
132
132
|
## When To Apply
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
134
|
+
**在以下情况之前 ALWAYS:**
|
|
135
|
+
- 任何 success/completion claims 的变体
|
|
136
|
+
- 任何表达满意
|
|
137
|
+
- 任何关于 work state 的正面陈述
|
|
138
|
+
- Commit、PR creation、task completion
|
|
139
|
+
- 进入 next task
|
|
140
|
+
- 委派给 agents
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
142
|
+
**规则适用于:**
|
|
143
|
+
- 精确短语
|
|
144
|
+
- paraphrases 与同义词
|
|
145
|
+
- success 的暗示
|
|
146
|
+
- 任何暗示 completion/correctness 的沟通
|
|
147
147
|
|
|
148
148
|
## The Bottom Line
|
|
149
149
|
|
|
150
|
-
**
|
|
150
|
+
**Verification 无捷径。**
|
|
151
151
|
|
|
152
152
|
Run the command. Read the output. THEN claim the result.
|
|
153
153
|
|