@ksuchoi216/ahe 0.1.7 → 0.1.12

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 (46) hide show
  1. package/README.md +57 -20
  2. package/bin/ahe +34 -233
  3. package/package.json +7 -4
  4. package/packages/ahe-antigravity/bin/ahe-antigravity +325 -0
  5. package/packages/ahe-antigravity/package.json +7 -0
  6. package/packages/ahe-antigravity/skills/ahe-git/SKILL.md +35 -0
  7. package/packages/ahe-antigravity/skills/ahe-ship/SKILL.md +28 -0
  8. package/packages/ahe-antigravity/skills/ahe-ship/scripts/post-ship-hook.sh +12 -0
  9. package/packages/ahe-codex/.codex/agents/ahe-harness-manager.toml +19 -0
  10. package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/AGENTS.md +11 -10
  11. package/{.codex/ahe-shared/templates/PRODUCT.md → packages/ahe-codex/.codex/ahe-shared/templates/product.md} +1 -1
  12. package/packages/ahe-codex/.codex/hooks/ahe-hook.js +249 -0
  13. package/packages/ahe-codex/.codex/skills/ahe/SKILL.md +36 -0
  14. package/packages/ahe-codex/.codex/skills/ahe-clean/SKILL.md +67 -0
  15. package/{.codex/skills/ahe-conversator → packages/ahe-codex/.codex/skills/ahe-converse}/SKILL.md +6 -6
  16. package/packages/ahe-codex/.codex/skills/ahe-feature/SKILL.md +25 -0
  17. package/packages/ahe-codex/.codex/skills/ahe-git/SKILL.md +34 -0
  18. package/packages/ahe-codex/.codex/skills/ahe-harness/SKILL.md +129 -0
  19. package/packages/ahe-codex/.codex/skills/ahe-harness-checker/SKILL.md +46 -0
  20. package/{.codex/skills/ahe-init → packages/ahe-codex/.codex/skills/ahe-new}/SKILL.md +36 -21
  21. package/packages/ahe-codex/.codex/skills/ahe-overview/SKILL.md +96 -0
  22. package/packages/ahe-codex/.codex/skills/ahe-review/SKILL.md +43 -0
  23. package/packages/ahe-codex/.codex/skills/ahe-ship/SKILL.md +58 -0
  24. package/packages/ahe-codex/.codex/skills/ahe-ship/agents/openai.yaml +4 -0
  25. package/packages/ahe-codex/.codex/skills/ahe-ship/scripts/write_plan.py +107 -0
  26. package/packages/ahe-codex/.codex/skills/ahe-solve/SKILL.md +30 -0
  27. package/packages/ahe-codex/.codex/skills/ahe-think/SKILL.md +125 -0
  28. package/packages/ahe-codex/bin/ahe-codex +398 -0
  29. package/packages/ahe-codex/package.json +7 -0
  30. package/.codex/ahe-shared/config.yaml +0 -8
  31. package/.codex/hooks/ahe-hook.js +0 -195
  32. package/.codex/skills/ahe-compression/SKILL.md +0 -97
  33. package/.codex/skills/ahe-compression/agents/openai.yaml +0 -6
  34. package/.codex/skills/ahe-compression/scripts/check-harness-size.sh +0 -109
  35. package/.codex/skills/ahe-harness/SKILL.md +0 -115
  36. package/.codex/skills/ahe-reviewer/SKILL.md +0 -35
  37. package/.codex/skills/ahe-solver/SKILL.md +0 -24
  38. package/.codex/skills/ahe-thinker/SKILL.md +0 -80
  39. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/schemas/feature-list-schema.json +0 -0
  40. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/schemas/process_status.schema.json +0 -0
  41. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/INSTRUCTIONS.md +0 -0
  42. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/feature-list.json +0 -0
  43. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/init.sh +0 -0
  44. /package/{.codex/ahe-shared/templates/PROGRESS.md → packages/ahe-codex/.codex/ahe-shared/templates/progress.md} +0 -0
  45. /package/{.codex/ahe-shared/templates/SESSION-HANDOFF.md → packages/ahe-codex/.codex/ahe-shared/templates/session-handoff.md} +0 -0
  46. /package/{.codex → packages/ahe-codex/.codex}/hooks/hooks.json +0 -0
