@ksuchoi216/ahe 0.1.1 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ agent_md: 80
2
+ product_md: 180
3
+ instructions_md: 180
4
+ feature_list_json: 180
5
+ progress_md: 180
6
+ session_handoff_md: 180
7
+ todo_md: 180
8
+ total: 750
@@ -18,6 +18,7 @@ const AHE_PROGRESS_DIRECTIVE = [
18
18
  " - Check `feature-list.json` as a derived tracker.",
19
19
  " - Check `PROGRESS.md`.",
20
20
  " - Use `ahe-thinking` as the internal decision layer before choosing the next action.",
21
+ " - Before reading large harness files wholesale, let `ahe-thinking` run the `ahe-compression` size detector and call `ahe-compression` if compression is required.",
21
22
  "",
22
23
  "3. Review code through CodeGraph when available:",
23
24
  " - Prefer CodeGraph MCP or CodeGraph exploration for code review and impact context after the preflight command succeeds.",
@@ -89,6 +90,96 @@ function isExactAheInitCommand(prompt) {
89
90
  );
90
91
  }
91
92
 
93
+ function isBroadAheIntent(prompt) {
94
+ if (isExactAheCommand(prompt) || isExactAheInitCommand(prompt)) {
95
+ return false;
96
+ }
97
+
98
+ const p = normalizePrompt(prompt);
99
+
100
+ const hasAction = /(add|new|update|change|track|manage)/.test(p);
101
+ const hasTarget = /(product|feature|instruction|requirement|spec|work|todo)/.test(p);
102
+
103
+ if (!(hasAction && hasTarget)) {
104
+ return false;
105
+ }
106
+
107
+ const falsePositives = [
108
+ /what is/,
109
+ /explain/,
110
+ /how to/,
111
+ /how do/,
112
+ /file/,
113
+ /error/,
114
+ /issue/
115
+ ];
116
+
117
+ for (const fp of falsePositives) {
118
+ if (fp.test(p)) return false;
119
+ }
120
+
121
+ return true;
122
+ }
123
+
124
+ function getAdaptiveDirective(prompt) {
125
+ return [
126
+ AHE_DIRECTIVE_MARKER,
127
+ "AHE automatic operation activated.",
128
+ "",
129
+ `Original prompt: "${prompt}"`,
130
+ "",
131
+ "The user provided a broad natural-language AHE work intent.",
132
+ "Operate as the Awesome Harness Engineering router with an adaptive workflow:",
133
+ "",
134
+ "1. Run CodeGraph preflight before inspecting harness status:",
135
+ " - Check whether the CodeGraph CLI is installed with `command -v codegraph`.",
136
+ " - If the `codegraph` command is not installed, report `NOT INSTALLATION of codegraph`, skip `codegraph init` and `codegraph sync`, and continue with normal repo inspection.",
137
+ " - If `.codegraph/` does not exist, run `codegraph init` before reviewing code.",
138
+ " - If `.codegraph/` exists, run `codegraph sync` before reviewing code.",
139
+ "",
140
+ "2. Inspect current harness state before choosing a workflow:",
141
+ " - Check `AGENTS.md`.",
142
+ " - Check `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` as the product/specification source of truth.",
143
+ " - Check `feature-list.json` as a derived tracker.",
144
+ " - Check `PROGRESS.md`.",
145
+ " - Use `ahe-thinking` as the internal decision layer before choosing the next action.",
146
+ " - Before reading large harness files wholesale, let `ahe-thinking` run the `ahe-compression` size detector and call `ahe-compression` if compression is required.",
147
+ "",
148
+ "3. Review code through CodeGraph when available.",
149
+ "",
150
+ "4. Make the first response a simple harness engineering status report table before proceeding:",
151
+ " - Start the response with a concise status report table.",
152
+ " - Use this consistent Markdown table format:",
153
+ " | Item | Content |",
154
+ " |---|---|",
155
+ " | AGENTS.md | Exists/missing, purpose status, and any obvious issue. |",
156
+ " | PRODUCT.md | Exists/missing, completion state, and whether product scope needs work. |",
157
+ " | INSTRUCTIONS.md | Exists/missing, and whether instruction boundaries need work. |",
158
+ " | feature-list.json | Valid/missing/invalid, unfinished feature summary, and all-done status. |",
159
+ " | PROGRESS.md | Exists/missing and current session state. |",
160
+ " - Keep the table short and readable.",
161
+ " - Do not include the next step inside the table.",
162
+ "",
163
+ "5. Decide the next AHE workflow with `ahe-thinking` based on the original prompt:",
164
+ " - Classify the user intent from the original prompt as: `product/spec changes`, `instruction changes`, `feature/todo tracking`, or `unclear AHE work`.",
165
+ " - Route product/spec changes to `ahe-spec`.",
166
+ " - Route instruction changes to `ahe-spec`, and create `docs/INSTRUCTIONS.md` from the template when needed.",
167
+ " - Route feature/todo tracking to `ahe-update`.",
168
+ " - Route unclear AHE work to `ahe-conversation`.",
169
+ "",
170
+ "6. Ask for clarification instead of guessing:",
171
+ " - If the request is vague, ask exactly one detail question before editing.",
172
+ " - Call `ahe-conversation` for missing `Why`, `What`, or `How`.",
173
+ " - Continue only after one safe next step is clear.",
174
+ "",
175
+ "7. After the table, classify the harness into exactly one state.",
176
+ " - Use exactly one state: `harness engineering not enough`, `in the middle of building features`, or `completed all`.",
177
+ " - Do not include the next step inside the table.",
178
+ " - Continue automatically after classification.",
179
+ " - Follow this loop: `thinking -> conversation if needed -> execution -> thinking`.",
180
+ ].join("\\n");
181
+ }
182
+
92
183
  function normalizePrompt(prompt) {
93
184
  return prompt.trim().toLowerCase();
94
185
  }
