workspace-maxxing 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.
Files changed (198) hide show
  1. package/.agents/skills/workspace-maxxing/.workspace-templates/CONTEXT.md +44 -0
  2. package/.agents/skills/workspace-maxxing/.workspace-templates/SYSTEM.md +44 -0
  3. package/.agents/skills/workspace-maxxing/.workspace-templates/references/anti-patterns.md +16 -0
  4. package/.agents/skills/workspace-maxxing/.workspace-templates/references/iron-laws.md +26 -0
  5. package/.agents/skills/workspace-maxxing/.workspace-templates/references/reporting-format.md +52 -0
  6. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/benchmark.ts +171 -0
  7. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/dispatch.ts +473 -0
  8. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/generate-tests.ts +158 -0
  9. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/install-tool.ts +82 -0
  10. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/iterate.ts +265 -0
  11. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/orchestrator.ts +539 -0
  12. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/scaffold.ts +282 -0
  13. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/validate.ts +452 -0
  14. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/architecture/SKILL.md +95 -0
  15. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/fixer/SKILL.md +109 -0
  16. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/iteration/SKILL.md +89 -0
  17. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/prompt-engineering/SKILL.md +87 -0
  18. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/research/SKILL.md +94 -0
  19. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/testing/SKILL.md +89 -0
  20. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/tooling/SKILL.md +87 -0
  21. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/validation/SKILL.md +103 -0
  22. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/worker/SKILL.md +79 -0
  23. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/00-meta/CONTEXT.md +6 -0
  24. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/00-meta/execution-log.md +27 -0
  25. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/01-input/CONTEXT.md +29 -0
  26. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/02-process/CONTEXT.md +29 -0
  27. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/03-output/CONTEXT.md +29 -0
  28. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/README.md +14 -0
  29. package/.agents/skills/workspace-maxxing/SKILL.md +312 -0
  30. package/.agents/skills/workspace-maxxing/scripts/benchmark.ts +171 -0
  31. package/.agents/skills/workspace-maxxing/scripts/dispatch.ts +473 -0
  32. package/.agents/skills/workspace-maxxing/scripts/generate-tests.ts +158 -0
  33. package/.agents/skills/workspace-maxxing/scripts/install-tool.ts +82 -0
  34. package/.agents/skills/workspace-maxxing/scripts/iterate.ts +265 -0
  35. package/.agents/skills/workspace-maxxing/scripts/orchestrator.ts +539 -0
  36. package/.agents/skills/workspace-maxxing/scripts/scaffold.ts +282 -0
  37. package/.agents/skills/workspace-maxxing/scripts/validate.ts +452 -0
  38. package/README.md +144 -0
  39. package/dist/agent-creator.d.ts +9 -0
  40. package/dist/agent-creator.d.ts.map +1 -0
  41. package/dist/agent-creator.js +199 -0
  42. package/dist/agent-creator.js.map +1 -0
  43. package/dist/agent-iterator.d.ts +38 -0
  44. package/dist/agent-iterator.d.ts.map +1 -0
  45. package/dist/agent-iterator.js +327 -0
  46. package/dist/agent-iterator.js.map +1 -0
  47. package/dist/index.d.ts +3 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +197 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/install.d.ts +18 -0
  52. package/dist/install.d.ts.map +1 -0
  53. package/dist/install.js +117 -0
  54. package/dist/install.js.map +1 -0
  55. package/dist/platforms/claude.d.ts +7 -0
  56. package/dist/platforms/claude.d.ts.map +1 -0
  57. package/dist/platforms/claude.js +70 -0
  58. package/dist/platforms/claude.js.map +1 -0
  59. package/dist/platforms/copilot.d.ts +7 -0
  60. package/dist/platforms/copilot.d.ts.map +1 -0
  61. package/dist/platforms/copilot.js +75 -0
  62. package/dist/platforms/copilot.js.map +1 -0
  63. package/dist/platforms/gemini.d.ts +7 -0
  64. package/dist/platforms/gemini.d.ts.map +1 -0
  65. package/dist/platforms/gemini.js +81 -0
  66. package/dist/platforms/gemini.js.map +1 -0
  67. package/dist/platforms/index.d.ts +8 -0
  68. package/dist/platforms/index.d.ts.map +1 -0
  69. package/dist/platforms/index.js +41 -0
  70. package/dist/platforms/index.js.map +1 -0
  71. package/dist/platforms/opencode.d.ts +7 -0
  72. package/dist/platforms/opencode.d.ts.map +1 -0
  73. package/dist/platforms/opencode.js +70 -0
  74. package/dist/platforms/opencode.js.map +1 -0
  75. package/dist/scripts/benchmark.d.ts +20 -0
  76. package/dist/scripts/benchmark.d.ts.map +1 -0
  77. package/dist/scripts/benchmark.js +170 -0
  78. package/dist/scripts/benchmark.js.map +1 -0
  79. package/dist/scripts/dispatch.d.ts +32 -0
  80. package/dist/scripts/dispatch.d.ts.map +1 -0
  81. package/dist/scripts/dispatch.js +386 -0
  82. package/dist/scripts/dispatch.js.map +1 -0
  83. package/dist/scripts/generate-tests.d.ts +11 -0
  84. package/dist/scripts/generate-tests.d.ts.map +1 -0
  85. package/dist/scripts/generate-tests.js +118 -0
  86. package/dist/scripts/generate-tests.js.map +1 -0
  87. package/dist/scripts/install-tool.d.ts +8 -0
  88. package/dist/scripts/install-tool.d.ts.map +1 -0
  89. package/dist/scripts/install-tool.js +98 -0
  90. package/dist/scripts/install-tool.js.map +1 -0
  91. package/dist/scripts/iterate.d.ts +44 -0
  92. package/dist/scripts/iterate.d.ts.map +1 -0
  93. package/dist/scripts/iterate.js +260 -0
  94. package/dist/scripts/iterate.js.map +1 -0
  95. package/dist/scripts/orchestrator.d.ts +40 -0
  96. package/dist/scripts/orchestrator.d.ts.map +1 -0
  97. package/dist/scripts/orchestrator.js +378 -0
  98. package/dist/scripts/orchestrator.js.map +1 -0
  99. package/dist/scripts/scaffold.d.ts +8 -0
  100. package/dist/scripts/scaffold.d.ts.map +1 -0
  101. package/dist/scripts/scaffold.js +279 -0
  102. package/dist/scripts/scaffold.js.map +1 -0
  103. package/dist/scripts/validate.d.ts +11 -0
  104. package/dist/scripts/validate.d.ts.map +1 -0
  105. package/dist/scripts/validate.js +472 -0
  106. package/dist/scripts/validate.js.map +1 -0
  107. package/docs/superpowers/plans/2026-04-07-autonomous-iteration-plan.md +1123 -0
  108. package/docs/superpowers/plans/2026-04-07-autonomous-iteration-sub-agent-batches.md +1923 -0
  109. package/docs/superpowers/plans/2026-04-07-autonomous-workflow-sub-skill-plan.md +1505 -0
  110. package/docs/superpowers/plans/2026-04-07-benchmarking-multi-agent-plan.md +854 -0
  111. package/docs/superpowers/plans/2026-04-07-workspace-builder-logic-plan.md +1426 -0
  112. package/docs/superpowers/plans/2026-04-07-workspace-maxxing-plan.md +1299 -0
  113. package/docs/superpowers/plans/2026-04-08-session-294c-subagent-invocation-plan.md +320 -0
  114. package/docs/superpowers/plans/2026-04-08-workflow-prompt-hardening-plan.md +1025 -0
  115. package/docs/superpowers/plans/2026-04-12-workspace-agent-creation-plan.md +992 -0
  116. package/docs/superpowers/specs/2026-04-07-autonomous-iteration-design.md +214 -0
  117. package/docs/superpowers/specs/2026-04-07-autonomous-iteration-sub-agent-batches-design.md +188 -0
  118. package/docs/superpowers/specs/2026-04-07-autonomous-workflow-sub-skill-design.md +137 -0
  119. package/docs/superpowers/specs/2026-04-07-benchmarking-multi-agent-design.md +105 -0
  120. package/docs/superpowers/specs/2026-04-07-workspace-builder-logic-design.md +179 -0
  121. package/docs/superpowers/specs/2026-04-07-workspace-maxxing-design.md +227 -0
  122. package/docs/superpowers/specs/2026-04-08-session-294c-subagent-invocation-design.md +265 -0
  123. package/docs/superpowers/specs/2026-04-08-workflow-prompt-hardening-design.md +146 -0
  124. package/docs/superpowers/specs/2026-04-12-workspace-agent-creation-design.md +239 -0
  125. package/jest.config.js +8 -0
  126. package/package.json +32 -0
  127. package/src/agent-creator.ts +180 -0
  128. package/src/agent-iterator.ts +397 -0
  129. package/src/index.ts +189 -0
  130. package/src/install.ts +105 -0
  131. package/src/platforms/claude.ts +40 -0
  132. package/src/platforms/copilot.ts +50 -0
  133. package/src/platforms/gemini.ts +55 -0
  134. package/src/platforms/index.ts +45 -0
  135. package/src/platforms/opencode.ts +41 -0
  136. package/src/scripts/benchmark.ts +171 -0
  137. package/src/scripts/dispatch.ts +473 -0
  138. package/src/scripts/generate-tests.ts +112 -0
  139. package/src/scripts/install-tool.ts +82 -0
  140. package/src/scripts/iterate.ts +271 -0
  141. package/src/scripts/orchestrator.ts +539 -0
  142. package/src/scripts/scaffold.ts +282 -0
  143. package/src/scripts/validate.ts +516 -0
  144. package/templates/.workspace-templates/CONTEXT.md +44 -0
  145. package/templates/.workspace-templates/SYSTEM.md +44 -0
  146. package/templates/.workspace-templates/references/anti-patterns.md +16 -0
  147. package/templates/.workspace-templates/references/iron-laws.md +26 -0
  148. package/templates/.workspace-templates/references/reporting-format.md +52 -0
  149. package/templates/.workspace-templates/scripts/benchmark.ts +171 -0
  150. package/templates/.workspace-templates/scripts/dispatch.ts +473 -0
  151. package/templates/.workspace-templates/scripts/generate-tests.ts +158 -0
  152. package/templates/.workspace-templates/scripts/install-tool.ts +82 -0
  153. package/templates/.workspace-templates/scripts/iterate.ts +265 -0
  154. package/templates/.workspace-templates/scripts/orchestrator.ts +539 -0
  155. package/templates/.workspace-templates/scripts/scaffold.ts +282 -0
  156. package/templates/.workspace-templates/scripts/validate.ts +452 -0
  157. package/templates/.workspace-templates/skills/architecture/SKILL.md +95 -0
  158. package/templates/.workspace-templates/skills/fixer/SKILL.md +109 -0
  159. package/templates/.workspace-templates/skills/iteration/SKILL.md +89 -0
  160. package/templates/.workspace-templates/skills/prompt-engineering/SKILL.md +87 -0
  161. package/templates/.workspace-templates/skills/research/SKILL.md +94 -0
  162. package/templates/.workspace-templates/skills/testing/SKILL.md +89 -0
  163. package/templates/.workspace-templates/skills/tooling/SKILL.md +87 -0
  164. package/templates/.workspace-templates/skills/validation/SKILL.md +103 -0
  165. package/templates/.workspace-templates/skills/worker/SKILL.md +79 -0
  166. package/templates/.workspace-templates/workspace/00-meta/CONTEXT.md +6 -0
  167. package/templates/.workspace-templates/workspace/00-meta/execution-log.md +27 -0
  168. package/templates/.workspace-templates/workspace/01-input/CONTEXT.md +29 -0
  169. package/templates/.workspace-templates/workspace/02-process/CONTEXT.md +29 -0
  170. package/templates/.workspace-templates/workspace/03-output/CONTEXT.md +29 -0
  171. package/templates/.workspace-templates/workspace/README.md +14 -0
  172. package/templates/SKILL.md +347 -0
  173. package/tests/benchmark.test.ts +158 -0
  174. package/tests/cli.test.ts +109 -0
  175. package/tests/dispatch-parallel.test.ts +124 -0
  176. package/tests/dispatch.test.ts +218 -0
  177. package/tests/fixer-skill.test.ts +203 -0
  178. package/tests/generate-tests.test.ts +101 -0
  179. package/tests/install-tool.test.ts +141 -0
  180. package/tests/install.test.ts +144 -0
  181. package/tests/integration.test.ts +324 -0
  182. package/tests/iterate.test.ts +219 -0
  183. package/tests/orchestrator.test.ts +710 -0
  184. package/tests/scaffold.test.ts +238 -0
  185. package/tests/templates-enhanced.test.ts +208 -0
  186. package/tests/templates.test.ts +219 -0
  187. package/tests/validate.test.ts +421 -0
  188. package/tests/validation-enhanced.test.ts +303 -0
  189. package/tests/worker-skill.test.ts +88 -0
  190. package/tsconfig.json +19 -0
  191. package/workspace/00-meta/CONTEXT.md +3 -0
  192. package/workspace/00-meta/execution-log.md +17 -0
  193. package/workspace/00-meta/tools.md +11 -0
  194. package/workspace/01-input/CONTEXT.md +27 -0
  195. package/workspace/CONTEXT.md +35 -0
  196. package/workspace/README.md +14 -0
  197. package/workspace/SYSTEM.md +36 -0
  198. package/workspace-maxxing-0.1.0.tgz +0 -0
