# triage

Adopt this skill: https://proskills.md/skills/other/brettreifs-decision-kit-github-skills-triage

Page: https://proskills.md/skills/other/brettreifs-decision-kit-github-skills-triage
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: .github/skills/triage/SKILL.md
size: 6558
upstream: https://github.com/brettreifs/decision-kit/blob/main/.github/skills/triage/SKILL.md

````text
---
name: triage
description: Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
disable-model-invocation: true
---

# Triage

Move issues on the project issue tracker through a small state machine of triage roles.

If this repo treats external pull requests as a request surface (see the issue-tracker config), triage covers them too: **a PR is an issue with attached code**, using the same roles, same states, and same machine, with a few deltas marked "for a PR" below. Resolve a bare `#42` to an issue or PR per the tracker config.

Every comment or issue posted to the issue tracker during triage **must** start with this disclaimer:

```
> *This was generated by AI during triage.*
```

## Reference docs

- [AGENT-BRIEF.md](AGENT-BRIEF.md): how to write durable agent briefs
- [OUT-OF-SCOPE.md](OUT-OF-SCOPE.md): how the `.out-of-scope/` knowledge base works

## Roles

Two **category** roles:

- `bug`: something is broken
- `enhancement`: new feature or improvement

Five **state** roles:

- `needs-triage`: maintainer needs to evaluate
- `needs-info`: waiting on reporter for more information
- `ready-for-agent`: fully specified, ready for an AFK agent
- `ready-for-human`: needs human implementation
- `wontfix`: will not be actioned

For a PR, the same states read against the attached code: `ready-for-agent` means a brief is attached and an agent should take the next step on the diff; `ready-for-human` means it's ready for a human to merge.

Every triaged issue should carry exactly one category role and one state role. If state roles conflict, flag it and ask the maintainer before doing anything else.

These are canonical role names. The actual label strings used in the issue tracker may differ. The mapping should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.

State transitions: an unlabeled issue normally goes to `needs-triage` first; from there it moves to `needs-info`, `ready-for-agent`, `ready-for-human`, or `wontfix`. `needs-info` returns to `needs-triage` once the reporter replies. The maintainer can override at any time; flag transitions that look unusual and ask before proceeding.

## Invocation

The maintainer invokes `/triage` and describes what they want in natural language. Interpret the request and act. Examples:

- "Show me anything that needs my attention"
- "Let's look at #42" (issue or PR)
- "Move #42 to ready-for-agent"
- "What's ready for agents to pick up?"

## Show what needs attention

Query the issue tracker and present three buckets, oldest first:

1. **Unlabeled**: never triaged.
2. **`needs-triage`**: evaluation in progress.
3. **`needs-info` with reporter activity since the last triage notes**: needs re-evaluation.

When PRs are in scope, include external PRs in these buckets and tag each line `[PR]` or `[issue]`. Discovery surfaces only *external* PRs (the tracker config defines who counts as external), so a collaborator's in-flight PR is not triage work. This filter is discovery-only; an explicitly named PR is always triaged regardless of author.

Show counts and a one-line summary per item. Let the maintainer pick.

## Triage a specific issue or PR