@@ -130,6 +221,14 @@ async function main() {
130
221
  }
131
222
  };
132
223
  process.stdout.write(JSON.stringify(output) + "\n");
224
+ } else if (isBroadAheIntent(parsed.prompt)) {
225
+ const output = {
226
+ hookSpecificOutput: {
227
+ hookEventName: "UserPromptSubmit",
228
+ additionalContext: getAdaptiveDirective(parsed.prompt)
229
+ }
230
+ };
231
+ process.stdout.write(JSON.stringify(output) + "\n");
133
232
  }
134
233
  }
135
234
  }
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: ahe-compression
3
+ description: Internal AHE compression workflow for detecting oversized harness-engineering files and compacting them before AHE thinking reads or routes large context. Use when AGENTS.md, docs/PRODUCT.md, docs/INSTRUCTIONS.md, feature-list.json, PROGRESS.md, SESSION-HANDOFF.md, docs/todo.md, or other AHE harness artifacts have too many lines or waste context.
4
+ ---
5
+
6
+ # AHE Compression
7
+
8
+ This is an internal AHE workflow skill, not a user-facing command.
9
+
10
+ Do not treat `$ahe-compression` as a user command.
11
+ Use it after `ahe-thinking` decides that harness context is too large to read
12
+ efficiently.
13
+
14
+ ## Size Detection
15
+
16
+ Run the deterministic line-count preflight before reading full harness files:
17
+
18
+ ```bash
19
+ sh .codex/skills/ahe-compression/scripts/check-harness-size.sh
20
+ ```
21
+
22
+ The script checks these AHE-managed files when they exist:
23
+
24
+ - `AGENTS.md`
25
+ - `docs/PRODUCT.md`
26
+ - `docs/INSTRUCTIONS.md`
27
+ - `feature-list.json`
28
+ - `PROGRESS.md`
29
+ - `SESSION-HANDOFF.md`
30
+ - `docs/todo.md`
31
+
32
+ Default thresholds are configured in `.codex/ahe-shared/config.yaml`:
33
+
34
+ - `agent_md`: 80
35
+ - `product_md`: 180
36
+ - `instructions_md`: 180
37
+ - `feature_list_json`: 180
38
+ - `progress_md`: 180
39
+ - `session_handoff_md`: 180
40
+ - `todo_md`: 180
41
+ - `total`: 750 (combined harness context limit)
42
+
43
+ Override thresholds only when the workspace has an explicit local rule using environment variables (e.g., `AHE_AGENT_MD_LIMIT`, `AHE_FILE_LINE_LIMIT`, `AHE_TOTAL_LINE_LIMIT`):
44
+
45
+ ```bash
46
+ AHE_AGENT_MD_LIMIT=100 AHE_TOTAL_LINE_LIMIT=900 sh .codex/skills/ahe-compression/scripts/check-harness-size.sh
47
+ ```
48
+
49
+ Exit code meanings:
50
+
51
+ - `0`: no compression needed.
52
+ - `2`: compression needed.
53
+ - Output ending in `COMPRESSION_REQUIRED`: compression needed.
54
+ - Any other nonzero code: detector failed; fall back to `wc -l` on the same
55
+ file set and continue the decision manually.
56
+
57
+ ## Compression Decision
58
+
59
+ - If the detector exits `2`, compress before normal AHE routing continues.
60
+ - If only one file exceeds the per-file threshold, compress that file first.
61
+ - If total harness context exceeds the total threshold, compress the largest
62
+ AHE-managed files until the total is under the threshold.
63
+ - If `AGENTS.md` is oversized, obey the local `AGENTS.md` instructions before
64
+ editing it. Compress only sections that local rules allow. If no section is
65
+ safely editable, report the blocker and compress other harness files instead.
66
+ - Do not read an oversized file wholesale after detection. Read headings,
67
+ current-status sections, JSON keys, or bounded line ranges needed to preserve
68
+ behavior.
69
+
70
+ ## Compression Rules
71
+
72
+ - Preserve active requirements, current decisions, incomplete work, blockers,
73
+ dependencies, and verification evidence.
74
+ - Preserve required headers and file formats for `PROGRESS.md`,
75
+ `SESSION-HANDOFF.md`, `feature-list.json`, and `AGENTS.md`.
76
+ - Keep `feature-list.json` valid JSON. Shorten old completed-feature evidence,
77
+ but preserve each feature `id`, `name`, `description`, `dependencies`,
78
+ `status`, and current unfinished details.
79
+ - Keep `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` as the current harness
80
+ contract. Remove duplicate historical wording only when the active contract
81
+ remains clear.
82
+ - Keep `PROGRESS.md` focused on current status, recent completed work,
83
+ decisions that still matter, blockers, and latest verification.
84
+ - Keep `SESSION-HANDOFF.md` focused on the startup path for the next session,
85
+ important files, open questions, and current verification status.
86
+ - Back up material before deleting substantial historical context by moving it
87
+ under `.ahe/backups/compression-YYYYMMDD-HHMMSS/` when that context may still
88
+ be useful.
89
+
90
+ ## Completion
91
+
92
+ - Re-run the size detector after compression.
93
+ - Run JSON validation when `feature-list.json` changed.
94
+ - Run the repository's normal harness verification command when compression
95
+ changed tracked harness files.
96
+ - Update `PROGRESS.md` and `SESSION-HANDOFF.md` with the compression evidence
97
+ when they changed or when compression affects the active workflow.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "AHE Compression"
3
+ short_description: "Compress oversized harness context"
4
+ default_prompt: "Use $ahe-compression to compact oversized AHE harness files before continuing."
5
+ policy:
6
+ allow_implicit_invocation: false
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env sh
2
+ set -eu
3
+
4
+ limit_agent_md=180
5
+ limit_product_md=180
6
+ limit_instructions_md=180
7
+ limit_feature_list_json=180
8
+ limit_progress_md=180
9
+ limit_session_handoff_md=180
10
+ limit_todo_md=180
11
+ limit_total=750
12
+
13
+ config_file=".codex/ahe-shared/config.yaml"
14
+ if [ -f "${config_file}" ]; then
15
+ while IFS= read -r line || [ -n "$line" ]; do
16
+ line="${line#"${line%%[![:space:]]*}"}"
17
+ line="${line%"${line##*[![:space:]]}"}"
18
+ case "$line" in
19
+ "" | \#*) continue ;;
20
+ esac
21
+
22
+ key="${line%%:*}"
23
+ val="${line#*:}"
24
+ key="${key%"${key##*[![:space:]]}"}"
25
+ val="${val#"${val%%[![:space:]]*}"}"
26
+
27
+ case "$val" in
28
+ ''|*[!0-9]*) continue ;;
29
+ esac
30
+
31
+ case "$key" in
32
+ agent_md) limit_agent_md="$val" ;;
33
+ product_md) limit_product_md="$val" ;;
34
+ instructions_md) limit_instructions_md="$val" ;;
35
+ feature_list_json) limit_feature_list_json="$val" ;;
36
+ progress_md) limit_progress_md="$val" ;;
37
+ session_handoff_md) limit_session_handoff_md="$val" ;;
38
+ todo_md) limit_todo_md="$val" ;;
39
+ total) limit_total="$val" ;;
40
+ esac
41
+ done < "${config_file}"
42
+ fi
43
+
44
+ limit_agent_md="${AHE_AGENT_MD_LIMIT:-${AHE_FILE_LINE_LIMIT:-$limit_agent_md}}"
45
+ limit_product_md="${AHE_PRODUCT_MD_LIMIT:-${AHE_FILE_LINE_LIMIT:-$limit_product_md}}"
46
+ limit_instructions_md="${AHE_INSTRUCTIONS_MD_LIMIT:-${AHE_FILE_LINE_LIMIT:-$limit_instructions_md}}"
47
+ limit_feature_list_json="${AHE_FEATURE_LIST_JSON_LIMIT:-${AHE_FILE_LINE_LIMIT:-$limit_feature_list_json}}"
48
+ limit_progress_md="${AHE_PROGRESS_MD_LIMIT:-${AHE_FILE_LINE_LIMIT:-$limit_progress_md}}"
49
+ limit_session_handoff_md="${AHE_SESSION_HANDOFF_MD_LIMIT:-${AHE_FILE_LINE_LIMIT:-$limit_session_handoff_md}}"
50
+ limit_todo_md="${AHE_TODO_MD_LIMIT:-${AHE_FILE_LINE_LIMIT:-$limit_todo_md}}"
51
+ total_limit="${AHE_TOTAL_LINE_LIMIT:-$limit_total}"
52
+
53
+ total_lines=0
54
+ compression_required=0
55
+
56
+ if [ "$#" -eq 0 ]; then
57
+ set -- \
58
+ "AGENTS.md" \
59
+ "docs/PRODUCT.md" \
60
+ "docs/INSTRUCTIONS.md" \
61
+ "feature-list.json" \
62
+ "PROGRESS.md" \
63
+ "SESSION-HANDOFF.md" \
64
+ "docs/todo.md"
65
+ fi
66
+
67
+ for file_path in "$@"; do
68
+ if [ ! -f "${file_path}" ]; then
69
+ continue
70
+ fi
71
+
72
+ line_count="$(wc -l < "${file_path}")"
73
+ line_count="${line_count#"${line_count%%[![:space:]]*}"}"
74
+ line_count="${line_count%"${line_count##*[![:space:]]}"}"
75
+ total_lines=$((total_lines + line_count))
76
+
77
+ current_limit=180
78
+ case "${file_path}" in
79
+ "AGENTS.md") current_limit="${limit_agent_md}" ;;
80
+ "docs/PRODUCT.md") current_limit="${limit_product_md}" ;;
81
+ "docs/INSTRUCTIONS.md") current_limit="${limit_instructions_md}" ;;
82
+ "feature-list.json") current_limit="${limit_feature_list_json}" ;;
83
+ "PROGRESS.md") current_limit="${limit_progress_md}" ;;
84
+ "SESSION-HANDOFF.md") current_limit="${limit_session_handoff_md}" ;;
85
+ "docs/todo.md") current_limit="${limit_todo_md}" ;;
86
+ *) current_limit="${AHE_FILE_LINE_LIMIT:-180}" ;;
87
+ esac
88
+
89
+ if [ "${line_count}" -ge "${current_limit}" ]; then
90
+ compression_required=1
91
+ printf 'COMPRESS\t%s\t%s\tlimit=%s\n' "${file_path}" "${line_count}" "${current_limit}"
92
+ else
93
+ printf 'OK\t%s\t%s\tlimit=%s\n' "${file_path}" "${line_count}" "${current_limit}"
94
+ fi
95
+ done
96
+
97
+ if [ "${total_lines}" -ge "${total_limit}" ]; then
98
+ compression_required=1
99
+ printf 'COMPRESS_TOTAL\t%s\tlimit=%s\n' "${total_lines}" "${total_limit}"
100
+ else
101
+ printf 'OK_TOTAL\t%s\tlimit=%s\n' "${total_lines}" "${total_limit}"
102
+ fi
103
+
104
+ if [ "${compression_required}" -eq 1 ]; then
105
+ printf 'COMPRESSION_REQUIRED\n'
106
+ exit 2
107
+ fi
108
+
109
+ printf 'COMPRESSION_NOT_REQUIRED\n'
@@ -22,7 +22,7 @@ Use it after `ahe-thinking` decides that specification work must continue.
22
22
 
