@ksuchoi216/ahe 0.1.6 → 0.1.10
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/README.md +82 -214
- package/bin/ahe +34 -231
- package/package.json +8 -4
- package/packages/ahe-antigravity/bin/ahe-antigravity +325 -0
- package/packages/ahe-antigravity/package.json +7 -0
- package/packages/ahe-antigravity/skills/ahe-git/SKILL.md +35 -0
- package/packages/ahe-antigravity/skills/ahe-ship/SKILL.md +28 -0
- package/packages/ahe-antigravity/skills/ahe-ship/scripts/post-ship-hook.sh +12 -0
- package/packages/ahe-codex/.codex/agents/ahe-harness-manager.toml +19 -0
- package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/AGENTS.md +11 -10
- package/{.codex/ahe-shared/templates/PRODUCT.md → packages/ahe-codex/.codex/ahe-shared/templates/product.md} +1 -1
- package/packages/ahe-codex/.codex/hooks/ahe-hook.js +296 -0
- package/packages/ahe-codex/.codex/skills/ahe/SKILL.md +34 -0
- package/packages/ahe-codex/.codex/skills/ahe-compress/SKILL.md +120 -0
- package/{.codex/skills/ahe-compression → packages/ahe-codex/.codex/skills/ahe-compress}/agents/openai.yaml +1 -1
- package/{.codex/skills/ahe-compression → packages/ahe-codex/.codex/skills/ahe-compress}/scripts/check-harness-size.sh +18 -6
- package/packages/ahe-codex/.codex/skills/ahe-compress/scripts/detect_stale_tests.py +30 -0
- package/packages/ahe-codex/.codex/skills/ahe-converse/SKILL.md +44 -0
- package/packages/ahe-codex/.codex/skills/ahe-feature/SKILL.md +25 -0
- package/packages/ahe-codex/.codex/skills/ahe-fix/SKILL.md +59 -0
- package/packages/ahe-codex/.codex/skills/ahe-fix/scripts/write_fix_plan.py +108 -0
- package/packages/ahe-codex/.codex/skills/ahe-git/SKILL.md +34 -0
- package/packages/ahe-codex/.codex/skills/ahe-harness/SKILL.md +128 -0
- package/packages/ahe-codex/.codex/skills/ahe-harness-checker/SKILL.md +46 -0
- package/{.codex/skills/ahe-init → packages/ahe-codex/.codex/skills/ahe-new}/SKILL.md +41 -37
- package/packages/ahe-codex/.codex/skills/ahe-overview/SKILL.md +119 -0
- package/packages/ahe-codex/.codex/skills/ahe-review/SKILL.md +43 -0
- package/packages/ahe-codex/.codex/skills/ahe-ship/SKILL.md +58 -0
- package/packages/ahe-codex/.codex/skills/ahe-ship/agents/openai.yaml +4 -0
- package/packages/ahe-codex/.codex/skills/ahe-ship/scripts/write_plan.py +107 -0
- package/packages/ahe-codex/.codex/skills/ahe-solve/SKILL.md +30 -0
- package/packages/ahe-codex/.codex/skills/ahe-think/SKILL.md +114 -0
- package/packages/ahe-codex/bin/ahe-codex +398 -0
- package/packages/ahe-codex/package.json +7 -0
- package/.codex/hooks/ahe-hook.js +0 -236
- package/.codex/skills/ahe-compression/SKILL.md +0 -97
- package/.codex/skills/ahe-conversation/SKILL.md +0 -73
- package/.codex/skills/ahe-spec/SKILL.md +0 -63
- package/.codex/skills/ahe-thinking/SKILL.md +0 -104
- package/.codex/skills/ahe-update/SKILL.md +0 -66
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/config.yaml +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/schemas/feature-list-schema.json +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/schemas/process_status.schema.json +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/INSTRUCTIONS.md +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/feature-list.json +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/init.sh +0 -0
- /package/{.codex/ahe-shared/templates/PROGRESS.md → packages/ahe-codex/.codex/ahe-shared/templates/progress.md} +0 -0
- /package/{.codex/ahe-shared/templates/SESSION-HANDOFF.md → packages/ahe-codex/.codex/ahe-shared/templates/session-handoff.md} +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/hooks/hooks.json +0 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const AHE_DIRECTIVE_MARKER = "<ahe-mode>";
|
|
3
|
+
|
|
4
|
+
const STATUS_TABLE_LINES = [
|
|
5
|
+
" - Start the response with a concise status report table.",
|
|
6
|
+
" - Use this consistent Markdown table format:",
|
|
7
|
+
" | Item | Content |",
|
|
8
|
+
" |---|---|",
|
|
9
|
+
" | AGENTS.md | Exists/missing, purpose status, and any obvious issue. |",
|
|
10
|
+
" | product.md | Exists/missing, completion state, and whether product scope needs work. |",
|
|
11
|
+
" | INSTRUCTIONS.md | Exists/missing, and whether instruction boundaries need work. |",
|
|
12
|
+
" | feature-list.json | Valid/missing/invalid, unfinished feature summary, and all-done status. |",
|
|
13
|
+
" | progress.md | Exists/missing and current session state. |",
|
|
14
|
+
" - Keep the table short and readable.",
|
|
15
|
+
" - Do not include the next step inside the table.",
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const CODEGRAPH_PREFLIGHT_LINES = [
|
|
19
|
+
"1. Run CodeGraph preflight before inspecting harness status:",
|
|
20
|
+
" - Check whether the CodeGraph CLI is installed with `command -v codegraph`.",
|
|
21
|
+
" - If the `codegraph` command is not installed, report `NOT INSTALLATION of codegraph`, skip `codegraph init` and `codegraph sync`, and continue with normal repo inspection.",
|
|
22
|
+
" - If `.codegraph/` does not exist, run `codegraph init` before reviewing code.",
|
|
23
|
+
" - If `.codegraph/` exists, run `codegraph sync` before reviewing code.",
|
|
24
|
+
"",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const COMMON_ROUTING_LINES = [
|
|
28
|
+
...CODEGRAPH_PREFLIGHT_LINES,
|
|
29
|
+
"2. Inspect current harness state before choosing a workflow:",
|
|
30
|
+
" - Check `AGENTS.md`.",
|
|
31
|
+
" - Read all existing `docs/*.md` files as supporting project context, even when `AGENTS.md` does not name them directly.",
|
|
32
|
+
" - Check `docs/product.md` and `docs/INSTRUCTIONS.md` as the product/specification source of truth.",
|
|
33
|
+
" - Treat `docs/product.md` as overview context and optional `docs/product1.md`, `docs/product2.md`, and later numeric suffix files as ordered product stages.",
|
|
34
|
+
" - Ignore non-numeric product docs such as `docs/product-alpha.md` when choosing product stage order.",
|
|
35
|
+
" - Choose the active product source by numeric suffix order: first `docs/product1.md`, then `docs/product2.md`, and so on, using the first stage whose derived work is not complete.",
|
|
36
|
+
" - Always derive features from only the active product stage; keep future product stages as context until earlier stages are done.",
|
|
37
|
+
" - Check `feature-list.json` as a derived tracker.",
|
|
38
|
+
" - Check `progress.md`.",
|
|
39
|
+
" - Use `ahe-think` as the internal decision layer before choosing the next action.",
|
|
40
|
+
" - Before reading large harness files wholesale, let `ahe-think` run the `ahe-compress` size detector and test-overlap detector. Call `ahe-compress` if compression is required.",
|
|
41
|
+
"",
|
|
42
|
+
"2. Review code through CodeGraph when available:",
|
|
43
|
+
" - Prefer CodeGraph MCP or CodeGraph exploration for code review and impact context after the preflight command succeeds.",
|
|
44
|
+
" - If CodeGraph is not installed, skip CodeGraph review and rely on normal repo inspection.",
|
|
45
|
+
"",
|
|
46
|
+
"3. Make the first response a simple harness engineering status report table before proceeding:",
|
|
47
|
+
...STATUS_TABLE_LINES,
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const AHE_PROGRESS_DIRECTIVE = [
|
|
51
|
+
AHE_DIRECTIVE_MARKER,
|
|
52
|
+
"AHE automatic operation activated.",
|
|
53
|
+
"",
|
|
54
|
+
"The user sent the exact AHE command. Operate as the Awesome Harness Engineering router:",
|
|
55
|
+
"",
|
|
56
|
+
...CODEGRAPH_PREFLIGHT_LINES,
|
|
57
|
+
...COMMON_ROUTING_LINES,
|
|
58
|
+
"",
|
|
59
|
+
"4. Decide the next AHE workflow with `ahe-think`:",
|
|
60
|
+
" - Automatically invoke `@ahe-harness-manager` before `ahe-think` chooses the next workflow if the harness state needs supervision (missing/invalid harness files, unfinished features, completed trackers with possible next work, or code/docs/tracker mismatch).",
|
|
61
|
+
" - Route through `ahe-think` first.",
|
|
62
|
+
" - If no harness files exist, route to `ahe-new`.",
|
|
63
|
+
" - If `docs/product.md` or `docs/INSTRUCTIONS.md` is missing or empty, classify the state as `harness engineering not enough`.",
|
|
64
|
+
" - If `feature-list.json` is missing or invalid, generating an empty one from template is allowed, but do not write specific features until `docs/product.md` and `docs/INSTRUCTIONS.md` are created and organized.",
|
|
65
|
+
" - When numbered product stages exist, let `ahe-feature` derive feature-list items from only the active product stage.",
|
|
66
|
+
" - Advance from `docs/product1.md` to `docs/product2.md` only after all feature-list items derived from `docs/product1.md` are `done`; repeat this rule for later numeric stages.",
|
|
67
|
+
" - If any feature in `feature-list.json` has a status other than `done`, classify the state as `in the middle of building features` and continue the first unfinished feature whose dependencies are satisfied.",
|
|
68
|
+
" - If all features are `done` and no obvious harness gap remains, classify the state as `completed all` and ask the user for the next task.",
|
|
69
|
+
" - Call `ahe-review` when repo or code understanding is needed.",
|
|
70
|
+
" - Call `ahe-converse` when the next safe step is blocked on user input.",
|
|
71
|
+
" - Call `ahe-harness` when product docs, instructions, tracking, todo sync, or compression-aware harness maintenance must change.",
|
|
72
|
+
" - Call `ahe-harness-checker` to validate and repair generated harness artifacts after bootstrap or harness maintenance work.",
|
|
73
|
+
" - Call `ahe-feature` to size and extract new features.",
|
|
74
|
+
" - Call `ahe-solve` when the next job is solving or planning a feature.",
|
|
75
|
+
"",
|
|
76
|
+
"5. After the table, classify the harness into exactly one state.",
|
|
77
|
+
" - Use exactly one state: `harness engineering not enough`, `in the middle of building features`, or `completed all`.",
|
|
78
|
+
" - Do not include the next step inside the table.",
|
|
79
|
+
" - Continue automatically after classification.",
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
const AHE_NEW_DIRECTIVE = [
|
|
83
|
+
AHE_DIRECTIVE_MARKER,
|
|
84
|
+
"AHE automatic operation activated.",
|
|
85
|
+
"",
|
|
86
|
+
"The user sent the exact AHE new command. Treat this as a possible new start request:",
|
|
87
|
+
"",
|
|
88
|
+
...CODEGRAPH_PREFLIGHT_LINES,
|
|
89
|
+
"2. Route to `ahe-think` first.",
|
|
90
|
+
"3. `ahe-think` must route to `ahe-new`.",
|
|
91
|
+
"4. Automatically invoke `@ahe-harness-manager` only when existing harness files need review before determining the restart scope.",
|
|
92
|
+
"5. If no AHE-managed harness files exist, start initialization normally.",
|
|
93
|
+
"6. If any AHE-managed harness file exists, read the existing files, summarize the current project purpose and product specification state, and ask what restart scope the user wants.",
|
|
94
|
+
"7. Do not remove, overwrite, or refresh existing harness files before the user answers the restart-scope question.",
|
|
95
|
+
"8. If the chosen restart scope replaces prior harness history, summarize that replaced state in the refreshed tracking artifacts instead of creating backup copies.",
|
|
96
|
+
"9. Interpret the restart scope from the user's free-form answer; examples like `purpose` and `product` are not a closed list.",
|
|
97
|
+
"10. Product/instructions specification details belong in `docs/product.md` and `docs/INSTRUCTIONS.md`, not `AGENTS.md`.",
|
|
98
|
+
"11. After setup, call `ahe-harness` to build the initial product, instructions, and tracking state, and end with `ahe-harness-checker` validation/fix before the harness is considered usable.",
|
|
99
|
+
"12. Use `ahe-think` before clarification when the next setup step is uncertain.",
|
|
100
|
+
"13. If clarification is needed, call `ahe-converse` for the exact missing detail.",
|
|
101
|
+
].join("\n");
|
|
102
|
+
|
|
103
|
+
const AHE_SHIP_DIRECTIVE = [
|
|
104
|
+
AHE_DIRECTIVE_MARKER,
|
|
105
|
+
"AHE plan export activated.",
|
|
106
|
+
"",
|
|
107
|
+
"The user invoked `ahe-ship`.",
|
|
108
|
+
"",
|
|
109
|
+
...CODEGRAPH_PREFLIGHT_LINES,
|
|
110
|
+
"2. Immediately call the `ahe-ship` skill.",
|
|
111
|
+
"3. Detect if the current conversation is still in Plan Mode.",
|
|
112
|
+
"4. If Plan Mode is active, the Codex host must exit Plan Mode and replay the command.",
|
|
113
|
+
"5. Outside Plan Mode, use the most recent `<proposed_plan>` already visible in this conversation.",
|
|
114
|
+
"6. Do not ask for the plan again when the latest plan is unambiguous.",
|
|
115
|
+
"7. Derive `plan_name` from the plan title and create `.plans/{plan_name}.md`.",
|
|
116
|
+
"8. Add compact handoff context for Antigravity or another LLM platform.",
|
|
117
|
+
"9. Use `.codex/skills/ahe-ship/scripts/write_plan.py` to write the final markdown and stop.",
|
|
118
|
+
"",
|
|
119
|
+
"Do not run the normal AHE harness workflow.",
|
|
120
|
+
].join("\n");
|
|
121
|
+
|
|
122
|
+
const AHE_FIX_DIRECTIVE = [
|
|
123
|
+
AHE_DIRECTIVE_MARKER,
|
|
124
|
+
"AHE fix planning activated.",
|
|
125
|
+
"",
|
|
126
|
+
"The user invoked `ahe-fix`.",
|
|
127
|
+
"",
|
|
128
|
+
...CODEGRAPH_PREFLIGHT_LINES,
|
|
129
|
+
"2. Route to `ahe-think` first.",
|
|
130
|
+
"3. `ahe-think` must immediately call the `ahe-fix` skill.",
|
|
131
|
+
"4. Automatically invoke `@ahe-harness-manager` only when the fix target may conflict with current harness state.",
|
|
132
|
+
"5. Understand the user's error, bug, mismatch, or intended change from the current conversation and repository context.",
|
|
133
|
+
"6. Create a concrete fix plan for fixing errors or following the user's intention when it differs from normal AHE continuation.",
|
|
134
|
+
"7. If the fix goal, scope, or success criteria are unclear, call `ahe-converse` and ask one focused question before writing the plan.",
|
|
135
|
+
"8. Derive `plan_name` from the fix goal and create `.plans/{plan_name}.md`.",
|
|
136
|
+
"9. Use `.codex/skills/ahe-fix/scripts/write_fix_plan.py` to write the final markdown.",
|
|
137
|
+
"",
|
|
138
|
+
"Do not run the normal AHE harness workflow.",
|
|
139
|
+
].join("\n");
|
|
140
|
+
|
|
141
|
+
const AHE_GIT_DIRECTIVE = [
|
|
142
|
+
AHE_DIRECTIVE_MARKER,
|
|
143
|
+
"AHE Git activated.",
|
|
144
|
+
"",
|
|
145
|
+
"The user invoked `ahe-git`.",
|
|
146
|
+
"",
|
|
147
|
+
...CODEGRAPH_PREFLIGHT_LINES,
|
|
148
|
+
"2. Route to `ahe-think` first.",
|
|
149
|
+
"3. `ahe-think` must immediately call the `ahe-git` skill.",
|
|
150
|
+
"",
|
|
151
|
+
"Do not run the normal AHE harness workflow.",
|
|
152
|
+
].join("\n");
|
|
153
|
+
|
|
154
|
+
const AHE_OVERVIEW_DIRECTIVE = [
|
|
155
|
+
AHE_DIRECTIVE_MARKER,
|
|
156
|
+
"AHE overview activated.",
|
|
157
|
+
"",
|
|
158
|
+
"The user invoked `ahe-overview`.",
|
|
159
|
+
"",
|
|
160
|
+
...CODEGRAPH_PREFLIGHT_LINES,
|
|
161
|
+
"2. Read `.codex/skills/ahe-overview/SKILL.md`.",
|
|
162
|
+
"3. Present its contents to explain the AHE concept to the user.",
|
|
163
|
+
"",
|
|
164
|
+
"Do not run the normal AHE harness workflow.",
|
|
165
|
+
].join("\n");
|
|
166
|
+
|
|
167
|
+
function normalizePrompt(prompt) {
|
|
168
|
+
return prompt.trim().replace(/\s+/g, " ").toLowerCase();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function isExactAheCommand(prompt) {
|
|
172
|
+
return normalizePrompt(prompt) === "ahe";
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function isExactAheNewCommand(prompt) {
|
|
176
|
+
const normalizedPrompt = normalizePrompt(prompt);
|
|
177
|
+
return normalizedPrompt === "ahe-new" || normalizedPrompt === "ahe new";
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function isExactAheShipCommand(prompt) {
|
|
181
|
+
const normalizedPrompt = normalizePrompt(prompt);
|
|
182
|
+
return normalizedPrompt === "ahe-ship" || normalizedPrompt === "ahe ship";
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function isExactAheFixCommand(prompt) {
|
|
186
|
+
const normalizedPrompt = normalizePrompt(prompt);
|
|
187
|
+
return normalizedPrompt === "ahe-fix" || normalizedPrompt === "ahe fix";
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function isExactAheGitCommand(prompt) {
|
|
191
|
+
const normalizedPrompt = normalizePrompt(prompt);
|
|
192
|
+
return normalizedPrompt === "ahe-git" || normalizedPrompt === "ahe git";
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function isExactAheOverviewCommand(prompt) {
|
|
196
|
+
return normalizePrompt(prompt) === "ahe-overview";
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async function main() {
|
|
200
|
+
let raw = "";
|
|
201
|
+
process.stdin.setEncoding("utf8");
|
|
202
|
+
for await (const chunk of process.stdin) {
|
|
203
|
+
raw += chunk;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (!raw.trim()) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
let parsed;
|
|
211
|
+
try {
|
|
212
|
+
parsed = JSON.parse(raw);
|
|
213
|
+
} catch {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (
|
|
218
|
+
parsed &&
|
|
219
|
+
parsed.hook_event_name === "UserPromptSubmit" &&
|
|
220
|
+
typeof parsed.prompt === "string"
|
|
221
|
+
) {
|
|
222
|
+
if (isExactAheCommand(parsed.prompt)) {
|
|
223
|
+
process.stdout.write(
|
|
224
|
+
JSON.stringify({
|
|
225
|
+
hookSpecificOutput: {
|
|
226
|
+
hookEventName: "UserPromptSubmit",
|
|
227
|
+
additionalContext: AHE_PROGRESS_DIRECTIVE.join("\n"),
|
|
228
|
+
},
|
|
229
|
+
}) + "\n"
|
|
230
|
+
);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (isExactAheNewCommand(parsed.prompt)) {
|
|
235
|
+
process.stdout.write(
|
|
236
|
+
JSON.stringify({
|
|
237
|
+
hookSpecificOutput: {
|
|
238
|
+
hookEventName: "UserPromptSubmit",
|
|
239
|
+
additionalContext: AHE_NEW_DIRECTIVE,
|
|
240
|
+
},
|
|
241
|
+
}) + "\n"
|
|
242
|
+
);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (isExactAheShipCommand(parsed.prompt)) {
|
|
247
|
+
process.stdout.write(
|
|
248
|
+
JSON.stringify({
|
|
249
|
+
hookSpecificOutput: {
|
|
250
|
+
hookEventName: "UserPromptSubmit",
|
|
251
|
+
additionalContext: AHE_SHIP_DIRECTIVE,
|
|
252
|
+
},
|
|
253
|
+
}) + "\n"
|
|
254
|
+
);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (isExactAheFixCommand(parsed.prompt)) {
|
|
259
|
+
process.stdout.write(
|
|
260
|
+
JSON.stringify({
|
|
261
|
+
hookSpecificOutput: {
|
|
262
|
+
hookEventName: "UserPromptSubmit",
|
|
263
|
+
additionalContext: AHE_FIX_DIRECTIVE,
|
|
264
|
+
},
|
|
265
|
+
}) + "\n"
|
|
266
|
+
);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (isExactAheGitCommand(parsed.prompt)) {
|
|
271
|
+
process.stdout.write(
|
|
272
|
+
JSON.stringify({
|
|
273
|
+
hookSpecificOutput: {
|
|
274
|
+
hookEventName: "UserPromptSubmit",
|
|
275
|
+
additionalContext: AHE_GIT_DIRECTIVE,
|
|
276
|
+
},
|
|
277
|
+
}) + "\n"
|
|
278
|
+
);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (isExactAheOverviewCommand(parsed.prompt)) {
|
|
283
|
+
process.stdout.write(
|
|
284
|
+
JSON.stringify({
|
|
285
|
+
hookSpecificOutput: {
|
|
286
|
+
hookEventName: "UserPromptSubmit",
|
|
287
|
+
additionalContext: AHE_OVERVIEW_DIRECTIVE,
|
|
288
|
+
},
|
|
289
|
+
}) + "\n"
|
|
290
|
+
);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
main().catch(() => {});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe
|
|
3
|
+
description: Continue existing harness work and route exact `ahe`, `ahe <query>`, and `<query> ahe` requests through the AHE agent network.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE
|
|
7
|
+
|
|
8
|
+
`ahe` is the top-level user-facing Codex skill for continuing existing AHE
|
|
9
|
+
work in the current workspace.
|
|
10
|
+
|
|
11
|
+
## Command Contract
|
|
12
|
+
|
|
13
|
+
- Exact `ahe` means continue existing harness work.
|
|
14
|
+
- `ahe <query>` and `<query> ahe` mean continue AHE work with the user's
|
|
15
|
+
explicit query.
|
|
16
|
+
- `ahe` must route through `ahe-think` as the central decision layer.
|
|
17
|
+
- `ahe` must not replace the dedicated `ahe-new`, `ahe-fix`, or `ahe-ship`
|
|
18
|
+
workflows when the user's prompt matches those command contracts.
|
|
19
|
+
|
|
20
|
+
## Routing
|
|
21
|
+
|
|
22
|
+
- Call `ahe-think` first.
|
|
23
|
+
- Let `ahe-think` choose `ahe-review`, `ahe-converse`, `ahe-harness`, or
|
|
24
|
+
`ahe-solve`.
|
|
25
|
+
- Keep `docs/product.md` as overview context and `feature-list.json` as the
|
|
26
|
+
derived tracker.
|
|
27
|
+
- Actualize the final product through `docs/product{number}.md` stages in
|
|
28
|
+
numeric order when staged product docs exist.
|
|
29
|
+
|
|
30
|
+
## Scope
|
|
31
|
+
|
|
32
|
+
- Use this skill for ongoing harness work, product updates, and explicit AHE
|
|
33
|
+
requests such as `ahe compress`.
|
|
34
|
+
- Do not use this skill for standalone fix-plan export or ship-plan export.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-compress
|
|
3
|
+
description: Internal AHE compression workflow for detecting oversized harness-engineering files or stale overlapping tests, and compacting them before AHE thinker or harness routing reads large context. Use when AGENTS.md, docs/product.md, docs/product{number}.md, docs/INSTRUCTIONS.md, feature-list.json, progress.md, session-handoff.md, docs/todo.md, or other AHE harness artifacts have too many lines or waste context. It also covers stale overlapping tests.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE Compression
|
|
7
|
+
|
|
8
|
+
This is an internal AHE workflow skill, not a user-facing command.
|
|
9
|
+
|
|
10
|
+
Do not treat `$ahe-compress` as a user command.
|
|
11
|
+
Use it after `think` or `harness` decides that harness context is too large to read
|
|
12
|
+
efficiently, or when test-suite cleanup is needed. When the user explicitly asks
|
|
13
|
+
for `ahe compress`, this skill must check both harness-file size pressure and
|
|
14
|
+
stale overlapping tests before deciding the next action.
|
|
15
|
+
|
|
16
|
+
## Test Overlap Detection
|
|
17
|
+
|
|
18
|
+
Run the deterministic test-overlap detector script:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python .codex/skills/compress/scripts/detect_stale_tests.py
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The script checks for legacy tests already covered by newer canonical files and prints `REVIEW_TEST\t<legacy-file>\tcovered_by=<keeper-files>`.
|
|
25
|
+
It exits with code `2` and prints `TEST_COMPRESSION_REQUIRED` when stale candidates exist.
|
|
26
|
+
|
|
27
|
+
Note: `compress` must not directly delete tests; it only signals compression pressure. The actual test consolidation must be routed by `think` through `review` first and then `solve` or `harness` as needed.
|
|
28
|
+
|
|
29
|
+
## Size Detection
|
|
30
|
+
|
|
31
|
+
Run the deterministic line-count preflight before reading full harness files:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
sh .codex/skills/compress/scripts/check-harness-size.sh
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The script checks these AHE-managed files when they exist:
|
|
38
|
+
|
|
39
|
+
- `AGENTS.md`
|
|
40
|
+
- `docs/product.md`
|
|
41
|
+
- numbered product stage docs such as `docs/product1.md` and `docs/product2.md`
|
|
42
|
+
- `docs/INSTRUCTIONS.md`
|
|
43
|
+
- `feature-list.json`
|
|
44
|
+
- `progress.md`
|
|
45
|
+
- `session-handoff.md`
|
|
46
|
+
- `docs/todo.md`
|
|
47
|
+
|
|
48
|
+
Default thresholds are configured in `.codex/ahe-shared/config.yaml`:
|
|
49
|
+
|
|
50
|
+
- `agent_md`: 80
|
|
51
|
+
- `product_md`: 180
|
|
52
|
+
- `instructions_md`: 180
|
|
53
|
+
- `feature_list_json`: 180
|
|
54
|
+
- `progress_md`: 180
|
|
55
|
+
- `session_handoff_md`: 180
|
|
56
|
+
- `todo_md`: 180
|
|
57
|
+
- `total`: 750 (combined harness context limit)
|
|
58
|
+
|
|
59
|
+
Override thresholds only when the workspace has an explicit local rule using environment variables (e.g., `AHE_AGENT_MD_LIMIT`, `AHE_FILE_LINE_LIMIT`, `AHE_TOTAL_LINE_LIMIT`):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
AHE_AGENT_MD_LIMIT=100 AHE_TOTAL_LINE_LIMIT=900 sh .codex/skills/compress/scripts/check-harness-size.sh
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Exit code meanings:
|
|
66
|
+
|
|
67
|
+
- `0`: no compression needed.
|
|
68
|
+
- `2`: compression needed.
|
|
69
|
+
- Output ending in `COMPRESSION_REQUIRED`: compression needed.
|
|
70
|
+
- Any other nonzero code: detector failed; fall back to `wc -l` on the same
|
|
71
|
+
file set and continue the decision manually.
|
|
72
|
+
|
|
73
|
+
## Compression Decision
|
|
74
|
+
|
|
75
|
+
- Run both compression detectors before choosing the next compression step.
|
|
76
|
+
- If the detector exits `2`, compress before normal AHE routing continues.
|
|
77
|
+
- If the harness-size detector exits `2`, compact harness files first.
|
|
78
|
+
- If the stale-test detector exits `2`, route through `review` before any test cleanup.
|
|
79
|
+
- If only one file exceeds the per-file threshold, compress that file first.
|
|
80
|
+
- If total harness context exceeds the total threshold, compress the largest
|
|
81
|
+
AHE-managed files until the total is under the threshold.
|
|
82
|
+
- If `AGENTS.md` is oversized, obey the local `AGENTS.md` instructions before
|
|
83
|
+
editing it. Compress only sections that local rules allow. If no section is
|
|
84
|
+
safely editable, report the blocker and compress other harness files instead.
|
|
85
|
+
- Do not read an oversized file wholesale after detection. Read headings,
|
|
86
|
+
current-status sections, JSON keys, or bounded line ranges needed to preserve
|
|
87
|
+
behavior.
|
|
88
|
+
|
|
89
|
+
## Compression Rules
|
|
90
|
+
|
|
91
|
+
- Preserve active requirements, current decisions, incomplete work, blockers,
|
|
92
|
+
dependencies, and verification evidence.
|
|
93
|
+
- Preserve required headers and file formats for `progress.md`,
|
|
94
|
+
`session-handoff.md`, `feature-list.json`, and `AGENTS.md`.
|
|
95
|
+
- Keep `feature-list.json` valid JSON. Replace stale completed-feature history
|
|
96
|
+
with one summarized done feature, preserve its `id`, `name`, `description`,
|
|
97
|
+
`dependencies`, `status`, and short evidence, and keep current unfinished
|
|
98
|
+
details as-is.
|
|
99
|
+
- Keep `docs/product.md` and `docs/INSTRUCTIONS.md` as the current harness
|
|
100
|
+
contract. Remove duplicate historical wording only when the active contract
|
|
101
|
+
remains clear.
|
|
102
|
+
- Keep numbered product stage docs in numeric suffix order. Ignore non-numeric
|
|
103
|
+
product docs such as `docs/product-alpha.md` for stage ordering.
|
|
104
|
+
- Preserve the active product stage and do not merge future product stages into
|
|
105
|
+
current feature-list work during compression.
|
|
106
|
+
- Keep `progress.md` focused on current status, recent completed work,
|
|
107
|
+
decisions that still matter, blockers, and latest verification.
|
|
108
|
+
- Keep `session-handoff.md` focused on the startup path for the next session,
|
|
109
|
+
important files, open questions, and current verification status.
|
|
110
|
+
- Do not create backup copies when compressing harness history. Preserve useful
|
|
111
|
+
context through concise summaries in the refreshed harness files instead.
|
|
112
|
+
|
|
113
|
+
## Completion
|
|
114
|
+
|
|
115
|
+
- Re-run the size detector after compression.
|
|
116
|
+
- Run JSON validation when `feature-list.json` changed.
|
|
117
|
+
- Run the repository's normal harness verification command when compression
|
|
118
|
+
changed tracked harness files.
|
|
119
|
+
- Update `progress.md` and `session-handoff.md` with the compression evidence
|
|
120
|
+
when they changed or when compression affects the active workflow.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "AHE Compression"
|
|
3
3
|
short_description: "Compress oversized harness context"
|
|
4
|
-
default_prompt: "Use $ahe-
|
|
4
|
+
default_prompt: "Use $ahe-compress to compact oversized AHE harness files before continuing."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: false
|
|
@@ -56,12 +56,23 @@ compression_required=0
|
|
|
56
56
|
if [ "$#" -eq 0 ]; then
|
|
57
57
|
set -- \
|
|
58
58
|
"AGENTS.md" \
|
|
59
|
-
"docs/
|
|
59
|
+
"docs/product.md" \
|
|
60
60
|
"docs/INSTRUCTIONS.md" \
|
|
61
61
|
"feature-list.json" \
|
|
62
|
-
"
|
|
63
|
-
"
|
|
62
|
+
"progress.md" \
|
|
63
|
+
"session-handoff.md" \
|
|
64
64
|
"docs/todo.md"
|
|
65
|
+
|
|
66
|
+
if [ -d "docs" ]; then
|
|
67
|
+
product_stage_number=1
|
|
68
|
+
while [ "${product_stage_number}" -le 999 ]; do
|
|
69
|
+
product_stage_path="docs/product${product_stage_number}.md"
|
|
70
|
+
if [ -f "${product_stage_path}" ]; then
|
|
71
|
+
set -- "$@" "${product_stage_path}"
|
|
72
|
+
fi
|
|
73
|
+
product_stage_number=$((product_stage_number + 1))
|
|
74
|
+
done
|
|
75
|
+
fi
|
|
65
76
|
fi
|
|
66
77
|
|
|
67
78
|
for file_path in "$@"; do
|
|
@@ -77,11 +88,12 @@ for file_path in "$@"; do
|
|
|
77
88
|
current_limit=180
|
|
78
89
|
case "${file_path}" in
|
|
79
90
|
"AGENTS.md") current_limit="${limit_agent_md}" ;;
|
|
80
|
-
"docs/
|
|
91
|
+
"docs/product.md") current_limit="${limit_product_md}" ;;
|
|
92
|
+
"docs/product"[0-9]*".md") current_limit="${limit_product_md}" ;;
|
|
81
93
|
"docs/INSTRUCTIONS.md") current_limit="${limit_instructions_md}" ;;
|
|
82
94
|
"feature-list.json") current_limit="${limit_feature_list_json}" ;;
|
|
83
|
-
"
|
|
84
|
-
"
|
|
95
|
+
"progress.md") current_limit="${limit_progress_md}" ;;
|
|
96
|
+
"session-handoff.md") current_limit="${limit_session_handoff_md}" ;;
|
|
85
97
|
"docs/todo.md") current_limit="${limit_todo_md}" ;;
|
|
86
98
|
*) current_limit="${AHE_FILE_LINE_LIMIT:-180}" ;;
|
|
87
99
|
esac
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
def main():
|
|
5
|
+
test_dir = "tests"
|
|
6
|
+
if not os.path.isdir(test_dir):
|
|
7
|
+
sys.exit(0)
|
|
8
|
+
|
|
9
|
+
overlap_map = {
|
|
10
|
+
"test_new_workflow.py": ["test_ahe_new.py"],
|
|
11
|
+
"test_spec_workflow.py": ["test_clarification_prompt.py", "test_ahe_new.py"],
|
|
12
|
+
"test_specialized_workflows.py": ["test_ahe_new.py", "test_clarification_prompt.py", "test_command_set.py"]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
stale_found = False
|
|
16
|
+
for legacy_file, keeper_files in overlap_map.items():
|
|
17
|
+
legacy_path = os.path.join(test_dir, legacy_file)
|
|
18
|
+
if os.path.exists(legacy_path):
|
|
19
|
+
stale_found = True
|
|
20
|
+
keepers_str = ",".join(f"tests/{f}" for f in keeper_files)
|
|
21
|
+
print(f"REVIEW_TEST\ttests/{legacy_file}\tcovered_by={keepers_str}")
|
|
22
|
+
|
|
23
|
+
if stale_found:
|
|
24
|
+
print("TEST_COMPRESSION_REQUIRED")
|
|
25
|
+
sys.exit(2)
|
|
26
|
+
else:
|
|
27
|
+
sys.exit(0)
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
main()
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-converse
|
|
3
|
+
description: Internal AHE conversation protocol for recursive clarification, conversation state, and resume-aware workflow guidance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE Conversator
|
|
7
|
+
|
|
8
|
+
This is an internal AHE workflow skill, not a user-facing command.
|
|
9
|
+
|
|
10
|
+
Do not treat `$ahe-converse` as a user command.
|
|
11
|
+
Use it after `ahe-think` or another AHE agent identifies a missing decision or
|
|
12
|
+
missing `Why`, `What`, or `How`.
|
|
13
|
+
|
|
14
|
+
## When To Converse
|
|
15
|
+
|
|
16
|
+
- Ask one question at a time.
|
|
17
|
+
- Use conversation state when multiple answers are needed across turns.
|
|
18
|
+
- Clarify product intent, instructions, next feature, restart scope, or any
|
|
19
|
+
decision that materially changes the workflow.
|
|
20
|
+
- If the answer can be derived safely from repo state, do that instead of
|
|
21
|
+
asking.
|
|
22
|
+
|
|
23
|
+
## Conversation Protocol
|
|
24
|
+
|
|
25
|
+
- Inspect relevant files before asking.
|
|
26
|
+
- Explain the blocked decision briefly.
|
|
27
|
+
- Use a Codex-supported structured response request when it helps.
|
|
28
|
+
- Ask exactly one focused question at a time.
|
|
29
|
+
- Continue recursively until the answer is specific enough to unblock the
|
|
30
|
+
calling workflow.
|
|
31
|
+
|
|
32
|
+
## State Persistence
|
|
33
|
+
|
|
34
|
+
- Update `status.json` before pausing for user input.
|
|
35
|
+
- Preserve the current command, current_step, workflow_complete, and files map.
|
|
36
|
+
- Update `progress.md` and `session-handoff.md` when the pending question
|
|
37
|
+
changes the workflow state.
|
|
38
|
+
|
|
39
|
+
## Resume Protocol
|
|
40
|
+
|
|
41
|
+
- Read `status.json` and the relevant workflow artifacts.
|
|
42
|
+
- Summarize the current state briefly.
|
|
43
|
+
- Ask the next focused question or return control to the caller when the answer
|
|
44
|
+
resolves the missing detail.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-feature
|
|
3
|
+
description: Internal AHE workflow skill for creating right-sized feature-list.json entries from product context.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE Feature
|
|
7
|
+
|
|
8
|
+
This is an internal AHE workflow skill, not a user-facing command.
|
|
9
|
+
Use it when `ahe-think` or another worker decides that feature sizes must be evaluated or when generating new features from product context.
|
|
10
|
+
|
|
11
|
+
## Command Workflow: ahe-feature
|
|
12
|
+
|
|
13
|
+
### Feature Generation and Sizing
|
|
14
|
+
|
|
15
|
+
- Derive concrete feature items from only the active product stage (e.g. `docs/product1.md`), not future stages.
|
|
16
|
+
- Create right-sized `feature-list.json` entries from product context.
|
|
17
|
+
- Avoid tiny task fragments. A feature should represent a meaningful, verifiable unit of work.
|
|
18
|
+
- Avoid vague, oversized features. Break large epics down into testable, implementable features.
|
|
19
|
+
- If product context is insufficient to create right-sized features, use `ahe-converse` to ask the user for clarification.
|
|
20
|
+
- Update `feature-list.json` with the newly derived, well-sized features.
|
|
21
|
+
- Ensure that features are actionable and have clear success criteria based on the product documentation.
|
|
22
|
+
|
|
23
|
+
### Clarification Rule
|
|
24
|
+
|
|
25
|
+
When feature sizing or extraction is ambiguous, follow the `ahe-think` protocol first. If `ahe-think` finds missing information, follow the `ahe-converse` protocol to ask the user for the exact missing detail.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-fix
|
|
3
|
+
description: Create a concrete `.plans/{plan_name}.md` fix plan for errors, bugs, or user-intent changes. Use when the user explicitly invokes `$fix`, `fix`, `ahe fix`, `ahe fix <query>`, or `<query> ahe fix`, and call `converse` when the plan needs clarification.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE Fix
|
|
7
|
+
|
|
8
|
+
`fix` is a user-facing AHE command for creating a fix plan. It is separate
|
|
9
|
+
from the normal `ahe` continuation workflow, including the thinker-routed
|
|
10
|
+
`ahe <query>` and `<query> ahe` forms.
|
|
11
|
+
|
|
12
|
+
Use this skill when the user wants a plan for fixing errors or following their
|
|
13
|
+
current intention when it differs from the previous AHE flow.
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
1. Inspect the current conversation and relevant repository context.
|
|
18
|
+
2. Identify the fix target:
|
|
19
|
+
- error, failure, regression, or broken behavior to repair.
|
|
20
|
+
- user intention that differs from the existing AHE direction.
|
|
21
|
+
3. If the fix goal, scope, or success criteria are unclear, call
|
|
22
|
+
`converse` and ask one focused question before writing the plan.
|
|
23
|
+
4. Derive `plan_name` from the fix goal. Use a short lowercase hyphenated name.
|
|
24
|
+
If no safe name can be derived, ask one focused question for the plan name.
|
|
25
|
+
5. Build a compact markdown plan with these sections:
|
|
26
|
+
- `# {Fix Plan Title}`
|
|
27
|
+
- `## Fix Goal`
|
|
28
|
+
- `## Current Evidence`
|
|
29
|
+
- `## Assumptions`
|
|
30
|
+
- `## Scope`
|
|
31
|
+
- `## Steps`
|
|
32
|
+
- `## Verification Plan`
|
|
33
|
+
- `## Risks and Open Questions`
|
|
34
|
+
- `## Instructions for Next Agent`
|
|
35
|
+
6. Write the final markdown through `scripts/write_fix_plan.py`.
|
|
36
|
+
7. Report the created `.plans/{plan_name}.md` path.
|
|
37
|
+
|
|
38
|
+
## Missing Context
|
|
39
|
+
|
|
40
|
+
- If the requested fix is ambiguous, use `converse` instead of guessing.
|
|
41
|
+
- If the target file already exists, ask whether to overwrite it or choose a
|
|
42
|
+
distinct plan name.
|
|
43
|
+
- Do not update `feature-list.json`, `progress.md`, or `session-handoff.md`
|
|
44
|
+
for a normal fix-plan export unless the user explicitly asks for harness
|
|
45
|
+
tracking changes too.
|
|
46
|
+
|
|
47
|
+
## Writer Script
|
|
48
|
+
|
|
49
|
+
Use:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python3 .codex/skills/fix/scripts/write_fix_plan.py \
|
|
53
|
+
--root "$PWD" \
|
|
54
|
+
--plan-name "Fix Plan Title" \
|
|
55
|
+
< /tmp/fix-plan.md
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Add `--overwrite` only after the user explicitly confirms replacing an existing
|
|
59
|
+
file.
|