factoryhub 0.0.0-stage → 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 (99) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +16 -0
  3. package/README.md +189 -2
  4. package/factories/README.md +17 -0
  5. package/factories/client-file-readiness/README.md +3 -0
  6. package/factories/client-file-readiness/agents/analyst/agent.md +10 -0
  7. package/factories/client-file-readiness/agents/reviewer/agent.md +10 -0
  8. package/factories/client-file-readiness/agents/writer/agent.md +11 -0
  9. package/factories/client-file-readiness/factory.yaml +12 -0
  10. package/factories/client-file-readiness/flow.yaml +56 -0
  11. package/factories/competitor-teardown/README.md +3 -0
  12. package/factories/competitor-teardown/agents/analyst/agent.md +10 -0
  13. package/factories/competitor-teardown/agents/researcher/agent.md +11 -0
  14. package/factories/competitor-teardown/agents/reviewer/agent.md +10 -0
  15. package/factories/competitor-teardown/agents/writer/agent.md +11 -0
  16. package/factories/competitor-teardown/factory.yaml +11 -0
  17. package/factories/competitor-teardown/flow.yaml +75 -0
  18. package/factories/homepage-audit/README.md +3 -0
  19. package/factories/homepage-audit/agents/analyst/agent.md +10 -0
  20. package/factories/homepage-audit/agents/researcher/agent.md +11 -0
  21. package/factories/homepage-audit/agents/reviewer/agent.md +10 -0
  22. package/factories/homepage-audit/agents/writer/agent.md +11 -0
  23. package/factories/homepage-audit/factory.yaml +11 -0
  24. package/factories/homepage-audit/flow.yaml +77 -0
  25. package/factories/inbox-triage/README.md +3 -0
  26. package/factories/inbox-triage/agents/analyst/agent.md +10 -0
  27. package/factories/inbox-triage/agents/reviewer/agent.md +10 -0
  28. package/factories/inbox-triage/agents/writer/agent.md +11 -0
  29. package/factories/inbox-triage/factory.yaml +11 -0
  30. package/factories/inbox-triage/flow.yaml +57 -0
  31. package/factories/index.json +356 -0
  32. package/factories/launch-kit/README.md +3 -0
  33. package/factories/launch-kit/agents/reviewer/agent.md +10 -0
  34. package/factories/launch-kit/agents/strategist/agent.md +10 -0
  35. package/factories/launch-kit/agents/writer/agent.md +11 -0
  36. package/factories/launch-kit/factory.yaml +12 -0
  37. package/factories/launch-kit/flow.yaml +75 -0
  38. package/factories/meeting-to-actions/CHANGELOG.md +7 -0
  39. package/factories/meeting-to-actions/README.md +15 -0
  40. package/factories/meeting-to-actions/agents/analyst/agent.md +10 -0
  41. package/factories/meeting-to-actions/agents/reviewer/agent.md +10 -0
  42. package/factories/meeting-to-actions/agents/writer/agent.md +11 -0
  43. package/factories/meeting-to-actions/factory.yaml +11 -0
  44. package/factories/meeting-to-actions/flow.yaml +53 -0
  45. package/factories/meeting-to-actions/mindburn.requirements.yaml +8 -0
  46. package/factories/meeting-to-actions/mindburn.tests.yaml +16 -0
  47. package/factories/outreach-pack/README.md +3 -0
  48. package/factories/outreach-pack/agents/reviewer/agent.md +5 -0
  49. package/factories/outreach-pack/agents/writer/agent.md +5 -0
  50. package/factories/outreach-pack/factory.yaml +9 -0
  51. package/factories/outreach-pack/flow.yaml +42 -0
  52. package/factories/prospect-brief/README.md +3 -0
  53. package/factories/prospect-brief/agents/researcher/agent.md +11 -0
  54. package/factories/prospect-brief/agents/reviewer/agent.md +10 -0
  55. package/factories/prospect-brief/agents/strategist/agent.md +10 -0
  56. package/factories/prospect-brief/agents/writer/agent.md +11 -0
  57. package/factories/prospect-brief/factory.yaml +11 -0
  58. package/factories/prospect-brief/flow.yaml +79 -0
  59. package/package.json +79 -4
  60. package/packages/cli/bin/factoryhub.mjs +8 -0
  61. package/packages/cli/package.json +29 -0
  62. package/packages/cli/src/args.mjs +47 -0
  63. package/packages/cli/src/commands/export.mjs +55 -0
  64. package/packages/cli/src/commands/get.mjs +38 -0
  65. package/packages/cli/src/commands/inspect.mjs +66 -0
  66. package/packages/cli/src/commands/list.mjs +29 -0
  67. package/packages/cli/src/commands/mcp.mjs +26 -0
  68. package/packages/cli/src/commands/new.mjs +148 -0
  69. package/packages/cli/src/commands/pack.mjs +97 -0
  70. package/packages/cli/src/commands/resume.mjs +67 -0
  71. package/packages/cli/src/commands/run.mjs +190 -0
  72. package/packages/cli/src/commands/search.mjs +31 -0
  73. package/packages/cli/src/commands/validate.mjs +81 -0
  74. package/packages/cli/src/main.mjs +68 -0
  75. package/packages/cli/src/util.mjs +21 -0
  76. package/packages/engine/lib/catalog.mjs +50 -0
  77. package/packages/engine/lib/hub.mjs +71 -0
  78. package/packages/engine/lib/node.mjs +114 -0
  79. package/packages/engine/lib/providers.mjs +52 -0
  80. package/packages/engine/lib/run.mjs +131 -0
  81. package/packages/engine/lib/skill.mjs +229 -0
  82. package/packages/engine/package.json +39 -0
  83. package/packages/engine/src/author-tests.mjs +78 -0
  84. package/packages/engine/src/compose.mjs +150 -0
  85. package/packages/engine/src/cost.mjs +41 -0
  86. package/packages/engine/src/diagnostics.mjs +21 -0
  87. package/packages/engine/src/factory-engine.mjs +1762 -0
  88. package/packages/engine/src/index.mjs +9 -0
  89. package/packages/engine/src/markdown.mjs +97 -0
  90. package/packages/engine/src/package.mjs +116 -0
  91. package/packages/engine/src/run.mjs +232 -0
  92. package/packages/mcp/bin/factoryhub-mcp.mjs +6 -0
  93. package/packages/mcp/package.json +36 -0
  94. package/packages/mcp/src/server.mjs +280 -0
  95. package/spec/README.md +36 -0
  96. package/spec/factory-format.md +621 -0
  97. package/spec/schema/factory.schema.json +43 -0
  98. package/spec/schema/flow.schema.json +169 -0
  99. package/spec/skill-export.md +126 -0
