codex-harness-engineering 0.1.5 → 0.1.6
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/AGENTS.md +18 -6
- package/LICENSE +21 -0
- package/README.md +69 -6
- package/docs/harness-engineering/implementation-playbook.md +232 -286
- package/docs/harness-engineering/index.md +7 -4
- package/docs/harness-engineering/research-note.md +294 -274
- package/docs/harness-engineering/sources.md +166 -72
- package/package.json +5 -4
- package/scripts/install-skills.mjs +73 -15
- package/scripts/publish.sh +2 -2
- package/scripts/verify-harness.mjs +61 -4
- package/skills/acceptance-contract/SKILL.md +39 -49
- package/skills/acceptance-contract/agents/openai.yaml +2 -2
- package/skills/cleanup-harness/SKILL.md +48 -59
- package/skills/cleanup-harness/agents/openai.yaml +2 -2
- package/skills/creator-harness/SKILL.md +79 -95
- package/skills/creator-harness/agents/openai.yaml +2 -2
- package/skills/creator-harness/references/harness-artifacts.md +63 -62
- package/skills/lessons-harness/SKILL.md +68 -0
- package/skills/lessons-harness/agents/openai.yaml +4 -0
- package/templates/harness/AGENTS.md +77 -0
- package/templates/harness/feature_list.json +16 -0
- package/templates/harness/init.sh +15 -0
- package/templates/harness/lessons.md +18 -0
- package/templates/harness/memory/README.md +22 -0
- package/templates/harness/progress.md +33 -0
- package/templates/harness/rotate-state.mjs +131 -0
- package/templates/harness/verify-state.mjs +117 -0
- package/templates/team/roles/evaluator.md +43 -0
- package/templates/team/roles/implementer.md +29 -0
- package/templates/team/roles/planner.md +28 -0
- package/templates/team/sprint-template.md +36 -0
- package/templates/team/verify-team.mjs +71 -0
- package/templates/team/workflow.md +62 -0
package/AGENTS.md
CHANGED
|
@@ -11,7 +11,7 @@ Chỉ dùng năm bài sau:
|
|
|
11
11
|
- `[S2]` Anthropic, "Effective harnesses for long-running agents".
|
|
12
12
|
- `[S3]` Anthropic, "Building effective agents".
|
|
13
13
|
- `[S4]` Anthropic, "Harness design for long-running application development".
|
|
14
|
-
- `[S5]` Google DeepMind, "AutoHarness:
|
|
14
|
+
- `[S5]` Google DeepMind, "AutoHarness: improving LLM agents by automatically synthesizing a code harness".
|
|
15
15
|
|
|
16
16
|
Không thêm resource, citation, paper, DOI, benchmark, hoặc blog khác nếu người
|
|
17
17
|
dùng chưa yêu cầu mở rộng phạm vi.
|
|
@@ -25,19 +25,31 @@ dùng chưa yêu cầu mở rộng phạm vi.
|
|
|
25
25
|
`docs/harness-engineering/implementation-playbook.md`.
|
|
26
26
|
- Danh mục nguồn đã xác minh nằm ở `docs/harness-engineering/sources.md`.
|
|
27
27
|
- Skill thực hành tạo harness nằm ở `skills/creator-harness/SKILL.md`.
|
|
28
|
+
- Skill ghi mistake thành lesson và promote rule lặp lại nằm ở
|
|
29
|
+
`skills/lessons-harness/SKILL.md`.
|
|
28
30
|
|
|
29
31
|
## Bắt đầu session
|
|
30
32
|
|
|
31
|
-
1. Đọc `README.md`, `progress.md`, và `feature_list.json`.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
1. Đọc `README.md`, `progress.md`, và `feature_list.json`. Đây là file nóng,
|
|
34
|
+
chỉ giữ entry gần nhất và capability đang active; lịch sử cũ nằm ở
|
|
35
|
+
`memory/progress/` và `memory/features-archive.json`, chỉ đọc khi cần tra
|
|
36
|
+
cứu. Khi `progress.md` vượt 400 dòng, verify sẽ fail và yêu cầu chạy
|
|
37
|
+
`node templates/harness/rotate-state.mjs .` để archive.
|
|
38
|
+
2. Đọc `lessons.md` để biết mistake đang chờ promote và rule rút ra từ session
|
|
39
|
+
trước; lesson đã promote nằm ở `memory/lessons/`.
|
|
40
|
+
3. Xem lịch sử git gần nhất để nhận biết thay đổi đang tiếp tục.
|
|
41
|
+
4. Chạy `./init.sh` để kiểm tra baseline rẻ nhất trước khi sửa.
|
|
42
|
+
5. Khi task thay đổi hành vi, guardrail, package, script, test, skill, hoặc
|
|
35
43
|
quy tắc agent, chỉ đánh dấu feature đã verify sau khi lệnh kiểm tra liên quan
|
|
36
44
|
pass.
|
|
37
|
-
|
|
45
|
+
6. Với các thay đổi ở mục 5, luôn cập nhật `feature_list.json` và `progress.md`
|
|
38
46
|
trước khi hoàn tất, kể cả task nhỏ. Chỉ task chỉnh nội dung nghiên cứu thuần
|
|
39
47
|
túy mới có thể chỉ ghi `progress.md` khi kéo dài. Mục `Relevant files` trong
|
|
40
48
|
entry mới nhất của progress phải liệt kê các artifact hành vi đã đổi.
|
|
49
|
+
7. Khi một gate, test, hoặc review bắt mistake do agent gây ra, dùng
|
|
50
|
+
`$lessons-harness` để ghi lesson vào `lessons.md` trước khi kết thúc
|
|
51
|
+
session. Khi cùng một rule xuất hiện lần thứ hai, promote nó vào
|
|
52
|
+
`AGENTS.md` hoặc `scripts/verify-harness.mjs`.
|
|
41
53
|
|
|
42
54
|
## Lệnh chuẩn
|
|
43
55
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thoai Nguyen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -27,6 +27,9 @@ Kho này biến năm nguồn thành một harness tối thiểu cho Codex:
|
|
|
27
27
|
planner, evaluator, hoặc orchestration mặc định [S3], [S4].
|
|
28
28
|
4. Cung cấp skill thực hành để tạo, chốt scope, verify, và cleanup harness trong
|
|
29
29
|
công việc dài hạn của Codex [S1], [S2], [S4], [S5].
|
|
30
|
+
5. Đóng vòng lặp học từ mistake: ghi lesson khi gate hoặc review bắt lỗi, và
|
|
31
|
+
promote rule lặp lại thành guardrail cơ học để Codex không lặp lại lỗi cũ
|
|
32
|
+
ở session sau [S1], [S2], [S5].
|
|
30
33
|
|
|
31
34
|
## Năm nguồn duy nhất
|
|
32
35
|
|
|
@@ -36,21 +39,24 @@ Kho này biến năm nguồn thành một harness tối thiểu cho Codex:
|
|
|
36
39
|
| `[S2]` | Anthropic, "Effective harnesses for long-running agents" | Mẫu state handoff cho agent dài hạn: feature list, progress file, setup, git history, và kiểm thử đầu-cuối |
|
|
37
40
|
| `[S3]` | Anthropic, "Building effective agents" | Nguyên tắc bắt đầu đơn giản, phân biệt workflow với agent, và chỉ tăng complexity khi tradeoff đáng giá |
|
|
38
41
|
| `[S4]` | Anthropic, "Harness design for long-running application development" | Planner-generator-evaluator, sprint contract, evaluator riêng, và QA runtime cho task ứng dụng dài |
|
|
39
|
-
| `[S5]` | Google DeepMind, "AutoHarness:
|
|
42
|
+
| `[S5]` | Google DeepMind, "AutoHarness: improving LLM agents by automatically synthesizing a code harness" | AutoHarness tự động sinh lớp bọc thực thi chặn hành động không hợp lệ và sinh policy thành code tĩnh (code-as-policy) để giảm chi phí runtime |
|
|
40
43
|
|
|
41
44
|
## Bản đồ tài liệu
|
|
42
45
|
|
|
43
46
|
| File | Mục đích |
|
|
44
47
|
| --- | --- |
|
|
45
48
|
| `docs/harness-engineering/index.md` | Mục lục và thứ tự đọc |
|
|
46
|
-
| `docs/harness-engineering/research-note.md` | Bản
|
|
49
|
+
| `docs/harness-engineering/research-note.md` | Bản white paper nguồn-truth |
|
|
47
50
|
| `docs/harness-engineering/implementation-playbook.md` | Playbook triển khai harness cho repository |
|
|
48
51
|
| `docs/harness-engineering/sources.md` | Metadata và bản đồ bằng chứng cho năm nguồn |
|
|
49
52
|
| `skills/creator-harness/SKILL.md` | Skill thực hành tạo harness tối thiểu |
|
|
50
53
|
| `skills/acceptance-contract/SKILL.md` | Skill chốt scope, tiêu chí done, và verification trước khi làm |
|
|
51
54
|
| `skills/cleanup-harness/SKILL.md` | Skill cleanup có trigger, acceptance criteria, và rollback |
|
|
55
|
+
| `skills/lessons-harness/SKILL.md` | Skill ghi mistake thành lesson và promote rule lặp lại thành guardrail cơ học |
|
|
52
56
|
| `progress.md` | Trạng thái bền vững để session sau tiếp tục công việc |
|
|
53
57
|
| `feature_list.json` | Danh sách capability harness và điều kiện verify |
|
|
58
|
+
| `lessons.md` | Mistake đang chờ promote và rule rút ra từ đó |
|
|
59
|
+
| `memory/README.md` | Contract của lớp lạnh và layout archive |
|
|
54
60
|
| `init.sh` | Smoke test đầu session |
|
|
55
61
|
|
|
56
62
|
## Phát hành qua NPM
|
|
@@ -62,7 +68,7 @@ Chạy lệnh sau ở root của project muốn nhận docs:
|
|
|
62
68
|
npx codex-harness-engineering init
|
|
63
69
|
```
|
|
64
70
|
|
|
65
|
-
Lệnh này copy
|
|
71
|
+
Lệnh này copy 4 skill vào `./.agents/skills` và copy docs vào
|
|
66
72
|
`./docs/harness-engineering` của project hiện tại. Nếu các target đã tồn tại,
|
|
67
73
|
lệnh sẽ dừng để tránh ghi đè. Dùng `--force` khi muốn thay thế bản cũ:
|
|
68
74
|
|
|
@@ -70,6 +76,60 @@ lệnh sẽ dừng để tránh ghi đè. Dùng `--force` khi muốn thay thế
|
|
|
70
76
|
npx codex-harness-engineering init --force
|
|
71
77
|
```
|
|
72
78
|
|
|
79
|
+
Chạy `npx codex-harness-engineering init` để scaffold bộ harness tối thiểu
|
|
80
|
+
cho developer theo chuẩn của playbook. `AGENTS.md`, `progress.md`,
|
|
81
|
+
`feature_list.json`, `lessons.md`, `memory/README.md`, `init.sh`, và
|
|
82
|
+
`verify-state.mjs` được tạo ở root của project từ template trong
|
|
83
|
+
`templates/harness/`:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx codex-harness-engineering init
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`--harness` và `--starter-kit` vẫn được giữ như alias tương thích ngược.
|
|
90
|
+
|
|
91
|
+
Sau khi scaffold, sửa `init.sh` thành lệnh setup + smoke test thật của project
|
|
92
|
+
và điền mục Commands trong `AGENTS.md`. `init.sh` mặc định exit 1 cho tới khi
|
|
93
|
+
được cấu hình để guardrail không pass giả. `node verify-state.mjs` là gate cơ
|
|
94
|
+
học: nó fail khi working tree có thay đổi behavior mà thiếu cập nhật
|
|
95
|
+
`feature_list.json`/`progress.md`, hoặc entry progress mới nhất không nêu tên
|
|
96
|
+
file đã đổi.
|
|
97
|
+
|
|
98
|
+
Scaffold này được viết cho workflow Codex: Codex tự đọc `AGENTS.md` ở đầu mỗi
|
|
99
|
+
session (file này là bản đồ ngắn theo [S1], trỏ tới state và lệnh chuẩn), bốn
|
|
100
|
+
skill cài ở `.agents/skills/` được gọi bằng `$acceptance-contract`,
|
|
101
|
+
`$creator-harness`, `$cleanup-harness`, `$lessons-harness`, và mỗi session kết
|
|
102
|
+
thúc bằng commit + entry `progress.md` làm recovery point cho session sau theo
|
|
103
|
+
[S2].
|
|
104
|
+
|
|
105
|
+
Thêm `--team` khi dự án cần một đội production theo mẫu
|
|
106
|
+
planner-generator-evaluator của [S4]. Lệnh này scaffold cả harness và thư mục
|
|
107
|
+
`team/` gồm `team/workflow.md` (pipeline plan → build → evaluate → ship), ba
|
|
108
|
+
role contract trong `team/roles/` (planner, implementer, evaluator — mỗi role
|
|
109
|
+
là một session Codex riêng, handoff qua artifact trong `team/sprints/`),
|
|
110
|
+
`team/sprint-template.md`, và gate `team/verify-team.mjs` — sprint không thể
|
|
111
|
+
mang `Status: done` nếu thiếu `evaluation.md` với `Verdict: pass` từ
|
|
112
|
+
evaluator:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npx codex-harness-engineering init --team
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Memory của harness chia hai lớp theo progressive disclosure [S1] để dự án kéo
|
|
119
|
+
dài không làm phình file nóng: `progress.md`, `feature_list.json`, và
|
|
120
|
+
`lessons.md` chỉ giữ entry gần nhất, capability đang active, và mistake/rule
|
|
121
|
+
chưa promote; contract của lớp lạnh nằm ở `memory/README.md`; lịch sử cũ nằm
|
|
122
|
+
ở `memory/progress/<YYYY-MM>.md`, `memory/features-archive.json`, và
|
|
123
|
+
`memory/lessons/<YYYY-MM>.md`. Chạy `node rotate-state.mjs` để archive; gate
|
|
124
|
+
`verify-state.mjs` tự fail khi `progress.md` hoặc `lessons.md` vượt budget
|
|
125
|
+
400 dòng để nhắc rotate.
|
|
126
|
+
|
|
127
|
+
`lessons.md` và skill `$lessons-harness` là vòng lặp học từ mistake: mỗi lần
|
|
128
|
+
gate, test, hoặc review bắt lỗi do agent gây ra, agent ghi lesson với root
|
|
129
|
+
cause và rule; khi cùng một rule lặp lại, rule được promote thành dòng trong
|
|
130
|
+
`AGENTS.md` hoặc một check trong `verify-state.mjs` để mistake không lặp lại ở
|
|
131
|
+
session sau [S1], [S5].
|
|
132
|
+
|
|
73
133
|
Khi phát triển local:
|
|
74
134
|
|
|
75
135
|
```bash
|
|
@@ -106,7 +166,9 @@ Khi bắt đầu một task trong repo phần mềm khác, dùng kho này như h
|
|
|
106
166
|
Codex.
|
|
107
167
|
4. Dùng `skills/cleanup-harness/SKILL.md` khi throughput của Codex tạo drift,
|
|
108
168
|
orphan, hoặc entropy cần cleanup định kỳ.
|
|
109
|
-
5.
|
|
169
|
+
5. Dùng `skills/lessons-harness/SKILL.md` khi một gate, test, hoặc review bắt
|
|
170
|
+
lỗi do Codex gây ra; ghi lesson và promote rule lặp lại thành guardrail.
|
|
171
|
+
6. Chỉ thêm evaluator, planner, hoặc sprint contract khi task thật sự có scope
|
|
110
172
|
dài, chất lượng chủ quan, hoặc runtime khó tự đánh giá.
|
|
111
173
|
|
|
112
174
|
## Kết luận cốt lõi
|
|
@@ -114,7 +176,7 @@ Khi bắt đầu một task trong repo phần mềm khác, dùng kho này như h
|
|
|
114
176
|
Từ năm bài này, harness engineering cho Codex không nên được hiểu là thêm nhiều
|
|
115
177
|
agent mặc định. Nó là một lớp điều khiển gồm state bền vững, tool dễ đọc,
|
|
116
178
|
acceptance criteria, kiểm thử runtime, evaluator khi cần, guardrail cơ học, dọn dẹp
|
|
117
|
-
hệ thống, và
|
|
179
|
+
hệ thống, và cơ chế tự động tổng hợp lớp bọc thực thi.
|
|
118
180
|
|
|
119
181
|
Nguyên tắc thực dụng:
|
|
120
182
|
|
|
@@ -125,7 +187,8 @@ Nguyên tắc thực dụng:
|
|
|
125
187
|
4. Khi Codex tự đánh giá quá lạc quan, tách generator khỏi evaluator [S4].
|
|
126
188
|
5. Khi throughput tạo drift, biến judgment lặp lại thành lint, test, rule, và
|
|
127
189
|
cleanup có nhịp [S1].
|
|
128
|
-
6. Khi quy tắc phức tạp, dùng AutoHarness tự sinh code wrapper để lọc hành vi
|
|
190
|
+
6. Khi quy tắc phức tạp, dùng AutoHarness tự sinh code wrapper để lọc hành vi
|
|
191
|
+
không hợp lệ trước khi thực thi [S5].
|
|
129
192
|
|
|
130
193
|
## Quy tắc cập nhật
|
|
131
194
|
|