@wichayutdew/pi-workflows 2.6.0 → 2.7.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/README.md +30 -0
- package/dist/index.js +141 -17
- package/examples/starter-kit/agents/planner.md +4 -0
- package/examples/starter-kit/agents/reviewer.md +4 -0
- package/examples/starter-kit/agents/scout.md +4 -0
- package/examples/starter-kit/agents/worker.md +4 -0
- package/examples/starter-kit/agents/workspace-preparer.md +4 -0
- package/examples/starter-kit/investigate.workflow.yaml +34 -64
- package/examples/starter-kit/jira.workflow.yaml +75 -0
- package/examples/starter-kit/mr-comment.workflow.yaml +48 -115
- package/examples/starter-kit/mr-review.workflow.yaml +36 -93
- package/examples/starter-kit/settings.yaml +2 -1
- package/examples/starter-kit/steps/investigate/investigate.md +18 -55
- package/examples/starter-kit/steps/investigate/retrieve.md +15 -50
- package/examples/starter-kit/steps/investigate/validate.md +10 -36
- package/examples/starter-kit/steps/jira/create.md +25 -0
- package/examples/starter-kit/steps/jira/draft.md +18 -0
- package/examples/starter-kit/steps/jira/plan.md +30 -0
- package/examples/starter-kit/steps/mr-comment/checkout-source.md +7 -60
- package/examples/starter-kit/steps/mr-comment/fetch.md +11 -36
- package/examples/starter-kit/steps/mr-comment/implement.md +10 -34
- package/examples/starter-kit/steps/mr-comment/plan.md +47 -70
- package/examples/starter-kit/steps/mr-comment/publish.md +11 -32
- package/examples/starter-kit/steps/mr-comment/verify.md +8 -42
- package/examples/starter-kit/steps/mr-review/fetch.md +8 -46
- package/examples/starter-kit/steps/mr-review/publish-approved.md +7 -38
- package/examples/starter-kit/steps/mr-review/review-for-approval.md +24 -113
- package/examples/starter-kit/steps/mr-review/verify-published.md +9 -30
- package/examples/starter-kit/steps/shared/prepare-workspace.md +9 -105
- package/examples/starter-kit/steps/shared/publish-remote.md +8 -37
- package/examples/starter-kit/steps/ticket/implement.md +11 -58
- package/examples/starter-kit/steps/ticket/plan.md +49 -171
- package/examples/starter-kit/steps/ticket/verify.md +12 -98
- package/examples/starter-kit/steps/work/implement.md +11 -58
- package/examples/starter-kit/steps/work/plan.md +42 -130
- package/examples/starter-kit/steps/work/verify.md +11 -58
- package/examples/starter-kit/ticket.workflow.yaml +38 -81
- package/examples/starter-kit/work.workflow.yaml +34 -72
- package/package.json +7 -4
- package/schemas/workflow.schema.json +61 -0
- package/scripts/patch-herdr-agent-state.mjs +36 -0
- package/src/config/types.ts +9 -0
- package/src/config/validation/step.ts +117 -0
- package/src/harness/artifact-contract.ts +46 -0
- package/src/harness/gate-submission-action.ts +28 -0
- package/src/harness/status-actions.ts +19 -0
- package/src/herdr-workflow-state.ts +65 -0
|
@@ -1,182 +1,60 @@
|
|
|
1
|
-
You are the planning and evidence stage for a Jira-ticket workflow.
|
|
2
|
-
the active workflow step; do not delegate this work.
|
|
3
|
-
Stay read-only.
|
|
1
|
+
You are the planning and evidence stage for a Jira-ticket workflow. Stay read-only in this child workspace; do not launch subagents.
|
|
4
2
|
|
|
5
|
-
Ticket input
|
|
3
|
+
Ticket input & user context:
|
|
6
4
|
{{workflow.input}}
|
|
7
5
|
|
|
8
6
|
Previously rejected artifact:
|
|
9
7
|
{{gate.artifact}}
|
|
10
8
|
|
|
11
|
-
Plannotator feedback
|
|
9
|
+
Plannotator feedback:
|
|
12
10
|
{{gate.feedback}}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Use outcome `workspace-refresh` only when the exact bound path/branch identity
|
|
54
|
-
is intact, the selected checkout is clean, and the recorded local source ref
|
|
55
|
-
has advanced to a commit that is not an ancestor of the selected HEAD. Its
|
|
56
|
-
summary must carry the complete previous workspace manifest plus exact current
|
|
57
|
-
source root/ref/HEAD and selected path/branch/HEAD/status. If preparation
|
|
58
|
-
already reported `deferred-dirty` or `not-needed` for that same source snapshot,
|
|
59
|
-
plan from the recorded current state instead of bouncing back. A canonical
|
|
60
|
-
path, branch, registration, marker, rewritten-history, or in-progress-operation
|
|
61
|
-
mismatch is `blocked`; never create, switch, reset, rebase, or select another
|
|
62
|
-
branch or worktree from this read-only step.
|
|
63
|
-
|
|
64
|
-
The repository contract must contain the bound Git root as `cwd`, the observed
|
|
65
|
-
current selected HEAD as `baseHead`, dedicated branch, Conventional Commit
|
|
66
|
-
title, copied ticket/user criteria, worker checks, and reviewer checks.
|
|
67
|
-
|
|
68
|
-
Use the `caveman` skill at lite intensity for artifact prose: remove filler and
|
|
69
|
-
repetition, but keep complete natural sentences, causal links, and exact
|
|
70
|
-
technical names.
|
|
71
|
-
|
|
72
|
-
Produce the artifact in this order:
|
|
73
|
-
|
|
74
|
-
1. `# <short outcome-oriented title>`
|
|
75
|
-
2. `## Review summary` — three to five plain-language bullets covering ticket
|
|
76
|
-
outcome, why it matters, in-scope work, and explicit exclusions.
|
|
77
|
-
3. `## Review focus` — only consequential user choices. For each, give the
|
|
78
|
-
recommendation, useful alternatives, and consequence. Write
|
|
79
|
-
`No decisions needed` when none remain.
|
|
80
|
-
4. `## Proposed approach` — short numbered actions. Each names the exact target,
|
|
81
|
-
observable change, reason, and matching ticket criterion.
|
|
82
|
-
5. `## Validation` — checks in reviewer language, including what each proves.
|
|
83
|
-
6. `## Risks` — only material risks, each with a safeguard or rollback signal.
|
|
84
|
-
7. `## Execution appendix (machine-readable)` — exact repository metadata and
|
|
85
|
-
commands, kept out of the main narrative.
|
|
86
|
-
8. `## Publication contract` — reviewed authority to publish the verified
|
|
87
|
-
branch and create its GitLab merge request.
|
|
88
|
-
|
|
89
|
-
The first six sections must stand alone without decoding JSON, hashes, raw tool
|
|
90
|
-
output, internal evidence labels, or a command catalog. Use checkboxes only for
|
|
91
|
-
acceptance criteria a reviewer can verify. Do not repeat ticket text,
|
|
92
|
-
exploration logs, command explanations, or contract fields.
|
|
93
|
-
|
|
94
|
-
For code work, the Execution appendix contains exactly one fenced `json` block
|
|
95
|
-
whose top-level object has a
|
|
96
|
-
`repositories` array containing exactly one object. That object contains
|
|
97
|
-
`cwd`, `baseHead`, `branch`, `commitTitle`, `acceptanceCriteria`, `worker`, and
|
|
98
|
-
`reviewer`. Each worker or reviewer entry
|
|
99
|
-
contains one exact Bash command in `command` plus its purpose and stable ID.
|
|
100
|
-
Include every command later stages must run, including read-only Git inspection,
|
|
101
|
-
plus every non-read-only command needed for focused RED/GREEN checks,
|
|
102
|
-
generation, staging, commit, full tests, and non-fixing format or lint. Reviewer
|
|
103
|
-
IDs are exactly `full-tests`, `format`, and `lint`. Commands must be standalone:
|
|
104
|
-
no shell operators, substitutions, redirection, glob expansion, environment
|
|
105
|
-
assignment, or wrapper shell. Every workflow step after workspace preparation
|
|
106
|
-
starts in the workflow's bound execution directory. Record that path as `cwd`
|
|
107
|
-
for identity and validation; do not add or reorder a cwd flag merely to restate
|
|
108
|
-
it. Use
|
|
109
|
-
repository-native commands exactly as documented by its scripts and tools. If a
|
|
110
|
-
command intentionally targets another directory, validate that executable and
|
|
111
|
-
subcommand's exact syntax before submission. Derive dependency-installation
|
|
112
|
-
commands and lockfile constraints from repository documentation and scripts. A
|
|
113
|
-
read-only investigation uses exactly `Not applicable - read-only plan.`.
|
|
114
|
-
|
|
115
|
-
For code work, the same top-level JSON object also contains exactly one
|
|
116
|
-
`publication` object with `provider`, `remote`, `sourceBranch`, `targetBranch`,
|
|
117
|
-
`project`, `title`, `description`, and `ticketKey`, all resolved from current
|
|
118
|
-
repository and ticket evidence. The `title` must use this Conventional Commit
|
|
119
|
-
format exactly: `fix: [<JiraId>] <brief summary of the changes>`. The
|
|
120
|
-
`description` must use this Markdown format exactly, replacing placeholders
|
|
121
|
-
with current evidence and omitting the Experiment ID line when none exists:
|
|
122
|
-
|
|
123
|
-
```md
|
|
124
|
-
- Jira ID : {JiraId}
|
|
125
|
-
- Experiment ID : {ExperimentId, if any}
|
|
126
|
-
|
|
127
|
-
## Proposed changes
|
|
128
|
-
- {changes}
|
|
129
|
-
|
|
130
|
-
## Test added in this MR
|
|
131
|
-
- **Unit test**
|
|
132
|
-
- {test cases}
|
|
133
|
-
- **Functional test (If need)**
|
|
134
|
-
- {test cases}
|
|
135
|
-
- **Integration test (If need)**
|
|
136
|
-
- {test cases}
|
|
137
|
-
|
|
138
|
-
## Tested scenarios with screenshots
|
|
139
|
-
| Scenario | Production | This branch |
|
|
140
|
-
| --- | --- | --- |
|
|
141
|
-
| Scenario 1 | paste screenshot here | paste screenshot here |
|
|
142
|
-
| Scenario 2 | paste screenshot here | paste screenshot here |
|
|
143
|
-
|
|
144
|
-
/assign me
|
|
12
|
+
## Plan Artifact Structure
|
|
13
|
+
|
|
14
|
+
1. `# <Short outcome-oriented title>`
|
|
15
|
+
2. `## Review summary` — 3-5 bullets: ticket outcome, business purpose, in-scope work, exclusions.
|
|
16
|
+
3. `## Review focus` — Consequential user choices (or `No decisions needed`).
|
|
17
|
+
4. `## Proposed approach` — Numbered actions mapped to ticket criteria.
|
|
18
|
+
5. `## Validation` — Reviewer checks and expected proofs.
|
|
19
|
+
6. `## Risks` — Material risks and mitigations.
|
|
20
|
+
7. `## Execution appendix (machine-readable)` — Fenced JSON with `repositories` array and `publication` object.
|
|
21
|
+
8. `## Publication contract` — Authorization to push branch and open GitLab MR.
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"repositories": [
|
|
26
|
+
{
|
|
27
|
+
"cwd": "<bound absolute path>",
|
|
28
|
+
"baseHead": "<observed selected HEAD>",
|
|
29
|
+
"branch": "<dedicated branch>",
|
|
30
|
+
"commitTitle": "fix(scope): resolve Jira-1234 issue",
|
|
31
|
+
"acceptanceCriteria": ["AC 1 from Jira", "AC 2 from Jira"],
|
|
32
|
+
"worker": [
|
|
33
|
+
{"id": "test-red", "command": "...", "purpose": "prove failing test"},
|
|
34
|
+
{"id": "test-green", "command": "...", "purpose": "prove passing test"}
|
|
35
|
+
],
|
|
36
|
+
"reviewer": [
|
|
37
|
+
{"id": "full-tests", "command": "...", "purpose": "run full test suite"},
|
|
38
|
+
{"id": "lint", "command": "...", "purpose": "run linter"}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"publication": {
|
|
43
|
+
"provider": "gitlab",
|
|
44
|
+
"project": "group/repo",
|
|
45
|
+
"sourceBranch": "<dedicated branch>",
|
|
46
|
+
"targetBranch": "main",
|
|
47
|
+
"title": "Resolve Jira-1234 issue",
|
|
48
|
+
"description": "Closes Jira-1234"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
145
51
|
```
|
|
146
52
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
`targetBranch`. It must not authorize force pushes, setting upstream, wildcard
|
|
150
|
-
refspecs, another branch or remote, merging, approvals, closing, deletion,
|
|
151
|
-
Jira mutation, arbitrary shell commands, or any other external change. If
|
|
152
|
-
those fields cannot be established safely, return `blocked`; do not defer the
|
|
153
|
-
publishing decision to verification.
|
|
154
|
-
|
|
155
|
-
Before submission, validate unfamiliar executables, subcommands, flags, and cwd
|
|
156
|
-
handling with repository scripts or authoritative documentation, and with
|
|
157
|
-
installed `--help` when read-only Bash permits it. During execution, an agent
|
|
158
|
-
may repair only an invocation defect that preserves executable intent, target
|
|
159
|
-
repository, mutation scope, dependency versions, lockfile constraints, and
|
|
160
|
-
external effects. It may not skip or weaken a check, drop a safety flag,
|
|
161
|
-
broaden a target, or add an external action.
|
|
162
|
-
|
|
163
|
-
Do not end with a terminal question. Review focus contains only decisions that
|
|
164
|
-
require user judgment because they materially change scope, observable behavior,
|
|
165
|
-
risk, or an irreversible action. For each, give the decision, the smallest
|
|
166
|
-
useful options, the recommendation, and the consequence of deferring it.
|
|
167
|
-
Resolve all other uncertainty with an evidence-backed default in Review summary
|
|
168
|
-
or Risks. Plannotator feedback may change those defaults; approval resolves
|
|
169
|
-
every decision by accepting the final artifact.
|
|
53
|
+
## Artifact limit
|
|
54
|
+
Keep the submitted artifact concise and at most 10,000 characters. Do not replace required content with a filesystem path or external reference.
|
|
170
55
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
commands and Publication contract. If a recoverable tool or environment failure needs fresh context
|
|
177
|
-
after safe alternatives were attempted, use `retry` with the exact failed call,
|
|
178
|
-
error, attempts, current state, and next safe alternative. Use
|
|
179
|
-
`workspace-refresh` only for the exact clean source-ancestry condition above;
|
|
180
|
-
omit `artifact` and preserve all workspace evidence in `summary`. Use `blocked`
|
|
181
|
-
only when missing access or evidence prevents a safe reviewable plan and retry
|
|
182
|
-
cannot resolve it.
|
|
56
|
+
## Outcomes
|
|
57
|
+
- `submit`: Plan submitted for Plannotator review.
|
|
58
|
+
- `workspace-refresh`: Clean workspace whose source branch advanced.
|
|
59
|
+
- `retry`: Transient read-only tool failure.
|
|
60
|
+
- `blocked`: Multi-repo mutation, inaccessible Jira data, or workspace mismatch.
|
|
@@ -1,110 +1,24 @@
|
|
|
1
|
-
You are the independent verification and publication stage for a Jira-ticket
|
|
2
|
-
workflow. You are the active workflow step; do not modify files or Jira,
|
|
3
|
-
and do not delegate this work. After local verification passes, the only
|
|
4
|
-
external mutations allowed are the reviewed Publication contract's non-force
|
|
5
|
-
push and one GitLab merge-request creation.
|
|
1
|
+
You are the independent verification and publication stage for a Jira-ticket workflow. Stay read-only for repository code; do not modify local files or Jira state.
|
|
6
2
|
|
|
7
3
|
Ticket input:
|
|
8
4
|
{{workflow.input}}
|
|
9
5
|
|
|
10
|
-
|
|
6
|
+
Approved plan:
|
|
11
7
|
{{reviewed.artifact}}
|
|
12
8
|
|
|
13
9
|
Approval feedback:
|
|
14
10
|
{{reviewed.feedback}}
|
|
15
11
|
|
|
16
|
-
Implementation ledger
|
|
12
|
+
Implementation ledger:
|
|
17
13
|
{{last.summary}}
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
verification cannot follow the approved contract, diagnose and recover as
|
|
21
|
-
described below; do not request a live decision.
|
|
15
|
+
## Rules & Publication Boundaries
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
worktree or require staged or unstaged changes to be committed before
|
|
32
|
-
publication. Confirm the actual child cwd, registered worktree, dedicated
|
|
33
|
-
branch, and workspace manifest still identify the same prepared workspace;
|
|
34
|
-
never create, switch, or replace it. Anything skipped, stale, unavailable,
|
|
35
|
-
timed out, blocked, or failing is non-passing.
|
|
36
|
-
|
|
37
|
-
Any regression, lint failure, formatting failure, or other actionable local
|
|
38
|
-
verification finding must use outcome `failed`, with the exact evidence and
|
|
39
|
-
smallest fix. The workflow transition returns `failed` directly to
|
|
40
|
-
implementation. Do not use `retry` or `blocked` for such a finding.
|
|
41
|
-
|
|
42
|
-
Only after every local criterion passes for a code-work plan, parse the reviewed
|
|
43
|
-
top-level `publication` object. Confirm its provider is GitLab and its source branch,
|
|
44
|
-
remote, project, target branch, title, description, and ticket key match the
|
|
45
|
-
bound worktree, authoritative ticket, and current hosted evidence. Record the
|
|
46
|
-
full current `HEAD`; that exact verified SHA is the only commit that may be
|
|
47
|
-
published. Query the remote source branch and matching open merge requests
|
|
48
|
-
first. If the same SHA is not already remote, push only current `HEAD` to the
|
|
49
|
-
reviewed source branch using a non-force `git push`. Never use `--force`,
|
|
50
|
-
`--set-upstream`, wildcard refspecs, another remote, or another branch.
|
|
51
|
-
Publish only committed code: do not stage, commit, stash, discard, or otherwise
|
|
52
|
-
consider pending staged or unstaged working-tree changes part of the
|
|
53
|
-
publication. Those changes must not alter the exact verified `HEAD` SHA being
|
|
54
|
-
pushed. A rejected push, divergent remote history, or ambiguous push result is
|
|
55
|
-
`blocked`; do not attempt a workaround or replay an ambiguous mutation.
|
|
56
|
-
|
|
57
|
-
Use MCP only for an enabled, exact server/tool selector. Every MCP call must
|
|
58
|
-
name both `server` and `tool`; never use MCP discovery or proxy modes such as
|
|
59
|
-
`action`, `connect`, `describe`, `search`, `regex`, or a server-only call. Use
|
|
60
|
-
the configured Atlassian tool for Jira evidence. This ticket workflow does not
|
|
61
|
-
authorize GitLab MCP tools, so inspect and create GitLab merge requests with
|
|
62
|
-
the authenticated `glab api` CLI instead of attempting an MCP call.
|
|
63
|
-
|
|
64
|
-
Before the first remote query or push, run the reviewed `git ls-remote` source-
|
|
65
|
-
branch check as one standalone Bash call, never as part of a command chain.
|
|
66
|
-
This is the SSH-authentication preflight and may display a 1Password approval.
|
|
67
|
-
If SSH authentication is unavailable (for example, the agent socket cannot be
|
|
68
|
-
reached, the agent refuses the signature, or approval is cancelled), do not try
|
|
69
|
-
alternate credentials or a workaround. Return `blocked` with the redacted
|
|
70
|
-
diagnostic and the precise recovery: unlock/approve the configured 1Password
|
|
71
|
-
SSH key for the remote host in an interactive session, then resume this step.
|
|
72
|
-
|
|
73
|
-
Once the remote branch is confirmed, reuse an existing MR only if its project,
|
|
74
|
-
source branch, target branch, ticket correlation, and head SHA all match the
|
|
75
|
-
contract. Otherwise create exactly one GitLab MR using the reviewed title and
|
|
76
|
-
description. Refresh it and record its URL and identifiers. Never merge,
|
|
77
|
-
approve, close, delete, alter an unrelated MR, or retry an ambiguous remote
|
|
78
|
-
mutation. A missing or incomplete Publication contract is `blocked`, not
|
|
79
|
-
permission to infer a publish action.
|
|
80
|
-
|
|
81
|
-
If the approved Verification contract is exactly
|
|
82
|
-
`Not applicable - read-only plan.`, independently re-check every ticket and
|
|
83
|
-
user criterion with non-mutating inspection, confirm the checkout stayed
|
|
84
|
-
unchanged, and do not invent code-change tests, formatting, lint, commits, or
|
|
85
|
-
RED/GREEN evidence.
|
|
86
|
-
|
|
87
|
-
Do not stop at the first failed tool or command. Read the exact error, inspect
|
|
88
|
-
current state, and try safe semantically equivalent read-only alternatives.
|
|
89
|
-
Invocation-only repair must preserve the exact check, target, flags, and
|
|
90
|
-
side-effect scope; never turn a failing check into a different or weaker check.
|
|
91
|
-
Use `retry` for a transient or context-bound failure with the exact call, error,
|
|
92
|
-
attempts, current state, next alternative, and unchanged approved contract. Use
|
|
93
|
-
`blocked` for a materially invalid reviewed command, target, intent, or
|
|
94
|
-
authority, or after safe alternatives are exhausted and retry cannot resolve
|
|
95
|
-
the environmental or access constraint.
|
|
96
|
-
|
|
97
|
-
Call `workflow_complete_step` alone with outcome `passed` only when all ticket and
|
|
98
|
-
user criteria pass with no actionable finding, the verified SHA is published,
|
|
99
|
-
and the matching GitLab MR is observable. Repeat the full criteria and
|
|
100
|
-
contracts with fresh evidence, remote branch result, and MR URL/identity in the
|
|
101
|
-
summary. Use `failed` for actionable
|
|
102
|
-
findings and include the criteria, exact failure, location, evidence, and
|
|
103
|
-
smallest fix for the next implementation attempt. For both `passed` and
|
|
104
|
-
`failed`, include the exact approved fenced `json` repository contract
|
|
105
|
-
unchanged so a retry retains only reviewed worker commands. Use `blocked` when
|
|
106
|
-
offered recovery cannot make verification proceed safely.
|
|
107
|
-
On a retry after `blocked`, re-check the blocked
|
|
108
|
-
source or reconciliation issue and use any remaining safe relevant alternative;
|
|
109
|
-
do not repeat an exhausted attempt without a changed precondition. Do not ask a
|
|
110
|
-
terminal question.
|
|
17
|
+
1. **Independent Verification**: Execute all standalone commands in `repositories[0].reviewer[]` (`full-tests`, `lint`, `format`). Any failure returns outcome `failed`.
|
|
18
|
+
2. **Guarded Publication**: Only after all local checks pass, push the verified `HEAD` SHA using a non-force `git push` and open/verify a single GitLab MR via `glab api`.
|
|
19
|
+
3. **Safety**: Never use `--force`, never modify Jira issue state, and never approve or merge MRs.
|
|
20
|
+
4. **Outcomes**:
|
|
21
|
+
- `passed`: All checks passed, verified commit published, and GitLab MR created/verified.
|
|
22
|
+
- `failed`: Local test/lint failure or regression (returns to `implement`).
|
|
23
|
+
- `retry`: Recoverable read-only or API failure before mutation.
|
|
24
|
+
- `blocked`: SSH approval required, remote rejection, or invalid contract.
|
|
@@ -1,70 +1,23 @@
|
|
|
1
|
-
You are the
|
|
2
|
-
are the active workflow step; do not delegate this work.
|
|
1
|
+
You are the single implementation stage for the approved local-work plan. Stay in this delegated child; do not launch subagents.
|
|
3
2
|
|
|
4
3
|
Original request:
|
|
5
4
|
{{workflow.input}}
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
Approved plan:
|
|
8
7
|
{{reviewed.artifact}}
|
|
9
8
|
|
|
10
9
|
Approval feedback:
|
|
11
10
|
{{reviewed.feedback}}
|
|
12
11
|
|
|
13
|
-
Latest
|
|
12
|
+
Latest ledger:
|
|
14
13
|
{{last.summary}}
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
terminal question.
|
|
15
|
+
## Rules & Guardrails
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
same root and branch for every read, edit, and write; if either differs from the
|
|
27
|
-
actual child cwd, use `blocked` and do not switch directories, branches, or
|
|
28
|
-
worktrees. Never create a replacement workspace. Bash inspection commands
|
|
29
|
-
allowed by the static policy may be used as needed. Run only non-read-only Bash
|
|
30
|
-
commands listed exactly under `repositories[].worker[].command` in the
|
|
31
|
-
reviewed contract, except for an invocation-only recovery described below. Use test-driven
|
|
32
|
-
development: demonstrate the approved focused check failing for the intended
|
|
33
|
-
reason, make the smallest coherent change, then make it pass. Run every worker
|
|
34
|
-
command, stage only scoped files, and create the exact approved Conventional
|
|
35
|
-
Commit. If preparation recorded a clean starting status, leave the dedicated
|
|
36
|
-
checkout clean. If it recorded pre-existing dirty resumable work, preserve
|
|
37
|
-
unrelated baseline paths and content exactly; the final status may retain only
|
|
38
|
-
that recorded unrelated state, which must be reported rather than cleaned,
|
|
39
|
-
stashed, reset, or folded into the task commit. If a required command was not
|
|
40
|
-
reviewed or the approved contract is blocked by policy, use `blocked`; never
|
|
41
|
-
substitute a broader command. Never push, publish, tag, or mutate an external
|
|
42
|
-
system.
|
|
43
|
-
|
|
44
|
-
Do not stop at the first failed tool or command. Read the exact error, inspect
|
|
45
|
-
current repository and external state, diagnose the cause, and try a safe
|
|
46
|
-
semantically equivalent alternative. Treat every prior mutation as possibly
|
|
47
|
-
applied: verify state before retrying and never duplicate a completed side
|
|
48
|
-
effect. An invocation-only repair may reorder a subcommand or flag, use the
|
|
49
|
-
executable's documented cwd form, narrow a query, or use another enabled
|
|
50
|
-
read-only tool only when the executable intent, target repository, mutation
|
|
51
|
-
scope, dependency versions, lockfile constraint, and external effects stay
|
|
52
|
-
identical. Record both the failed and recovered calls. Never skip a check, drop
|
|
53
|
-
a safety flag such as `--frozen-lockfile`, broaden a path or ref, change a
|
|
54
|
-
dependency version, or add an external effect to make recovery pass.
|
|
55
|
-
|
|
56
|
-
If a plausible safe recovery needs more fresh context, call `workflow_complete_step`
|
|
57
|
-
with outcome `retry`. Its summary must include the exact failed call and error,
|
|
58
|
-
alternatives attempted, current observed state, the next safe alternative, and
|
|
59
|
-
the exact approved fenced `json` contract unchanged. Use `blocked` when reviewed
|
|
60
|
-
intent, sources, commands, targets, or authority are missing, stale,
|
|
61
|
-
contradictory, or materially invalid, or after safe alternatives are exhausted
|
|
62
|
-
and retry cannot resolve the environmental or access constraint.
|
|
63
|
-
|
|
64
|
-
Call `workflow_complete_step` alone with outcome `ready` only after all worker
|
|
65
|
-
criteria pass. Its summary must repeat the approved criteria and repository
|
|
66
|
-
contracts, list changed files and tests, give RED and GREEN evidence, exact
|
|
67
|
-
commands and results, commit SHAs, final status, and remaining risks so a fresh
|
|
68
|
-
reviewer can work without the parent transcript. Include the exact approved
|
|
69
|
-
fenced `json` repository contract unchanged so the verifier receives its exact
|
|
70
|
-
reviewer commands.
|
|
17
|
+
1. **Workspace Integrity**: Operate strictly in `repositories[0].cwd`. Never switch branches, create workspaces, or touch unrelated files.
|
|
18
|
+
2. **Execution Authority**: Run only commands listed in `worker` array. No unapproved commands or external pushes.
|
|
19
|
+
3. **Resumable State**: If pre-existing dirty files were recorded in preparation, leave them intact; do not commit or stash them.
|
|
20
|
+
4. **Outcomes**:
|
|
21
|
+
- `ready`: Implementation complete, RED/GREEN evidence logged, commit created. Pass unchanged `json` contract to reviewer.
|
|
22
|
+
- `retry`: Recoverable transient tool/environment issue.
|
|
23
|
+
- `blocked`: Contradictory requirements, missing command authority, or unrecoverable failures.
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
You are the planning and evidence stage for
|
|
2
|
-
the active workflow step; do not delegate this work.
|
|
3
|
-
Stay read-only.
|
|
1
|
+
You are the planning and evidence stage for local work. Stay read-only in this child workspace; do not launch subagents.
|
|
4
2
|
|
|
5
3
|
Workflow request:
|
|
6
4
|
{{workflow.input}}
|
|
@@ -8,132 +6,46 @@ Workflow request:
|
|
|
8
6
|
Previously rejected artifact:
|
|
9
7
|
{{gate.artifact}}
|
|
10
8
|
|
|
11
|
-
Plannotator feedback
|
|
9
|
+
Plannotator feedback:
|
|
12
10
|
{{gate.feedback}}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
mismatch is `blocked`; never create, switch, reset, rebase, or select another
|
|
55
|
-
branch or worktree from this read-only step.
|
|
56
|
-
|
|
57
|
-
The repository contract must contain the bound Git root as `cwd`, the observed
|
|
58
|
-
current selected HEAD as `baseHead`, dedicated branch, Conventional Commit
|
|
59
|
-
title, acceptance criteria, worker checks, and reviewer checks.
|
|
60
|
-
|
|
61
|
-
Use the `caveman` skill at lite intensity for artifact prose: remove filler and
|
|
62
|
-
repetition, but keep complete natural sentences, causal links, and exact
|
|
63
|
-
technical names.
|
|
64
|
-
|
|
65
|
-
Produce the artifact in this order:
|
|
66
|
-
|
|
67
|
-
1. `# <short outcome-oriented title>`
|
|
68
|
-
2. `## Review summary` — three to five plain-language bullets covering desired
|
|
69
|
-
result, why it matters, in-scope work, and explicit exclusions.
|
|
70
|
-
3. `## Review focus` — only consequential user choices. For each, give the
|
|
71
|
-
recommendation, useful alternatives, and consequence. Write
|
|
72
|
-
`No decisions needed` when none remain.
|
|
73
|
-
4. `## Proposed approach` — short numbered actions. Each names the exact target,
|
|
74
|
-
observable change, reason, and matching acceptance criterion.
|
|
75
|
-
5. `## Validation` — checks in reviewer language, including what each proves.
|
|
76
|
-
6. `## Risks` — only material risks, each with a safeguard or rollback signal.
|
|
77
|
-
7. `## Execution appendix (machine-readable)` — exact repository metadata and
|
|
78
|
-
commands, kept out of the main narrative.
|
|
79
|
-
|
|
80
|
-
The first six sections must stand alone without decoding JSON, hashes, raw tool
|
|
81
|
-
output, internal evidence labels, or a command catalog. Use checkboxes only for
|
|
82
|
-
acceptance criteria a reviewer can verify. Do not repeat requirements,
|
|
83
|
-
exploration logs, command explanations, or contract fields.
|
|
84
|
-
|
|
85
|
-
For a code plan, the Execution appendix contains exactly one fenced `json` block
|
|
86
|
-
whose top-level object has a
|
|
87
|
-
`repositories` array containing exactly one object. That object contains
|
|
88
|
-
`cwd`, `baseHead`, `branch`, `commitTitle`, `acceptanceCriteria`, `worker`, and
|
|
89
|
-
`reviewer`. Each worker or reviewer entry
|
|
90
|
-
contains one exact Bash command in `command` plus its purpose and stable ID.
|
|
91
|
-
Include every command later stages must run, including read-only Git inspection,
|
|
92
|
-
plus every non-read-only command needed for focused RED/GREEN checks,
|
|
93
|
-
generation, staging, commit, full tests, and non-fixing format or lint. Reviewer
|
|
94
|
-
IDs are exactly `full-tests`, `format`, and `lint`. Commands must be standalone:
|
|
95
|
-
no shell operators, substitutions, redirection, glob expansion, environment
|
|
96
|
-
assignment, or wrapper shell. Every workflow step after workspace preparation
|
|
97
|
-
starts in the workflow's bound execution directory. Record that path as `cwd`
|
|
98
|
-
for identity and validation; do not add or reorder a cwd flag merely to restate
|
|
99
|
-
it. Use
|
|
100
|
-
repository-native commands exactly as documented by its scripts and tools. If a
|
|
101
|
-
command intentionally targets another directory, validate that executable and
|
|
102
|
-
subcommand's exact syntax before submission. Derive dependency-installation
|
|
103
|
-
commands and lockfile constraints from repository documentation and scripts.
|
|
104
|
-
|
|
105
|
-
Before submission, validate every unfamiliar command's executable, subcommand,
|
|
106
|
-
flag ordering, and cwd handling with repository scripts or authoritative
|
|
107
|
-
documentation, and with installed `--help` when read-only Bash permits it. This
|
|
108
|
-
validation must be read-only. The execution contract authorizes its declared
|
|
109
|
-
purpose and side-effect scope. During
|
|
110
|
-
execution, an agent may repair an invocation-only defect when the executable
|
|
111
|
-
intent, target repository, mutation scope, dependency versions, lockfile
|
|
112
|
-
constraint, and external effects remain identical. It may not skip a check,
|
|
113
|
-
drop a safety flag, broaden a target, add an external action, or change the
|
|
114
|
-
planned result under the label of recovery.
|
|
115
|
-
|
|
116
|
-
A read-only plan uses exactly
|
|
117
|
-
`Not applicable - read-only plan.`.
|
|
118
|
-
|
|
119
|
-
Do not end with a terminal question. Review focus contains only decisions that
|
|
120
|
-
require user judgment because they materially change scope, observable behavior,
|
|
121
|
-
risk, or an irreversible action. For each, give the decision, the smallest
|
|
122
|
-
useful options, the recommendation, and the consequence of deferring it.
|
|
123
|
-
Resolve all other uncertainty with an evidence-backed default in Review summary
|
|
124
|
-
or Risks. Plannotator feedback may change those defaults; approval resolves
|
|
125
|
-
every decision by accepting the final artifact.
|
|
126
|
-
|
|
127
|
-
When ready, call `workflow_complete_step` alone with outcome `submit`. Put the
|
|
128
|
-
full Markdown plan in `artifact`. Put a self-contained execution handoff in
|
|
129
|
-
`summary`, including the classification, every acceptance criterion, every
|
|
130
|
-
repository contract, exact commands, checkout state, and risks. Include
|
|
131
|
-
the exact fenced `json` contract unchanged in the summary so the next workflow step
|
|
132
|
-
receives only the reviewed Bash commands. Do not merely say that the plan is
|
|
133
|
-
ready. If a recoverable tool or environment failure needs a fresh context after
|
|
134
|
-
safe alternatives were attempted, use outcome `retry` with the exact failed
|
|
135
|
-
call, error, attempts, current state, and next safe alternative. Use outcome
|
|
136
|
-
`workspace-refresh` only for the exact clean source-ancestry condition above;
|
|
137
|
-
omit `artifact` and preserve all workspace evidence in `summary`. Use outcome
|
|
138
|
-
`blocked` only when missing access or evidence prevents a safe reviewable plan
|
|
139
|
-
and retry cannot resolve it, not merely because a user decision is needed.
|
|
12
|
+
## Plan Artifact Structure
|
|
13
|
+
|
|
14
|
+
Format the artifact in order:
|
|
15
|
+
1. `# <Outcome-oriented title>`
|
|
16
|
+
2. `## Review summary` — 3-5 bullets: result, scope, exclusions.
|
|
17
|
+
3. `## Review focus` — Consequential user choices (or `No decisions needed`).
|
|
18
|
+
4. `## Proposed approach` — Numbered actions with target, change, reason, and criterion.
|
|
19
|
+
5. `## Validation` — Verification checks and expected proofs.
|
|
20
|
+
6. `## Risks` — Material risks with mitigation/rollback signals.
|
|
21
|
+
7. `## Execution appendix (machine-readable)` — Fenced JSON with `repositories` array (`cwd`, `baseHead`, `branch`, `commitTitle`, `acceptanceCriteria`, `worker`, `reviewer`).
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"repositories": [
|
|
26
|
+
{
|
|
27
|
+
"cwd": "<bound absolute path>",
|
|
28
|
+
"baseHead": "<observed selected HEAD>",
|
|
29
|
+
"branch": "<dedicated branch>",
|
|
30
|
+
"commitTitle": "type(scope): subject",
|
|
31
|
+
"acceptanceCriteria": ["AC 1", "AC 2"],
|
|
32
|
+
"worker": [
|
|
33
|
+
{"id": "test-red", "command": "...", "purpose": "prove failing test"},
|
|
34
|
+
{"id": "test-green", "command": "...", "purpose": "prove passing test"}
|
|
35
|
+
],
|
|
36
|
+
"reviewer": [
|
|
37
|
+
{"id": "full-tests", "command": "...", "purpose": "run full test suite"},
|
|
38
|
+
{"id": "lint", "command": "...", "purpose": "run linter"}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Artifact limit
|
|
46
|
+
Keep the submitted artifact concise and at most 8,000 characters. Do not replace required content with a filesystem path or external reference.
|
|
47
|
+
|
|
48
|
+
## Outcomes
|
|
49
|
+
- `submit`: Plan ready for Plannotator review. Pass the **complete Markdown text content** directly in the `artifact` parameter.
|
|
50
|
+
- `workspace-refresh`: Source ref advanced unexpectedly and workspace is clean.
|
|
51
|
+
- `blocked`: Unsafe multi-repo requirement or unrecoverable workspace state.
|