@lchase/kiln 0.0.0-stage → 0.3.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.
@@ -0,0 +1,26 @@
1
+ <!-- factory: prompts/factory/review-code.md -->
2
+
3
+ Kiln runs this factory reviewer inside yak. The working directory is the worktree. There is no job folder, no round folder, and no `.factory/repo.md`; read the repo for conventions. `.factory/lessons.md` applies only when that file is really present.
4
+
5
+ `<main branch>` is the base SHA `{{input.baseRef}}` (the commit this worktree was branched from). Use that SHA wherever the factory instructions say `<main branch>`, including `git diff <main branch>...HEAD`, merge-tree, and ahead-of checks. Do not guess `main`.
6
+
7
+ Your branch is whatever `git branch --show-current` prints. It is `yak/<run-id>`. That is the branch name in this prompt. Do not BLOCK because it is not `factory/...` or `main`.
8
+
9
+ Do not write `review-code.md`. Return JSON `{ "verdict": "PASS" or "CHANGES", "findings": "the rest of that file" }`. `verdict` is the VERDICT line. `spec.md` and `build.md` are the text below, not files. Call the smart-review skill the way the factory instructions say (`smart-review:smart-review`, min mode). Skill is available. There is no `spec.md` path on disk; use the spec text below as the spec. Your previous review is not a separate file.
10
+
11
+ Spec goal: {{spec.goal}}
12
+ Spec design: {{spec.design}}
13
+ Spec acceptance: {{spec.acceptance}}
14
+
15
+ Build ({{build.status}}): {{build.summary}}
16
+
17
+ Verify ran the repo test command. A non-zero exit is a failure:
18
+ exit {{verify.exitCode}}
19
+ stdout: {{verify.stdout}}
20
+ stderr: {{verify.stderr}}
21
+
22
+ Verify stdout and stderr may be truncated to the last 200 lines or 20480 bytes. A leading `[truncated:` line means the head was cut.
23
+
24
+ Use the verify output provided; do not re-run tests, builds, or anything that writes to the working tree. Read-only git and file inspection only.
25
+
26
+ The factory agent instructions follow. Their frontmatter is the original definition. Follow that prose except where it says to re-run tests or builds, or to write a file. Return the JSON above instead of writing the file they name.
@@ -0,0 +1,31 @@
1
+ Kiln runs this investigation inside yak. The working directory is an isolated worktree of the repo at base SHA `{{input.baseRef}}`. That SHA is the commit to inspect. Do not guess a branch name.
2
+
3
+ Explore the tree and answer the questions in the spec. You may run commands and scripts. You must not change product code. Do not create, modify, or delete files. Do not commit, push, or open a pull request. Do not run formatters, package installs, or anything else that writes. Read-only git and file inspection are allowed. This step has no Write or Edit tool.
4
+
5
+ Do not write a findings file. Return JSON with one string field, `markdown`. Kiln stores that markdown after a person approves it, and later jobs read it. The markdown is the whole document, not a fragment.
6
+
7
+ Use these headings, in this order, spelled exactly:
8
+
9
+ # Findings: {{input.title}}
10
+
11
+ ## Questions
12
+
13
+ The questions the spec asks, as a list.
14
+
15
+ ## Answers
16
+
17
+ One subsection per question. State the answer, then the evidence. Evidence is file paths and command output you actually observed in this worktree. Do not invent paths or output. If you did not run a command, do not claim you did.
18
+
19
+ ## Unconfirmed
20
+
21
+ What you could not confirm, and what you looked at. Write "None." when nothing is left open.
22
+
23
+ ## Implications for dependent tickets
24
+
25
+ What a later ticket should rely on, and what it must not assume.
26
+
27
+ Spec title: {{input.title}}
28
+
29
+ {{input.spec}}
30
+
31
+ Launch id: {{input.runNonce}}
@@ -0,0 +1,26 @@
1
+ <!-- factory: prompts/factory/review-security.md -->
2
+
3
+ Kiln runs this factory reviewer inside yak. The working directory is the worktree. There is no job folder, no round folder, and no `.factory/repo.md`; read the repo for conventions. `.factory/lessons.md` applies only when that file is really present.
4
+
5
+ `<main branch>` is the base SHA `{{input.baseRef}}` (the commit this worktree was branched from). Use that SHA wherever the factory instructions say `<main branch>`, including `git diff <main branch>...HEAD`, merge-tree, and ahead-of checks. Do not guess `main`.
6
+
7
+ Your branch is whatever `git branch --show-current` prints. It is `yak/<run-id>`. That is the branch name in this prompt. Do not BLOCK because it is not `factory/...` or `main`.
8
+
9
+ Do not write `review-security.md`. Return JSON `{ "verdict": "PASS" or "CHANGES", "findings": "the rest of that file" }`. `verdict` is the VERDICT line. `spec.md` and `build.md` are the text below. Your previous review is not a separate file.
10
+
11
+ Spec goal: {{spec.goal}}
12
+ Spec design: {{spec.design}}
13
+ Spec acceptance: {{spec.acceptance}}
14
+
15
+ Build ({{build.status}}): {{build.summary}}
16
+
17
+ Verify ran the repo test command. A non-zero exit is a failure:
18
+ exit {{verify.exitCode}}
19
+ stdout: {{verify.stdout}}
20
+ stderr: {{verify.stderr}}
21
+
22
+ Verify stdout and stderr may be truncated to the last 200 lines or 20480 bytes. A leading `[truncated:` line means the head was cut.
23
+
24
+ Use the verify output provided; do not re-run tests, builds, or anything that writes to the working tree. Read-only git and file inspection only.
25
+
26
+ The factory agent instructions follow. Their frontmatter is the original definition. Follow that prose except where it says to re-run tests or builds, or to write a file. Return the JSON above instead of writing the file they name.
@@ -0,0 +1,18 @@
1
+ <!-- factory: prompts/factory/spec-writer.md -->
2
+
3
+ Kiln runs this factory agent inside yak. The working directory is the worktree. There is no `.factory/` job folder and no `.factory/repo.md`; read the repo for conventions. `.factory/lessons.md` applies only when that file is really present.
4
+
5
+ `<main branch>` is the base SHA `{{input.baseRef}}` (the commit this worktree was branched from). Use that SHA wherever the factory instructions say `<main branch>`, including `git diff <main branch>...HEAD`, merge-tree, and ahead-of checks. Do not guess `main`.
6
+
7
+ Your branch is whatever `git branch --show-current` prints. It is `yak/<run-id>`. That is the branch name in this prompt. Do not BLOCK because it is not `factory/...` or `main`.
8
+
9
+ `feature.md` is the task below, not a file. Do not write `spec.md`. Return JSON: `goal` (the Goal paragraph), `design` (Scope, Design, and Deferred), `acceptance` (the acceptance criteria and the Verify commands). Do not write code.
10
+
11
+ Task title: {{input.title}}
12
+
13
+ {{input.description}}
14
+
15
+ Acceptance:
16
+ {{input.acceptance}}
17
+
18
+ The factory agent instructions follow. Their frontmatter is the original definition; follow the prose, and return the JSON above instead of writing the file they name.
@@ -0,0 +1,26 @@
1
+ <!-- factory: prompts/factory/review-ui.md -->
2
+
3
+ Kiln runs this factory reviewer inside yak. The working directory is the worktree. There is no job folder, no round folder, and no `.factory/repo.md` (so there is no `## UI paths` file; look at the diff). `.factory/lessons.md` applies only when that file is really present.
4
+
5
+ `<main branch>` is the base SHA `{{input.baseRef}}` (the commit this worktree was branched from). Use that SHA wherever the factory instructions say `<main branch>`, including `git diff <main branch>...HEAD`, merge-tree, and ahead-of checks. Do not guess `main`.
6
+
7
+ Your branch is whatever `git branch --show-current` prints. It is `yak/<run-id>`. That is the branch name in this prompt. Do not BLOCK because it is not `factory/...` or `main`.
8
+
9
+ This step always runs. The factory instructions below already return PASS when no UI changed. Do not write `review-ui.md`. Return JSON `{ "verdict": "PASS" or "CHANGES", "findings": "the rest of that file" }`. `verdict` is the VERDICT line. `spec.md` and `build.md` are the text below. Your previous review is not a separate file.
10
+
11
+ Spec goal: {{spec.goal}}
12
+ Spec design: {{spec.design}}
13
+ Spec acceptance: {{spec.acceptance}}
14
+
15
+ Build ({{build.status}}): {{build.summary}}
16
+
17
+ Verify ran the repo test command. A non-zero exit is a failure:
18
+ exit {{verify.exitCode}}
19
+ stdout: {{verify.stdout}}
20
+ stderr: {{verify.stderr}}
21
+
22
+ Verify stdout and stderr may be truncated to the last 200 lines or 20480 bytes. A leading `[truncated:` line means the head was cut.
23
+
24
+ Use the verify output provided; do not re-run tests, builds, or anything that writes to the working tree. Read-only git and file inspection only.
25
+
26
+ The factory agent instructions follow. Their frontmatter is the original definition. Follow that prose except where it says to re-run tests or builds, or to write a file. Return the JSON above instead of writing the file they name.
@@ -0,0 +1,26 @@
1
+ <!-- factory: prompts/factory/review-ux.md -->
2
+
3
+ Kiln runs this factory reviewer inside yak. The working directory is the worktree. There is no job folder, no round folder, and no `.factory/repo.md`; read the repo for conventions. `.factory/lessons.md` applies only when that file is really present.
4
+
5
+ `<main branch>` is the base SHA `{{input.baseRef}}` (the commit this worktree was branched from). Use that SHA wherever the factory instructions say `<main branch>`, including `git diff <main branch>...HEAD`, merge-tree, and ahead-of checks. Do not guess `main`.
6
+
7
+ Your branch is whatever `git branch --show-current` prints. It is `yak/<run-id>`. That is the branch name in this prompt. Do not BLOCK because it is not `factory/...` or `main`.
8
+
9
+ Do not write `review-ux.md`. Return JSON `{ "verdict": "PASS" or "CHANGES", "findings": "the rest of that file" }`. `verdict` is the VERDICT line. `spec.md` and `build.md` are the text below. Your previous review is not a separate file.
10
+
11
+ Spec goal: {{spec.goal}}
12
+ Spec design: {{spec.design}}
13
+ Spec acceptance: {{spec.acceptance}}
14
+
15
+ Build ({{build.status}}): {{build.summary}}
16
+
17
+ Verify ran the repo test command. A non-zero exit is a failure:
18
+ exit {{verify.exitCode}}
19
+ stdout: {{verify.stdout}}
20
+ stderr: {{verify.stderr}}
21
+
22
+ Verify stdout and stderr may be truncated to the last 200 lines or 20480 bytes. A leading `[truncated:` line means the head was cut.
23
+
24
+ Use the verify output provided; do not re-run tests, builds, or anything that writes to the working tree. Read-only git and file inspection only.
25
+
26
+ The factory agent instructions follow. Their frontmatter is the original definition. Follow that prose except where it says to re-run tests or builds, or to write a file. Return the JSON above instead of writing the file they name.
@@ -0,0 +1,239 @@
1
+ # One Kiln job, run by yak (@lchase/yak).
2
+ #
3
+ # Faithful to Lawrence Chase's factory plugin v0.7.0 (MIT):
4
+ # https://github.com/lchase/coding-agent-plugins/tree/4c84a2ce7fbde5ac298c0de9f0b90141eac4ed98/plugins/factory
5
+ # skills/factory/SKILL.md (the loop: spec, build, 4 reviews, approver)
6
+ # agents/spec-writer.md model opus
7
+ # agents/builder.md model opus
8
+ # agents/review-security.md model opus
9
+ # agents/review-ux.md model sonnet
10
+ # agents/review-ui.md model sonnet
11
+ # agents/review-code.md model sonnet
12
+ # agents/approver.md model opus
13
+ # The prompt bodies are copied verbatim into prompts/factory/. Each step's
14
+ # prompt file is a Kiln preamble (prompts/kiln/) that maps the factory's
15
+ # job-folder files onto yak artifacts and tells the agent to return JSON
16
+ # instead of writing a file. `kiln tick` appends the factory body and rewrites
17
+ # prompt.file to an absolute path under the kiln directory before launching,
18
+ # because yak resolves prompt.file from the checkout cwd
19
+ # (yak src/steps/agent.ts, path.resolve(cwd, file)).
20
+ #
21
+ # yak 0.6.1 limits this file still works inside:
22
+ # - command.run is not templated. verify runs $KILN_TEST through
23
+ # dist/truncate-output.js ($KILN_VERIFY_WRAPPER). `kiln tick` sets
24
+ # KILN_TEST from repos.<repo>.test. An empty value fails the step. The
25
+ # wrapper keeps the test's exit code and cuts stdout/stderr to the last
26
+ # 200 lines or 20KB, with a leading `[truncated:` line when it cuts.
27
+ # land commits with `git commit -m "kiln: $KILN_TASK_TITLE"`. verify and
28
+ # land need `input` (it carries a per-launch runNonce) so one job cannot
29
+ # cache-hit another. land runs only when approval.decision is approve,
30
+ # and it does not fail when the index is empty. `git add -A` stages every
31
+ # uncommitted path in the worktree.
32
+ # - input.baseRef is the commit the worktree was branched from (full SHA).
33
+ # deliver=local uses checkout HEAD. deliver=pr uses origin/<base>, or the
34
+ # upstream yak/<run-id> tip when the job is stacked. Every preamble maps
35
+ # `<main branch>` to that SHA. The worktree branch is yak/<run-id>.
36
+ # - A loop body does not evaluate skipIf, so the UI reviewer is a real step.
37
+ # review-ui.md itself returns PASS when no UI changed.
38
+ # - A loop-body artifact is not a top-level producer. The approver reads the
39
+ # last verify on rounds.verify; needs: [verify] on the approver is rejected.
40
+ # Reviewers run inside the loop, so they need verify directly. They inherit
41
+ # input (for baseRef) instead of listing it in needs, and the loop's
42
+ # concurrency is 4 so the four reviewers start together.
43
+ name: kiln-feature
44
+ version: "1"
45
+ inputSchema:
46
+ inline:
47
+ type: object
48
+ additionalProperties: false
49
+ properties:
50
+ title: { type: string }
51
+ description: { type: string }
52
+ acceptance: { type: string }
53
+ runNonce: { type: string }
54
+ baseRef: { type: string }
55
+ required: [title, description, acceptance, runNonce, baseRef]
56
+ steps:
57
+ - id: spec
58
+ needs: [input]
59
+ agent:
60
+ model: opus
61
+ prompt:
62
+ file: prompts/kiln/spec.md
63
+ schema:
64
+ inline:
65
+ type: object
66
+ additionalProperties: false
67
+ properties:
68
+ goal: { type: string }
69
+ design: { type: string }
70
+ acceptance: { type: string }
71
+ required: [goal, design, acceptance]
72
+ tools: [Read, Grep, Glob, Bash, Write, Skill]
73
+ produces: spec
74
+
75
+ - id: revise
76
+ needs: [spec]
77
+ loop:
78
+ # A BLOCKED build, a red verify (exitCode != 0), or any CHANGES verdict
79
+ # sends the builder around again. failOn: never on verify is what keeps
80
+ # a red test from failing the run before that can happen. max 2 rounds,
81
+ # then the approver still runs (factory step 5: round 2 done goes to
82
+ # the approver).
83
+ until: 'build.status == "READY" && security.verdict == "PASS" && ux.verdict == "PASS" && ui.verdict == "PASS" && code.verdict == "PASS" && verify.exitCode == 0'
84
+ budget:
85
+ maxIterations: 2
86
+ onExhausted: continue
87
+ concurrency: 4
88
+ body:
89
+ # security, ux, ui, code, and verify are later in this body, so on
90
+ # build they are the previous round. Round 1 leaves them undefined;
91
+ # the prompt's `.field ||` defaults cover findings and verify text.
92
+ # Round 1 leaves verify undefined. A verify that ran with exitCode
93
+ # null was signal-killed, so `verify.exitCode == null` is not labeled
94
+ # round 1. Exit code 0 still renders as 0.
95
+ # `{{ security || "x" }}` does not validate.
96
+ - id: build
97
+ needs: [input, spec, security, ux, ui, code, verify]
98
+ agent:
99
+ model: opus
100
+ prompt:
101
+ file: prompts/kiln/build.md
102
+ schema:
103
+ inline:
104
+ type: object
105
+ additionalProperties: false
106
+ properties:
107
+ summary: { type: string }
108
+ status: { type: string, enum: [READY, BLOCKED] }
109
+ required: [summary, status]
110
+ tools: [Read, Grep, Glob, Bash, Write, Edit, Skill]
111
+ produces: build
112
+
113
+ - id: verify
114
+ needs: [input, build]
115
+ command:
116
+ run: 'node "${KILN_VERIFY_WRAPPER:?KILN_VERIFY_WRAPPER is empty}"'
117
+ failOn: never
118
+ capture: [stdout, stderr, exitCode]
119
+ produces: verify
120
+
121
+ # Build and verify stay in order. These four do not need each other,
122
+ # so concurrency 4 starts them together. They have no Write or Edit.
123
+ # Bash stays, because the factory prompts diff with git. Yak warns
124
+ # that concurrent Bash steps share one cwd. The preambles forbid
125
+ # re-running tests, builds, and any other write; git and file reads
126
+ # stay. input is inherited for baseRef; it is not in needs.
127
+ - id: security
128
+ needs: [spec, build, verify]
129
+ agent:
130
+ model: opus
131
+ context:
132
+ inherit: [input]
133
+ prompt:
134
+ file: prompts/kiln/security.md
135
+ schema:
136
+ inline:
137
+ type: object
138
+ additionalProperties: false
139
+ properties:
140
+ verdict: { type: string, enum: [PASS, CHANGES] }
141
+ findings: { type: string }
142
+ required: [verdict, findings]
143
+ tools: [Read, Grep, Glob, Bash, Skill]
144
+ produces: security
145
+
146
+ - id: ux
147
+ needs: [spec, build, verify]
148
+ agent:
149
+ model: sonnet
150
+ context:
151
+ inherit: [input]
152
+ prompt:
153
+ file: prompts/kiln/ux.md
154
+ schema:
155
+ inline:
156
+ type: object
157
+ additionalProperties: false
158
+ properties:
159
+ verdict: { type: string, enum: [PASS, CHANGES] }
160
+ findings: { type: string }
161
+ required: [verdict, findings]
162
+ tools: [Read, Grep, Glob, Bash, Skill]
163
+ produces: ux
164
+
165
+ - id: ui
166
+ needs: [spec, build, verify]
167
+ agent:
168
+ model: sonnet
169
+ context:
170
+ inherit: [input]
171
+ prompt:
172
+ file: prompts/kiln/ui.md
173
+ schema:
174
+ inline:
175
+ type: object
176
+ additionalProperties: false
177
+ properties:
178
+ verdict: { type: string, enum: [PASS, CHANGES] }
179
+ findings: { type: string }
180
+ required: [verdict, findings]
181
+ tools: [Read, Grep, Glob, Bash, Skill]
182
+ produces: ui
183
+
184
+ - id: code
185
+ needs: [spec, build, verify]
186
+ agent:
187
+ model: sonnet
188
+ context:
189
+ inherit: [input]
190
+ prompt:
191
+ file: prompts/kiln/code.md
192
+ schema:
193
+ inline:
194
+ type: object
195
+ additionalProperties: false
196
+ properties:
197
+ verdict: { type: string, enum: [PASS, CHANGES] }
198
+ findings: { type: string }
199
+ required: [verdict, findings]
200
+ tools: [Read, Grep, Glob, Bash, Skill]
201
+ produces: code
202
+ produces: rounds
203
+
204
+ - id: approver
205
+ needs: [input, spec, rounds]
206
+ agent:
207
+ model: opus
208
+ prompt:
209
+ file: prompts/kiln/approver.md
210
+ schema:
211
+ inline:
212
+ type: object
213
+ additionalProperties: false
214
+ properties:
215
+ decision: { type: string, enum: [APPROVE, ESCALATE] }
216
+ reason: { type: string }
217
+ required: [decision, reason]
218
+ tools: [Read, Grep, Glob, Bash, Write, Skill]
219
+ produces: decision
220
+
221
+ - id: approve
222
+ needs: [input, decision]
223
+ gate:
224
+ schema:
225
+ inline:
226
+ type: object
227
+ additionalProperties: false
228
+ properties:
229
+ decision: { type: string, enum: [approve, reject] }
230
+ required: [decision]
231
+ render:
232
+ inline: 'Approve "{{input.title}}"? Agent decision: {{decision.decision}}. {{decision.reason}}'
233
+ produces: approval
234
+
235
+ - id: land
236
+ needs: [input, approval]
237
+ skipIf: 'approval.decision != "approve"'
238
+ command:
239
+ run: 'git add -A && git diff --cached --quiet || git commit -m "kiln: $KILN_TASK_TITLE"'
@@ -0,0 +1,67 @@
1
+ # One Kiln investigation, run by yak (@lchase/yak).
2
+ #
3
+ # A spike, probe, or research ticket. The agent explores the worktree and
4
+ # returns a findings document. A person approves or rejects it. There is no
5
+ # build, review, verify, or land step, and Kiln does not open a pull request
6
+ # for this workflow, whatever the repo's deliver mode is.
7
+ #
8
+ # The agent artifact is `findings`: `{ "markdown": "<document>" }`.
9
+ # The document uses these headings, in order:
10
+ # # Findings: <title>
11
+ # ## Questions
12
+ # ## Answers (each answer includes evidence: file paths and command output)
13
+ # ## Unconfirmed
14
+ # ## Implications for dependent tickets
15
+ # On approve, Kiln copies that markdown to `<kilnDir>/findings/<jobId>.md`.
16
+ # A later job that depends on this one receives the file as a
17
+ # `## Findings from <title>` section in the spec yak sees.
18
+ #
19
+ # `adapter: "mock"` reads `test/fixtures/kiln-investigation/explore.json`
20
+ # from the checkout. The gate has no fixture.
21
+ # Prompt paths are rewritten to absolute files under the kiln directory
22
+ # before launch, same as workflows/feature.yaml. This prompt has no factory
23
+ # directive; it is stored as itself.
24
+ name: kiln-investigation
25
+ version: "1"
26
+ inputSchema:
27
+ inline:
28
+ type: object
29
+ additionalProperties: false
30
+ properties:
31
+ title: { type: string }
32
+ spec: { type: string }
33
+ runNonce: { type: string }
34
+ baseRef: { type: string }
35
+ required: [title, spec, runNonce, baseRef]
36
+ steps:
37
+ - id: explore
38
+ needs: [input]
39
+ agent:
40
+ model: opus
41
+ prompt:
42
+ file: prompts/kiln/investigation.md
43
+ schema:
44
+ inline:
45
+ type: object
46
+ additionalProperties: false
47
+ properties:
48
+ markdown: { type: string, minLength: 1 }
49
+ required: [markdown]
50
+ # Bash can run read-only commands. File-editing tools are omitted.
51
+ # The prompt forbids any command that writes.
52
+ tools: [Read, Grep, Glob, Bash]
53
+ produces: findings
54
+
55
+ - id: approve
56
+ needs: [input, findings]
57
+ gate:
58
+ schema:
59
+ inline:
60
+ type: object
61
+ additionalProperties: false
62
+ properties:
63
+ decision: { type: string, enum: [approve, reject] }
64
+ required: [decision]
65
+ render:
66
+ inline: "Approve findings for \"{{input.title}}\"?\n\n{{findings.markdown}}"
67
+ produces: approval