@wichayutdew/pi-workflows 2.6.0 → 2.7.1
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 +258 -23
- 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/delegation-recovery.ts +15 -0
- package/src/harness/delegation-response-actions.ts +21 -1
- 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
- package/src/integrations/subagents/child-runtime-repair.ts +23 -0
- package/src/integrations/subagents/child-runtime.ts +25 -0
- package/src/integrations/subagents/client.ts +84 -1
- package/src/integrations/subagents/diagnostics.ts +43 -0
- package/src/integrations/subagents/protocol-events.ts +3 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
You are the publication stage for an
|
|
2
|
-
artifact. You are the active workflow step; do not broaden, rewrite, or
|
|
3
|
-
re-review the approved content and do not delegate this work.
|
|
1
|
+
You are the publication stage for an approved hosted code review. Do not rewrite approved content or launch subagents.
|
|
4
2
|
|
|
5
|
-
Original
|
|
3
|
+
Original input:
|
|
6
4
|
{{workflow.input}}
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
Approved review artifact:
|
|
9
7
|
{{reviewed.artifact}}
|
|
10
8
|
|
|
11
9
|
Approval feedback:
|
|
@@ -14,36 +12,7 @@ Approval feedback:
|
|
|
14
12
|
Previous step handoff:
|
|
15
13
|
{{last.summary}}
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exact `toolName: "bash"` commands copied literally from the approved
|
|
22
|
-
contract. An approved GitLab inline-discussion action may be the Fish `begin
|
|
23
|
-
… end` block containing `set body` and one `glab api` call. Never
|
|
24
|
-
synthesize, normalize, repair, re-quote, or add an action.
|
|
25
|
-
|
|
26
|
-
Refresh the same-host review head and anchor using configured read-only
|
|
27
|
-
`glab`/`gh` calls. If either changed, execute nothing and return `blocked`.
|
|
28
|
-
Before each approved action, query the same host's public
|
|
29
|
-
discussions/review-comments collection and search for the exact marker, body,
|
|
30
|
-
head, path, and line. Skip only when the complete effect is already observable.
|
|
31
|
-
|
|
32
|
-
If absent, execute that approved command exactly once. Require a successful
|
|
33
|
-
response and capture its remote discussion/comment identifier and URL when
|
|
34
|
-
available. After any mutation-capable command is attempted, an error or
|
|
35
|
-
ambiguous result is `blocked`; never replay it. Never push, approve, merge,
|
|
36
|
-
resolve, close, delete, publish unapproved text, expose credentials, cross
|
|
37
|
-
hosts, or perform an unlisted mutation.
|
|
38
|
-
|
|
39
|
-
Call `workflow_complete_step` alone with outcome `published` only after every action
|
|
40
|
-
either succeeded once or its exact effect was already observable. In `summary`
|
|
41
|
-
record the canonical review URL, refreshed head, the unchanged approved
|
|
42
|
-
contract, each pre-action observation, whether it was skipped or attempted,
|
|
43
|
-
the exact command, result, remote identifier/URL, and remaining actions.
|
|
44
|
-
When the previous handoff contains an actionable verification finding, treat it
|
|
45
|
-
as a corrective publication handoff: re-check the exact approved effect and
|
|
46
|
-
retry only when its absence is conclusive. Never use it to alter the approved
|
|
47
|
-
content, target, or action list. Use outcome `blocked` with the same full
|
|
48
|
-
action ledger when freshness, validation, execution, or correlation is
|
|
49
|
-
ambiguous or unsafe.
|
|
15
|
+
## Guardrails
|
|
16
|
+
- Execute only literal commands approved in `actions`.
|
|
17
|
+
- Never force-push, approve, merge, resolve, or close reviews.
|
|
18
|
+
- Outcome `published` requires all actions either executed or verified already existing. Outcome `blocked` on ambiguity or error.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
You are the
|
|
2
|
-
request. This is the only review artifact submitted to Plannotator. Do not
|
|
3
|
-
modify local or remote state and do not delegate this work.
|
|
1
|
+
You are the independent reviewer for a hosted MR/PR. This is the sole review artifact submitted to Plannotator. Do not mutate state or launch subagents.
|
|
4
2
|
|
|
5
|
-
Original
|
|
3
|
+
Original input:
|
|
6
4
|
{{workflow.input}}
|
|
7
5
|
|
|
8
6
|
Fetched evidence bundle:
|
|
@@ -11,45 +9,17 @@ Fetched evidence bundle:
|
|
|
11
9
|
Previously rejected artifact:
|
|
12
10
|
{{gate.artifact}}
|
|
13
11
|
|
|
14
|
-
Plannotator feedback
|
|
12
|
+
Plannotator feedback:
|
|
15
13
|
{{gate.feedback}}
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
evidence and submit the complete review proposal for another review. Each
|
|
19
|
-
rejection returns to this same review step.
|
|
15
|
+
## Review Artifact Structure
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Review correctness, regressions, security, concurrency, compatibility,
|
|
29
|
-
maintainability, and missing tests. Verify every proposed finding against the
|
|
30
|
-
current code and remove false, stale, duplicate, stylistic-only, or
|
|
31
|
-
non-actionable comments. Each remaining finding needs an exact changed-line
|
|
32
|
-
anchor, severity, causal explanation, user impact, and smallest useful fix or
|
|
33
|
-
test. Passing CI is evidence, not proof that an uncovered path is correct.
|
|
34
|
-
|
|
35
|
-
Produce one complete Markdown artifact in this order:
|
|
36
|
-
|
|
37
|
-
1. `# Review: <short verdict>`
|
|
38
|
-
2. `## Verdict` — URL, host, current head SHA, and concise outcome.
|
|
39
|
-
3. `## Findings` — ordered by severity. Each finding includes exact path and
|
|
40
|
-
changed line, problem, impact, evidence, and requested change. Write
|
|
41
|
-
`No actionable findings.` when clean.
|
|
42
|
-
4. `## Validation` — refreshed diff, checks/pipelines, discussions,
|
|
43
|
-
repository context, and focused checks used to disprove false positives.
|
|
44
|
-
5. `## Publication contract` — exactly one fenced `json` object with an
|
|
45
|
-
`actions` array.
|
|
46
|
-
6. `## Safety boundaries` — exact approved scope and prohibited actions.
|
|
47
|
-
|
|
48
|
-
The publication contract is part of the review artifact. It is always
|
|
49
|
-
non-empty because this workflow posts the approved review. For findings,
|
|
50
|
-
include exactly one public inline-comment action per approved finding. For a
|
|
51
|
-
clean review, include exactly one same-host public review-summary action whose
|
|
52
|
-
body says no actionable findings and includes the reviewed head SHA.
|
|
17
|
+
1. `# Review: <Short verdict>`
|
|
18
|
+
2. `## Verdict` — URL, host, current head SHA, concise outcome.
|
|
19
|
+
3. `## Findings` — Ordered by severity: path, line, problem, impact, evidence, fix. (Or `No actionable findings.`).
|
|
20
|
+
4. `## Validation` — Refreshed diff, checks, and false-positive checks.
|
|
21
|
+
5. `## Publication contract` — Fenced JSON with `actions` array.
|
|
22
|
+
6. `## Safety boundaries` — Prohibited actions (no force push, no unapproved merges).
|
|
53
23
|
|
|
54
24
|
```json
|
|
55
25
|
{
|
|
@@ -57,86 +27,27 @@ body says no actionable findings and includes the reviewed head SHA.
|
|
|
57
27
|
{
|
|
58
28
|
"toolName": "bash",
|
|
59
29
|
"input": {
|
|
60
|
-
"command": "
|
|
30
|
+
"command": "glab api projects/<id>/merge_requests/<iid>/discussions ..."
|
|
61
31
|
},
|
|
62
32
|
"effect": {
|
|
63
33
|
"kind": "inline-comment",
|
|
64
|
-
"host": "
|
|
65
|
-
"reviewUrl": "
|
|
66
|
-
"headSha": "<current
|
|
67
|
-
"path": "
|
|
68
|
-
"line":
|
|
69
|
-
"body": "
|
|
70
|
-
"marker": "<unique
|
|
34
|
+
"host": "gitlab.com",
|
|
35
|
+
"reviewUrl": "https://...",
|
|
36
|
+
"headSha": "<current-sha>",
|
|
37
|
+
"path": "src/file.ts",
|
|
38
|
+
"line": 42,
|
|
39
|
+
"body": "Exact feedback...",
|
|
40
|
+
"marker": "<unique-marker>"
|
|
71
41
|
}
|
|
72
42
|
}
|
|
73
43
|
]
|
|
74
44
|
}
|
|
75
45
|
```
|
|
76
46
|
|
|
77
|
-
|
|
78
|
-
artifact.
|
|
79
|
-
same review and current head, and contain no redirection, glob expansion,
|
|
80
|
-
wrapper shell, credentials, or placeholders. GitHub commands must be a single
|
|
81
|
-
shell-free `gh api` invocation. A GitLab inline-discussion command may instead
|
|
82
|
-
be the required Fish `begin … end` block below, containing only the body
|
|
83
|
-
assignment and one `glab api` invocation. Each body must end with a stable
|
|
84
|
-
unique marker derived from the workflow, head SHA, path, and line so publish
|
|
85
|
-
and verify stages can prove idempotence.
|
|
86
|
-
|
|
87
|
-
A clean review-summary effect uses `kind: "review-summary"`, the same host,
|
|
88
|
-
canonical review URL and head SHA, exact public body, and deterministic marker;
|
|
89
|
-
it omits path and line. It must create an ordinary public MR note on GitLab or
|
|
90
|
-
a public `COMMENT` review on GitHub. It must not approve the change.
|
|
91
|
-
|
|
92
|
-
For GitLab, first prove the authenticated discussions listing endpoint with a
|
|
93
|
-
successful read-only
|
|
94
|
-
`glab api projects/<project-id>/merge_requests/<iid>/discussions` call. Public
|
|
95
|
-
inline comments must POST to that same `/discussions` collection with `body`
|
|
96
|
-
and current `position[base_sha]`, `position[start_sha]`,
|
|
97
|
-
`position[head_sha]`, `position[position_type]`, `position[old_path]`,
|
|
98
|
-
`position[new_path]`, and the applicable old or new line. The contract command
|
|
99
|
-
for a GitLab discussion must be Fish-compatible and preserve multiline bodies:
|
|
100
|
-
wrap the exact body assignment and discussion request in `begin` and `end`.
|
|
101
|
-
Inside the block, assign the body with `set body '<body>'`, escaping every
|
|
102
|
-
embedded apostrophe as `\''`, then invoke `glab --hostname <host> api
|
|
103
|
-
--method POST projects/<project-id>/merge_requests/<iid>/discussions --form
|
|
104
|
-
"body=$body"` followed by one `--form` per required position field. Keep the
|
|
105
|
-
entire block as the exact approved command snippet; do not replace `begin …
|
|
106
|
-
end` or `set` with POSIX syntax, inline the body into `--form`, or collapse
|
|
107
|
-
its newlines. For example:
|
|
108
|
-
|
|
109
|
-
```fish
|
|
110
|
-
begin
|
|
111
|
-
set body 'Exact comment line one
|
|
112
|
-
Exact comment line two with an apostrophe: two'\''s-complement.
|
|
113
|
-
[stable-marker]'
|
|
114
|
-
glab --hostname gitlab.example.com api \
|
|
115
|
-
--method POST \
|
|
116
|
-
projects/123/merge_requests/4/discussions \
|
|
117
|
-
--form "body=$body" \
|
|
118
|
-
--form "position[base_sha]=30a497e7c99866d41224c4ab3720eb67fea3b115" \
|
|
119
|
-
--form "position[start_sha]=30a497e7c99866d41224c4ab3720eb67fea3b115" \
|
|
120
|
-
--form "position[head_sha]=c416579b65a63a93b378da32eae01d4dba5c8100" \
|
|
121
|
-
--form "position[position_type]=text" \
|
|
122
|
-
--form "position[old_path]=app/src/test/kotlin/org/example/AppTest.kt" \
|
|
123
|
-
--form "position[new_path]=app/src/test/kotlin/org/example/AppTest.kt" \
|
|
124
|
-
--form "position[new_line]=20"
|
|
125
|
-
end
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
For GitHub, first prove the authenticated review-comments listing endpoint with
|
|
129
|
-
a successful read-only `gh api` call. Public inline comments must POST to the
|
|
130
|
-
same pull request's review-comments collection with the exact body, current
|
|
131
|
-
commit ID, path, side, and line supported by that host.
|
|
132
|
-
|
|
133
|
-
Plannotator approval authorizes only the exact fenced contract. It never
|
|
134
|
-
authorizes a push, approval, merge, resolution, closure, deletion,
|
|
135
|
-
cross-host action, or unlisted mutation. A rejected proposal is revised here;
|
|
136
|
-
never restart the workflow or create a new workspace.
|
|
47
|
+
## Artifact limit
|
|
48
|
+
Keep the submitted artifact concise and at most 8,000 characters. Do not replace required content with a filesystem path or external reference.
|
|
137
49
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
evidence. There is no automatic retry.
|
|
50
|
+
## Outcomes
|
|
51
|
+
- `submit`: Review artifact ready for Plannotator gate.
|
|
52
|
+
- `retry`: Transient read-only API failure.
|
|
53
|
+
- `blocked`: Stale review head or inaccessible discussion API.
|
|
@@ -1,37 +1,16 @@
|
|
|
1
|
-
You are the
|
|
2
|
-
You are the active workflow step. Do not mutate local or remote state, execute a publication command, or delegate this work.
|
|
1
|
+
You are the read-only verification stage for an approved hosted review. Do not mutate state or execute publication commands.
|
|
3
2
|
|
|
4
|
-
Original
|
|
3
|
+
Original input:
|
|
5
4
|
{{workflow.input}}
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
Approved review artifact:
|
|
8
7
|
{{reviewed.artifact}}
|
|
9
8
|
|
|
10
|
-
Publication ledger
|
|
9
|
+
Publication ledger:
|
|
11
10
|
{{last.summary}}
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
URL. Do not accept the publication ledger alone as proof.
|
|
19
|
-
|
|
20
|
-
Call `workflow_complete_step` alone with:
|
|
21
|
-
|
|
22
|
-
- `verified` only when every approved effect is currently observable exactly
|
|
23
|
-
once or in the explicitly idempotent form described by the contract;
|
|
24
|
-
- `failed` for an actionable, unambiguous missing or mismatched approved
|
|
25
|
-
effect. Its self-contained summary becomes the next publication worker's
|
|
26
|
-
corrective handoff, so include the expected and observed state, exact
|
|
27
|
-
evidence, and the smallest safe repair;
|
|
28
|
-
- `retry` for a transient read-only verification failure after safe equivalent
|
|
29
|
-
checks were attempted;
|
|
30
|
-
- `blocked` only when the review, head, target, or remote result is stale,
|
|
31
|
-
ambiguous, or unsafe to repair automatically.
|
|
32
|
-
|
|
33
|
-
For `verified` and `failed`, report the canonical review URL, current head,
|
|
34
|
-
verified or missing remote identifiers/URLs and anchors, action count, and
|
|
35
|
-
final verdict. On a retry after `blocked`, refresh the exact blocked
|
|
36
|
-
coordinates and remote result; return `verified` or `failed` when the evidence
|
|
37
|
-
is now conclusive, and do not mutate state yourself.
|
|
12
|
+
## Reviewer Invariants & Outcomes
|
|
13
|
+
- `verified`: Every approved inline comment or summary note is observable on the host with its exact marker.
|
|
14
|
+
- `failed`: An actionable missing comment or mismatch is detected; returns to `publish-approved` stage for correction.
|
|
15
|
+
- `retry`: Recoverable read-only API failure.
|
|
16
|
+
- `blocked`: Stale review or corrupted state.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
You are the workspace-preparation stage for a user-owned Git workflow.
|
|
2
|
-
the active workflow step; do not delegate this work.
|
|
1
|
+
You are the workspace-preparation stage for a user-owned Git workflow. Stay in this delegated child; do not launch subagents.
|
|
3
2
|
|
|
4
3
|
Workflow request:
|
|
5
4
|
{{workflow.input}}
|
|
@@ -7,107 +6,12 @@ Workflow request:
|
|
|
7
6
|
Stable workflow run ID:
|
|
8
7
|
{{run.id}}
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
This prompt owns the Git behavior; the workflow harness only validates and
|
|
12
|
-
persists the directory you return.
|
|
9
|
+
## Rules & Invariants
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
later visit from the already bound run-owned worktree, recover the original
|
|
22
|
-
source Git root and local branch/ref from the previous workspace manifest, then
|
|
23
|
-
validate both against current Git registration. Never treat the run-owned
|
|
24
|
-
target as its own source merely because it is now the workflow workspace cwd. If a
|
|
25
|
-
later visit has no trustworthy original source identity, use `blocked` instead
|
|
26
|
-
of guessing a default branch. Capture the source ref and its exact current
|
|
27
|
-
local HEAD as this attempt's intended base. Do not fetch, pull, or infer a
|
|
28
|
-
remote base.
|
|
29
|
-
|
|
30
|
-
Compute one stable short marker from `{{run.id}}` and require it in both the
|
|
31
|
-
dedicated branch and worktree name. Before selecting the current checkout or
|
|
32
|
-
deriving a new name, search all registered worktrees and refs for that marker.
|
|
33
|
-
|
|
34
|
-
If exactly one branch/worktree pair is owned by this run, validate its
|
|
35
|
-
registered path and branch plus YAML-authorized-root containment, then reuse it
|
|
36
|
-
even when dirty and even when this step was launched from a different primary
|
|
37
|
-
or linked worktree. Preserve every uncommitted change and preserve its current
|
|
38
|
-
HEAD unless the guarded clean-worktree rebase below is both needed and safe. If
|
|
39
|
-
the current checkout is that exact pair, this rule naturally selects it.
|
|
40
|
-
|
|
41
|
-
Never reuse the current checkout merely because it is a linked worktree or is
|
|
42
|
-
on a named non-default branch. It remains the source checkout unless it matches
|
|
43
|
-
the exact run marker. This prevents an unrelated earlier task worktree from
|
|
44
|
-
replacing this run's already-created target.
|
|
45
|
-
|
|
46
|
-
Only when no exact run-owned pair exists, derive a concise
|
|
47
|
-
repository-conventional task branch and deterministic adjacent worktree path
|
|
48
|
-
containing the marker. Verify that the target canonicalizes inside one of the
|
|
49
|
-
YAML-authorized roots before mutation. Create the new pair from the exact source
|
|
50
|
-
HEAD observed by this step, regardless of whether the source checkout is
|
|
51
|
-
primary or linked. The branch must be new and must not be the source branch.
|
|
52
|
-
|
|
53
|
-
Be idempotent:
|
|
54
|
-
|
|
55
|
-
- Inspect registered worktrees and refs before every mutation.
|
|
56
|
-
- If this run's exact branch and worktree were already created by an earlier
|
|
57
|
-
attempt, validate and reuse them before considering any source checkout. A
|
|
58
|
-
dirty existing run-owned worktree is valid resumable work: preserve and
|
|
59
|
-
report its changes instead of blocking or creating a replacement.
|
|
60
|
-
- If only part of the operation exists, diagnose it and complete only the
|
|
61
|
-
missing safe operation when the marker proves one unambiguous identity.
|
|
62
|
-
- If the intended branch or path belongs to unrelated work, differs from the
|
|
63
|
-
expected identity, has multiple marker matches, or is ambiguous, use
|
|
64
|
-
`blocked`; never delete, overwrite, force, reset, switch, or repurpose it.
|
|
65
|
-
Dirtiness alone is safe for this run's exact existing worktree.
|
|
66
|
-
- Never create a second branch or worktree for the same run.
|
|
67
|
-
|
|
68
|
-
After selecting the exact run-owned worktree, inspect its current HEAD, status,
|
|
69
|
-
operation state, upstream/remote reachability, and ancestry against the
|
|
70
|
-
captured local source HEAD:
|
|
71
|
-
|
|
72
|
-
- If the captured source HEAD is already an ancestor of the selected HEAD,
|
|
73
|
-
preserve the selected HEAD. Target-only commits are legitimate resumable
|
|
74
|
-
workflow work, not a stale workspace. Rebasing would be a no-op.
|
|
75
|
-
- If the source HEAD is not an ancestor and the selected worktree is dirty,
|
|
76
|
-
preserve it without stashing or rebasing. Report `rebase: deferred-dirty`
|
|
77
|
-
with exact source and selected state. The next planner must work from that
|
|
78
|
-
recorded state and must not request another refresh for the same source
|
|
79
|
-
snapshot.
|
|
80
|
-
- If the source HEAD is not an ancestor, the selected worktree is clean, and no
|
|
81
|
-
Git operation is active, rebase only the exact run-owned dedicated branch
|
|
82
|
-
onto the captured local source HEAD. First prove that the rewritten commits
|
|
83
|
-
are local, unpublished, linear run-owned work and that no unrelated ref will
|
|
84
|
-
move. Do not rewrite published, signed, merge, or unrelated history.
|
|
85
|
-
- If that rebase conflicts or fails after it starts, do not edit conflicts or
|
|
86
|
-
continue it. Abort only the rebase started by this attempt, prove the exact
|
|
87
|
-
pre-attempt selected HEAD and status were restored, and use `blocked` with
|
|
88
|
-
conflict and rollback evidence. If restoration cannot be proven, preserve
|
|
89
|
-
all recovery state and stop without further mutation.
|
|
90
|
-
|
|
91
|
-
Do not edit project files, stage, commit, reset, clean, stash, push, fetch,
|
|
92
|
-
pull, publish, force, update unrelated refs, or change an external system. The
|
|
93
|
-
only history rewrite authorized here is the guarded rebase of the exact
|
|
94
|
-
run-owned branch above; the only rollback is aborting that same in-progress
|
|
95
|
-
rebase. After creation or reuse, verify the selected path is an absolute
|
|
96
|
-
existing Git worktree on the selected dedicated branch. A newly created
|
|
97
|
-
worktree must have the captured source HEAD and clean status. A dirty exact
|
|
98
|
-
run-owned worktree remains valid and unchanged. In all cases, the source
|
|
99
|
-
checkout must remain unchanged.
|
|
100
|
-
|
|
101
|
-
Call `workflow_complete_step` alone with outcome `ready` only after those checks
|
|
102
|
-
pass. Include `workspace: {cwd: "<absolute selected worktree path>"}`. The
|
|
103
|
-
summary must be a self-contained workspace manifest containing source Git root,
|
|
104
|
-
source branch/ref and captured HEAD; selected worktree path, dedicated branch,
|
|
105
|
-
before/after HEAD, whether it was created or reused, ancestry before/after,
|
|
106
|
-
`rebase: not-needed | completed | deferred-dirty`, initial/final status, and
|
|
107
|
-
exact verification evidence.
|
|
108
|
-
|
|
109
|
-
Use outcome `retry` without `workspace` only for a recoverable tool or
|
|
110
|
-
environment failure after safe alternatives were attempted. Include the exact
|
|
111
|
-
failed call, error, observed partial state, and next idempotent action. Use
|
|
112
|
-
`blocked` without `workspace` for conflicts, unsafe source state, missing Git
|
|
113
|
-
authority, or exhausted recovery. Do not ask a terminal question.
|
|
11
|
+
1. **Idempotence**: Extract marker from `{{run.id}}`. Reuse existing run-owned worktree/branch if present; never create a duplicate.
|
|
12
|
+
2. **Preservation**: Preserve all uncommitted user changes and existing branches. Never touch unrelated worktrees.
|
|
13
|
+
3. **Rebase Safety**: Only rebase clean, run-owned local branches. Abort immediately on conflict and return `blocked`.
|
|
14
|
+
4. **Output Contract**:
|
|
15
|
+
- `ready`: Include `workspace: {cwd: "<absolute path>"}` and manifest (source root, ref, HEAD; selected path, branch, HEAD, rebase status, initial/final status).
|
|
16
|
+
- `retry`: Transient tool failure with no state changes.
|
|
17
|
+
- `blocked`: Unsafe Git state, ambiguity, or conflict.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
You are the remote-action execution stage
|
|
2
|
-
independent verification. You are the active workflow step; do not broaden the approved action set or delegate this work.
|
|
1
|
+
You are the remote-action execution stage following an approved plan and independent verification. Do not broaden scope or launch subagents.
|
|
3
2
|
|
|
4
3
|
Original workflow input:
|
|
5
4
|
{{workflow.input}}
|
|
@@ -7,39 +6,11 @@ Original workflow input:
|
|
|
7
6
|
Approved exact actions:
|
|
8
7
|
{{last.summary}}
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
terminal question. Use `blocked` with declarative evidence when the reviewed
|
|
12
|
-
contract, head, anchor, or target is materially stale; do not request a live
|
|
13
|
-
decision.
|
|
9
|
+
## Guardrails & Output
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
already observable. If completion cannot be determined safely, use `blocked`
|
|
22
|
-
instead of repeating it.
|
|
23
|
-
|
|
24
|
-
Execute each remaining exact action once, in order, using only the approved
|
|
25
|
-
`git push`, `gh api`, or `glab api` command. Require a successful result for
|
|
26
|
-
every attempted action. Never alter the command text.
|
|
27
|
-
|
|
28
|
-
Do not stop at the first pre-action evidence failure. Inspect its exact error
|
|
29
|
-
and try a safe semantically equivalent non-mutating alternative. Use `retry`
|
|
30
|
-
only when observable state proves that no remote mutation was attempted and a
|
|
31
|
-
next workflow step can continue without duplicating an effect. Include the exact
|
|
32
|
-
failed call, alternatives, observed state, next alternative, unchanged action
|
|
33
|
-
contract, and full action ledger. After any mutation-capable command is
|
|
34
|
-
attempted, ambiguity or failure remains `blocked` unless its exact effect is
|
|
35
|
-
already observable; never blindly replay it.
|
|
36
|
-
|
|
37
|
-
Never force-push, approve, merge, resolve a discussion, close, delete, expose
|
|
38
|
-
credentials, cross hosts, or perform an unlisted mutation.
|
|
39
|
-
|
|
40
|
-
Call `workflow_complete_step` alone with outcome `drafted` only after every
|
|
41
|
-
approved action either succeeds now or is proven already complete. In the
|
|
42
|
-
summary, record every exact command, the state observed before it, whether it
|
|
43
|
-
was skipped or attempted, the result and remote correlation, and all remaining
|
|
44
|
-
unattempted actions. Use the same full ledger with `blocked` on post-action
|
|
45
|
-
failure or ambiguity so pause, retry, and resume cannot silently repeat work.
|
|
11
|
+
- **Strict Command Fidelity**: Run only the exact approved commands (`git push`, `gh api`, `glab api`) without alteration or shell expansion.
|
|
12
|
+
- **Prohibitions**: Never force-push, approve, merge, resolve discussions, or delete remote resources without explicit authority.
|
|
13
|
+
- **Outcomes**:
|
|
14
|
+
- `drafted`: All approved actions executed or verified complete. Include full command ledger.
|
|
15
|
+
- `retry`: Transient pre-mutation error where no side effects occurred.
|
|
16
|
+
- `blocked`: Remote mismatch, stale anchors, or failed execution.
|
|
@@ -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 Jira-ticket plan. Stay in this delegated child; do not launch subagents.
|
|
3
2
|
|
|
4
3
|
Ticket input:
|
|
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. If the approved plan is materially contradictory, stale, or
|
|
18
|
-
insufficient, use `blocked` with declarative evidence; do not request a live
|
|
19
|
-
decision.
|
|
15
|
+
## Rules & Guardrails
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
same root and branch for every read, edit, and write; if either differs from the
|
|
29
|
-
actual child cwd, use `blocked` and do not switch directories, branches, or
|
|
30
|
-
worktrees. Never create a replacement workspace. Bash inspection commands
|
|
31
|
-
allowed by the static policy may be used as needed. Run only
|
|
32
|
-
non-read-only Bash commands listed exactly under
|
|
33
|
-
`repositories[].worker[].command` in the reviewed contract, except for the
|
|
34
|
-
invocation-only recovery below. Use test-driven development and prove the same
|
|
35
|
-
approved focused command failed RED for the intended reason before it passed
|
|
36
|
-
GREEN. Run every worker command, stage only scoped files, and create the exact
|
|
37
|
-
approved Conventional Commit. If preparation recorded a clean starting status,
|
|
38
|
-
leave the dedicated checkout clean. If it recorded pre-existing dirty resumable
|
|
39
|
-
work, preserve unrelated baseline paths and content exactly; the final status
|
|
40
|
-
may retain only that recorded unrelated state, which must be reported rather
|
|
41
|
-
than cleaned, stashed, reset, or folded into the task commit. If a required
|
|
42
|
-
command was not reviewed or the approved contract is blocked by policy, use
|
|
43
|
-
`blocked` with exact evidence; never substitute a broader command. Never edit
|
|
44
|
-
Jira, push, publish, tag, or create a merge request.
|
|
45
|
-
|
|
46
|
-
Do not stop at the first failed tool or command. Read the exact error, inspect
|
|
47
|
-
current Jira and repository state, diagnose the cause, and try a safe
|
|
48
|
-
semantically equivalent alternative. Treat every prior mutation as possibly
|
|
49
|
-
applied: verify state before retrying and never duplicate a completed side
|
|
50
|
-
effect. An invocation-only repair may change documented option order or cwd
|
|
51
|
-
form, narrow a query, or use another enabled read-only tool only when intent,
|
|
52
|
-
target, mutation scope, dependency versions, lockfile constraints, and external
|
|
53
|
-
effects remain identical. Record failed and recovered calls. Never skip or
|
|
54
|
-
weaken a check, drop a safety flag, broaden a path or ref, change a dependency
|
|
55
|
-
version, or add an external effect.
|
|
56
|
-
|
|
57
|
-
If a plausible safe recovery needs a fresh context, call `workflow_complete_step`
|
|
58
|
-
with outcome `retry`. Include the exact failed call and error, alternatives
|
|
59
|
-
attempted, current observed state, next safe alternative, and the exact
|
|
60
|
-
approved fenced `json` contract unchanged. Use `blocked` when reviewed intent,
|
|
61
|
-
authority, targets, or commands are missing, stale, contradictory, or
|
|
62
|
-
materially invalid, or after safe alternatives are exhausted and retry cannot
|
|
63
|
-
resolve the environmental or access constraint.
|
|
64
|
-
|
|
65
|
-
Call `workflow_complete_step` alone with outcome `ready` only after all worker
|
|
66
|
-
criteria pass. Its summary must repeat authoritative ticket criteria and every
|
|
67
|
-
repository contract, list changed files and tests, RED/GREEN evidence, exact
|
|
68
|
-
commands and results, commit SHAs, final status, and risks. Include the exact
|
|
69
|
-
approved fenced `json` repository contract unchanged so the verifier receives
|
|
70
|
-
its exact reviewer commands.
|
|
17
|
+
1. **Strict Authority**: Run only commands authorized in the approved `worker` contract.
|
|
18
|
+
2. **Workspace Isolation**: Implement strictly in `repositories[0].cwd`. Leave pre-existing dirty files untouched.
|
|
19
|
+
3. **No External Writes**: Never push, edit Jira, or create MRs from this stage.
|
|
20
|
+
4. **Outcomes**:
|
|
21
|
+
- `ready`: Implementation and commit complete; RED/GREEN evidence recorded. Pass full JSON contract to reviewer.
|
|
22
|
+
- `retry`: Recoverable transient environment failure.
|
|
23
|
+
- `blocked`: Contradictory ticket requirements or missing execution authority.
|