@@ -0,0 +1,146 @@
1
+ # Workflow Prompt Hardening for Scaffolded Workspaces — Design Spec
2
+
3
+ ## Overview
4
+
5
+ Harden generated workspace prompts so agents reliably follow the intended workflow stages and loading discipline. This design upgrades scaffolded `SYSTEM.md`, root `CONTEXT.md`, and stage-level `CONTEXT.md` generation, aligns shipped template docs to the same structure, and introduces stricter validation checks that enforce both structure and workflow semantics.
6
+
7
+ ## Goals
8
+
9
+ 1. Make scaffold-generated prompts robust enough to guide stage-correct execution.
10
+ 2. Ensure prompt structures are consistent across generated workspaces and shipped templates.
11
+ 3. Enforce workflow contracts through `validate.ts` so prompt regressions fail early.
12
+ 4. Preserve existing script ergonomics (same CLI usage and pass/fail exit behavior).
13
+
14
+ ## Non-Goals
15
+
16
+ 1. No anti-rationalization or iron-law requirement in validation for this phase.
17
+ 2. No orchestrator or benchmark behavior changes.
18
+ 3. No package or dependency changes (Node builtins only).
19
+
20
+ ## Architecture
21
+
22
+ ### 1) Generation Contract (Scaffold)
23
+
24
+ File: `src/scripts/scaffold.ts`
25
+
26
+ #### SYSTEM.md (root) required sections
27
+ - `## Role`
28
+ - `## Folder Map`
29
+ - `## Workflow Rules`
30
+ - `## Stage Boundaries`
31
+ - `## Tooling Policy`
32
+
33
+ The generated content must explicitly communicate:
34
+ - One-way stage dependencies.
35
+ - Numbered stage progression.
36
+ - Selective loading expectations.
37
+ - Canonical-source behavior (avoid duplication).
38
+
39
+ #### CONTEXT.md (root router) required sections
40
+ - `## How to Use This File`
41
+ - `## Task Routing`
42
+ - `## Loading Order`
43
+ - `## Stage Handoff Routing`
44
+ - `## Escalation`
45
+
46
+ The generated router must:
47
+ - Route workspace intents to specific stage context files.
48
+ - Include deterministic loading order (`SYSTEM.md` first, then root `CONTEXT.md`, then stage `CONTEXT.md`, then minimal task files).
49
+ - Describe how to move from one stage to the next.
50
+
51
+ #### Stage CONTEXT.md required sections
52
+ - `## Purpose`
53
+ - `## Inputs`
54
+ - `## Outputs`
55
+ - `## Dependencies`
56
+ - `## Completion Criteria`
57
+ - `## Handoff`
58
+
59
+ Each stage context must include enough contract detail to prevent generic or cross-stage ambiguous behavior.
60
+
61
+ ### 2) Template Alignment
62
+
63
+ Files:
64
+ - `templates/.workspace-templates/SYSTEM.md`
65
+ - `templates/.workspace-templates/CONTEXT.md`
66
+ - `templates/.workspace-templates/workspace/01-input/CONTEXT.md`
67
+ - `templates/.workspace-templates/workspace/02-process/CONTEXT.md`
68
+ - `templates/.workspace-templates/workspace/03-output/CONTEXT.md`
69
+
70
+ These files will be updated to match the same generation contract so both:
71
+ - scaffolded workspaces, and
72
+ - packaged templates
73
+
74
+ provide consistent guidance quality.
75
+
76
+ ### 3) Validation Contract (Structural + Workflow Strictness)
77
+
78
+ File: `src/scripts/validate.ts`
79
+
80
+ #### Root checks
81
+ - `SYSTEM.md` exists.
82
+ - `SYSTEM.md` contains required section headings.
83
+ - Root `CONTEXT.md` exists.
84
+ - Root `CONTEXT.md` contains required section headings.
85
+
86
+ #### Stage checks
87
+ For each numbered stage folder:
88
+ - `CONTEXT.md` exists and is non-empty.
89
+ - Stage `CONTEXT.md` contains all required stage section headings.
90
+
91
+ #### Workflow consistency checks
92
+ - Every discovered numbered stage appears in root routing.
93
+ - Routed stage targets resolve to existing stage `CONTEXT.md` files.
94
+ - Root loading order enforces selective loading.
95
+ - Dependency direction rule: a stage must not depend on a later-numbered stage.
96
+
97
+ #### Output behavior
98
+ - Keep check-by-check result structure and human-readable console reporting.
99
+ - Keep exit semantics unchanged (`0` pass, `1` fail).
100
+
101
+ ## Data Flow
102
+
103
+ 1. `scaffold.ts` generates robust prompt contracts at root and stage levels.
104
+ 2. Agents load root documents, route into stage contexts, and follow stage boundaries.
105
+ 3. `validate.ts` enforces structural and workflow contracts.
106
+ 4. Iteration/orchestration logic consumes stronger workflow prompts and fails fast on doc drift.
107
+
108
+ ## Testing Strategy (TDD)
109
+
110
+ ### Scaffold tests (`tests/scaffold.test.ts`)
111
+ Add failing tests first for:
112
+ - SYSTEM required section headings.
113
+ - Root CONTEXT required section headings.
114
+ - Stage CONTEXT required section headings including Completion Criteria and Handoff.
115
+ - Root routing references all generated numbered stages.
116
+
117
+ ### Validate tests (`tests/validate.test.ts`)
118
+ Add failing tests first for:
119
+ - Missing SYSTEM required sections.
120
+ - Missing root CONTEXT required sections.
121
+ - Missing stage required sections.
122
+ - Missing stage routing coverage in root router.
123
+ - Dependency direction violation (later-stage dependency).
124
+
125
+ ### Regression checks
126
+ - Existing scaffold/validate expectations that remain valid should still pass.
127
+ - Run targeted suites first, then full suite and build.
128
+
129
+ ## Risks and Mitigations
130
+
131
+ 1. Risk: False negatives from strict heading checks.
132
+ - Mitigation: validate by section headings that are stable and intentionally generated.
133
+
134
+ 2. Risk: Overly rigid wording constraints.
135
+ - Mitigation: enforce section presence and key workflow semantics, not full text equality.
136
+
137
+ 3. Risk: Breakage in existing test fixtures.
138
+ - Mitigation: update fixture content only where new contract explicitly requires it.
139
+
140
+ ## Acceptance Criteria
141
+
142
+ 1. Scaffold-generated `SYSTEM.md`, root `CONTEXT.md`, and stage `CONTEXT.md` files contain all required sections.
143
+ 2. Shipped template docs use the same robust structure.
144
+ 3. `validate.ts` fails when required sections or workflow consistency rules are violated.
145
+ 4. Focused scaffold and validate test suites pass.
146
+ 5. Full repository test suite and TypeScript build pass.
@@ -0,0 +1,239 @@
1
+ # Workspace-Maxxing with Invokable Agent Creation - Design Spec
2
+
3
+ ## Overview
4
+
5
+ Extends `workspace-maxxing` skill to create, deliver, and iteratively improve an autonomous workflow agent inside the generated workspace. The skill builds both the ICM folder structure AND a self-improving agent that can be invoked with `@` in the workspace.
6
+
7
+ ## Goals
8
+
9
+ 1. Create invokable sub-agent inside the generated workspace
10
+ 2. Agent implements the actual workflow use case (not just the workspace structure)
11
+ 3. Self-improvement loop tests and strengthens the agent during build phase
12
+ 4. Backward compatible with existing workspace-maxxing behavior
13
+ 5. Multi-platform support (OpenCode, Claude Code, Copilot, Gemini)
14
+
15
+ ## Non-Goals
16
+
17
+ 1. Agent that persists outside the workspace (workspace-local only)
18
+ 2. Real-time self-improvement after delivery (improvement only during build)
19
+ 3. UI changes to workspace-maxxing skill
20
+
21
+ ## Architecture
22
+
23
+ ### Package Structure
24
+
25
+ ```
26
+ workspace-maxxing/
27
+ ├── SKILL.md # Main skill entry
28
+ ├── package.json
29
+ ├── src/
30
+ │ ├── index.ts # Main entry, orchestration
31
+ │ ├── scaffold.ts # Creates ICM workspace
32
+ │ ├── agent-creator.ts # Creates @agent implementation
33
+ │ ├── agent-iterator.ts # Self-improvement loop
34
+ │ └── installer.ts # Platform-specific install
35
+ ├── scripts/
36
+ │ ├── scaffold.ts # (existing)
37
+ │ ├── validate.ts # (existing)
38
+ │ ├── benchmark.ts # (existing)
39
+ │ ├── dispatch.ts # (existing)
40
+ │ └── orchestrator.ts # (existing)
41
+ └── templates/
42
+ ├── workspace/ # ICM workspace template
43
+ └── agent/ # Agent template base
44
+ ```
45
+
46
+ ### Agent Structure (Created Inside Workspace)
47
+
48
+ ```
49
+ workspace/
50
+ ├── .agents/
51
+ │ └── skills/
52
+ │ └── @<purpose>/ # The invokable agent
53
+ │ ├── SKILL.md
54
+ │ ├── prompts/
55
+ │ │ ├── system.md
56
+ │ │ └── tasks/
57
+ │ ├── tools/
58
+ │ │ └── index.ts
59
+ │ ├── tests/
60
+ │ │ └── cases.json
61
+ │ └── config.json
62
+ ├── 01-input/
63
+ ├── 02-process/
64
+ ├── 03-output/
65
+ ├── SYSTEM.md
66
+ └── CONTEXT.md
67
+ ```
68
+
69
+ ## Core Workflow
70
+
71
+ ```
72
+ ┌─────────────────────────────────────────────────────────────────┐
73
+ │ workspace-maxxing execution │
74
+ ├─────────────────────────────────────────────────────────────────┤
75
+ │ 1. Research phase (dispatch research sub-skill) │
76
+ │ 2. Architecture phase (dispatch architecture sub-skill) │
77
+ │ 3. Build workspace (scaffold.ts) │
78
+ │ 4. Create agent (agent-creator.ts) │
79
+ │ - Generate agent name from purpose │
80
+ │ - Create agent structure from template │
81
+ │ - Initialize prompts based on workflow │
82
+ │ 5. Iterate agent (agent-iterator.ts) - SELF-IMPROVING │
83
+ │ a. Generate test cases (edge, empty, various) │
84
+ │ b. Run agent with each test case │
85
+ │ c. Assess robustness (score + issues) │
86
+ │ d. If score < threshold: improve agent │
87
+ │ e. Repeat until score >= threshold OR max-retries │
88
+ │ 6. Validate workspace (validate.ts) │
89
+ │ 7. Install agent to platform skill directory │
90
+ │ 8. Deliver │
91
+ └─────────────────────────────────────────────────────────────────┘
92
+ ```
93
+
94
+ ## Agent Self-Improvement Loop
95
+
96
+ ### Input
97
+
98
+ - Agent implementation (prompts, tools, config)
99
+ - Test case generation rules (edge cases, empty states, varied inputs)
100
+
101
+ ### Process
102
+
103
+ 1. **Generate test cases** - Create diverse test inputs based on workflow type
104
+ 2. **Execute agent** - Run agent with each test case, capture outputs
105
+ 3. **Assess robustness** - Check for:
106
+ - Crashes or errors
107
+ - Invalid outputs
108
+ - Edge case handling
109
+ - Empty input handling
110
+ 4. **Score** - Compute robustness score (0-100)
111
+ 5. **Improve** - If score < threshold, modify prompts/tools to fix issues
112
+ 6. **Repeat** - Max 3 improvement cycles per batch
113
+
114
+ ### Output
115
+
116
+ - Improved agent implementation
117
+ - Test case results with pass/fail per case
118
+ - Robustness score
119
+ - Iteration log
120
+
121
+ ### Thresholds
122
+
123
+ - Default robustness threshold: 85
124
+ - Max iteration cycles: 3 per batch
125
+ - Batch size: 3 test cases
126
+
127
+ ## Agent Naming
128
+
129
+ - **Pattern**: `@<purpose>` derived from workspace purpose
130
+ - **Generation**: Convert workspace name/purpose to lowercase, hyphenated
131
+ - **Examples**:
132
+ - "Daily Digest" → `@daily-digest`
133
+ - "Project Tracker" → `@project-tracker`
134
+ - "AI News Aggregator" → `@ai-news-aggregator`
135
+
136
+ ## Platform Integration
137
+
138
+ ### OpenCode
139
+
140
+ - Location: `workspace/.agents/skills/@<name>/`
141
+ - Invocation: `@agent-name`
142
+ - Auto-load on first mention
143
+
144
+ ### Claude Code
145
+
146
+ - Location: `workspace/.claude/skills/<name>/`
147
+ - Invocation: `{@name}` in prompts or instructions
148
+ - Manual first invocation required
149
+
150
+ ### GitHub Copilot
151
+
152
+ - Location: `workspace/.github/copilot-instructions/<name>.md`
153
+ - Invocation: Through inline instructions
154
+
155
+ ### Gemini CLI
156
+
157
+ - Location: `workspace/.gemini/skills/<name>/`
158
+ - Invocation: Follows Gemini instruction format
159
+
160
+ ## Backward Compatibility
161
+
162
+ - **Default behavior**: Creates workspace + agent (new behavior)
163
+ - **Opt-out**: `--no-agent` flag creates workspace-only (existing behavior)
164
+ - **Detection**: If no agent flag specified, assumes with-agent
165
+ - **Existing scripts**: Unchanged, work as before
166
+ - **Existing workspaces**: No migration needed
167
+
168
+ ## Configuration
169
+
170
+ ### Workspace-Maxxing Options
171
+
172
+ | Option | Default | Description |
173
+ |--------|---------|-------------|
174
+ | `--with-agent` | true | Create invokable agent |
175
+ | `--agent-name` | auto | Custom agent name (overrides auto) |
176
+ | `--robustness-threshold` | 85 | Min score to pass iteration |
177
+ | `--max-agent-iterations` | 3 | Max improvement cycles |
178
+
179
+ ### Agent Config
180
+
181
+ ```json
182
+ {
183
+ "name": "@daily-digest",
184
+ "purpose": "Create daily AI news digest",
185
+ "platforms": ["opencode", "claude", "copilot", "gemini"],
186
+ "robustnessThreshold": 85,
187
+ "iterationCount": 0,
188
+ "testCases": []
189
+ }
190
+ ```
191
+
192
+ ## Anti-Patterns
193
+
194
+ | Thought | Reality |
195
+ |---------|---------|
196
+ | "The agent works for basic cases" | Edge cases and empty states matter. Iterate until threshold. |
197
+ | "One iteration is enough" | Self-improvement needs multiple cycles. |
198
+ | "User will refine the agent later" | Goal is robust agent on delivery. |
199
+ | "Agent validation is optional" | Robustness check is mandatory gate. |
200
+
201
+ ## Acceptance Criteria
202
+
203
+ 1. Workspace-maxxing creates both folder structure AND agent
204
+ 2. Agent is invokable with `@<name>` in supported platforms
205
+ 3. Self-improvement loop runs during build, achieves score >= 85
206
+ 4. Backward compatible - existing usage unchanged with `--no-agent`
207
+ 5. Agent persists in workspace, survives session restart
208
+ 6. Iteration logs stored in workspace for debugging
209
+ 7. Multi-platform installation works (OpenCode, Claude, Copilot, Gemini)
210
+
211
+ ## Risks and Mitigations
212
+
213
+ | Risk | Mitigation |
214
+ |------|------------|
215
+ | Agent name collision in workspace | Check existing agents, append number if needed |
216
+ | Platform detection fails | Default to OpenCode, log warning |
217
+ | Iteration infinite loop | Max 3 cycles, escalate after threshold not met |
218
+ | Agent template incomplete | Provide minimal viable template, improve over time |
219
+
220
+ ## File Changes
221
+
222
+ ### New Files
223
+
224
+ - `src/agent-creator.ts` - Creates agent implementation
225
+ - `src/agent-iterator.ts` - Self-improvement loop
226
+ - `templates/agent/` - Agent template base
227
+
228
+ ### Modified Files
229
+
230
+ - `SKILL.md` - Update workflow to include agent creation
231
+ - `src/index.ts` - Add agent orchestration
232
+ - `package.json` - Add dependencies if needed
233
+
234
+ ## Timeline
235
+
236
+ 1. Phase 1: Agent creator (scaffold agent structure from template)
237
+ 2. Phase 2: Agent iterator (self-improvement loop)
238
+ 3. Phase 3: Platform installer (multi-platform support)
239
+ 4. Phase 4: Backward compatibility (--no-agent flag)
package/jest.config.js ADDED
@@ -0,0 +1,8 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
+ roots: ['<rootDir>/tests'],
6
+ testMatch: ['**/*.test.ts'],
7
+ moduleFileExtensions: ['ts', 'js', 'json'],
8
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "workspace-maxxing",
3
+ "version": "0.1.0",
4
+ "description": "npx-installable skill for AI agents to create structured workspaces using ICM methodology",
5
+ "bin": {
6
+ "workspace-maxxing": "dist/index.js"
7
+ },
8
+ "main": "dist/index.js",
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "test": "jest --config jest.config.js",
12
+ "test:watch": "jest --watch",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "keywords": ["ai-agent", "workspace", "skill", "opencode", "icm"],
16
+ "author": "Eric Julian Deguzman <ericjuliandeguzman77@gmail.com>",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/ericjdz/workflow-maxxing"
21
+ },
22
+ "devDependencies": {
23
+ "@types/jest": "^29.5.12",
24
+ "@types/node": "^20.11.0",
25
+ "jest": "^29.7.0",
26
+ "ts-jest": "^29.1.2",
27
+ "typescript": "^5.3.3"
28
+ },
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ }
32
+ }
@@ -0,0 +1,180 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+
4
+ export interface AgentOptions {
5
+ name: string;
6
+ purpose: string;
7
+ workspacePath: string;
8
+ platforms?: string[];
9
+ }
10
+
11
+ export function generateAgentName(purpose: string): string {
12
+ // Convert "Daily Digest" -> "@daily-digest"
13
+ // Convert "AI News Aggregator" -> "@ai-news-aggregator"
14
+ const cleaned = purpose
15
+ .toLowerCase()
16
+ .replace(/[^a-z0-9\s-]/g, '')
17
+ .replace(/\s+/g, '-')
18
+ .replace(/-+/g, '-')
19
+ .trim();
20
+ return `@${cleaned}`;
21
+ }
22
+
23
+ export function createAgent(options: AgentOptions): void {
24
+ const { name, purpose, workspacePath } = options;
25
+
26
+ // Remove @ prefix for directory name
27
+ const dirName = name.startsWith('@') ? name.slice(1) : name;
28
+ const agentDir = path.join(workspacePath, '.agents', 'skills', dirName);
29
+
30
+ // Create directory structure
31
+ fs.mkdirSync(path.join(agentDir, 'prompts', 'tasks'), { recursive: true });
32
+ fs.mkdirSync(path.join(agentDir, 'tools'), { recursive: true });
33
+ fs.mkdirSync(path.join(agentDir, 'tests'), { recursive: true });
34
+
35
+ // Write SKILL.md
36
+ const skillContent = generateSkillMd(name, purpose);
37
+ fs.writeFileSync(path.join(agentDir, 'SKILL.md'), skillContent);
38
+
39
+ // Write config.json
40
+ const configContent = JSON.stringify({
41
+ name,
42
+ purpose,
43
+ platforms: options.platforms ?? ['opencode', 'claude', 'copilot', 'gemini'],
44
+ robustnessThreshold: 85,
45
+ iterationCount: 0,
46
+ testCases: [],
47
+ }, null, 2);
48
+ fs.writeFileSync(path.join(agentDir, 'config.json'), configContent);
49
+
50
+ // Write prompts/system.md
51
+ const systemPrompt = generateSystemPrompt(name, purpose);
52
+ fs.writeFileSync(path.join(agentDir, 'prompts', 'system.md'), systemPrompt);
53
+
54
+ // Write prompts/tasks/ default task prompt
55
+ const taskPrompt = generateTaskPrompt(name, purpose);
56
+ fs.writeFileSync(path.join(agentDir, 'prompts', 'tasks', 'default.md'), taskPrompt);
57
+
58
+ console.log(`Agent "${name}" created at: ${agentDir}`);
59
+ }
60
+
61
+ function generateSkillMd(name: string, purpose: string): string {
62
+ const dirName = name.startsWith('@') ? name.slice(1) : name;
63
+ return `---
64
+ name: ${name}
65
+ description: "${purpose}. Use when user wants to run this workflow."
66
+ triggers: ["${name}", "${purpose.toLowerCase()}", "run ${dirName} workflow"]
67
+ ---
68
+
69
+ # ${name} Agent
70
+
71
+ ## Purpose
72
+ ${purpose}
73
+
74
+ ## When to Use
75
+ - User wants to execute the workflow
76
+ - User asks to process inputs and generate outputs
77
+ - User wants to run automated tasks
78
+
79
+ ## The Iron Law
80
+
81
+ NO SKIPPING WORKFLOW STEPS
82
+ NO IMPLEMENTATION BEFORE PLAN
83
+ NO CLAIMING DONE WITHOUT OUTPUT
84
+
85
+ ## Capabilities
86
+ - Execute workflow tasks following ICM stage boundaries
87
+ - Process inputs from 01-input/ and generate outputs in 03-output/
88
+ - Read workspace context (SYSTEM.md, stage CONTEXT.md)
89
+ - Produce structured markdown outputs
90
+
91
+ ## How It Works
92
+
93
+ 1. **Read Context** - Load SYSTEM.md, root CONTEXT.md, and relevant stage CONTEXT.md
94
+ 2. **Process Task** - Execute the requested workflow step
95
+ 3. **Write Output** - Save results to appropriate stage folder
96
+ 4. **Report** - Provide summary in chat + log to file
97
+
98
+ ## Output Format
99
+
100
+ - Stage outputs as markdown files in numbered folders
101
+ - Progress reported in hybrid format (chat summary + file details)
102
+ - Results logged for traceability
103
+
104
+ ## Configuration
105
+ See config.json for agent configuration options.
106
+
107
+ ## Anti-Rationalization
108
+
109
+ | Thought | Reality |
110
+ |---------|----------|
111
+ | "I know what to do" | Read the stage CONTEXT.md first |
112
+ | "Good enough" | Follow the workflow exactly |
113
+ | "Skip a stage" | Workflow stages exist for a reason |
114
+ | "No output needed" | Every task produces artifacts |
115
+ `;
116
+ }
117
+
118
+ function generateSystemPrompt(name: string, purpose: string): string {
119
+ const dirName = name.startsWith('@') ? name.slice(1) : name;
120
+ return `# ${name} - System Prompt
121
+
122
+ ## Role
123
+ You are ${name}, an autonomous workflow agent that executes the ${purpose} workflow.
124
+
125
+ ## Workspace Context
126
+ - Read \`SYSTEM.md\` first for global rules
127
+ - Load root \`CONTEXT.md\` for routing
128
+ - Read relevant stage \`CONTEXT.md\` for specific instructions
129
+
130
+ ## Workflow Execution
131
+
132
+ 1. **Understand the request** - What does the user want to accomplish?
133
+ 2. **Load appropriate context** - Read only the needed stage files
134
+ 3. **Execute the task** - Follow the stage-specific instructions
135
+ 4. **Produce output** - Write results to the appropriate folder
136
+ 5. **Report progress** - Provide summary in chat + log to file
137
+
138
+ ## Stage Boundaries
139
+ - \`01-input/\` - Input collection and validation
140
+ - \`02-process/\` - Processing and transformation
141
+ - \`03-output/\` - Output generation and delivery
142
+ - \`00-meta/\` - Configuration and tools
143
+
144
+ ## Constraints
145
+ - Stay within workspace scope
146
+ - Follow ICM folder boundaries strictly
147
+ - Do not create product implementation code
148
+ - Keep outputs as markdown artifacts
149
+ - Report progress in hybrid format (chat + files)
150
+
151
+ ## Error Handling
152
+ - If context is missing, ask for clarification
153
+ - If stage dependencies are unclear, check execution-log.md
154
+ - If task is outside workspace scope, redirect to workflow design
155
+ `;
156
+ }
157
+
158
+ function generateTaskPrompt(name: string, purpose: string): string {
159
+ return `# Default Task Prompt
160
+
161
+ ## Task
162
+ Execute the workflow request from the user.
163
+
164
+ ## Input
165
+ Read the user's request and determine which workflow stage applies.
166
+
167
+ ## Process
168
+ 1. Load the relevant stage context
169
+ 2. Follow the stage's completion criteria
170
+ 3. Produce the required outputs
171
+
172
+ ## Output
173
+ Write results to the appropriate stage folder as markdown artifacts.
174
+
175
+ ## Success Criteria
176
+ - Output conforms to stage purpose
177
+ - Required evidence is produced
178
+ - Handoff notes updated for next stage
179
+ `;
180
+ }