23
23
  - `docs/PRODUCT.md` is the canonical home for product specification details collected during `ahe init`.
24
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.
25
+ - Clarify project instructions when `docs/INSTRUCTIONS.md` needs to change. If `docs/INSTRUCTIONS.md` is missing, create it from `.codex/ahe-shared/templates/INSTRUCTIONS.md` first, then ask what additional instructions belong under `## CAN CHANGE INSTRUCTIONS`.
26
26
  - Draft the relevant specification updates in chat and ask for user approval.
27
27
  - Ask recursively for more detail until the affected specification areas are clear and approved.
28
28
 
@@ -56,6 +56,14 @@ safely.
56
56
 
57
57
  ## Next-Step Decision
58
58
 
59
+ - Before reading full harness files, decide whether compression is needed.
60
+ Run `sh .codex/skills/ahe-compression/scripts/check-harness-size.sh` when the
61
+ script exists (which checks against configurable thresholds in `.codex/ahe-shared/config.yaml`),
62
+ or fall back to `wc -l` over `AGENTS.md`, `docs/PRODUCT.md`, `docs/INSTRUCTIONS.md`,
63
+ `feature-list.json`, `PROGRESS.md`, `SESSION-HANDOFF.md`, and `docs/todo.md`.
64
+ - If the detector reports `COMPRESSION_REQUIRED` or exits with code `2`, call
65
+ `ahe-compression` before normal routing. Do not spend context reading the
66
+ oversized files wholesale first.
59
67
  - If `docs/PRODUCT.md` or `docs/INSTRUCTIONS.md` is missing or empty, classify the state as
