pirl-framework-cli 0.0.0-stage → 1.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 (92) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/LICENSE +21 -0
  3. package/README.md +265 -2
  4. package/bundled-framework/files/.agents/evals/layer_record.py +438 -0
  5. package/bundled-framework/files/.agents/evals/tests/test_layer_record.py +264 -0
  6. package/bundled-framework/files/.agents/evals/tests/test_skills.py +210 -0
  7. package/bundled-framework/files/.agents/evals/tests/test_validate_layer_artifact.py +214 -0
  8. package/bundled-framework/files/.agents/evals/validate_layer_artifact.py +415 -0
  9. package/bundled-framework/files/.agents/instructions/implement.instructions.md +343 -0
  10. package/bundled-framework/files/.agents/instructions/layered-task-execution.instructions.md +370 -0
  11. package/bundled-framework/files/.agents/instructions/layout-verification.instructions.md +107 -0
  12. package/bundled-framework/files/.agents/instructions/plan.instructions.md +292 -0
  13. package/bundled-framework/files/.agents/instructions/review.instructions.md +236 -0
  14. package/bundled-framework/files/.agents/instructions/self-evaluation.instructions.md +146 -0
  15. package/bundled-framework/files/.agents/instructions/standalone-and-maintenance.instructions.md +230 -0
  16. package/bundled-framework/files/.agents/roles/backend-developer.role.md +45 -0
  17. package/bundled-framework/files/.agents/roles/business-analyst.role.md +55 -0
  18. package/bundled-framework/files/.agents/roles/code-analyst.role.md +63 -0
  19. package/bundled-framework/files/.agents/roles/code-reviewer.role.md +46 -0
  20. package/bundled-framework/files/.agents/roles/frontend-developer.role.md +51 -0
  21. package/bundled-framework/files/.agents/roles/process-auditor.role.md +62 -0
  22. package/bundled-framework/files/.agents/roles/solution-architect.role.md +53 -0
  23. package/bundled-framework/files/.agents/roles/technical-writer.role.md +68 -0
  24. package/bundled-framework/files/.agents/roles/ux-designer.role.md +46 -0
  25. package/bundled-framework/files/.skills/pirl-implement/SKILL.md +115 -0
  26. package/bundled-framework/files/.skills/pirl-implement/assets/implementation-record-template.md +22 -0
  27. package/bundled-framework/files/.skills/pirl-implement/references/implementation-record-format.md +41 -0
  28. package/bundled-framework/files/.skills/pirl-implement/scripts/add_implementation_record.py +58 -0
  29. package/bundled-framework/files/.skills/pirl-implement/scripts/new_layout_run.py +51 -0
  30. package/bundled-framework/files/.skills/pirl-plan/SKILL.md +100 -0
  31. package/bundled-framework/files/.skills/pirl-plan/assets/plan-template.md +48 -0
  32. package/bundled-framework/files/.skills/pirl-plan/references/plan-format.md +65 -0
  33. package/bundled-framework/files/.skills/pirl-plan/scripts/new_plan.py +93 -0
  34. package/bundled-framework/files/.skills/pirl-review/SKILL.md +106 -0
  35. package/bundled-framework/files/.skills/pirl-review/assets/review-template.md +92 -0
  36. package/bundled-framework/files/.skills/pirl-review/references/review-format.md +70 -0
  37. package/bundled-framework/files/.skills/pirl-review/scripts/new_review.py +83 -0
  38. package/bundled-framework/files/AGENTS.md +303 -0
  39. package/bundled-framework/files/CONTEXT.md +187 -0
  40. package/bundled-framework/files/LICENSE +21 -0
  41. package/bundled-framework/files/README.md +170 -0
  42. package/bundled-framework/files/gitignore.pirl-bundled +12 -0
  43. package/bundled-framework/manifest.json +45 -0
  44. package/dist/bin/main.js +128 -0
  45. package/dist/bin/pirl.js +6 -0
  46. package/dist/commands/dispatch.js +57 -0
  47. package/dist/commands/registry.js +39 -0
  48. package/dist/core/clipboard.js +70 -0
  49. package/dist/core/config.js +73 -0
  50. package/dist/core/exec.js +32 -0
  51. package/dist/core/paths.js +34 -0
  52. package/dist/core/targetRepo.js +22 -0
  53. package/dist/doctor/doctor.js +95 -0
  54. package/dist/engine/agentMerge.js +71 -0
  55. package/dist/engine/agents.js +67 -0
  56. package/dist/engine/attachments.js +251 -0
  57. package/dist/engine/claudeQuota.js +62 -0
  58. package/dist/engine/claudeRunner.js +118 -0
  59. package/dist/engine/claudeStream.js +205 -0
  60. package/dist/engine/hubData.js +176 -0
  61. package/dist/engine/permissions.js +67 -0
  62. package/dist/engine/pricing.js +24 -0
  63. package/dist/engine/protocol.js +98 -0
  64. package/dist/engine/run.js +527 -0
  65. package/dist/engine/runStore.js +67 -0
  66. package/dist/engine/types.js +3 -0
  67. package/dist/hub/framework.js +13 -0
  68. package/dist/hub/hub.js +125 -0
  69. package/dist/hub/services.js +38 -0
  70. package/dist/hub/update.js +261 -0
  71. package/dist/providers/claude.js +62 -0
  72. package/dist/providers/index.js +17 -0
  73. package/dist/providers/types.js +1 -0
  74. package/dist/ui/App.js +849 -0
  75. package/dist/ui/browse.js +144 -0
  76. package/dist/ui/components/Header.js +54 -0
  77. package/dist/ui/components/Input.js +76 -0
  78. package/dist/ui/components/Lines.js +50 -0
  79. package/dist/ui/components/Panels.js +73 -0
  80. package/dist/ui/content.js +225 -0
  81. package/dist/ui/frameworkConsole.js +541 -0
  82. package/dist/ui/inputEditor.js +86 -0
  83. package/dist/ui/layout.js +36 -0
  84. package/dist/ui/lines.js +15 -0
  85. package/dist/ui/listOverlay.js +97 -0
  86. package/dist/ui/runView.js +305 -0
  87. package/dist/ui/session.js +1 -0
  88. package/dist/ui/terminalInput.js +45 -0
  89. package/dist/ui/text.js +58 -0
  90. package/dist/ui/theme.js +139 -0
  91. package/dist/ui/ticker.js +48 -0
  92. package/package.json +67 -4
