@clemrig/factory 0.20.0 → 0.22.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 (58) hide show
  1. package/README.md +30 -17
  2. package/dist/app/prototype.d.ts +15 -0
  3. package/dist/app/prototype.js +65 -0
  4. package/dist/app/prototype.js.map +1 -0
  5. package/dist/app/review.js +3 -2
  6. package/dist/app/review.js.map +1 -1
  7. package/dist/app/spec-page.d.ts +15 -2
  8. package/dist/app/spec-page.js +45 -10
  9. package/dist/app/spec-page.js.map +1 -1
  10. package/dist/app/workflows/issue-save.js +63 -20
  11. package/dist/app/workflows/issue-save.js.map +1 -1
  12. package/dist/app/workflows/stages/agents.d.ts +5 -0
  13. package/dist/app/workflows/stages/agents.js +5 -0
  14. package/dist/app/workflows/stages/agents.js.map +1 -1
  15. package/dist/app/workflows/stages/deliver.js +11 -3
  16. package/dist/app/workflows/stages/deliver.js.map +1 -1
  17. package/dist/app/workflows/stages/implement.js +8 -2
  18. package/dist/app/workflows/stages/implement.js.map +1 -1
  19. package/dist/app/workflows/stages/plan.js +2 -0
  20. package/dist/app/workflows/stages/plan.js.map +1 -1
  21. package/dist/app/workflows/stages/prepare.js +15 -1
  22. package/dist/app/workflows/stages/prepare.js.map +1 -1
  23. package/dist/app/workflows/stages/review.js +9 -2
  24. package/dist/app/workflows/stages/review.js.map +1 -1
  25. package/dist/app/workflows/stages/run.d.ts +14 -1
  26. package/dist/app/workflows/stages/run.js.map +1 -1
  27. package/dist/cli/ui.js +3 -2
  28. package/dist/cli/ui.js.map +1 -1
  29. package/dist/domain/pull-request.d.ts +9 -2
  30. package/dist/domain/pull-request.js +12 -2
  31. package/dist/domain/pull-request.js.map +1 -1
  32. package/dist/domain/spec-page.d.ts +73 -17
  33. package/dist/domain/spec-page.js +93 -6
  34. package/dist/domain/spec-page.js.map +1 -1
  35. package/dist/domain/spec.d.ts +13 -1
  36. package/dist/domain/spec.js +60 -8
  37. package/dist/domain/spec.js.map +1 -1
  38. package/dist/domain/tidy.d.ts +2 -1
  39. package/dist/domain/tidy.js +5 -1
  40. package/dist/domain/tidy.js.map +1 -1
  41. package/dist/system/git.d.ts +4 -0
  42. package/dist/system/git.js +13 -0
  43. package/dist/system/git.js.map +1 -1
  44. package/dist/system/images.d.ts +16 -0
  45. package/dist/system/images.js +51 -0
  46. package/dist/system/images.js.map +1 -0
  47. package/dist/system/issues.d.ts +18 -1
  48. package/dist/system/issues.js +63 -3
  49. package/dist/system/issues.js.map +1 -1
  50. package/dist/system/run-files.d.ts +0 -8
  51. package/dist/system/run-files.js +1 -28
  52. package/dist/system/run-files.js.map +1 -1
  53. package/package.json +4 -4
  54. package/prompts/implement.md +11 -1
  55. package/prompts/plan.md +18 -6
  56. package/prompts/review.md +13 -4
  57. package/templates/init/factory.ts +18 -0
  58. package/templates/skills/issue/SKILL.md +48 -18