60
68
  `harness engineering not enough` and prioritize product/instructions specification work.
61
69
  - `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` form the required harness contract. `docs/PRODUCT.md` is the product/specification source of truth, and
@@ -69,6 +77,14 @@ safely.
69
77
  - If tracked work is complete and no obvious essential harness gap remains,
70
78
  classify the state as `completed all` and ask for the next task.
71
79
 
80
+ ## Broad User Intent Routing
81
+
82
+ When the user provides a broad natural-language work intent (e.g., "add features", "update spec"), use their original prompt to determine the exact path:
83
+ - Route **product/spec changes** to `ahe-spec`.
84
+ - Route **instruction changes** to `ahe-spec`.
85
+ - Route **feature/todo tracking** to `ahe-update`.
86
+ - Route **unclear AHE work** to `ahe-conversation` and ask exactly one detail question before editing if the request is vague.
87
+
72
88
  ## Conversation Handoff
73
89
 
74
90
  If clarity is missing, call `ahe-conversation` with the exact missing `Why`,
package/README.md CHANGED
@@ -29,14 +29,14 @@ npx --yes --package=file:. ahe install
29
29
 
30
30
  ### CLI Commands
31
31
 
32
- | Command | Description |
33
- |---|---|
34
- | `ahe install` | Install AHE skills into `.codex/` |
35
- | `ahe install --force` | Overwrite existing installation |
32
+ | Command | Description |
33
+ | ---------------------- | ----------------------------------------------- |
34
+ | `ahe install` | Install AHE skills into `.codex/` |
35
+ | `ahe install --force` | Overwrite existing installation |
36
36
  | `ahe install --backup` | Backup existing installation before overwriting |