@@ -0,0 +1,249 @@
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
+ "",
41
+ "2. Review code through CodeGraph when available:",
42
+ " - Prefer CodeGraph MCP or CodeGraph exploration for code review and impact context after the preflight command succeeds.",
43
+ " - If CodeGraph is not installed, skip CodeGraph review and rely on normal repo inspection.",
44
+ "",
45
+ "3. Make the first response a simple harness engineering status report table before proceeding:",
46
+ ...STATUS_TABLE_LINES,
47
+ ];
48
+
49
+ const AHE_PROGRESS_DIRECTIVE = [
50
+ AHE_DIRECTIVE_MARKER,
51
+ "AHE automatic operation activated.",
52
+ "",
53
+ "The user sent an AHE continuation request. Operate as the Awesome Harness Engineering router:",
54
+ "",
55
+ ...CODEGRAPH_PREFLIGHT_LINES,
56
+ ...COMMON_ROUTING_LINES,
57
+ "",
58
+ "4. Decide the next AHE workflow with `ahe-think`:",
59
+ " - Route through `ahe-think` first.",
60
+ " - let `ahe-think` decide whether `@ahe-harness-manager` supervision is needed before choosing the next workflow.",
61
+ " - If no harness files exist, route to `ahe-new`.",
62
+ " - If `docs/product.md` or `docs/INSTRUCTIONS.md` is missing or empty, classify the state as `harness engineering not enough`.",
63
+ " - 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.",
64
+ " - When numbered product stages exist, let `ahe-feature` derive feature-list items from only the active product stage.",
65
+ " - 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.",
66
+ " - 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.",
67
+ " - 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.",
68
+ " - Call `ahe-review` when repo or code understanding is needed.",
69
+ " - Call `ahe-clean` when stale completed tracking history makes the current next step harder to see.",
70
+ " - Call `ahe-converse` when the next safe step is blocked on user input.",
71
+ " - Call `ahe-harness` when product docs, instructions, tracking, or todo sync 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_SHIP_DIRECTIVE = [
83
+ AHE_DIRECTIVE_MARKER,
84
+ "AHE plan export activated.",
85
+ "",
86
+ "The user invoked `ahe-ship`.",
87
+ "",
88
+ ...CODEGRAPH_PREFLIGHT_LINES,
89
+ "2. Immediately call the `ahe-ship` skill.",
90
+ "3. Detect if the current conversation is still in Plan Mode.",
91
+ "4. If Plan Mode is active, the Codex host must exit Plan Mode and replay the command.",
92
+ "5. Outside Plan Mode, use the most recent `<proposed_plan>` already visible in this conversation.",
93
+ "6. Do not ask for the plan again when the latest plan is unambiguous.",
94
+ "7. Derive `plan_name` from the plan title and create `.plans/{plan_name}.md`.",
95
+ "8. Add compact handoff context for Antigravity or another LLM platform.",
96
+ "9. Use `.codex/skills/ahe-ship/scripts/write_plan.py` to write the final markdown and stop.",
97
+ "",
98
+ "Do not run the normal AHE harness workflow.",
99
+ ].join("\n");
100
+
101
+ const AHE_GIT_DIRECTIVE = [
102
+ AHE_DIRECTIVE_MARKER,
103
+ "AHE Git activated.",
104
+ "",
105
+ "The user invoked `ahe-git`.",
106
+ "",
107
+ ...CODEGRAPH_PREFLIGHT_LINES,
108
+ "2. Route to `ahe-think` first.",
109
+ "3. `ahe-think` must immediately call the `ahe-git` skill.",
110
+ "",
111
+ "Do not run the normal AHE harness workflow.",
112
+ ].join("\n");
113
+
114
+ const AHE_OVERVIEW_DIRECTIVE = [
115
+ AHE_DIRECTIVE_MARKER,
116
+ "AHE overview activated.",
117
+ "",
118
+ "The user invoked `ahe-overview`.",
119
+ "",
120
+ ...CODEGRAPH_PREFLIGHT_LINES,
121
+ "2. Read `.codex/skills/ahe-overview/SKILL.md`.",
122
+ "3. Present its contents to explain the AHE concept to the user.",
123
+ "",
124
+ "Do not run the normal AHE harness workflow.",
125
+ ].join("\n");
126
+
127
+ function normalizePrompt(prompt) {
128
+ return prompt.trim().replace(/\s+/g, " ").toLowerCase();
129
+ }
130
+
131
+ function isExactAheCommand(prompt) {
132
+ return normalizePrompt(prompt) === "ahe";
133
+ }
134
+
135
+ function isExactAheShipCommand(prompt) {
136
+ const normalizedPrompt = normalizePrompt(prompt);
137
+ return normalizedPrompt === "ahe-ship" || normalizedPrompt === "ahe ship";
138
+ }
139
+
140
+ function isExactAheGitCommand(prompt) {
141
+ const normalizedPrompt = normalizePrompt(prompt);
142
+ return normalizedPrompt === "ahe-git" || normalizedPrompt === "ahe git";
143
+ }
144
+
145
+ function isExactAheOverviewCommand(prompt) {
146
+ return normalizePrompt(prompt) === "ahe-overview";
147
+ }
148
+
149
+ function isAheQueryCommand(prompt) {
150
+ const normalizedPrompt = normalizePrompt(prompt);
151
+
152
+ if (
153
+ isExactAheCommand(prompt) ||
154
+ isExactAheShipCommand(prompt) ||
155
+ isExactAheGitCommand(prompt) ||
156
+ isExactAheOverviewCommand(prompt)
157
+ ) {
158
+ return false;
159
+ }
160
+
161
+ return /^ahe .+/.test(normalizedPrompt) || /^.+ ahe$/.test(normalizedPrompt);
162
+ }
163
+
164
+ async function main() {
165
+ let raw = "";
166
+ process.stdin.setEncoding("utf8");
167
+ for await (const chunk of process.stdin) {
168
+ raw += chunk;
169
+ }
170
+
171
+ if (!raw.trim()) {
172
+ return;
173
+ }
174
+
175
+ let parsed;
176
+ try {
177
+ parsed = JSON.parse(raw);
178
+ } catch {
179
+ return;
180
+ }
181
+
182
+ if (
183
+ parsed &&
184
+ parsed.hook_event_name === "UserPromptSubmit" &&
185
+ typeof parsed.prompt === "string"
186
+ ) {
187
+ if (isExactAheCommand(parsed.prompt)) {
188
+ process.stdout.write(
189
+ JSON.stringify({
190
+ hookSpecificOutput: {
191
+ hookEventName: "UserPromptSubmit",
192
+ additionalContext: AHE_PROGRESS_DIRECTIVE.join("\n"),
193
+ },
194
+ }) + "\n"
195
+ );
196
+ return;
197
+ }
198
+
199
+ if (isAheQueryCommand(parsed.prompt)) {
200
+ process.stdout.write(
201
+ JSON.stringify({
202
+ hookSpecificOutput: {
203
+ hookEventName: "UserPromptSubmit",
204
+ additionalContext: AHE_PROGRESS_DIRECTIVE.join("\n"),
205
+ },
206
+ }) + "\n"
207
+ );
208
+ return;
209
+ }
210
+
211
+ if (isExactAheShipCommand(parsed.prompt)) {
212
+ process.stdout.write(
213
+ JSON.stringify({
214
+ hookSpecificOutput: {
215
+ hookEventName: "UserPromptSubmit",
216
+ additionalContext: AHE_SHIP_DIRECTIVE,
217
+ },
218
+ }) + "\n"
219
+ );
220
+ return;
221
+ }
222
+
223
+ if (isExactAheGitCommand(parsed.prompt)) {
224
+ process.stdout.write(
225
+ JSON.stringify({
226
+ hookSpecificOutput: {
227
+ hookEventName: "UserPromptSubmit",
228
+ additionalContext: AHE_GIT_DIRECTIVE,
229
+ },
230
+ }) + "\n"
231
+ );
232
+ return;
233
+ }
234
+
235
+ if (isExactAheOverviewCommand(parsed.prompt)) {
236
+ process.stdout.write(
237
+ JSON.stringify({
238
+ hookSpecificOutput: {
239
+ hookEventName: "UserPromptSubmit",
240
+ additionalContext: AHE_OVERVIEW_DIRECTIVE,
241
+ },
242
+ }) + "\n"
243
+ );
244
+ return;
245
+ }
246
+ }
247
+ }
248
+
249
+ main().catch(() => {});
@@ -0,0 +1,36 @@
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-think` may call `ahe-new` internally when the workspace has no usable
18
+ harness yet.
19
+ - `ahe` must stay separate from the dedicated `ahe-ship` and `ahe-git`
20
+ workflows when the user's prompt matches those command contracts.
21
+
22
+ ## Routing
23
+
24
+ - Call `ahe-think` first.
25
+ - Let `ahe-think` choose `ahe-review`, `ahe-converse`, `ahe-harness`, or
26
+ `ahe-solve`.
27
+ - Keep `docs/product.md` as overview context and `feature-list.json` as the
28
+ derived tracker.
29
+ - Actualize the final product through `docs/product{number}.md` stages in
30
+ numeric order when staged product docs exist.
31
+
32
+ ## Scope
33
+
34
+ - Use this skill for ongoing harness work, product updates, and explicit AHE
35
+ requests such as `ahe update product spec` or `ahe fix stale tests`.
36
+ - Do not use this skill for standalone ship-plan export or git orchestration.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: ahe-clean
3
+ description: Use when valid harness tracking artifacts contain too much stale completed history and the current next step is harder to see.
4
+ ---
5
+
6
+ # AHE Clean
7
+
8
+ This is an internal AHE workflow skill, not a user-facing command.
9
+
10
+ Do not treat `$ahe-clean` as a user command.
11
+ Use it when `ahe-think` decides that completed tracker history should be compacted
12
+ to restore clarity for current work.
13
+
14
+ ## Purpose
15
+
16
+ - Reduce stale completed history in `feature-list.json`.
17
+ - Reduce stale completed history in `session-handoff.md`.
18
+ - Keep the active work legible without turning tracking artifacts into archives.
19
+ - Follow the tracking-policy contract owned by `ahe-harness`.
20
+
21
+ ## Scope
22
+
23
+ - Read only the context needed to judge relevance:
24
+ - `docs/product.md`
25
+ - active `docs/product{number}.md` stage when present
26
+ - `feature-list.json`
27
+ - `progress.md`
28
+ - `session-handoff.md`
29
+ - Do not become a general harness editor.
30
+ - Do not rewrite `docs/product.md` or `docs/INSTRUCTIONS.md`.
31
+ - Touch `progress.md` only when the active-feature or latest-completed-work text
32
+ must stay consistent after cleanup.
33
+
34
+ ## Cleanup Rules For `feature-list.json`
35
+
36
+ - Preserve all non-`done` features.
37
+ - Preserve the active feature from `progress.md`.
38
+ - Preserve completed dependency features needed for the active feature.
39
+ - Preserve completed features still needed to understand the active product
40
+ stage or the current next work.
41
+ - Remove `done` features that are not relevant under those rules.
42
+ - Replace removed completed history with one stable summary feature entry.
43
+ - The summary entry must stay `status: "done"`.
44
+ - The summary entry must explain that older unrelated completed work was
45
+ compacted.
46
+ - The summary entry must record a covered feature ID span or covered count.
47
+ - The summary entry must be updated in place on future cleanup runs instead of
48
+ duplicating summaries.
49
+
50
+ ## Cleanup Rules For `session-handoff.md`
51
+
52
+ - In `## Last Completed Work`, preserve only:
53
+ - items directly related to the active feature;
54
+ - items needed to explain current harness state;
55
+ - items needed to justify the next recommended step.
56
+ - Remove unrelated older completed bullets.
57
+ - Replace removed bullets with one compact summary bullet describing that older
58
+ unrelated completed work was condensed.
59
+ - Keep `## Current Product Context`, `## Important Files`,
60
+ `## Next Recommended Action`, and `## Verification Status` governed by the
61
+ normal handoff rules; do not broadly compress them here.
62
+
63
+ ## Completion
64
+
65
+ - Keep `feature-list.json` valid JSON.
66
+ - Keep `session-handoff.md` focused on the next-session startup path.
67
+ - Preserve current-work clarity rather than long-form history.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: ahe-conversator
2
+ name: ahe-converse
3
3
  description: Internal AHE conversation protocol for recursive clarification, conversation state, and resume-aware workflow guidance.
