Compare commits

..
3 Commits
8 changed files with 182 additions and 7 deletions

No files matched your search

+4 -3
View File
@@ -71,7 +71,8 @@ Every skill features an explicit **"Your call"** checkpoint where the agent paus
| **[`practice`](skills/practice/SKILL.md)** | `/practice [topic]`, `/practice review` | Socratic tutoring and delayed retrieval. Learner writes all code; uses graduated assistance, rubric calibration, and recall-before-reveal. | 50 lines |
| **[`diagnose`](skills/diagnose/SKILL.md)** | `/diagnose [symptom]` | Evidence-first troubleshooting. Progresses from raw logs to proven root cause and minimal, reversible fixes. | 49 lines |
| **[`git-manager`](skills/git-manager/SKILL.md)** | `/git-manager` | Repository hygiene, branch and worktree lifecycle, incremental Conventional Commits (autonomous on working branches in delivery mode; user-authored in learning mode), integration, conflict stops, and evidence-first reflog recovery. | 65 lines |
| **[`gitea-plan`](skills/gitea-plan/SKILL.md)** | `/gitea-plan` | Translates technical goals and plans into Gitea milestones and issues with tiered sizing and falsifiable acceptance criteria. | 52 lines |
| **[`gitea-plan`](skills/gitea-plan/SKILL.md)** | `/gitea-plan` | Translates technical goals and plans into Gitea milestones and issues with tiered sizing and falsifiable acceptance criteria. | 54 lines |
| **[`implement-slice`](skills/implement-slice/SKILL.md)** | `/implement-slice` | Orchestrates end-to-end delivery of an issue or vertical slice across worker and QA subagents, pre-committed rubrics, and final-HEAD gates without editing code directly. | 44 lines |
| **[`gitea-pr`](skills/gitea-pr/SKILL.md)** | `/gitea-pr` | Manages Gitea pull request lifecycle: branch readiness, review/verification synthesis, issue closing, and merge readiness. | 60 lines |
| **[`document`](skills/document/SKILL.md)** | `/document` | Second-order knowledge classifier (Discussion, ADR, Plan, Debug Record, Knowledge, Journal). User confirms type and provides core insight. | 55 lines |
| **[`journal-builder`](skills/journal-builder/SKILL.md)** | `/journal-builder` or `/journal` | Two-phase daily engineering review: generates factual skeleton with question blanks, then reviews and calibrates user reasoning. | 58 lines |
@@ -81,7 +82,7 @@ Every skill features an explicit **"Your call"** checkpoint where the agent paus
| **[`inspect-flake-update`](skills/inspect-flake-update/SKILL.md)** | `/inspect-flake-update` | Inspects updated flake.lock inputs, reviews upstream revisions, runs nix flake check, and drafts commit messages. | 46 lines |
| **[`nix-devshell`](skills/nix-devshell/SKILL.md)** | `/nix-devshell` | Authors, extends, validates, and troubleshoots project Nix development shells from repository evidence. | 76 lines |
| **[`verify-slice`](skills/verify-slice/SKILL.md)** | `/verify-slice` | Runs risk-proportional verification and PR review across behavioral, state, security, ergonomic, and regression perspectives using falsifiable assertions. | 37 lines |
| **[`code-review`](skills/code-review/SKILL.md)** | `/code-review` | Inspects diffs across four isolated axes: Spec & Scope, Standards & Smells, Seam & Test Integrity, and Defensive Invariants. | 42 lines |
| **[`code-review`](skills/code-review/SKILL.md)** | `/code-review` | Inspects diffs across four isolated axes: Spec & Scope (including strategic project alignment), Standards & Smells, Seam & Test Integrity, and Defensive Invariants. | 42 lines |
| **[`tdd`](skills/tdd/SKILL.md)** | `/tdd` | Guides red-green test-driven development through public interface seams, boundary-only mocking, and non-tautological assertions. | 40 lines |
### Vault Extensions (`extensions/`)
@@ -113,7 +114,7 @@ Every skill features an explicit **"Your call"** checkpoint where the agent paus
4. **Documentation Reconciliation**: `reconcile-docs` (audit history, code reality, roadmap) -> propose updates to README / ARCHITECTURE / ADRs -> user approves.
5. **Skill Design Loop**: `build-skill` (approve spec) -> dogfood run -> minimal mechanism refinement.
6. **Branch Lifecycle & Integration**: `git-manager` (branch-before-edits or isolated worktree) -> implementation & incremental checkpoint commits -> `code-review` / `verify-slice` -> `git-manager` (rebase or integration).
7. **Issue Planning to PR Delivery**: `gitea-plan` (tiered sizing & falsifiable acceptance criteria) -> `git-manager` (dedicated branch & incremental checkpoint commits) -> `code-review` / `verify-slice` (provenance & runtime ledger) -> `gitea-pr` (PR synthesis, feedback triage, issue closing).
7. **Issue Planning to PR Delivery**: `gitea-plan` (tiered sizing & falsifiable acceptance criteria) -> `implement-slice` (orchestrates `git-manager` workspace isolation, worker `tdd` checkpoints, pre-committed `verify-slice` QA rubrics, and final-HEAD `code-review`) -> `gitea-pr` (PR synthesis, feedback triage, issue closing).
---
+1 -1
View File
@@ -33,7 +33,7 @@ while [[ $# -gt 0 ]]; do
done
# Active skills to install
ACTIVE_PORTABLE_SKILLS=(build-skill code-review derive-skill diagnose document git-manager gitea-plan gitea-pr inspect-flake-update journal-builder nix-devshell practice reconcile-docs tdd verify-slice)
ACTIVE_PORTABLE_SKILLS=(build-skill code-review derive-skill diagnose document git-manager gitea-plan gitea-pr implement-slice inspect-flake-update journal-builder nix-devshell practice reconcile-docs tdd verify-slice)
ACTIVE_EXTENSION_SKILLS=(draft-curation)
# Legacy / deprecated skills to clean up or back up if found in target
+1 -1
View File
@@ -19,7 +19,7 @@ description: >-
1. **Pin the fixed point and scope.** Resolve the base ref and record exact base and head commit SHAs (`git rev-parse <base> HEAD`). Inspect working-tree state (`git status --short`, unstaged `git diff`, staged `git diff --cached`, and relevant untracked files) alongside committed history (`git diff <base>...HEAD` and `git log <base>..HEAD --oneline`). Record the covered revisions and working-tree diff state (for example, clean tree or diff fingerprint) so downstream tools can verify whether the reviewed diff remained unchanged, and distinguish findings across committed, staged, and unstaged changes.
2. **Select execution tier.** Match the change to the risk tiers from [axes](references/axes.md) (`Lightweight`, `Standard`, or `High-Assurance`). Single-agent sequential pass for Lightweight; independent review passes for Standard; isolated subagents per axis for High-Assurance.
3. **Inspect the four axes.** Evaluate the diff against each axis independently using [axes](references/axes.md):
- **Spec & Scope**: originating requirements satisfied, minimal shared-file footprint, zero scope creep.
- **Spec & Scope**: originating requirements satisfied, aligned with canonical project direction (`ARCHITECTURE.md`, `ROADMAP.md`, ADRs, active milestone) when present, minimal shared-file footprint, zero scope creep.
- **Standards & Smells**: repository rules and Fowler smell diagnostics from [smell-heuristics](references/smell-heuristics.md) (evaluated as confirmed violations, potential smells, or contextual trade-offs).
- **Seam & Test Integrity**: tests verify public interface seams, assertions are non-tautological, negative/boundary paths covered, vertical slices prioritized over bulk imagined tests.
- **Defensive Invariants**: system properties from [defensive-invariants](references/defensive-invariants.md) (trust boundaries, authority, consistency, failure semantics, resource limits).
+2 -2
View File
@@ -8,7 +8,7 @@ Derived and adapted from Matt Pocock's skills repository (github.com/mattpocock/
| Axis | Primary Question | Failure Mode Caught | Core Inspection Questions |
| :--- | :--- | :--- | :--- |
| **Spec & Scope** | Did we build what was requested, and only that? | Scope creep, missing requirements, leaky abstractions | 1. Does the diff satisfy the originating issue or specification contract?<br/>2. Is there unrequested functionality or premature generalization?<br/>3. Are changes to shared entrypoints (e.g., routers, base config) minimal and additive? |
| **Spec & Scope** | Did we build what was requested, aligned with project direction, and only that? | Scope creep, missing requirements, architectural or roadmap drift, leaky abstractions | 1. Does the diff satisfy the originating issue or specification contract?<br/>2. When canonical direction docs exist (`ARCHITECTURE.md`, `ROADMAP.md`, ADRs, or active milestone scope), does the change align with long-term boundaries and trajectory?<br/>3. Is there unrequested functionality or premature generalization?<br/>4. Are changes to shared entrypoints (e.g., routers, base config) minimal and additive? |
| **Standards & Smells** | Is the implementation maintainable and consistent? | Structural debt, friction with conventions | 1. Does the code adhere to repo standards (`CODING_STANDARDS.md`, linter configs)?<br/>2. Are code smells present that warrant refactoring? (See [smell-heuristics](smell-heuristics.md)).<br/>3. Is naming clear and aligned with domain vocabulary? |
| **Seam & Test Integrity** | Do tests prove actual contracts at public interfaces? | Tautological tests, implementation coupling | 1. Are tests verifying public interfaces (seams) rather than mocking private internals?<br/>2. Are assertions non-tautological (do not mirror code logic or pass by construction)?<br/>3. Prefer tests establishing observable behavior through meaningful vertical slices. Batch independent cases when doing so preserves clear contracts and does not substitute test quantity for behavioral evidence. |
| **Defensive Invariants** | Does the code preserve critical system properties under stress? | Injection, state desync, unhandled crashes | 1. Are untrusted inputs sanitized before reaching sinks? (See [defensive-invariants](defensive-invariants.md)).<br/>2. Does state reconcile against authoritative sources rather than local heuristic drift?<br/>3. Are failure semantics, timeouts, and resource limits explicit? |
@@ -16,7 +16,7 @@ Derived and adapted from Matt Pocock's skills repository (github.com/mattpocock/
### Non-Compensation Invariant
A strong pass on one axis never excuses a failure on another:
- Clean abstractions and zero code smells cannot excuse an unescaped HTML sink or an unhandled conflict.
- 100% test coverage cannot excuse unrequested feature drift or broken domain invariants.
- 100% test coverage cannot excuse unrequested feature drift, architectural direction drift, or broken domain invariants.
- Strict spec compliance cannot excuse fragile code structure that breaks repository conventions.
## 2. Review Recommendations Matrix
+2
View File
@@ -13,6 +13,7 @@ description: >-
- Decomposing a project, feature request, or technical plan into trackable Gitea units.
- Creating or editing milestones and issues with falsifiable acceptance criteria.
- Setting rolling planning horizons for multi-phase epics.
- Not for orchestrating slice implementation across subagents: use `implement-slice`.
- Not for branch or worktree management: use `git-manager`.
- Not for pull request lifecycle or review tracking: use `gitea-pr`.
@@ -48,5 +49,6 @@ description: >-
acceptance criteria.
## Hands off to
- `implement-slice`: to orchestrate end-to-end delivery of an approved issue or slice.
- `git-manager`: to create dedicated branches or worktrees for the decomposed issues.
- `gitea-pr`: to link, review, and close issues via pull requests.
+44
View File
@@ -0,0 +1,44 @@
---
name: implement-slice
description: >-
Orchestrates end-to-end delivery of a Gitea issue or vertical feature slice
across delegated implementation and QA subagents, checkpoint commits, static
review, and pull request packaging. Never edits implementation code or
self-certifies QA. Not for decomposing epics into issues (use gitea-plan) or
executing a single already-delegated worker task (use tdd and git-manager).
---
# Implement Slice
## Use when
- Delivering an approved Gitea issue or bounded feature slice end to end via coordinated subagents.
- Coordinating multi-task checkpoints, pre-committed QA rubrics, and final review gates.
- Not for decomposing raw epics into milestones and issues: use `gitea-plan`.
- Not inside an already-delegated implementation worker task: follow the assigned worker contract (`tdd`, `git-manager`) without re-invoking `implement-slice`.
## Steps
1. **Verify session mode and read slice context.** Check active session mode per `profile/AGENTS.md`: if `learning` is active, pause so the user can decide whether to switch to `delivery`. Read target Gitea issue/milestone state (`tea issues`, `tea milestones`), canonical direction docs (`ARCHITECTURE.md`, `ROADMAP.md`, ADRs when present), and `git status --short`. Clarify ambiguous intent with the user; hand off to `gitea-plan` if tracking issues must be created first.
2. **Select orchestration topology (`complexity x risk`).** Combine planning size (`Small`, `Medium`, `Large` from `gitea-plan`) with assurance risk (`Lightweight`, `Standard`, `High-Assurance` from `code-review` and `verify-slice`) per [orchestration-tiers](references/orchestration-tiers.md), letting high-risk surfaces override size upward. Keep pure-orchestrator and context-budget invariants at every tier: retain only the plan, task status, commit SHAs, QA dispositions, blockers, and decisions; never edit implementation files, repair Git via code edits, self-certify QA, or ingest full test logs unless resolving a failure.
3. **Lock plan, workspace topology, and pre-committed QA rubrics.** Decompose the slice into ordered tasks/chunks with explicit scope boundaries, expected `git-manager` checkpoint boundaries, workspace assignment (sequential shared branch vs. isolated `.worktrees/<task>` for concurrent workers), whether a PR applies, and falsifiable QA rubrics written before any worker spawns. Hard gate: pause for human approval before implementation begins.
4. **Assign workspaces and delegate implementation.** Govern branch and worktree lifecycle through `git-manager` per [orchestration-tiers](references/orchestration-tiers.md) (orchestrator decides topology and assigns workspaces; `git-manager` executes branch/worktree operations; workers edit and commit checkpoints inside their assigned workspace). Dispatch worker subagent(s) with the Implementation Assignment in [handoff-contracts](references/handoff-contracts.md). Never run concurrent implementation workers in the same working tree.
5. **Audit worker reports and run rubric QA.** Verify returned Implementation Reports via concise read-only Git checks (`git status --short`, `git log`, `git show --stat`) to confirm clean trees, commit SHAs, and scope containment. When the tier or chunk boundary requires independent QA, spawn a read-only/isolated QA subagent running `verify-slice` against the pre-committed rubric (withholding author narrative for `High-Assurance` black-box runs).
6. **Triage outcomes and route rework.** Classify non-passing outcomes using [handoff-contracts](references/handoff-contracts.md): send code defects or missing seam tests back to the existing worker subagent (`send_message`) when its context remains live; repair or escalate `BLOCKED (env/fixture)`; pause for human authorization on `BLOCKED (out-of-bounds)` (`live-infra`); and if a rubric proves defective, record an explicit justified amendment (pausing for human approval if acceptance criteria or scope change). Loop Steps 4-6 until all slice tasks pass.
7. **Enforce final-`HEAD` evidence invariant and finish.** Run `code-review` across `<base>...HEAD` (including strategic project alignment). Enforce the final-`HEAD` invariant in [handoff-contracts](references/handoff-contracts.md): required `code-review` (`Ready`) and `verify-slice` (zero unhandled `FAIL`) evidence must identify the same final `HEAD` and applicable base revision; any diff change invalidates affected evidence and triggers re-verification (completing any new `RV-*` checks on final `HEAD` via valid handshake reuse). Hard gate: never package a ready PR or declare completion until final-`HEAD` evidence is current. If a PR applies, hand off to `gitea-pr`; otherwise present the final-`HEAD` evidence summary, commit range, and open decisions to the user.
## Your call
- **Session mode**: decide whether to switch from `learning` to `delivery` before autonomous delegation.
- **Plan and pre-committed rubrics**: approve task decomposition, assurance tier, workspace topology, and QA rubrics before any implementation worker spawns.
- **Rubric amendments, `live-infra`, and trade-offs**: approve any rubric change that relaxes criteria or alters scope, authorize `live-infra` checks, and adjudicate unresolved conflicts or review disagreements.
- **PR packaging and release**: approve PR creation/updates and authorize merge (or accept local slice delivery when no PR applies).
## Done when
- All slice checkpoints are committed on a clean target branch, `code-review` (`Ready`) and `verify-slice` (zero unhandled `FAIL`) match the same final `HEAD` and base revision, and either `gitea-pr` has packaged the PR or final evidence has been delivered directly when no PR applies.
## Hands off to
- `gitea-plan`: when goals or epics require milestone and issue decomposition before slice execution.
- `git-manager`: to create/integrate slice branches and worktrees, commit worker checkpoints, or stop on conflicts.
- `tdd`: inside implementation workers for seam-level red-green development.
- `verify-slice`: inside QA subagents for pre-committed chunk and final-`HEAD` runtime verification.
- `code-review`: for final-slice 4-axis static and strategic alignment inspection.
- `diagnose`: when an unexpected failure requires evidence-first root-cause investigation.
- `gitea-pr`: when a PR applies and final-`HEAD` review plus verification packets are ready.
@@ -0,0 +1,80 @@
# Handoff Contracts, Failure Triage, and Final-HEAD Invariant
Reference for `implement-slice`. Every delegation uses explicit, bounded schemas so subagents execute deterministically and return compact evidence packets.
## 1. Implementation Assignment (Orchestrator -> Worker)
Provide before spawning (or messaging) an implementation worker:
- **Session Mode & Anti-Recursion**: Active mode (`mode: delivery`) plus explicit instruction: execute this task directly using `tdd` and `git-manager`; do not invoke `implement-slice` or spawn nested workers unless explicitly authorized.
- **Task ID & Objective**: Concrete deliverable outcome and linked Gitea issue (`#<id>` when applicable).
- **Assigned Workspace & Branch**: Exact repository/worktree path and non-default working branch name.
- **Scope Boundary**: In-scope files/interfaces and explicit out-of-scope exclusions (preventing opportunistic refactors).
- **Acceptance Criteria**: Numbered, falsifiable conditions this task must satisfy.
- **Checkpoint Expectation**: Expected coherent commit boundary (or boundaries) following `git-manager` Conventional Commits.
- **Required Compact Report**: Request concise structured output (no raw multi-hundred-line logs unless a check fails).
## 2. Implementation Report (Worker -> Orchestrator)
Require each worker to return:
- **Summary of Changes**: Touched files/seams and 2-5 bullet summary of what changed.
- **Criteria Coverage**: Mapping from assigned acceptance criteria to test or command proof.
- **Verification Summary**: Commands run (`pytest`, `cargo test`, typecheck, lint) with exit codes and pass counts.
- **Checkpoint Commits**: Exact commit SHA(s) and subject lines created, plus confirmation that `git status --short` is clean.
- **Scope Deviations or Open Risks**: Any unexpected constraint, untouched edge case, or blocker encountered (`None` if clean).
---
## 3. Pre-Committed QA Rubric Assignment (Orchestrator -> QA Subagent)
The rubric is written and approved during Step 3 (before implementation begins). When spawning the QA subagent:
- **Target Revision & Workspace**: Exact commit SHA (`HEAD`), base ref, and workspace path. State clearly: do not modify tracked files; leave `git status --short` clean.
- **Assurance Tier & Mode**: `Lightweight`, `Standard`, or `High-Assurance` per `verify-slice`. For `High-Assurance` black-box runs, withhold the diff narrative and worker self-audit.
- **Pre-Committed Falsifiable Checks**: Numbered checks with scope (`local` vs. `live-infra`), exact pass conditions, `FAIL if ...` signals, and any `code-review` Step 6 `RV-*` checks.
- **Authorization Boundary**: Explicitly state whether any `live-infra` check has human owner authorization for this run (default: unauthorized -> record `BLOCKED (out-of-bounds)`).
## 4. QA Report (QA Subagent -> Orchestrator)
Follows the `verify-slice` disposition contract:
- **Tested Revision**: Confirmed `HEAD` SHA and clean working-tree verification.
- **Check Dispositions**: Per-criterion result (`PASS`, `FAIL`, `BLOCKED (env/fixture)`, `BLOCKED (out-of-bounds)`, or `INCONCLUSIVE`) with concise observable evidence.
- **Confirmed Defects**: Reproducible failure steps, severity, and expected vs. actual behavior.
- **Rubric Fitness**: Explicit note if any rubric criterion proved ambiguous, untestable, or mismatched against repository reality.
---
## 5. Failure Triage and Rubric Amendment Routing
Never relay "QA failed" blindly. Classify each non-passing outcome and route to the right owner:
| Observed Outcome | Classification | Orchestrator Action |
| :--- | :--- | :--- |
| Behavioral check `FAIL` or `code-review` `Needs Rework` | **Implementation or test defect** | Send targeted actionable feedback (check ID, repro, expected contract) to the existing worker via `send_message` when live. |
| Acceptance criterion lacks public-seam test proof | **Missing seam test** | Route back to the existing worker (`tdd`) to add a non-tautological seam test and commit checkpoint. |
| `BLOCKED (env/fixture)` | **Environment or fixture blocker** | Delegate fixture/devshell repair (`nix-devshell` or worker task) or surface environment blocker to user before judging product code. |
| `BLOCKED (out-of-bounds)` | **Unauthorized `live-infra` boundary** | Preserve exact command and criteria; pause for human owner authorization, operator run, or documented deferral. |
| Symptom contradicts hypotheses across retries | **Unknown root cause** | Stop blind retries; hand off to `diagnose` for evidence-first root-cause investigation. |
| Criterion contradicts actual system architecture or tests the wrong seam | **Defective rubric** | Record an explicit **Rubric Amendment** stating what changed and why. Pause for human approval whenever an amendment relaxes an acceptance criterion or alters slice scope; never silently rewrite criteria to match worker output. |
---
## 6. Final-HEAD Evidence Invariant and Terminal Delivery
### The Invariant
> Before `gitea-pr` creates or marks a PR ready (or before terminal delivery when no PR applies), the required `code-review` and `verify-slice` evidence must identify the same final `HEAD` and applicable base revision. Any change to the reviewed diff invalidates affected evidence.
### Recovery Rules When `HEAD` Advances or Checks Emit
1. **Post-QA commit**: If `HEAD` changes after `verify-slice` (for example, to address a `code-review` finding or rebase onto base), rerun `verify-slice` against the new `HEAD`.
2. **Post-review commit**: If `HEAD` changes after `code-review`, rerun `code-review` against `<base>...HEAD`.
3. **Emitted `RV-*` runtime checks**: If `code-review` Step 6 emits executable `RV-*` checks, execute them via `verify-slice` against the final `HEAD` before packaging.
4. **Handshake reuse condition**: `verify-slice` may reuse a preceding `code-review` report for static provenance only when its recommendation is `Ready` (including `Ready (Conditional)` once open items are adjudicated by the human owner per `code-review`) and its recorded base SHA, `HEAD` SHA, and working-tree diff fingerprint still match exactly.
### Conditional Terminal Paths
- **PR applies**: Once `code-review` (`Ready`) and `verify-slice` (zero unhandled `FAIL`) match final `HEAD`, hand off both packets to `gitea-pr` to draft the PR description, pause for human PR approval, create/update the PR, and report merge readiness.
- **No PR applies** (local repo, approved solo-branch workflow, or bounded spike): Enforce the identical final-`HEAD` evidence invariant, then present the commit range (`<base>..HEAD`), static review disposition, runtime verification ledger, and any open residual-risk decisions directly to the user.
@@ -0,0 +1,48 @@
# Orchestration Topology, Boundaries, and Workspace Ownership
Reference for `implement-slice`. Defines how the orchestrator combines existing planning and assurance tiers without redefining them, preserves context efficiency, and prevents workspace contention.
## 1. Pure-Orchestrator and Context-Budget Invariants
These boundaries hold across every slice size and risk tier:
1. **No implementation or self-certified QA**: The orchestrator never edits product or test files, creates ad-hoc fixup commits, executes mutations to repair broken code, or declares runtime QA passing without worker/QA evidence. Read-only inspection (`tea`, `git status`, `git log`, `git diff --stat`, targeted file reads to check a contradiction) is allowed.
2. **Context-budget discipline**:
- **Retain in orchestrator context**: approved slice plan, task dependency status, assigned workspace/branch refs, checkpoint commit SHAs, QA check dispositions, active blockers, and open human decisions.
- **Delegate out of orchestrator context**: full test suite transcripts, build logs, browser traces, and line-by-line edit narratives. Require concise structured reports with exact references (commit SHAs, `path:line` locations, check IDs, or log/artifact paths) and inspect raw output only when resolving a discrepancy or failure.
---
## 2. Combining `Complexity x Risk` (Single-Owner Tier Mapping)
`implement-slice` does not define new sizing or risk vocabularies; it composes the canonical tiers owned by sibling skills:
- **Planning size (`Small`, `Medium`, `Large`)**: owned by [`gitea-plan`](../../gitea-plan/references/decomposition-tiers.md). Governs Gitea planning ceremony and task decomposition granularity.
- **Assurance rigor (`Lightweight`, `Standard`, `High-Assurance`)**: owned by [`code-review`](../../code-review/references/axes.md) and [`verify-slice`](../../verify-slice/references/perspectives.md). Governs worker independence, runtime check depth, and static review isolation.
**Risk override rule**: Always compute assurance rigor from failure consequences, never diff line count alone. Touching authentication, permissions, secrets, payments, concurrent state, data migrations, deployment/infrastructure, destructive operations, or core shared libraries elevates even a `Small` slice to `High-Assurance` verification and review while keeping `Small` planning ceremony.
| Planning Size x Assurance Rigor | Worker Delegation | Mid-Slice QA (`verify-slice`) | Final Slice Gate (`<base>...HEAD`) |
| :--- | :--- | :--- | :--- |
| **`Small` x `Lightweight`** | 1 implementation worker subagent on slice branch (`tdd` where applicable + `git-manager` checkpoint commit + self-audit). | Skip separate mid-slice QA subagent if deterministic worker evidence satisfies the pre-committed rubric; run final-`HEAD` `verify-slice` Lightweight checks. | Single-pass `code-review` (`Lightweight`) + final-`HEAD` `verify-slice` confirmation. |
| **`Small`/`Medium` x `Standard`** | Sequential worker subagent(s) per task/chunk on slice branch (or isolated worktrees only if tasks are genuinely independent). | Spawn independent rubric QA subagent (`verify-slice` `Standard`) at chunk boundary or slice completion when stateful/UI/API behavior warrants separation. | Independent `code-review` (`Standard`, including strategic alignment) + final-`HEAD` `verify-slice` packet. |
| **Any Size x `High-Assurance`** (or `Large` multi-chunk slice) | Sequential tasks on slice branch or isolated per-task worktrees for independent tracks; strict checkpoint boundaries. | Spawn clean black-box QA subagent (`verify-slice` `High-Assurance`), withholding diff narrative and worker self-audit per `verify-slice` Step 3. | Isolated multi-axis `code-review` (`High-Assurance`) + final-`HEAD` `verify-slice` packet (including any emitted `RV-*` checks). |
---
## 3. Branch, Worktree, and QA Ownership Boundaries
Explicit ownership prevents concurrent working-tree corruption and keeps Git recovery out of the orchestrator:
| Role | Exact Responsibility |
| :--- | :--- |
| **Orchestrator (`implement-slice`)** | Decides branch/worktree topology in the approved plan, assigns each worker an explicit workspace path and target branch, and verifies resulting refs/SHAs read-only. Never repairs broken Git state by editing files or committing directly. |
| **`git-manager`** | Owns and governs branch creation, `.worktrees/<task>` creation/removal, branch integration (`rebase`, `merge`, `cherry-pick`), conflict stops, and evidence-first `reflog` recovery. On any merge/rebase conflict or unfamiliar dirty tree, `git-manager` stops immediately for human decision. |
| **Implementation Worker** | Modifies code and tests only inside its assigned workspace and scope boundary; runs local checks via `tdd` and commits verified checkpoints autonomously on the non-default working branch per `git-manager`. |
| **QA Subagent (`verify-slice`)** | Evaluates a pinned commit SHA (`HEAD`) without modifying tracked repository files. Writes temporary fixtures or scratch state only in isolated temp directories (such as `mktemp -d`), leaving `git status --short` clean. |
### Contention and Worker Reuse Rules
1. **Sequential default**: Prefer sequential task delegation on a single slice branch when tasks touch related modules or take minutes rather than hours; parallel worktrees pay an integration cost.
2. **Mandatory isolation for concurrency**: Never run two implementation subagents concurrently in the same working directory. Concurrent implementation tasks require separate `git-manager` worktrees and an explicit integration step before final-`HEAD` review.
3. **Stateful worker reuse**: Retain each worker's subagent `conversationId`. When QA or `code-review` routes actionable rework back on a task, message that existing worker (`send_message`) so it retains design context instead of spawning a cold worker. Spawn a fresh worker only for a distinct new task or when the original worker session is unavailable.