37
- | `ahe uninstall` | Remove all AHE skills, shared assets, and hooks |
38
- | `ahe doctor` | Check installation health and integrity |
39
- | `ahe version` | Print the current version |
37
+ | `ahe uninstall` | Remove all AHE skills, shared assets, and hooks |
38
+ | `ahe doctor` | Check installation health and integrity |
39
+ | `ahe version` | Print the current version |
40
40
 
41
41
  ---
42
42
 
@@ -46,10 +46,10 @@ AHE works inside **Codex chat**. After installing via the terminal, open Codex c
46
46
 
47
47
  ### Chat Commands
48
48
 
49
- | Command | What it does |
50
- |---|---|
49
+ | Command | What it does |
50
+ | ---------- | ----------------------------------------------------------------------------------------------------------------------- |
51
51
  | `ahe init` | **Start a new harness.** Creates harness skeleton files, asks about your project, and writes the product specification. |
52
- | `ahe` | **Continue existing work.** Inspects the current state, reports status, decides the next step, and keeps working. |
52
+ | `ahe` | **Continue existing work.** Inspects the current state, reports status, decides the next step, and keeps working. |
53
53
 
54
54
  > **Note:** Only exact commands trigger AHE. Normal messages like "explain ahe" or "what does ahe do" will not start any workflow.
