@starlein/paperclip-plugin-company-wizard 0.4.3 → 0.4.5-a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/manifest.js +1 -1
  4. package/dist/manifest.js.map +1 -1
  5. package/dist/ui/index.css +6 -3
  6. package/dist/ui/index.css.map +2 -2
  7. package/dist/ui/index.js +69 -74
  8. package/dist/ui/index.js.map +3 -3
  9. package/dist/worker.js +62 -5
  10. package/dist/worker.js.map +2 -2
  11. package/package.json +1 -1
  12. package/templates/bootstrap-instructions.md +1 -1
  13. package/templates/modules/ci-cd/agents/devops/skills/ci-cd.md +4 -4
  14. package/templates/modules/ci-cd/agents/engineer/skills/ci-cd.fallback.md +1 -1
  15. package/templates/modules/ci-cd/module.meta.json +3 -3
  16. package/templates/modules/ci-cd/skills/ci-cd.bar.md +2 -2
  17. package/templates/modules/ci-cd/skills/ci-cd.md +4 -4
  18. package/templates/modules/github-repo/README.md +2 -2
  19. package/templates/modules/github-repo/agents/engineer/skills/git-workflow.md +2 -2
  20. package/templates/modules/github-repo/docs/git-workflow.md +27 -2
  21. package/templates/modules/github-repo/module.meta.json +1 -1
  22. package/templates/modules/launch-mvp/module.meta.json +1 -1
  23. package/templates/modules/pr-review/README.md +7 -7
  24. package/templates/modules/pr-review/agents/code-reviewer/skills/code-review.md +32 -16
  25. package/templates/modules/pr-review/agents/engineer/skills/pr-workflow.md +12 -11
  26. package/templates/modules/pr-review/docs/pr-conventions.md +13 -13
  27. package/templates/modules/pr-review/module.meta.json +3 -3
  28. package/templates/presets/fast/preset.meta.json +2 -2
  29. package/templates/presets/repo-maintenance/preset.meta.json +1 -1
  30. package/templates/roles/engineer/SOUL.md +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starlein/paperclip-plugin-company-wizard",
3
- "version": "0.4.3",
3
+ "version": "0.4.5a",
4
4
  "type": "module",
5
5
  "description": "AI-powered wizard to bootstrap paperclip agent companies from composable templates (for latest paperclip version)",
6
6
  "repository": "https://github.com/starlein/paperclip-plugin-company-wizard",
@@ -31,7 +31,7 @@ Each section (Goals, Projects, Labels, Agents, Issues, Routines) contains object
31
31
 
32
32
  **Review workflow guardrail:**
33
33
 
34
- - Required PR reviews use the issue's `executionPolicy` review/approval stages, not @-mentions and not separate child review issues. When an engineer opens a PR, set the implementation issue to `in_review` with the resolved execution policy: QA review when present, Security review only for security-relevant changes, Product Owner approval for scope/intent, and a final Engineer merge gate after verification is recorded. Each active participant records their decision through the normal issue update route (`approved` by PATCHing toward `done`, `changes_requested` by PATCHing back to `in_progress`), which is the issue-level reviewed/approved audit trail (`reviewed_by` / `approved_by` metadata where Paperclip exposes it). The Engineer merge gate must verify the PR base against the project/worktree base ref shown in `heartbeat-context`, merge before approving, close/archive any isolated worktree when one exists and close-readiness allows it, and only then record final approval. Follow `docs/pr-conventions.md` when the PR review module is active.
34
+ - Required PR reviews use the issue's `executionPolicy` review/approval stages, not @-mentions and not separate child review issues. When an engineer opens a PR, set the implementation issue to `in_review` with the resolved execution policy: QA review when present, Security review only for security-relevant changes, Product Owner approval for scope/intent, and a final Code Reviewer merge gate after verification is recorded. **Never list the issue's executor/author as a participant in any stage** — Paperclip excludes the original executor from review/approval, so a stage whose only participant is the author stalls the issue in `in_review` (`422 No eligible approval participant`); the merge gate is therefore a non-author (the Code Reviewer), not the engineer who wrote the code. Each active participant records their decision through the normal issue update route (`approved` by PATCHing toward `done`, `changes_requested` by PATCHing back to `in_progress`), which is the issue-level reviewed/approved audit trail (`reviewed_by` / `approved_by` metadata where Paperclip exposes it). The Code Reviewer merge gate must verify the PR base against the project/worktree base ref shown in `heartbeat-context`, merge before approving, close/archive any isolated worktree when one exists and close-readiness allows it, and only then record final approval. Follow `docs/pr-conventions.md` when the PR review module is active.
35
35
 
36
36
  **Secrets guardrail:**
37
37
 
@@ -6,11 +6,11 @@ You are the DevOps engineer and CI/CD is your core domain. You own the full pipe
6
6
 
7
7
  1. Review the tech stack to determine build, lint, and test tooling
8
8
  2. Create a CI workflow (GitHub Actions or equivalent):
9
- - Lint on all PRs and pushes to main
10
- - Run tests on all PRs and pushes to main
9
+ - Lint on all PRs and pushes to the default branch
10
+ - Run tests on all PRs and pushes to the default branch
11
11
  - Build/typecheck to verify compilation
12
12
  3. Create a CD workflow:
13
- - Trigger on merge to main
13
+ - Trigger on merge to the default branch
14
14
  - Deploy to the target environment
15
15
  - Run smoke tests after deployment
16
16
  4. Add status badges to the project README
@@ -24,5 +24,5 @@ You are the DevOps engineer and CI/CD is your core domain. You own the full pipe
24
24
  - Use dependency caching (e.g., `actions/cache`, `setup-node` cache) to speed up installs.
25
25
  - Pin action versions to full SHAs, not tags, for security.
26
26
  - Never store secrets in workflow files — use GitHub Secrets or equivalent.
27
- - If CI breaks main, fix it immediately — a red main blocks everyone.
27
+ - If CI breaks the default branch, fix it immediately — a red default branch blocks everyone.
28
28
  - Own pipeline health metrics — track build times, flake rates, deployment frequency.