4
4
  ---
5
5
 
@@ -7,8 +7,8 @@ description: Internal AHE conversation protocol for recursive clarification, con
7
7
 
8
8
  This is an internal AHE workflow skill, not a user-facing command.
9
9
 
10
- Do not treat `$ahe-conversator` as a user command.
11
- Use it after `ahe-thinker` or another AHE agent identifies a missing decision or
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
12
  missing `Why`, `What`, or `How`.
13
13
 
14
14
  ## When To Converse
@@ -31,14 +31,14 @@ missing `Why`, `What`, or `How`.
31
31
 
32
32
  ## State Persistence
33
33
 
34
- - Update `.ahe/process_status.json` before pausing for user input.
34
+ - Update `status.json` before pausing for user input.
35
35
  - Preserve the current command, current_step, workflow_complete, and files map.
36
- - Update `PROGRESS.md` and `SESSION-HANDOFF.md` when the pending question
36
+ - Update `progress.md` and `session-handoff.md` when the pending question
37
37
  changes the workflow state.
38
38
 
39
39
  ## Resume Protocol
40
40
 
41
- - Read `.ahe/process_status.json` and the relevant workflow artifacts.
41
+ - Read `status.json` and the relevant workflow artifacts.
42
42
  - Summarize the current state briefly.
