@ksuchoi216/ahe 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AHE Feature List",
4
+ "type": "object",
5
+ "required": [
6
+ "features"
7
+ ],
8
+ "properties": {
9
+ "features": {
10
+ "type": "array",
11
+ "items": {
12
+ "type": "object"
13
+ }
14
+ }
15
+ },
16
+ "additionalProperties": false
17
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AHE Process Status",
4
+ "type": "object",
5
+ "required": [
6
+ "version",
7
+ "current_command",
8
+ "current_step",
9
+ "workflow_complete",
10
+ "updated_at"
11
+ ],
12
+ "properties": {
13
+ "version": {
14
+ "type": "string"
15
+ },
16
+ "current_command": {
17
+ "type": [
18
+ "string",
19
+ "null"
20
+ ]
21
+ },
22
+ "current_step": {
23
+ "type": [
24
+ "string",
25
+ "null"
26
+ ],
27
+ "description": "The current step of the active workflow. For the ahe-init command, it represents the active stage being executed sequentially: 'ahe-init', 'ahe-spec', or 'ahe-update'."
28
+ },
29
+ "workflow_complete": {
30
+ "type": "boolean"
31
+ },
32
+ "updated_at": {
33
+ "type": [
34
+ "string",
35
+ "null"
36
+ ]
37
+ }
38
+ },
39
+ "additionalProperties": true
40
+ }
@@ -0,0 +1,64 @@
1
+ # {{AGENT_FILE_NAME}}
2
+
3
+ {{PROJECT_PURPOSE}}
4
+
5
+ ## Startup Workflow
6
+
7
+ Before writing code:
8
+
9
+ 1. **Confirm working directory** with `pwd`
10
+ 2. **Read this file** completely
11
+ 3. **Read project docs if present** (`docs/ARCHITECTURE.md`, `docs/PRODUCT.md`, `docs/INSTRUCTIONS.md`, `docs/TODO.md`, README, or equivalent)
12
+ 4. **Run `./init.sh`** to verify environment is healthy
13
+ 5. **Read `feature_list.json`** to see current feature state
14
+ 6. **Review recent commits** with `git log --oneline -5`
15
+
16
+ If baseline verification is failing, repair that first before adding new scope.
17
+
18
+ ## Working Rules
19
+
20
+ - **One feature at a time**: Pick exactly one unfinished feature from `feature_list.json`
21
+ - **Verification required**: Don't claim done without running verification commands
22
+ - **Update artifacts**: Before ending session, update `progress.md` and `feature_list.json`
23
+ - **Stay in scope**: Don't modify files unrelated to the current feature
24
+ - **Leave clean state**: Next session must be able to run `./init.sh` immediately
25
+
26
+ ## Required Artifacts
27
+
28
+ - `feature_list.json` — Feature state tracker (source of truth)
29
+ - `progress.md` — Session continuity log
30
+ - `init.sh` — Standard startup and verification path
31
+ - `session-handoff.md` — Optional, for larger sessions
32
+
33
+ ## Definition of Done
34
+
35
+ A feature is done only when ALL of the following are true:
36
+
37
+ - [ ] Target behavior is implemented
38
+ - [ ] Required verification actually ran (tests / lint / type-check)
39
+ - [ ] Evidence recorded in `feature_list.json` or `progress.md`
40
+ - [ ] Repository remains restartable from standard startup path
41
+
42
+ ## End of Session
43
+
44
+ Before ending a session:
45
+
46
+ 1. Update `progress.md` with current state
47
+ 2. Update `feature_list.json` with new feature status
48
+ 3. Record any unresolved risks or blockers
49
+ 4. Commit with descriptive message once work is in safe state
50
+ 5. Leave repo clean enough for next session to run `./init.sh` immediately
51
+
52
+ ## Verification Commands
53
+ - Tests: pytest tests/ -x
54
+ - Type check: mypy src/ --strict
55
+ - Lint: ruff check src/
56
+ - Full verification: make check (includes all above)
57
+
58
+ ## Escalation
59
+
60
+ If you encounter:
61
+ - **Architecture decisions**: Consult project architecture docs if present, otherwise ask user
62
+ - **Unclear requirements**: Check product/requirements docs if present, otherwise ask user
63
+ - **Repeated test failures**: Update progress, flag for human review
64
+ - **Scope ambiguity**: Re-read `feature_list.json` for definition of done
@@ -0,0 +1,29 @@
1
+ # Instructions
2
+
3
+ ## MUST NOT CHANGE INSTRUCTIONS
4
+ ### Code & Refactoring Style
5
+
6
+ Write code that is easy to read, maintain, and test.
7
+
8
+ Readability is the highest priority. Prefer simple, intuitive code that another developer can quickly understand.
9
+
10
+ Follow these rules:
11
+
12
+ 1. Use clear and descriptive names.
13
+ 2. Keep functions and classes focused and cohesive.
14
+ 3. Remove unnecessary duplication.
15
+ 4. Prefer self-explanatory code over comments.
16
+ 5. Follow the project's existing style and conventions. Use PEP 8 for Python unless the project requires otherwise.
17
+ 6. Make exception handling explicit and easy to understand.
18
+ 7. Keep inputs, outputs, and side effects clear.
19
+ 8. Structure code so it is easy to test.
20
+ 9. Avoid excessive abstraction, indirection, and over-engineering.
21
+ 10. Do not split code into too many small functions, classes, or files.
22
+ 11. Prefer files under approximately 500 lines when reasonable.
23
+ 12. Do not introduce structural changes solely to satisfy line-count targets. Any extraction or separation should provide a clear readability or maintainability benefit.
24
+ 13. Favor practical simplicity over theoretical purity.
25
+
26
+ When modifying existing code, preserve behavior unless a change is explicitly requested.
27
+
28
+ ## CAN CHANGE INSTRUCTIONS
29
+
@@ -0,0 +1,7 @@
1
+ # PRODUCT.md
2
+
3
+ ## Product Name
4
+
5
+ ## Product Objective
6
+
7
+ ## Requirements
@@ -0,0 +1,51 @@
1
+ # Session Progress Log
2
+
3
+ ## Current State
4
+
5
+ **Last Updated:** YYYY-MM-DD HH:MM
6
+ **Session ID:** [optional]
7
+ **Active Feature:** [feat-XXX - Feature Name]
8
+
9
+ ## Status
10
+
11
+ ### What's Done
12
+
13
+ - [x] [Completed item 1]
14
+ - [x] [Completed item 2]
15
+
16
+ ### What's In Progress
17
+
18
+ - [ ] [Current work item]
19
+ - Details: [specific task]
20
+ - Blockers: [if any]
21
+
22
+ ### What's Next
23
+
24
+ 1. [Next action item]
25
+ 2. [Following action item]
26
+
27
+ ## Blockers / Risks
28
+
29
+ - [ ] [Blocker 1]: [description, impact]
30
+ - [ ] [Risk 1]: [description, mitigation]
31
+
32
+ ## Decisions Made
33
+
34
+ - **[Decision 1]**: [description]
35
+ - Context: [why this decision was made]
36
+ - Alternatives considered: [what else was discussed]
37
+
38
+ ## Files Modified This Session
39
+
40
+ - `path/to/file1.ts` - [brief description of change]
41
+ - `path/to/file2.ts` - [brief description of change]
42
+
43
+ ## Evidence of Completion
44
+
45
+ - [ ] Tests pass: `[command and output]`
46
+ - [ ] Type check clean: `[command and output]`
47
+ - [ ] Manual verification: `[what was tested]`
48
+
49
+ ## Notes for Next Session
50
+
51
+ [Free-form notes that will help the next session pick up context]
@@ -0,0 +1,40 @@
1
+ # Session Handoff
2
+
3
+ ## Current Objective
4
+
5
+ - Goal:
6
+ - Current status:
7
+ - Branch / commit:
8
+
9
+ ## Completed This Session
10
+
11
+ - [ ]
12
+
13
+ ## Verification Evidence
14
+
15
+ | Check | Command | Result | Notes |
16
+ |---|---|---|---|
17
+ | | | | |
18
+
19
+ ## Files Changed
20
+
21
+ -
22
+
23
+ ## Decisions Made
24
+
25
+ -
26
+
27
+ ## Blockers / Risks
28
+
29
+ -
30
+
31
+ ## Next Session Startup
32
+
33
+ 1. Read `AGENTS.md`.
34
+ 2. Read `feature_list.json` and `progress.md`.
35
+ 3. Review this handoff.
36
+ 4. Run `./init.sh` or the documented verification command before editing.
37
+
38
+ ## Recommended Next Step
39
+
40
+ -
@@ -0,0 +1,44 @@
1
+ {
2
+ "features": [
3
+ {
4
+ "id": "feat-001",
5
+ "name": "Project Setup",
6
+ "description": "Confirm the project can install dependencies, run verification, and start from a clean checkout",
7
+ "dependencies": [],
8
+ "status": "not-started",
9
+ "evidence": ""
10
+ },
11
+ {
12
+ "id": "feat-002",
13
+ "name": "First User-Facing Feature",
14
+ "description": "Replace this placeholder with the first concrete behavior the agent should implement",
15
+ "dependencies": ["feat-001"],
16
+ "status": "not-started",
17
+ "evidence": ""
18
+ },
19
+ {
20
+ "id": "feat-003",
21
+ "name": "Verification Coverage",
22
+ "description": "Add or confirm tests, type checks, linting, or manual verification for the active feature",
23
+ "dependencies": ["feat-002"],
24
+ "status": "not-started",
25
+ "evidence": ""
26
+ },
27
+ {
28
+ "id": "feat-004",
29
+ "name": "Documentation Update",
30
+ "description": "Update README, architecture notes, or product docs affected by the implemented feature",
31
+ "dependencies": ["feat-003"],
32
+ "status": "not-started",
33
+ "evidence": ""
34
+ },
35
+ {
36
+ "id": "feat-005",
37
+ "name": "Cleanup and Handoff",
38
+ "description": "Record verification evidence, update progress.md, and leave a clear next-session path",
39
+ "dependencies": ["feat-004"],
40
+ "status": "not-started",
41
+ "evidence": ""
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,68 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "=== Harness Initialization ==="
5
+
6
+ conda_env_name=""
7
+ if [ -f environment.yml ]; then
8
+ conda_env_name="$(sed -n 's/^name:[[:space:]]*//p' environment.yml | head -n 1)"
9
+ elif [ -f conda.yaml ]; then
10
+ conda_env_name="$(sed -n 's/^name:[[:space:]]*//p' conda.yaml | head -n 1)"
11
+ fi
12
+ if [ -n "$conda_env_name" ]; then
13
+ echo "=== Conda environment: $conda_env_name ==="
14
+ fi
15
+
16
+ if [ ! -f pyproject.toml ] && [ ! -f requirements.txt ] && [ ! -f setup.py ] && [ ! -f environment.yml ] && [ ! -f conda.yaml ]; then
17
+ echo "Error: No Python manifest (pyproject.toml, requirements.txt, setup.py, environment.yml, or conda.yaml) found."
18
+ exit 1
19
+ fi
20
+
21
+ # Ensure virtual environment exists
22
+ if [ ! -d ".venv" ]; then
23
+ echo "=== Creating virtual environment ==="
24
+ uv venv
25
+ fi
26
+
27
+ # Activate virtual environment
28
+ echo "=== Activating virtual environment ==="
29
+ source .venv/bin/activate
30
+
31
+ # Install dependencies
32
+ echo "=== Installing dependencies ==="
33
+ if [ -f pyproject.toml ]; then
34
+ if grep -q "^\[project\]" pyproject.toml || grep -q "^\[build-system\]" pyproject.toml; then
35
+ uv pip install -e .
36
+ fi
37
+ fi
38
+ if [ -f setup.py ]; then
39
+ uv pip install -e .
40
+ fi
41
+ if [ -f requirements.txt ]; then
42
+ uv pip install -r requirements.txt
43
+ fi
44
+ if [ -f requirements-dev.txt ]; then
45
+ uv pip install -r requirements-dev.txt
46
+ fi
47
+ if [ -f requirements-test.txt ]; then
48
+ uv pip install -r requirements-test.txt
49
+ fi
50
+
51
+ echo "=== Running Python verification ==="
52
+ # Check if pytest is installed and run it, otherwise warn or skip
53
+ if python -c "import pytest" >/dev/null 2>&1; then
54
+ python -m pytest
55
+ else
56
+ echo "pytest not found. Skipping tests."
57
+ fi
58
+
59
+ # Compile Python source files to check for syntax errors
60
+ python -m compileall .
61
+
62
+ echo "=== Verification Complete ==="
63
+ echo ""
64
+ echo "Next steps:"
65
+ echo "1. Read feature_list.json to see current feature state"
66
+ echo "2. Pick ONE unfinished feature to work on"
67
+ echo "3. Implement only that feature"
68
+ echo "4. Re-run verification before claiming done"
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/env node
2
+ const AHE_DIRECTIVE_MARKER = "<ahe-mode>";
3
+ const AHE_PROGRESS_DIRECTIVE = [
4
+ AHE_DIRECTIVE_MARKER,
5
+ "AHE automatic operation activated.",
6
+ "",
7
+ "The user sent the exact AHE command. Operate as the Awesome Harness Engineering router:",
8
+ "",
9
+ "1. Run CodeGraph preflight before inspecting harness status:",
10
+ " - Check whether the CodeGraph CLI is installed with `command -v codegraph`.",
11
+ " - If the `codegraph` command is not installed, report `NOT INSTALLATION of codegraph`, skip `codegraph init` and `codegraph sync`, and continue with normal repo inspection.",
12
+ " - If `.codegraph/` does not exist, run `codegraph init` before reviewing code.",
13
+ " - If `.codegraph/` exists, run `codegraph sync` before reviewing code.",
14
+ "",
15
+ "2. Inspect current harness state before choosing a workflow:",
16
+ " - Check `AGENTS.md`.",
17
+ " - Check `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` as the product/specification source of truth.",
18
+ " - Check `feature-list.json` as a derived tracker.",
19
+ " - Check `PROGRESS.md`.",
20
+ " - Use `ahe-thinking` as the internal decision layer before choosing the next action.",
21
+ "",
22
+ "3. Review code through CodeGraph when available:",
23
+ " - Prefer CodeGraph MCP or CodeGraph exploration for code review and impact context after the preflight command succeeds.",
24
+ " - If CodeGraph is not installed, skip CodeGraph review and rely on normal repo inspection.",
25
+ "",
26
+ "4. Make the first response a simple harness engineering status report table before proceeding:",
27
+ " - Start the response with a concise status report table.",
28
+ " - Use this consistent Markdown table format:",
29
+ " | Item | Content |",
30
+ " |---|---|",
31
+ " | AGENTS.md | Exists/missing, purpose status, and any obvious issue. |",
32
+ " | PRODUCT.md | Exists/missing, completion state, and whether product scope needs work. |",
33
+ " | INSTRUCTIONS.md | Exists/missing, and whether instruction boundaries need work. |",
34
+ " | feature-list.json | Valid/missing/invalid, unfinished feature summary, and all-done status. |",
35
+ " | PROGRESS.md | Exists/missing and current session state. |",
36
+ " - Keep the table short and readable.",
37
+ " - Do not include the next step inside the table.",
38
+ "",
39
+ "5. Decide the next AHE workflow with `ahe-thinking`:",
40
+ " - If no harness files exist, route to `$ahe-init`.",
41
+ " - If `docs/PRODUCT.md` or `docs/INSTRUCTIONS.md` is missing or empty, classify the state as `harness engineering not enough` and prioritize product/instructions specification.",
42
+ " - 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.",
43
+ " - 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.",
44
+ " - Respect dependencies listed in `feature-list.json`; do not start a dependent feature before prerequisites are done.",
45
+ " - 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.",
46
+ " - Judge the active `project`, `feature`, or `sub-feature` before moving forward.",
47
+ " - For a `project`, require `Why`, `What`, and `How` by default.",
48
+ " - For a `feature` or `sub-feature`, require only the minimum of `Why`, `What`, and `How` needed to proceed safely.",
49
+ "",
50
+ "6. Ask for clarification instead of guessing:",
51
+ " - If multiple plausible next steps exist, feature data conflicts, dependencies are unclear, or CodeGraph review points to several valid directions, use `ahe-thinking` to judge the missing detail.",
52
+ " - If clarity is missing, call `ahe-conversation` for the exact missing `Why`, `What`, or `How`.",
53
+ " - Continue only after one safe next step is clear.",
54
+ "",
55
+ "7. After the table, classify the harness into exactly one state.",
56
+ " - Use exactly one state: `harness engineering not enough`, `in the middle of building features`, or `completed all`.",
57
+ " - Do not include the next step inside the table.",
58
+ " - Continue automatically after classification.",
59
+ " - Follow this loop: `thinking -> conversation if needed -> execution -> thinking`.",
60
+ ].join("\\n");
61
+
62
+ const AHE_INIT_DIRECTIVE = [
63
+ AHE_DIRECTIVE_MARKER,
64
+ "AHE automatic operation activated.",
65
+ "",
66
+ "The user sent the exact AHE init command. Treat this as a possible new start request:",
67
+ "",
68
+ "1. Route to `$ahe-init` first.",
69
+ "2. If no AHE-managed harness files exist, start initialization normally.",
70
+ "3. 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.",
71
+ "4. Do not back up, remove, overwrite, or refresh existing harness files before the user answers the restart-scope question.",
72
+ "5. Interpret the restart scope from the user's free-form answer; examples like `purpose` and `product` are not a closed list.",
73
+ "6. Product/instructions specification details belong in `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md`, not `AGENTS.md`.",
74
+ "7. Use `ahe-thinking` before clarification when the next setup step is uncertain.",
75
+ "8. If clarification is needed, call `ahe-conversation` for the exact missing detail.",
76
+ "9. Continue through initialization work until the new start path is clear.",
77
+ ].join("\\n");
78
+
79
+ function isExactAheCommand(prompt) {
80
+ return normalizePrompt(prompt) === "ahe";
81
+ }
82
+
83
+ function isExactAheInitCommand(prompt) {
84
+ const normalizedPrompt = normalizePrompt(prompt);
85
+ return (
86
+ normalizedPrompt === "ahe init" ||
87
+ normalizedPrompt === "ahe-init" ||
88
+ normalizedPrompt === "$ahe-init"
89
+ );
90
+ }
91
+
92
+ function normalizePrompt(prompt) {
93
+ return prompt.trim().toLowerCase();
94
+ }
95
+
96
+ async function main() {
97
+ let raw = "";
98
+ process.stdin.setEncoding("utf8");
99
+ for await (const chunk of process.stdin) {
100
+ raw += chunk;
101
+ }
102
+
103
+ if (!raw.trim()) return;
104
+
105
+ let parsed;
106
+ try {
107
+ parsed = JSON.parse(raw);
108
+ } catch (e) {
109
+ return;
110
+ }
111
+
112
+ if (
113
+ parsed &&
114
+ parsed.hook_event_name === "UserPromptSubmit" &&
115
+ typeof parsed.prompt === "string"
116
+ ) {
117
+ if (isExactAheCommand(parsed.prompt)) {
118
+ const output = {
119
+ hookSpecificOutput: {
120
+ hookEventName: "UserPromptSubmit",
121
+ additionalContext: AHE_PROGRESS_DIRECTIVE
122
+ }
123
+ };
124
+ process.stdout.write(JSON.stringify(output) + "\n");
125
+ } else if (isExactAheInitCommand(parsed.prompt)) {
126
+ const output = {
127
+ hookSpecificOutput: {
128
+ hookEventName: "UserPromptSubmit",
129
+ additionalContext: AHE_INIT_DIRECTIVE
130
+ }
131
+ };
132
+ process.stdout.write(JSON.stringify(output) + "\n");
133
+ }
134
+ }
135
+ }
136
+
137
+ main().catch(() => {});
@@ -0,0 +1,16 @@
1
+ {
2
+ "hooks": {
3
+ "UserPromptSubmit": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "node .codex/hooks/ahe-hook.js",
9
+ "timeout": 5,
10
+ "statusMessage": "AHE: Checking Keyword Trigger"
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: ahe-conversation
3
+ description: Internal AHE protocol for recursive clarification, conversation state, and resume-aware workflow guidance.
4
+ ---
5
+
6
+ # AHE Conversation
7
+
8
+ This is an internal AHE protocol skill, not a user-facing command.
9
+
10
+ Do not treat `$ahe-conversation` as a user command.
11
+ Use it only when another AHE workflow skill needs more conversation before it can
12
+ continue safely.
13
+ Use it after `ahe-thinking` identifies a missing decision or missing `Why`,
14
+ `What`, or `How`.
15
+
16
+ ## When to Converse
17
+
18
+ Start or continue an AHE conversation when the missing answer materially changes
19
+ one of these:
20
+
21
+ - Project purpose or target user.
22
+ - Product behavior, scope, success criteria, or out-of-scope boundaries.
23
+ - Implementation instructions, architecture direction, or verification commands.
24
+ - Harness file ownership, overwrite behavior, or reset behavior.
25
+ - `.ahe/process_status.json`, `PROGRESS.md`, or `SESSION-HANDOFF.md` state.
26
+ - The next workflow step when several valid paths are possible.
27
+ - The missing `Why`, `What`, or `How` for the current `project`, `feature`, or
28
+ `sub-feature`.
29
+
30
+ If the missing detail can be inferred safely from existing files, infer
31
+ conservatively and record the assumption in the active workflow artifact.
32
+
33
+ ## Conversation Protocol
34
+
35
+ - Inspect relevant existing files before asking.
36
+ - Let `ahe-thinking` judge what is missing before you ask.
37
+ - Explain the decision point briefly when context helps the user answer.
38
+ - Ask exactly one question at a time.
39
+ - Use a Codex-supported structured response request when meaningful options exist.
40
+ - Provide 2-3 mutually exclusive options when useful, and allow custom input when
41
+ predefined options are not enough.
42
+ - Keep each question specific to the active AHE workflow.
43
+ - Think through what the answer will unlock before asking.
44
+ - Ask again when the answer is vague, off-topic, contradictory, or incomplete
45
+ according to the calling skill's clarification criteria.
46
+ - Continue until the calling workflow has enough information to act.
47
+ - Do not expand the scope of questioning beyond the missing detail that
48
+ `ahe-thinking` identified.
49
+
50
+ ## State Persistence
51
+
52
+ Before pausing for user input, update `.ahe/process_status.json` when it exists
53
+ or when the active workflow uses it:
54
+
55
+ - Set the active command or skill name.
56
+ - Set `workflow_complete` to `false`.
57
+ - Set `current_step` to the pending question, decision point, or missing field.
58
+ - Refresh `updated_at`.
59
+ - Preserve already collected project and product data.
60
+
61
+ Update `PROGRESS.md` and `SESSION-HANDOFF.md` when the pending conversation
62
+ changes the active workflow state, blocks completion, or affects the next
63
+ session's startup path.
64
+
65
+ ## Resume Protocol
66
+
67
+ When resuming after the user answers:
68
+
69
+ - Read `.ahe/process_status.json` and the relevant workflow artifacts.
70
+ - Summarize the already collected data briefly.
71
+ - Identify the missing field or decision that is still blocking progress.
72
+ - Ask the next focused question, or continue the calling workflow when the
73
+ answer satisfies its clarification criteria.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: ahe-init
3
+ description: Initialize AHE in the current workspace and create the base harness files.
4
+ ---
5
+
6
+ # AHE Init
7
+
8
+ Use this skill when the user invokes `$ahe-init`.
9
+
10
+ ## Command Workflow: ahe-init
11
+
12
+ ### Workspace Inspection
13
+
14
+ - Read `AGENTS.md` if it already exists.
15
+ - Read `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` when they exist.
16
+ - Read `docs/ARCHITECTURE.md` if it exists, but treat it as an optional document.
17
+ - Read existing workspace-root harness files that may be copied from templates, including `PROGRESS.md`, `SESSION-HANDOFF.md`, `feature-list.json`, and `init.sh`.
18
+ - Read `.ahe/process_status.json` when it exists.
19
+ - Treat `AGENTS.md`, `docs/PRODUCT.md`, `docs/INSTRUCTIONS.md`, `PROGRESS.md`, `SESSION-HANDOFF.md`, `feature-list.json`, `init.sh`, and `.ahe/process_status.json` as AHE-managed harness files for restart-scope decisions.
20
+
21
+ ### Sequential Conversation Flow
22
+
23
+ - Treat exact `ahe init` as a possible new start request.
24
+ - If no AHE-managed harness files exist, start initialization normally without asking a restart-scope question.
25
+ - If any AHE-managed harness file already exists, read the existing files first.
26
+ - When existing harness files are present, summarize the current project purpose and product specification state, then ask what restart scope the user wants before backing up, removing, overwriting, or refreshing existing harness files.
27
+ - Do not back up, remove, overwrite, or refresh existing harness files until the restart scope is clear.
28
+ - Interpret the restart scope from the user's free-form answer; examples are guidance only and must not limit valid answers.
29
+ - 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`, back up the current product/specification files in scope, and restart product specification work in `docs/PRODUCT.md`.
31
+ - If the answer names a narrower custom scope, preserve unrelated harness files and restart only the named scope after backing up the affected files.
32
+ - If `AGENTS.md` already exists, ask the user whether the current `AGENTS.md` is right.
33
+ - If the current `AGENTS.md` is not right or does not exist, ask for the purpose of this project.
34
+ - If `AGENTS.md` does not exist, copy `AGENTS.md` from `.codex/ahe-shared/templates/`.
35
+ - Update only the `PROJECT_PURPOSE` portion of `AGENTS.md`.
36
+ - Keep `AGENTS.md` limited to the project purpose and base agent settings.
37
+ - Do not put product specification details in `AGENTS.md`.
38
+ - Send product behavior, scope, requirements, success criteria, and workflow details to `ahe-spec` so they are written in `docs/PRODUCT.md` first.
39
+ - Generating an empty `feature-list.json` from a template is allowed, but do not write concrete feature items until `docs/PRODUCT.md` is populated.
40
+ - Ask whether the project language is Python using a Codex-supported structured response request with meaningful options and custom input.
41
+ - If the user answers that the project language is not Python, ask again: "Which language do you use?".
42
+ - If the workspace already has active harness files and the user chooses a restart scope, create a timestamped backup directory under `.ahe/backups/`.
43
+ - Copy `AGENTS.md` into the backup directory when it exists.
44
+ - Copy the current `docs/PRODUCT.md` into the backup directory when it exists.
45
+ - Copy the current `PROGRESS.md` into the backup directory when it exists.
46
+ - Copy the current `SESSION-HANDOFF.md` into the backup directory when it exists.
47
+ - Copy the current `feature-list.json` into the backup directory when it exists.
48
+ - Copy `init.sh` into the backup directory when it exists.
49
+ - Copy the `docs/` folder into the backup directory when it exists.
50
+ - Remove the previous `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` when the chosen restart scope includes product specification after backup.
51
+ - Remove the previous `PROGRESS.md` when the chosen restart scope includes progress tracking after backup.
52
+ - Remove the previous `SESSION-HANDOFF.md` when the chosen restart scope includes session handoff after backup.
53
+ - Remove the previous `feature-list.json` when the chosen restart scope includes feature tracking after backup.
54
+ - After backup, remove only the files included in the chosen restart scope before continuing the new start flow.
55
+ - Find all template files under `.codex/ahe-shared/templates/`.
56
+ - Ignore `AGENTS.md` and `PRODUCT.md` when copying template files.
57
+ - Before copying a template file into the workspace root, check whether the target file already exists and ask for explicit overwrite confirmation when needed.
58
+ - Execute the following three steps sequentially, updating the progress status (`current_step` in `.ahe/process_status.json`):
59
+ 1. complete the embedded init setup work (status: "ahe-init")
60
+ 2. call "ahe-spec" (status: "ahe-spec")
61
+ 3. call "ahe-update" (status: "ahe-update")
62
+
63
+ ### Harness Generation
64
+
65
+ - Create or refresh `AGENTS.md`.
66
+ - Create or refresh missing workspace-root harness files from `.codex/ahe-shared/templates/`, converting markdown filenames to uppercase when needed.
67
+ - Create `.ahe/process_status.json` and update it at each step to indicate the active status from the three-step sequence.
68
+ - Create missing harness files from `.codex/ahe-shared/templates/`.
69
+ - Keep the generated files aligned with the installed shared templates.
70
+ - Only allow additions/removals/edits to `docs/INSTRUCTIONS.md` inside `## CAN CHANGE INSTRUCTIONS`; preserve `## MUST NOT CHANGE INSTRUCTIONS`.
71
+
72
+ ## Clarification Rule
73
+
74
+ When the next setup step is not clear, follow the `ahe-thinking` protocol first. If `ahe-thinking` finds missing information, follow the `ahe-conversation` 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.
75
+
76
+ ### User Response Target
77
+
78
+ - Collect the project purpose, language choice, and overwrite decisions needed to continue initialization safely.
79
+
80
+ ### Questions to Ask
81
+
82
+ - Ask whether the existing `AGENTS.md` is correct.
83
+ - Ask what restart scope the user wants when harness files already exist.
84
+ - Ask what the purpose of this project is when `AGENTS.md` is missing or incorrect.
85
+ - Ask whether the project language is Python and ask which language is used when the answer is no or custom.
86
+ - Ask whether template files should be overwritten when target files already exist.
87
+ - Ask follow-up questions when the restart scope, purpose, language, or overwrite choice is still unclear.
88
+
89
+ ### Clarification Criteria
90
+
91
+ - The answer must be specific enough to update `PROJECT_PURPOSE`.
92
+ - The answer must make it clear whether initialization should continue with the current `AGENTS.md` or with a new purpose.
93
+ - The answer must clearly identify whether Python guidance applies.
94
+ - The answer must make the restart scope clear when existing harness files must be backed up or replaced.
95
+ - The answer must make overwrite intent explicit for existing template targets.
96
+ - The answer must resolve any setup choice that blocks the next workflow step.
97
+
98
+ ### Re-ask When
99
+
100
+ - Ask again when the answer is vague, off-topic, contradictory, or incomplete.
101
+ - Ask again when the answer does not identify the project goal, target user, or intended outcome clearly enough to continue initialization.
102
+ - Ask again when the language answer is ambiguous or does not clearly name the language in use.
103
+ - Ask again when the overwrite decision is not explicit.
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: ahe-spec
3
+ description: Internal AHE specification workflow for updating product and instructions docs.
4
+ ---
5
+
6
+ # AHE Spec
7
+
8
+ This is an internal AHE workflow skill, not a user-facing command.
9
+
10
+ Do not treat `$ahe-spec` as a user command.
11
+ Use it after `ahe-thinking` decides that specification work must continue.
12
+
13
+ ## Command Workflow: ahe-spec
14
+
15
+ ### Spec Inspection
16
+
17
+ - Read `docs/PRODUCT.md` if it exists.
18
+ - Read `docs/INSTRUCTIONS.md` if it exists.
19
+ - Read `AGENTS.md`, `feature-list.json`, `PROGRESS.md`, and `SESSION-HANDOFF.md`.
20
+
21
+ ### Sequential Spec Conversation Flow
22
+
23
+ - `docs/PRODUCT.md` is the canonical home for product specification details collected during `ahe init`.
24
+ - Clarify product goal, scope, and success criteria when `docs/PRODUCT.md` needs to change.
25
+ - Clarify project instructions when `docs/INSTRUCTIONS.md` needs to change.
26
+ - Draft the relevant specification updates in chat and ask for user approval.
27
+ - Ask recursively for more detail until the affected specification areas are clear and approved.
28
+
29
+ ### Spec Completion
30
+
31
+ - Write product behavior, scope, requirements, success criteria, and workflow details into `docs/PRODUCT.md`.
32
+ - `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.
33
+ - Do not move product specification details into `AGENTS.md`.
34
+ - Update only the relevant docs among `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md`.
35
+ - When updating `docs/INSTRUCTIONS.md`, only allow additions/removals/edits to instructions inside `## CAN CHANGE INSTRUCTIONS`; preserve `## MUST NOT CHANGE INSTRUCTIONS`.
36
+ - Update `.ahe/process_status.json`.
37
+ - Update `PROGRESS.md` and `SESSION-HANDOFF.md` when specification changes affect active work.
38
+
39
+ ## Clarification Rule
40
+
41
+ When the next specification step is not clear, follow the `ahe-thinking` protocol first. If `ahe-thinking` finds missing information, follow the `ahe-conversation` 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.
42
+
43
+ ### User Response Target
44
+
45
+ - Collect the product or instructions details required to update the relevant specification docs.
46
+
47
+ ### Questions to Ask
48
+
49
+ - Ask who the product is for and what problem it solves when product intent is unclear.
50
+ - Ask what behavior, scope boundaries, and success criteria should be documented.
51
+ - Ask what rule, practice, or guideline should be documented as an instruction.
52
+
53
+ ### Clarification Criteria
54
+
55
+ - The answer must identify the target user, product goal, main behavior, scope, and success signal when product details are changing.
56
+ - The answer must describe any instruction and its practical meaning clearly enough that another engineer can follow it.
57
+ - The answer must be concrete enough to update the relevant specification docs without guessing missing intent.
58
+
59
+ ### Re-ask When
60
+
61
+ - Ask again when the answer is vague, contradictory, or incomplete.
62
+ - Ask again when the response gives features without explaining the user goal or success criteria.
63
+ - Ask again when the response names an instruction topic without the actual rule.
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: ahe-thinking
3
+ description: Internal AHE orchestration protocol for deciding what to clarify, what to execute, and what to do next.
4
+ ---
5
+
6
+ # AHE Thinking
7
+
8
+ This is an internal AHE protocol skill, not a user-facing command.
9
+
10
+ Do not treat `$ahe-thinking` as a user command.
11
+ Use it before and between AHE workflow actions when the next safe step is not
12
+ already obvious.
13
+
14
+ ## Purpose
15
+
16
+ - Judge what is missing before another AHE workflow acts.
17
+ - Decide whether the current unit is clear enough to execute safely.
18
+ - Call `ahe-conversation` only when clarification is still needed.
19
+ - Continue to the next skill or next unfinished feature when the path is clear.
20
+
21
+ ## Units of Work
22
+
23
+ Inspect the current unit as `project`, `feature`, or `sub-feature`.
24
+
25
+ - `project`: overall goal, target user, expected outcome, and delivery
26
+ direction.
27
+ - `feature`: one concrete capability or work item under the project.
28
+ - `sub-feature`: one smaller capability or step under a feature.
29
+
30
+ ## Clarity Judgment
31
+
32
+ Judge the current unit against `Why`, `What`, and `How`.
33
+
34
+ - `Why`: why this unit matters, what problem it solves, or what purpose it
35
+ serves.
36
+ - `What`: what result, behavior, or output should be built.
37
+ - `How`: how the work should be approached when methodology or architecture
38
+ matters.
39
+
40
+ ### Project Rule
41
+
42
+ For a `project`, require `Why`, `What`, and `How` by default before moving
43
+ forward.
44
+
45
+ ### Feature Rule
46
+
47
+ For a `feature` or `sub-feature`, require only the minimum needed to proceed
48
+ safely.
49
+
50
+ - If the feature is already clear from the project context, do not ask all
51
+ three again.
52
+ - If only the result is missing, ask only `What`.
53
+ - If the feature goal is clear but the implementation direction is risky or
54
+ materially different, ask `How`.
55
+ - If the feature exists but its purpose is unclear, ask `Why`.
56
+
57
+ ## Next-Step Decision
58
+
59
+ - If `docs/PRODUCT.md` or `docs/INSTRUCTIONS.md` is missing or empty, classify the state as
60
+ `harness engineering not enough` and prioritize product/instructions specification work.
61
+ - `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` form the required harness contract. `docs/PRODUCT.md` is the product/specification source of truth, and
62
+ `feature-list.json` is a derived tracker. Do not write specific feature items
63
+ to `feature-list.json` until `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` are established.
64
+ - If other harness essentials are missing or inconsistent, classify the state as
65
+ `harness engineering not enough` and continue the harness-building workflow.
66
+ - If the harness exists and there is unfinished tracked work, classify the
67
+ state as `in the middle of building features` and continue the first safe
68
+ unfinished feature.
69
+ - If tracked work is complete and no obvious essential harness gap remains,
70
+ classify the state as `completed all` and ask for the next task.
71
+
72
+ ## Conversation Handoff
73
+
74
+ If clarity is missing, call `ahe-conversation` with the exact missing `Why`,
75
+ `What`, or `How`.
76
+
77
+ - Explain which unit is blocked.
78
+ - Explain what answer will unlock the next action.
79
+ - Ask for only the minimum missing detail.
80
+ - When the path is clear, continue to the next skill or next unfinished feature.
81
+
82
+ ## Execution Loop
83
+
84
+ Follow this loop whenever AHE is routing or continuing work:
85
+
86
+ `thinking -> conversation if needed -> execution -> thinking`
87
+
88
+ After execution, reassess the active unit before choosing the next step.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: ahe-update
3
+ description: Internal AHE workflow for synchronizing tracked work and handoff artifacts.
4
+ ---
5
+
6
+ # AHE Update
7
+
8
+ This is an internal AHE workflow skill, not a user-facing command.
9
+
10
+ Do not treat `$ahe-update` as a user command.
11
+ Use it after `ahe-thinking` decides that tracked harness work should be synchronized.
12
+
13
+ ## Command Workflow: ahe-update
14
+
15
+ - Read `feature-list.json`.
16
+ - Read `PROGRESS.md` if it exists.
17
+ - Read `SESSION-HANDOFF.md`.
18
+ - Read `docs/todo.md` when it exists.
19
+ - If the user is adding new work, clarify the todo item, append it under the last `## TODO` section in `docs/todo.md`, and create that section when it does not exist.
20
+ - Apply the queued `docs/todo.md` content to `docs/PRODUCT.md`. If `docs/PRODUCT.md` does not exist, create it.
21
+ - Remove the applied content from `docs/todo.md` because that todo content was already applied in `docs/PRODUCT.md`.
22
+ - Update `feature-list.json` to derive the specific feature items from the updated `docs/PRODUCT.md`.
23
+ - Update `PROGRESS.md`.
24
+ - Update `SESSION-HANDOFF.md`.
25
+
26
+ ## Clarification Rule
27
+
28
+ When the next update step is not clear, follow the `ahe-thinking` protocol first. If `ahe-thinking` finds missing information, follow the `ahe-conversation` 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.
29
+
30
+ ### User Response Target
31
+
32
+ - Collect either an actionable todo entry to queue or a clear instruction to synchronize the existing queued work.
33
+
34
+ ### Questions to Ask
35
+
36
+ - Ask what work needs to be done when the user is adding a new todo item.
37
+ - Ask which file, feature area, or workflow the todo affects.
38
+ - Ask what outcome or completion signal the todo should capture.
39
+ - Ask whether the user wants to queue new work, apply queued work, or do both when that is unclear.
40
+
41
+ ### Clarification Criteria
42
+
43
+ - The answer must describe actionable work, the affected area, and the intended outcome when queuing a todo item.
44
+ - The answer must be clear enough to decide whether to queue work, apply queued work, or do both.
45
+
46
+ ### Re-ask When
47
+
48
+ - Ask again when the answer is too broad, off-topic, or only names a topic without describing the work.
49
+ - Ask again when dependencies, affected area, intended outcome, or update action are still unclear.
50
+
51
+ ## Session Tracking and Handoff Sync
52
+
53
+ ### Tracking Update Rules
54
+
55
+ - Update `.ahe/process_status.json` at workflow start.
56
+ - Update `.ahe/process_status.json` after every answered question.
57
+ - Refresh `updated_at` every time workflow state changes.
58
+ - Keep `current_command`, `current_step`, and `workflow_complete` aligned with the active workflow state.
59
+ - Keep the `files` status map aligned with the actual workspace files.
60
+
61
+ ### Progress and Handoff Content Requirements
62
+
63
+ - Update `PROGRESS.md` whenever the active feature, workflow status, blockers, or verification state changes.
64
+ - Update `SESSION-HANDOFF.md` whenever the current objective, completed work, important files, verification evidence, or recommended next step changes.
65
+ - PROGRESS.md must reflect the current active feature and latest completed work.
66
+ - SESSION-HANDOFF.md must leave the next Codex session with a concrete startup path.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Awesome Harness Engineering (ahe-codex)
2
+
3
+ Codex chat workflow skill installer for Awesome Harness Engineering.
4
+
5
+ This project provides a set of Codex skills and templates to automatically build project harnesses. It is designed to be used directly within a Codex chat conversation, guiding users through the engineering workflow.
6
+
7
+ ## Installation
8
+
9
+ ### For End Users
10
+ To install the Codex skills in your current workspace, run:
11
+
12
+ ```bash
13
+ npx --yes --package=ahe-codex ahe install
14
+ ```
15
+
16
+ Alternatively, you can install it globally:
17
+
18
+ ```bash
19
+ npm install -g ahe-codex
20
+ ahe install
21
+ ```
22
+
23
+ ### For Local Development
24
+ If you have cloned the repository and want to install it locally:
25
+
26
+ ```bash
27
+ npx --yes --package=file:. ahe install
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ Once installed, the `ahe` skills will be added to your `.codex` directory.
33
+
34
+ 1. **Open Codex chat** in your workspace.
35
+ 2. Use the `ahe init` skill to start a new harness.
36
+ 3. Use exact `ahe` skills (like `ahe-conversation`, `ahe-thinking`, `ahe-spec`, `ahe-update`) to continue your existing harness work.
37
+
38
+ ### Available CLI Commands
39
+
40
+ The command-line interface is primarily used for the installation and maintenance of the Codex skills:
41
+
42
+ - `ahe install [--force] [--backup]`: Installs or updates the skills in your `.codex/` directory.
43
+ - `ahe doctor`: Checks the health and integrity of your AHE skill installation.
44
+ - `ahe version`: Prints the current version.
45
+
46
+ ## Project Structure
47
+
48
+ - `bin/ahe`: The main CLI executable for installing the skills.
49
+ - `.codex/skills/`: Contains the managed Codex skills (`ahe-init`, `ahe-conversation`, `ahe-thinking`, `ahe-spec`, `ahe-update`).
50
+ - `.codex/ahe-shared/`: Contains shared assets like `templates` and `schemas`.
51
+ - `AGENTS.md`: Defines the project objectives, global rules, and startup workflow.
52
+
53
+ ## Agent Working Rules
54
+
55
+ If you are an AI agent working on this repository, please strictly follow the guidelines in [AGENTS.md](AGENTS.md). It includes critical instructions regarding the definition of done, verification commands, and file modification rules (e.g., you must update `PROGRESS.md` and `feature-list.json` appropriately).
56
+
57
+ ## License
58
+
59
+ MIT
package/bin/ahe ADDED
@@ -0,0 +1,237 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ readonly VERSION="0.1.0"
5
+ SCRIPT_PATH="${BASH_SOURCE[0]}"
6
+
7
+ while [ -L "${SCRIPT_PATH}" ]; do
8
+ SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${SCRIPT_PATH}")" && pwd)"
9
+ SCRIPT_PATH="$(readlink "${SCRIPT_PATH}")"
10
+
11
+ case "${SCRIPT_PATH}" in
12
+ /*) ;;
13
+ *) SCRIPT_PATH="${SCRIPT_DIR}/${SCRIPT_PATH}" ;;
14
+ esac
15
+ done
16
+
17
+ readonly SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${SCRIPT_PATH}")" && pwd)"
18
+ readonly PACKAGE_ROOT="$(CDPATH= cd -- "${SCRIPT_DIR}/.." && pwd)"
19
+ readonly SOURCE_SKILLS_DIR="${PACKAGE_ROOT}/.codex/skills"
20
+ readonly SOURCE_SHARED_DIR="${PACKAGE_ROOT}/.codex/ahe-shared"
21
+ readonly SOURCE_HOOKS_DIR="${PACKAGE_ROOT}/.codex/hooks"
22
+ readonly MANAGED_SKILLS=(
23
+ "ahe-init"
24
+ "ahe-conversation"
25
+ "ahe-thinking"
26
+ "ahe-spec"
27
+ "ahe-update"
28
+ )
29
+
30
+ usage() {
31
+ cat <<'EOF'
32
+ Usage:
33
+ ahe install [--force] [--backup]
34
+ ahe uninstall
35
+ ahe doctor
36
+ ahe version
37
+ EOF
38
+ }
39
+
40
+ backup_existing_installation() {
41
+ local target_dir="$1"
42
+ local backup_root="$2"
43
+ local backup_name="$3"
44
+ local timestamp
45
+
46
+ timestamp="$(date '+%Y%m%d-%H%M%S')"
47
+ mkdir -p "${backup_root}"
48
+ mv "${target_dir}" "${backup_root}/${backup_name}-${timestamp}"
49
+ }
50
+
51
+ install_skill() {
52
+ local force="false"
53
+ local backup="false"
54
+
55
+ while [ "$#" -gt 0 ]; do
56
+ case "$1" in
57
+ --force)
58
+ force="true"
59
+ ;;
60
+ --backup)
61
+ backup="true"
62
+ ;;
63
+ *)
64
+ printf 'Unknown install option: %s\n' "$1" >&2
65
+ usage >&2
66
+ exit 1
67
+ ;;
68
+ esac
69
+ shift
70
+ done
71
+
72
+ if [ ! -d "${SOURCE_SKILLS_DIR}" ]; then
73
+ printf 'Packaged skill files are missing: %s\n' "${SOURCE_SKILLS_DIR}" >&2
74
+ exit 1
75
+ fi
76
+
77
+ if [ ! -d "${SOURCE_SHARED_DIR}" ]; then
78
+ printf 'Packaged shared files are missing: %s\n' "${SOURCE_SHARED_DIR}" >&2
79
+ exit 1
80
+ fi
81
+
82
+ local target_skills_dir="${PWD}/.codex/skills"
83
+ local target_shared_dir="${PWD}/.codex/ahe-shared"
84
+ local target_hooks_dir="${PWD}/.codex/hooks"
85
+ local backup_dir="${PWD}/.codex/_backups"
86
+ local skill_name=""
87
+ local skill_target=""
88
+
89
+ for skill_name in "${MANAGED_SKILLS[@]}"; do
90
+ skill_target="${target_skills_dir}/${skill_name}"
91
+
92
+ if [ -e "${skill_target}" ]; then
93
+ if [ "${backup}" = "true" ]; then
94
+ backup_existing_installation "${skill_target}" "${backup_dir}" "${skill_name}"
95
+ elif [ "${force}" != "true" ]; then
96
+ cat <<EOF >&2
97
+ AHE skill is already installed at:
98
+ ${skill_target}
99
+
100
+ Re-run with --force to overwrite or --backup to move the existing install aside first.
101
+ EOF
102
+ exit 1
103
+ else
104
+ rm -rf "${skill_target}"
105
+ fi
106
+ fi
107
+ done
108
+
109
+ if [ -e "${target_shared_dir}" ]; then
110
+ if [ "${backup}" = "true" ]; then
111
+ backup_existing_installation "${target_shared_dir}" "${backup_dir}" "ahe-shared"
112
+ elif [ "${force}" = "true" ]; then
113
+ rm -rf "${target_shared_dir}"
114
+ else
115
+ cat <<EOF >&2
116
+ AHE shared assets are already installed at:
117
+ ${target_shared_dir}
118
+
119
+ Re-run with --force to overwrite or --backup to move the existing install aside first.
120
+ EOF
121
+ exit 1
122
+ fi
123
+ fi
124
+
125
+ if [ -e "${target_hooks_dir}" ]; then
126
+ if [ "${backup}" = "true" ]; then
127
+ backup_existing_installation "${target_hooks_dir}" "${backup_dir}" "hooks"
128
+ elif [ "${force}" = "true" ]; then
129
+ rm -rf "${target_hooks_dir}"
130
+ else
131
+ cat <<EOF >&2
132
+ AHE hooks are already installed at:
133
+ ${target_hooks_dir}
134
+
135
+ Re-run with --force to overwrite or --backup to move the existing install aside first.
136
+ EOF
137
+ exit 1
138
+ fi
139
+ fi
140
+
141
+ mkdir -p "${target_skills_dir}"
142
+ for skill_name in "${MANAGED_SKILLS[@]}"; do
143
+ cp -R "${SOURCE_SKILLS_DIR}/${skill_name}" "${target_skills_dir}/${skill_name}"
144
+ done
145
+ cp -R "${SOURCE_SHARED_DIR}" "${target_shared_dir}"
146
+ cp -R "${SOURCE_HOOKS_DIR}" "${target_hooks_dir}"
147
+
148
+ cat <<EOF
149
+ AHE Codex skill installed.
150
+
151
+ Next:
152
+ 1. Open Codex chat in this workspace.
153
+ 2. Use \`ahe init\` for a new start.
154
+ 3. Use exact \`ahe\` to continue existing harness work.
155
+ EOF
156
+ }
157
+
158
+ doctor() {
159
+ local target_skills_dir="${PWD}/.codex/skills"
160
+ local target_shared_dir="${PWD}/.codex/ahe-shared"
161
+ local target_hooks_dir="${PWD}/.codex/hooks"
162
+ local skill_name=""
163
+
164
+ for skill_name in "${MANAGED_SKILLS[@]}"; do
165
+ if [ ! -f "${target_skills_dir}/${skill_name}/SKILL.md" ]; then
166
+ printf 'Missing: %s/%s/SKILL.md\n' "${target_skills_dir}" "${skill_name}" >&2
167
+ exit 1
168
+ fi
169
+ done
170
+
171
+ if [ ! -d "${target_shared_dir}/templates" ]; then
172
+ printf 'Missing: %s/templates\n' "${target_shared_dir}" >&2
173
+ exit 1
174
+ fi
175
+
176
+ if [ ! -d "${target_shared_dir}/schemas" ]; then
177
+ printf 'Missing: %s/schemas\n' "${target_shared_dir}" >&2
178
+ exit 1
179
+ fi
180
+
181
+ if [ ! -f "${target_hooks_dir}/hooks.json" ]; then
182
+ printf 'Missing: %s/hooks.json\n' "${target_hooks_dir}" >&2
183
+ exit 1
184
+ fi
185
+
186
+ printf 'AHE skill installation looks healthy.\n'
187
+ }
188
+
189
+ uninstall_skill() {
190
+ local target_skills_dir="${PWD}/.codex/skills"
191
+ local target_shared_dir="${PWD}/.codex/ahe-shared"
192
+ local target_hooks_dir="${PWD}/.codex/hooks"
193
+ local skill_name=""
194
+
195
+ echo "Uninstalling AHE skills from ${PWD}/.codex..."
196
+
197
+ for skill_name in "${MANAGED_SKILLS[@]}"; do
198
+ rm -rf "${target_skills_dir}/${skill_name}"
199
+ done
200
+
201
+ rm -rf "${target_shared_dir}"
202
+ rm -rf "${target_hooks_dir}"
203
+
204
+ echo "AHE skills uninstalled successfully."
205
+ }
206
+
207
+ main() {
208
+ if [ "$#" -eq 0 ]; then
209
+ usage
210
+ exit 1
211
+ fi
212
+
213
+ local command="$1"
214
+ shift
215
+
216
+ case "${command}" in
217
+ install)
218
+ install_skill "$@"
219
+ ;;
220
+ uninstall)
221
+ uninstall_skill
222
+ ;;
223
+ doctor)
224
+ doctor
225
+ ;;
226
+ version)
227
+ printf '%s\n' "${VERSION}"
228
+ ;;
229
+ *)
230
+ printf 'Unknown command: %s\n' "${command}" >&2
231
+ usage >&2
232
+ exit 1
233
+ ;;
234
+ esac
235
+ }
236
+
237
+ main "$@"
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@ksuchoi216/ahe",
3
+ "version": "0.1.0",
4
+ "description": "Codex chat workflow skill installer for Awesome Harness Engineering",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "bin": {
9
+ "ahe": "./bin/ahe"
10
+ },
11
+ "scripts": {
12
+ "test": "pytest tests/ -x",
13
+ "prepublishOnly": "npm run test"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/ksuchoi216/awesome_harness_engineering.git"
18
+ },
19
+ "keywords": [
20
+ "codex",
21
+ "agent",
22
+ "workflow",
23
+ "harness",
24
+ "ahe",
25
+ "ahe-codex"
26
+ ],
27
+ "author": "ksuchoi216",
28
+ "files": [
29
+ "bin/",
30
+ ".codex/"
31
+ ],
32
+ "license": "MIT"
33
+ }