@@ -0,0 +1,16 @@
1
+ /** An image file's bytes and media type. */
2
+ export interface Image {
3
+ body: Buffer;
4
+ type: string;
5
+ }
6
+ /** The media type of a PNG, JPEG, GIF or WebP image, from its first bytes; `undefined` for anything else. */
7
+ export declare function imageType(start: Buffer): string | undefined;
8
+ /**
9
+ * The image at `path`, with its media type: `undefined` when it is no image
10
+ * file of its own there, a link included, or is over `maxBytes`.
11
+ */
12
+ export declare function readImage(path: string, maxBytes: number): Promise<Image | undefined>;
13
+ /** An image an agent hands over with a draft, by its absolute path; otherwise why it is none. */
14
+ export declare function readDraftImage(path: string, maxBytes: number): Promise<Image | string>;
15
+ /** Image `file` of `folder`, named alone: a path that leaves the folder reads nothing. */
16
+ export declare function readImageIn(folder: string, file: string, maxBytes: number): Promise<Image | undefined>;
@@ -0,0 +1,51 @@
1
+ import { lstat, readFile } from "node:fs/promises";
2
+ import { basename, isAbsolute, join } from "node:path";
3
+ /** The media type of a PNG, JPEG, GIF or WebP image, from its first bytes; `undefined` for anything else. */
4
+ export function imageType(start) {
5
+ const ascii = (from, to) => start.subarray(from, to).toString("latin1");
6
+ if (ascii(0, 8) === "\x89PNG\r\n\x1a\n")
7
+ return "image/png";
8
+ if (ascii(0, 3) === "\xff\xd8\xff")
9
+ return "image/jpeg";
10
+ if (ascii(0, 4) === "GIF8")
11
+ return "image/gif";
12
+ if (ascii(0, 4) === "RIFF" && ascii(8, 12) === "WEBP")
13
+ return "image/webp";
14
+ return undefined;
15
+ }
16
+ /** The image at `path`, with its media type, or why it is none: no file of its own there, a link included, or over `maxBytes`. */
17
+ async function inspectImage(path, maxBytes) {
18
+ const found = await lstat(path).catch(() => undefined);
19
+ if (!found)
20
+ return "does not exist";
21
+ if (found.isSymbolicLink())
22
+ return "is a link: give the image file itself";
23
+ if (!found.isFile())
24
+ return "is not a file";
25
+ if (found.size > maxBytes)
26
+ return `has ${found.size} bytes, over ${maxBytes / 1024 / 1024} MiB`;
27
+ const body = await readFile(path);
28
+ const type = imageType(body);
29
+ return type ? { body, type } : "is not a PNG, JPEG, GIF or WebP image";
30
+ }
31
+ /**
32
+ * The image at `path`, with its media type: `undefined` when it is no image
33
+ * file of its own there, a link included, or is over `maxBytes`.
34
+ */
35
+ export async function readImage(path, maxBytes) {
36
+ const image = await inspectImage(path, maxBytes);
37
+ return typeof image === "string" ? undefined : image;
38
+ }
39
+ /** An image an agent hands over with a draft, by its absolute path; otherwise why it is none. */
40
+ export async function readDraftImage(path, maxBytes) {
41
+ return isAbsolute(path)
42
+ ? inspectImage(path, maxBytes)
43
+ : "is not an absolute path";
44
+ }
45
+ /** Image `file` of `folder`, named alone: a path that leaves the folder reads nothing. */
46
+ export async function readImageIn(folder, file, maxBytes) {
47
+ if (basename(file) !== file)
48
+ return undefined;
49
+ return readImage(join(folder, file), maxBytes);
50
+ }
51
+ //# sourceMappingURL=images.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"images.js","sourceRoot":"","sources":["../../src/system/images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD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CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,uCAAuC,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAY,EACZ,QAAgB;IAEhB,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;AACvD,CAAC;AAED,iGAAiG;AACjG,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAY,EACZ,QAAgB;IAEhB,OAAO,UAAU,CAAC,IAAI,CAAC;QACrB,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC;QAC9B,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC;AAED,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,IAAY,EACZ,QAAgB;IAEhB,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC9C,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type Image } from "./images.js";
1
2
  /** An issue's files: a folder with none of them is not an issue. */
2
3
  declare const artifactKinds: readonly ["issue", "spec", "plan"];
3
4
  export type ArtifactKind = (typeof artifactKinds)[number];