@@ -0,0 +1,169 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/Mindburn-Labs/factoryhub/blob/main/spec/schema/flow.schema.json",
4
+ "title": "flow.yaml",
5
+ "description": "A factory's executable workflow, format v1alpha1 (mindburn.flow/v1). Describes the document after YAML parsing. Rules across steps and files (references, cycles, agent files) are in spec/factory-format.md, section 6.",
6
+ "type": "object",
7
+ "required": ["steps"],
8
+ "properties": {
9
+ "flow": { "description": "The flow format.", "const": "mindburn.flow/v1" },
10
+ "requires": {
11
+ "description": "Execution features the flow depends on.",
12
+ "type": "array",
13
+ "items": { "enum": ["scoped-context", "multiple-outputs"] }
14
+ },
15
+ "title": { "type": "string" },
16
+ "author": { "type": "string" },
17
+ "version": { "description": "The factory's version. Quote it, for example \"1.0.0\".", "type": "string" },
18
+ "license": { "description": "An SPDX license identifier is recommended.", "type": "string" },
19
+ "tags": { "type": "array", "items": { "type": "string" } },
20
+ "time": { "description": "How long a run takes, in words.", "type": "string" },
21
+ "inputs": {
22
+ "description": "What a person fills in before a run. At most eight.",
23
+ "type": ["object", "null"],
24
+ "maxProperties": 8,
25
+ "propertyNames": { "$ref": "#/$defs/name" },
26
+ "additionalProperties": { "$ref": "#/$defs/input" }
27
+ },
28
+ "steps": {
29
+ "description": "The steps, in the order they are written. At most 24.",
30
+ "type": "object",
31
+ "minProperties": 1,
32
+ "maxProperties": 24,
33
+ "propertyNames": { "$ref": "#/$defs/name" },
34
+ "additionalProperties": { "$ref": "#/$defs/step" }
35
+ },
36
+ "done": {
37
+ "description": "Checkable statements about the deliverable.",
38
+ "type": "array",
39
+ "items": { "type": "string" }
40
+ },
41
+ "outputs": {
42
+ "description": "Exact results to deliver, in order. Needs requires: [multiple-outputs].",
43
+ "type": "array",
44
+ "minItems": 1,
45
+ "maxItems": 24,
46
+ "items": {
47
+ "type": "object",
48
+ "required": ["step", "title"],
49
+ "additionalProperties": false,
50
+ "properties": {
51
+ "step": { "$ref": "#/$defs/name" },
52
+ "title": { "type": "string", "pattern": "\\S", "maxLength": 200 }
53
+ }
54
+ }
55
+ },
56
+ "composition": {
57
+ "description": "Provenance of a composed factory.",
58
+ "type": "object",
59
+ "required": ["compiler", "intent", "sources", "unmetCapabilities"],
60
+ "additionalProperties": false,
61
+ "properties": {
62
+ "compiler": { "const": "mindburn.compose/v1" },
63
+ "intent": { "type": "string" },
64
+ "sources": {
65
+ "type": "array",
66
+ "items": {
67
+ "type": "object",
68
+ "required": ["id", "name", "version", "sha256"],
69
+ "properties": {
70
+ "id": { "type": "string" },
71
+ "name": { "type": "string" },
72
+ "version": { "type": "string" },
73
+ "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
74
+ }
75
+ }
76
+ },
77
+ "unmetCapabilities": { "type": "array", "items": { "type": "string" } }
78
+ }
79
+ }
80
+ },
81
+ "$defs": {
82
+ "name": {
83
+ "description": "An input or step name, written normalized: lowercase letters and digits joined by single underscores.",
84
+ "type": "string",
85
+ "pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$",
86
+ "maxLength": 64
87
+ },
88
+ "agent": {
89
+ "description": "An agent folder name under agents/: lowercase letters and digits joined by single hyphens.",
90
+ "type": "string",
91
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
92
+ "maxLength": 41
93
+ },
94
+ "input": {
95
+ "type": "object",
96
+ "properties": {
97
+ "type": { "enum": ["text", "longtext", "url"] },
98
+ "label": { "type": "string" },
99
+ "help": { "type": "string" },
100
+ "optional": { "type": "boolean" },
101
+ "required": { "type": "boolean" },
102
+ "visibility": { "enum": ["public", "private"] }
103
+ }
104
+ },
105
+ "toolList": {
106
+ "oneOf": [
107
+ { "type": "string" },
108
+ { "type": "array", "items": { "type": "string" } }
109
+ ]
110
+ },
111
+ "step": {
112
+ "type": "object",
113
+ "properties": {
114
+ "title": { "type": "string" },
115
+ "kind": { "enum": ["work", "check", "approve", "deliver"] },
116
+ "agent": { "$ref": "#/$defs/agent" },
117
+ "task": { "type": "string" },
118
+ "needs": {
119
+ "oneOf": [
120
+ { "$ref": "#/$defs/name" },
121
+ { "type": "array", "items": { "$ref": "#/$defs/name" } },
122
+ { "type": "null" }
123
+ ]
124
+ },
125
+ "checks": { "$ref": "#/$defs/name" },
126
+ "shows": { "$ref": "#/$defs/name" },
127
+ "rounds": { "type": "integer", "minimum": 0, "maximum": 5 },
128
+ "tools": { "$ref": "#/$defs/toolList" },
129
+ "mcp": {}, "mcpServers": {}, "mcp_servers": {}, "connectors": {}, "plugins": {}, "skills": {},
130
+ "context": {
131
+ "type": "object",
132
+ "additionalProperties": false,
133
+ "properties": {
134
+ "inputs": { "$ref": "#/$defs/bindings" },
135
+ "artifacts": { "$ref": "#/$defs/bindings" },
136
+ "public": { "type": "boolean" }
137
+ }
138
+ },
139
+ "criteria": {
140
+ "type": "array",
141
+ "items": { "type": "string", "pattern": "\\S" }
142
+ }
143
+ },
144
+ "allOf": [
145
+ {
146
+ "if": { "not": { "properties": { "kind": { "const": "approve" } }, "required": ["kind"] } },
147
+ "then": { "required": ["agent"] }
148
+ },
149
+ {
150
+ "if": { "anyOf": [{ "not": { "required": ["kind"] } }, { "properties": { "kind": { "enum": ["work", "deliver"] } } }] },
151
+ "then": { "required": ["task"], "properties": { "task": { "type": "string", "pattern": "\\S" } } }
152
+ },
153
+ {
154
+ "if": { "required": ["checks"] },
155
+ "then": { "required": ["kind"], "properties": { "kind": { "const": "check" } } }
156
+ },
157
+ {
158
+ "if": { "required": ["shows"] },
159
+ "then": { "properties": { "kind": { "const": "approve" } }, "required": ["kind"] }
160
+ }
161
+ ]
162
+ },
163
+ "bindings": {
164
+ "type": "object",
165
+ "propertyNames": { "pattern": "^[a-z][a-z0-9_]{0,63}$" },
166
+ "additionalProperties": { "$ref": "#/$defs/name" }
167
+ }
168
+ }
169
+ }
@@ -0,0 +1,126 @@
1
+ # Exporting a factory as an Agent Skill
2
+
3
+ Status: alpha, version 1. This mapping turns a factory into an
4
+ [Agent Skills](https://agentskills.io/specification) folder, so any agent that
5
+ loads skills can find the factory, collect its inputs, follow its steps and
6
+ stop where a person decides. `factoryhub export --as skill`, the MCP tool
7
+ `export_skill` and `exportSkill()` in
8
+ [`packages/engine/lib/skill.mjs`](../packages/engine/lib/skill.mjs) implement
9
+ it. Another implementation, such as the factoryhub site, MUST produce the
10
+ same bytes for the same canonical bundle and id: the expected `SKILL.md` of
11
+ every house factory is in [`skill-export/`](skill-export), and
12
+ [`test/skill-export.test.mjs`](test/skill-export.test.mjs) checks it.
13
+
14
+ ## Layout
15
+
16
+ ```text
17
+ <id>/
18
+ SKILL.md frontmatter and instructions written from the flow
19
+ factory/... the canonical bundle, byte for byte
20
+ ```
21
+
22
+ `<id>` is the factory's id: its `name`, or the id the factoryhub catalogue
23
+ gives it. It MUST be lowercase letters, digits and single hyphens, at most 64
24
+ characters, as both formats require.
25
+
26
+ `factory/` holds the **canonical bundle** (spec section 9): the factory's own
27
+ files, unchanged, plus `agents/foreman/agent.md` written from the flow when
28
+ the author wrote none. Nothing else is added or changed.
29
+
30
+ ## Frontmatter
31
+
32
+ ```yaml
33
+ ---
34
+ name: "<id>"
35
+ description: "<description>"
36
+ license: "<license>"
37
+ metadata:
38
+ factoryhub-id: "<id>"
39
+ factoryhub-version: "<version>"
40
+ factoryhub-source: "https://factory.mindburn.org/f/<id>"
41
+ factoryhub-sha256: "<bundle sha256>"
42
+ factoryhub-author: "<author>"
43
+ ---
44
+ ```
45
+
46
+ | Field | Value |
47
+ |---|---|
48
+ | `name` | the id |
49
+ | `description` | the factory's description with every run of whitespace turned into one space. If it does not contain "use when" (in any case), append ` Use when the person wants to run the “<title>” factory.` If the result is longer than 1,024 characters, the factory description is cut at a word boundary to fit and ends with `…` before the appended sentence |
50
+ | `license` | the `license` in `flow.yaml`. Left out when the flow declares none |
51
+ | `metadata.factoryhub-id` | the id |
52
+ | `metadata.factoryhub-version` | the `version` in `flow.yaml` |
53
+ | `metadata.factoryhub-source` | `https://factory.mindburn.org/f/<id>`, or the same path on another factoryhub address |
54
+ | `metadata.factoryhub-sha256` | the SHA-256 of the canonical bundle, as hex: the factory's identity |
55
+ | `metadata.factoryhub-author` | the `author` in `flow.yaml`. Left out when the flow declares none |
56
+
57
+ Every value is written as a JSON string, which YAML reads as a double-quoted
58
+ scalar, so an id such as `no` or `2024` stays text in every YAML reader. The fields appear in
59
+ the order above, one per line; the `metadata` keys are indented by two
60
+ spaces. `metadata` is a map from strings to strings, as the Agent Skills
61
+ specification requires, and holds nothing but these keys.
62
+
63
+ ## Body
64
+
65
+ After the frontmatter, a blank line, then these parts in order:
66
+
67
+ 1. `# <title>`, the description, and a line naming the factory id and its
68
+ version, saying that `factory/` holds its files unchanged, "plus a foreman
69
+ written from the flow" when the canonical bundle's
70
+ `agents/foreman/agent.md` is the one the engine writes from the flow
71
+ (`isGeneratedForeman`) or "with nothing added" otherwise, and giving the
72
+ source address. The sentence depends on the canonical bundle alone, so a
73
+ source with or without the generated foreman exports to the same bytes.
74
+ 2. `## What it produces`: the deliverable (the declared outputs in order, or
75
+ the final step and its agent), then the `done` statements as a list.
76
+ 3. `## Inputs to collect`: how many are required, then one line per input:
77
+ name, type, required or optional, help; then the input limits and "Never
78
+ invent a missing input".
79
+ 4. `## Steps`: the order rule, the parallel rule when two steps need the same
80
+ earlier steps, then every step in file order, numbered:
81
+ - work and deliver: title, kind, the agent with its description, what it
82
+ needs, its tools, then its task;
83
+ - check: title, the reviewer agent, what it needs, the step it checks, the
84
+ criteria as a quotation, and what happens when it fails, by `rounds`;
85
+ - approve: title, "Who: the person", what it needs, then
86
+ `Stop and ask the person to approve the result of "<subject title>".`,
87
+ "Show it to them in full", its task, and what approve, change (by
88
+ `rounds`) and reject do, ending "Never decide for them".
89
+ 5. `## Run it with the factoryhub CLI`: how to run the bundle in `factory/`
90
+ with the CLI and the person's own key or a local model.
91
+ 6. `## Follow it by hand`: read the foreman, take on each agent's role, stop
92
+ and ask the person to approve at every decision, deliver the final result
93
+ unchanged; and that following by hand does not reproduce the runner's
94
+ enforced checks or receipt.
95
+
96
+ Every decision step appears exactly once as `Stop and ask the person to
97
+ approve the result of`. The exact wording of every sentence is the one
98
+ `exportSkill()` writes; the golden files are the reference.
99
+
100
+ ## Checks
101
+
102
+ `checkSkill()` checks an exported folder, and the tests run it on every house
103
+ factory:
104
+
105
+ - `SKILL.md` has YAML frontmatter with only the Agent Skills fields (`name`,
106
+ `description`, `license`, `compatibility`, `metadata`, `allowed-tools`);
107
+ - `name` follows the naming rule and matches the folder name;
108
+ - `description` is 1 to 1,024 characters and says when to use the skill;
109
+ - every `metadata` value is a string, and the `factoryhub-*` keys hold the
110
+ id, version, source address and SHA-256;
111
+ - the body has the five sections;
112
+ - the folder holds only `SKILL.md` and `factory/`, `factory/` is a valid
113
+ factory, and its hash equals `metadata.factoryhub-sha256`;
114
+ - the body asks the person to approve exactly as many times as the flow has
115
+ decision steps.
116
+
117
+ CI also runs the Agent Skills reference validator (`skills-ref`) on the
118
+ exports of every house factory.
119
+
120
+ ## Using an export
121
+
122
+ Copy the folder into a skills directory: `~/.claude/skills/` for Claude Code,
123
+ `~/.agents/skills/` or `<workspace>/skills/` for OpenClaw,
124
+ `~/.hermes/skills/` for Hermes Agent. See
125
+ [`docs/integrations.md`](../docs/integrations.md) for which of these were
126
+ exercised.