@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.
- package/README.md +57 -20
- package/bin/ahe +34 -233
- package/package.json +7 -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 +249 -0
- package/packages/ahe-codex/.codex/skills/ahe/SKILL.md +36 -0
- package/packages/ahe-codex/.codex/skills/ahe-clean/SKILL.md +67 -0
- package/{.codex/skills/ahe-conversator → packages/ahe-codex/.codex/skills/ahe-converse}/SKILL.md +6 -6
- package/packages/ahe-codex/.codex/skills/ahe-feature/SKILL.md +25 -0
- package/packages/ahe-codex/.codex/skills/ahe-git/SKILL.md +34 -0
- package/packages/ahe-codex/.codex/skills/ahe-harness/SKILL.md +129 -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 +36 -21
- package/packages/ahe-codex/.codex/skills/ahe-overview/SKILL.md +96 -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 +125 -0
- package/packages/ahe-codex/bin/ahe-codex +398 -0
- package/packages/ahe-codex/package.json +7 -0
- package/.codex/ahe-shared/config.yaml +0 -8
- package/.codex/hooks/ahe-hook.js +0 -195
- package/.codex/skills/ahe-compression/SKILL.md +0 -97
- package/.codex/skills/ahe-compression/agents/openai.yaml +0 -6
- package/.codex/skills/ahe-compression/scripts/check-harness-size.sh +0 -109
- package/.codex/skills/ahe-harness/SKILL.md +0 -115
- package/.codex/skills/ahe-reviewer/SKILL.md +0 -35
- package/.codex/skills/ahe-solver/SKILL.md +0 -24
- package/.codex/skills/ahe-thinker/SKILL.md +0 -80
- /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
|
@@ -1,33 +1,45 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: ahe-
|
|
2
|
+
name: ahe-new
|
|
3
3
|
description: Initialize AHE in the current workspace and create the base harness files.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# AHE
|
|
6
|
+
# AHE New
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
This is an internal AHE workflow skill, not a user-facing command.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Use this skill when `ahe-think` decides the workspace needs bootstrap or
|
|
11
|
+
restart handling.
|
|
12
|
+
|
|
13
|
+
## Command Workflow: new
|
|
11
14
|
|
|
12
15
|
### Workspace Inspection
|
|
13
16
|
|
|
14
17
|
- Read `AGENTS.md` if it already exists.
|
|
15
|
-
- Read `docs
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
- Treat `
|
|
18
|
+
- Read all `docs/*.md` files when they exist. Treat every docs file as
|
|
19
|
+
supporting project context, even when `AGENTS.md` does not name it directly.
|
|
20
|
+
- Especially read `docs/product.md` and
|
|
21
|
+
`docs/product{number}.md` files when present because they explain what to do.
|
|
22
|
+
- Treat `docs/product.md` as overview context and numbered
|
|
23
|
+
`docs/product{number}.md` files as ordered product stages.
|
|
24
|
+
- Ignore non-numeric product docs such as `docs/product-alpha.md` for stage
|
|
25
|
+
ordering.
|
|
26
|
+
- Read existing workspace-root harness files that may be copied from templates, including `progress.md`, `session-handoff.md`, `feature-list.json`, and `init.sh`.
|
|
27
|
+
- Read `status.json` when it exists.
|
|
28
|
+
- Treat `AGENTS.md`, `docs/product.md`, `docs/INSTRUCTIONS.md`, `progress.md`, `session-handoff.md`, `feature-list.json`, `init.sh`, and `status.json` as AHE-managed harness files for restart-scope decisions.
|
|
20
29
|
|
|
21
30
|
### Sequential Conversation Flow
|
|
22
31
|
|
|
23
|
-
- Treat
|
|
32
|
+
- Treat new-start or reset intent arriving through the normal `ahe` path as a
|
|
33
|
+
possible new start request.
|
|
24
34
|
- If no AHE-managed harness files exist, start initialization normally without asking a restart-scope question.
|
|
25
35
|
- If any AHE-managed harness file already exists, read the existing files first.
|
|
26
36
|
- When existing harness files are present, summarize the current project purpose and product specification state, then ask what restart scope the user wants before removing, overwriting, or refreshing existing harness files.
|
|
27
37
|
- Do not remove, overwrite, or refresh existing harness files until the restart scope is clear.
|
|
28
38
|
- Interpret the restart scope from the user's free-form answer; examples are guidance only and must not limit valid answers.
|
|
29
39
|
- If the answer says `purpose`, full restart, or equivalent, `purpose` means restart the whole harness from the project purpose.
|
|
30
|
-
- If the answer says `product`, product spec, or equivalent, `product` means preserve the project purpose in `AGENTS.md` and restart product specification work in `docs/
|
|
40
|
+
- If the answer says `product`, product spec, or equivalent, `product` means preserve the project purpose in `AGENTS.md` and restart product specification work in `docs/product.md`.
|
|
41
|
+
- If the answer names staged product work, restart only the named product stage
|
|
42
|
+
files unless the user also requests the overview product spec.
|
|
31
43
|
- If the answer names a narrower custom scope, preserve unrelated harness files and restart only the named scope.
|
|
32
44
|
- If `AGENTS.md` already exists, ask the user whether the current `AGENTS.md` is right.
|
|
33
45
|
- If the current `AGENTS.md` is not right or does not exist, ask for the purpose of this project.
|
|
@@ -35,36 +47,39 @@ Use this skill when the user invokes `$ahe-init`.
|
|
|
35
47
|
- Update only the `PROJECT_PURPOSE` portion of `AGENTS.md`.
|
|
36
48
|
- Keep `AGENTS.md` limited to the project purpose and base agent settings.
|
|
37
49
|
- Do not put product specification details in `AGENTS.md`.
|
|
38
|
-
- Send product behavior, scope, requirements, success criteria, and workflow details to `ahe-harness` so they are written in `docs/
|
|
39
|
-
- Generating an empty `feature-list.json` from a template is allowed, but do not write concrete feature items until `docs/
|
|
50
|
+
- Send product behavior, scope, requirements, success criteria, and workflow details to `ahe-harness` so they are written in `docs/product.md` first.
|
|
51
|
+
- Generating an empty `feature-list.json` from a template is allowed, but do not write concrete feature items until `docs/product.md` is populated.
|
|
52
|
+
- When staged product docs exist, let `ahe-harness` derive concrete feature
|
|
53
|
+
items from only the active product stage.
|
|
40
54
|
- Ask whether the project language is Python using a Codex-supported structured response request with meaningful options and custom input.
|
|
41
55
|
- If the user answers that the project language is not Python, ask again: "Which language do you use?".
|
|
42
56
|
- Do not create backup copies of the replaced harness files.
|
|
43
57
|
- When a restart scope replaces prior harness history, summarize the replaced harness history in the refreshed tracking artifacts instead of creating backups.
|
|
44
|
-
- Remove the previous `docs/
|
|
45
|
-
- Remove the previous `
|
|
46
|
-
- Remove the previous `
|
|
58
|
+
- Remove the previous `docs/product.md` and `docs/INSTRUCTIONS.md` when the chosen restart scope includes product specification.
|
|
59
|
+
- Remove the previous `progress.md` when the chosen restart scope includes progress tracking.
|
|
60
|
+
- Remove the previous `session-handoff.md` when the chosen restart scope includes session handoff.
|
|
47
61
|
- Remove the previous `feature-list.json` when the chosen restart scope includes feature tracking.
|
|
48
62
|
- Remove only the files included in the chosen restart scope before continuing the new start flow.
|
|
49
63
|
- Find all template files under `.codex/ahe-shared/templates/`.
|
|
50
|
-
- Ignore `AGENTS.md` and `
|
|
64
|
+
- Ignore `AGENTS.md` and `product.md` when copying template files.
|
|
51
65
|
- Before copying a template file into the workspace root, check whether the target file already exists and ask for explicit overwrite confirmation when needed.
|
|
52
|
-
- Execute the following
|
|
53
|
-
1. complete the embedded init setup work (status: "
|
|
66
|
+
- Execute the following three steps sequentially, updating the progress status (`current_step` in `status.json`):
|
|
67
|
+
1. complete the embedded init setup work (status: "new")
|
|
54
68
|
2. call "ahe-harness" (status: "ahe-harness")
|
|
69
|
+
3. call "ahe-harness-checker" (status: "ahe-harness-checker")
|
|
55
70
|
|
|
56
71
|
### Harness Generation
|
|
57
72
|
|
|
58
73
|
- Create or refresh `AGENTS.md`.
|
|
59
74
|
- Create or refresh missing workspace-root harness files from `.codex/ahe-shared/templates/`, converting markdown filenames to uppercase when needed.
|
|
60
|
-
- Create
|
|
75
|
+
- Create `status.json` and update it at each step to indicate the active status from the three-step sequence.
|
|
61
76
|
- Create missing harness files from `.codex/ahe-shared/templates/`.
|
|
62
77
|
- Keep the generated files aligned with the installed shared templates.
|
|
63
78
|
- Only allow additions/removals/edits to `docs/INSTRUCTIONS.md` inside `## CAN CHANGE INSTRUCTIONS`; preserve `## MUST NOT CHANGE INSTRUCTIONS`.
|
|
64
79
|
|
|
65
80
|
## Clarification Rule
|
|
66
81
|
|
|
67
|
-
When the next setup step is not clear, follow the `ahe-
|
|
82
|
+
When the next setup 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 when possible, and allow custom input when predefined options are not enough.
|
|
68
83
|
|
|
69
84
|
### User Response Target
|
|
70
85
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-overview
|
|
3
|
+
description: Provides an overview of Awesome Harness Engineering (AHE), its architecture, and available commands.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Awesome Harness Engineering (AHE) Overview
|
|
7
|
+
|
|
8
|
+
AHE is a framework and set of managed skills designed to maintain project harnesses (documentation, requirements, testing) and route work systematically through AI agents.
|
|
9
|
+
|
|
10
|
+
## Public Entrypoints
|
|
11
|
+
|
|
12
|
+
You interact with AHE using the following user-facing commands:
|
|
13
|
+
- **`ahe` / `ahe <query>` / `<query> ahe`**: Automatically inspects the harness state and routes to the correct next step. This same entrypoint covers new-workspace bootstrap, normal continuation, and user-directed follow-up such as `ahe update product spec` or `ahe fix stale tests`.
|
|
14
|
+
- **`ahe ship`**: In Codex, saves the latest Plan Mode plan into `.plans/{plan_name}.md` without automatically executing it. In Antigravity, refreshes and executes exactly one plan from `.plans/`.
|
|
15
|
+
- **`ahe-git`**: In Antigravity, safely pulls and commits all nested repositories.
|
|
16
|
+
|
|
17
|
+
`ahe-overview` remains an explanation helper, not part of the normal work-routing surface.
|
|
18
|
+
|
|
19
|
+
## Thinker-Centered Routing Model
|
|
20
|
+
|
|
21
|
+
AHE operates through a central decision layer: **`ahe-think`**. This internal agent determines the current state of the harness and delegates tasks to specialized sub-skills:
|
|
22
|
+
- **`ahe-harness`**: Builds and maintains product docs, instructions, and tracking state.
|
|
23
|
+
- **`ahe-review`**: Explores the codebase and reads files to understand context.
|
|
24
|
+
- **`ahe-converse`**: Pauses and asks the user for clarification when blocked.
|
|
25
|
+
- **`ahe-feature`**: Sizes and extracts new features from product documentation.
|
|
26
|
+
- **`ahe-solve`**: Solves or plans specific features.
|
|
27
|
+
- **`ahe-new`**: Internal bootstrap worker used when `ahe-think` detects that the workspace has no usable harness yet.
|
|
28
|
+
|
|
29
|
+
These internal sub-skills are not user-facing commands.
|
|
30
|
+
|
|
31
|
+
## Main Flows
|
|
32
|
+
|
|
33
|
+
### 1. `ahe` (Continuous Execution)
|
|
34
|
+
```mermaid
|
|
35
|
+
graph TD;
|
|
36
|
+
User[User: ahe] --> Hook[ahe-hook.js]
|
|
37
|
+
Hook --> Think[ahe-think]
|
|
38
|
+
Think --> State{State?}
|
|
39
|
+
State -- Harness Missing --> New[ahe-new]
|
|
40
|
+
State -- Building Features --> Solve[ahe-solve]
|
|
41
|
+
State -- Need Context --> Review[ahe-review]
|
|
42
|
+
State -- Blocked --> Converse[ahe-converse]
|
|
43
|
+
State -- Harness Work --> Harness[ahe-harness]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. `ahe ship` (Export / Execute Plan)
|
|
47
|
+
|
|
48
|
+
**In Codex (Export):**
|
|
49
|
+
```mermaid
|
|
50
|
+
graph TD;
|
|
51
|
+
User[User: ahe ship] --> Hook[ahe-hook.js]
|
|
52
|
+
Hook --> Think[ahe-think]
|
|
53
|
+
Think --> Ship[ahe-ship]
|
|
54
|
+
Ship --> Write[Write .plans/*.md]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**In Antigravity (Execute):**
|
|
58
|
+
```mermaid
|
|
59
|
+
graph TD;
|
|
60
|
+
User[User: ahe-ship] --> Antigravity
|
|
61
|
+
Antigravity --> ShipSkill[ahe-ship skill]
|
|
62
|
+
ShipSkill --> Read[Read .plans/*.md]
|
|
63
|
+
Read --> Execute[Execute Plan]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 3. `ahe-git` (Repository Sync)
|
|
67
|
+
|
|
68
|
+
**In Antigravity:**
|
|
69
|
+
```mermaid
|
|
70
|
+
graph TD;
|
|
71
|
+
User[User: ahe-git] --> Antigravity
|
|
72
|
+
Antigravity --> GitSkill[ahe-git skill]
|
|
73
|
+
GitSkill --> Pull[Pull Remote]
|
|
74
|
+
Pull --> Commit[Commit Local Changes]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Example of How to Use
|
|
78
|
+
|
|
79
|
+
### Harness Engineering
|
|
80
|
+
1. `ahe`
|
|
81
|
+
(in a workspace with no harness, `ahe-think` routes internally to `ahe-new`)
|
|
82
|
+
2. `ahe update product spec`
|
|
83
|
+
(update product documentation)
|
|
84
|
+
3. `ahe add dashboard export feature`
|
|
85
|
+
(implement a specific feature)
|
|
86
|
+
|
|
87
|
+
### ahe-ship in Codex and Antigravity
|
|
88
|
+
after planning in codex
|
|
89
|
+
1. `ahe-ship` in codex
|
|
90
|
+
(save the plan to .plans)
|
|
91
|
+
2. `ahe-ship` in antigravity
|
|
92
|
+
(implement one of plans in .plans)
|
|
93
|
+
|
|
94
|
+
### ahe-git
|
|
95
|
+
1. `ahe-git` in antigravity
|
|
96
|
+
(safely pull and commit all nested repositories)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-review
|
|
3
|
+
description: Internal AHE review workflow for understanding repo code, harness files, and CodeGraph context before another agent acts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE Reviewer
|
|
7
|
+
|
|
8
|
+
This is an internal AHE workflow skill, not a user-facing command.
|
|
9
|
+
|
|
10
|
+
Do not treat `$ahe-review` as a user command.
|
|
11
|
+
Use it when `ahe-think` or another worker needs evidence from code or harness
|
|
12
|
+
state before deciding what to do next.
|
|
13
|
+
|
|
14
|
+
## Review Scope
|
|
15
|
+
|
|
16
|
+
- Inspect repo code, harness files, verification history, and feature progress.
|
|
17
|
+
- If `.codegraph/` exists, prefer `.codegraph` or CodeGraph-backed review
|
|
18
|
+
context when available.
|
|
19
|
+
- Check `AGENTS.md`, all existing `docs/*.md` files, `feature-list.json`,
|
|
20
|
+
`progress.md`, `session-handoff.md`, and `docs/todo.md` when the question is
|
|
21
|
+
about harness state.
|
|
22
|
+
- Treat `docs/product.md` as overview context and `docs/product{number}.md`
|
|
23
|
+
files as ordered product stages when reviewing product or feature drift.
|
|
24
|
+
- Ignore non-numeric product docs such as `docs/product-alpha.md` for stage
|
|
25
|
+
ordering.
|
|
26
|
+
- Verify that `feature-list.json` reflects only the active product stage, not
|
|
27
|
+
future product stages.
|
|
28
|
+
- Especially read `docs/product.md` and
|
|
29
|
+
`docs/product{number}.md` files when present because they explain what to do.
|
|
30
|
+
|
|
31
|
+
## Handoffs
|
|
32
|
+
|
|
33
|
+
- Report findings back to `ahe-think` by default.
|
|
34
|
+
- Call `ahe-harness` directly when review finds harness drift, stale tracking,
|
|
35
|
+
or product doc / feature-list mismatches.
|
|
36
|
+
- Call `ahe-converse` only when the missing information must come from the
|
|
37
|
+
user.
|
|
38
|
+
|
|
39
|
+
## Output
|
|
40
|
+
|
|
41
|
+
- State what was reviewed.
|
|
42
|
+
- State the relevant evidence or mismatch.
|
|
43
|
+
- State the recommended next agent.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-ship
|
|
3
|
+
description: Use when the user explicitly invokes `$ship`, `ship`, or `ahe ship` after a plan has just been created and wants Codex to save it.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE Ship
|
|
7
|
+
|
|
8
|
+
`ship` is a user-facing AHE command, but it is independent from the AHE
|
|
9
|
+
agent network.
|
|
10
|
+
|
|
11
|
+
Use this skill only to export a completed Codex Plan Mode plan and save it to `.plans/`.
|
|
12
|
+
Do not route through `think`. You must not call `harness`, `solve`, or any
|
|
13
|
+
other AHE workflow agent.
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
1. Detect if the current conversation is still in Plan Mode.
|
|
18
|
+
2. If Plan Mode is active, the Codex host must exit Plan Mode and replay the command.
|
|
19
|
+
3. Outside Plan Mode, locate the most recent completed `<proposed_plan>` already visible in the
|
|
20
|
+
current conversation.
|
|
21
|
+
4. If the latest plan is clear, use it directly. Do not ask the user to paste
|
|
22
|
+
the plan again.
|
|
23
|
+
5. Derive `plan_name` from the plan title. Use a short lowercase hyphenated
|
|
24
|
+
name. If no title or safe name can be derived, ask one focused question for
|
|
25
|
+
the plan name.
|
|
26
|
+
6. Build a compact markdown handoff with these sections:
|
|
27
|
+
- `# {Plan Title}`
|
|
28
|
+
- `## Handoff Summary`
|
|
29
|
+
- `## Source Plan`
|
|
30
|
+
- `## Execution Context`
|
|
31
|
+
- `## Assumptions`
|
|
32
|
+
- `## Constraints`
|
|
33
|
+
- `## Verification Plan`
|
|
34
|
+
- `## Risks and Open Questions`
|
|
35
|
+
- `## Instructions for Next Agent`
|
|
36
|
+
7. Write the final markdown through `scripts/write_plan.py`.
|
|
37
|
+
8. Report that the plan was saved to `.plans/{plan_name}.md` and stop.
|
|
38
|
+
|
|
39
|
+
## Missing Context
|
|
40
|
+
|
|
41
|
+
- If there is no recent `<proposed_plan>` in context, ask the user for the plan
|
|
42
|
+
text instead of inventing one.
|
|
43
|
+
- If the target file already exists, ask whether to overwrite it or choose a
|
|
44
|
+
distinct plan name.
|
|
45
|
+
|
|
46
|
+
## Writer Script
|
|
47
|
+
|
|
48
|
+
Use:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python .codex/skills/ship/scripts/write_plan.py \
|
|
52
|
+
--root "$PWD" \
|
|
53
|
+
--plan-name "Plan Title" \
|
|
54
|
+
< /tmp/ahe-plan.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Add `--overwrite` only after the user explicitly confirms replacing an existing
|
|
58
|
+
file.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env -S uv run --script
|
|
2
|
+
# /// script
|
|
3
|
+
# requires-python = ">=3.11"
|
|
4
|
+
# dependencies = []
|
|
5
|
+
# ///
|
|
6
|
+
#
|
|
7
|
+
# How to run:
|
|
8
|
+
# 1. Install uv (if not installed):
|
|
9
|
+
# curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
10
|
+
# 2. Run directly:
|
|
11
|
+
# uv run write_plan.py --root "$PWD" --plan-name "Plan Title" < /tmp/ahe-plan.md
|
|
12
|
+
# 3. Or with Python when dependencies are already available:
|
|
13
|
+
# python write_plan.py --root "$PWD" --plan-name "Plan Title" < /tmp/ahe-plan.md
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import re
|
|
18
|
+
import sys
|
|
19
|
+
from dataclasses import dataclass
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True, slots=True)
|
|
24
|
+
class WritePlanArgs:
|
|
25
|
+
root: Path
|
|
26
|
+
plan_name: str
|
|
27
|
+
overwrite: bool
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ArgumentError(Exception):
|
|
31
|
+
def __init__(self, message: str) -> None:
|
|
32
|
+
self.message = message
|
|
33
|
+
super().__init__(message)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class PlanAlreadyExistsError(Exception):
|
|
37
|
+
def __init__(self, path: Path) -> None:
|
|
38
|
+
self.path = path
|
|
39
|
+
super().__init__(f"Plan file already exists: {path}")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def sanitize_plan_name(plan_name: str) -> str:
|
|
43
|
+
normalized_name = re.sub(r"[^a-z0-9]+", "-", plan_name.strip().lower()).strip("-")
|
|
44
|
+
if normalized_name:
|
|
45
|
+
return normalized_name
|
|
46
|
+
raise ArgumentError("plan name must contain at least one letter or digit")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def parse_args(argv: list[str]) -> WritePlanArgs:
|
|
50
|
+
root: Path | None = None
|
|
51
|
+
plan_name: str | None = None
|
|
52
|
+
overwrite = False
|
|
53
|
+
index = 0
|
|
54
|
+
|
|
55
|
+
while index < len(argv):
|
|
56
|
+
argument = argv[index]
|
|
57
|
+
if argument == "--root":
|
|
58
|
+
index += 1
|
|
59
|
+
if index >= len(argv):
|
|
60
|
+
raise ArgumentError("--root requires a value")
|
|
61
|
+
root = Path(argv[index])
|
|
62
|
+
elif argument == "--plan-name":
|
|
63
|
+
index += 1
|
|
64
|
+
if index >= len(argv):
|
|
65
|
+
raise ArgumentError("--plan-name requires a value")
|
|
66
|
+
plan_name = argv[index]
|
|
67
|
+
elif argument == "--overwrite":
|
|
68
|
+
overwrite = True
|
|
69
|
+
else:
|
|
70
|
+
raise ArgumentError(f"unknown argument: {argument}")
|
|
71
|
+
index += 1
|
|
72
|
+
|
|
73
|
+
if root is None:
|
|
74
|
+
raise ArgumentError("--root is required")
|
|
75
|
+
if plan_name is None:
|
|
76
|
+
raise ArgumentError("--plan-name is required")
|
|
77
|
+
|
|
78
|
+
return WritePlanArgs(root=root, plan_name=plan_name, overwrite=overwrite)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def write_plan(args: WritePlanArgs, markdown: str) -> Path:
|
|
82
|
+
filename = f"{sanitize_plan_name(args.plan_name)}.md"
|
|
83
|
+
plans_dir = args.root / ".plans"
|
|
84
|
+
plan_path = plans_dir / filename
|
|
85
|
+
|
|
86
|
+
if plan_path.exists() and not args.overwrite:
|
|
87
|
+
raise PlanAlreadyExistsError(plan_path)
|
|
88
|
+
|
|
89
|
+
plans_dir.mkdir(parents=True, exist_ok=True)
|
|
90
|
+
plan_path.write_text(markdown, encoding="utf-8")
|
|
91
|
+
return plan_path
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def main() -> int:
|
|
95
|
+
try:
|
|
96
|
+
args = parse_args(sys.argv[1:])
|
|
97
|
+
plan_path = write_plan(args, sys.stdin.read())
|
|
98
|
+
except (ArgumentError, PlanAlreadyExistsError) as error:
|
|
99
|
+
print(error, file=sys.stderr)
|
|
100
|
+
return 1
|
|
101
|
+
|
|
102
|
+
print(plan_path)
|
|
103
|
+
return 0
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-solve
|
|
3
|
+
description: Internal AHE feature-solving workflow for dividing, planning, and solving feature work after the active goal is clear enough.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE Solver
|
|
7
|
+
|
|
8
|
+
This is an internal AHE workflow skill, not a user-facing command.
|
|
9
|
+
|
|
10
|
+
Do not treat `$ahe-solve` as a user command.
|
|
11
|
+
Use it when `ahe-think` decides that the next job is building or planning a
|
|
12
|
+
feature.
|
|
13
|
+
|
|
14
|
+
## Command Workflow: solve
|
|
15
|
+
|
|
16
|
+
- Read the active feature context from `docs/product.md`, `feature-list.json`,
|
|
17
|
+
`progress.md`, and any relevant code files.
|
|
18
|
+
- Read all existing `docs/*.md` files as supporting context.
|
|
19
|
+
- When numbered product stages exist, solve against the active product stage:
|
|
20
|
+
start with `docs/product1.md`, advance to later numeric stages only after the
|
|
21
|
+
current stage's derived feature-list items are `done`, and keep future product stages as context rather than implementation scope.
|
|
22
|
+
- Keep `docs/product.md` as overview context while working from an active
|
|
23
|
+
product stage.
|
|
24
|
+
- Divide broad work into smaller problems when useful.
|
|
25
|
+
- Plan each smaller problem before implementation.
|
|
26
|
+
- Call `ahe-review` when repo or code understanding is needed.
|
|
27
|
+
- Call `ahe-converse` when feature requirements, scope, or success criteria
|
|
28
|
+
are still unclear.
|
|
29
|
+
- Report the solved step, remaining work, and recommended next agent back to
|
|
30
|
+
`ahe-think`.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ahe-think
|
|
3
|
+
description: Internal AHE orchestration protocol for routing exact `ahe`, `ahe <query>`, and `<query> ahe` requests through the AHE agent network.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AHE Thinker
|
|
7
|
+
|
|
8
|
+
This is an internal AHE workflow skill, not a user-facing command.
|
|
9
|
+
|
|
10
|
+
Do not treat `$ahe-think` as a user command.
|
|
11
|
+
Use it as the central decision layer for AHE work.
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
- Judge what is missing before another agent acts.
|
|
16
|
+
- Optionally invoke `@ahe-harness-manager` as a pre-routing supervisor when the
|
|
17
|
+
harness state itself is unclear or contradictory.
|
|
18
|
+
- Optionally invoke `ahe-clean` when tracking artifacts are valid but noisy
|
|
19
|
+
enough that stale completed history makes the current next step harder to see.
|
|
20
|
+
- Judge the active `project`, `feature`, or `sub-feature`.
|
|
21
|
+
- Decide which of `Why`, `What`, and `How` are still missing.
|
|
22
|
+
- Choose the next internal agent: `ahe-clean`, `ahe-review`, `ahe-converse`,
|
|
23
|
+
`ahe-harness`, or `ahe-solve`.
|
|
24
|
+
- Receive each agent result, reassess the state, and decide the next step.
|
|
25
|
+
|
|
26
|
+
## Routing Inputs
|
|
27
|
+
|
|
28
|
+
- Exact `ahe` means continue existing harness work.
|
|
29
|
+
- `ahe <query>` and `<query> ahe` mean route the query through `ahe-think`.
|
|
30
|
+
- New-start intent such as `ahe new` arrives through the normal `ahe` query
|
|
31
|
+
path, and `ahe-think` decides whether to call `ahe-new`.
|
|
32
|
+
- Broad non-prefixed prompts must not activate AHE.
|
|
33
|
+
|
|
34
|
+
## Startup Contract
|
|
35
|
+
|
|
36
|
+
- Check whether the copied harness files are correct before reading their contents.
|
|
37
|
+
- Read files strictly in this order:
|
|
38
|
+
`AGENTS.md` -> `docs/product.md` plus `docs/product{n}.md` -> `docs/architecture.md` -> `docs/instructions.md` -> `init.sh` -> `feature-list.json` -> `status.json` -> `progress.md` -> `session-handoff.md`
|
|
39
|
+
- `ahe-think` explicitly owns the "what to do next" decisions for Codex-side AHE work.
|
|
40
|
+
|
|
41
|
+
## Decision Rules
|
|
42
|
+
|
|
43
|
+
- For a `project`, require `Why`, `What`, and `How` by default.
|
|
44
|
+
- For a `feature` or `sub-feature`, require only the minimum of `Why`, `What`,
|
|
45
|
+
and `How` needed to proceed safely.
|
|
46
|
+
- Read all existing `docs/*.md` files before choosing product work.
|
|
47
|
+
- Treat `docs/product.md` as overview context.
|
|
48
|
+
- Treat only `docs/product{number}.md` files as ordered product stages, starting
|
|
49
|
+
with `docs/product1.md` and then `docs/product2.md`.
|
|
50
|
+
- Ignore non-numeric product docs such as `docs/product-alpha.md` for stage
|
|
51
|
+
ordering.
|
|
52
|
+
- Choose the active product source as the lowest-numbered stage whose derived
|
|
53
|
+
feature work is not complete, or `docs/product.md` when no numbered stage
|
|
54
|
+
exists.
|
|
55
|
+
- Use `@ahe-harness-manager` as an optional pre-routing supervisor when:
|
|
56
|
+
- missing or invalid harness artifacts;
|
|
57
|
+
- `docs/*.md`, `feature-list.json`, `progress.md`, `session-handoff.md`, and
|
|
58
|
+
code appear to disagree;
|
|
59
|
+
- all tracked features are done but likely next work exists;
|
|
60
|
+
- the harness state is ambiguous enough that `ahe-review` vs `ahe-harness` vs `ahe-converse` is not yet clear.
|
|
61
|
+
- Keep `@ahe-harness-manager` advisory. It reports findings back to
|
|
62
|
+
`ahe-think`; it does not replace `ahe-think` as the decision layer.
|
|
63
|
+
- Use `ahe-clean` when the harness is valid but noisy, including:
|
|
64
|
+
- too many `done` entries in `feature-list.json` that are unrelated to active work;
|
|
65
|
+
- too many stale bullets in `session-handoff.md`;
|
|
66
|
+
- current next work is harder to identify because old completed detail dominates the trackers.
|
|
67
|
+
- Treat `ahe-clean` as distinct from `@ahe-harness-manager` escalation:
|
|
68
|
+
`ahe-clean` handles valid but noisy tracking state, while
|
|
69
|
+
`@ahe-harness-manager` handles missing, invalid, mismatched, or otherwise
|
|
70
|
+
ambiguous harness state.
|
|
71
|
+
- If the need is understanding repo code, harness drift, progress evidence, or
|
|
72
|
+
CodeGraph context, call `ahe-review`.
|
|
73
|
+
- If the need is user clarification, call `ahe-converse`.
|
|
74
|
+
- If the need is updating harness artifacts, product docs, feature tracking, or
|
|
75
|
+
todo sync, call `ahe-harness`.
|
|
76
|
+
- If the need is compacting stale completed tracking history without changing
|
|
77
|
+
product or instruction content, call `ahe-clean`.
|
|
78
|
+
- If the need is solving or decomposing feature work, call `ahe-solve`.
|
|
79
|
+
|
|
80
|
+
## Interaction Model
|
|
81
|
+
|
|
82
|
+
- `ahe-think` is centered, but direct worker-to-worker calls are allowed when
|
|
83
|
+
they are the obvious next step.
|
|
84
|
+
- Typical loops:
|
|
85
|
+
- `ahe-think -> @ahe-harness-manager -> ahe-think`
|
|
86
|
+
- `ahe-think -> ahe-clean -> ahe-think`
|
|
87
|
+
- `ahe-think -> ahe-review -> ahe-think`
|
|
88
|
+
- `ahe-think -> ahe-harness -> ahe-think`
|
|
89
|
+
- `ahe-think -> ahe-converse -> ahe-think`
|
|
90
|
+
- `ahe-think -> ahe-solve -> ahe-think`
|
|
91
|
+
- `ahe-think -> ahe-harness-checker -> ahe-think`
|
|
92
|
+
- Allowed direct handoffs include:
|
|
93
|
+
- `ahe-harness -> ahe-converse`
|
|
94
|
+
- `ahe-solve -> ahe-review`
|
|
95
|
+
- `ahe-review -> ahe-harness`
|
|
96
|
+
- `ahe-harness -> ahe-harness-checker`
|
|
97
|
+
- `ahe-new -> ahe-harness -> ahe-harness-checker`
|
|
98
|
+
- Every handoff must state the goal, reason, relevant files or context, and the
|
|
99
|
+
expected result.
|
|
100
|
+
|
|
101
|
+
## Broad Intent Routing
|
|
102
|
+
|
|
103
|
+
- Use `ahe-review` for review-first requests.
|
|
104
|
+
- Use `ahe-harness` for product, instructions, progress, feature-list, todo, or
|
|
105
|
+
tracker-policy maintenance.
|
|
106
|
+
- Use `ahe-clean` for reducing stale completed history in `feature-list.json`
|
|
107
|
+
and `session-handoff.md`.
|
|
108
|
+
- Use `ahe-solve` for feature implementation planning or execution work.
|
|
109
|
+
- Use `ahe-converse` when no safe next step exists without user input.
|
|
110
|
+
|
|
111
|
+
## Hard Editing Rule
|
|
112
|
+
|
|
113
|
+
- `AGENTS.md` and any `instructions.md` file may only be modified inside an explicitly changeable section.
|
|
114
|
+
- If no changeable section exists, AHE must ask via `ahe-converse` instead of editing.
|
|
115
|
+
- Reference and template folders must be strictly excluded from reads and edits per project rules.
|
|
116
|
+
|
|
117
|
+
## Completion
|
|
118
|
+
|
|
119
|
+
- Continue to the next skill or next unfinished feature until the active unit is
|
|
120
|
+
resolved.
|
|
121
|
+
- Keep `docs/product.md` as overview context and `feature-list.json` as a
|
|
122
|
+
derived tracker.
|
|
123
|
+
- Derive features from only the active product stage.
|
|
124
|
+
- Advance from one numbered product stage to the next only after all
|
|
125
|
+
feature-list items derived from the current active stage are `done`.
|