55
55
 
@@ -82,15 +82,16 @@ $ ahe install
82
82
 
83
83
  ### Skills Overview
84
84
 
85
- AHE is composed of five internal skills that coordinate automatically:
85
+ AHE is composed of six core skills that coordinate automatically:
86
86
 
87
- | Skill | Role |
88
- |---|---|
89
- | **ahe-init** | Entry point for new projects. Creates harness files, asks for project info, then calls ahe-spec and ahe-update. |
90
- | **ahe-thinking** | Internal decision engine. Evaluates clarity on **Why** / **What** / **How** for each work unit and routes to the right action. |
91
- | **ahe-conversation** | Internal question protocol. Asks exactly one focused question at a time when information is missing. |
92
- | **ahe-spec** | Writes and updates `docs/PRODUCT.md` (canonical source of truth) and `docs/INSTRUCTIONS.md`. |
93
- | **ahe-update** | Syncs tracking artifacts: `feature-list.json`, `PROGRESS.md`, `SESSION-HANDOFF.md`. |
87
+ | Skill | Role |
88
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
89
+ | **ahe-init** | Entry point for new projects. Creates harness files, asks for project info, then calls ahe-spec and ahe-update. |
90
+ | **ahe-thinking** | Internal decision engine. Evaluates clarity on **Why** / **What** / **How** for each work unit and routes to the right action. |
91
+ | **ahe-compression** | Internal size detector & compressor. Monitors file sizes via configurable thresholds (`config.yaml`) and compresses bloated files before reading. |
92
+ | **ahe-conversation** | Internal question protocol. Asks exactly one focused question at a time when information is missing. |
93
+ | **ahe-spec** | Writes and updates `docs/PRODUCT.md` (canonical source of truth) and `docs/INSTRUCTIONS.md`. |
94
+ | **ahe-update** | Syncs tracking artifacts: `feature-list.json`, `PROGRESS.md`, `SESSION-HANDOFF.md`. |
94
95
 
95
96
  ### Process Flow
96
97
 
@@ -113,7 +114,8 @@ flowchart TD
113
114
  Step2 --> Step3["<b>Step 3: ahe-update</b><br/>Sync feature-list.json<br/>and PROGRESS.md"]
114
115
  Step3 --> Done["Harness ready ✓"]
115
116
 