@@ -5,7 +5,7 @@ The DevOps engineer primarily owns CI/CD pipelines. You are the fallback — ste
5
5
  ## CI/CD (Fallback)
6
6
 
7
7
  1. If no CI workflow exists and DevOps hasn't started:
8
- - Create a basic CI workflow: lint + test on PRs, build on push to main
8
+ - Create a basic CI workflow: lint + test on PRs, build on push to the default branch
9
9
  - Use standard caching and pinned action versions
10
10
  - Document the setup in `docs/CI-CD.md`
11
11
  - Mark the pipeline as **provisional** — it needs DevOps review for CD, caching optimization, and security hardening
@@ -52,7 +52,7 @@
52
52
  },
53
53
  {
54
54
  "title": "Set up deployment automation",
55
- "description": "Configure automated deployment to at least one environment (staging or production). Use the CI pipeline to trigger deploys on successful builds from the main branch. Include a rollback strategy.",
55
+ "description": "Configure automated deployment to at least one environment (staging or production). Use the CI pipeline to trigger deploys on successful builds from the default branch. Include a rollback strategy.",
56
56
  "priority": "medium",
57
57
  "assignTo": "engineer"
58
58
  },
@@ -65,7 +65,7 @@
65
65
  ],
66
66
  "goal": {
67
67
  "title": "Set up CI/CD pipeline",
68
- "description": "Establish a complete CI/CD pipeline: automated linting, testing, building, and deployment. Every push to main should be verified automatically, and deployments should be reproducible and low-risk.",
68
+ "description": "Establish a complete CI/CD pipeline: automated linting, testing, building, and deployment. Every push to the default branch should be verified automatically, and deployments should be reproducible and low-risk.",
69
69
  "project": false,
70
70
  "subgoals": [
71
71
  {
@@ -90,7 +90,7 @@
90
90
  "id": "deploy",
91
91
  "title": "Automated deployment",
92
92
  "level": "team",
93
- "description": "Deploy to staging or production with minimal manual intervention. Pushes to main trigger automated deployment to at least one environment."
93
+ "description": "Deploy to staging or production with minimal manual intervention. Pushes to the default branch trigger automated deployment to at least one environment."
94
94
  }
95
95
  ]
96
96
  },
@@ -2,10 +2,10 @@
2
2
 
3
3
  A good CI/CD setup:
4
4
 
5
- - A working pipeline with a CI stage (lint → typecheck → test on every PR and push to main) and a CD stage (deploy on merge to main, smoke tests after deployment), documented in `docs/CI-CD.md` with status badges in the README.
5
+ - A working pipeline with a CI stage (lint → typecheck → test on every PR and push to the default branch) and a CD stage (deploy on merge to the default branch, smoke tests after deployment), documented in `docs/CI-CD.md` with status badges in the README.
6
6
  - Pipelines complete in under 5 minutes (dependency caching in place), action versions pinned to full SHAs, and all secrets stored in GitHub Secrets or equivalent — none in workflow files.
7
7
 
8
8
  Not done:
9
9
 
10
10
  - A pipeline with no rollback path — deploying with no documented procedure for reverting a bad release or re-running the previous successful build is not done.
11
- - A pipeline that breaks main and is not fixed immediately, or one that stores secrets directly in the workflow YAML.
11
+ - A pipeline that breaks the default branch and is not fixed immediately, or one that stores secrets directly in the workflow YAML.
@@ -6,11 +6,11 @@ You manage continuous integration and deployment pipelines. Follow the conventio
6
6
 
7
7
  1. Review the tech stack to determine build, lint, and test tooling
8
8
  2. Create a CI workflow (GitHub Actions or equivalent):
9
- - Lint on all PRs and pushes to main
10
- - Run tests on all PRs and pushes to main
9
+ - Lint on all PRs and pushes to the default branch
10
+ - Run tests on all PRs and pushes to the default branch
11
11
  - Build/typecheck to verify compilation
12
12
  3. Create a CD workflow:
13
- - Trigger on merge to main
13
+ - Trigger on merge to the default branch
14
14
  - Deploy to the target environment
15
15
  - Run smoke tests after deployment
16
16
  4. Add status badges to the project README
@@ -23,4 +23,4 @@ You manage continuous integration and deployment pipelines. Follow the conventio
23
23
  - Use dependency caching (e.g., `actions/cache`, `setup-node` cache) to speed up installs.
24
24
  - Pin action versions to full SHAs, not tags, for security.
25
25
  - Never store secrets in workflow files — use GitHub Secrets or equivalent.
26
- - If CI breaks main, fix it immediately — a red main blocks everyone.
26
+ - If CI breaks the default branch, fix it immediately — a red default branch blocks everyone.
@@ -10,7 +10,7 @@ Enables the Engineer to work in a GitHub repository.
10
10
 
11
11
  ## Variants
12
12
 
13
- - **direct-to-main** (default): Engineer commits directly on main. No branches, no PRs. Fast iteration for solo engineer setups.
13
+ - **direct-to-base-ref** (default): Engineer commits directly on the default branch. No branches, no PRs. Fast iteration for solo engineer setups.
14
14
  - When combined with `pr-review` module: switches to feature-branch workflow automatically.
15
15
 
16
16
  ## Best for
@@ -21,4 +21,4 @@ Enables the Engineer to work in a GitHub repository.
21
21
 
22
22
  ## Example
23
23
 
24
- A company building a web app with one engineer. The engineer picks up issues, implements them, commits to main, and marks the issue done. CI runs on push.
24
+ A company building a web app with one engineer. The engineer picks up issues, implements them, commits to the default branch, and marks the issue done. CI runs on push.
@@ -2,9 +2,9 @@
2
2
 
3
3
  You work in a GitHub repository. Follow the conventions in `docs/git-workflow.md` in the project root.
4
4
 
5
- ## Direct-to-Main Flow
5
+ ## Direct-to-Base-Ref Flow
6
6
 