1. **Gather context.** Read the full issue or PR (body, comments, labels, author, dates; for a PR, the diff too). Parse any prior triage notes so you don't re-ask resolved questions. Explore the codebase using the project's domain glossary, respecting ADRs in the area. Run two checks against the codebase: (a) **redundancy**: search for an existing implementation of the requested behavior by domain concept (not just the request's wording), and report where you looked. If found, it's an already-implemented `wontfix` (step 5). (b) **prior rejection**: read `.out-of-scope/*.md` and surface any that resembles this request.

2. **Recommend.** Tell the maintainer your category and state recommendation with reasoning, plus a brief codebase summary relevant to the request (including whether it's already implemented). Wait for direction.

3. **Verify the claim.** Before any grilling, check that the claim holds up. For a bug, reproduce it from the reporter's steps. For a PR, confirm the diff does what it claims: check it out, run the relevant tests or commands. Report what happened: confirmed (with code path), failed, or insufficient detail (a strong `needs-info` signal). A confirmed verification makes a much stronger agent brief.

4. **Grill (if needed).** If the request needs fleshing out, call the Skill tool twice, for "grilling" and "domain-modeling", and grill it into shape a round of questions at a time, sharpening domain terms and updating `GLOSSARY.md`/ADRs inline as decisions land.

5. **Apply the outcome:**
   - `ready-for-agent`: post an agent brief comment ([AGENT-BRIEF.md](AGENT-BRIEF.md)).
   - `ready-for-human`: same structure as an agent brief, but note why it can't be delegated (judgment calls, external access, design decisions, manual testing).
   - `needs-info`: post triage notes (template below).
   - For `wontfix`, close the issue, with the comment depending on *why*:
     - **Already implemented**: the change already exists in the codebase. Point to where it lives; do **not** write to `.out-of-scope/` (that KB is for *rejected* requests, not built ones).
     - **Rejected (bug)**: give a polite explanation, then close.
     - **Rejected (enhancement)**: write to `.out-of-scope/`, link to it from a comment, then close ([OUT-OF-SCOPE.md](OUT-OF-SCOPE.md)).
   - `needs-triage`: apply the role. Optional comment if there's partial progress.

## Quick state override

If the maintainer says "move #42 to ready-for-agent", trust them and apply the role directly. Confirm what you're about to do (role changes, comment, close), then act. Skip grilling. If moving to `ready-for-agent` without a grilling session, ask whether they want to write an agent brief.

## Needs-info template

```markdown
## Triage Notes

**What we've established so far:**

- point 1
- point 2

**What we still need from you (@reporter):**

- question 1
- question 2
```

Capture everything resolved during grilling under "established so far" so the work isn't lost. Questions must be specific and actionable, not "please provide more info".

## Resuming a previous session

If prior triage notes exist on the issue or PR, read them, check whether the reporter has answered any outstanding questions, and present an updated picture before continuing. Don't re-ask resolved questions.
````

## File: README.md
upstream: https://github.com/brettreifs/decision-kit/blob/main/README.md

````text
# Decision Kit

Decision Kit is a public GitHub Copilot Canvas demonstration for making fast, inspectable decisions from real context. TypeSafe AI's Jev model chooses a typed branch and exposes its probabilities. A separate chat model explains that bounded result and proposes next steps without changing it.

```mermaid
flowchart LR
    A[Scenario + edited context] --> B[Loopback Canvas server]
    B --> C[OpenRouter Decisions API]
    C -->|choice + score + noul| D[Confidence gate]
    D -->|above threshold| E[Recommended action]
    D -->|below threshold or review signal| F[Human review]
    D --> G[OpenRouter chat completion]
    G --> H[Bounded rationale + next steps]
    E --> I[Context-selected Canvas UI]
    F --> I
    H --> I
```

## What the workbench demonstrates

The Canvas offers incident response, feature prioritization, and customer escalation presets. You can select a scenario, edit its context, and watch two explicit stages progress through Server-Sent Events.

Jev is not a chatbot. One request asks three independent questions using TypeSafe's `choice`, `score`, and `noul` primitives. The result includes the selected branch, option probabilities, confidence, urgency score, and latency. Decision Kit applies a `0.72` confidence threshold and an explicit human-review signal. Below the threshold, it withholds automated certainty and routes the case to a human.

The LLM receives the source context and Jev's bounded result only after that gate is computed. It writes a concise rationale and next-step plan, but it cannot invisibly replace the branch, probabilities, score, or review requirement. The interface labels Jev output as authoritative and the LLM narrative as explanatory.

The UI selects from a small vocabulary instead of rendering every possible panel: urgency signal, option distribution, confidence gate, recommended action, human review, and audit trace.

## Setup

Requirements:

- GitHub Copilot CLI with project extension Canvas support
- Node.js 20 or newer for local tests
- An OpenRouter account for live requests

Environment variables:

| Name | Purpose | Default |
|---|---|---|
| `OPENROUTER_API_KEY` | Authorizes server-side OpenRouter calls. Requested by the extension and read only from `process.env`. | None |
| `OPENROUTER_JEV_MODEL` | Overrides the typed decision model. | `~typesafe/jev-latest` |
| `OPENROUTER_LLM_MODEL` | Overrides the explanatory chat model. | `openai/gpt-4.1-mini` |

Do not put credentials in the repository. The extension requests `OPENROUTER_API_KEY` through the Copilot SDK's `requestedEnvironmentVariables` flow. If the key is absent or access is denied, the extension retries without the secret and remains usable in clearly labeled deterministic demo mode. A failed live request remains an explicit error; it does not fall back to a fixture.

## Open and use the Canvas

The project extension is discovered from `.github/extensions/decision-kit/extension.mjs`.

1. Open this repository in a Copilot project session.
2. Reload extensions after changing extension files.
3. Ask Copilot to open the `decision-kit` Canvas, or use the Canvas catalog.
4. Pick a preset, edit the context, and select **Run decision**.

Host integrations can invoke `run_preset` and `reset_state`. Both actions validate inputs with JSON Schema. The renderer communicates only with its per-instance HTTP server on `127.0.0.1` using an ephemeral port.

## Passive delivery nudge and evaluations

The first delivery slice is a **possible polish-loop nudge**, independent of the Canvas and
OpenRouter. It requires no self-report, feedback form, model call, or API key. It does not
change Jev decisions or grant execution permissions.

The repository hook in `.github/hooks/decision-kit.json` uses Copilot's documented
[`postToolUse` event and `additionalContext` output](https://docs.github.com/en/copilot/reference/hooks-reference).
On a host that supports that output, the reminder goes to the agent after a successful tool
call, not to a user approval dialog. Start a new host session after installing the hook.
Node.js 20+ and Git must be available to the hook process.

### What triggers it

Three narrow spacing or corner-radius replacements in the same file, within the last ten
successful tool observations and fifteen minutes, produce at most one reminder per session.
The agent is asked to check the **existing agreed outcome**, preserve necessary usability
and accessibility work, and verify the current slice before the next authorized commit or PR.
The hook never declares work complete, changes the contract, commits, opens a PR, or deploys.

The classifier supports `edit` and `str_replace_editor` replacement arguments (`path` or
`file_path`, `old_str`/`new_str` or `oldString`/`newString`, including JSON-encoded arguments).
It recognizes only whole snippets of spacing or radius declarations in CSS, SCSS, HTML,
JavaScript, and JSX/TSX files. Contrast, focus, mixed behavior changes, failed edits, and
unsupported patches do not qualify. Larger replacements and `apply_patch` are deliberately
not inferred to be cosmetic. Spacing can still be important: the nudge is advisory, not a
finding of wasted work. These thresholds are initial heuristics, not calibrated facts.

Set `DECISION_KIT_DELIVERY_MODE` in the host environment:

| Mode | Behavior |
|---|---|
| `nudge` (default) | Observe and output at most one advisory reminder per session. |
| `observe` | Record candidate signals without injecting a reminder. |
| `off` | Do not collect or output anything. |

You can also disable this hook file with its top-level `disableAllHooks` setting.
Missing or incompatible host events mean reduced coverage, not proof that no drift occurred.
The implementation is tested with documented payloads; live host delivery is not verified by
the unit tests. There is no automatic cross-host installation or device synchronization.

### Local observations and privacy

State lives in `decision-kit/` inside the current worktree's Git metadata directory, outside
tracked files. It contains hashed session IDs and relative file identifiers, event timestamps,
bounded recent event categories, counts, and hook processing time. Hashes are identifiers,
not anonymization. Prompts, source text, tool results, credentials, and raw file paths are
not persisted or sent over the network.

State is isolated by worktree and session. Atomic writes and a per-session lock prevent
duplicate nudges from overlapping calls; a contended lock skips the observation rather than
waiting. Unsupported, stale, or same-timestamp duplicate events are conservatively skipped.
A killed process can leave a lock; after stopping the host, remove the matching `.lock`
directory to resume observation. Corrupt state is not silently reset and re-nudged.

There is no automatic retention cleanup in this slice. After stopping the host, deleting
`decision-kit/` from the directory reported by `git rev-parse --absolute-git-dir` clears these
observations and reminder suppression. Do not delete the Git metadata directory itself.
Cloud-agent sandbox data is ephemeral and is not uploaded.

### Run the targeted evaluations

```text
npm run eval:delivery
npm run delivery:report
```

The eval suite replays synthetic positive and negative cases and tests the outcome evaluator's
guardrails. It is a regression baseline, **not evidence of faster or better real delivery**.
The report summarizes local observations and nudge outputs. It leaves cost, verified delivery
time, quality, and human attention as `null`: these hooks do not provide those facts.
Nudge output is not proof of host receipt, agent compliance, or human attention saved.
Reported hook time excludes process startup and final persistence.

`delivery-evaluation.mjs` exports `evaluateDeliveryOutcomes({ policy, slices })` for future
passive outcome adapters. No user data-entry step or live experiment is installed.
Its input contract is:

| Input | Required evidence |
|---|---|
| Policy | `id
````