116
- Feature --> Thinking["<b>ahe-thinking</b><br/>Check Why / What / How"]
117
+ Feature --> Compression["<b>ahe-compression</b><br/>Check & compress oversized files"]
118
+ Compression --> Thinking["<b>ahe-thinking</b><br/>Check Why / What / How"]
117
119
  Thinking --> Clear{"Clear enough<br/>to proceed?"}
118
120
  Clear -->|"No"| Convo["<b>ahe-conversation</b><br/>Ask one focused question"]
119
121
  Convo --> UserAnswer["User answers"]
@@ -143,10 +145,11 @@ flowchart TD
143
145
  - **"Not enough spec"** → routes to `ahe-init` to fill gaps.
144
146
  - **"Building features"** → picks the next unfinished feature from `feature-list.json`.
145
147
  - **"All completed"** → asks the user for the next task.
146
- 4. **ahe-thinking** checks clarity (Why / What / How) for the current work unit.
147
- 5. If unclear → **ahe-conversation** asks exactly one question, then re-evaluates.
148
- 6. If clearexecutes the next safe step.
149
- 7. **ahe-update** syncs all tracking artifacts at the end.
148
+ 4. **ahe-thinking** checks file sizes using **ahe-compression** and compresses oversized files based on `config.yaml` thresholds.
149
+ 5. **ahe-thinking** checks clarity (Why / What / How) for the current work unit.
150
+ 6. If unclear**ahe-conversation** asks exactly one question, then re-evaluates.
151
+ 7. If clear executes the next safe step.
152
+ 8. **ahe-update** syncs all tracking artifacts at the end.
150
153
 
151
154
  #### Execution Loop
152
155
 
@@ -169,9 +172,11 @@ your-project/
169
172
  │ │ ├── ahe-init/ # New-start workflow skill
170
173
  │ │ ├── ahe-conversation/ # Internal question protocol
171
174
  │ │ ├── ahe-thinking/ # Internal decision engine
175
+ │ │ ├── ahe-compression/ # Internal size detector & compressor
172
176
  │ │ ├── ahe-spec/ # Specification writer
173
177
  │ │ └── ahe-update/ # Tracking artifact syncer
174
178
  │ ├── ahe-shared/
179
+ │ │ ├── config.yaml # Compression thresholds & configuration
175
180
  │ │ ├── templates/ # Harness file templates
176
181
  │ │ └── schemas/ # Validation schemas
177
182
  │ └── hooks/
@@ -199,6 +204,13 @@ your-project/
199
204
 
200
205
  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).
201
206
 