7
- 1. Resolve the base ref from project workspace metadata or the issue's `heartbeat-context`. Use the configured `repoRef`, `defaultRef`, or `executionWorkspacePolicy.workspaceStrategy.baseRef` exactly as Paperclip provides it. Never guess from the current shell branch and never rewrite the configured ref to `main`, `master`, or `origin/*`.
7
+ 1. Resolve the base ref from project workspace metadata or the issue's `heartbeat-context`. Use the configured `repoRef`, `defaultRef`, or `executionWorkspacePolicy.workspaceStrategy.baseRef` exactly as Paperclip provides it. Never guess from the current shell branch and never rewrite the configured ref to `main`, `master`, or `origin/*`. If no base ref is configured anywhere, use the repository's actual default branch — whatever `origin/HEAD` points at, regardless of name (`main`/`master`/`trunk`/…); fall back to `main` then `master` only if the remote advertises no default HEAD. See `docs/git-workflow.md` → *Resolving the default branch*. Never hard-code `main`.
8
8
  2. Pull/update latest from that base:
9
9
  - external: `git fetch origin`, then integrate from the configured base ref
10
10
  - local: update from the configured local branch
@@ -33,11 +33,12 @@ directory inside the repository. This must never be committed.
33
33
  - Committing `.paperclip/` pollutes history and can nest isolated worktrees inside the
34
34
  repo, which causes confusing git state for every agent.
35
35
 
36
- ## Direct-to-Main Workflow
36
+ ## Direct-to-Base-Ref Workflow
37
37
 
38
38
  1. Resolve the configured base ref from project workspace metadata or the issue's `heartbeat-context` before touching Git. Do not infer it from the current shell branch and do not rewrite it to `main`, `master`, or `origin/*`.
39
39
  - External repos: use the project/worktree `repoRef`, `defaultRef`, or `executionWorkspacePolicy.workspaceStrategy.baseRef` exactly as configured.
40
40
  - Fresh/local repos: use the configured local branch.
41
+ - Only if no base ref is configured anywhere, detect the repository's default branch — see *Resolving the default branch* below. Never hard-code `main`.
41
42
  2. Pull/fetch latest from that base before editing.
42
43
  3. Make changes
43
44
  4. Run tests/linting locally if available
@@ -45,6 +46,30 @@ directory inside the repository. This must never be committed.
45
46
  6. Push to the matching configured base branch
46
47
  7. Verify CI passes (if configured)
47
48
 
49
+ ## Resolving the default branch
50
+
51
+ A configured base ref (`repoRef` / `defaultRef` / `workspaceStrategy.baseRef`) always wins — use it verbatim. Only when **none** is configured (typically at first-time setup of an existing repository) detect the default branch from the remote, and record it on the project workspace so later isolated worktrees branch from the right base.
52
+
53
+ The base ref for worktrees should simply **be the repository's default branch, whatever it is named** — `main`, `master`, `trunk`, `develop`, anything. The authoritative source is what `origin/HEAD` points at. Resolution priority:
54
+
55
+ 1. **The remote's default branch** — whatever `origin/HEAD` resolves to. This is name-agnostic and is the answer in almost all cases.
56
+ 2. **`main`, then `master`** — only as a fallback when the remote advertises no default HEAD (rare/ambiguous).
57
+
58
+ ```bash
59
+ # Prints the repository's default branch name (origin/HEAD; main/master only as fallback).
60
+ git remote set-head origin --auto >/dev/null 2>&1 || true
61
+ def=$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's@^origin/@@')
62
+ [ -z "$def" ] && def=$(git ls-remote --symref origin HEAD 2>/dev/null | sed -n 's@^ref: refs/heads/\(.*\)\tHEAD@\1@p')
63
+ if [ -z "$def" ]; then
64
+ if git ls-remote --exit-code --heads origin main >/dev/null 2>&1; then def=main
65
+ elif git ls-remote --exit-code --heads origin master >/dev/null 2>&1; then def=master
66
+ fi
67
+ fi
68
+ echo "$def"
69
+ ```
70
+
71
+ For a brand-new local repository there is no remote yet, so initialize on `main` (`git init -b main`) — that is the conventional default for fresh repos.
72
+
48
73
  ## What Requires a Commit
49
74
 
50
75
  - Code logic changes
@@ -63,4 +88,4 @@ directory inside the repository. This must never be committed.
63
88
 
64
89
  ## CI
65
90
 
66
- If the project has CI configured (e.g., GitHub Actions), always verify your push passes CI. If CI fails, fix it immediately — a broken main blocks everyone.
91
+ If the project has CI configured (e.g., GitHub Actions), always verify your push passes CI. If CI fails, fix it immediately — a broken base ref blocks everyone.
@@ -9,7 +9,7 @@
9
9
  "priority": "critical",
10
10
  "bootstrapPhase": "foundation",
11
11
  "labels": ["chore"],
12
- "description": "Foundation setup: handle this before normal implementation issues. For a fresh repository, create the GitHub repository, initialize local workspace with a README or bootstrap commit, add origin, push main, and record the repository URL. For an existing repository, verify the workspace has a reachable remote, current default branch, and starter commit state; escalate to CEO if repo setup is missing instead of silently closing the issue. Before the first commit, ensure the repository's `.gitignore` ignores Paperclip's local state — add a `.paperclip/` entry (this is where Paperclip keeps per-issue git worktrees and workspace metadata inside the repo; committing it pollutes history and can nest worktrees inside the repo). Create `.gitignore` if it is missing. Branch protection is tracked separately by the pr-review module when that workflow is enabled."
12
+ "description": "Foundation setup: handle this before normal implementation issues. For a fresh repository, create the GitHub repository, initialize the local workspace with a README or bootstrap commit, add origin, push the default branch (`main` for a fresh repo), and record the repository URL. For an existing repository, verify the workspace has a reachable remote and a starter commit state, then determine the repository's default branch and confirm it is recorded as the project workspace `defaultRef`/`repoRef` so isolated worktrees branch from the correct base. The default branch is whatever `origin/HEAD` points at — name-agnostic (`main`, `master`, `trunk`, etc.); use it exactly as the remote advertises it (`git ls-remote --symref origin HEAD`). Only if the remote advertises no default HEAD, fall back to `main`, then `master`. Never assume `main` for an existing repo. Escalate to CEO if repo setup is missing instead of silently closing the issue. Before the first commit, ensure the repository's `.gitignore` ignores Paperclip's local state — add a `.paperclip/` entry (this is where Paperclip keeps per-issue git worktrees and workspace metadata inside the repo; committing it pollutes history and can nest worktrees inside the repo). Create `.gitignore` if it is missing. Branch protection is tracked separately by the pr-review module when that workflow is enabled."
13
13
  }