43
43
  - Ask the next focused question or return control to the caller when the answer
44
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,34 @@
1
+ ---
2
+ name: ahe-git
3
+ description: Use when the user explicitly invokes `ahe git` or `ahe-git` to manage and commit changes across repositories and submodules.
4
+ ---
5
+
6
+ # AHE Git
7
+
8
+ `ahe-git` is a user-facing AHE command independent from the normal AHE agent network.
9
+
10
+ Use this skill only to orchestrate safe Git pulls and commits across the active repository and its nested Git repositories or submodules.
11
+ Do not route through `ahe-think`. You must not call `ahe-harness`, `ahe-solve`, or any other AHE workflow agent.
12
+
13
+ ## Workflow
14
+
15
+ 1. **Discover**: Scan for both `.git` directories and `.git` files to find all nested repositories, worktrees, and submodules. Normalize and deduplicate the repo roots. Process them deepest-first (so submodules commit before parent gitlink updates).
16
+ 2. **Safe Pull**: For each repo, run `git fetch` and inspect the current branch and upstream state:
17
+ - If the repo is clean and upstream is ahead, fast-forward with `git pull --ff-only`.
18
+ - If the repo is already at upstream head, continue.
19
+ - If the repo is locally ahead of upstream and has local changes, continue to Dirty-State Review.
20
+ - If the repo has local changes and upstream has commits not present locally, **stop and explain the issue**.
21
+ - If upstream is missing, detached, diverged, rebasing, merging, cherry-picking, or cannot fast-forward cleanly, **stop and explain the issue**.
22
+ - *Never* auto-stash, auto-merge, auto-rebase, auto-resolve conflicts, or change branch topology.
23
+ 3. **Failure Policy**: On any hard Git state, stop immediately and report:
24
+ - Which repo is blocked.
25
+ - The exact detected condition.
26
+ - Why `ahe-git` is refusing to continue.
27
+ - Concrete manual steps the user should perform next (e.g., set upstream, finish merge, clean changes).
28
+ - Do not attempt partial recovery beyond safe read-only diagnosis.
29
+ 4. **Dirty-State Review**: Inspect `git status --short`. Read unstaged diffs first, then staged diffs, and include untracked files so the commit message covers the full pending change.
30
+ 5. **Commit-Message Drafting**: Generate one concise conventional-style message per repo (`feat:`, `fix:`, `chore:`, etc.) based on the actual diff.
31
+ - Run an explicit self-check pass to reject vague or misleading messages before commit.
32
+ - If the message is still ambiguous after self-check, stop and ask the user instead of committing a generic summary.
33
+ 6. **Commit**: Stage with `git add -A` inside that repo. Commit exactly once per dirty repo with its reviewed message.
34
+ 7. **Re-evaluate**: After submodule commits, re-evaluate parent repos so gitlink updates are committed if they became dirty.
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: ahe-harness
3
+ description: Internal AHE harness workflow for managing product docs, instructions, feature tracking, session artifacts, and todo sync.
4
+ ---
5
+
6
+ # AHE Harness
7
+
8
+ This is an internal AHE workflow skill, not a user-facing command.
9
+
10
+ Do not treat `$ahe-harness` as a user command.
11
+ Use it when `ahe-think` or another worker decides that harness artifacts must
12
+ be created, updated, or reconciled.
13
+
14
+ ## Command Workflow: harness
15
+
16
+ ### Harness Inspection
17
+
18
+ - Discover and read scoped docs anywhere in the repo. Treat every docs file as supporting project context, even when `AGENTS.md` does not name it directly.
19
+ - Treat `docs/product.md`, `docs/architecture.md`, and `docs/INSTRUCTIONS.md` (or `docs/instructions.md`) as overview docs.
20
+ - Especially read `docs/product{number}.md` files when present because they explain what to do.
21
+ - Read `AGENTS.md`, `feature-list.json`, `progress.md`, `session-handoff.md`,
22
+ and `docs/todo.md` when they exist.
23
+ - Read `status.json` when it exists.
24
+ - Treat `docs/product.md` as the canonical source of truth and
25
+ `feature-list.json` as a derived tracker.
26
+ - Treat `docs/product.md` as overview context even when a numbered product stage is active.
27
+ - Recognize only `docs/product{number}.md` files as ordered product stages.
28
+ - Ignore non-numeric product files such as `docs/product-alpha.md` for stage ordering.
29
+ - Choose the lowest-numbered product stage whose derived feature work is not complete.
30
+ - Use `docs/product.md` as the normal overview-only source when no numbered product stage exists.
31
+
32
+ ### Harness Decision Paths
33
+
34
+ - Clarify product goal, scope, and success criteria when `docs/product.md`
35
+ needs to change.
36
+ - Clarify project instructions when `docs/INSTRUCTIONS.md` needs to change.
37
+ - Clarify what next feature or goal should be tracked when the next work item is
38
+ unclear.
39
+ - `docs/product.md` is the canonical home for product specification details collected during `ahe-new`.
40
+ - Write product behavior, scope, requirements, success criteria, and workflow details into `docs/product.md`.
41
+ - `docs/product.md` is the canonical source of truth. Concrete feature items for `feature-list.json` must be derived from it only after it has been populated.
42
+ - Derive concrete feature items from only the active product stage, not future stages.
43
+ - Advance from `docs/product1.md` to `docs/product2.md` only after all feature-list items derived from `docs/product1.md` are `done`.
44
+ - Apply the same done-before-advance rule for later stages such as `docs/product2.md` to `docs/product3.md`.
45
+ - Do not move product specification details into `AGENTS.md`.
46
+ - Update only the relevant docs among `docs/product.md` and
47
+ `docs/INSTRUCTIONS.md`.
48
+ - If the user is adding new work, append it into the last `## TODO` section of
49
+ `docs/todo.md`, create that section when needed, and update
50
+ `feature-list.json`.
51
+ - Apply the queued `docs/todo.md` content to `docs/product.md`.
52
+ - Remove the applied content from `docs/todo.md` because that todo content is
53
+ already reflected in `docs/product.md`.
54
+ - Update `feature-list.json` to derive the specific feature items from the updated `docs/product.md`.
55
+ - Update `progress.md`.
56
+ - Update `session-handoff.md`.
57
+ - Treat `feature-list.json` and `session-handoff.md` as current-work artifacts,
58
+ not archival logs; they are current-work artifacts, and unrelated completed
59
+ history may be compacted when it no longer helps the active work.
60
+ - unrelated completed feature entries may be compacted.
61
+ - unrelated completed handoff bullets may be compacted.
62
+ - current-work-relevant completed context must remain.
63
+ - If no new feature can be derived from `docs/product.md`, call `ahe-converse` to ask what next feature, product direction, or goal should be tracked.
64
+ - If a numbered product stage is active and no new feature can be derived from
65
+ that active product stage, call `ahe-converse` with the same clarification
66
+ target.
67
+ - Call `ahe-review` directly when code or progress evidence must be checked
68
+ before updating harness files.
69
+
70
+ ### Harness Completion
71
+
72
+ - Keep `feature-list.json` valid JSON.
73
+ - Keep `progress.md` focused on current work, decisions that still matter,
74
+ blockers, and recent verification evidence.
75
+ - Keep `session-handoff.md` focused on the next-session startup path.
76
+ - Keep tracking artifacts concise enough that the current next step is easy to
77
+ identify.
78
+ - Keep `status.json` aligned with the active workflow.
79
+ - When harness files are created or refreshed, hand off to `ahe-harness-checker` before considering the harness ready.
80
+
81
+ ## Clarification Rule
82
+
83
+ When the next harness step is not clear, follow the `ahe-think` protocol first. If `ahe-think` finds missing information, follow the `ahe-converse` protocol. Ask again recursively using a Codex-supported structured response request, provide 2-3 meaningful mutually exclusive options
84
+ when possible, and allow custom input when predefined options are not enough.
85
+
86
+ ### User Response Target
87
+
88
+ - Collect the product, instruction, tracking, or next-feature details required
89
+ to update harness artifacts safely.
90
+
91
+ ### Questions to Ask
92
+
93
+ - Ask who the product is for and what problem it solves when product intent is
94
+ unclear.
95
+ - Ask what behavior, scope boundaries, and success criteria should be
96
+ documented.
97
+ - Ask what rule, practice, or guideline belongs in `docs/INSTRUCTIONS.md`.
98
+ - Ask what work should be added next when `docs/product.md` does not imply a new
99
+ feature safely.
100
+
101
+ ### Clarification Criteria
102
+
103
+ - The answer must be concrete enough to update the relevant harness files
104
+ without guessing.
105
+ - The answer must describe actionable work, the affected area, and the intended
106
+ outcome when queuing a todo item.
107
+
108
+ ### Re-ask When
109
+
110
+ - Ask again when the answer is vague, contradictory, or incomplete.
111
+ - Ask again when the response names a topic without enough detail to update the
112
+ harness safely.
113
+
114
+ ## Session Tracking and Handoff Sync
115
+
116
+ ### Tracking Update Rules
117
+
118
+ - Update `status.json` at workflow start.
119
+ - Update `status.json` after every answered question.
120
+ - Refresh `updated_at` every time workflow state changes.
121
+ - Keep `current_command`, `current_step`, and `workflow_complete` aligned with the active workflow state.
122
+ - Keep the `files` status map aligned with the actual workspace files.
123
+
124
+ ### Progress and Handoff Content Requirements
125
+
126
+ - Update `progress.md` whenever the active feature, workflow status, blockers, or verification state changes.
127
+ - Update `session-handoff.md` whenever the current objective, completed work, important files, verification evidence, or recommended next step changes.
128
+ - progress.md must reflect the current active feature and latest completed work.
129
+ - session-handoff.md must leave the next Codex session with a concrete startup path.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: ahe-harness-checker
3
+ description: Internal AHE harness validation and repair protocol for checking artifacts after generation or maintenance.
4
+ ---
5
+
6
+ # AHE Harness Checker
7
+
8
+ **CRITICAL: This is an internal AHE workflow skill, not a user-facing command.**
9
+
10
+ Do not treat `$ahe-harness-checker` as a user command.
11
+ Use it when `ahe-think`, `ahe-harness`, or `ahe-new` decides that generated or maintained harness files must be validated and repaired.
12
+
13
+ ## Protocol and Purpose
14
+
15
+ Your primary purpose is to validate and repair generated harness artifacts after bootstrap/initialization or harness maintenance work.
16
+
17
+ **CRITICAL MANDATORY STEP**: You MUST read and review the actual contents of all harness files before attempting to validate or repair them. You have explicit authority and the obligation to inspect the contents of the following key files:
18
+ - `AGENTS.md`
19
+ - `docs/product.md`
20
+ - `docs/INSTRUCTIONS.md`
21
+ - `feature-list.json`
22
+ - `progress.md`
23
+ - `session-handoff.md`
24
+ - `init.sh`
25
+ - `status.json`
26
+
27
+ ## Detectable Failure Classes
28
+
29
+ You must detect and classify the following issues during your validation check:
30
+
31
+ 1. **Missing Required File**: A key harness file is completely absent from the workspace.
32
+ 2. **Empty Required File**: A key harness file exists but contains zero bytes or only whitespace.
33
+ 3. **Invalid Tracker JSON**: `feature-list.json` or `status.json` contains malformed JSON or violates the required schema.
34
+ 4. **Wrong Filename Casing**: A harness file uses an incorrect case (e.g., `PROGRESS.md` instead of `progress.md`). Note: `AGENTS.md` is the only file that must remain uppercase.
35
+ 5. **Forbidden AGENTS.md Edits**: Edits to `AGENTS.md` have occurred outside the allowed changeable section / `PROJECT_PURPOSE`.
36
+ 6. **Missing Product Docs**: `docs/product.md` is absent or does not contain valid specification text.
37
+ 7. **Template/Bootstrap Drift**: Workspace files contradict the intended layout or templates defined by AHE.
38
+
39
+ ## Repair Behavior
40
+
41
+ - **Direct Fix**: If the detected failure is deterministic and local (e.g., wrong casing, missing template placeholders, local syntax drift, malformed but fixable JSON), fix the issue directly in the workspace without prompting.
42
+ - **Escalation**: If the issue is ambiguous or requires understanding the user's intent (e.g., missing project purpose, contradictory requirements, or major data loss in tracker files), escalate the issue by handing off to `ahe-converse` to query the user for clarification.
43
+
44
+ ## Sequence Completion
45
+
46
+ Once all detected issues have been either directly fixed or safely escalated, summarize the fixes applied and exit. Do not proceed to other workflow steps on your own.