207
+ ## References
208
+
209
+ This repository was greatly influenced by the following projects:
210
+
211
+ - [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent): Greatly influenced the code structure of this project.
212
+ - [learn-harness-engineering](https://github.com/walkinglabs/learn-harness-engineering): Provided the harness engineering templates used in this project.
213
+
202
214
  ## License
203
215
 
204
216
  MIT
package/bin/ahe CHANGED
@@ -19,9 +19,12 @@ readonly PACKAGE_ROOT="$(CDPATH= cd -- "${SCRIPT_DIR}/.." && pwd)"
19
19
  readonly SOURCE_SKILLS_DIR="${PACKAGE_ROOT}/.codex/skills"
20
20
  readonly SOURCE_SHARED_DIR="${PACKAGE_ROOT}/.codex/ahe-shared"
21
21
  readonly SOURCE_HOOKS_DIR="${PACKAGE_ROOT}/.codex/hooks"
22
+ readonly AHE_CONFIG_BLOCK_START="# BEGIN AHE MANAGED CONFIG"
23
+ readonly AHE_CONFIG_BLOCK_END="# END AHE MANAGED CONFIG"
22
24
  readonly MANAGED_SKILLS=(
23
25
  "ahe-init"
24
26
  "ahe-conversation"
27
+ "ahe-compression"
25
28
  "ahe-thinking"
26
29
  "ahe-spec"
27
30
  "ahe-update"
@@ -48,6 +51,48 @@ backup_existing_installation() {
48
51
  mv "${target_dir}" "${backup_root}/${backup_name}-${timestamp}"
49
52
  }
50
53
 
54
+ cleanup_ahe_config_entries() {
55
+ local config_path="$1"
56
+ local temp_path=""
57
+
58
+ if [ ! -f "${config_path}" ]; then
59
+ return 0
60
+ fi
61
+
62
+ temp_path="${config_path}.ahe-cleanup"
63
+ awk -v block_start="${AHE_CONFIG_BLOCK_START}" -v block_end="${AHE_CONFIG_BLOCK_END}" '
64
+ function is_ahe_header(line) {
65
+ return line ~ /^\[agents\."?ahe[-_][^]]*"?\]$/ ||
66
+ line ~ /^\[hooks\.state\."ahe[^"]*"\]$/ ||
67
+ line ~ /^\[plugins\."?ahe[^]]*"?\]$/ ||
68
+ line ~ /^\[plugins\."@ksuchoi216\/ahe[^"]*"\]$/
69
+ }
70
+
71
+ $0 == block_start {
72
+ skip = 1
73
+ next
74
+ }
75
+
76
+ $0 == block_end {
77
+ skip = 0
78
+ next
79
+ }
80
+
81
+ /^\[/ {
82
+ if (is_ahe_header($0)) {
83
+ skip = 1
84
+ next
85
+ }
86
+ skip = 0
87
+ }
88
+
89
+ skip != 1 {
90
+ print
91
+ }
92
+ ' "${config_path}" > "${temp_path}"
93
+ mv "${temp_path}" "${config_path}"
94
+ }
95
+
51
96
  install_skill() {
52
97
  local force="false"
53
98
  local backup="false"
@@ -82,10 +127,13 @@ install_skill() {
82
127
  local target_skills_dir="${PWD}/.codex/skills"
83
128
  local target_shared_dir="${PWD}/.codex/ahe-shared"
84
129
  local target_hooks_dir="${PWD}/.codex/hooks"
130
+ local target_config_path="${PWD}/.codex/config.toml"
85
131
  local backup_dir="${PWD}/.codex/_backups"
86
132
  local skill_name=""
87
133
  local skill_target=""
88
134
 
135
+ cleanup_ahe_config_entries "${target_config_path}"
136
+
89
137
  for skill_name in "${MANAGED_SKILLS[@]}"; do
90
138
  skill_target="${target_skills_dir}/${skill_name}"
91
139
 
@@ -168,6 +216,11 @@ doctor() {
168
216
  fi
169
217
  done
170
218
 
219
+ if [ ! -f "${target_shared_dir}/config.yaml" ]; then
220
+ printf 'Missing: %s/config.yaml\n' "${target_shared_dir}" >&2
221
+ exit 1
222
+ fi
223
+
171
224
  if [ ! -d "${target_shared_dir}/templates" ]; then
172
225
  printf 'Missing: %s/templates\n' "${target_shared_dir}" >&2
173
226
  exit 1
@@ -190,6 +243,7 @@ uninstall_skill() {
190
243
  local target_skills_dir="${PWD}/.codex/skills"
191
244
  local target_shared_dir="${PWD}/.codex/ahe-shared"
192
245
  local target_hooks_dir="${PWD}/.codex/hooks"
246
+ local target_config_path="${PWD}/.codex/config.toml"
193
247
  local skill_name=""
194
248
 
195
249
  echo "Uninstalling AHE skills from ${PWD}/.codex..."
@@ -200,6 +254,7 @@ uninstall_skill() {
200
254
 
201
255
  rm -rf "${target_shared_dir}"
202
256
  rm -rf "${target_hooks_dir}"
257
+ cleanup_ahe_config_entries "${target_config_path}"
203
258
 
204
259
  echo "AHE skills uninstalled successfully."
205
260
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ksuchoi216/ahe",
3
- "version": "0.1.1",
3
+ "version": "0.1.6",
4
4
  "description": "Codex chat workflow skill installer for Awesome Harness Engineering",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,4 +30,4 @@
30
30
  ".codex/"
31
31
  ],
32
32
  "license": "MIT"
33
- }
33
+ }