14
14
  ]
15
15
  }
@@ -36,7 +36,7 @@
36
36
  "issues": [
37
37
  {
38
38
  "title": "Create project repository and initial structure",
39
- "description": "Initialize the repository with README, .gitignore, package.json (or equivalent), and a basic project structure. Push to main.",
39
+ "description": "Initialize the repository with README, .gitignore, package.json (or equivalent), and a basic project structure. Push to the default branch.",
40
40
  "priority": "high",
41
41
  "assignTo": "engineer"
42
42
  },
@@ -4,11 +4,11 @@ Adds a PR-based review workflow with dedicated reviewer roles.
4
4
 
5
5
  ## What it adds
6
6
 
7
- - **Core roles**: Product Owner (approval) and Engineer (final merge gate)
8
- - **Extended roles** *(when present)*: QA (substantive review), Security Engineer (security-relevant review), Code Reviewer/UI/UX/DevOps advisory or domain review when explicitly configured
7
+ - **Core roles**: Product Owner (approval) and Code Reviewer (final merge gate — a non-author who lands the PR)
8
+ - **Extended roles** *(when present)*: QA (substantive review), Security Engineer (security-relevant review), UI/UX/DevOps advisory or domain review when explicitly configured
9
9
  - **Shared docs**: `docs/pr-conventions.md` — PR format, review workflow, merge rules
10
- - **Engineer skill**: Feature-branch + PR workflow (overrides direct-to-main from `github-repo`)
11
- - **Reviewer skills**: Review checklists for each reviewer role
10
+ - **Engineer skill**: Feature-branch + PR workflow (overrides direct-to-base-ref from `github-repo`)
11
+ - **Reviewer skills**: Review checklists for each reviewer role, plus the Code Reviewer's merge-gate skill
12
12
 
13
13
  ## Dependencies
14
14
 
@@ -19,13 +19,13 @@ Adds a PR-based review workflow with dedicated reviewer roles.
19
19
  1. Engineer resolves the project/worktree base ref first from `heartbeat-context` / project workspace metadata and uses it exactly as configured
20
20
  2. Engineer creates a feature branch (`<prefix>-<N>/<short-description>`) from that base
21
21
  3. Engineer opens a PR with Conventional Commits title, issue reference, and the matching base branch
22
- 4. Engineer sets the originating issue's `executionPolicy`: review stages for QA/domain reviewers as needed, an approval stage for the Product Owner, and a final Engineer merge-gate approval stage (roles resolved to agentIds); the PR link is added as an issue comment
22
+ 4. Engineer sets the originating issue's `executionPolicy`: review stages for QA/domain reviewers as needed, an approval stage for the Product Owner, and a final Code Reviewer merge-gate approval stage (roles resolved to agentIds); the PR link is added as an issue comment. The engineer never lists themselves as a participant — Paperclip excludes the issue's executor from every stage.
23
23
  5. QA reviews with executed evidence when present
24
24
  6. Security Engineer reviews security-relevant changes when present
25
25
  7. Product Owner reviews for intent alignment, scope discipline, acceptance criteria
26
- 8. Code Reviewer and domain reviewers may add advisory PR comments unless explicitly added as executionPolicy participants
26
+ 8. Domain reviewers (UI/UX/DevOps) may add advisory PR comments unless explicitly added as executionPolicy participants
27
27
  9. DevOps reviews infrastructure impact when explicitly added as a stage
28
- 10. Engineer merges when all stages are approved (no `changes_requested` outstanding), confirms the PR landed on the correct base, closes/archives any isolated worktree that Paperclip created, and only then records the final approval / closes the issue
28
+ 10. The Code Reviewer (the non-author merge gate) merges when all stages are approved (no `changes_requested` outstanding), confirms the PR landed on the correct base, closes/archives any isolated worktree that Paperclip created, and only then records the final approval / closes the issue
29
29
 
30
30
  ## Handover mechanism
31
31
 
@@ -1,25 +1,41 @@
1
- # Skill: Code Review (advisory)
1
+ # Skill: Code Review (final merge gate)
2
2
 
3
- You provide an **advisory, non-binding** code review. You are *not a merge gate*: the merge is gated by executed verification green CI, or QA running the tests (see `docs/pr-conventions.md`). Your value is a second pair of eyes on correctness, clarity, and simplicity that automated checks miss.
3
+ You are the **final merge gate** for pull requests. After QA, the Security Engineer (when relevant), and the Product Owner have approved, the issue's `executionPolicy` routes its final `approval` stage to you. You do a last correctness pass, satisfy the hard verification gate, **merge the PR**, clean up, and only then record `approved` — which closes the issue to `done`.
4
4
 
5
- ## What to look for
5
+ ## Why you, and not the engineer
6
6
 
7
- 1. **Correctness** Does the code do what the PR claims? Are edge cases handled? Does the logic match the stated intent?
8
- 2. **Simplicity** — Is this the simplest solution that works? Could anything be removed without losing functionality?
9
- 3. **Clarity** Naming, structure, comments. Will the next reader understand this?
10
- 4. **Security smells** — Obvious injection, exposed secrets, missing validation at boundaries. Defer deep security review to the Security Engineer when the change is security-relevant.
11
- 5. **Dead code**Commented-out blocks, unused branches.
7
+ Paperclip's runtime **excludes the issue's original executor (the author) from every review and approval stage** to prevent self-review. A stage whose only participant is the author has *no eligible participant*, so the issue stalls in `in_review` forever (`422 No eligible approval participant is configured for this issue`). The merge therefore cannot be performed by the engineer who wrote the code — it must be a non-author. That is you.
8
+
9
+ ## What to verify before merging
10
+
11
+ 1. **Hard gateexecuted verification (never skip):**
12
+ - With CI: the PR's CI (lint/test/build) must be **green**. Confirm it on the PR.
13
+ - Without CI: run the full test suite and build yourself and paste the real output into your verdict before merging.
14
+ - A merge without cited executed verification is invalid.
15
+ 2. **All prior stages approved:** QA's `review` (when present), the Security Engineer's `review` (when added), and the Product Owner's `approval` are all recorded `approved`.
16
+ 3. **Correctness pass:** read the diff. Does it do what the PR claims? Are edge cases handled? Is it the simplest, clearest solution? Watch for dead code, exposed secrets, and missing validation at boundaries (defer deep security review to the Security Engineer when the change is security-relevant).
17
+ 4. **Base ref:** the PR targets the configured project/worktree base from `heartbeat-context` (`repoRef` / `defaultRef` / `workspaceStrategy.baseRef`). Retarget before merging if it points at the wrong branch.
18
+
19
+ ## Merging
20
+
21
+ 1. Merge with `gh pr merge <number> --merge`. No force pushes.
22
+ 2. Confirm the merge landed on the correct base.
23
+ 3. If Paperclip created an isolated execution workspace for the issue, read its id from `heartbeat-context`, call close-readiness, and archive it after the merge and once the tree is clean. If cleanup is blocked or fails, do **not** record approval — leave the issue open with the exact blocker. If the issue runs in the shared project workspace, do not invent isolated-worktree cleanup.
24
+ 4. **Only after the merge and cleanup succeed**, record `approved` (PATCH toward `done`) with a comment citing the executed verification and the merge confirmation. That closes the issue.
25
+ 5. Never record `approved` before the merge has actually succeeded, and never leave the issue `done` with the PR still open.
26
+
27
+ ## When something is wrong
28
+
29
+ If correctness, security, or verification is not satisfied, record `changes_requested` (PATCH back toward `in_progress`) with a specific comment. That routes the issue back to the engineer (the `returnAssignee`) — they fix it and resubmit, and the issue returns to you. Do not merge around an unresolved concern.
12
30
 
13
31
  ## How to comment
14
32
 
15
- 1. When the PR has a review stage assigned to you, read the diff (check it out locally if useful).
16
- 2. Post your feedback as a GitHub PR comment via a Markdown file: open with a heading (`## 💬 Review notes`), then specific, actionable points, and run `gh pr comment <number> --body-file <file>`. Never inline `--body "..."` — `\n` stays literal in a double-quoted shell string. See `docs/pr-conventions.md` → *Posting PR Bodies & Comments*.
17
- 3. If you are a participant on an advisory review stage, record your notes there too — but understand it does not gate the merge.
33
+ Post verdicts as GitHub PR comments via a Markdown file (`gh pr comment <number> --body-file <file>`) — never inline `--body "..."` (`\n` stays literal in a double-quoted shell string). Open with a heading stating the verdict (`## Approved & merged`, `## 🔄 Changes requested`), then the verification you ran or confirmed and the specific points you examined. See `docs/pr-conventions.md` → *Posting PR Bodies & Comments*.
18
34
 
19
35
  ## Rules
20
36
 
21
- - Be constructive suggest alternatives, don't just criticize.
22
- - Focus on substance over style; auto-formatters handle style.
23
- - "Looks good" is not useful feedback. Point at what you actually examined.
24
- - Raise correctness or security concerns clearly so QA / the Security Engineer / the Engineer can act on them before merge.
25
- - You do not gate the merge. If something must block, it belongs to QA (tests), the Security Engineer (security-relevant), or CI.
37
+ - You are the merge owner. Reviewers before you do not merge; the engineer (author) cannot.
38
+ - "Looks good" is not a verdict. Cite what you examined and the verification you ran or confirmed.
39
+ - Never merge without green CI or pasted test/build output.
40
+ - Block on real concerns via `changes_requested` rather than merging around them.
41
+ - Never add the issue's author/executor as a participant in any stage you are the non-author gate that lands the work.
@@ -1,10 +1,10 @@
1
1
  # Skill: PR Workflow
2
2
 
3
- When this skill is active, you work in feature branches and open PRs instead of committing directly to main. Follow the conventions in `docs/pr-conventions.md` in the project root.
3
+ When this skill is active, you work in feature branches and open PRs instead of committing directly to the base ref. Follow the conventions in `docs/pr-conventions.md` in the project root.
4
4
 
5
5
  ## Feature Branch Flow
6
6
 
7
- 1. Resolve the project/worktree base ref from the issue's `heartbeat-context` / project workspace metadata before branching. Use the configured `repoRef`, `defaultRef`, or `executionWorkspacePolicy.workspaceStrategy.baseRef` exactly as Paperclip provides it. Never guess from your shell's current branch and never rewrite the configured ref to `main`, `master`, or `origin/*`.
7
+ 1. Resolve the project/worktree base ref from the issue's `heartbeat-context` / project workspace metadata before branching. Use the configured `repoRef`, `defaultRef`, or `executionWorkspacePolicy.workspaceStrategy.baseRef` exactly as Paperclip provides it. Never guess from your shell's current branch and never rewrite the configured ref to `main`, `master`, or `origin/*`. If no base ref is configured anywhere, use the repository's actual default branch — whatever `origin/HEAD` points at, regardless of name (`main`/`master`/`trunk`/…); fall back to `main` then `master` only if the remote advertises no default HEAD. See `docs/git-workflow.md` → *Resolving the default branch*. Never hard-code `main`.
8
8
  2. Fetch and update the base:
9
9
  - external: `git fetch origin`, then branch from the configured base ref
10
10
  - local: update from the configured local branch
@@ -12,26 +12,27 @@ When this skill is active, you work in feature branches and open PRs instead of
12
12
  4. Make your changes, commit with Conventional Commits format
13
13
  5. Push branch: `git push -u origin <branch-name>`
14
14
  6. Open PR against the same resolved base: derive the GitHub base branch from the configured ref (for example, strip the remote prefix only when the ref is remote-tracking), write the body (PR Body Template in `docs/pr-conventions.md`) to a file, then `gh pr create --base <github-base-branch> --head <branch-name> --title "<type>: <description>" --body-file <file>`. Never inline `--body "..."` — a double-quoted shell string keeps `\n` literal and the PR renders as `text\ntext` (see *Posting PR Bodies & Comments*).
15
- 7. Set the originating issue's `executionPolicy` to gate the merge on review, ending with your own merge gate:
15
+ 7. Set the originating issue's `executionPolicy` to gate the merge on review, ending with the Code Reviewer as the merge gate:
16
16
  - One `review` stage with **QA** when a QA agent exists (test adequacy / executed verification).
17
17
  - One `review` stage with the **Security Engineer** only when the change is security-relevant (auth, secrets, input boundaries, crypto, dependencies, infra exposure).
18
- - Additional `review` stages only for domain reviewers that should block this specific change. Code Reviewer and other specialists are advisory by default unless explicitly configured as participants.
18
+ - Additional `review` stages only for domain reviewers that should block this specific change.
19
19
  - An `approval` stage with the **Product Owner** as participant (always) — the product sign-off.
20
- - A final `approval` stage with **yourself (the Engineer)** as participant — the **merge gate**. This stage exists so you are woken *last*, after every reviewer and the Product Owner have cleared, to perform the merge.
20
+ - A final `approval` stage with the **Code Reviewer** as participant — the **merge gate**. The Code Reviewer is woken *last*, after every reviewer and the Product Owner have cleared, to satisfy the hard verification gate and merge the PR. If the team has no Code Reviewer, use another present non-author agent (e.g. DevOps, the Product Owner, or another engineer) — never yourself.
21
+ - **Never list yourself (the issue's executor) as a participant in any stage.** Paperclip excludes the original executor to prevent self-review; a stage whose only participant is you has no eligible participant and the issue stalls in `in_review` forever (`422 No eligible approval participant is configured for this issue`).
21
22
  - Resolve each role to its agentId first (look up active agents), then set the policy on the issue. Include the PR link in an issue comment so reviewers can find it.
22
23
  8. Move the originating issue to `in_review`.
23
24
  9. Wait for the issue to clear its review/approval stages. Each reviewer and the Product Owner records `approved` by PATCHing the issue toward `done`, or `changes_requested` by PATCHing it back to `in_progress`; Paperclip stores the reviewer/approver decision metadata on the issue. Verdicts may be mirrored as PR comments. A `changes_requested` routes the issue back to you — address it, push to the same branch, and that stage re-runs.
24
- 10. When the issue reaches your final **merge gate** stage (you are the current participant and every prior stage is approved): run `gh pr merge <number> --merge`, confirm the merge landed into the configured project base, then close/archive the isolated execution workspace if one exists and close-readiness allows it. **Only after merge and workspace close/cleanup succeeds** record `approved` on your stage — that closes the issue to `done`. Never record `approved` before the merge has actually succeeded, and never set the issue to `done` with the PR still open or an execution workspace still active.
25
+ 10. You do not merge your own PR. The **Code Reviewer** (the non-author merge gate) lands it after every prior stage approves, satisfies the hard verification gate, and records the final `approved` that closes the issue to `done`. Your remaining job is to respond to `changes_requested`: when a stage routes the issue back to you (the `returnAssignee`), address the feedback, push to the same branch, and the routed stage re-runs.
25
26
 
26
27
  ## Rules
27
28
 
28
- - Never commit directly to main (except typos/comment-only/doc fixes with issue reference).
29
+ - Never commit directly to the base ref (except typos/comment-only/doc fixes with issue reference).
29
30
  - One PR per issue. Keep changes focused.
30
31
  - Always include `Closes [PREFIX-N]` in the PR body.
31
32
  - If a reviewer requests changes, address them, push to the same branch, and re-request review (the stage re-runs).
32
- - You are the merge owner — never ask reviewers to merge.
33
- - Before creating a PR or merging, verify the PR base matches the configured project/worktree base. If the base is wrong, retarget the PR before review/merge.
34
- - **Your merge gate must be the last stage.** The Product Owner's `approval` is the product sign-off, not the final stage. If it were last, their verdict would auto-close the issue to `done` and you would never be woken to merge — leaving the PR open on GitHub. Always append your own merge-gate `approval` stage after the Product Owner's, and do the merge there before recording your verdict.
33
+ - The Code Reviewer (the non-author merge gate) is the merge owner. You cannot merge your own PR Paperclip excludes you (the executor) from every review/approval stage. Hand off cleanly by setting the policy correctly, not by merging yourself.
34
+ - Before creating a PR, verify the PR base matches the configured project/worktree base. If the base is wrong, retarget the PR before review.
35
+ - **The merge gate must be the last stage, and it must be a non-author.** The Product Owner's `approval` is the product sign-off, not the final stage: if it were last, their verdict would auto-close the issue to `done` with the PR still open on GitHub. Append a final merge-gate `approval` stage for the **Code Reviewer** (or another present non-author agent) after the Product Owner's. Never make yourself the merge gate Paperclip excludes the executor, so that stage stalls with `422 No eligible approval participant`.
35
36
  - Do not create separate child review issues and do not use @-mentions to request review; the executionPolicy stages are the governance signal.
36
37
  - Do not wait for GitHub-native approving reviews when all agents share the same GitHub credential; GitHub rejects self-approval. The Paperclip executionPolicy stages are the required signal unless a separate non-author GitHub reviewer credential is explicitly available.
37
- - If Paperclip created an isolated execution workspace for this issue, do not leave it behind. Use the current execution workspace id from `heartbeat-context`, check close-readiness, and archive it after the PR is merged and the tree is clean. If archive/cleanup is blocked, leave the issue `blocked` or `in_review` with the exact cleanup blocker instead of marking `done`. If this issue runs in the shared project workspace, do not invent isolated-worktree cleanup.
38
+ - Post-merge cleanup of any isolated execution workspace belongs to the merge-gate agent (they archive it from `heartbeat-context` when landing the PR). You only clean up your own worktree if you abandon a branch or the issue is cancelled before review. If this issue runs in the shared project workspace, do not invent isolated-worktree cleanup.
@@ -69,42 +69,42 @@ Review runs through the issue's native `executionPolicy` (stages), not separate
69
69
  - a `review` stage for **QA** when a QA agent is on the team (test adequacy / running the tests),
70
70
  - a `review` stage for the **Security Engineer** *only when the change is security-relevant* (auth, secrets, input boundaries, crypto, dependencies, infra exposure),
71
71
  - an `approval` stage for the **Product Owner** (intent, scope, acceptance),
72
- - a final `approval` stage for the **Engineer** as the merge gate.
73
- Resolve each role to its agentId.
72
+ - a final `approval` stage for the **Code Reviewer** as the merge gate (a non-author — Paperclip excludes the issue's executor from every stage).
73
+ Resolve each role to its agentId. **Never list the issue's executor (the engineer who authored the work) as a participant in any stage** — the runtime excludes the original executor, so such a stage has no eligible participant and the issue stalls (`422 No eligible approval participant`).
74
74
  4. **Engineer** sets the issue to `in_review`.
75
75
  5. **QA** (when present) reviews and records `approved`/`changes_requested` through the normal issue update route with executed evidence (see *Merge Rules*), preserving the issue-level review audit trail.
76
76
  6. **Security Engineer** (when present as a stage) probes the security-relevant change and records a verdict stating what was checked.
77
- 7. **Code Reviewer** and other domain reviewers may add **advisory, non-blocking** PR comments. They do not gate the merge.
77
+ 7. Other domain reviewers may add **advisory, non-blocking** PR comments. They do not gate the merge.
78
78
  8. **Product Owner** reviews for intent match, scope discipline, and acceptance criteria, and records the `approval` verdict through the normal issue update route, preserving the issue-level approval audit trail.
79
- 9. **Engineer** owns the final `approval` stage (merge gate): once reviewers and the Product Owner have approved, the engineer satisfies the hard gate (CI green, or runs the tests/build and pastes the output), merges the PR into the correct configured base, confirms the merge landed, closes/archives the isolated execution workspace when one exists and close-readiness allows it, and only then records `approved` — which closes the issue to `done`. The merge and workspace cleanup must happen before the issue is `done`.
79
+ 9. **Code Reviewer** owns the final `approval` stage (merge gate): once reviewers and the Product Owner have approved, the Code Reviewer satisfies the hard gate (CI green, or runs the tests/build and pastes the output), merges the PR into the correct configured base, confirms the merge landed, closes/archives the isolated execution workspace when one exists and close-readiness allows it, and only then records `approved` — which closes the issue to `done`. The merge and workspace cleanup must happen before the issue is `done`. The merge owner must be a non-author: Paperclip excludes the issue's executor (the engineer) from every stage, so the engineer cannot be the merge gate.
80
80
 
81
81
  ## Review Roles
82
82
 
83
83
  - **QA** (`review` stage, when present): the substantive gate. Test coverage, regression risk, and validation — backed by tests that actually ran.
84
84
  - **Security Engineer** (`review` stage, only when the change is security-relevant): probes the diff for injection, auth, secrets, crypto, dependency, and exposure issues.
85
85
  - **Product Owner** (`approval` stage): intent alignment, scope discipline, acceptance criteria.
86
- - **Engineer** (`approval` stage, last): the merge gate and hard-gate backstop — see *Merge Rules*.
87
- - **Code Reviewer / domain reviewers** (advisory): optional, non-blocking comments on correctness, clarity, design, accessibility, UX. They never gate the merge.
86
+ - **Code Reviewer** (`approval` stage, last): the merge gate and hard-gate backstop — a non-author who verifies and lands the PR. See *Merge Rules*.
87
+ - **Domain reviewers** (advisory): optional, non-blocking comments on correctness, clarity, design, accessibility, UX. They never gate the merge.
88
88
 
89
89
  ## Merge Rules
90
90
 
91
- The hard gate is **executed verification**, enforced on the Engineer's merge-gate stage and independent of which reviewers are present:
91
+ The hard gate is **executed verification**, enforced on the merge-gate stage (the Code Reviewer's) and independent of which reviewers are present:
92
92
 
93
- - **With CI:** CI (lint/test/build) must be **green** before the Engineer merges. This is machine-verified and cannot be skipped.
94
- - **Without CI:** the Engineer must run the full test suite and build locally and paste the real output into the merge-gate verdict before merging. (When QA is present, QA already produced this evidence; the Engineer confirms it.)
93
+ - **With CI:** CI (lint/test/build) must be **green** before the merge gate merges. This is machine-verified and cannot be skipped.
94
+ - **Without CI:** the merge-gate agent must run the full test suite and build locally and paste the real output into the merge-gate verdict before merging. (When QA is present, QA already produced this evidence; the merge gate confirms it.)
95
95
  - A verdict that does not cite executed verification — green CI, or pasted test/build output — is not valid.
96
96
  - The Product Owner's `approval` stage must be approved.
97
97
  - QA's `review` stage (when present) and the Security Engineer's `review` stage (when added) must be approved.
98
- - The Code Reviewer and other domain reviewers are advisory — blocking only when they escalate a concern that QA, the Security Engineer, or the Engineer then acts on.
98
+ - Domain reviewers are advisory — blocking only when they escalate a concern that QA, the Security Engineer, or the merge gate then acts on.
99
99
  - No force pushes.
100
100
  - Merge using `gh pr merge <number> --merge`.
101
101
  - Before merge, verify the PR base matches the configured project/worktree base from `heartbeat-context`. Retarget before review/merge if needed.
102
- - The Engineer is the merge owner reviewers never merge.
103
- - The engineer's merge gate must be the **last** `approval` stage. If the Product Owner's approval were last, it would auto-close the issue to `done` and the merge would be skipped, leaving the PR open on GitHub.
102
+ - The Code Reviewer is the merge owner (a non-author); the engineer who wrote the PR cannot merge it.
103
+ - The merge gate must be the **last** `approval` stage and must be a **non-author**. If the Product Owner's approval were last, it would auto-close the issue to `done` and the merge would be skipped, leaving the PR open on GitHub. The merge gate can never be the issue's executor — Paperclip excludes the original executor from every stage (`422 No eligible approval participant is configured for this issue`).
104
104
  - If Paperclip created an isolated execution workspace for the issue, read its id from `heartbeat-context`, call close-readiness, and archive it after the PR is merged and the tree is clean. If cleanup is blocked or fails, do not mark the issue `done`; record the exact blocker and leave a concrete cleanup next action. If the issue runs in the shared project workspace, do not invent isolated-worktree cleanup.
105
105
  - Do not configure GitHub branch protection to require approving reviews unless the project has distinct non-author GitHub reviewer credentials; all agents using one GitHub account cannot formally approve their own PRs.
106
106
 
107
107
  ## Dev Cycle Rules
108
108
 
109
109
  **Requires PR**: code logic, APIs, DB schema, agent configs, infrastructure
110
- **Direct-to-main OK**: typos, comment-only changes, minor doc fixes (must reference issue)
110
+ **Direct-to-base-ref OK**: typos, comment-only changes, minor doc fixes (must reference issue)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-review",
3
- "description": "Coordinates substantive PR review through the issue's native executionPolicy. The merge gate is executed verification — green CI, or the engineer running the tests/build and pasting the output — not opinion. QA is the substantive reviewer when present; the Security Engineer reviews only security-relevant changes; the Code Reviewer is advisory.",
3
+ "description": "Coordinates substantive PR review through the issue's native executionPolicy. The merge gate is executed verification — green CI, or running the tests/build and pasting the output — not opinion. QA is the substantive reviewer when present; the Security Engineer reviews only security-relevant changes; the Code Reviewer is the non-author merge gate that verifies and lands the PR (Paperclip excludes the issue's author from every stage, so the engineer cannot merge their own work).",
4
4
  "requires": [
5
5
  "github-repo"
6
6
  ],
@@ -23,9 +23,9 @@
23
23
  "reviewGate": {
24
24
  "reviewers": ["qa"],
25
25
  "approver": "product-owner",
26
- "mergeGate": "engineer"
26
+ "mergeGate": "code-reviewer"
27
27
  },
28
- "description": "Document and verify the PR workflow via the issue's executionPolicy. The merge gate is executed verification: with CI, builds must be green before merge; without CI, the engineer runs the test suite/build and pastes the output before merging. Stages: a review stage for QA when present, a review stage for the Security Engineer only on security-relevant changes, an approval stage for the Product Owner, and a final approval stage for the Engineer as the merge gate (woken last to merge the PR before recording approval, which closes the issue). The merge gate must be the last stage so the Product Owner's approval does not auto-close the issue with the PR still open. The Code Reviewer and other domain reviewers add advisory, non-blocking comments. Optional branch protection may disable direct pushes, but do not require GitHub-native approving reviews unless the project has distinct non-author GitHub reviewer credentials."
28
+ "description": "Document and verify the PR workflow via the issue's executionPolicy. The merge gate is executed verification: with CI, builds must be green before merge; without CI, the merge-gate agent runs the test suite/build and pastes the output before merging. Stages: a review stage for QA when present, a review stage for the Security Engineer only on security-relevant changes, an approval stage for the Product Owner, and a final approval stage for the Code Reviewer as the merge gate (a non-author woken last to merge the PR before recording approval, which closes the issue). Never list the issue's executor/author as a participant in any stage — Paperclip excludes the original executor, so a stage whose only participant is the author has no eligible participant and the issue stalls (`422 No eligible approval participant is configured for this issue`); this is why the merge gate is the Code Reviewer (or another non-author), not the engineer. The merge gate must be the last stage so the Product Owner's approval does not auto-close the issue with the PR still open. Other domain reviewers add advisory, non-blocking comments. Optional branch protection may disable direct pushes, but do not require GitHub-native approving reviews unless the project has distinct non-author GitHub reviewer credentials."
29
29
  }
30
30
  ]
31
31
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "fast",
3
- "description": "Speed-optimized for solo engineer. CEO + one Engineer, commit directly on main, no PR review. Automatic issue generation and assignment.",
3
+ "description": "Speed-optimized for solo engineer. CEO + one Engineer, commit directly on the default branch, no PR review. Automatic issue generation and assignment.",
4
4
  "constraints": [
5
- "Not suited for more than one implementing engineer \u2014 lacks review process and parallel commits to main will cause conflicts."
5
+ "Not suited for more than one implementing engineer \u2014 lacks review process and parallel commits to the default branch will cause conflicts."
6
6
  ],
7
7
  "modules": [
8
8
  "github-repo",
@@ -67,7 +67,7 @@
67
67
  },
68
68
  {
69
69
  "title": "Configure branch protection and PR workflow",
70
- "description": "Set up branch protection on main, require PR reviews, configure review conventions. Document in docs/pr-conventions.md.",
70
+ "description": "Set up branch protection on the default branch, require PR reviews, configure review conventions. Document in docs/pr-conventions.md.",
71
71
  "priority": "high",
72
72
  "assignTo": "engineer"
73
73
  },
@@ -15,6 +15,6 @@ You are the Engineer.
15
15
 
16
16
  - Be precise. Use technical terms correctly.
17
17
  - Lead with what you did, then why, then how.
18
- - Keep status updates short. "Done. Merged to main. CI green." is a perfect update.
18
+ - Keep status updates short. "Done. Merged to the base branch. CI green." is a perfect update.
19
19
  - Flag risks early and clearly. "This will break X if Y" is better than discovering it later.
20
20
  - No fluff. Skip "I think we should consider possibly..." -- just state the recommendation.