--- name: brigade-work description: Use in a Brigade Stack-wired workspace for work briefs, verification when selected, and Memory Handoffs. --- # brigade-work Start with the work brief and hand off durable knowledge at closeout. If you record a verification receipt, capture its outcome and make the evidence available to the next run. Receipts record observed exit codes. Ad hoc verify receipts provide audit evidence, while eligible manifest-backed receipts can score an artifact. Check scoreability before claiming a result affects ranking. ## When this applies The repo or workspace is Brigade Stack-wired: a `.brigade/` directory exists, or `brigade status --target .` succeeds. If neither is true, this skill does not apply (run `brigade init` first only if the user wants Brigade Stack here). ## The loop ### 1. Start: see what is pending At the start of a work session, before deciding what to do: ```bash brigade work brief --target . # pending work, imports, warnings, suggested next command ``` In a memory/operator workspace, `brigade daily status --target .` is the lighter equivalent. Read it first. ### 2. Check the workspace mode before verifying Check `brigade work mode show`. In Off and Observe, run checks directly or choose to record a receipt. In Strict, run checks through Brigade Stack. Use this command when recording a receipt: ```bash brigade work verify run --target . --command "" --capture auto # e.g. "pytest -q tests/test_example.py", "npm test", "go test ./..." ``` Use a focused selector for local pytest checks; the full suite belongs to CI. This writes an audit receipt under `.brigade/work/verify-runs//` with the real status. Running tests raw produces no Brigade receipt. Neither a raw test result nor an ad hoc receipt scores an artifact. To do steps 2 and 3 in one command (so the capture is never forgotten), pass `--capture`. Use `--capture auto` so you never hand-type an artifact id: Brigade reads this session's hook state and captures against each skill whose `SKILL.md` you read: ```bash brigade work verify run --target . --command "" --capture auto ``` `auto` rows are marked `session_observed`. That attribution is caller-side and forgeable, so it can only lower a rank or hold a promotion, never raise or promote. If no skill was read (a Codex repo, a plain shell) it records against `brigade-work` as `caller_typed` and prints one note, so the loop never records nothing. A typed id (`--capture `) is still accepted and is recorded as `caller_typed`. For a skill it never promotes, holds or rolls it back, because only a scoreable manifest trial moves a skill through the scorecard. Card scores still count typed captures. For scoreable evidence, use an existing registered verifier manifest tracked under `verify/manifests/`: ```bash brigade work verify run --target . --manifest --capture auto ``` When the hook names a manifest verify, run it: that is the only scoreable kind. Inspect the reported eligibility and reason. Do not create or alter a manifest merely to make a result count. ### 3. Capture the outcome for a check that used a receipt Immediately after a verify run (if you did not use `--capture`), record the result against the skill or card you exercised: ```bash brigade outcome capture --run-id latest --kind skill ``` Ad hoc `--command` and `--argv-json` receipts are audit-only evidence and cannot score an artifact. Scoreable evidence requires a registered verifier manifest tracked under `verify/manifests/` with subject/check metadata and artifact attribution. Inspect the receipt eligibility and reason. Capture observed failures too; capture does not make an audit receipt scoreable. **Name an id you actually have.** Capturing against an id Brigade Stack does not recognize prints a warning and pollutes the ranking. The id is whatever genuinely guided the change: - the actual installed skill that guided the work; - a memory card under `memory/cards/` (use `--kind card`); - `brigade-work` itself - a fresh repo always has this one, so when nothing else applies, capture against `brigade-work`. Prefer `--capture auto` on the verify run; reach for a typed id only when you are recording after the fact with `brigade outcome capture`. Do not invent a skill name you are not running just to have something to capture against. ### 4. Export receipts so the next run can reuse them (optional stations) When brigade-code-graph and brigade-evidence are installed, close the receipts-to-context loop so the next run sees measured evidence, not only a handoff. `brigade work verify run --capture auto` auto-exports and imports pending receipts after capture (fail-open when `brigade-evidence` is absent). For backlog catch-up or fleet repos, run manually: ```bash brigade receipts export evidence --target . --new-only --import # fail-open if brigade-evidence is absent # next brigade run attaches a capped evidence brief from brigade-evidence automatically # or fetch on demand: brigade work import context --from-evidence "auth receipts" --target . ``` brigade-code-graph is what makes the brief measurable: verify/run receipts carry `code_graph_delta`, and non-read-only runs record `context_eval.brief_hit_rate` (did the pre-run context name the files the run actually touched?). `brigade outcome rank` surfaces mean brief hit rate per skill as a quality signal (secondary sort; install/rollback still use exit-code signals only). One-glance loop health: ```bash brigade operator checkup --target . # doctors + graph ok / ledger ok / last brief hit rate ``` ### 5. Finish: handoff, and let the ratchet run At session end, write a Memory Handoff only for knowledge a later session cannot get from the repo, git history or an existing card: a root cause, a decision with its reason, a new operational fact, or a stated preference. Run `brigade memory search` first, update that card where one exists, and write it with `brigade handoff draft`. If nothing qualifies, end with one line, `Nothing durable: `, and write no file. A code or config edit alone is not a reason. The ratchet then closes itself, on a schedule or by hand: ```bash brigade outcome rank --target . # most-proven skills first (and brief_hit when present) brigade outcome reconcile --target . # dry-run; --apply promotes a proven skill / rolls back a regressed one across harnesses ``` `reconcile --apply` installs a proven skill only if it lives in the registry. To make a candidate skill promotable, accept it first (`brigade skills inbox accept `); the ledger id must match the registry slug. A reconcile that cannot install reports `install-skipped: not in registry` and leaves the skill a candidate (it never silently marks it promoted). ## Rules - Follow the workspace mode and any repository-specific check requirements. - If you record a receipt, capture its outcome against the skill or card that did the work. - One verify, one capture. Never batch or invent outcomes - the receipt is the evidence. - Prefer run-receipt capture (`outcome capture --run-receipt latest`) when the worker run is what changed code; verify receipts often have no-op graph deltas. - Export receipts into brigade-evidence when the evidence station is installed so the next run's context is measured, not guessed. ## Common mistakes - Running tests raw leaves no Brigade receipt. Capturing an ad hoc receipt records audit evidence but does not supply a score for `outcome rank`. - Capturing against a skill you did not actually use, which poisons the ranking. - Skipping capture on failures loses audit evidence. Failures can affect artifact ranking only when the receipt meets the scoring and attribution requirements. - Stopping at capture without export: receipts pile up locally and the next `brigade run` has no brigade-evidence evidence brief to attach. - Putting shell operators in the verify command. `brigade work verify run` splits `--command` with `shlex` and runs it with `shell=False` in the `--target` directory, so `cd x && pytest`, pipes, and `&&` do NOT work. Set the working directory with `--target ` and pass a single command, e.g. `--target ./pkg --command "pytest -q tests/test_example.py"`. The receipt export subcommand and context import flag retain their legacy spelling for compatibility through v0.32.