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,452 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+
4
+ export interface CheckResult {
5
+ name: string;
6
+ passed: boolean;
7
+ message: string;
8
+ }
9
+
10
+ export interface ValidationResult {
11
+ passed: boolean;
12
+ checks: CheckResult[];
13
+ }
14
+
15
+ const REQUIRED_SYSTEM_HEADINGS = [
16
+ '## Role',
17
+ '## Folder Map',
18
+ '## Workflow Rules',
19
+ '## Scope Guardrails',
20
+ '## Sequential Execution Protocol',
21
+ '## Stage Boundaries',
22
+ '## Tooling Policy',
23
+ ];
24
+
25
+ const REQUIRED_ROOT_CONTEXT_HEADINGS = [
26
+ '## How to Use This File',
27
+ '## Task Routing',
28
+ '## Loading Order',
29
+ '## Scope Guardrails',
30
+ '## Sequential Routing Contract',
31
+ '## Stage Handoff Routing',
32
+ '## Escalation',
33
+ ];
34
+
35
+ const REQUIRED_STAGE_CONTEXT_HEADINGS = [
36
+ '## Purpose',
37
+ '## Inputs',
38
+ '## Outputs',
39
+ '## Dependencies',
40
+ '## Required Evidence',
41
+ '## Completion Criteria',
42
+ '## Handoff',
43
+ ];
44
+
45
+ const DISALLOWED_STAGE_SOURCE_EXTENSIONS = new Set([
46
+ '.ts',
47
+ '.tsx',
48
+ '.js',
49
+ '.jsx',
50
+ '.py',
51
+ '.java',
52
+ '.go',
53
+ '.rs',
54
+ '.cs',
55
+ '.cpp',
56
+ '.c',
57
+ '.rb',
58
+ '.php',
59
+ '.swift',
60
+ '.kt',
61
+ '.scala',
62
+ ]);
63
+
64
+ export function validateWorkspace(workspacePath: string): ValidationResult {
65
+ const ws = path.resolve(workspacePath);
66
+ const checks: CheckResult[] = [];
67
+ const numberedFolders = getNumberedStageFolders(ws);
68
+
69
+ const systemMdPath = path.join(ws, 'SYSTEM.md');
70
+ const systemExists = fs.existsSync(systemMdPath);
71
+ checks.push({
72
+ name: 'SYSTEM.md exists',
73
+ passed: systemExists,
74
+ message: systemExists ? 'Found' : 'Missing',
75
+ });
76
+
77
+ if (systemExists) {
78
+ const systemContent = fs.readFileSync(systemMdPath, 'utf-8');
79
+ const hasFolderMap = systemContent.toLowerCase().includes('folder map');
80
+ checks.push({
81
+ name: 'SYSTEM.md contains folder map',
82
+ passed: hasFolderMap,
83
+ message: hasFolderMap ? 'Found' : 'Missing "folder map" reference',
84
+ });
85
+
86
+ addRequiredHeadingChecks('SYSTEM.md', systemContent, REQUIRED_SYSTEM_HEADINGS, checks);
87
+ } else {
88
+ checks.push({
89
+ name: 'SYSTEM.md contains folder map',
90
+ passed: false,
91
+ message: 'Cannot check — SYSTEM.md missing',
92
+ });
93
+
94
+ for (const heading of REQUIRED_SYSTEM_HEADINGS) {
95
+ checks.push({
96
+ name: `SYSTEM.md contains ${heading}`,
97
+ passed: false,
98
+ message: `Cannot check - SYSTEM.md missing`,
99
+ });
100
+ }
101
+ }
102
+
103
+ const contextMdPath = path.join(ws, 'CONTEXT.md');
104
+ const contextExists = fs.existsSync(contextMdPath);
105
+ checks.push({
106
+ name: 'CONTEXT.md exists at root',
107
+ passed: contextExists,
108
+ message: contextExists ? 'Found' : 'Missing',
109
+ });
110
+
111
+ if (contextExists) {
112
+ const contextContent = fs.readFileSync(contextMdPath, 'utf-8');
113
+ addRequiredHeadingChecks('CONTEXT.md', contextContent, REQUIRED_ROOT_CONTEXT_HEADINGS, checks);
114
+
115
+ const allReferenced = numberedFolders.every((folder) => contextContent.includes(`${folder}/CONTEXT.md`));
116
+ checks.push({
117
+ name: 'Root routing references all numbered stages',
118
+ passed: allReferenced,
119
+ message: allReferenced ? 'All numbered stages are routed' : 'Missing one or more numbered stage routes',
120
+ });
121
+
122
+ const enforcesSelectiveLoading =
123
+ /## Loading Order/i.test(contextContent)
124
+ && /SYSTEM\.md/i.test(contextContent)
125
+ && /Only the task files needed/i.test(contextContent);
126
+
127
+ checks.push({
128
+ name: 'Root loading order enforces selective loading',
129
+ passed: enforcesSelectiveLoading,
130
+ message: enforcesSelectiveLoading
131
+ ? 'Selective loading guidance found'
132
+ : 'Loading order lacks selective-loading guidance',
133
+ });
134
+ } else {
135
+ for (const heading of REQUIRED_ROOT_CONTEXT_HEADINGS) {
136
+ checks.push({
137
+ name: `CONTEXT.md contains ${heading}`,
138
+ passed: false,
139
+ message: 'Cannot check - CONTEXT.md missing',
140
+ });
141
+ }
142
+
143
+ checks.push({
144
+ name: 'Root routing references all numbered stages',
145
+ passed: false,
146
+ message: 'Cannot check - CONTEXT.md missing',
147
+ });
148
+ checks.push({
149
+ name: 'Root loading order enforces selective loading',
150
+ passed: false,
151
+ message: 'Cannot check - CONTEXT.md missing',
152
+ });
153
+ }
154
+
155
+ const executionLogPath = path.join(ws, '00-meta', 'execution-log.md');
156
+ const executionLogExists = fs.existsSync(executionLogPath);
157
+ checks.push({
158
+ name: '00-meta/execution-log.md exists',
159
+ passed: executionLogExists,
160
+ message: executionLogExists ? 'Found' : 'Missing',
161
+ });
162
+
163
+ if (executionLogExists) {
164
+ const executionLogContent = fs.readFileSync(executionLogPath, 'utf-8');
165
+ const hasStageChecklistHeading = /## Stage Checklist/i.test(executionLogContent);
166
+ checks.push({
167
+ name: 'Execution log contains stage checklist heading',
168
+ passed: hasStageChecklistHeading,
169
+ message: hasStageChecklistHeading ? 'Found' : 'Missing "## Stage Checklist" heading',
170
+ });
171
+
172
+ const hasAllStageChecklistEntries = numberedFolders.every((folder) => {
173
+ const pattern = new RegExp(`^\\s*-\\s*\\[[ xX]\\]\\s+${escapeRegExp(folder)}\\s*$`, 'm');
174
+ return pattern.test(executionLogContent);
175
+ });
176
+ checks.push({
177
+ name: 'Execution log references all numbered stages',
178
+ passed: hasAllStageChecklistEntries,
179
+ message: hasAllStageChecklistEntries
180
+ ? 'All numbered stages are present in checklist'
181
+ : 'Missing one or more numbered stage checklist entries',
182
+ });
183
+
184
+ const sequentialOrderValid = hasAllStageChecklistEntries
185
+ ? isExecutionChecklistSequential(executionLogContent, numberedFolders)
186
+ : false;
187
+ checks.push({
188
+ name: 'Execution log stage completion order is sequential',
189
+ passed: sequentialOrderValid,
190
+ message: sequentialOrderValid
191
+ ? 'Stage completion order is sequential'
192
+ : 'Found later stage marked complete before earlier stage',
193
+ });
194
+ } else {
195
+ checks.push({
196
+ name: 'Execution log contains stage checklist heading',
197
+ passed: false,
198
+ message: 'Cannot check - execution log missing',
199
+ });
200
+ checks.push({
201
+ name: 'Execution log references all numbered stages',
202
+ passed: false,
203
+ message: 'Cannot check - execution log missing',
204
+ });
205
+ checks.push({
206
+ name: 'Execution log stage completion order is sequential',
207
+ passed: false,
208
+ message: 'Cannot check - execution log missing',
209
+ });
210
+ }
211
+
212
+ for (const folder of numberedFolders) {
213
+ const contextPath = path.join(ws, folder, 'CONTEXT.md');
214
+ const exists = fs.existsSync(contextPath);
215
+ checks.push({
216
+ name: `${folder}/CONTEXT.md exists`,
217
+ passed: exists,
218
+ message: exists ? 'Found' : 'Missing',
219
+ });
220
+
221
+ if (exists) {
222
+ const content = fs.readFileSync(contextPath, 'utf-8');
223
+ const notEmpty = content.trim().length > 0;
224
+ checks.push({
225
+ name: `${folder}/CONTEXT.md is not empty`,
226
+ passed: notEmpty,
227
+ message: notEmpty ? `${content.trim().length} chars` : 'File is empty',
228
+ });
229
+
230
+ addRequiredHeadingChecks(`${folder}/CONTEXT.md`, content, REQUIRED_STAGE_CONTEXT_HEADINGS, checks);
231
+
232
+ const deps = extractStageRefs(extractDependenciesSection(content));
233
+ const currentNum = parseInt(folder.slice(0, 2), 10);
234
+ const pointsToLaterStage = deps.some((dep) => parseInt(dep.slice(0, 2), 10) > currentNum);
235
+
236
+ checks.push({
237
+ name: `${folder} dependencies do not point to later stages`,
238
+ passed: !pointsToLaterStage,
239
+ message: !pointsToLaterStage ? 'Dependency direction valid' : 'Found dependency on later-numbered stage',
240
+ });
241
+ } else {
242
+ for (const heading of REQUIRED_STAGE_CONTEXT_HEADINGS) {
243
+ checks.push({
244
+ name: `${folder}/CONTEXT.md contains ${heading}`,
245
+ passed: false,
246
+ message: 'Cannot check - CONTEXT.md missing',
247
+ });
248
+ }
249
+
250
+ checks.push({
251
+ name: `${folder} dependencies do not point to later stages`,
252
+ passed: false,
253
+ message: 'Cannot check - CONTEXT.md missing',
254
+ });
255
+ }
256
+
257
+ const disallowedFiles = findDisallowedStageSourceFiles(path.join(ws, folder));
258
+ checks.push({
259
+ name: `${folder} contains no product source code files`,
260
+ passed: disallowedFiles.length === 0,
261
+ message: disallowedFiles.length === 0
262
+ ? 'Only workflow documentation artifacts found'
263
+ : `Found source files: ${disallowedFiles.join(', ')}`,
264
+ });
265
+ }
266
+
267
+ const allFiles = getAllMarkdownFiles(ws);
268
+ const duplicateCheck = checkDuplicateContent(allFiles);
269
+ checks.push(duplicateCheck);
270
+
271
+ const passed = checks.every((c) => c.passed);
272
+
273
+ console.log(`\nValidation: ${ws}`);
274
+ console.log('='.repeat(50));
275
+ for (const check of checks) {
276
+ const icon = check.passed ? '✓' : '✗';
277
+ console.log(` ${icon} ${check.name}: ${check.message}`);
278
+ }
279
+ console.log('='.repeat(50));
280
+ console.log(passed ? '✓ All checks passed' : '✗ Some checks failed');
281
+
282
+ return { passed, checks };
283
+ }
284
+
285
+ function getAllMarkdownFiles(dir: string): string[] {
286
+ const results: string[] = [];
287
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
288
+
289
+ for (const entry of entries) {
290
+ const fullPath = path.join(dir, entry.name);
291
+ if (entry.isDirectory()) {
292
+ results.push(...getAllMarkdownFiles(fullPath));
293
+ } else if (entry.name.endsWith('.md')) {
294
+ results.push(fullPath);
295
+ }
296
+ }
297
+
298
+ return results;
299
+ }
300
+
301
+ function escapeRegExp(value: string): string {
302
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
303
+ }
304
+
305
+ function hasHeading(content: string, heading: string): boolean {
306
+ return new RegExp(`^${escapeRegExp(heading)}\\s*$`, 'im').test(content);
307
+ }
308
+
309
+ function addRequiredHeadingChecks(
310
+ fileLabel: string,
311
+ content: string,
312
+ headings: string[],
313
+ checks: CheckResult[],
314
+ ): void {
315
+ for (const heading of headings) {
316
+ const found = hasHeading(content, heading);
317
+ checks.push({
318
+ name: `${fileLabel} contains ${heading}`,
319
+ passed: found,
320
+ message: found ? 'Found' : `Missing ${heading}`,
321
+ });
322
+ }
323
+ }
324
+
325
+ function checkDuplicateContent(files: string[]): CheckResult {
326
+ const MIN_DUPLICATE_LENGTH = 50;
327
+ const duplicates: string[] = [];
328
+
329
+ for (let i = 0; i < files.length; i++) {
330
+ for (let j = i + 1; j < files.length; j++) {
331
+ const contentA = fs.readFileSync(files[i], 'utf-8');
332
+ const contentB = fs.readFileSync(files[j], 'utf-8');
333
+
334
+ const linesA = contentA.split('\n');
335
+ const linesB = contentB.split('\n');
336
+
337
+ for (const lineA of linesA) {
338
+ const trimmed = lineA.trim();
339
+ if (trimmed.length > MIN_DUPLICATE_LENGTH) {
340
+ for (const lineB of linesB) {
341
+ if (lineB.trim() === trimmed) {
342
+ duplicates.push(trimmed.substring(0, 60) + '...');
343
+ break;
344
+ }
345
+ }
346
+ }
347
+ }
348
+ }
349
+ }
350
+
351
+ if (duplicates.length > 0) {
352
+ return {
353
+ name: 'No duplicate content across files',
354
+ passed: false,
355
+ message: `Found ${duplicates.length} duplicate text block(s)`,
356
+ };
357
+ }
358
+
359
+ return {
360
+ name: 'No duplicate content across files',
361
+ passed: true,
362
+ message: 'No duplicates found',
363
+ };
364
+ }
365
+
366
+ function getNumberedStageFolders(workspacePath: string): string[] {
367
+ const entries = fs.readdirSync(workspacePath, { withFileTypes: true });
368
+ return entries
369
+ .filter((entry) => entry.isDirectory() && /^\d{2}-/.test(entry.name) && entry.name !== '00-meta')
370
+ .map((entry) => entry.name);
371
+ }
372
+
373
+ function extractDependenciesSection(content: string): string {
374
+ const match = content.match(/## Dependencies\s*([\s\S]*?)(?=\n##\s|$)/i);
375
+ return match ? match[1] : '';
376
+ }
377
+
378
+ function extractStageRefs(content: string): string[] {
379
+ const refs = new Set<string>();
380
+ const regex = /(\d{2}-[A-Za-z0-9-_]+)/g;
381
+ let match: RegExpExecArray | null;
382
+
383
+ while ((match = regex.exec(content)) !== null) {
384
+ refs.add(match[1]);
385
+ }
386
+
387
+ return Array.from(refs);
388
+ }
389
+
390
+ function isExecutionChecklistSequential(content: string, stages: string[]): boolean {
391
+ let foundUncheckedStage = false;
392
+
393
+ for (const stage of stages) {
394
+ const pattern = new RegExp(`^\\s*-\\s*\\[([ xX])\\]\\s+${escapeRegExp(stage)}\\s*$`, 'm');
395
+ const match = content.match(pattern);
396
+ if (!match) {
397
+ return false;
398
+ }
399
+
400
+ const isChecked = match[1].toLowerCase() === 'x';
401
+ if (!isChecked) {
402
+ foundUncheckedStage = true;
403
+ continue;
404
+ }
405
+
406
+ if (foundUncheckedStage) {
407
+ return false;
408
+ }
409
+ }
410
+
411
+ return true;
412
+ }
413
+
414
+ function findDisallowedStageSourceFiles(stageDir: string): string[] {
415
+ const disallowed: string[] = [];
416
+
417
+ const walk = (currentDir: string): void => {
418
+ const entries = fs.readdirSync(currentDir, { withFileTypes: true });
419
+
420
+ for (const entry of entries) {
421
+ const fullPath = path.join(currentDir, entry.name);
422
+
423
+ if (entry.isDirectory()) {
424
+ walk(fullPath);
425
+ continue;
426
+ }
427
+
428
+ const ext = path.extname(entry.name).toLowerCase();
429
+ if (DISALLOWED_STAGE_SOURCE_EXTENSIONS.has(ext)) {
430
+ disallowed.push(path.relative(stageDir, fullPath).replace(/\\/g, '/'));
431
+ }
432
+ }
433
+ };
434
+
435
+ walk(stageDir);
436
+
437
+ return disallowed;
438
+ }
439
+
440
+ if (require.main === module) {
441
+ const args = process.argv.slice(2);
442
+ const workspaceIdx = args.indexOf('--workspace');
443
+ const workspace = workspaceIdx !== -1 ? args[workspaceIdx + 1] : undefined;
444
+
445
+ if (!workspace) {
446
+ console.error('Usage: node validate.ts --workspace <path>');
447
+ process.exit(1);
448
+ }
449
+
450
+ const result = validateWorkspace(workspace);
451
+ process.exit(result.passed ? 0 : 1);
452
+ }
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # workspace-maxxing
2
+
3
+ An installable skill package for AI coding agents that scaffolds, validates, and iterates on ICM-style workspaces with explicit workflow routing.
4
+
5
+ ## Why This Exists
6
+
7
+ Most agent workspaces drift over time because prompts are underspecified and context loading is inconsistent. `workspace-maxxing` provides a repeatable workflow that generates structured `SYSTEM.md` and `CONTEXT.md` contracts, validates them, and improves them through autonomous iteration.
8
+
9
+ ## Features
10
+
11
+ - Multi-agent install targets: OpenCode, Claude Code, GitHub Copilot, Gemini CLI
12
+ - ICM workspace scaffolding with robust root and per-stage context contracts
13
+ - Workflow-aware validation (routing coverage, stage dependency direction, selective loading)
14
+ - Batched autonomous iteration via orchestrator + worker/fixer loops
15
+ - Built-in test-case generation and weighted benchmarking
16
+
17
+ ## Requirements
18
+
19
+ - Node.js 18+
20
+ - `npx` available in your shell
21
+
22
+ ## Install
23
+
24
+ ```bash
25
+ # OpenCode (default target)
26
+ npx workspace-maxxing --opencode
27
+
28
+ # Claude Code
29
+ npx workspace-maxxing --claude
30
+
31
+ # GitHub Copilot
32
+ npx workspace-maxxing --copilot
33
+
34
+ # Gemini CLI
35
+ npx workspace-maxxing --gemini
36
+ ```
37
+
38
+ ### Install Targets
39
+
40
+ | Target | Flag | Install Path |
41
+ |---|---|---|
42
+ | OpenCode | `--opencode` | `.agents/skills/workspace-maxxing/` |
43
+ | Claude Code | `--claude` | `.claude/skills/` |
44
+ | GitHub Copilot | `--copilot` | `.github/copilot-instructions/` |
45
+ | Gemini CLI | `--gemini` | `.gemini/skills/` |
46
+
47
+ ## Quick Start
48
+
49
+ 1. Install to your preferred target with `npx workspace-maxxing --<target>`.
50
+ 2. Open a new agent session.
51
+ 3. Invoke the `workspace-maxxing` skill.
52
+ 4. Approve the proposed workflow structure.
53
+ 5. Let the agent scaffold, validate, and iterate until quality gates pass.
54
+
55
+ ## What Gets Installed
56
+
57
+ - `SKILL.md` (entry behavior and phase logic)
58
+ - `.workspace-templates/` (SYSTEM/CONTEXT templates and scripts)
59
+ - `scripts/` (scaffold, validate, dispatch, orchestrator, benchmark, etc.)
60
+
61
+ ## Workflow Model
62
+
63
+ The skill follows a phased flow:
64
+
65
+ 1. Research
66
+ 2. Architecture
67
+ 3. Build (scaffold workspace)
68
+ 4. Validate
69
+ 5. Autonomous iteration (batched worker/fixer loops)
70
+ 6. Deliver
71
+
72
+ This is designed to keep prompt structure, execution order, and handoffs explicit.
73
+
74
+ ## Sub-Agent Runner Contract
75
+
76
+ Worker/fixer execution is external-runner-driven in strict mode. Configure orchestrator with `--subagent-runner` (or `WORKSPACE_MAXXING_SUBAGENT_RUNNER`) using placeholders:
77
+
78
+ ```bash
79
+ node scripts/orchestrator.ts --workspace ./workspace --subagent-runner "<runner-command> {skill} {workspace} {batchId} {testCaseId}"
80
+ ```
81
+
82
+ Contract details:
83
+
84
+ - `worker/fixer` require an external runner command.
85
+ - Runner output must be JSON containing: `skill`, `status`, `timestamp`, `findings`, `recommendations`, `metrics`, `nextSkill`.
86
+ - Missing/invalid payloads are treated as failures (no simulated completion).
87
+ - Telemetry is written under `.agents/iteration/runs/` for troubleshooting.
88
+
89
+ ## Included Script Surface
90
+
91
+ Run these from the installed skill directory (for example, `.agents/skills/workspace-maxxing/` in OpenCode).
92
+
93
+ | Script | Purpose | Example |
94
+ |---|---|---|
95
+ | `scaffold.ts` | Create an ICM workspace from a stage plan | `node scripts/scaffold.ts --name "my-flow" --stages "01-input,02-process,03-output" --output ./workspace` |
96
+ | `validate.ts` | Validate workspace structure and routing rules | `node scripts/validate.ts --workspace ./workspace` |
97
+ | `generate-tests.ts` | Generate stage-based test cases | `node scripts/generate-tests.ts --workspace ./workspace --output ./tests.json` |
98
+ | `dispatch.ts` | Dispatch sub-skills (single or parallel) | `node scripts/dispatch.ts --skill research --workspace ./workspace` |
99
+ | `orchestrator.ts` | Run batched autonomous iteration | `node scripts/orchestrator.ts --workspace ./workspace --batch-size 3 --score-threshold 85 --subagent-runner "<runner>"` |
100
+ | `benchmark.ts` | Compute weighted benchmark score | `node scripts/benchmark.ts --workspace ./workspace` |
101
+ | `install-tool.ts` | Install a tool and update inventory | `node scripts/install-tool.ts --tool "pdf-lib" --manager npm --workspace ./workspace` |
102
+ | `iterate.ts` | Legacy single-loop iteration path | `node scripts/iterate.ts --workspace ./workspace --max-retries 3` |
103
+
104
+ ## ICM Layers
105
+
106
+ Based on the Interpretable Context Methodology (ICM):
107
+
108
+ - Layer 0: `SYSTEM.md` (global rules)
109
+ - Layer 1: root `CONTEXT.md` (routing)
110
+ - Layer 2: stage `CONTEXT.md` files (contracts)
111
+ - Layer 3: selective task artifacts
112
+
113
+ Reference: [Interpretable Context Methodology paper](https://arxiv.org/abs/2603.16021)
114
+
115
+ ## Local Development
116
+
117
+ ```bash
118
+ npm install
119
+ npm run build
120
+ npm test
121
+ ```
122
+
123
+ ## Project Layout
124
+
125
+ ```text
126
+ src/
127
+ index.ts
128
+ install.ts
129
+ scripts/
130
+ templates/
131
+ SKILL.md
132
+ tests/
133
+ ```
134
+
135
+ ## Contributing
136
+
137
+ 1. Fork and create a feature branch.
138
+ 2. Add or update tests for behavior changes.
139
+ 3. Run `npm run build` and `npm test`.
140
+ 4. Open a PR with context on workflow impact.
141
+
142
+ ## License
143
+
144
+ MIT
@@ -0,0 +1,9 @@
1
+ export interface AgentOptions {
2
+ name: string;
3
+ purpose: string;
4
+ workspacePath: string;
5
+ platforms?: string[];
6
+ }
7
+ export declare function generateAgentName(purpose: string): string;
8
+ export declare function createAgent(options: AgentOptions): void;
9
+ //# sourceMappingURL=agent-creator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-creator.d.ts","sourceRoot":"","sources":["../src/agent-creator.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUzD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAoCvD"}