@wichayutdew/pi-workflows 2.5.1 → 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 +34 -1
- package/dist/index.js +1315 -2467
- package/examples/starter-kit/agents/planner.md +11 -0
- package/examples/starter-kit/agents/reviewer.md +10 -0
- package/examples/starter-kit/agents/scout.md +10 -0
- package/examples/starter-kit/agents/worker.md +11 -0
- package/examples/starter-kit/agents/workspace-preparer.md +10 -0
- package/examples/starter-kit/investigate.workflow.yaml +84 -0
- package/examples/starter-kit/jira.workflow.yaml +75 -0
- package/examples/starter-kit/mr-comment.workflow.yaml +86 -93
- package/examples/starter-kit/mr-review.workflow.yaml +52 -88
- package/examples/starter-kit/settings.yaml +4 -0
- package/examples/starter-kit/steps/investigate/investigate.md +40 -0
- package/examples/starter-kit/steps/investigate/retrieve.md +28 -0
- package/examples/starter-kit/steps/investigate/validate.md +20 -0
- 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 +14 -0
- package/examples/starter-kit/steps/mr-comment/fetch.md +11 -28
- package/examples/starter-kit/steps/mr-comment/implement.md +9 -26
- package/examples/starter-kit/steps/mr-comment/plan.md +46 -55
- package/examples/starter-kit/steps/mr-comment/publish.md +11 -31
- package/examples/starter-kit/steps/mr-comment/verify.md +7 -34
- package/examples/starter-kit/steps/mr-review/fetch.md +13 -21
- package/examples/starter-kit/steps/mr-review/publish-approved.md +18 -0
- package/examples/starter-kit/steps/mr-review/review-for-approval.md +53 -0
- package/examples/starter-kit/steps/mr-review/verify-published.md +16 -0
- package/examples/starter-kit/steps/shared/prepare-workspace.md +11 -89
- package/examples/starter-kit/steps/shared/publish-remote.md +16 -0
- package/examples/starter-kit/steps/ticket/implement.md +10 -23
- package/examples/starter-kit/steps/ticket/plan.md +49 -98
- package/examples/starter-kit/steps/ticket/verify.md +14 -65
- package/examples/starter-kit/steps/work/implement.md +11 -22
- package/examples/starter-kit/steps/work/plan.md +43 -59
- package/examples/starter-kit/steps/work/verify.md +14 -25
- package/examples/starter-kit/ticket.workflow.yaml +57 -61
- package/examples/starter-kit/work.workflow.yaml +49 -57
- package/package.json +9 -19
- package/schemas/workflow.schema.json +63 -15
- package/scripts/patch-herdr-agent-state.mjs +36 -0
- package/src/agents/profile.ts +98 -0
- package/src/config/ceiling.ts +0 -82
- package/src/config/types.ts +15 -53
- package/src/config/validation/settings.ts +2 -14
- package/src/config/validation/step.ts +129 -8
- package/src/config/validation/workflow.ts +1 -10
- package/src/engine/run-workflow-validation.ts +0 -3
- package/src/engine/state-types.ts +1 -1
- package/src/harness/action-context.ts +1 -13
- package/src/harness/artifact-contract.ts +46 -0
- package/src/harness/delegation-control-actions.ts +4 -63
- package/src/harness/delegation-plan.ts +26 -80
- package/src/harness/delegation-response-actions.ts +22 -135
- package/src/harness/dependencies.ts +1 -12
- package/src/harness/gate-submission-action.ts +28 -0
- package/src/harness/status-actions.ts +20 -0
- package/src/harness/step-execution-actions.ts +2 -9
- package/src/harness/types.ts +2 -40
- package/src/harness.ts +2 -17
- package/src/herdr-workflow-state.ts +65 -0
- package/src/index.ts +4 -9
- package/src/integrations/subagents/child-policy-validation.ts +6 -7
- package/src/integrations/subagents/child-runtime-dependencies.ts +1 -1
- package/src/integrations/subagents/child-runtime-policy.ts +1 -7
- package/src/integrations/subagents/child-runtime.ts +18 -9
- package/src/integrations/subagents/client.ts +240 -98
- package/src/integrations/subagents/protocol-events.ts +32 -15
- package/src/integrations/subagents/protocol.ts +1 -1
- package/src/preflight.ts +0 -8
- package/src/prompt/main-workflow-notice.ts +8 -15
- package/src/prompt/step-task.ts +7 -6
- package/src/workflow-status/format-status.ts +5 -1
- package/src/workflow-status/render-step-detail.ts +94 -0
- package/src/workflow-status/types.ts +1 -0
- package/src/workflow-status/view.ts +49 -14
- package/agents/step.md +0 -32
- package/examples/mr-comments.workflow.yaml +0 -125
- package/examples/prompts/mr-comments/implement.md +0 -17
- package/examples/prompts/mr-comments/inspect.md +0 -5
- package/examples/prompts/mr-comments/plan.md +0 -54
- package/examples/prompts/mr-comments/verify.md +0 -9
- package/examples/settings.yaml +0 -27
- package/examples/starter-kit/steps/mr-review/publish.md +0 -48
- package/examples/starter-kit/steps/mr-review/review.md +0 -76
- package/examples/starter-kit/steps/mr-review/verify.md +0 -35
- package/src/config/validation/subagent.ts +0 -288
- package/src/harness/delegation-failure.ts +0 -248
- package/src/harness/delegation-recovery-validation.ts +0 -161
- package/src/harness/delegation-retry-policy.ts +0 -120
- package/src/integrations/subagents/client-delegation.ts +0 -181
- package/src/integrations/subagents/client-messages.ts +0 -66
- package/src/integrations/subagents/client-types.ts +0 -36
- package/src/integrations/subagents/diagnostic-format.ts +0 -45
- package/src/integrations/subagents/diagnostic-text.ts +0 -114
- package/src/integrations/subagents/diagnostic-types.ts +0 -83
- package/src/integrations/subagents/diagnostics.ts +0 -26
- package/src/integrations/subagents/failure-correlation.ts +0 -285
- package/src/integrations/subagents/failure-transcript.ts +0 -252
- package/src/integrations/subagents/hidden-bash-failure.ts +0 -98
- package/src/integrations/subagents/replay-audit.ts +0 -146
- package/src/integrations/subagents/replay-safety.ts +0 -67
- package/src/integrations/subagents/session-diagnostics.ts +0 -357
|
@@ -1,95 +1,17 @@
|
|
|
1
|
-
You
|
|
2
|
-
workflow harness—owns every Git and worktree decision.
|
|
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}}
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
Stable workflow run ID:
|
|
8
7
|
{{run.id}}
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
instructions, and `git status --short` before changing anything. Preserve every
|
|
12
|
-
existing file, branch, worktree, commit, and uncommitted change.
|
|
9
|
+
## Rules & Invariants
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
HEAD; that commit is the intended base for this preparation attempt. Do not
|
|
22
|
-
fetch, pull, or infer a remote base.
|
|
23
|
-
|
|
24
|
-
Compute one stable short run marker from the run ID and require it in both the
|
|
25
|
-
dedicated branch and worktree name. Before selecting the current checkout or
|
|
26
|
-
deriving a new name, search every registered worktree and branch for that
|
|
27
|
-
marker.
|
|
28
|
-
|
|
29
|
-
If exactly one branch/worktree pair is owned by this run, validate its canonical
|
|
30
|
-
path, registered branch, and containment inside `workspace.allowedRoots`, then
|
|
31
|
-
reuse it. Reuse it even when it is dirty and even when this step was launched
|
|
32
|
-
from a different primary or linked worktree. Its current HEAD and uncommitted
|
|
33
|
-
state are resumable work that must be preserved. If the current checkout is
|
|
34
|
-
that exact pair, this rule naturally selects it. A dirty exact run-owned
|
|
35
|
-
worktree is resumable and must never cause a replacement workspace.
|
|
36
|
-
|
|
37
|
-
Never reuse the current checkout merely because it is a linked worktree or is
|
|
38
|
-
on a non-default branch. It is the source checkout unless it matches the exact
|
|
39
|
-
run marker. This prevents an unrelated earlier task worktree from replacing
|
|
40
|
-
this run's already-created target.
|
|
41
|
-
|
|
42
|
-
Only when no exact run-owned pair exists, derive a concise task branch and
|
|
43
|
-
adjacent worktree path containing the marker. Create the new pair from the
|
|
44
|
-
exact source HEAD observed by this step, regardless of whether the source
|
|
45
|
-
checkout is primary or linked. Before mutation, prove the target canonicalizes
|
|
46
|
-
inside an allowed root and does not belong to unrelated work.
|
|
47
|
-
|
|
48
|
-
Be idempotent. Complete a safe partial setup only when the marker identifies
|
|
49
|
-
one unambiguous branch/path pair. Block on multiple matches, mismatched
|
|
50
|
-
branch/path ownership, or an unrelated collision. Never create a second
|
|
51
|
-
workspace for one run.
|
|
52
|
-
|
|
53
|
-
After selecting the exact run-owned worktree, inspect its current HEAD, status,
|
|
54
|
-
operation state, upstream/remote reachability, and ancestry against the
|
|
55
|
-
captured local source HEAD:
|
|
56
|
-
|
|
57
|
-
- When the captured source HEAD is already an ancestor of the selected HEAD,
|
|
58
|
-
preserve the selected HEAD. Target-only commits are legitimate resumable
|
|
59
|
-
workflow work, not a stale workspace, so rebasing would be a no-op.
|
|
60
|
-
- When the source HEAD is not an ancestor and the selected worktree is dirty,
|
|
61
|
-
preserve it without stashing or rebasing. Report `rebase: deferred-dirty`
|
|
62
|
-
with the exact source and selected state. A later planner must work from that
|
|
63
|
-
recorded state and must not bounce back for the same source snapshot.
|
|
64
|
-
- When the source HEAD is not an ancestor, the selected worktree is clean, and
|
|
65
|
-
no Git operation is active, rebase only the exact run-owned branch onto the
|
|
66
|
-
captured local source HEAD. First prove that the commits being rewritten are
|
|
67
|
-
local, unpublished, linear run-owned work and that no unrelated ref will be
|
|
68
|
-
updated. Do not rewrite published, signed, merge, or unrelated history.
|
|
69
|
-
- If that rebase conflicts or fails after it starts, do not resolve project
|
|
70
|
-
files or continue it. Abort only the rebase started by this attempt, verify
|
|
71
|
-
that the exact pre-attempt selected HEAD and status were restored, and use
|
|
72
|
-
`blocked` with the conflict and rollback evidence. If restoration cannot be
|
|
73
|
-
proven, preserve all recovery state and report it without further mutation.
|
|
74
|
-
|
|
75
|
-
Do not reset, clean, delete, overwrite, force, stash, commit, fetch, pull, push,
|
|
76
|
-
edit project files, update unrelated refs, or repurpose an existing path. The
|
|
77
|
-
only history rewrite authorized here is the guarded rebase of the exact
|
|
78
|
-
run-owned branch above; the only rollback is aborting that same in-progress
|
|
79
|
-
rebase. If a branch/path collision or ambiguous partial setup makes reuse
|
|
80
|
-
unsafe, finish with `blocked`.
|
|
81
|
-
|
|
82
|
-
After creation or reuse, verify that the selected path is an absolute,
|
|
83
|
-
registered Git worktree on the intended named branch and that the source
|
|
84
|
-
checkout was not changed. Call `structured_output` alone with outcome `ready`,
|
|
85
|
-
a self-contained workspace manifest containing the source path, branch/ref and
|
|
86
|
-
captured HEAD; selected path, branch and before/after HEAD; ancestry before and
|
|
87
|
-
after; `rebase: not-needed | completed | deferred-dirty`; initial and final
|
|
88
|
-
status; and exact verification evidence. Include:
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
{ "cwd": "/absolute/path/to/the/selected/worktree" }
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Place that object in the result's `workspace` field, not in the summary alone.
|
|
95
|
-
Use `blocked` without `workspace` when preparation cannot be made safe.
|
|
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.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
You are the remote-action execution stage following an approved plan and independent verification. Do not broaden scope or launch subagents.
|
|
2
|
+
|
|
3
|
+
Original workflow input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Approved exact actions:
|
|
7
|
+
{{last.summary}}
|
|
8
|
+
|
|
9
|
+
## Guardrails & Output
|
|
10
|
+
|
|
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,4 +1,4 @@
|
|
|
1
|
-
You
|
|
1
|
+
You are the single implementation stage for the approved Jira-ticket plan. Stay in this delegated child; do not launch subagents.
|
|
2
2
|
|
|
3
3
|
Ticket input:
|
|
4
4
|
{{workflow.input}}
|
|
@@ -9,28 +9,15 @@ Approved plan:
|
|
|
9
9
|
Approval feedback:
|
|
10
10
|
{{reviewed.feedback}}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Latest ledger:
|
|
13
13
|
{{last.summary}}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
confirm the current directory, branch, HEAD, status, and repository
|
|
17
|
-
instructions. Work on top of this exact worktree and preserve all existing
|
|
18
|
-
unrelated changes. Never create, switch, reset, clean, delete, or replace a
|
|
19
|
-
branch or worktree.
|
|
15
|
+
## Rules & Guardrails
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Run the approved checks, and stage or commit only when the approved plan calls
|
|
29
|
-
for it. Do not push or publish in this step; independent verification publishes
|
|
30
|
-
only the reviewed Publication contract after it has passed.
|
|
31
|
-
|
|
32
|
-
Call `structured_output` alone with outcome `ready` when the result is ready for
|
|
33
|
-
independent review. Summarize ticket identity, changed files, commands/results,
|
|
34
|
-
criterion evidence, commit identity if any, current status, and risks. Use
|
|
35
|
-
`blocked` with exact evidence when safe completion is impossible. Do not replan
|
|
36
|
-
or ask a terminal question.
|
|
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.
|
|
@@ -1,109 +1,60 @@
|
|
|
1
|
-
You are the 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.
|
|
2
2
|
|
|
3
|
-
Ticket input:
|
|
3
|
+
Ticket input & user context:
|
|
4
4
|
{{workflow.input}}
|
|
5
5
|
|
|
6
|
-
Workspace handoff:
|
|
7
|
-
{{last.summary}}
|
|
8
|
-
|
|
9
6
|
Previously rejected artifact:
|
|
10
7
|
{{gate.artifact}}
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
Plannotator feedback:
|
|
13
10
|
{{gate.feedback}}
|
|
14
11
|
|
|
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
|
-
3. `## Repository evidence`
|
|
55
|
-
4. `## Proposed changes`
|
|
56
|
-
5. `## Acceptance criteria`
|
|
57
|
-
6. `## Validation commands`
|
|
58
|
-
7. `## Risks and unresolved decisions`
|
|
59
|
-
8. `## Publication contract`
|
|
60
|
-
|
|
61
|
-
Include exact target files and observable results. Derive every repository
|
|
62
|
-
command from current scripts or authoritative tool help. Do not assume a
|
|
63
|
-
language, framework, package manager, flag order, or cwd syntax.
|
|
64
|
-
|
|
65
|
-
The Publication contract is part of the reviewed artifact and authorizes the
|
|
66
|
-
post-verification publication. State the exact bound branch, remote, target
|
|
67
|
-
branch, merge-request title and description, and the GitLab project or hosted
|
|
68
|
-
remote evidence. The title must use this Conventional Commit format exactly:
|
|
69
|
-
`fix: [<JiraId>] <brief summary of the changes>`. The description must use this
|
|
70
|
-
format exactly, replacing placeholders with current evidence and omitting the
|
|
71
|
-
Experiment ID line when none exists:
|
|
72
|
-
|
|
73
|
-
```md
|
|
74
|
-
- Jira ID : {JiraId}
|
|
75
|
-
- Experiment ID : {ExperimentId, if any}
|
|
76
|
-
|
|
77
|
-
## Proposed changes
|
|
78
|
-
- {changes}
|
|
79
|
-
|
|
80
|
-
## Test added in this MR
|
|
81
|
-
- **Unit test**
|
|
82
|
-
- {test cases}
|
|
83
|
-
- **Functional test (If need)**
|
|
84
|
-
- {test cases}
|
|
85
|
-
- **Integration test (If need)**
|
|
86
|
-
- {test cases}
|
|
87
|
-
|
|
88
|
-
## Tested scenarios with screenshots
|
|
89
|
-
| Scenario | Production | This branch |
|
|
90
|
-
| --- | --- | --- |
|
|
91
|
-
| Scenario 1 | paste screenshot here | paste screenshot here |
|
|
92
|
-
| Scenario 2 | paste screenshot here | paste screenshot here |
|
|
93
|
-
|
|
94
|
-
/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
|
+
}
|
|
95
51
|
```
|
|
96
52
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
arbitrary shell commands, history rewrites, branch deletion, Jira mutation,
|
|
100
|
-
merging, or any other remote mutation. If the remote, target branch, or
|
|
101
|
-
merge-request metadata cannot be established safely from current evidence, use
|
|
102
|
-
`blocked` rather than leaving a publish decision for the verification step.
|
|
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.
|
|
103
55
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
edit repository or ticket state and do not ask a terminal question.
|
|
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,7 +1,4 @@
|
|
|
1
|
-
You
|
|
2
|
-
Publication contract. Do not edit files, amend commits, change worktrees, or
|
|
3
|
-
mutate Jira. The only allowed external mutations are the contract's non-force
|
|
4
|
-
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.
|
|
5
2
|
|
|
6
3
|
Ticket input:
|
|
7
4
|
{{workflow.input}}
|
|
@@ -9,67 +6,19 @@ Ticket input:
|
|
|
9
6
|
Approved plan:
|
|
10
7
|
{{reviewed.artifact}}
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
{{
|
|
14
|
-
|
|
15
|
-
Refresh the ticket read-only and confirm the current directory and branch still
|
|
16
|
-
match the bound workspace. Inspect repository instructions, the complete diff,
|
|
17
|
-
affected callers, tests, commits, and working-tree status. Verify each approved
|
|
18
|
-
ticket acceptance criterion against current code and behavior. Run every exact
|
|
19
|
-
repository-native validation command from the approved plan. A skipped, stale,
|
|
20
|
-
unavailable, or failing required check is not passing.
|
|
21
|
-
|
|
22
|
-
Any regression, lint failure, formatting failure, or other actionable local
|
|
23
|
-
verification finding is `failed`; the workflow sends that outcome directly back
|
|
24
|
-
to implementation. Do not use `blocked` for a fixable local finding.
|
|
25
|
-
|
|
26
|
-
Only after all local criteria pass, parse the approved `## Publication contract`
|
|
27
|
-
and validate its branch, remote, target branch, project, title, and description
|
|
28
|
-
against the bound workspace and current remote evidence. The commit being
|
|
29
|
-
published must be the current verified `HEAD`; record its full SHA. Query the
|
|
30
|
-
remote branch and existing GitLab merge requests first. If the exact SHA is
|
|
31
|
-
already published, do not push again. Otherwise push only that current HEAD to
|
|
32
|
-
the contract branch with a non-force `git push`. Publish only committed code:
|
|
33
|
-
never stage, commit, stash, discard, or otherwise consider pending staged or
|
|
34
|
-
unstaged working-tree changes part of the publication. Those changes must not
|
|
35
|
-
change the exact `HEAD` SHA being pushed. Never use `--force`, `--set-upstream`,
|
|
36
|
-
refspec wildcards, another remote, or another branch. If the push is rejected,
|
|
37
|
-
ambiguous, or proves that the remote branch contains different history, use
|
|
38
|
-
`blocked` and do not attempt a workaround.
|
|
9
|
+
Approval feedback:
|
|
10
|
+
{{reviewed.feedback}}
|
|
39
11
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
`action`, `connect`, `describe`, `search`, `regex`, or a server-only call. Use
|
|
43
|
-
the configured Atlassian tool for Jira evidence. This ticket workflow does not
|
|
44
|
-
authorize GitLab MCP tools, so inspect and create GitLab merge requests with
|
|
45
|
-
the authenticated host CLI instead of attempting an MCP call.
|
|
46
|
-
|
|
47
|
-
Before the first remote query or push, run the contract's `git ls-remote`
|
|
48
|
-
branch check as one standalone Bash call, never as part of a command chain.
|
|
49
|
-
This is the SSH-authentication preflight and may display a 1Password approval.
|
|
50
|
-
If SSH authentication is unavailable (for example, the agent socket cannot be
|
|
51
|
-
reached, the agent refuses the signature, or approval is cancelled), do not try
|
|
52
|
-
alternate credentials or a workaround. Return `blocked` with the redacted
|
|
53
|
-
diagnostic and the precise recovery: unlock/approve the configured 1Password
|
|
54
|
-
SSH key for the remote host in an interactive session, then resume this step.
|
|
55
|
-
|
|
56
|
-
After the branch is confirmed remote, reuse an existing open merge request only
|
|
57
|
-
when its source branch, target branch, and ticket correlation match the contract.
|
|
58
|
-
Otherwise create exactly one GitLab merge request using the contract title and
|
|
59
|
-
description. Refresh it and confirm its URL, project, source branch, target
|
|
60
|
-
branch, and head SHA. Never merge, close, approve, alter an unrelated MR, or
|
|
61
|
-
retry an ambiguous mutation. A missing or materially incomplete Publication
|
|
62
|
-
contract is `blocked`, not permission to infer a publish action.
|
|
63
|
-
|
|
64
|
-
Call `structured_output` alone with:
|
|
12
|
+
Implementation ledger:
|
|
13
|
+
{{last.summary}}
|
|
65
14
|
|
|
66
|
-
|
|
67
|
-
pushed and represented by the matching GitLab merge request;
|
|
68
|
-
- `failed` for an actionable implementation defect, with exact location,
|
|
69
|
-
evidence, and the smallest corrective handoff;
|
|
70
|
-
- `blocked` when ticket or repository evidence is stale or verification cannot
|
|
71
|
-
proceed safely.
|
|
15
|
+
## Rules & Publication Boundaries
|
|
72
16
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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,6 +1,6 @@
|
|
|
1
|
-
You
|
|
1
|
+
You are the single implementation stage for the approved local-work plan. Stay in this delegated child; do not launch subagents.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Original request:
|
|
4
4
|
{{workflow.input}}
|
|
5
5
|
|
|
6
6
|
Approved plan:
|
|
@@ -9,26 +9,15 @@ Approved plan:
|
|
|
9
9
|
Approval feedback:
|
|
10
10
|
{{reviewed.feedback}}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Latest ledger:
|
|
13
13
|
{{last.summary}}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
current directory, branch, HEAD, status, and repository instructions before
|
|
17
|
-
editing. Work on top of all existing files in this exact worktree. Never create,
|
|
18
|
-
switch, reset, clean, delete, or replace a branch or worktree, and preserve
|
|
19
|
-
unrelated user changes.
|
|
15
|
+
## Rules & Guardrails
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
for it, and never push or mutate an external service in this step.
|
|
29
|
-
|
|
30
|
-
Call `structured_output` alone with outcome `ready` only when implementation is
|
|
31
|
-
ready for independent review. Summarize changed files, commands and results,
|
|
32
|
-
acceptance-criterion evidence, commit information if any, current status, and
|
|
33
|
-
remaining risks. Use `blocked` with exact evidence when safe completion is not
|
|
34
|
-
possible. Do not create a replacement plan or ask a terminal question.
|
|
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,67 +1,51 @@
|
|
|
1
|
-
You are the read-only
|
|
1
|
+
You are the planning and evidence stage for local work. Stay read-only in this child workspace; do not launch subagents.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Workflow request:
|
|
4
4
|
{{workflow.input}}
|
|
5
5
|
|
|
6
|
-
Workspace handoff:
|
|
7
|
-
{{last.summary}}
|
|
8
|
-
|
|
9
6
|
Previously rejected artifact:
|
|
10
7
|
{{gate.artifact}}
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
Plannotator feedback:
|
|
13
10
|
{{gate.feedback}}
|
|
14
11
|
|
|
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
|
-
|
|
55
|
-
Resolve ordinary uncertainty from evidence. Put only consequential choices in
|
|
56
|
-
the artifact, with a recommendation and trade-off. Include exact target files
|
|
57
|
-
and observable behavior. Derive every validation, formatting, linting, build,
|
|
58
|
-
and test command from this repository's current scripts and tool help. Command
|
|
59
|
-
syntax is domain data: do not assume a package manager, language, framework,
|
|
60
|
-
argument order, or cwd flag.
|
|
61
|
-
|
|
62
|
-
Call `structured_output` alone with outcome `submit`. Put the complete Markdown
|
|
63
|
-
plan in `artifact`; put a compact but self-contained handoff in `summary`.
|
|
64
|
-
Use `workspace-refresh` only for the exact clean source-ancestry condition
|
|
65
|
-
above; omit `artifact` and preserve the full workspace evidence in `summary`.
|
|
66
|
-
Use `blocked` when the request cannot be planned safely with available
|
|
67
|
-
read-only evidence. Do not modify files or ask a terminal question.
|
|
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.
|