aiblueprint-cli 1.4.99 → 1.4.100
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/agents-config/skills/agents-manager/SKILL.md +2 -2
- package/agents-config/skills/agents-manager/agents/openai.yaml +7 -0
- package/agents-config/skills/agents-manager/assets/codex-icon.svg +20 -0
- package/agents-config/skills/apex/SKILL.md +120 -118
- package/agents-config/skills/apex/agents/openai.yaml +10 -0
- package/agents-config/skills/apex/assets/codex-icon.svg +15 -0
- package/agents-config/skills/apex/scripts/apex-state.py +740 -0
- package/agents-config/skills/apex/scripts/setup-templates.sh +27 -145
- package/agents-config/skills/apex/scripts/test_apex_state.py +413 -0
- package/agents-config/skills/apex/scripts/update-progress.sh +17 -73
- package/agents-config/skills/apex/steps/step-00-init.md +85 -231
- package/agents-config/skills/apex/steps/step-00b-branch.md +10 -118
- package/agents-config/skills/apex/steps/step-00b-economy.md +12 -239
- package/agents-config/skills/apex/steps/step-00b-interactive.md +13 -162
- package/agents-config/skills/apex/steps/step-00b-save.md +13 -114
- package/agents-config/skills/apex/steps/step-01-analyze.md +40 -361
- package/agents-config/skills/apex/steps/step-02-plan.md +55 -562
- package/agents-config/skills/apex/steps/step-02b-tasks.md +15 -291
- package/agents-config/skills/apex/steps/step-03-execute-teams.md +47 -267
- package/agents-config/skills/apex/steps/step-03-execute.md +32 -212
- package/agents-config/skills/apex/steps/step-04-validate.md +42 -246
- package/agents-config/skills/apex/steps/step-05-examine.md +47 -371
- package/agents-config/skills/apex/steps/step-06-resolve.md +19 -221
- package/agents-config/skills/apex/steps/step-07-tests.md +19 -234
- package/agents-config/skills/apex/steps/step-08-run-tests.md +13 -300
- package/agents-config/skills/apex/steps/step-09-finish.md +36 -200
- package/agents-config/skills/apex/steps/step-10-verify.md +46 -264
- package/agents-config/skills/appstore-connect/agents/openai.yaml +7 -0
- package/agents-config/skills/appstore-connect/assets/codex-icon.svg +17 -0
- package/agents-config/skills/commit/agents/openai.yaml +10 -0
- package/agents-config/skills/commit/assets/codex-icon.svg +17 -0
- package/agents-config/skills/create-pr/agents/openai.yaml +10 -0
- package/agents-config/skills/create-pr/assets/codex-icon.svg +17 -0
- package/agents-config/skills/environments-manager/SKILL.md +1 -1
- package/agents-config/skills/environments-manager/agents/openai.yaml +7 -0
- package/agents-config/skills/environments-manager/assets/codex-icon.svg +16 -0
- package/agents-config/skills/environments-manager/examples/scripts/claude-worktree-remove.sh +19 -3
- package/agents-config/skills/environments-manager/examples/scripts/worktree-up.sh +1 -1
- package/agents-config/skills/environments-manager/references/claude.md +1 -1
- package/agents-config/skills/fix-pr-comments/agents/openai.yaml +10 -0
- package/agents-config/skills/fix-pr-comments/assets/codex-icon.svg +17 -0
- package/agents-config/skills/grill-me/SKILL.md +25 -4
- package/agents-config/skills/grill-me/agents/openai.yaml +8 -0
- package/agents-config/skills/grill-me/assets/codex-icon.svg +16 -0
- package/agents-config/skills/hooks-manager/SKILL.md +19 -9
- package/agents-config/skills/hooks-manager/assets/codex-icon.svg +15 -4
- package/agents-config/skills/hooks-manager/references/claude-code.md +32 -0
- package/agents-config/skills/hooks-manager/references/codex.md +23 -0
- package/agents-config/skills/hooks-manager/references/cursor.md +18 -0
- package/agents-config/skills/hooks-manager/references/hook-types.md +5 -3
- package/agents-config/skills/hooks-manager/references/input-output-schemas.md +2 -2
- package/agents-config/skills/hooks-manager/references/research-sources.md +25 -0
- package/agents-config/skills/hooks-manager/references/router.md +32 -0
- package/agents-config/skills/hooks-manager/references/troubleshooting.md +3 -3
- package/agents-config/skills/merge/agents/openai.yaml +10 -0
- package/agents-config/skills/merge/assets/codex-icon.svg +17 -0
- package/agents-config/skills/oneshot/SKILL.md +4 -0
- package/agents-config/skills/oneshot/agents/openai.yaml +10 -0
- package/agents-config/skills/oneshot/assets/codex-icon.svg +18 -0
- package/agents-config/skills/prompt-creator/agents/openai.yaml +7 -0
- package/agents-config/skills/prompt-creator/assets/codex-icon.svg +16 -0
- package/agents-config/skills/rules-manager/agents/openai.yaml +7 -0
- package/agents-config/skills/rules-manager/assets/codex-icon.svg +23 -0
- package/agents-config/skills/skill-manager/SKILL.md +45 -3
- package/agents-config/skills/skill-manager/agents/openai.yaml +7 -0
- package/agents-config/skills/skill-manager/assets/codex-icon.svg +23 -0
- package/agents-config/skills/skill-manager/references/skill-writing-glossary.md +201 -0
- package/agents-config/skills/skill-manager/scripts/setup-codex-icons.ts +143 -0
- package/agents-config/skills/ultrathink/agents/openai.yaml +10 -0
- package/agents-config/skills/ultrathink/assets/codex-icon.svg +20 -0
- package/agents-config/skills/use-artifacts/SKILL.md +102 -51
- package/agents-config/skills/use-artifacts/assets/local-runtime.js +299 -0
- package/agents-config/skills/use-artifacts/scripts/create_artifact.py +1 -1
- package/agents-config/skills/use-delegate/SKILL.md +4 -0
- package/agents-config/skills/use-delegate/agents/openai.yaml +10 -0
- package/agents-config/skills/use-delegate/assets/codex-icon.svg +20 -0
- package/agents-config/skills/use-goal/SKILL.md +70 -9
- package/agents-config/skills/use-goal/agents/openai.yaml +1 -1
- package/agents-config/skills/use-goal/assets/codex-icon.svg +17 -3
- package/agents-config/skills/use-goal/references/claude-code-goal.md +54 -6
- package/agents-config/skills/use-goal/references/codex-goal.md +59 -4
- package/agents-config/skills/use-goal/references/verification-harnesses.md +104 -3
- package/package.json +1 -1
- package/agents-config/skills/apex/templates/00-context.md +0 -55
- package/agents-config/skills/apex/templates/01-analyze.md +0 -10
- package/agents-config/skills/apex/templates/02-plan.md +0 -10
- package/agents-config/skills/apex/templates/03-execute.md +0 -10
- package/agents-config/skills/apex/templates/04-validate.md +0 -10
- package/agents-config/skills/apex/templates/05-examine.md +0 -10
- package/agents-config/skills/apex/templates/06-resolve.md +0 -10
- package/agents-config/skills/apex/templates/07-tests.md +0 -10
- package/agents-config/skills/apex/templates/08-run-tests.md +0 -10
- package/agents-config/skills/apex/templates/09-finish.md +0 -10
- package/agents-config/skills/apex/templates/10-verify.md +0 -9
- package/agents-config/skills/apex/templates/README.md +0 -195
- package/agents-config/skills/apex/templates/step-complete.md +0 -7
|
@@ -1,7 +1,108 @@
|
|
|
1
1
|
# Verification Harnesses For Refactors
|
|
2
2
|
|
|
3
|
-
Use this reference when a Goal involves refactoring, deletion, migration, moving files, eliminating a pattern, or reducing a code smell.
|
|
3
|
+
Use this reference when a Goal involves refactoring, deletion, migration, moving files, eliminating a pattern, or reducing a code smell. The core tactic is to create a small measurable harness before the main work, then make the Goal continue until the harness reaches the target.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Principle
|
|
6
6
|
|
|
7
|
-
For
|
|
7
|
+
For broad changes, do not rely only on subjective review. Convert the desired end state into a number, list, or deterministic command result.
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
|
|
11
|
+
- Remove all explicit TypeScript `any` -> count explicit `any` occurrences and require `0`.
|
|
12
|
+
- Delete dead files -> scan imports/references and require no references to removed paths.
|
|
13
|
+
- Move a module -> scan imports and require all imports use the new path.
|
|
14
|
+
- Rename an API -> count old symbol references and require `0`, then run tests/typecheck.
|
|
15
|
+
- Remove a dependency -> scan package manifests and lockfiles, then run install/typecheck/test.
|
|
16
|
+
- Split a large file -> check file size or exported symbol boundaries, then run typecheck/test.
|
|
17
|
+
|
|
18
|
+
The harness should make progress visible after every iteration.
|
|
19
|
+
|
|
20
|
+
## Harness Rules
|
|
21
|
+
|
|
22
|
+
1. First establish the baseline count or failure list before editing.
|
|
23
|
+
2. Prefer existing repo tooling: tests, lint rules, typecheck, dependency analyzers, codemods, static analyzers.
|
|
24
|
+
3. If no existing command measures the target, create a narrow validation script.
|
|
25
|
+
4. Make the script deterministic and fast enough to run repeatedly.
|
|
26
|
+
5. Exclude generated, vendored, build output, lockfiles, snapshots, and irrelevant binary assets unless the task explicitly includes them.
|
|
27
|
+
6. Print actionable output: total count, grouped files, and the top remaining offenders.
|
|
28
|
+
7. Exit with code `0` only when the target condition is met. Exit non-zero while work remains.
|
|
29
|
+
8. Keep the harness scoped to the Goal. Remove temporary harnesses before completion unless they are useful project validation and the user or repo conventions support keeping them.
|
|
30
|
+
|
|
31
|
+
## Goal Pattern
|
|
32
|
+
|
|
33
|
+
Use this shape for count-based refactor Goals:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
<desired refactor>, verified by `<validation command>` returning success with <target count/list condition>, while preserving <tests/typecheck/public behavior>. First establish the baseline with `<validation command>` and inspect the highest-signal offenders. Work in checkpoints: after each batch, rerun `<validation command>`, record the count/list delta, run the narrowest relevant tests, and continue until the validation command exits 0. If the target cannot be reached safely, stop with the remaining offenders, attempted paths, failing output, and the decision needed.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
Remove all explicit TypeScript `any` from the codebase, verified by `node scripts/check-explicit-any.mjs` exiting 0 with count 0, while keeping `pnpm typecheck` and relevant tests green. First run the checker to record the baseline and prioritize files with the most occurrences. Work in checkpoints: after each batch, rerun the checker, record the remaining count, and run the narrowest relevant typecheck/tests. Continue until the checker exits 0. If some `any` cannot be removed safely, stop with the remaining locations, attempted replacements, compiler/test output, and the type information needed.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Script Patterns
|
|
46
|
+
|
|
47
|
+
Use structured parsers when reasonable. For TypeScript, prefer the TypeScript compiler API, `ts-morph`, ESLint, or an existing lint rule over raw text search when false positives matter.
|
|
48
|
+
|
|
49
|
+
For a quick bootstrap harness, a text scanner is acceptable if the Goal explicitly treats it as an approximate first pass and follows up with typecheck/lint.
|
|
50
|
+
|
|
51
|
+
Example quick scanner:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
#!/usr/bin/env node
|
|
55
|
+
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
56
|
+
import { join } from "node:path";
|
|
57
|
+
|
|
58
|
+
const root = process.cwd();
|
|
59
|
+
const ignoredDirs = new Set([".git", "node_modules", "dist", "build", ".next", "coverage"]);
|
|
60
|
+
const extensions = new Set([".ts", ".tsx"]);
|
|
61
|
+
const matches = [];
|
|
62
|
+
|
|
63
|
+
function walk(dir) {
|
|
64
|
+
for (const entry of readdirSync(dir)) {
|
|
65
|
+
const path = join(dir, entry);
|
|
66
|
+
const stat = statSync(path);
|
|
67
|
+
if (stat.isDirectory()) {
|
|
68
|
+
if (!ignoredDirs.has(entry)) walk(path);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (![...extensions].some((ext) => path.endsWith(ext))) continue;
|
|
72
|
+
const text = readFileSync(path, "utf8");
|
|
73
|
+
const lines = text.split("\n");
|
|
74
|
+
lines.forEach((line, index) => {
|
|
75
|
+
if (/\bany\b/.test(line)) matches.push(`${path.replace(`${root}/`, "")}:${index + 1}: ${line.trim()}`);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
walk(root);
|
|
81
|
+
|
|
82
|
+
console.log(`explicit_any_count=${matches.length}`);
|
|
83
|
+
for (const match of matches.slice(0, 50)) console.log(match);
|
|
84
|
+
if (matches.length > 50) console.log(`...and ${matches.length - 50} more`);
|
|
85
|
+
process.exit(matches.length === 0 ? 0 : 1);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Refactor Targets
|
|
89
|
+
|
|
90
|
+
For deletion Goals, verify both absence and behavior:
|
|
91
|
+
|
|
92
|
+
- target files or symbols are gone
|
|
93
|
+
- no imports, string references, routes, config entries, docs links, or tests point to them
|
|
94
|
+
- typecheck/build/test still passes
|
|
95
|
+
|
|
96
|
+
For moving Goals, verify all call sites:
|
|
97
|
+
|
|
98
|
+
- old import path count is `0`
|
|
99
|
+
- new import path exists where expected
|
|
100
|
+
- public exports remain compatible unless changing them is part of the Goal
|
|
101
|
+
- typecheck/build/test still passes
|
|
102
|
+
|
|
103
|
+
For migration Goals, verify old surface removal and new surface behavior:
|
|
104
|
+
|
|
105
|
+
- old package/API/pattern count reaches `0` or the explicitly allowed exception list
|
|
106
|
+
- new package/API/pattern is used consistently
|
|
107
|
+
- tests/typecheck/build pass
|
|
108
|
+
- manual or browser verification is included when behavior is visual or interactive
|
package/package.json
CHANGED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# APEX Task: {{task_id}}
|
|
2
|
-
|
|
3
|
-
**Created:** {{timestamp}}
|
|
4
|
-
**Task:** {{task_description}}
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Configuration
|
|
9
|
-
|
|
10
|
-
| Flag | Value |
|
|
11
|
-
|------|-------|
|
|
12
|
-
| Auto mode (`-a`) | {{auto_mode}} |
|
|
13
|
-
| Examine mode (`-x`) | {{examine_mode}} |
|
|
14
|
-
| Save mode (`-s`) | {{save_mode}} |
|
|
15
|
-
| Test mode (`-t`) | {{test_mode}} |
|
|
16
|
-
| Economy mode (`-e`) | {{economy_mode}} |
|
|
17
|
-
| Branch mode (`-b`) | {{branch_mode}} |
|
|
18
|
-
| PR mode (`-pr`) | {{pr_mode}} |
|
|
19
|
-
| Interactive mode (`-i`) | {{interactive_mode}} |
|
|
20
|
-
| Tasks mode (`-k`) | {{tasks_mode}} |
|
|
21
|
-
| Verify mode (`-v`) | {{verify_mode}} |
|
|
22
|
-
| Branch name | {{branch_name}} |
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## User Request
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
{{original_input}}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Acceptance Criteria
|
|
35
|
-
|
|
36
|
-
_To be defined in step-01-analyze.md_
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Progress
|
|
41
|
-
|
|
42
|
-
| Step | Status | Timestamp |
|
|
43
|
-
|------|--------|-----------|
|
|
44
|
-
| 00-init | ⏸ Pending | |
|
|
45
|
-
| 01-analyze | ⏸ Pending | |
|
|
46
|
-
| 02-plan | ⏸ Pending | |
|
|
47
|
-
| 02b-tasks | {{tasks_status}} | |
|
|
48
|
-
| 03-execute | ⏸ Pending | |
|
|
49
|
-
| 04-validate | ⏸ Pending | |
|
|
50
|
-
| 05-examine | {{examine_status}} | |
|
|
51
|
-
| 06-resolve | {{examine_status}} | |
|
|
52
|
-
| 07-tests | {{test_status}} | |
|
|
53
|
-
| 08-run-tests | {{test_status}} | |
|
|
54
|
-
| 10-verify | {{verify_status}} | |
|
|
55
|
-
| 09-finish | {{pr_status}} | |
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
# APEX Template System
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This directory contains template files used to initialize APEX workflow outputs when save mode (`-s`) is enabled. This template system significantly reduces token usage by moving repetitive content out of step files.
|
|
6
|
-
|
|
7
|
-
## Template Files
|
|
8
|
-
|
|
9
|
-
| Template | Purpose | Created When |
|
|
10
|
-
|----------|---------|--------------|
|
|
11
|
-
| `00-context.md` | Workflow configuration and progress tracking | Always (if save_mode) |
|
|
12
|
-
| `01-analyze.md` | Analysis findings | Always (if save_mode) |
|
|
13
|
-
| `02-plan.md` | Implementation plan | Always (if save_mode) |
|
|
14
|
-
| `03-execute.md` | Implementation log | Always (if save_mode) |
|
|
15
|
-
| `04-validate.md` | Validation results | Always (if save_mode) |
|
|
16
|
-
| `05-examine.md` | Adversarial review findings | Only if examine_mode enabled |
|
|
17
|
-
| `06-resolve.md` | Finding resolution log | Only if examine_mode enabled |
|
|
18
|
-
| `07-tests.md` | Test analysis and creation | Only if test_mode enabled |
|
|
19
|
-
| `08-run-tests.md` | Test runner log | Only if test_mode enabled |
|
|
20
|
-
| `09-finish.md` | PR creation log | Only if pr_mode enabled |
|
|
21
|
-
| `step-complete.md` | Completion marker template | Referenced in steps |
|
|
22
|
-
|
|
23
|
-
## Template Variables
|
|
24
|
-
|
|
25
|
-
Templates use `{{variable}}` syntax for placeholders:
|
|
26
|
-
|
|
27
|
-
| Variable | Description | Example |
|
|
28
|
-
|----------|-------------|---------|
|
|
29
|
-
| `{{task_id}}` | Kebab-case task identifier | `01-add-auth-middleware` |
|
|
30
|
-
| `{{task_description}}` | Plain text task description | `add authentication middleware` |
|
|
31
|
-
| `{{timestamp}}` | ISO 8601 timestamp | `2026-01-12T10:30:00Z` |
|
|
32
|
-
| `{{auto_mode}}` | Auto mode flag | `true` or `false` |
|
|
33
|
-
| `{{examine_mode}}` | Examine mode flag | `true` or `false` |
|
|
34
|
-
| `{{save_mode}}` | Save mode flag | `true` or `false` |
|
|
35
|
-
| `{{test_mode}}` | Test mode flag | `true` or `false` |
|
|
36
|
-
| `{{economy_mode}}` | Economy mode flag | `true` or `false` |
|
|
37
|
-
| `{{branch_mode}}` | Branch mode flag | `true` or `false` |
|
|
38
|
-
| `{{pr_mode}}` | PR mode flag | `true` or `false` |
|
|
39
|
-
| `{{interactive_mode}}` | Interactive mode flag | `true` or `false` |
|
|
40
|
-
| `{{branch_name}}` | Git branch name | `feature/add-auth` |
|
|
41
|
-
| `{{original_input}}` | Raw user input | `/apex -a -s add auth` |
|
|
42
|
-
| `{{examine_status}}` | Progress status for examine steps | `⏸ Pending` or `⏭ Skip` |
|
|
43
|
-
| `{{test_status}}` | Progress status for test steps | `⏸ Pending` or `⏭ Skip` |
|
|
44
|
-
| `{{pr_status}}` | Progress status for PR step | `⏸ Pending` or `⏭ Skip` |
|
|
45
|
-
|
|
46
|
-
## Setup Script
|
|
47
|
-
|
|
48
|
-
### `setup-templates.sh`
|
|
49
|
-
|
|
50
|
-
Initializes all template files in the output directory with variables replaced.
|
|
51
|
-
|
|
52
|
-
**Usage:**
|
|
53
|
-
```bash
|
|
54
|
-
bash scripts/setup-templates.sh \
|
|
55
|
-
"task_id" \
|
|
56
|
-
"task_description" \
|
|
57
|
-
"auto_mode" \
|
|
58
|
-
"examine_mode" \
|
|
59
|
-
"save_mode" \
|
|
60
|
-
"test_mode" \
|
|
61
|
-
"economy_mode" \
|
|
62
|
-
"branch_mode" \
|
|
63
|
-
"pr_mode" \
|
|
64
|
-
"interactive_mode" \
|
|
65
|
-
"branch_name" \
|
|
66
|
-
"original_input"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Output:**
|
|
70
|
-
```
|
|
71
|
-
.claude/output/apex/01-add-auth-middleware/
|
|
72
|
-
├── 00-context.md # Always created
|
|
73
|
-
├── 01-analyze.md # Always created
|
|
74
|
-
├── 02-plan.md # Always created
|
|
75
|
-
├── 03-execute.md # Always created
|
|
76
|
-
├── 04-validate.md # Always created
|
|
77
|
-
├── 05-examine.md # Only if examine_mode
|
|
78
|
-
├── 06-resolve.md # Only if examine_mode
|
|
79
|
-
├── 07-tests.md # Only if test_mode
|
|
80
|
-
├── 08-run-tests.md # Only if test_mode
|
|
81
|
-
└── 09-finish.md # Only if pr_mode
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Progress Update Script
|
|
85
|
-
|
|
86
|
-
### `update-progress.sh`
|
|
87
|
-
|
|
88
|
-
Updates the progress table in `00-context.md` without manual markdown editing.
|
|
89
|
-
|
|
90
|
-
**Usage:**
|
|
91
|
-
```bash
|
|
92
|
-
bash scripts/update-progress.sh <task_id> <step_number> <step_name> <status>
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Examples:**
|
|
96
|
-
```bash
|
|
97
|
-
# Mark step 01 as in progress
|
|
98
|
-
bash scripts/update-progress.sh "01-add-auth" "01" "analyze" "in_progress"
|
|
99
|
-
|
|
100
|
-
# Mark step 01 as complete
|
|
101
|
-
bash scripts/update-progress.sh "01-add-auth" "01" "analyze" "complete"
|
|
102
|
-
|
|
103
|
-
# Mark step 02 as in progress
|
|
104
|
-
bash scripts/update-progress.sh "01-add-auth" "02" "plan" "in_progress"
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Status Values:**
|
|
108
|
-
- `in_progress` → `⏳ In Progress`
|
|
109
|
-
- `complete` → `✓ Complete`
|
|
110
|
-
|
|
111
|
-
## Token Savings
|
|
112
|
-
|
|
113
|
-
### Before Optimization
|
|
114
|
-
|
|
115
|
-
Each step file contained full template content inline:
|
|
116
|
-
|
|
117
|
-
```markdown
|
|
118
|
-
### 1. Initialize Save Output (if save_mode)
|
|
119
|
-
|
|
120
|
-
**If `{save_mode}` = true:**
|
|
121
|
-
|
|
122
|
-
Create `{output_dir}/01-analyze.md`:
|
|
123
|
-
```markdown
|
|
124
|
-
# Step 01: Analyze
|
|
125
|
-
|
|
126
|
-
**Task:** {task_description}
|
|
127
|
-
**Started:** {ISO timestamp}
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Context Discovery
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Update `00-context.md` progress:
|
|
135
|
-
```markdown
|
|
136
|
-
| 01-analyze | ⏳ In Progress | {timestamp} |
|
|
137
|
-
```
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**Token cost per step:** ~200 tokens × 9 steps = ~1,800 tokens
|
|
141
|
-
|
|
142
|
-
### After Optimization
|
|
143
|
-
|
|
144
|
-
Step files now reference templates and scripts:
|
|
145
|
-
|
|
146
|
-
```markdown
|
|
147
|
-
### 1. Initialize Save Output (if save_mode)
|
|
148
|
-
|
|
149
|
-
**If `{save_mode}` = true:**
|
|
150
|
-
|
|
151
|
-
The file `{output_dir}/01-analyze.md` has already been created by the setup script.
|
|
152
|
-
|
|
153
|
-
Update progress:
|
|
154
|
-
```bash
|
|
155
|
-
bash {skill_dir}/scripts/update-progress.sh "{task_id}" "01" "analyze" "in_progress"
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Append your findings to `01-analyze.md` as you work.
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
**Token cost per step:** ~50 tokens × 9 steps = ~450 tokens
|
|
162
|
-
|
|
163
|
-
**Total savings:** ~1,350 tokens per workflow execution (75% reduction)
|
|
164
|
-
|
|
165
|
-
## How It Works
|
|
166
|
-
|
|
167
|
-
1. **Initialization (step-00-init.md):**
|
|
168
|
-
- Runs `setup-templates.sh` once at workflow start
|
|
169
|
-
- Creates all template files with variables replaced
|
|
170
|
-
- Output directory is ready with pre-initialized files
|
|
171
|
-
|
|
172
|
-
2. **Each Step:**
|
|
173
|
-
- Runs `update-progress.sh` to mark step as "in_progress"
|
|
174
|
-
- Appends findings/logs to the pre-created step file
|
|
175
|
-
- Runs `update-progress.sh` again to mark step as "complete"
|
|
176
|
-
|
|
177
|
-
3. **Benefits:**
|
|
178
|
-
- AI doesn't need to hold template content in context
|
|
179
|
-
- Consistent formatting across all workflows
|
|
180
|
-
- Easy to update templates without editing step files
|
|
181
|
-
- Scripts handle the tedious markdown updates
|
|
182
|
-
|
|
183
|
-
## Updating Templates
|
|
184
|
-
|
|
185
|
-
To modify template content:
|
|
186
|
-
|
|
187
|
-
1. Edit the template file in `templates/`
|
|
188
|
-
2. Changes apply to all future workflows automatically
|
|
189
|
-
3. No need to update step files
|
|
190
|
-
|
|
191
|
-
## Maintenance
|
|
192
|
-
|
|
193
|
-
- Templates are stateless (no workflow-specific logic)
|
|
194
|
-
- Scripts are idempotent (safe to run multiple times)
|
|
195
|
-
- Variables use `{{var}}` syntax to avoid conflicts with markdown
|