@archmax-ai/harness 0.0.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 (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +219 -0
  3. package/dist/agent.d.ts +174 -0
  4. package/dist/agent.js +140 -0
  5. package/dist/agent.js.map +1 -0
  6. package/dist/assembly/compose.d.ts +170 -0
  7. package/dist/assembly/compose.js +391 -0
  8. package/dist/assembly/compose.js.map +1 -0
  9. package/dist/assembly/delegation-registry.d.ts +5 -0
  10. package/dist/assembly/delegation-registry.js +118 -0
  11. package/dist/assembly/delegation-registry.js.map +1 -0
  12. package/dist/assembly/index.d.ts +192 -0
  13. package/dist/assembly/index.js +265 -0
  14. package/dist/assembly/index.js.map +1 -0
  15. package/dist/assembly/plain.d.ts +7 -0
  16. package/dist/assembly/plain.js +41 -0
  17. package/dist/assembly/plain.js.map +1 -0
  18. package/dist/authoring-skill/archmax-harness/README.md +76 -0
  19. package/dist/authoring-skill/archmax-harness/SKILL.md +241 -0
  20. package/dist/authoring-skill/archmax-harness/references/backend-integration.md +626 -0
  21. package/dist/authoring-skill/archmax-harness/references/cases.md +41 -0
  22. package/dist/authoring-skill/archmax-harness/references/diagnostics.md +51 -0
  23. package/dist/authoring-skill/archmax-harness/references/hook-and-test-scripts.md +1070 -0
  24. package/dist/authoring-skill/archmax-harness/references/hooks-and-scripts.md +82 -0
  25. package/dist/authoring-skill/archmax-harness/references/wiring.md +101 -0
  26. package/dist/authoring-skill/archmax-harness/references/workflow-schema.md +1631 -0
  27. package/dist/authoring-skill/archmax-harness/references/workflow-yaml.md +241 -0
  28. package/dist/behaviour/support.d.ts +232 -0
  29. package/dist/behaviour/support.js +339 -0
  30. package/dist/behaviour/support.js.map +1 -0
  31. package/dist/cli/banner.d.ts +11 -0
  32. package/dist/cli/banner.js +29 -0
  33. package/dist/cli/banner.js.map +1 -0
  34. package/dist/cli/bootstrap.d.ts +33 -0
  35. package/dist/cli/bootstrap.js +153 -0
  36. package/dist/cli/bootstrap.js.map +1 -0
  37. package/dist/cli/command.d.ts +39 -0
  38. package/dist/cli/command.js +97 -0
  39. package/dist/cli/command.js.map +1 -0
  40. package/dist/cli/state-flow.d.ts +46 -0
  41. package/dist/cli/state-flow.js +268 -0
  42. package/dist/cli/state-flow.js.map +1 -0
  43. package/dist/cli/style.d.ts +41 -0
  44. package/dist/cli/style.js +64 -0
  45. package/dist/cli/style.js.map +1 -0
  46. package/dist/cli/turn.d.ts +41 -0
  47. package/dist/cli/turn.js +161 -0
  48. package/dist/cli/turn.js.map +1 -0
  49. package/dist/cli.d.ts +10 -0
  50. package/dist/cli.js +426 -0
  51. package/dist/cli.js.map +1 -0
  52. package/dist/core/code-description.d.ts +22 -0
  53. package/dist/core/code-description.js +38 -0
  54. package/dist/core/code-description.js.map +1 -0
  55. package/dist/core/deepagents.d.ts +183 -0
  56. package/dist/core/deepagents.js +128 -0
  57. package/dist/core/deepagents.js.map +1 -0
  58. package/dist/core/events.d.ts +350 -0
  59. package/dist/core/events.js +205 -0
  60. package/dist/core/events.js.map +1 -0
  61. package/dist/core/frontmatter.d.ts +15 -0
  62. package/dist/core/frontmatter.js +32 -0
  63. package/dist/core/frontmatter.js.map +1 -0
  64. package/dist/core/listing-redact.d.ts +37 -0
  65. package/dist/core/listing-redact.js +88 -0
  66. package/dist/core/listing-redact.js.map +1 -0
  67. package/dist/core/match.d.ts +26 -0
  68. package/dist/core/match.js +75 -0
  69. package/dist/core/match.js.map +1 -0
  70. package/dist/core/message-readers.d.ts +84 -0
  71. package/dist/core/message-readers.js +159 -0
  72. package/dist/core/message-readers.js.map +1 -0
  73. package/dist/core/messages.d.ts +49 -0
  74. package/dist/core/messages.js +85 -0
  75. package/dist/core/messages.js.map +1 -0
  76. package/dist/core/mount-prompt.d.ts +28 -0
  77. package/dist/core/mount-prompt.js +55 -0
  78. package/dist/core/mount-prompt.js.map +1 -0
  79. package/dist/core/mount-redact.d.ts +28 -0
  80. package/dist/core/mount-redact.js +32 -0
  81. package/dist/core/mount-redact.js.map +1 -0
  82. package/dist/core/mounts.d.ts +88 -0
  83. package/dist/core/mounts.js +147 -0
  84. package/dist/core/mounts.js.map +1 -0
  85. package/dist/core/path-mapping.d.ts +52 -0
  86. package/dist/core/path-mapping.js +113 -0
  87. package/dist/core/path-mapping.js.map +1 -0
  88. package/dist/core/platform-prompt.generated.d.ts +2 -0
  89. package/dist/core/platform-prompt.generated.js +4 -0
  90. package/dist/core/platform-prompt.generated.js.map +1 -0
  91. package/dist/core/prompt.d.ts +42 -0
  92. package/dist/core/prompt.js +75 -0
  93. package/dist/core/prompt.js.map +1 -0
  94. package/dist/core/session-id.d.ts +38 -0
  95. package/dist/core/session-id.js +61 -0
  96. package/dist/core/session-id.js.map +1 -0
  97. package/dist/core/session-store.d.ts +85 -0
  98. package/dist/core/session-store.js +149 -0
  99. package/dist/core/session-store.js.map +1 -0
  100. package/dist/core/session-zone.d.ts +54 -0
  101. package/dist/core/session-zone.js +82 -0
  102. package/dist/core/session-zone.js.map +1 -0
  103. package/dist/core/skill-prompt.d.ts +31 -0
  104. package/dist/core/skill-prompt.js +54 -0
  105. package/dist/core/skill-prompt.js.map +1 -0
  106. package/dist/core/skill-redact.d.ts +15 -0
  107. package/dist/core/skill-redact.js +27 -0
  108. package/dist/core/skill-redact.js.map +1 -0
  109. package/dist/core/skills.d.ts +172 -0
  110. package/dist/core/skills.js +214 -0
  111. package/dist/core/skills.js.map +1 -0
  112. package/dist/core/tool-mocks.d.ts +23 -0
  113. package/dist/core/tool-mocks.js +39 -0
  114. package/dist/core/tool-mocks.js.map +1 -0
  115. package/dist/core/tool-telemetry.d.ts +16 -0
  116. package/dist/core/tool-telemetry.js +40 -0
  117. package/dist/core/tool-telemetry.js.map +1 -0
  118. package/dist/core/usage.d.ts +114 -0
  119. package/dist/core/usage.js +226 -0
  120. package/dist/core/usage.js.map +1 -0
  121. package/dist/core/workspace-context.d.ts +136 -0
  122. package/dist/core/workspace-context.js +178 -0
  123. package/dist/core/workspace-context.js.map +1 -0
  124. package/dist/core/workspace-prompt.d.ts +7 -0
  125. package/dist/core/workspace-prompt.js +102 -0
  126. package/dist/core/workspace-prompt.js.map +1 -0
  127. package/dist/core/workspace-router.d.ts +61 -0
  128. package/dist/core/workspace-router.js +145 -0
  129. package/dist/core/workspace-router.js.map +1 -0
  130. package/dist/core/workspace.d.ts +85 -0
  131. package/dist/core/workspace.js +193 -0
  132. package/dist/core/workspace.js.map +1 -0
  133. package/dist/core/zones.d.ts +181 -0
  134. package/dist/core/zones.js +202 -0
  135. package/dist/core/zones.js.map +1 -0
  136. package/dist/env.d.ts +99 -0
  137. package/dist/env.js +271 -0
  138. package/dist/env.js.map +1 -0
  139. package/dist/index.d.ts +265 -0
  140. package/dist/index.js +197 -0
  141. package/dist/index.js.map +1 -0
  142. package/dist/kernel/kernel.d.ts +192 -0
  143. package/dist/kernel/kernel.js +751 -0
  144. package/dist/kernel/kernel.js.map +1 -0
  145. package/dist/lifecycle/hook-shape.d.ts +44 -0
  146. package/dist/lifecycle/hook-shape.js +66 -0
  147. package/dist/lifecycle/hook-shape.js.map +1 -0
  148. package/dist/lifecycle/runner.d.ts +177 -0
  149. package/dist/lifecycle/runner.js +372 -0
  150. package/dist/lifecycle/runner.js.map +1 -0
  151. package/dist/lifecycle/transcript.d.ts +27 -0
  152. package/dist/lifecycle/transcript.js +43 -0
  153. package/dist/lifecycle/transcript.js.map +1 -0
  154. package/dist/machine/allow.d.ts +65 -0
  155. package/dist/machine/allow.js +107 -0
  156. package/dist/machine/allow.js.map +1 -0
  157. package/dist/machine/delegation.d.ts +9 -0
  158. package/dist/machine/delegation.js +10 -0
  159. package/dist/machine/delegation.js.map +1 -0
  160. package/dist/machine/diagnostic.d.ts +14 -0
  161. package/dist/machine/diagnostic.js +2 -0
  162. package/dist/machine/diagnostic.js.map +1 -0
  163. package/dist/machine/lint-spec.d.ts +4 -0
  164. package/dist/machine/lint-spec.js +266 -0
  165. package/dist/machine/lint-spec.js.map +1 -0
  166. package/dist/machine/load-spec.d.ts +90 -0
  167. package/dist/machine/load-spec.js +120 -0
  168. package/dist/machine/load-spec.js.map +1 -0
  169. package/dist/machine/machine.d.ts +273 -0
  170. package/dist/machine/machine.js +551 -0
  171. package/dist/machine/machine.js.map +1 -0
  172. package/dist/machine/mount-grants.d.ts +25 -0
  173. package/dist/machine/mount-grants.js +24 -0
  174. package/dist/machine/mount-grants.js.map +1 -0
  175. package/dist/machine/slug.d.ts +14 -0
  176. package/dist/machine/slug.js +17 -0
  177. package/dist/machine/slug.js.map +1 -0
  178. package/dist/machine/spec-schema.d.ts +662 -0
  179. package/dist/machine/spec-schema.js +717 -0
  180. package/dist/machine/spec-schema.js.map +1 -0
  181. package/dist/machine/tool-names.d.ts +98 -0
  182. package/dist/machine/tool-names.js +144 -0
  183. package/dist/machine/tool-names.js.map +1 -0
  184. package/dist/machine/triggers.d.ts +114 -0
  185. package/dist/machine/triggers.js +165 -0
  186. package/dist/machine/triggers.js.map +1 -0
  187. package/dist/machine/types.d.ts +186 -0
  188. package/dist/machine/types.js +12 -0
  189. package/dist/machine/types.js.map +1 -0
  190. package/dist/machine/validate-spec.d.ts +42 -0
  191. package/dist/machine/validate-spec.js +29 -0
  192. package/dist/machine/validate-spec.js.map +1 -0
  193. package/dist/machine/variables.d.ts +196 -0
  194. package/dist/machine/variables.js +415 -0
  195. package/dist/machine/variables.js.map +1 -0
  196. package/dist/public/cli.d.ts +15 -0
  197. package/dist/public/cli.js +14 -0
  198. package/dist/public/cli.js.map +1 -0
  199. package/dist/public/messages.d.ts +33 -0
  200. package/dist/public/messages.js +33 -0
  201. package/dist/public/messages.js.map +1 -0
  202. package/dist/public/sandbox.d.ts +99 -0
  203. package/dist/public/sandbox.js +32 -0
  204. package/dist/public/sandbox.js.map +1 -0
  205. package/dist/public/spec.d.ts +147 -0
  206. package/dist/public/spec.js +149 -0
  207. package/dist/public/spec.js.map +1 -0
  208. package/dist/public/testing.d.ts +71 -0
  209. package/dist/public/testing.js +39 -0
  210. package/dist/public/testing.js.map +1 -0
  211. package/dist/rubrics/rubrics.d.ts +135 -0
  212. package/dist/rubrics/rubrics.js +145 -0
  213. package/dist/rubrics/rubrics.js.map +1 -0
  214. package/dist/runtime/contract.d.ts +73 -0
  215. package/dist/runtime/contract.js +96 -0
  216. package/dist/runtime/contract.js.map +1 -0
  217. package/dist/sandbox/assets/parts/core.js +22 -0
  218. package/dist/sandbox/assets/parts/lifecycle-hook.js +47 -0
  219. package/dist/sandbox/bridge.d.ts +16 -0
  220. package/dist/sandbox/bridge.js +95 -0
  221. package/dist/sandbox/bridge.js.map +1 -0
  222. package/dist/sandbox/executor.d.ts +46 -0
  223. package/dist/sandbox/executor.js +119 -0
  224. package/dist/sandbox/executor.js.map +1 -0
  225. package/dist/sandbox/imports.d.ts +33 -0
  226. package/dist/sandbox/imports.js +67 -0
  227. package/dist/sandbox/imports.js.map +1 -0
  228. package/dist/sandbox/prelude.d.ts +12 -0
  229. package/dist/sandbox/prelude.js +51 -0
  230. package/dist/sandbox/prelude.js.map +1 -0
  231. package/dist/sandbox/ptc-gateway.d.ts +104 -0
  232. package/dist/sandbox/ptc-gateway.js +167 -0
  233. package/dist/sandbox/ptc-gateway.js.map +1 -0
  234. package/dist/sandbox/runtime.d.ts +59 -0
  235. package/dist/sandbox/runtime.js +51 -0
  236. package/dist/sandbox/runtime.js.map +1 -0
  237. package/dist/sandbox/tools.d.ts +34 -0
  238. package/dist/sandbox/tools.js +147 -0
  239. package/dist/sandbox/tools.js.map +1 -0
  240. package/dist/sessions/operations.d.ts +79 -0
  241. package/dist/sessions/operations.js +121 -0
  242. package/dist/sessions/operations.js.map +1 -0
  243. package/dist/sessions/resolve.d.ts +97 -0
  244. package/dist/sessions/resolve.js +145 -0
  245. package/dist/sessions/resolve.js.map +1 -0
  246. package/dist/sessions/resume.d.ts +242 -0
  247. package/dist/sessions/resume.js +288 -0
  248. package/dist/sessions/resume.js.map +1 -0
  249. package/dist/sessions/scope.d.ts +99 -0
  250. package/dist/sessions/scope.js +145 -0
  251. package/dist/sessions/scope.js.map +1 -0
  252. package/dist/sessions/summary.d.ts +65 -0
  253. package/dist/sessions/summary.js +56 -0
  254. package/dist/sessions/summary.js.map +1 -0
  255. package/dist/testing/assertions.d.ts +30 -0
  256. package/dist/testing/assertions.js +231 -0
  257. package/dist/testing/assertions.js.map +1 -0
  258. package/dist/testing/case-document.d.ts +141 -0
  259. package/dist/testing/case-document.js +51 -0
  260. package/dist/testing/case-document.js.map +1 -0
  261. package/dist/testing/case-schema.d.ts +29 -0
  262. package/dist/testing/case-schema.js +519 -0
  263. package/dist/testing/case-schema.js.map +1 -0
  264. package/dist/testing/discovery.d.ts +10 -0
  265. package/dist/testing/discovery.js +24 -0
  266. package/dist/testing/discovery.js.map +1 -0
  267. package/dist/testing/driver.d.ts +78 -0
  268. package/dist/testing/driver.js +117 -0
  269. package/dist/testing/driver.js.map +1 -0
  270. package/dist/testing/grade.d.ts +116 -0
  271. package/dist/testing/grade.js +261 -0
  272. package/dist/testing/grade.js.map +1 -0
  273. package/dist/testing/interpreter.d.ts +55 -0
  274. package/dist/testing/interpreter.js +103 -0
  275. package/dist/testing/interpreter.js.map +1 -0
  276. package/dist/testing/mock-middleware.d.ts +5 -0
  277. package/dist/testing/mock-middleware.js +33 -0
  278. package/dist/testing/mock-middleware.js.map +1 -0
  279. package/dist/testing/runner.d.ts +205 -0
  280. package/dist/testing/runner.js +266 -0
  281. package/dist/testing/runner.js.map +1 -0
  282. package/dist/testing/target.d.ts +27 -0
  283. package/dist/testing/target.js +21 -0
  284. package/dist/testing/target.js.map +1 -0
  285. package/dist/validate/validate.d.ts +41 -0
  286. package/dist/validate/validate.js +669 -0
  287. package/dist/validate/validate.js.map +1 -0
  288. package/dist/workflow/agent-tools.d.ts +10 -0
  289. package/dist/workflow/agent-tools.js +10 -0
  290. package/dist/workflow/agent-tools.js.map +1 -0
  291. package/dist/workflow/checkpointer.d.ts +52 -0
  292. package/dist/workflow/checkpointer.js +200 -0
  293. package/dist/workflow/checkpointer.js.map +1 -0
  294. package/dist/workflow/control-tools.d.ts +174 -0
  295. package/dist/workflow/control-tools.js +468 -0
  296. package/dist/workflow/control-tools.js.map +1 -0
  297. package/dist/workflow/governance.d.ts +104 -0
  298. package/dist/workflow/governance.js +546 -0
  299. package/dist/workflow/governance.js.map +1 -0
  300. package/dist/workflow/middleware.d.ts +85 -0
  301. package/dist/workflow/middleware.js +283 -0
  302. package/dist/workflow/middleware.js.map +1 -0
  303. package/dist/workflow/on-error.d.ts +25 -0
  304. package/dist/workflow/on-error.js +58 -0
  305. package/dist/workflow/on-error.js.map +1 -0
  306. package/dist/workflow/parks.d.ts +46 -0
  307. package/dist/workflow/parks.js +513 -0
  308. package/dist/workflow/parks.js.map +1 -0
  309. package/dist/workflow/paths.d.ts +67 -0
  310. package/dist/workflow/paths.js +108 -0
  311. package/dist/workflow/paths.js.map +1 -0
  312. package/dist/workflow/prompt-cache.d.ts +70 -0
  313. package/dist/workflow/prompt-cache.js +103 -0
  314. package/dist/workflow/prompt-cache.js.map +1 -0
  315. package/dist/workflow/prompt-pruning.d.ts +20 -0
  316. package/dist/workflow/prompt-pruning.js +83 -0
  317. package/dist/workflow/prompt-pruning.js.map +1 -0
  318. package/dist/workflow/render-prompt.d.ts +45 -0
  319. package/dist/workflow/render-prompt.js +140 -0
  320. package/dist/workflow/render-prompt.js.map +1 -0
  321. package/dist/workflow/runtime-config.d.ts +7 -0
  322. package/dist/workflow/runtime-config.js +9 -0
  323. package/dist/workflow/runtime-config.js.map +1 -0
  324. package/dist/workflow/session-artifacts.d.ts +90 -0
  325. package/dist/workflow/session-artifacts.js +134 -0
  326. package/dist/workflow/session-artifacts.js.map +1 -0
  327. package/dist/workflow/session-view.d.ts +31 -0
  328. package/dist/workflow/session-view.js +94 -0
  329. package/dist/workflow/session-view.js.map +1 -0
  330. package/dist/workflow/snapshot.d.ts +14 -0
  331. package/dist/workflow/snapshot.js +97 -0
  332. package/dist/workflow/snapshot.js.map +1 -0
  333. package/dist/workflow/state.d.ts +347 -0
  334. package/dist/workflow/state.js +322 -0
  335. package/dist/workflow/state.js.map +1 -0
  336. package/dist/workflow/sub-workflow.d.ts +174 -0
  337. package/dist/workflow/sub-workflow.js +392 -0
  338. package/dist/workflow/sub-workflow.js.map +1 -0
  339. package/dist/workflow/tool-service.d.ts +48 -0
  340. package/dist/workflow/tool-service.js +291 -0
  341. package/dist/workflow/tool-service.js.map +1 -0
  342. package/dist/workflow/turn-boundary.d.ts +39 -0
  343. package/dist/workflow/turn-boundary.js +128 -0
  344. package/dist/workflow/turn-boundary.js.map +1 -0
  345. package/dist/workflow/turn-runner.d.ts +40 -0
  346. package/dist/workflow/turn-runner.js +122 -0
  347. package/dist/workflow/turn-runner.js.map +1 -0
  348. package/dist/workflow/workflow-tools.d.ts +46 -0
  349. package/dist/workflow/workflow-tools.js +90 -0
  350. package/dist/workflow/workflow-tools.js.map +1 -0
  351. package/package.json +119 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The no-workflow composition: a plain, skills-driven Deep Agent over the same
3
+ * workspace, with no machine, no control tools and no per-state gating.
4
+ */
5
+ import { createDeepAgent } from "deepagents";
6
+ import { asCompiledAgentGraph } from "../core/deepagents.js";
7
+ import { TOOL_MOCK_MIDDLEWARE_NAME } from "../core/tool-mocks.js";
8
+ import { frameworkPassthrough, rubricParams, todoMiddleware } from "./compose.js";
9
+ /**
10
+ * A skill source as upstream's middleware wants it: a leading-slash,
11
+ * trailing-slash POSIX path. The assembly's own sources are workspace-relative
12
+ * (`skills/`); only the plain composition hands them to upstream, so the
13
+ * conversion lives at that one boundary.
14
+ */
15
+ function asSkillSource(source) {
16
+ return `/${source.replace(/^\/+/, "").replace(/\/+$/, "")}/`;
17
+ }
18
+ /** Compose the plain agent: its graph, and whether the host's tool-mock middleware is among its middleware. */
19
+ export function composePlain(ctx, systemPrompt) {
20
+ // The host's middleware rides after the runtime's own, as on the governed path.
21
+ const middleware = [todoMiddleware(), ...(ctx.params.middleware ?? [])];
22
+ const deepAgent = createDeepAgent({
23
+ model: ctx.model,
24
+ backend: ctx.backend,
25
+ // No machine, so there are no states to vary disclosure by: upstream's
26
+ // skills middleware discloses every skill of the declared sources, which is
27
+ // exactly right here and exactly wrong under a workflow.
28
+ skills: ctx.skillSources.map(asSkillSource),
29
+ tools: ctx.params.tools ?? [],
30
+ ...rubricParams(ctx),
31
+ middleware,
32
+ systemPrompt: { prefix: systemPrompt, base: null },
33
+ checkpointer: ctx.checkpointer,
34
+ ...frameworkPassthrough(ctx.params),
35
+ });
36
+ return {
37
+ graph: asCompiledAgentGraph(deepAgent.graph),
38
+ toolMocks: middleware.some((m) => m.name === TOOL_MOCK_MIDDLEWARE_NAME),
39
+ };
40
+ }
41
+ //# sourceMappingURL=plain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain.js","sourceRoot":"","sources":["../../src/assembly/plain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAA2B,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,cAAc,EAAwB,MAAM,cAAc,CAAC;AAExG;;;;;GAKG;AACH,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC;AAC/D,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,YAAY,CAC1B,GAAoB,EACpB,YAAoB;IAEpB,gFAAgF;IAChF,MAAM,UAAU,GAAG,CAAC,cAAc,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC;IACxE,MAAM,SAAS,GAAG,eAAe,CAAC;QAChC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,uEAAuE;QACvE,4EAA4E;QAC5E,yDAAyD;QACzD,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC;QAC3C,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QAC7B,GAAG,YAAY,CAAC,GAAG,CAAC;QACpB,UAAU;QACV,YAAY,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE;QAClD,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,GAAG,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC;KACpC,CAAC,CAAC;IACH,OAAO;QACL,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,KAAK,CAAC;QAC5C,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,yBAAyB,CAAC;KACxE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,76 @@
1
+ # @archmax-ai/harness skill
2
+
3
+ An [Agent Skill](https://skills.sh) that teaches a coding agent (Claude Code,
4
+ Cursor, Codex, …) how to **build with** the
5
+ [`@archmax-ai/harness`](https://www.npmjs.com/package/@archmax-ai/harness) runtime:
6
+
7
+ 1. **Author a workflow** — a `workflow.yaml` state machine plus its skills,
8
+ grading rubrics, scripts, lifecycle hooks, tool governance, and cases.
9
+ 2. **Wire the runtime into a backend** — assemble an agent with
10
+ `createAgent`, run a workflow, resume human-in-the-loop states, and
11
+ stream lifecycle events / run artifacts so a frontend can visualize run state.
12
+
13
+ ## Install
14
+
15
+ **From the installed `@archmax-ai/harness` package (primary for runtime consumers)** —
16
+ the skill ships inside the npm package, so it always matches the installed SDK
17
+ version instead of a synced copy:
18
+
19
+ ```ts
20
+ import { BUNDLED_AUTHORING_SKILL_DIR } from "@archmax-ai/harness";
21
+ // <BUNDLED_AUTHORING_SKILL_DIR>/archmax-harness/SKILL.md (+ references/) — the constant
22
+ // is the dist/authoring-skill directory holding archmax-harness/. Point an install CLI at
23
+ // the skill itself:
24
+ // npx skills add ./node_modules/@archmax-ai/harness/dist/authoring-skill/archmax-harness
25
+ // (`BUNDLED_SKILLS_DIR` is a deprecated alias with the same value, kept one
26
+ // release.)
27
+ ```
28
+
29
+ **Via the skills CLI from a checkout (coding-agent / development use)**:
30
+
31
+ ```bash
32
+ npx skills add <owner>/<repo> # once this repo is public, from its root
33
+ # or point at the subfolder directly:
34
+ npx skills add ./skills/archmax-harness
35
+ ```
36
+
37
+ Replace `<owner>/<repo>` with this repository's GitHub slug. Skills appear on
38
+ skills.sh automatically via install telemetry — there is no separate submission
39
+ step.
40
+
41
+ ## What's inside
42
+
43
+ | File | Purpose |
44
+ | --- | --- |
45
+ | `SKILL.md` | The entry point, loaded when the skill triggers: procedure, workspace layout, CLI, and a table saying which short reference to load for which task |
46
+ | `references/workflow-yaml.md` | Short: every `workflow.yaml` key as an annotated skeleton, machine rules, governance |
47
+ | `references/hooks-and-scripts.md` | Short: the hook-script and `archmax_run` contracts |
48
+ | `references/cases.md` | Short: the case grammar (keys, actions, assertions, mocking rule) |
49
+ | `references/diagnostics.md` | Short: every `validate` diagnostic → its fix; removed keys |
50
+ | `references/wiring.md` | Short: `createAgent`, human states, events, artifacts |
51
+ | `references/workflow-schema.md` | Exhaustive `workflow.yaml` field reference + annotated example |
52
+ | `references/hook-and-test-scripts.md` | Full lifecycle hook-script + cases contracts with worked code examples |
53
+ | `references/backend-integration.md` | Full `createAgent` / events / run-artifact integration reference |
54
+
55
+ The skill is **self-contained** — no external docs are required to use it. It
56
+ targets **runtime contract version `"2"`**.
57
+
58
+ ## Naming note
59
+
60
+ This **authoring skill** is distinct from a workspace's **skill bundles** —
61
+ `skills/<slug>/` directories holding a `SKILL.md`, the capability's `assets/`
62
+ and its `archmax_run` `scripts/`, enabled per workflow and per state by slug.
63
+ They share the Agent Skills file format and nothing else: this skill is a
64
+ playbook for *building* such workspaces and wiring the runtime, which is why
65
+ it ships under `dist/authoring-skill/` rather than beside any workspace's
66
+ `skills/`.
67
+
68
+ ## Safety
69
+
70
+ Instruction-only: this skill bundles **no executable scripts**. It directs the
71
+ agent to run the runtime's own `archmax validate` / `archmax test` CLI commands to
72
+ verify authored workflows.
73
+
74
+ ## License
75
+
76
+ MIT (same as the `@archmax-ai/harness` package).
@@ -0,0 +1,241 @@
1
+ ---
2
+ name: archmax-harness
3
+ description: >-
4
+ Build with the @archmax-ai/harness runtime for LangChain Deep Agents. Use this
5
+ whenever you are designing, editing or fixing a workflow state machine (a
6
+ workflow.yaml with states, transitions, lifecycle hooks, tool and skill
7
+ governance, grading rubrics, scripts, cases, or skill bundles), OR wiring the
8
+ @archmax-ai/harness npm package into a backend service — assembling an agent with
9
+ createAgent, running a workflow, resuming human-in-the-loop states, or
10
+ streaming lifecycle events / session artifacts so a frontend can visualize a
11
+ run. Trigger this skill for phrases like "design a workflow", "author a
12
+ workflow.yaml", "add a state/transition/hook", "archmax validate fails", "run
13
+ an agent workflow from my worker", or "integrate @archmax-ai/harness" even when the
14
+ runtime is not named explicitly.
15
+ ---
16
+
17
+ # Building with @archmax-ai/harness
18
+
19
+ The archmax harness is a thin, governed runtime over
20
+ [LangChain Deep Agents](https://docs.langchain.com/oss/javascript/deepagents/overview):
21
+ one Deep Agent per workflow, moved by a declarative state machine
22
+ (`workflow.yaml`). It holds no use-case logic — a **workspace** supplies it.
23
+ Runtime contract: `runtime: { engine: archmax-harness, version: "2" }` in every spec.
24
+
25
+ **Read by task, not by curiosity.** This file holds the procedure, the
26
+ workspace layout and the commands. Load exactly the short reference your next
27
+ file needs, once, and nothing else:
28
+
29
+ | You are about to… | Load |
30
+ | --- | --- |
31
+ | write or edit `workflow.yaml` | [`references/workflow-yaml.md`](references/workflow-yaml.md) — every key, machine rules, governance |
32
+ | write a script — a skill's `scripts/*.js` (`archmax_run`) or a `hooks/*.js` gate | [`references/hooks-and-scripts.md`](references/hooks-and-scripts.md); sequence the skill case with the *Script playbook* below |
33
+ | write or fix a case (`tests/*.test.yaml`) | [`references/cases.md`](references/cases.md) |
34
+ | fix what `archmax validate` / `archmax test` reported | [`references/diagnostics.md`](references/diagnostics.md) |
35
+ | embed the package in a service | [`references/wiring.md`](references/wiring.md) |
36
+
37
+ The long references — `workflow-schema.md`, `hook-and-test-scripts.md`,
38
+ `backend-integration.md` — are exhaustive; open a **section** of one only when
39
+ the short reference says so or a field's exact semantics are in doubt. Do
40
+ **not** read the SDK source, do not `ls`/`glob` a workspace to discover its
41
+ layout (it is fixed, below), and do not re-read a file already in context.
42
+ Naming note: this authoring skill is not a workspace's `skills/<slug>/` bundle;
43
+ they share a file format and nothing else.
44
+
45
+ ---
46
+
47
+ ## Authoring
48
+
49
+ ### Procedure
50
+
51
+ **Build a workflow.** Design the whole file set first, write each file once,
52
+ then verify. Do not write a file, validate, and discover the next file.
53
+
54
+ 1. **Sketch the graph**: states (kebab-case slugs), the start state carrying
55
+ `triggers: { manual: }` (plus any host trigger ids that enter there),
56
+ terminal states (no `transitions`), the edges between them — and for each
57
+ edge, the *condition* under which it is taken. That condition is the edge's
58
+ required `description`, and it is the only thing the agent will know about
59
+ where the edge leads.
60
+ 2. **Decide the file set** from the sketch: `workflow.yaml` always; one
61
+ `hooks/<check>.js` per *deterministic* gate; one inline `rubric:` per
62
+ *judgment* gate (tone, completeness); cases — one happy path per branch,
63
+ one per hook veto path, one `decide:` per human state; a
64
+ `skills/<capability>/` bundle only for data, an `archmax_run` script, or
65
+ guidance two or more states share identically; `AGENTS.md` only for a
66
+ workspace-wide persona.
67
+ 3. **Write `workflow.yaml`** from the skeleton in [`references/workflow-yaml.md`](references/workflow-yaml.md). Each state's behaviour
68
+ goes inline in its `instructions`; run-wide rules once in the top-level
69
+ `instructions`; nothing about the machine itself (the platform prompt and
70
+ the disclosed edges already say it, and prose is billed on every call), and
71
+ nothing about the date: every model call opens with the current date and time
72
+ in UTC (rounded down to ten minutes, with the host's zone named), so date
73
+ arithmetic ("due in 30 days") needs no authored `today`.
74
+ Never describe another state in a state's `instructions` or in an edge's
75
+ `description`: the agent is shown the active state's edges and nothing else
76
+ of the graph, so a routing condition parked in the *target's* `summary` or
77
+ `instructions` is invisible to the state that has to route on it. Name
78
+ a model (`settings.model`, or `model:` on one state) only where the work
79
+ differs in kind — a small model on mechanical states, the default on
80
+ drafting, judgement and heavy-routing ones.
81
+ 4. **Write hooks, rubrics, cases** — description first (a hook's JSDoc, a
82
+ case's `title` + `description`), then the body, and never leave the two
83
+ disagreeing. Before writing a case, settle what to mock ([`references/cases.md`](references/cases.md)).
84
+ 5. **Verify**: `archmax validate <slug>` → fix every error (and every warning
85
+ you can) → `archmax test <slug>`. Never call a workflow done without a clean
86
+ `validate`.
87
+
88
+ **Fix a workflow.** Diagnose from the tool, not by reading everything.
89
+
90
+ 1. Run `archmax validate <slug>` (offline, instant). Every diagnostic names
91
+ the file, the field path and the fix; map it with the
92
+ [`references/diagnostics.md`](references/diagnostics.md).
93
+ 2. Read **only** the files the diagnostics name. Edit once. Re-validate.
94
+ 3. When clean, `archmax test <slug> [filter]`. Read the failing case's verdict
95
+ line: a **structural** miss (`reachedState`, `parked`, `succeeded`,
96
+ `trail`) is a routing or governance defect — fix the routing state's
97
+ `instructions`, the transition `description`s, or the `tools`/`skills`
98
+ grants; a **content** miss (`reply`, `calledTool`, `grade`) is an
99
+ `instructions` defect in the state that answered; a veto reason quoted in
100
+ the reply is the hook or rubric speaking — fix what it names. Change the
101
+ case only when it asserts something the spec never promised.
102
+ 4. A `grade` miss is the one non-deterministic assertion: re-run that case
103
+ once before calling it a regression. Re-run with `--verbose` for raw
104
+ events only when the verdict line is not enough.
105
+
106
+ Budget: one validate, one edit pass, one validate, one test. If you are on
107
+ your fourth read of a file, you are guessing — reread the relevant reference
108
+ instead.
109
+
110
+ **Shapes come from tools, not from research.** Before naming any field of a
111
+ tool's result or a trigger's payload — in `instructions`, a `${{…}}` guard, a
112
+ hook — ask the host: a platform embedding this runtime typically exposes
113
+ describe-style tools (a tool's input and output schema, a trigger's payload
114
+ schema and sample) and a way to sample or invoke once with a narrow input. Call
115
+ those first; fall back to a recorded session's variables (`archmax sessions <id>`)
116
+ only when no such tool exists. Reading more files never reveals what a live
117
+ system returns.
118
+
119
+ ### Script playbook (a skill's `scripts/<x>.js`)
120
+
121
+ Deterministic work the model triggers with `archmax_run`. In order:
122
+
123
+ 1. **Shapes first.** Trigger payload and tool I/O from the host's describe/sample
124
+ tools; the variables a run actually carries from `archmax sessions <id>`.
125
+ Guessing a field name here costs a whole run (above).
126
+ 2. **Write it.** `skills/<cap>/scripts/<x>.js`: JSDoc, then the body. Input is the
127
+ global `args` — `args.<param>` from the model plus `args.variables`, a read-only
128
+ snapshot — and the **last expression** is the result. Contract:
129
+ [`references/hooks-and-scripts.md`](references/hooks-and-scripts.md).
130
+ 3. **Land the result in a variable.** Return structured data, and name the variable
131
+ in the calling state's `requires:`. A script may not call
132
+ `archmax_set_variables`, so `requires` is what makes the model record the return;
133
+ unrecorded, the result lives in one tool message and is gone.
134
+ 4. **Announce it in the skill.** The `SKILL.md` `description` says *when* to run it;
135
+ the body says the script's path, its arguments, and the variable its result
136
+ lands in. A script nothing points at is never reached.
137
+ 5. **Grant it.** The calling state allows `{ tool: archmax_run, paths:
138
+ ["skills/<cap>/scripts/**"] }` plus every tool the script itself calls. Then
139
+ `archmax validate`.
140
+
141
+ ### Reference a variable, never retype it
142
+
143
+ `${{name}}` / `${{a.b.-1.c}}` resolves against the run's variables in a
144
+ `tools.allow` glob **and inside any text argument the model writes** — mid-string,
145
+ repeatable, matched literally. The transcript keeps the reference and only the tool
146
+ sees the value, so a stored value costs its tokens once instead of on every later
147
+ model call. Step 3 is what puts a value there to reference.
148
+
149
+ A state that must emit something already stored is told to interpolate it:
150
+
151
+ ```yaml
152
+ instructions: >-
153
+ Send the reply with gmail__send. Quote the customer's message by writing
154
+ ${{inbound.text}} in the body rather than retyping it.
155
+ ```
156
+
157
+ Exact — a retyped copy truncates and drifts, a reference cannot — and it agrees by
158
+ construction with a guard on the same variable. Not available in scripts, which
159
+ read `args.variables`. To write the characters literally: `$${{name}}`.
160
+
161
+ ### Workspace layout (complete — nothing else exists)
162
+
163
+ ```
164
+ <workspace root>/
165
+ AGENTS.md # optional persona; prompt layer 1
166
+ workflows/<slug>/ # AUTHORING PLANE — runtime reads it, the agent CANNOT
167
+ workflow.yaml # the machine (required, canonical)
168
+ WORKFLOW.md # optional plain-markdown addendum, NO frontmatter
169
+ hooks/<check>.js # lifecycle hook scripts, run by the runtime
170
+ tests/<case>.test.yaml # one case per file; fixtures beside them (`from:`)
171
+ skills/<capability>/ # AGENT PLANE — mounted read-only, enabled per state by slug
172
+ SKILL.md # frontmatter (name = directory slug, description) + body
173
+ scripts/<script>.js # archmax_run sources, run by the agent
174
+ assets/<file> # read-only inputs
175
+ references/<topic>.md # optional deeper material
176
+ .env # ARCHMAX_* model config (never mounted)
177
+ sessions/<sessionId>/ # the run; the agent's workspace ROOT (never authored)
178
+ scratchpad/ # agent-visible `scratchpad/…`: the session's always-writable
179
+ # area (a host-wired writable mount is another place to write)
180
+ large_tool_results/ conversation_history/ # runtime offload, agent reads only
181
+ checkpoints/ artifacts/ # runtime-internal
182
+ ```
183
+
184
+ Rules that follow:
185
+
186
+ - **The agent cannot read `workflows/**`** — its spec, hooks, rubrics and
187
+ cases have no route in its workspace. Never point `instructions`,
188
+ `evidence` or a case `workspace:` at one (`validate` errors). Text the agent
189
+ needs goes in a skill bundle.
190
+ - **Placement**: a hook is the guard, a runtime script is the tool; they
191
+ never share a file or a directory.
192
+
193
+ | Script | Runs on | Lives at | Wired as |
194
+ | --- | --- | --- | --- |
195
+ | Hook | runtime authority, at `before`/`after` | `workflows/<slug>/hooks/<x>.js` | `before: { script: hooks/<x>.js }` (workflow-relative, confined to `hooks/`) |
196
+ | Runtime script | the model's authority, via `archmax_run` | `skills/<cap>/scripts/<x>.js` | enabling the skill; narrow with `{ tool: archmax_run, paths: ["skills/<cap>/scripts/**"] }` |
197
+
198
+ `archmax_run` is confined to skill bundles by a non-overridable rule
199
+ (`script.skill-only`): a script in `scratchpad/` or `hooks/` is unrunnable.
200
+ - **Paths have no leading slash** (`skills/order-data/assets/orders.json`,
201
+ `scratchpad/refund.json`); never author a `run/` prefix. `scratchpad/` is
202
+ writable in every state regardless of `tools.allow`, so an allow entry
203
+ inside it narrows nothing (warning); to govern *where* a result lands, name
204
+ a non-reserved run path (`reports/*.json`) and allow it.
205
+ - **Guidance has three homes, one per rule**: every workflow → `AGENTS.md`;
206
+ the whole run → top-level `instructions` (`|-` literal block, since `>-`
207
+ folds paragraphs together); one state's turn → that state's `instructions`
208
+ (`>-` is fine). Pasting a paragraph into a second state means hoist it.
209
+ Never one `skills/<state>/` per state.
210
+ - **Every `.js` you author opens with a JSDoc block**: title line, blank
211
+ line, then what it reads, the sequence of checks, and the condition for each
212
+ verdict (hook) or what it computes and returns (script). Admin UIs show this
213
+ instead of the code. No `@specification` tag, no sidecar key.
214
+
215
+ ### Verify (CLI)
216
+
217
+ ```bash
218
+ archmax validate [workflow] [--json] # offline; run after every structural edit
219
+ archmax test [workflow] [filter] [--json] # cases; filter = case-id substring
220
+ archmax run <workflow> "<prompt>" [--session <id>] [--trigger <id>] [--variables '<json>']
221
+ archmax sessions [session] [--json] # list, or one session's variables (value + locked)
222
+ archmax decide <session> --to <state> [--comment "…"] # resume a human state
223
+ archmax reply <session> "<message>" # message a parked run; it stays parked
224
+ archmax deliver <session> --trigger <id> [--variables '<json>'] # resume an archmax_wait
225
+ ```
226
+
227
+ `<workflow>` may be omitted when the workspace has one. Global `--root <dir>`
228
+ (cwd default; `.env` loads from it), `--verbose` for raw events. Results on
229
+ stdout, narration on stderr. Exit 0 done/parked, 1 failure, 2 usage. Dev from
230
+ the SDK checkout: `npm run dev -- <command…>`.
231
+
232
+ ---
233
+
234
+
235
+ ---
236
+
237
+ ## Done when
238
+
239
+ - Authoring: `archmax validate` clean, `archmax test` passing, every `.js`
240
+ opens with its JSDoc, every case has `title` + `description`.
241
+ - Wiring: the snippet compiles against the installed package's exports.