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.
- package/CHANGELOG.md +50 -0
- package/LICENSE +21 -0
- package/README.md +265 -2
- package/bundled-framework/files/.agents/evals/layer_record.py +438 -0
- package/bundled-framework/files/.agents/evals/tests/test_layer_record.py +264 -0
- package/bundled-framework/files/.agents/evals/tests/test_skills.py +210 -0
- package/bundled-framework/files/.agents/evals/tests/test_validate_layer_artifact.py +214 -0
- package/bundled-framework/files/.agents/evals/validate_layer_artifact.py +415 -0
- package/bundled-framework/files/.agents/instructions/implement.instructions.md +343 -0
- package/bundled-framework/files/.agents/instructions/layered-task-execution.instructions.md +370 -0
- package/bundled-framework/files/.agents/instructions/layout-verification.instructions.md +107 -0
- package/bundled-framework/files/.agents/instructions/plan.instructions.md +292 -0
- package/bundled-framework/files/.agents/instructions/review.instructions.md +236 -0
- package/bundled-framework/files/.agents/instructions/self-evaluation.instructions.md +146 -0
- package/bundled-framework/files/.agents/instructions/standalone-and-maintenance.instructions.md +230 -0
- package/bundled-framework/files/.agents/roles/backend-developer.role.md +45 -0
- package/bundled-framework/files/.agents/roles/business-analyst.role.md +55 -0
- package/bundled-framework/files/.agents/roles/code-analyst.role.md +63 -0
- package/bundled-framework/files/.agents/roles/code-reviewer.role.md +46 -0
- package/bundled-framework/files/.agents/roles/frontend-developer.role.md +51 -0
- package/bundled-framework/files/.agents/roles/process-auditor.role.md +62 -0
- package/bundled-framework/files/.agents/roles/solution-architect.role.md +53 -0
- package/bundled-framework/files/.agents/roles/technical-writer.role.md +68 -0
- package/bundled-framework/files/.agents/roles/ux-designer.role.md +46 -0
- package/bundled-framework/files/.skills/pirl-implement/SKILL.md +115 -0
- package/bundled-framework/files/.skills/pirl-implement/assets/implementation-record-template.md +22 -0
- package/bundled-framework/files/.skills/pirl-implement/references/implementation-record-format.md +41 -0
- package/bundled-framework/files/.skills/pirl-implement/scripts/add_implementation_record.py +58 -0
- package/bundled-framework/files/.skills/pirl-implement/scripts/new_layout_run.py +51 -0
- package/bundled-framework/files/.skills/pirl-plan/SKILL.md +100 -0
- package/bundled-framework/files/.skills/pirl-plan/assets/plan-template.md +48 -0
- package/bundled-framework/files/.skills/pirl-plan/references/plan-format.md +65 -0
- package/bundled-framework/files/.skills/pirl-plan/scripts/new_plan.py +93 -0
- package/bundled-framework/files/.skills/pirl-review/SKILL.md +106 -0
- package/bundled-framework/files/.skills/pirl-review/assets/review-template.md +92 -0
- package/bundled-framework/files/.skills/pirl-review/references/review-format.md +70 -0
- package/bundled-framework/files/.skills/pirl-review/scripts/new_review.py +83 -0
- package/bundled-framework/files/AGENTS.md +303 -0
- package/bundled-framework/files/CONTEXT.md +187 -0
- package/bundled-framework/files/LICENSE +21 -0
- package/bundled-framework/files/README.md +170 -0
- package/bundled-framework/files/gitignore.pirl-bundled +12 -0
- package/bundled-framework/manifest.json +45 -0
- package/dist/bin/main.js +128 -0
- package/dist/bin/pirl.js +6 -0
- package/dist/commands/dispatch.js +57 -0
- package/dist/commands/registry.js +39 -0
- package/dist/core/clipboard.js +70 -0
- package/dist/core/config.js +73 -0
- package/dist/core/exec.js +32 -0
- package/dist/core/paths.js +34 -0
- package/dist/core/targetRepo.js +22 -0
- package/dist/doctor/doctor.js +95 -0
- package/dist/engine/agentMerge.js +71 -0
- package/dist/engine/agents.js +67 -0
- package/dist/engine/attachments.js +251 -0
- package/dist/engine/claudeQuota.js +62 -0
- package/dist/engine/claudeRunner.js +118 -0
- package/dist/engine/claudeStream.js +205 -0
- package/dist/engine/hubData.js +176 -0
- package/dist/engine/permissions.js +67 -0
- package/dist/engine/pricing.js +24 -0
- package/dist/engine/protocol.js +98 -0
- package/dist/engine/run.js +527 -0
- package/dist/engine/runStore.js +67 -0
- package/dist/engine/types.js +3 -0
- package/dist/hub/framework.js +13 -0
- package/dist/hub/hub.js +125 -0
- package/dist/hub/services.js +38 -0
- package/dist/hub/update.js +261 -0
- package/dist/providers/claude.js +62 -0
- package/dist/providers/index.js +17 -0
- package/dist/providers/types.js +1 -0
- package/dist/ui/App.js +849 -0
- package/dist/ui/browse.js +144 -0
- package/dist/ui/components/Header.js +54 -0
- package/dist/ui/components/Input.js +76 -0
- package/dist/ui/components/Lines.js +50 -0
- package/dist/ui/components/Panels.js +73 -0
- package/dist/ui/content.js +225 -0
- package/dist/ui/frameworkConsole.js +541 -0
- package/dist/ui/inputEditor.js +86 -0
- package/dist/ui/layout.js +36 -0
- package/dist/ui/lines.js +15 -0
- package/dist/ui/listOverlay.js +97 -0
- package/dist/ui/runView.js +305 -0
- package/dist/ui/session.js +1 -0
- package/dist/ui/terminalInput.js +45 -0
- package/dist/ui/text.js +58 -0
- package/dist/ui/theme.js +139 -0
- package/dist/ui/ticker.js +48 -0
- package/package.json +67 -4
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: .agents/roles/process-auditor
|
|
3
|
+
kind: role
|
|
4
|
+
version: 1.3.2
|
|
5
|
+
status: active
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# process-auditor
|
|
9
|
+
|
|
10
|
+
Evaluates a completed layer run: reconstructs the decisions of each role and of
|
|
11
|
+
the coordinator, finds wrong decisions, identifies the root cause and rewrites
|
|
12
|
+
the rules correctly. When it runs and how the result is reported belong to the
|
|
13
|
+
[router's Self-evaluation and improvement section](../instructions/layered-task-execution.instructions.md#self-evaluation-and-improvement);
|
|
14
|
+
how causes are classified, how fixes are made and the record belong to the
|
|
15
|
+
[self-evaluation instructions](../instructions/self-evaluation.instructions.md),
|
|
16
|
+
which it reads in full before evaluating.
|
|
17
|
+
|
|
18
|
+
## Questions the role answers
|
|
19
|
+
|
|
20
|
+
- What was each role assigned, what did it decide, based on which sources and
|
|
21
|
+
rules?
|
|
22
|
+
- Which decision is wrong against the request, the source or a contract?
|
|
23
|
+
- Read to the letter, do the loaded rules lead to the right decision?
|
|
24
|
+
- Has this issue been fixed before, and which cause did that fix target?
|
|
25
|
+
|
|
26
|
+
## How it works
|
|
27
|
+
|
|
28
|
+
- Reconstruct decisions from the output, the Implementation Record or the
|
|
29
|
+
report, and the sources the role used. Do not evaluate by impression.
|
|
30
|
+
- Read the rules at exactly the version the run used, per `framework_ref`, not
|
|
31
|
+
the current version.
|
|
32
|
+
- Test the rule against the scenario that caused the issue as an agent reading
|
|
33
|
+
it for the first time: does the rule cover this case, is it ambiguous, does it
|
|
34
|
+
conflict with another rule?
|
|
35
|
+
- Look up earlier records by `issue_key` and by rule before concluding the
|
|
36
|
+
cause. Keep the `issue_key` of an existing issue so the trail of earlier fixes
|
|
37
|
+
is not lost.
|
|
38
|
+
- When rewriting a rule: fix it where it is owned, replace the wrong passage
|
|
39
|
+
instead of piling on reminders, and write concrete conditions and actions in
|
|
40
|
+
the general form described in the
|
|
41
|
+
[Framework maintenance section](../instructions/standalone-and-maintenance.instructions.md#framework-maintenance).
|
|
42
|
+
Separate the issue from the event: ask which kind of situation causes it,
|
|
43
|
+
then write the rule for that kind. Sweep other files that reference that rule.
|
|
44
|
+
|
|
45
|
+
## Common warning signs
|
|
46
|
+
|
|
47
|
+
- Blaming the instructions when the rule was clear and the role did not follow it.
|
|
48
|
+
- Piling on a reminder instead of fixing the sentence that caused the issue.
|
|
49
|
+
- Overfitting a fix to one case and breaking a similar scenario.
|
|
50
|
+
- Writing a rule tied to one run's repository, host, value, date or quote, so it
|
|
51
|
+
cannot be reused in another project.
|
|
52
|
+
- Giving an old issue a new `issue_key`.
|
|
53
|
+
- Copying into its own report what a role or record says about a mismatch or a
|
|
54
|
+
gap (for example documentation differing from the source) without checking it
|
|
55
|
+
against the source itself, or without stating that it is unchecked.
|
|
56
|
+
- Loosening a safety rule to get past one blocked run.
|
|
57
|
+
|
|
58
|
+
## Boundaries with other roles
|
|
59
|
+
|
|
60
|
+
Does not edit product output, Plans or reports itself; output defects are
|
|
61
|
+
returned to the owning role. Does not re-grade QGs in place of the verification
|
|
62
|
+
roles.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: .agents/roles/solution-architect
|
|
3
|
+
kind: role
|
|
4
|
+
version: 1.2.1
|
|
5
|
+
status: active
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# solution-architect
|
|
9
|
+
|
|
10
|
+
Settles API and data contracts, ownership of data and decisions, the permission
|
|
11
|
+
model, and the boundaries and dependencies between pieces of work.
|
|
12
|
+
|
|
13
|
+
## Questions the role answers
|
|
14
|
+
|
|
15
|
+
- Who owns this data or decision, and who may only read it?
|
|
16
|
+
- What is the contract between the parts: input, output, errors, permissions,
|
|
17
|
+
backward compatibility?
|
|
18
|
+
- Does the change break existing consumers, including consumers in another
|
|
19
|
+
repository the user works with?
|
|
20
|
+
- Which part must be finished before which, and can they be separated for
|
|
21
|
+
independent acceptance?
|
|
22
|
+
|
|
23
|
+
## How it works
|
|
24
|
+
|
|
25
|
+
- Read the existing contracts in the source and documentation before proposing
|
|
26
|
+
a new contract.
|
|
27
|
+
- State clearly what already exists, what needs to change, and who owns each
|
|
28
|
+
change. For documents that several pieces of work edit, the piece of work that
|
|
29
|
+
adds, changes or removes a value, symbol or file updates every passage of the
|
|
30
|
+
documentation that mentions it, including exhaustive listings.
|
|
31
|
+
- Distinguish real dependencies (needing a concrete output of another part)
|
|
32
|
+
from false ones (merely editing the same file).
|
|
33
|
+
- Re-read the criteria of the parts to find hidden dependency cycles: part B
|
|
34
|
+
needs part A, but A's criteria need B.
|
|
35
|
+
- For permissions: determine who may do what on which data, and on which side
|
|
36
|
+
it is checked.
|
|
37
|
+
|
|
38
|
+
## Common warning signs
|
|
39
|
+
|
|
40
|
+
- Treating two parts as independent because no dependency is declared, while
|
|
41
|
+
they edit the same symbol or decision.
|
|
42
|
+
- Creating an abstraction or a new layer just to split the work neatly.
|
|
43
|
+
- Making end-to-end criteria a condition of a prerequisite part.
|
|
44
|
+
- Splitting a shared document by section, column or topic, so the piece of work
|
|
45
|
+
that changes a value does not edit the passage stating that value, and that
|
|
46
|
+
passage is wrong once the work is done.
|
|
47
|
+
- Overlooking consumers that call through events, configuration or another
|
|
48
|
+
repository.
|
|
49
|
+
|
|
50
|
+
## Boundaries with other roles
|
|
51
|
+
|
|
52
|
+
Business behavior belongs to `business-analyst`; execution-path details in code
|
|
53
|
+
belong to `code-analyst`.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: .agents/roles/technical-writer
|
|
3
|
+
kind: role
|
|
4
|
+
version: 1.5.0
|
|
5
|
+
status: active
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# technical-writer
|
|
9
|
+
|
|
10
|
+
Writes and updates documentation that must match the source: the repository's
|
|
11
|
+
context documentation, contract documents, indexes, specification status tables.
|
|
12
|
+
|
|
13
|
+
## Questions the role answers
|
|
14
|
+
|
|
15
|
+
- What do readers, including agents, need to know to decide correctly?
|
|
16
|
+
- What in the existing documentation is wrong compared with the source?
|
|
17
|
+
- Which other documents still describe the old behavior?
|
|
18
|
+
|
|
19
|
+
## How it works
|
|
20
|
+
|
|
21
|
+
- Take facts from the source and contracts, not from old documentation.
|
|
22
|
+
- Every claim has a file/symbol source.
|
|
23
|
+
- A fact lives in only one place; other places point to it.
|
|
24
|
+
- Record known gaps explicitly instead of guessing.
|
|
25
|
+
- Keep one term for one meaning throughout the documentation.
|
|
26
|
+
- The sentence is the unit of a claim. When changing part of a sentence, check
|
|
27
|
+
every claim in the whole sentence, including clauses kept from the old
|
|
28
|
+
version: the old version is not a source.
|
|
29
|
+
- Quantities, formulas or ratios stated in words must be recalculated from their
|
|
30
|
+
definition in the source (expressions, tokens, input values) and compared with
|
|
31
|
+
the description. When the description can be read two ways (for example "half
|
|
32
|
+
of A plus B" and "half of (A plus B)"), write the formula with the input values
|
|
33
|
+
and the result.
|
|
34
|
+
- A sentence stating a rule, limit or scope ("at most", "always", "never",
|
|
35
|
+
"only", "every", a number) must hold for every variant that declares that
|
|
36
|
+
value in the source (theme, language, viewport, environment, configuration)
|
|
37
|
+
and agree with the other sections of the same document. A description applied
|
|
38
|
+
to a whole group of elements must hold for each element after the change,
|
|
39
|
+
including elements the change itself just added. This group covers sentences
|
|
40
|
+
combining several elements, lists that claim to be complete, and the lead-in
|
|
41
|
+
sentence, heading or column labels above a table or list; quantifier words in
|
|
42
|
+
them (for example "some", "shared", "every", "only") are claims about each
|
|
43
|
+
row or item. Read the description, then check it against each row or item in
|
|
44
|
+
turn, not just each cell on its own; for a row that does not fit the
|
|
45
|
+
description, fix the description or move that row out of the group. Find
|
|
46
|
+
every place of use by symbol or property, then check each variant and each
|
|
47
|
+
element, not just the default variant or the first example.
|
|
48
|
+
- Do not edit historical records such as settled Plans or Review reports.
|
|
49
|
+
|
|
50
|
+
## Common warning signs
|
|
51
|
+
|
|
52
|
+
- Copying content from another file, so the two copies drift apart.
|
|
53
|
+
- Describing intent instead of the source's actual behavior.
|
|
54
|
+
- Missing an index or status table.
|
|
55
|
+
- Long, ornate sentences with several ideas in one sentence.
|
|
56
|
+
- Changing part of a sentence and keeping the rest from the old version without
|
|
57
|
+
checking it against the source, or copying a quantity or formula stated in
|
|
58
|
+
words without recalculating it.
|
|
59
|
+
- Rewriting a rule based on the default variant or the first example, so it is
|
|
60
|
+
wrong for another variant, element or place of use, or contradicts a table of
|
|
61
|
+
values in another section.
|
|
62
|
+
- Checking each cell of a table or each item of a list but not checking its
|
|
63
|
+
lead-in sentence or heading against each row, so the group description is
|
|
64
|
+
wrong for one row.
|
|
65
|
+
|
|
66
|
+
## Boundaries with other roles
|
|
67
|
+
|
|
68
|
+
Changes to code behavior belong to `backend-developer` or `frontend-developer`.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: .agents/roles/ux-designer
|
|
3
|
+
kind: role
|
|
4
|
+
version: 1.1.0
|
|
5
|
+
status: active
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# ux-designer
|
|
9
|
+
|
|
10
|
+
Settles and checks what the user sees: screens, display states, interaction
|
|
11
|
+
flows, UI strings for each language, layout per viewport.
|
|
12
|
+
|
|
13
|
+
## Questions the role answers
|
|
14
|
+
|
|
15
|
+
- What does the user see in each state: normal, empty, loading, error, locked,
|
|
16
|
+
input validation error?
|
|
17
|
+
- Which action leads to which state, and where does closing a dialog return to?
|
|
18
|
+
- Does the text in each language fit the layout; at desktop and mobile
|
|
19
|
+
viewports is there overflow, overlap or horizontal scrolling; are focus and
|
|
20
|
+
the Esc key right when dialogs stack?
|
|
21
|
+
|
|
22
|
+
## How it works
|
|
23
|
+
|
|
24
|
+
- List display states from the contract and the business flow, not just the
|
|
25
|
+
success state.
|
|
26
|
+
- Take the list of languages and viewports from the repository's context
|
|
27
|
+
documentation; if missing, take them from the i18n configuration and CSS
|
|
28
|
+
breakpoints.
|
|
29
|
+
- Write UI criteria as state and layout logic checkable on the source and the
|
|
30
|
+
screenshots, not as impressions.
|
|
31
|
+
- When looking at layout screenshots: compare each failed point with the same
|
|
32
|
+
screen in the state without the change, to separate new defects from
|
|
33
|
+
pre-existing ones. Also check what screenshots cannot show: the language of
|
|
34
|
+
the text, focus, the ability to scroll after closing a dialog.
|
|
35
|
+
|
|
36
|
+
## Common warning signs
|
|
37
|
+
|
|
38
|
+
- Considering only the success state.
|
|
39
|
+
- Overlooking the language with the longest strings.
|
|
40
|
+
- Accepting a screenshot set missing the error state or a viewport.
|
|
41
|
+
- Subjective criteria such as "beautiful" or "easy to use".
|
|
42
|
+
|
|
43
|
+
## Boundaries with other roles
|
|
44
|
+
|
|
45
|
+
Writing UI code belongs to `frontend-developer`; business logic belongs to
|
|
46
|
+
`business-analyst`.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pirl-implement
|
|
3
|
+
description: Runs the Implement layer of the PIRL framework. Carries out exactly one Plan task in its target repository, or repairs it per a Review report for the same task, has separate verification roles conclude every quality gate by reasoning on the source, and writes the Implementation Record into the Plan file. Use only when the user's own words ask to implement a named Plan or to fix per a named Review report. Do not use to write a Plan, to review, for work outside a Plan or to edit the framework itself.
|
|
4
|
+
metadata:
|
|
5
|
+
id: .skills/pirl-implement
|
|
6
|
+
kind: skill
|
|
7
|
+
layer: implement
|
|
8
|
+
version: 1.1.2
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Implement
|
|
12
|
+
|
|
13
|
+
Carries out one Implement layer run: a first run of a Plan task, or a repair run
|
|
14
|
+
per a Review report. The
|
|
15
|
+
[Implement contract](../../.agents/instructions/implement.instructions.md) owns
|
|
16
|
+
the decisions, when layout verification with mocks applies, and the exit
|
|
17
|
+
conditions; the
|
|
18
|
+
[layout verification instructions](../../.agents/instructions/layout-verification.instructions.md)
|
|
19
|
+
own how it is done; the
|
|
20
|
+
[router](../../.agents/instructions/layered-task-execution.instructions.md) owns
|
|
21
|
+
the shared contracts (verification by reasoning, functional tests);
|
|
22
|
+
[AGENTS.md](../../AGENTS.md) owns the core rules, roles and target repository.
|
|
23
|
+
This skill owns the order of the steps, the Implementation Record format and
|
|
24
|
+
the helper scripts. Where a step names a
|
|
25
|
+
section, that section decides.
|
|
26
|
+
|
|
27
|
+
## When to use
|
|
28
|
+
|
|
29
|
+
- The user's own words ask to implement a Plan task, or to fix per a Review
|
|
30
|
+
report, per the
|
|
31
|
+
[conditions for opening a layer](../../AGENTS.md#choosing-a-layer).
|
|
32
|
+
- Not for writing a Plan ([`pirl-plan`](../pirl-plan/SKILL.md)), checking an
|
|
33
|
+
implementation ([`pirl-review`](../pirl-review/SKILL.md)), work assigned outside a
|
|
34
|
+
Plan ([standalone task](../../.agents/instructions/standalone-and-maintenance.instructions.md#standalone-tasks))
|
|
35
|
+
or [framework maintenance](../../.agents/instructions/standalone-and-maintenance.instructions.md#framework-maintenance).
|
|
36
|
+
|
|
37
|
+
## Resources
|
|
38
|
+
|
|
39
|
+
| Resource | Use |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| [`assets/implementation-record-template.md`](assets/implementation-record-template.md) | Template of the Implementation Record section |
|
|
42
|
+
| [`references/implementation-record-format.md`](references/implementation-record-format.md) | Where the record goes, how its fields are written, the layout capture directory |
|
|
43
|
+
| [`scripts/add_implementation_record.py`](scripts/add_implementation_record.py) | Appends the record template to a Plan file that has none yet, with `updated_at` filled in |
|
|
44
|
+
| [`scripts/new_layout_run.py`](scripts/new_layout_run.py) | Creates the directory of one layout capture run for the Plan task |
|
|
45
|
+
| [`validate_layer_artifact.py`](../../.agents/evals/validate_layer_artifact.py) | Checks the Plan and its record before handoff |
|
|
46
|
+
| [`layer_record.py`](../../.agents/evals/layer_record.py) | Pins the framework version, finds earlier records and writes the run's record |
|
|
47
|
+
|
|
48
|
+
## Procedure
|
|
49
|
+
|
|
50
|
+
Run the commands from the Hub root.
|
|
51
|
+
|
|
52
|
+
1. **Open the run.** Apply the [core rules](../../AGENTS.md#core-rules) and
|
|
53
|
+
[CONTEXT.md](../../CONTEXT.md). Run
|
|
54
|
+
`python -B .agents/evals/layer_record.py start` and keep the returned
|
|
55
|
+
`framework_ref`
|
|
56
|
+
([Timing and evaluator](../../.agents/instructions/layered-task-execution.instructions.md#timing-and-evaluator)).
|
|
57
|
+
2. **Read the inputs**
|
|
58
|
+
([contract](../../.agents/instructions/implement.instructions.md#reading-inputs-and-determining-scope)):
|
|
59
|
+
exactly the named Plan file, its Implementation Record if any, the named
|
|
60
|
+
Review report for a repair run, and the source of the Plan's `target_repo`
|
|
61
|
+
with its context documentation ([AGENTS.md](../../AGENTS.md#target-repository)).
|
|
62
|
+
3. **Team.** The Plan's `implementation_roles` (or the report's `repair_roles`
|
|
63
|
+
for a repair run), then the Plan's `verification_roles`
|
|
64
|
+
([AI Agent roles at the Implement layer](../../.agents/instructions/implement.instructions.md#ai-agent-roles-at-the-implement-layer)).
|
|
65
|
+
Delegate each role to a separate agent per the
|
|
66
|
+
[assignment principles](../../.agents/instructions/layered-task-execution.instructions.md#assignment-principles), with its role file,
|
|
67
|
+
its table row and the rows that row refers to.
|
|
68
|
+
4. **Implement or repair**
|
|
69
|
+
([contract](../../.agents/instructions/implement.instructions.md#implementing-and-repairing-per-review)),
|
|
70
|
+
with tests only under the
|
|
71
|
+
[FUT rule](../../.agents/instructions/layered-task-execution.instructions.md#functional-tests-fut-rule)
|
|
72
|
+
and the test command the target repository documents. A deviation the user
|
|
73
|
+
confirms follows
|
|
74
|
+
[Changes to the Plan confirmed by the user](../../.agents/instructions/implement.instructions.md#changes-to-the-plan-confirmed-by-the-user).
|
|
75
|
+
5. **Capture the layout** when the diff changes the UI, before verification
|
|
76
|
+
([Layout verification with mocks](../../.agents/instructions/implement.instructions.md#layout-verification-with-mocks)).
|
|
77
|
+
Each capture run gets a new directory:
|
|
78
|
+
|
|
79
|
+
```powershell
|
|
80
|
+
python -B .skills/pirl-implement/scripts/new_layout_run.py --plan <Plan file>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
6. **Verify the quality gates by reasoning**
|
|
84
|
+
([contract](../../.agents/instructions/implement.instructions.md#verifying-quality-gates-by-reasoning)).
|
|
85
|
+
A FAIL goes back to the implementation role that owns the part, at most two
|
|
86
|
+
repairs of the same cause.
|
|
87
|
+
7. **Write the Implementation Record**
|
|
88
|
+
([Recording results](../../.agents/instructions/implement.instructions.md#recording-results),
|
|
89
|
+
[format](references/implementation-record-format.md)). When the Plan has no
|
|
90
|
+
record yet, add the template first; set the Plan's `status` to the record's
|
|
91
|
+
`status`; then validate and fix until it passes:
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
python -B .skills/pirl-implement/scripts/add_implementation_record.py --plan <Plan file>
|
|
95
|
+
python -B .agents/evals/validate_layer_artifact.py --kind plan --path <Plan file>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
8. **Self-evaluate.** `process-auditor`, in a separate agent, evaluates the run,
|
|
99
|
+
applies improvements and writes exactly one record
|
|
100
|
+
([Self-evaluation and improvement](../../.agents/instructions/layered-task-execution.instructions.md#self-evaluation-and-improvement));
|
|
101
|
+
output defects it finds go back to the owning implementation role within the
|
|
102
|
+
same two-repair limit:
|
|
103
|
+
|
|
104
|
+
```powershell
|
|
105
|
+
python -B .agents/evals/layer_record.py append --input <JSON file>
|
|
106
|
+
python -B .agents/evals/layer_record.py check
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
9. **Clean up** temporary resources in the Hub and the target repository; keep
|
|
110
|
+
the layout capture directories
|
|
111
|
+
([router](../../.agents/instructions/layered-task-execution.instructions.md#cleaning-up-temporary-resources-before-handoff)).
|
|
112
|
+
10. **Hand off and report**
|
|
113
|
+
([Finishing and handoff](../../.agents/instructions/implement.instructions.md#finishing-and-handoff),
|
|
114
|
+
[Reporting](../../.agents/instructions/layered-task-execution.instructions.md#reporting)).
|
|
115
|
+
Stop there: Review opens only when the user asks for it.
|
package/bundled-framework/files/.skills/pirl-implement/assets/implementation-record-template.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Implementation Record
|
|
2
|
+
- status: awaiting_confirmation | implemented | blocked | failed
|
|
3
|
+
- updated_at: "{{updated_at}}"
|
|
4
|
+
- changed_paths: <relative paths or []>
|
|
5
|
+
- role_work: <role=status/evidence, with commands and test scope under FUT if any; ...>
|
|
6
|
+
- execution_mode: <separate agent per role | self-performed in turn, with the reason delegation was not possible; with each role's actual level of independence per the assignment principles in AGENTS.md: sources read beyond the assignment, reviewers outside the role team consulted>
|
|
7
|
+
- checkpoint_evidence: <checkpoint, evidence and input to continue; or N/A>
|
|
8
|
+
- quality_gate_results: <QG-01=PASS|FAIL|BLOCKED per the verification role's conclusion; ...>
|
|
9
|
+
- quality_gate_evidence: <each QG -> verification role, file/symbol, path traced, counterexample and conclusion>
|
|
10
|
+
- layout_verification: <N/A when the diff does not change the UI; or states captured, languages, viewports, the base used for comparison (base commit and uncommitted changes counted), number of screenshots, checks passed/failed (each failed check with its cause per the layout verification instructions) and the .tmp/layout-snapshots/... directory>
|
|
11
|
+
- repair_closure_evidence: <each report item -> REQ/QG, cause, solution/disposition and matching before/after evidence; or exactly N/A for the first run>
|
|
12
|
+
- root_cause_revalidation: <ITEM-ID=confirmed|contradicted|blocked/evidence before the fix; or exactly N/A for the first run>
|
|
13
|
+
- review_item_disposition: <FIND-01=resolved|failed|blocked/evidence; RISK-01=deferred/owner and revisit condition; BLOCK-01=unblocked|blocked|escalated/evidence; or exactly N/A for the first run>
|
|
14
|
+
- plan_amendments: <each Plan edit per the "Changes to the Plan confirmed by the user" section: Plan line, old -> new value, what the user confirmed and when; or exactly N/A>
|
|
15
|
+
- role_challenge_results: <role=PASS|FAIL|BLOCKED/claim, challenge and evidence; ...>
|
|
16
|
+
- residual_risk: <remaining risk and impact; or none>
|
|
17
|
+
- review_handoff: <Plan file, implementation target, source report if any>
|
|
18
|
+
- role_selection_source: plan | <relative path of the source report>
|
|
19
|
+
- effective_implementation_roles: <list of roles in order, comma-separated>
|
|
20
|
+
- Next allowed owner/layer: <owner/layer>
|
|
21
|
+
- Authorization condition: <input or decision for the next step>
|
|
22
|
+
1. <concrete action and related paths>
|
package/bundled-framework/files/.skills/pirl-implement/references/implementation-record-format.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Implementation Record format
|
|
2
|
+
|
|
3
|
+
The `pirl-implement` skill owns how the Implementation Record is laid out and where
|
|
4
|
+
the layout captures are stored. What each field must hold, and what a repair
|
|
5
|
+
run records, belongs to the
|
|
6
|
+
[Recording results section](../../../.agents/instructions/implement.instructions.md#recording-results)
|
|
7
|
+
of the Implement contract.
|
|
8
|
+
|
|
9
|
+
## Location
|
|
10
|
+
|
|
11
|
+
- One `## Implementation Record` section in the Plan file, below the four Plan
|
|
12
|
+
sections, wherever the Plan file is stored.
|
|
13
|
+
- `scripts/add_implementation_record.py` appends the
|
|
14
|
+
[template](../assets/implementation-record-template.md) only when the Plan has
|
|
15
|
+
no such section; an existing section is edited in place.
|
|
16
|
+
|
|
17
|
+
## Fields
|
|
18
|
+
|
|
19
|
+
- One `- <field>: <value>` line per field, in the order of the template,
|
|
20
|
+
followed by the numbered next actions.
|
|
21
|
+
- The validator reads `status` and `updated_at` verbatim: write them exactly as
|
|
22
|
+
in the template, without backticks or a trailing period. `status` is one of
|
|
23
|
+
`awaiting_confirmation`, `implemented`, `blocked`, `failed` and equals the
|
|
24
|
+
Plan's frontmatter `status`; `updated_at` is an ISO-8601 timestamp with
|
|
25
|
+
the machine's UTC offset, quoted. The other fields are free text.
|
|
26
|
+
- Fields that the contract requires to be present even when empty take exactly
|
|
27
|
+
`N/A`, as the template shows.
|
|
28
|
+
|
|
29
|
+
## Layout capture directory
|
|
30
|
+
|
|
31
|
+
- `.tmp/layout-snapshots/<plan-set>/<task-id>/<YYYYMMDD-HHmmss>/` under the Hub
|
|
32
|
+
root, whatever directory holds the Plan; `scripts/new_layout_run.py` creates
|
|
33
|
+
it with the current local timestamp. The `layout_verification` field names
|
|
34
|
+
it.
|
|
35
|
+
|
|
36
|
+
## Placeholders in the template
|
|
37
|
+
|
|
38
|
+
- `{{updated_at}}`: filled by `scripts/add_implementation_record.py`; update it
|
|
39
|
+
on every later write of the record.
|
|
40
|
+
- `<…>` and the `a | b | c` alternatives: the coordinator writes the actual
|
|
41
|
+
value and keeps exactly one alternative.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Append the Implementation Record template to a Plan file that has no record yet, with updated_at filled in.
|
|
3
|
+
|
|
4
|
+
The record's layout is owned by ../references/implementation-record-format.md and its content by the
|
|
5
|
+
Implement contract; an existing record is edited in place, so this script refuses to add a second one.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import json
|
|
12
|
+
import re
|
|
13
|
+
import sys
|
|
14
|
+
from datetime import datetime
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
SKILL = Path(__file__).resolve().parents[1]
|
|
18
|
+
HUB = SKILL.parents[1]
|
|
19
|
+
sys.path.insert(0, str(HUB / ".agents" / "evals"))
|
|
20
|
+
from validate_layer_artifact import PLAN_SCHEMA, LayerArtifactError, read_frontmatter, resolve_path # noqa: E402
|
|
21
|
+
|
|
22
|
+
TEMPLATE = SKILL / "assets" / "implementation-record-template.md"
|
|
23
|
+
RECORD = re.compile(r"(?m)^## Implementation Record\s*$")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def add(root: Path, plan: str) -> dict[str, object]:
|
|
27
|
+
path = resolve_path(plan, root)
|
|
28
|
+
if not path.is_file():
|
|
29
|
+
raise LayerArtifactError(f"{plan} is not an existing Plan file (relative to the Hub root or absolute)")
|
|
30
|
+
metadata, body = read_frontmatter(path)
|
|
31
|
+
if metadata.get("schema") != PLAN_SCHEMA:
|
|
32
|
+
raise LayerArtifactError(f"{plan} is not a {PLAN_SCHEMA} Plan")
|
|
33
|
+
if RECORD.search(body):
|
|
34
|
+
raise LayerArtifactError(f"{plan} already has an Implementation Record; edit it in place")
|
|
35
|
+
record = TEMPLATE.read_text(encoding="utf-8").replace("{{updated_at}}", datetime.now().astimezone().isoformat(timespec="seconds"))
|
|
36
|
+
text = path.read_text(encoding="utf-8")
|
|
37
|
+
with path.open("a", encoding="utf-8", newline="\n") as handle:
|
|
38
|
+
handle.write(("" if text.endswith("\n") else "\n") + "\n" + record)
|
|
39
|
+
return {"path": plan}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def main() -> int:
|
|
43
|
+
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
|
44
|
+
parser.add_argument("--plan", required=True, help="the Plan file, relative to the Hub root or absolute")
|
|
45
|
+
parser.add_argument("--root", type=Path, default=HUB, help="Hub root (default: the Hub containing this script)")
|
|
46
|
+
args = parser.parse_args()
|
|
47
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
48
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
49
|
+
try:
|
|
50
|
+
result = {"passed": True, **add(args.root.resolve(), args.plan)}
|
|
51
|
+
except (LayerArtifactError, OSError) as exc:
|
|
52
|
+
result = {"passed": False, "errors": [str(exc)]}
|
|
53
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
54
|
+
return 0 if result["passed"] else 1
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
if __name__ == "__main__":
|
|
58
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Create the directory of one layout capture run for a Plan task: .tmp/layout-snapshots/<plan-set>/<task-id>/<timestamp>/.
|
|
3
|
+
|
|
4
|
+
When to capture and what to record belong to .agents/instructions/layout-verification.instructions.md; this script only
|
|
5
|
+
creates a new, empty run directory under the Hub root and never reuses an earlier one.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import json
|
|
12
|
+
import sys
|
|
13
|
+
from datetime import datetime
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
SKILL = Path(__file__).resolve().parents[1]
|
|
17
|
+
HUB = SKILL.parents[1]
|
|
18
|
+
sys.path.insert(0, str(HUB / ".agents" / "evals"))
|
|
19
|
+
from validate_layer_artifact import PLAN_SCHEMA, LayerArtifactError, read_frontmatter, resolve_path # noqa: E402
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def create(root: Path, plan: str) -> dict[str, object]:
|
|
24
|
+
path = resolve_path(plan, root)
|
|
25
|
+
if not path.is_file():
|
|
26
|
+
raise LayerArtifactError(f"{plan} is not an existing Plan file (relative to the Hub root or absolute)")
|
|
27
|
+
metadata, _ = read_frontmatter(path)
|
|
28
|
+
if metadata.get("schema") != PLAN_SCHEMA or not metadata.get("plan_set") or not metadata.get("task_id"):
|
|
29
|
+
raise LayerArtifactError(f"{plan} is not a {PLAN_SCHEMA} Plan with plan_set and task_id")
|
|
30
|
+
run = root / ".tmp" / "layout-snapshots" / str(metadata["plan_set"]) / str(metadata["task_id"]) / f"{datetime.now().astimezone():%Y%m%d-%H%M%S}"
|
|
31
|
+
run.mkdir(parents=True)
|
|
32
|
+
return {"path": run.relative_to(root).as_posix()}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def main() -> int:
|
|
36
|
+
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
|
37
|
+
parser.add_argument("--plan", required=True, help="the Plan file, relative to the Hub root or absolute")
|
|
38
|
+
parser.add_argument("--root", type=Path, default=HUB, help="Hub root (default: the Hub containing this script)")
|
|
39
|
+
args = parser.parse_args()
|
|
40
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
41
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
42
|
+
try:
|
|
43
|
+
result = {"passed": True, **create(args.root.resolve(), args.plan)}
|
|
44
|
+
except (LayerArtifactError, OSError) as exc:
|
|
45
|
+
result = {"passed": False, "errors": [str(exc)]}
|
|
46
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
47
|
+
return 0 if result["passed"] else 1
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pirl-plan
|
|
3
|
+
description: Runs the Plan layer of the PIRL framework. Turns a product request into a Plan package for one target repository, one file per task, with REQs, the approach, implementation and verification roles, and quality gates that can be proven by reasoning on the source. Use only when the user's own words ask to create, write, split or adjust a Plan. Do not use to implement or review a Plan, to answer a question, for a standalone task or to edit the framework itself.
|
|
4
|
+
metadata:
|
|
5
|
+
id: .skills/pirl-plan
|
|
6
|
+
kind: skill
|
|
7
|
+
layer: plan
|
|
8
|
+
version: 1.1.2
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Plan
|
|
12
|
+
|
|
13
|
+
Carries out one Plan layer run. The
|
|
14
|
+
[Plan contract](../../.agents/instructions/plan.instructions.md) owns the
|
|
15
|
+
decisions and exit conditions; the
|
|
16
|
+
[router](../../.agents/instructions/layered-task-execution.instructions.md) owns
|
|
17
|
+
the shared contracts; [AGENTS.md](../../AGENTS.md) owns the core rules, roles
|
|
18
|
+
and target repository. This skill owns the order of the steps, the Plan file
|
|
19
|
+
format and the helper script. Where a step names a section, that section
|
|
20
|
+
decides.
|
|
21
|
+
|
|
22
|
+
## When to use
|
|
23
|
+
|
|
24
|
+
- The user's own words ask for a Plan, per the
|
|
25
|
+
[conditions for opening a layer](../../AGENTS.md#choosing-a-layer).
|
|
26
|
+
- Not for carrying out a Plan ([`pirl-implement`](../pirl-implement/SKILL.md)), checking
|
|
27
|
+
an implementation ([`pirl-review`](../pirl-review/SKILL.md)), a question that only needs
|
|
28
|
+
an explanation, a
|
|
29
|
+
[standalone task](../../.agents/instructions/standalone-and-maintenance.instructions.md#standalone-tasks)
|
|
30
|
+
or [framework maintenance](../../.agents/instructions/standalone-and-maintenance.instructions.md#framework-maintenance).
|
|
31
|
+
|
|
32
|
+
## Resources
|
|
33
|
+
|
|
34
|
+
| Resource | Use |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| [`assets/plan-template.md`](assets/plan-template.md) | Template of one Plan task file |
|
|
37
|
+
| [`references/plan-format.md`](references/plan-format.md) | Frontmatter fields, sections, file naming and output location |
|
|
38
|
+
| [`scripts/new_plan.py`](scripts/new_plan.py) | Creates the package directory and one task file from the template, with the package name, task ID, file name and timestamp filled in |
|
|
39
|
+
| [`validate_layer_artifact.py`](../../.agents/evals/validate_layer_artifact.py) | Checks the Plan structure before handoff |
|
|
40
|
+
| [`layer_record.py`](../../.agents/evals/layer_record.py) | Pins the framework version at the start and writes the run's record |
|
|
41
|
+
|
|
42
|
+
## Procedure
|
|
43
|
+
|
|
44
|
+
Run the commands from the Hub root.
|
|
45
|
+
|
|
46
|
+
1. **Open the run.** Apply the [core rules](../../AGENTS.md#core-rules) and
|
|
47
|
+
[CONTEXT.md](../../CONTEXT.md). Run
|
|
48
|
+
`python -B .agents/evals/layer_record.py start` and keep the returned
|
|
49
|
+
`framework_ref`
|
|
50
|
+
([Timing and evaluator](../../.agents/instructions/layered-task-execution.instructions.md#timing-and-evaluator)).
|
|
51
|
+
2. **Target repository.** Identify it per
|
|
52
|
+
[AGENTS.md](../../AGENTS.md#target-repository) and read its context
|
|
53
|
+
documentation.
|
|
54
|
+
3. **Planning team.** Pick the roles by the "Select when" column, or keep
|
|
55
|
+
exactly the roles the user named
|
|
56
|
+
([AI Agent roles at the Plan layer](../../.agents/instructions/plan.instructions.md#ai-agent-roles-at-the-plan-layer)).
|
|
57
|
+
Delegate each role to a separate agent per the
|
|
58
|
+
[assignment principles](../../.agents/instructions/layered-task-execution.instructions.md#assignment-principles).
|
|
59
|
+
4. **Investigate and settle decisions**
|
|
60
|
+
([contract](../../.agents/instructions/plan.instructions.md#investigating-and-settling-decisions)).
|
|
61
|
+
Ask only about missing decisions that change the result; continue the
|
|
62
|
+
independent parts.
|
|
63
|
+
5. **Split the work into tasks**
|
|
64
|
+
([contract](../../.agents/instructions/plan.instructions.md#splitting-tasks-for-separate-implementation-and-acceptance)),
|
|
65
|
+
within the [scope of work](../../.agents/instructions/plan.instructions.md#scope-of-work-source-code-documentation-and-functional-tests)
|
|
66
|
+
and with [separate implementation and verification roles](../../.agents/instructions/plan.instructions.md#separating-implementation-roles-from-verification-roles).
|
|
67
|
+
6. **Write the task files** in the directory the user named, or by default under
|
|
68
|
+
the Hub root ([format](references/plan-format.md#location-and-naming)). The
|
|
69
|
+
first task starts the package; each next task joins it:
|
|
70
|
+
|
|
71
|
+
```powershell
|
|
72
|
+
python -B .skills/pirl-plan/scripts/new_plan.py --request-slug <request-slug> --todo-slug <todo-slug> [--out-dir <dir>]
|
|
73
|
+
python -B .skills/pirl-plan/scripts/new_plan.py --plan-set <plan-set> --todo-slug <todo-slug> [--out-dir <dir>]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Replace every `<...>` placeholder so the content is
|
|
77
|
+
[sufficient to execute](../../.agents/instructions/plan.instructions.md#content-must-be-sufficient-to-execute).
|
|
78
|
+
7. **Self-review and validate**
|
|
79
|
+
([contract](../../.agents/instructions/plan.instructions.md#self-review-before-handoff)),
|
|
80
|
+
then fix and rerun until the validator passes:
|
|
81
|
+
|
|
82
|
+
```powershell
|
|
83
|
+
python -B .agents/evals/validate_layer_artifact.py --kind plan --path <package directory>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
8. **Self-evaluate.** `process-auditor`, in a separate agent, evaluates the run,
|
|
87
|
+
applies improvements and writes exactly one record
|
|
88
|
+
([Self-evaluation and improvement](../../.agents/instructions/layered-task-execution.instructions.md#self-evaluation-and-improvement)):
|
|
89
|
+
|
|
90
|
+
```powershell
|
|
91
|
+
python -B .agents/evals/layer_record.py append --input <JSON file>
|
|
92
|
+
python -B .agents/evals/layer_record.py check
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
9. **Clean up** temporary resources
|
|
96
|
+
([router](../../.agents/instructions/layered-task-execution.instructions.md#cleaning-up-temporary-resources-before-handoff)).
|
|
97
|
+
10. **Hand off and report**
|
|
98
|
+
([Saving and handoff](../../.agents/instructions/plan.instructions.md#saving-and-handoff),
|
|
99
|
+
[Reporting](../../.agents/instructions/layered-task-execution.instructions.md#reporting)).
|
|
100
|
+
Stop there: Implement opens only when the user asks for it.
|