@@ -0,0 +1,370 @@
1
+ ---
2
+ name: "Layered Task Execution Instructions"
3
+ description: "Defines the boundaries between Plan, Implement, Review and other kinds of work, the assignment principles, and the shared contracts: verification by reasoning, functional tests, shared snapshots and older records, self-evaluation and improvement, temporary-resource cleanup."
4
+ applyTo: ".agents/instructions/**/*,.skills/**/*"
5
+ metadata:
6
+ id: ".agents/instructions/layered-task-execution"
7
+ kind: "instruction"
8
+ version: "2.3.0"
9
+ status: "active"
10
+ ---
11
+
12
+ # Layered Task Execution Instructions
13
+
14
+ ## Scope and sources of decisions
15
+
16
+ This contract routes work through the three layers Plan, Implement and Review
17
+ and holds their shared rules. The current request and the permissions the
18
+ user has granted decide the scope; AI Agent roles supply expertise and do not
19
+ add product goals or a new approval round on their own.
20
+
21
+ [AGENTS.md](../../AGENTS.md) owns the core rules, the structure, how the kind
22
+ of work is chosen, the role catalog with the delegation rules and how the target
23
+ repository is chosen; role files own each role's expertise; the router owns the
24
+ boundaries between kinds of work, the assignment principles and the shared
25
+ contracts; the [standalone and maintenance instructions](standalone-and-maintenance.instructions.md) own standalone
26
+ tasks, framework maintenance, the framework structure and the role catalog; layer
27
+ contracts own the roles' responsibilities at the layer, the decisions and the
28
+ content of the output; each layer's skill in `.skills/` owns the run
29
+ procedure, the output format and the helper scripts.
30
+ Fix things where the decision is owned; do not copy a process into several files.
31
+
32
+ The current handoff schemas are `pirl-plan/v1` and `pirl-review/v1`. Other
33
+ schemas are not handoff inputs; do not create migrations or readers for old
34
+ schemas.
35
+
36
+ ## Choosing a layer
37
+
38
+ The kind of work is chosen per [Choosing a layer](../../AGENTS.md#choosing-a-layer)
39
+ in `AGENTS.md`, which every host loads; this router holds the boundaries and
40
+ shared contracts that apply once the kind of work is chosen. Standalone tasks
41
+ and framework maintenance are in the
42
+ [standalone and maintenance instructions](standalone-and-maintenance.instructions.md), read only in the cases that
43
+ file lists.
44
+
45
+ ## AI Agent roles and assignment
46
+
47
+ The [role catalog](standalone-and-maintenance.instructions.md#role-catalog) and the
48
+ [constraints that keep roles separate from skills](standalone-and-maintenance.instructions.md#constraints-that-keep-roles-separate-from-skills)
49
+ live in the standalone and maintenance instructions, the delegation rules in
50
+ [AGENTS.md](../../AGENTS.md#ai-agent-roles); this section holds the assignment
51
+ principles.
52
+
53
+ ### Assignment principles
54
+
55
+ For all three layers, together with the delegation rules in AGENTS.md:
56
+
57
+ - The coordinator (the Agent receiving the request from the user) is
58
+ responsible for the final result: it assigns work and merges results by
59
+ evidence, not by how many roles agree.
60
+ - Roles that do not need each other's results run in parallel; a role that
61
+ needs another role's result runs after that role (`process-auditor` runs after
62
+ the layer's output is settled). The coordinator does not do the delegated
63
+ work itself.
64
+ - When delegating, pass the role file, the role's row in the layer file's table
65
+ (plus every row that row refers to for its completion condition), sources,
66
+ constraints, the settled direction and the part to examine; do not hide the
67
+ solution and do not impose the conclusion.
68
+ - Self-perform (`mode: self`) only when the host has no mechanism to create
69
+ agents in the session or the call to create an agent fails. The coordinator
70
+ then takes on each role in turn in the layer's order and records the concrete
71
+ reason in the record's `summary` and in the layer's output. Lack of
72
+ delegation does not block the work.
73
+ - A role description does not prove an independent agent. To keep a role
74
+ independent of drafts or existing conclusions of the same run (written by the
75
+ coordinator or another role), leave them out of the assignment and state that
76
+ the paths holding them must not be read, or place them outside the area the
77
+ agent can read. Until that is ensured, record each role's actual level of
78
+ independence in the output. Self-checking is recorded as self-checking; do
79
+ not claim independent challenge or verification that did not happen.
80
+ - A reviewer outside the run's role team (another host tool or agent, not in
81
+ the role catalog) that a role consulted while working is part of that role's
82
+ actual level of independence, even when independence from drafts was
83
+ ensured. The assignment asks the role to report every consultation; the
84
+ coordinator records each role that consulted one in the run's output. That
85
+ opinion is not a source of evidence and does not replace the role's reasoning
86
+ on the sources the router allows.
87
+
88
+ ## Runtime Neutrality
89
+
90
+ The framework does not choose or require a provider, model, reasoning effort or
91
+ host. Do not infer from a missing tool or a skipped test that a runtime must be
92
+ installed or a new operating system supported. Only conditions needed for the
93
+ assigned result can block that part. A host without a mechanism to create
94
+ agents does not block the work: the coordinator performs the roles and states
95
+ the reason, per the
96
+ [assignment principles](#assignment-principles).
97
+
98
+ ## Verification by reasoning
99
+
100
+ This rule applies to the Plan → Implement → Review chain of development work.
101
+ Work in the chain covers implementing product source code (with accompanying
102
+ documentation in the target repository), creating/updating the repository's
103
+ context documentation, and writing, updating and running functional tests under
104
+ the [FUT rule](#functional-tests-fut-rule) when a REQ/specification needs them. Building, running the application/
105
+ database/browser for acceptance, measuring performance or load, running tests
106
+ outside FUT, building new harnesses or verification scripts, deploying and
107
+ releasing belong to the user's build/test/release stage, outside the task
108
+ lifecycle: that stage produces no evidence for the framework and hands no
109
+ results back to the task. Defects the user sees there are sent as an
110
+ independent fix request, which is a new task. The only exception is
111
+ [layout verification with mocks](layout-verification.instructions.md) during an
112
+ Implement run.
113
+
114
+ Verifying an implementation result is the agent's reasoning: read the diff
115
+ and the source, trace the execution path from the entrypoint through callers,
116
+ guards and write/read operations to the final state, check each `Required logic`
117
+ of the QG, pick a counterexample or failure branch that could refute it,
118
+ challenge competing explanations, then conclude `PASS|FAIL|BLOCKED` with
119
+ sources. Reading files, diffs, git history or searching gathers sources for
120
+ the reasoning; it is not a verification run. Test/build/run results, whether
121
+ already in the repository, CI, an old report or from the test run under FUT,
122
+ are not a baseline or PASS/FAIL evidence for a QG: a red test must be explained
123
+ from the source, and a green test only proves the cases it ran.
124
+
125
+ Sources of evidence for a QG, for every role in all three layers:
126
+
127
+ - Allowed: file contents, diffs, git history, search results over the source
128
+ and documentation; for UI QGs, also the screenshots and measurements of
129
+ [layout verification with mocks](layout-verification.instructions.md) (bounding
130
+ boxes, computed styles, scroll-area sizes of rendered elements in each state).
131
+ - Not evidence, whether run inside or outside the repository: scripts,
132
+ harnesses or probes written to verify (bulk value comparisons, counting
133
+ differing pixels between two images, computing on the reader's behalf); using
134
+ a browser or runtime to force logic branches, emulate features, measure
135
+ timing or check listener removal; builds, typechecks, lint and other static
136
+ analysis tools; test results. Test results under FUT are stated next to the
137
+ reasoning and do not become an evidence line of a QG.
138
+ - Calculations needed for the reasoning (ratios, unit conversions, formulas)
139
+ are written with the formula and the input values taken from the source, so
140
+ readers can check them themselves.
141
+
142
+ Per layer:
143
+
144
+ - Plan creates no task, step, REQ, QG or allowed path for work of the user's
145
+ stage; tests are assigned only under FUT. If the specification has a goal in
146
+ that stage, write one line saying it belongs to the user's build/test/release
147
+ stage. Planning roles investigate by reading the source, documentation, git
148
+ history and existing records; they do not build harnesses or measuring tools
149
+ and do not run the application or a browser, unless the user asks for a
150
+ root-cause investigation (paragraph below).
151
+ - Implement does not build, typecheck or lint and does not run the application
152
+ for acceptance; it only writes, updates and runs tests under FUT, and when the
153
+ diff changes the UI it verifies layout with mocks per the [layout verification instructions](layout-verification.instructions.md). Do not record
154
+ work of the user's stage as `BLOCKED` or as remaining risk of the task; only
155
+ list briefly what moves to that stage.
156
+ - Review does not build and does not create or run tests or mocks; it does not
157
+ open a FIND/RISK/BLOCK because of missing tests, not having built/run, or
158
+ red/green tests. Each conclusion is proven or refuted by reasoning on the
159
+ source; tests in the diff that violate FUT are a defect to fix under the
160
+ Review contract. For a diff that changes the UI, Review reads Implement's
161
+ screenshots and layout verification summary per the [layout verification instructions](layout-verification.instructions.md).
162
+ - No layer asks the user for build/test/release results, measurements,
163
+ screenshots or operational data for a task to be `implemented`, PASS or
164
+ closed. Do not put them in `Authorization condition`, `Next allowed owner/layer`,
165
+ a confirmation checkpoint, `awaiting_confirmation` or the task's open-items
166
+ list; do not hold a task or report waiting for them. A task ends when its own
167
+ QGs have been concluded by reasoning. Layout screenshots produced by the
168
+ Implement run itself per the [layout verification instructions](layout-verification.instructions.md) are not data supplied by the user.
169
+
170
+ Commands the user requests run in every layer: when the user explicitly asks
171
+ for a command or check, run exactly the requested part in that run and report
172
+ the result separately; the result does not replace QG reasoning and does not
173
+ extend to other commands. A request to investigate the root cause of a bug/issue
174
+ lets the role responsible for the investigation reproduce the defect in that
175
+ run: run commands, related tests, the application or small test data at the
176
+ boundary that causes the defect to tell hypotheses apart. Stop once the cause
177
+ has been distinguished; the reproduction result is diagnostic evidence, not a
178
+ QG baseline, and does not entail running the whole system.
179
+
180
+ The Plan/report validator commands, the `layer_record.py` commands, the
181
+ framework check commands after self-improvement and the `git status` sweep
182
+ during cleanup are contractual handoff procedures; they still run as
183
+ specified and are not product verification. Instructions to run, measure or
184
+ reproduce in a repository's documentation apply only when the user assigns
185
+ that work directly (including as a standalone task) or asks for a root-cause
186
+ investigation; instructions to write/run tests apply within the limits of FUT;
187
+ instructions to capture layout apply per the layout verification with mocks
188
+ section; outside those cases, use the same mechanism of reasoning on the source.
189
+
190
+ ## Functional tests (FUT rule)
191
+
192
+ Applies to all writing, updating and running of tests, inside and outside the
193
+ three layers. Tests that are created or updated must be functional tests based
194
+ on the REQ/specification. If the user explicitly asks for something else,
195
+ follow that request.
196
+
197
+ - Source: each test traces back to a REQ or specification item of the
198
+ functionality under development, or of functionality affected by it.
199
+ "Affected" must be grounded in the source: a call path, contract or shared
200
+ data that the change touches; do not infer it from module names, the
201
+ existence of a test or a wish to "be safe".
202
+ - Content: assert functional behavior observable at the functionality's
203
+ contract (input → outcome/state, refusal/failure branches the specification
204
+ names). Do not lock in implementation details, do not use the
205
+ implementation's algorithm as the expected result, and do not assert things
206
+ the specification does not require (wording, order, timing, format) in a way
207
+ that blocks a correct result.
208
+ - Extent: only enough tests to tell right from wrong for the assigned behavior.
209
+ Do not add combinations, edge cases, performance or platforms the
210
+ specification does not require, do not test the same behavior twice, and do
211
+ not spread to unrelated functionality. If an existing test already protects
212
+ that behavior, update it instead of writing a new one.
213
+ - Updates: tests of affected functionality that still assert the old behavior
214
+ are fixed to the new logic; tests that only served a removed flow are deleted.
215
+ - Running: run only the tests of the functionality under development and the
216
+ affected functionality, selected by file, class or test name, with the
217
+ command the target repository's context documentation gives. Never run tests
218
+ of unrelated functionality or the whole suite/system, even when you believe
219
+ the change has no impact. Compilation performed by that test command itself
220
+ is part of the run, not a separate build.
221
+ - Results: a run only proves the cases that ran. A red test is explained from
222
+ the source (wrong product or wrong test) before fixing the right side; in the
223
+ Plan → Implement → Review chain, test results are not a QG baseline.
224
+
225
+ ## Shared snapshots and older records
226
+
227
+ Applies to every layer when drawing conclusions about the source, the
228
+ documentation or an older record (Implementation Record, report, record).
229
+ Separate three things: the current source, what the record states, and the
230
+ changes between those two points in time.
231
+
232
+ - When the current source differs from what an older record states, that only
233
+ proves the source changed after the record; it does not prove the record was
234
+ wrong when written. Treat the record as wrong only when a time-stamped source
235
+ (a capture, a diff, a commit, a measurement) shows the statement was wrong at
236
+ the time it was written; otherwise record the mismatch as a change that
237
+ happened after that record.
238
+ - A change in the snapshot that no Implementation Record of the package
239
+ records (not in any task's `changed_paths`) is an unowned change. State it in
240
+ the run's output with its path and its effect on the conclusions; do not
241
+ attribute it to any task or role, and do not use it as grounds for a role's
242
+ issue. The user assigns an Implement run or a standalone task to record it.
243
+ - When several tasks of a package share one snapshot (the same commit, or the
244
+ same set of changes that cannot be separated by task), attribute a mismatch
245
+ (a broken QG, a wrong documentation sentence, a value that does not match) to
246
+ the task that made it wrong, in run order: rebuild the state after each task
247
+ from the base revision, that task's REQs and its `changed_paths`. Something
248
+ that was still right when a task completed and only became wrong after a
249
+ change belonging to a later task's REQ is a mismatch of the later task, even
250
+ when the earlier task wrote or synced it. Rewriting a whole file does not make
251
+ a task own every sentence of the file after another task changes what the
252
+ sentence describes. When the source, diffs and records are not enough to
253
+ separate the order, record the conclusion as an inference with its basis.
254
+
255
+ Review applies these rules to conclude QGs and attribute issues to Implement
256
+ roles per the [Inputs and permissions section](review.instructions.md#inputs-and-permissions);
257
+ Implement applies the first rule when correcting an older record, per the
258
+ [Recording results section](implement.instructions.md#recording-results).
259
+
260
+ ## Self-evaluation and improvement
261
+
262
+ Each Plan, Implement or Review run (including repair runs and every Review
263
+ round) self-evaluates and improves the framework before handoff, whether the
264
+ result is PASS, FAIL or blocked. Standalone tasks and framework maintenance do
265
+ not apply this section.
266
+
267
+ ### Timing and evaluator
268
+
269
+ - At the start of the run, the coordinator runs
270
+ `python -B .agents/evals/layer_record.py start` and keeps the returned
271
+ `framework_ref`: the Hub commit and the hashes of framework files that differ
272
+ from that commit. This is the version of the rules the run applies.
273
+ - After the layer's output is settled and before cleanup,
274
+ [`process-auditor`](../roles/process-auditor.role.md) evaluates the run:
275
+ every role that took part and the coordinator itself (choosing the team,
276
+ assigning work, merging results). At Review, `process-auditor` also
277
+ re-evaluates the roles of the reviewed Implement run per the
278
+ [Evaluations section](review.instructions.md#evaluations-assessing-implement-roles).
279
+ - Delegate `process-auditor` to a separate agent per the
280
+ [assignment principles](#assignment-principles) and record
281
+ `mode: agent`. Only when the host has no tool to create sub-agents or the call
282
+ fails does the coordinator self-evaluate, record `mode: self` and state that
283
+ reason in `summary`.
284
+
285
+ ### Issues, improvements and the record
286
+
287
+ `process-auditor` classifies each issue by cause, applies the improvements and
288
+ writes the run's record per the
289
+ [self-evaluation instructions](self-evaluation.instructions.md), which it reads
290
+ in full; the coordinator reads them only when it self-evaluates in `mode: self`.
291
+
292
+ Output issues (product source, Plan, report) are also returned to the owning
293
+ role to fix within the run, under the layer's contract and limits (for example
294
+ Implement's two-repair limit). `process-auditor` only edits framework files.
295
+
296
+ ### Reporting
297
+
298
+ The run's final response has a "Self-improvement" section: the `record_id`,
299
+ then for each applied improvement the issue, cause, file and section edited,
300
+ old → new version, and a summary of the change; or a single sentence "no issues
301
+ found". In `mode: self`, the `record_id` is the maintenance record that
302
+ supersedes the self-evaluation record. An improvement pending the user for
303
+ reason `safety` is described in the "Self-improvement" section, and the decision
304
+ about it is one point of "Needs confirmation" per the
305
+ [Self-evaluation when `mode: self`](self-evaluation.instructions.md#self-evaluation-when-mode-self) section.
306
+ An improvement pending for reason `repository` is described in the
307
+ "Self-improvement" section and offered as one point of "Proposals"
308
+ ([CONTEXT.md](../../CONTEXT.md#5-closing-block-needs-confirmation-and-proposals)):
309
+ the user assigns it as a standalone task in the target repository.
310
+
311
+ ## Cleaning up temporary resources before handoff
312
+
313
+ This rule applies to every Plan, Implement and Review layer, standalone tasks
314
+ and framework maintenance. It does not change how work is routed. The
315
+ role/agent that creates temporary resources must clean them up itself; the
316
+ coordinator is responsible for checking the whole run, including work
317
+ delegated to sub-agents. Do not push cleanup to a later layer or wait for the
318
+ user to remind you. PASS, FAIL, blocked or cancelled, everything no longer
319
+ needed must be cleaned up before handing off the corresponding result.
320
+
321
+ - The mandatory cleanup scope is the Git-committable area of the Hub and of
322
+ each target repository used: tracked files and untracked files not excluded
323
+ by `.gitignore`. Paths ignored by Git (for example `.tmp/` at the Hub root,
324
+ `node_modules/`, build directories) and locations outside the repository are
325
+ not committed and are not part of the cleanup duty; they may be kept for a
326
+ later run. The `.tmp/layout-snapshots/` directory of
327
+ [layout verification with mocks](layout-verification.instructions.md) is handoff
328
+ output and is always kept.
329
+ - When creating temporary files, directories or sessions in the committable
330
+ area, keep their paths/owners in the working context; do not create extra
331
+ manifests or cleanup logs just to track them. Run Python tools with
332
+ `python -B` to avoid `__pycache__`.
333
+ - In that area, delete as soon as their purpose is served: probe scripts, input
334
+ drafts, images, traces, logs, caches and the run's own temporary directories.
335
+ Everywhere, close the browser/temporary processes the run started once they
336
+ are no longer needed; do not stop pre-existing shared sessions or services
337
+ that are output the user needs to keep using.
338
+ - Before deleting raw evidence, save the trigger, reproduction steps, runtime,
339
+ measurements and conclusions needed into the official output under the
340
+ applicable contract. Keep source, user inputs, Plans, reports and records.
341
+ Keep raw files only when the user asks or when they are a defined handoff
342
+ output; do not use possible reuse as an excuse to keep clutter. Do not leave
343
+ required references pointing to temporary files about to be deleted, to paths
344
+ ignored by Git or to locations outside the repository, because they do not go
345
+ with commits. Plan packages with their Review reports and self-evaluation
346
+ records are the exception: they are local by design, ignored by Git
347
+ ([AGENTS.md](../../AGENTS.md#git)), and refer to each other by path or
348
+ `record_id`.
349
+ - Verify ownership and the absolute path before deleting, using specific
350
+ targets. Do not delete the whole TEMP, run a broad `git clean`, or treat every
351
+ untracked file as clutter. For resources with an unclear owner, verify first;
352
+ do not delete by mistake to reach a clean state. Sub-agents clean up their
353
+ own part and report exactly what remains if they hit a real error; the
354
+ coordinator takes it over and handles it in the same run.
355
+ - After the last verification command that can regenerate files, sweep
356
+ `git status --short` of the Hub and each target repository used: every remaining change
357
+ or untracked file must be handoff output or a pre-existing user change.
358
+ Claim completion only after cleaning up and checking again. If a file is
359
+ locked or permissions are genuinely missing, clean up what can be cleaned,
360
+ report the path, cause, owner and the steps to resolve it; keep the cleanup
361
+ duty open and report the product result separately, without pretending it is
362
+ clean or changing the QGs.
363
+
364
+ ## Finishing and confirmation
365
+
366
+ Finish after delivery and cleanup of temporary resources under the shared
367
+ contract above; report separately the result, evidence and what is still
368
+ missing for each part. Keep the permissions already granted and do not ask for
369
+ routine confirmation again. Next work that belongs to another task/layer needs
370
+ a corresponding instruction; do not start it just because a report proposes it.
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: "Layout Verification Instructions"
3
+ description: "How an Implement run captures and checks layout with mocks when its diff changes what the user sees, and how Review reads that result; read only when the condition in the Implement contract holds."
4
+ applyTo: ".agents/instructions/layout-verification.instructions.md"
5
+ metadata:
6
+ id: ".agents/instructions/layout-verification"
7
+ kind: "instruction"
8
+ version: "1.0.0"
9
+ status: "active"
10
+ ---
11
+
12
+ # Layout verification with mocks
13
+
14
+ Read this file only when the condition in the
15
+ [Implement contract](implement.instructions.md#layout-verification-with-mocks)
16
+ holds: an Implement run whose diff changes what the user sees, or a Review of
17
+ such a run. Who captures, when, and the condition itself stay in that contract.
18
+
19
+ - **What:** run the frontend in development mode and answer every API call with
20
+ mocks right in the browser; no backend, database, build or typecheck. Drive
21
+ to each state the diff creates or changes, including error branches and
22
+ input validation errors, then capture each state in every UI language, at
23
+ the desktop and mobile viewports that the target repository's context
24
+ documentation ([AGENTS.md](../../AGENTS.md#target-repository)) specifies. If the documentation
25
+ does not specify them, take the languages from the i18n configuration and the
26
+ viewports from the repository's CSS breakpoints, and record the set of
27
+ viewports/languages used. When the diff changes the size or number of
28
+ elements in a row or frame of constrained width (navigation bar, toolbar, row
29
+ of cards), add viewports on both sides of every breakpoint threshold that
30
+ affects that row or frame (per the context documentation or the CSS), and
31
+ measure in the browser the bounding boxes of the frame and of each child
32
+ element: children stay inside the frame and do not overlap, compared with the
33
+ same measurements in the state without the diff; screenshots at the main
34
+ viewports are not enough to conclude that. Also check what screenshots cannot
35
+ show: text in the right language, elements inside the viewport, no horizontal
36
+ scrolling, focus and the Esc key when dialogs stack, the page scrolls after
37
+ closing. This approach is for web UIs served by a dev server; for other UIs
38
+ (extensions, native apps) the layout part is `BLOCKED` with an owner, without
39
+ improvising a means. Tools, how to run a stable server and known environment
40
+ obstacles belong in the tooling notes of the target repository's context
41
+ documentation ([AGENTS.md](../../AGENTS.md#target-repository)), not in the
42
+ framework.
43
+ - **State without the diff:** the post-diff capture of the preceding task in
44
+ the same package, when that capture covered exactly the screens and
45
+ viewports to compare. Otherwise, build and capture separately the source
46
+ right before the task's changes: the base commit plus every uncommitted
47
+ change that does not belong to the task (from other runs, recorded or not).
48
+ If the working tree has no such uncommitted changes, export the base commit
49
+ into the run's temporary directory (for example `git archive <revision>` into
50
+ `.tmp/`); if it has them, exporting the commit is not enough, so copy the
51
+ working tree intact (except `.git`) into a temporary directory before the task
52
+ edits it, or export the base commit and reapply exactly those changes. Do not
53
+ use stash, checkout or reset on the working repository
54
+ ([safety rules](../../AGENTS.md#safety)). Record in
55
+ `layout_verification` the base commit and the uncommitted changes counted in
56
+ the base; the Plan does not describe how to build this base.
57
+ - **Where:** mock scripts, screenshots and the results table go in
58
+ `.tmp/layout-snapshots/<plan-set>/<task-id>/<YYYYMMDD-HHmmss>/` at the Hub root
59
+ (ignored by Git), whatever directory holds the Plan; the `pirl-implement` skill's
60
+ helper script creates it. Each run gets a new directory; do not delete or
61
+ overwrite earlier runs. This directory is handoff output and is kept; dev servers,
62
+ browsers and temporary profiles are still stopped or deleted per the [cleanup
63
+ section](layered-task-execution.instructions.md#cleaning-up-temporary-resources-before-handoff).
64
+ - **Role as evidence:** the screenshots and measurements of the checks in the
65
+ What section are mandatory evidence for the layout part; they accompany, and
66
+ do not replace, QG reasoning on the source. This run does not extend to
67
+ builds, typechecks, tests outside FUT, a real backend, real devices or
68
+ releases; those still belong to the user's stage. The verification role treats the screenshots as a source when
69
+ concluding UI QGs and does not run anything itself. Each failed check is
70
+ compared with the same scenario in the state without the diff (an unchanged
71
+ screen or route); only defects caused by the diff are FAIL. A wrong layout
72
+ caused by the diff (overflow, overlap, wrong language, missing state) is a
73
+ FAIL returned to `frontend-developer`, under the same two-repair limit of
74
+ Implement; pre-existing defects are recorded where the project keeps known
75
+ gaps and in the summary, and do not block the task. A failed check caused by
76
+ the diff that the Plan excluded from scope with a REQ naming exactly that
77
+ behavior and the viewport range, together with a known-gaps entry, is not a
78
+ FAIL of the task but is still a failed check: `layout_verification` lists it
79
+ with the REQ and its cause (the diff), and `residual_risk` states the impact;
80
+ if the Plan did not exclude it, it is a FAIL. When no usable browser engine is
81
+ available, the layout part is `BLOCKED` with an owner. A diff that changes the
82
+ UI without this result cannot be recorded as `implemented`.
83
+ - **Differences outside the checks:** a difference between the base and the
84
+ post-diff state where bounding boxes, computed styles and scroll areas are all
85
+ unchanged (for example a few differing pixels, a page height that varies
86
+ between loads) is not a wrong layout caused by the diff. Capture the base
87
+ state repeatedly to learn its own variation, record every value seen in the
88
+ summary, then stop. Looking for the cause of such a difference or of a
89
+ pre-existing defect, and measuring a behavior the checks do not require (for
90
+ example hiding an element and measuring again, forcing a viewport change while
91
+ a state is open, building a separate probe script), is a root-cause
92
+ investigation that runs only when the user asks for it
93
+ ([Verification by reasoning](layered-task-execution.instructions.md#verification-by-reasoning)); missing handling
94
+ visible from the source is recorded by reasoning on the source. Pixel counts
95
+ and repeated base captures, if any, are recorded apart from the checks and
96
+ marked as not QG evidence.
97
+ - **Record:** summarize in the `layout_verification` field of the
98
+ Implementation Record: states captured, languages, viewports (including the
99
+ threshold-adjacent viewports measured), the base used for comparison (commit
100
+ and uncommitted changes counted), number of screenshots, checks passed/failed
101
+ (each failed check with its cause: pre-existing, or caused by the diff and
102
+ excluded by a Plan REQ) and the directory path. `.tmp/` does not go with
103
+ commits, so the summary is the evidence and the path is for lookup only.
104
+ - **Review:** reads Implement's summary and screenshots and does not rerun
105
+ them. A diff that changes the UI while the Record lacks this result, or
106
+ screenshots showing a layout that violates a QG, is a `repair` FIND for
107
+ `frontend-developer`.