@@ -30,7 +31,23 @@ export declare function readArtifact(repository: string, slug: string, kind: Art
30
31
  export declare function readDraft(path: string): Promise<string>;
31
32
  /** The issue's presented spec, as kept; nothing when its spec is not presented. */
32
33
  export declare function readSpecPage(repository: string, slug: string): Promise<unknown | undefined>;
33
- export declare function writeSpecPage(repository: string, slug: string, value: unknown): Promise<string>;
34
+ /**
35
+ * Keeps the presentation of the issue's spec, `value`, and the captures it
36
+ * names, which replace the previous ones whole. Both are written apart, then
37
+ * renamed in: a failure leaves the previous presentation as it was, with
38
+ * nothing Git would see as a change in progress. Returns where they are.
39
+ */
40
+ export declare function writeSpecPage(repository: string, slug: string, value: unknown, captures: {
41
+ name: string;
42
+ body: Uint8Array;
43
+ }[]): Promise<{
44
+ page: string;
45
+ captures?: string;
46
+ }>;
47
+ /** Where capture `file` of the issue's spec page is, absolute. */
48
+ export declare function specCapturePath(repository: string, slug: string, file: string): string;
49
+ /** Capture `file` of the issue's spec page; `undefined` when there is no such image. */
50
+ export declare function readSpecCapture(repository: string, slug: string, file: string, maxBytes: number): Promise<Image | undefined>;
34
51
  /** Where the operator is in the issue's spec validation; nothing before the first answer. */
35
52
  export declare function readSpecAnswers(repository: string, slug: string): Promise<unknown | undefined>;
36
53
  export declare function keepSpecAnswers(repository: string, slug: string, answers: unknown): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { access, mkdir, readdir, readFile, rename, rm, stat, writeFile, } from "node:fs/promises";
3
3
  import { dirname, join } from "node:path";
4
+ import { readImageIn } from "./images.js";
4
5
  /** An issue's files: a folder with none of them is not an issue. */
5
6
  const artifactKinds = ["issue", "spec", "plan"];
6
7
  /** Where the issues are, relative to the repository. */
@@ -13,6 +14,10 @@ export function artifactPath(slug, kind) {
13
14
  function specPagePath(slug) {
14
15
  return join(issuesPath, slug, "spec-page.json");
15
16
  }
17
+ /** `.factory/issues/<slug>/spec-page/`: the captures its spec's presentation shows, kept with it. */
18
+ function capturesPath(slug) {
19
+ return join(issuesPath, slug, "spec-page");
20
+ }
16
21
  /** `.factory/issues/<slug>/spec-answers.json`: where the operator is in its validation, which Git ignores. */
17
22
  function specAnswersPath(slug) {
18
23
  return join(issuesPath, slug, "spec-answers.json");
@@ -100,12 +105,13 @@ async function readJson(repository, path) {
100
105
  throw new Error(`${path} is not JSON`);
101
106
  }
102
107
  }
108
+ const jsonText = (value) => `${JSON.stringify(value, null, 2)}\n`;
103
109
  /** Writes `value` as the JSON file `path` of the repository, replacing it whole. */
104
110
  async function writeJson(repository, path, value) {
105
111
  const target = join(repository, path);
106
112
  await mkdir(dirname(target), { recursive: true });
107
113
  const temporary = `${target}.${randomUUID()}.tmp`;
108
- await writeFile(temporary, `${JSON.stringify(value, null, 2)}\n`);
114
+ await writeFile(temporary, jsonText(value));
109
115
  await rename(temporary, target);
110
116
  return path;
111
117
  }
@@ -113,8 +119,62 @@ async function writeJson(repository, path, value) {
113
119
  export function readSpecPage(repository, slug) {
114
120
  return readJson(repository, specPagePath(slug));
115
121
  }
116
- export function writeSpecPage(repository, slug, value) {
117
- return writeJson(repository, specPagePath(slug), value);
122
+ /**
123
+ * Keeps the presentation of the issue's spec, `value`, and the captures it
124
+ * names, which replace the previous ones whole. Both are written apart, then
125
+ * renamed in: a failure leaves the previous presentation as it was, with
126
+ * nothing Git would see as a change in progress. Returns where they are.
127
+ */
128
+ export async function writeSpecPage(repository, slug, value, captures) {
129
+ const page = join(repository, specPagePath(slug));
130
+ const folder = join(repository, capturesPath(slug));
131
+ const id = randomUUID();
132
+ const written = { page: `${page}.${id}.tmp`, folder: `${folder}.${id}.tmp` };
133
+ const previous = `${folder}.${id}.old`;
134
+ const discard = () => Promise.all([written.page, written.folder].map((path) => rm(path, { recursive: true, force: true })));
135
+ try {
136
+ await mkdir(dirname(page), { recursive: true });
137
+ if (captures.length > 0) {
138
+ await mkdir(written.folder);
139
+ for (const { name, body } of captures)
140
+ await writeFile(join(written.folder, name), body);
141
+ }
142
+ await writeFile(written.page, jsonText(value));
143
+ }
144
+ catch (error) {
145
+ await discard();
146
+ throw error;
147
+ }
148
+ const moved = await rename(folder, previous).then(() => true, (error) => {
149
+ if (error.code === "ENOENT")
150
+ return false;
151
+ throw error;
152
+ });
153
+ try {
154
+ if (captures.length > 0)
155
+ await rename(written.folder, folder);
156
+ await rename(written.page, page);
157
+ }
158
+ catch (error) {
159
+ await rm(folder, { recursive: true, force: true });
160
+ if (moved)
161
+ await rename(previous, folder);
162
+ await discard();
163
+ throw error;
164
+ }
165
+ await rm(previous, { recursive: true, force: true });
166
+ return {
167
+ page: specPagePath(slug),
168
+ ...(captures.length > 0 ? { captures: `${capturesPath(slug)}/` } : {}),
169
+ };
170
+ }
171
+ /** Where capture `file` of the issue's spec page is, absolute. */
172
+ export function specCapturePath(repository, slug, file) {
173
+ return join(repository, capturesPath(slug), file);
174
+ }
175
+ /** Capture `file` of the issue's spec page; `undefined` when there is no such image. */
176
+ export function readSpecCapture(repository, slug, file, maxBytes) {
177
+ return readImageIn(join(repository, capturesPath(slug)), file, maxBytes);
118
178
  }
119
179
  /** Where the operator is in the issue's spec validation; nothing before the first answer. */
120
180
  export async function readSpecAnswers(repository, slug) {
@@ -1 +1 @@
1
- {"version":3,"file":"issues.js","sourceRoot":"","sources":["../../src/system/issues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,EAAE,EACF,IAAI,EACJ,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,oEAAoE;AACpE,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAGzD,wDAAwD;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAErD,6GAA6G;AAC7G,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,IAAkB;IAC3D,OAAO,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;AAC9C,CAAC;AAED,2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M,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC"}
@@ -17,14 +17,6 @@ export declare function keepCheckOutputs(runDir: string, passed: PassedCheck[]):
17
17
  export declare function keepFailedCheck(runDir: string, name: string, output: string): Promise<string>;
18
18
  /** The run's folder where the describing agent puts its screenshots, created empty. */
19
19
  export declare function screenshotsFolder(runDir: string): Promise<string>;
20
- /**
21
- * Screenshot `file` of `folder`, with its media type: `undefined` when it is
22
- * no image file of its own there, a link included, or is over `maxBytes`.
23
- */
24
- export declare function readScreenshot(folder: string, file: string, maxBytes: number): Promise<{
25
- body: Buffer;
26
- type: string;
27
- } | undefined>;
28
20
  /** The answers of a run's review page, as kept: `undefined` before the first, or when they are no JSON. */
29
21
  export declare function readAnswers(runDir: string): Promise<unknown>;
30
22
  /** Keeps the answers of a run's review page, replacing the file whole. */
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { lstat, mkdir, open, readdir, readFile, realpath, rename, writeFile, } from "node:fs/promises";
3
3
  import { basename, dirname, join } from "node:path";
4
+ import { imageType } from "./images.js";
4
5
  /** Keeps `text` in the run's directory, at `path` within it; returns where, absolute. */
5
6
  export async function keepInRun(runDir, path, text) {
6
7
  const file = join(runDir, path);
@@ -38,34 +39,6 @@ export async function screenshotsFolder(runDir) {
38
39
  await mkdir(folder, { recursive: true });
39
40
  return folder;
40
41
  }
41
- /** The media type of a PNG, JPEG, GIF or WebP image, from its first bytes; `undefined` for anything else. */
42
- function imageType(start) {
43
- const ascii = (from, to) => start.subarray(from, to).toString("latin1");
44
- if (ascii(0, 8) === "\x89PNG\r\n\x1a\n")
45
- return "image/png";
46
- if (ascii(0, 3) === "\xff\xd8\xff")
47
- return "image/jpeg";
48
- if (ascii(0, 4) === "GIF8")
49
- return "image/gif";
50
- if (ascii(0, 4) === "RIFF" && ascii(8, 12) === "WEBP")
51
- return "image/webp";
52
- return undefined;
53
- }
54
- /**
55
- * Screenshot `file` of `folder`, with its media type: `undefined` when it is
56
- * no image file of its own there, a link included, or is over `maxBytes`.
57
- */
58
- export async function readScreenshot(folder, file, maxBytes) {
59
- if (basename(file) !== file)
60
- return undefined;
61
- const path = join(folder, file);
62
- const found = await lstat(path).catch(() => undefined);
63
- if (!found?.isFile() || found.size > maxBytes)
64
- return undefined;
65
- const body = await readFile(path);
66
- const type = imageType(body);
67
- return type ? { body, type } : undefined;
68
- }
69
42
  /** The answers of a run's review page, as kept: `undefined` before the first, or when they are no JSON. */
70
43
  export async function readAnswers(runDir) {
71
44
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"run-files.js","sourceRoot":"","sources":["../../src/system/run-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOpD,yFAAyF;AACzF,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAc,EACd,IAAY,EACZ,IAAY;IAEZ,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,oCAAoC;AACpC,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,qFAAqF;AACrF,MAAM,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;YACnB,QAAQ,CAAC,IAAI,CACX,gBAAgB,IAAI,wCAAwC,CAC7D,CAAC;IACN,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clemrig/factory",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "Take a repository's issues from spec to pull request with agents, watch them on a local Kanban, and run the repository's own workflows",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "prepack": "npm run build"
40
40
  },
41
41
  "dependencies": {
42
- "@clemrig/factory-ui": "0.5.0",
43
- "@clemrig/flow": "0.11.0",
44
- "@clemrig/flow-ui": "0.12.0"
42
+ "@clemrig/factory-ui": "0.6.0",
43
+ "@clemrig/flow": "0.12.0",
44
+ "@clemrig/flow-ui": "0.13.0"
45
45
  }
46
46
  }
@@ -3,7 +3,8 @@ content, even when the request, the code or these instructions use another; keep
3
3
  they are.
4
4
 
5
5
  First read the repository's agent instructions: `AGENTS.md` at the root and in each directory you touch.
6
- Follow their conventions and validation guidance. Ignore `.factory/` and never change it.
6
+ Follow their conventions and validation guidance. Ignore `.factory/`, except the files the request names, and never
7
+ change it.
7
8
 
8
9
  The request gives the spec, approved and unchanging, and the plan. The plan is your guide, not a script: its
9
10
  `existing` says what the code already does and must keep doing, and each step's `cases` the situations it must
@@ -11,6 +12,15 @@ handle and test besides its main path. When the code shows a better way than a s
11
12
  in `deviations`. Implement the spec through the plan, tests included, and run the relevant checks yourself before
12
13
  answering.
13
14
 
15
+ When the request gives `prototype`, the spec draws on a throwaway prototype the operator validated. Read it by its
16
+ `commit`, which is in this repository (its `branch` may have moved since, or exist only on origin):
17
+ `git diff HEAD...<commit>` shows what it changed, `git show <commit>:<path>` a file as it was there; its `captures`
18
+ are screenshots of its screens the operator validated. Build what the spec asks as it shows it, with the same
19
+ screens, texts, behavior and existing components, where the spec and the plan do not settle them, and compare what
20
+ you build with its captures in the browser; where they differ, the spec and the plan win. Its code was written
21
+ without the repository's checks: write the change to the repository's standards, tests included, rather than copying
22
+ it, and bring nothing it does beyond the spec.
23
+
14
24
  When the change shows in a web interface, check it in a browser before answering. When the request gives `app`, the
15
25
  application already runs this working tree at `app.url`, with data of its own that you may change freely and that is
16
26
  removed once you answer; its output is in the file `app.logs`, and your commands run with its variables, so that
package/prompts/plan.md CHANGED
@@ -2,9 +2,9 @@ You plan the implementation of an approved spec in this repository. You change n
2
2
  answer in the language of the spec's content, except `commit`, in English, even when the request, the code or
3
3
  these instructions use another; keep code, paths and identifiers as they are.
4
4
 
5
- Before planning, read the repository's agent instructions: `AGENTS.md` at the root and in each directory the
6
- change will touch, and follow them. Ignore `.factory/`: the other issues there are history, not the current
7
- truth, and `.factory/runs/` holds agents' outputs.
5
+ Before planning, read the repository's agent instructions: `AGENTS.md` at the root and in each directory the change
6
+ will touch, and follow them. Ignore `.factory/`, except the files the request names: the other issues there are
7
+ history, not the current truth, and `.factory/runs/` holds agents' outputs.
8
8
 
9
9
  The request gives the issue's slug and its spec. The spec is approved and does not change: plan what it asks,
10
10
  nothing more. When the spec reads more than one way, choose the reading most consistent with the code and record it
@@ -12,6 +12,16 @@ in `interpretations`. When its letter would give a behavior its objective would
12
12
  same and record the conflict in `interpretations`: only whoever approved the spec can depart from it, and the
13
13
  review holds the change to its letter.
14
14
 
15
+ When the request gives `prototype`, the spec draws on a throwaway prototype the operator validated. Read it by its
16
+ `commit`, which is in this repository (its `branch` may have moved since, or exist only on origin):
17
+ `git diff HEAD...<commit>` shows what it changed, `git show <commit>:<path>` a file as it was there, and its notes,
18
+ when it has some (a `PROTOTYPE.md`, say), what was validated. Its `captures` are screenshots of its screens the
19
+ operator validated on the spec's page, files you can open. It shows how the operator saw what the spec asks: its
20
+ screens, texts and behavior, and the existing components it reuses; plan the spec that way where the spec does not
21
+ settle it. The spec still decides: where the prototype differs from it, plan the spec and record the difference in
22
+ `interpretations`; nothing the prototype does beyond the spec is approved. Its code was written without the
23
+ repository's checks: the plan builds what it shows, not its code as it is.
24
+
15
25
  ## Explore first
16
26
 
17
27
  Before writing a step, find out how the code works where the spec changes it. For each area the spec touches,
@@ -22,9 +32,11 @@ such as an application, a layer or a feature, establish from the code itself, no
22
32
  - the conventions the change must follow: texts and their plural forms, errors, API shapes, migrations;
23
33
  - the tests and tools that prove such behavior in this repository.
24
34
 
25
- When the spec touches several areas and you can launch sub-agents, give each, five at most, one area: the spec,
26
- the questions above for that area, and the instruction to report facts with the file and symbol they come from,
27
- to change nothing and to launch no agent itself. Check against the code the facts the plan depends on.
35
+ When the spec touches several areas and you can launch sub-agents, give each, five at most, one area: the spec, the
36
+ request's `prototype` when it gives one, the questions above for that area and the areas the others take, so that
37
+ each reads its own. Tell each to report facts with the file and symbol they come from, and what it looked for without
38
+ finding it; to run the searches and reads that do not depend on each other together, in the same turn; to change
39
+ nothing and to launch no agent itself. Check against the code the facts the plan depends on.
28
40
 
29
41
  ## The plan
30
42
 
package/prompts/review.md CHANGED
@@ -12,6 +12,13 @@ The request gives the spec, the change and the repository's checks, which all pa
12
12
  `diff`; a large one (`large` is true) with `diffFile`, the path of its diff: read the parts you review from it.
13
13
  - `checks` gives each check's command, its duration and `outputFile`, where the run kept what it wrote.
14
14
 
15
+ When the request gives `prototype`, the spec was written from a throwaway prototype the operator validated. Read it
16
+ by its `commit`, which is in this repository (its `branch` may have moved since, or exist only on origin):
17
+ `git diff HEAD...<commit>` shows what it changed, `git show <commit>:<path>` a file as it was there; its `captures`
18
+ are screenshots of its screens the operator validated. Read them to understand what the spec's words describe, the
19
+ screens, texts and behavior they name. The spec remains the measure: what the prototype does beyond the spec is not
20
+ required.
21
+
15
22
  Do not take anything on trust: verify each acceptance criterion in the code and the tests, reading files beyond the
16
23
  diff when needed. Look for unmet criteria, defects, regressions, missing or weak tests, security problems and
17
24
  departures from the repository's conventions. Follow every path the change must handle, failures, interruptions,
@@ -49,10 +56,12 @@ split the whole review between them for your first answer, five at most, and rev
49
56
  keep while you coordinate the others gets less attention than theirs. Each takes one part of the change, such as an
50
57
  application, a layer or a feature, with its checks in a browser when it shows in a web interface; one more, always,
51
58
  takes the paths that cross the parts: failures, interruptions, concurrent requests and recoveries. Give each the
52
- spec, its part, the files concerned, where to read the diff, and the request's `app` and `browser` when it gives
53
- them, with the rules above on servers and data, and tell it to report its findings with their evidence, established
54
- as above, to look for each defect's other occurrences, to change nothing and to launch no agent itself. Check their
55
- reports, then give one answer for the whole change.
59
+ spec, its part, the files concerned, where to read the diff, and the request's `prototype`, `app` and `browser` when
60
+ it gives them, with the rules above on servers and data, and tell it to report its findings with their evidence,
61
+ established as above, to look for each defect's other occurrences, to run the reads, searches and inspection commands
62
+ that do not depend on each other together, in the same turn, but tests and browser checks one at a time, to change
63
+ nothing and to launch no agent itself.
64
+ Check their reports, then give one answer for the whole change.
56
65
 
57
66
  Answer with:
58
67
 
@@ -12,6 +12,24 @@ const opus = {
12
12
  const planner = {
13
13
  ...opus,
14
14
  tools: ["Read", "Grep", "Glob", "Agent"],
15
+ agents: {
16
+ // In place of Claude Code's: one area of the code, read only and reported
17
+ // as facts, on the planner's model and effort; `thinking` would give it
18
+ // its own effort.
19
+ Explore: {
20
+ description:
21
+ "Read-only explorer of one area of the code. Give it the area, the questions to answer about it and the areas other agents take; it answers with facts, each with the file and symbol it comes from.",
22
+ prompt: [
23
+ "You explore one area of this repository for an agent that plans a change, and answer the questions it asks about that area. You change nothing: you only search and read.",
24
+ "Establish each answer from the code itself, not from names or documentation alone: read the whole of what an answer depends on, not only the lines a search matches. Stay in your area; outside it, read only what an answer depends on, such as a function your area calls, and leave the areas other agents take to them.",
25
+ "Run the searches and reads that do not depend on each other together, in the same turn.",
26
+ "Answer with facts, each with the file and symbol it comes from, then what you looked for and did not find, and what you could not establish. Propose no design and no code: the planning agent decides.",
27
+ ].join("\n\n"),
28
+ tools: ["Read", "Grep", "Glob"],
29
+ // As Claude Code's Explore: the planner's request gives what it needs.
30
+ omitClaudeMd: true,
31
+ },
32
+ },
15
33
  timeoutMs: 30 * minutes,
16
34
  } satisfies AgentProfile;
17
35
  // Reads the change and runs what checks it: tests, the application in a
@@ -19,16 +19,25 @@ description of the need. Once the operator agrees, save the issue (see Save).
19
19
 
20
20
  1. Read the repository's agent instructions (`AGENTS.md` at the root and in the directories concerned) and the
21
21
  relevant code. Change nothing.
22
- 2. Ask the operator questions, a few at a time, until you can fill every section without inventing anything.
22
+ 2. When the operator built a prototype for this need (they say so, or the issue names one), it is what they
23
+ validated: write the spec from it, not from what you would design, and ask only about what it leaves open.
24
+ - It must be committed, its notes included (a `PROTOTYPE.md`, say), on a branch named with a slash, such as
25
+ `prototype/<slug>`, and pushed: if it is not, ask the operator to do it, or to let you do it there. The spec
26
+ names that branch and the full id of the commit they validated (see Format).
27
+ - Read it at that commit, before asking anything: its notes, what it changed (`git diff HEAD...<commit>`) and
28
+ its screens. To run it, add a working tree of that commit outside the repository
29
+ (`git worktree add --detach <folder> <commit>`, removed once done) and start it as the repository's
30
+ instructions say, or ask the operator where it already runs; never switch branches in the repository.
31
+ 3. Ask the operator questions, a few at a time, until you can fill every section without inventing anything.
23
32
  Do not ask what the code or the docs already answer. For each question, give its practical consequence
24
33
  and your recommendation.
25
- 3. Ask whether the issue relies on another issue that must be delivered first: its spec assumes behavior that
34
+ 4. Ask whether the issue relies on another issue that must be delivered first: its spec assumes behavior that
26
35
  issue brings. List the issues of `.factory/issues/` that look related, with whether each is delivered (its
27
36
  `plan.md` is on the main branch), and record the operator's answer in Dependencies.
28
- 4. Describe what and why, never how: the run that implements the spec plans the technical work itself.
37
+ 5. Describe what and why, never how: the run that implements the spec plans the technical work itself.
29
38
  Where you chose between real alternatives, write the one you recommend: the presentation shows the others.
30
- 5. Propose the complete spec and wait for the operator's agreement, then save it (see Save).
31
- 6. Present it for the operator to validate it on its page (see Present).
39
+ 6. Propose the complete spec and wait for the operator's agreement, then save it (see Save).
40
+ 7. Present it for the operator to validate it on its page (see Present).
32
41
 
33
42
  Other issues in `.factory/issues/` are history, not the current truth: rely on the code and the docs, and read
34
43
  them only to find the issues this one depends on.
@@ -57,11 +66,19 @@ JSON draft outside the repository, then save it with `--kind page` (see Save):
57
66
 
58
67
  - One change per part of the scope a person would judge on its own; `text` in a few sentences, `**bold**` and
59
68
  `` `code` `` allowed.
60
- - A mockup only for a change that brings or changes an interface:
61
- `{ "caption": "…", "html": "<a whole HTML document>", "width": <320–1600>, "height": <200–4000> }`. It is
62
- shown in a frame without script, network or anything but its own HTML and inline styles: no `<script>`, no
63
- link to a stylesheet, a font or an image (draw them, or use `data:` images). Reproduce the application's look
64
- (read its styles: colors, fonts, components) and mark what is new; keep it under 256 KiB.
69
+ - A mockup only for a change that brings or changes an interface. When the spec's prototype shows it, capture it,
70
+ never draw it: the operator validated that screen. Run the prototype at the spec's commit (see Specify), open the
71
+ state the change describes in a browser (`.factory/node_modules/.bin/playwright-cli`, which `factory init`
72
+ installs: run it with `--help` first, or the browser tools you have) and save a screenshot (PNG, JPEG or WebP,
73
+ 2 MiB at most) beside the draft, outside the repository; give its absolute path,
74
+ `{ "caption": "…", "image": "<path>" }`, and `issue-save` keeps the image beside the spec. When you cannot run
75
+ the prototype or take the screenshot, ask the operator for it. Capture again whenever the spec names another
76
+ commit. Only an interface the prototype does not show is drawn:
77
+ `{ "caption": "…", "html": "<a whole HTML document>", "width": <320–1600>, "height": <200–4000> }`, shown in a
78
+ frame without script, network or anything but its own HTML and inline styles: no `<script>`, no link to a
79
+ stylesheet, a font or an image (draw them, or use `data:` images); under 256 KiB. Reproduce the application's
80
+ existing pages and components from its code and styles and mark what is new; invent no component, text or state
81
+ that neither the application nor the spec has.
65
82
  - A decision for each choice where the spec took one of real alternatives (2 to 5 options), the one it took as
66
83
  `chosen`; none when there was nothing to choose. An `<id>` starts with a lowercase letter, then lowercase
67
84
  letters, digits or hyphens, 40 characters at most.
@@ -112,15 +129,25 @@ delivered is either delivered first or removed from the spec, as the operator de
112
129
 
113
130
  ## Dependencies
114
131
  - <slug of an issue that must be delivered first>
132
+
133
+ ## Prototype
134
+ - Branch: <the prototype's branch>
135
+ - Commit: <the full id of the commit the operator validated>
115
136
  ```
116
137
 
117
- - Exactly these six sections, in this order, with nothing between the title and the first one.
138
+ - Exactly these six sections, in this order, with nothing between the title and the first one; then Prototype,
139
+ only when the spec draws on a prototype, and left out otherwise.
118
140
  - No section is empty: write `None.` when there is nothing to say.
119
141
  - Acceptance criteria contains only `- AC<n>: <criterion>` items, numbered from AC1 without gaps; an indented
120
142
  line continues the criterion above it. Each criterion is a fact that a user, an API client or an operator
121
143
  can check, not an implementation detail.
122
144
  - Dependencies contains only `- <slug>` items, each an issue of `.factory/issues/` other than this one, or
123
145
  `None.`: the run refuses to start until each of them is delivered.
146
+ - Prototype contains `- Branch: <branch>` then `- Commit: <full commit id>`: the commit the operator validated,
147
+ as `git rev-parse` prints it, on a branch named with a slash, which no run takes, and which origin holds. The
148
+ runs read the prototype at that commit and refuse to start without it: keep the branch until the issue is
149
+ delivered, and never rewrite it (commits added on top are fine). To draw on another commit, have the operator
150
+ validate it, then save the spec and its presentation again.
124
151
  - Headings stay in English; the content may be in any language.
125
152
 
126
153
  ## Save
@@ -129,13 +156,16 @@ delivered is either delivered first or removed from the spec, as the operator de
129
156
  2. From the repository, run
130
157
  `factory run issue-save --issue <slug> --kind issue --file <absolute path>` for `issue.md`,
131
158
  `--kind spec` for `spec.md`, or `--kind page` for the spec's presentation (`spec-page.json`).
132
- 3. `Saved .factory/issues/<slug>/<file>` means it is done. Otherwise the command lists every problem: fix
133
- the draft and run it again. It refuses a spec whose issue does not exist yet, a
134
- dependency that is no issue of the repository, and a presentation that does not present the saved spec.
159
+ 3. `Saved .factory/issues/<slug>/<file>` means it is done. Otherwise the command lists every problem: fix the
160
+ draft and run it again. It refuses a spec whose issue does not exist yet, a dependency that is no issue of the
161
+ repository, a prototype origin does not hold, and a presentation that does not present the saved spec or whose
162
+ capture is no image. Each saved file is named, the captures folder included.
135
163
 
136
164
  ## Boundaries
137
165
 
138
- Never write in `.factory/issues/` directly, never commit, and never run `factory run implement`. When the spec
139
- and its presentation are saved, tell the operator the next steps: validate it on its page in `factory ui` (the
140
- Spec link of the issue's card), commit the spec and its `spec-page.json` and push them on the main branch, then
141
- run `factory run implement --issue <slug>`.
166
+ Never write in `.factory/issues/` directly, never commit in the repository (a prototype is committed on its own
167
+ branch, by the operator or with their leave), and never run `factory run implement`. When the spec and its
168
+ presentation are saved, tell the operator the next steps: validate it on its page in `factory ui` (the Spec link
169
+ of the issue's card), commit the spec, its `spec-page.json` and its captures (`spec-page/`) and push them on the
170
+ main branch, then run `factory run implement --issue <slug>`. A prototype's branch stays until the issue is
171
+ delivered; its pull request then says whether it can be removed.