---
id: OBPI-0.0.57-03-foundation-triage-skill
parent: ADR-0.0.57-foundation-adr-nominal-id-triage
item: 3
lane: Heavy
status: Completed
---

# OBPI-0.0.57-03-foundation-triage-skill: Foundation Triage Skill

## ADR Item

- **Source ADR:** `docs/design/adr/foundation/ADR-0.0.57-foundation-adr-nominal-id-triage/ADR-0.0.57-foundation-adr-nominal-id-triage.md`
- **Checklist Item:** #3 - "OBPI-0.0.57-03: **foundation-triage-skill** — Author the gz-foundation-triage on-demand skill: ranks in-flight foundation backlog, cross-references insights + GHIs + invariants, flags port/adapter reclassification candidates, diagnosis only, ephemeral ranked report."

**Status:** Completed

## Objective

**foundation-triage-skill** — Author the gz-foundation-triage on-demand skill: ranks in-flight foundation backlog, cross-references insights + GHIs + invariants, flags port/adapter reclassification candidates, diagnosis only, ephemeral ranked report.

## Lane

**Heavy** - This OBPI changes a command/API/schema/runtime contract surface.

> Heavy is reserved for command/API/schema/runtime-contract changes. Process,
> documentation, and template-only work stays Lite unless it changes one of
> those external surfaces.

## Allowed Paths

<!-- What files/directories are IN SCOPE? Be explicit with paths. -->

- `.gzkit/skills/gz-foundation-triage/SKILL.md` — canonical skill body; mirrors the `ghi-triage` three-step pattern but ranks the in-flight foundation backlog (not the GHI queue)
- `.gzkit/skills/gz-foundation-triage/scripts/triage.py` — bundled deterministic helper (parallels `.gzkit/skills/ghi-triage/scripts/`)
- `src/gzkit/foundation/__init__.py` — new `gzkit.foundation` subpackage
- `src/gzkit/foundation/triage.py` — composer module that gathers in-flight foundations and invokes the rubric module (OBPI-04's surface)
- `src/gzkit/skills/gz-foundation-triage/SKILL.md` — wheel-shipping package copy (regenerated by `gz agent sync control-surfaces`; not hand-edited)
- `tests/test_foundation_triage_skill.py` — REQ-derived tests covering skill discovery, ephemeral-report property, port/adapter reclassification surface
- `docs/design/adr/foundation/ADR-0.0.57-foundation-adr-nominal-id-triage/obpis/OBPI-0.0.57-03-foundation-triage-skill.md` — this brief (evidence updates only)

## Denied Paths

<!-- What files/directories are OUT OF SCOPE? Agents will not touch these. -->

- `.claude/skills/gz-foundation-triage/**`, `.github/skills/gz-foundation-triage/**`, `.agents/skills/gz-foundation-triage/**` — vendor mirrors; written by sync only
- `docs/design/adr/foundation/ADR-0.0.17-*/**`, `docs/design/adr/foundation/ADR-0.0.18-*/**` — doctrine amendments are OBPI-0.0.57-01's surface
- `src/gzkit/commands/plan.py` — allocator change is OBPI-0.0.57-02's surface
- `src/gzkit/foundation/rubric.py` and `src/gzkit/schemas/foundation_triage_rank_input.json` — rubric scorer + structural-only schema are OBPI-0.0.57-04's surface (this OBPI imports them once they exist; in this OBPI's scope, the skill body references them by name without implementing them)
- `docs/user/manpages/**`, `docs/governance/governance_runbook.md`, `docs/user/runbook.md` — runbook/manpage updates are OBPI-0.0.57-05's surface
- Mutations to any foundation ADR file — the skill is diagnosis-only / ephemeral
- New runtime dependencies; CI files; lockfiles

## Requirements (FAIL-CLOSED)

<!-- Constraints that MUST hold. Numbered list. NEVER/ALWAYS language.
     These are the rules agents ground against. If not met, OBPI fails. -->

1. REQUIREMENT: `.gzkit/skills/gz-foundation-triage/SKILL.md` MUST declare `name: gz-foundation-triage`, frontmatter compliant with `SkillFrontmatter`, and a description that names the operator moment ("rank the in-flight foundation backlog by priority").
2. REQUIREMENT: The skill body MUST encode three steps mirroring `ghi-triage` round-3 hardening: Step 1 mechanical pre-pass (gather in-flight foundations + insights/GHI/invariant counts), Step 2 agent cognitive pass over each candidate, Step 3 deterministic rendering of a structural-only ranked report.
3. REQUIREMENT: The output MUST be **diagnosis-only and ephemeral** (ADR § Decision item 2) — the skill MUST NOT mutate any foundation ADR, ledger entry, or registry, and MUST NOT promote, complete, or change status on any artifact.
4. REQUIREMENT: The cognitive-pass procedure MUST include a port/adapter reclassification check that flags candidates where a foundation matches port-shape (mirrors the OBPI-0.0.48-02 cognitive-pass pattern; cross-references the same reclassification language).
5. REQUIREMENT: The skill MUST expose `/gz-foundation-triage` (or operator-supplied equivalent if naming convention conflicts) as the invocation surface; mirror via `gz agent sync control-surfaces` after canonical edit.
6. NEVER: Author the rubric scoring or the structural-only schema in this OBPI — those land in OBPI-04. The skill body REFERENCES them by path/name; OBPI-04 implements them.
7. NEVER: Use `ghi-triage`'s scripts verbatim — the foundation triage helper is its own file under `.gzkit/skills/gz-foundation-triage/scripts/`, even if 90% of the structure is parallel.
8. ALWAYS: Bump `skill-version:` AND `last_reviewed:` in the same edit per `.claude/rules/skill-surface-sync.md` non-negotiable rule #6.

> STOP-on-BLOCKERS: if prerequisites are missing, print a BLOCKERS list and halt.


## Creates these files

<!-- Net-new files this OBPI creates. Path existence is exempt for these entries per GHI #419. -->

- `.gzkit/skills/gz-foundation-triage/SKILL.md` **CREATE**
- `.gzkit/skills/gz-foundation-triage/scripts/triage.py` **CREATE**
- `src/gzkit/foundation/__init__.py` **CREATE**
- `src/gzkit/foundation/triage.py` **CREATE**
- `src/gzkit/skills/gz-foundation-triage/SKILL.md` **CREATE**
- `tests/test_foundation_triage_skill.py` **CREATE**

## Discovery Checklist

<!-- What to read before implementation. Complete this checklist first.
     Order matters: read the structured input (parent ADR § Decision)
     before the unstructured one (allowed paths, prerequisites). -->

**Parent ADR (read first; order pinned — GHI #321):**

- [ ] **Parent ADR § Decision item — quote the line this OBPI implements** verbatim into the brief's Implementation Summary. The Decision item is the contract; everything else hangs off it.
- [ ] Parent ADR § Intent — the why-frame for the Decision read above.
- [ ] Parent ADR file: `docs/design/adr/foundation/ADR-0.0.57-foundation-adr-nominal-id-triage/ADR-0.0.57-foundation-adr-nominal-id-triage.md`

> **STOP:** If you cannot quote the parent ADR § Decision item that this OBPI implements, STOP and re-read. Do not proceed to Allowed Paths, Prerequisites, or implementation until the Decision quote is in hand.

**Governance (read once, cache):**

- [ ] `.github/discovery-index.json` - repo structure
- [ ] `AGENTS.md` or `CLAUDE.md` - agent operating contract

**Context:**

- [ ] Related OBPIs in same ADR

**Prerequisites (check existence, STOP if missing):**

- [ ] Required path exists or is intentionally created in this OBPI: `docs/design/adr/foundation/ADR-0.0.57-foundation-adr-nominal-id-triage/ADR-0.0.57-foundation-adr-nominal-id-triage.md`
- [ ] Required path exists or is intentionally created in this OBPI: `docs/design/adr/foundation/ADR-0.0.57-foundation-adr-nominal-id-triage/**`
- [ ] Parent ADR evidence artifacts referenced by this brief are present

**Existing Code (understand current state):**

- [ ] Existing tests adjacent to the Allowed Paths reviewed before implementation
- [ ] Parent ADR integration points reviewed for local conventions

## Quality Gates

<!-- Which gates apply and how to verify them. -->

### Gate 1: ADR

- [ ] Intent and scope recorded in this OBPI brief
- [ ] Parent ADR checklist item quoted

### Gate 2: TDD (Red-Green-Refactor)

- [ ] Tests derived from brief acceptance criteria, not from implementation
- [ ] Red-Green-Refactor cycle followed per behavior increment
- [ ] Tests pass: `uv run gz test`
- [ ] Validation commands recorded in evidence with real outputs

### Code Quality

- [ ] Lint clean: `uv run gz lint`
- [ ] Type check clean: `uv run gz typecheck`

<!-- Heavy lane only: -->
### Gate 3: Docs (Heavy only)

- [ ] Docs build: `uv run mkdocs build --strict`
- [ ] Relevant docs updated

### Gate 4: BDD (Heavy only)

- [ ] Acceptance scenarios pass: `uv run -m behave features/`

### Gate 5: Human (Heavy only)

- [ ] Human attestation recorded

## Verification

<!-- What commands verify this work? Use real repo commands, then paste the
     outputs into Evidence. These are CONSTRUCTION HOUSEKEEPING (lint, type,
     test, mkdocs) — they prove the codebase is healthy, not what the OBPI
     yielded. The yielded product belongs in the `## Demo` section below. -->

```bash
uv run gz validate --documents
uv run gz validate --surfaces
uv run gz lint
uv run gz typecheck
uv run gz arb step --name unittest -- uv run -m unittest -q tests.test_foundation_triage_skill

# OBPI-specific surface checks
test -f .gzkit/skills/gz-foundation-triage/SKILL.md
uv run gz skill list | grep '^gz-foundation-triage'
uv run gz agent sync control-surfaces

# Mirror parity
diff .gzkit/skills/gz-foundation-triage/SKILL.md src/gzkit/skills/gz-foundation-triage/SKILL.md
diff .gzkit/skills/gz-foundation-triage/SKILL.md .claude/skills/gz-foundation-triage/SKILL.md

# Ephemeral-output invariant — no governance mutation after a triage run
git status --porcelain docs/design/adr/foundation/ .gzkit/ledger.jsonl
# Expected: empty (no foundation file or ledger event mutated)
```

## Demo

<!-- THE YIELDED PRODUCT, not housekeeping. Concrete, runnable invocations
     that demonstrate the capability this OBPI delivers — e.g. an actual
     diagnosis run against a real file, the `--json` form, an auto-chain
     trigger. The closeout ceremony walkthrough harvests this section
     (parser-validated; unregistered verbs are dropped). Prefer real paths
     and arguments over `<placeholder>` syntax. `--help` is not a demo. -->

```bash
# Invoke the skill
# /gz-foundation-triage

# Verify the skill is discoverable
uv run gz skill list | grep '^gz-foundation-triage'

# Show byte-equivalent vendor mirrors
md5 .gzkit/skills/gz-foundation-triage/SKILL.md .claude/skills/gz-foundation-triage/SKILL.md .github/skills/gz-foundation-triage/SKILL.md
```

## Acceptance Criteria

<!--
Specific, testable criteria for completion.
Each checkbox MUST carry a deterministic REQ ID:
REQ-<semver>-<obpi_item>-<criterion_index>
-->

- [ ] REQ-0.0.57-03-01: Given `.gzkit/skills/gz-foundation-triage/SKILL.md` exists, when `gz validate --surfaces` runs, then frontmatter validates against `SkillFrontmatter` (exit 0) and the description names the operator moment.
- [ ] REQ-0.0.57-03-02: Given the skill body, when read, then it contains Step 1 (mechanical pre-pass), Step 2 (cognitive pass), Step 3 (deterministic rendering) headings in that order.
- [ ] REQ-0.0.57-03-03: Given the skill is registered, when `uv run gz skill list` runs, then `gz-foundation-triage` appears in the listing.
- [ ] REQ-0.0.57-03-04: Given a foundation-triage run is invoked against the live repo, when the run completes, then `git status --porcelain docs/design/adr/foundation/ .gzkit/ledger.jsonl` is empty (ephemeral / diagnosis-only invariant).
- [ ] REQ-0.0.57-03-05: Given the cognitive-pass procedure, when read, then it includes a port/adapter reclassification check identical in shape to the OBPI-0.0.48-02 cognitive pass (cross-reference exact wording or quote it).
- [ ] REQ-0.0.57-03-06: Given `uv run gz agent sync control-surfaces` runs after a canonical edit, when sync completes, then `src/gzkit/skills/gz-foundation-triage/SKILL.md`, `.claude/skills/gz-foundation-triage/SKILL.md`, `.github/skills/gz-foundation-triage/SKILL.md`, and `.agents/skills/gz-foundation-triage/SKILL.md` are byte-equivalent to canonical.

## Completion Checklist

<!-- Verify all gates before marking OBPI accepted. -->

- [ ] **Gate 1 (ADR):** Intent recorded in brief
- [ ] **Gate 2 (TDD):** RGR cycle followed, tests derived from brief, coverage maintained
- [ ] **Code Quality:** Lint, format, type checks clean
- [ ] **Value Narrative:** Problem-before vs capability-now is documented
- [ ] **Key Proof:** One concrete usage example is included
- [ ] **OBPI Acceptance:** Evidence recorded below

> For ceremony steps and lane-inheritance attestation rules, see `AGENTS.md` section `OBPI Acceptance Protocol`.

## Evidence

<!-- Record observations during/after implementation.
     Command outputs, file:line references, dates. -->

### Gate 1 (ADR)

- [ ] Intent and scope recorded

### Gate 2 (TDD — Red-Green-Refactor)

```text
# Paste test output here
```

### Code Quality

```text
# Paste lint/format/type check output here
```

### Gate 3 (Docs)

```text
# Paste docs-build output here when Gate 3 applies
```

### Gate 4 (BDD)

```text
# Paste behave output here when Gate 4 applies
```

### Gate 5 (Human)

```text
# Record attestation text here when required by parent lane
```

### Value Narrative

<!-- What problem existed before this OBPI, and what capability exists now? -->

### Key Proof


```bash
uv run python .gzkit/skills/gz-foundation-triage/scripts/triage.py --format json
git status --porcelain docs/design/adr/foundation/ .gzkit/ledger.jsonl
```

The script emits a JSON list of in-flight foundation ADRs with signal counts (insight_count, ghi_count, invariant_mentions, signal_total) for each. The second command shows no NEW changes to foundation ADR files or the ledger after the triage runs — the ephemeral / diagnosis-only invariant per REQ-0.0.57-03-04. Verified by:

- arb-step-unittest-97735eb36013473a994ddfca9fb2e73b (OBPI-scoped: 13/13 pass)
- arb-step-unittest-a9215e3d4b5c4c659d6b3a3cb325b92c (full sweep: 5463/5463 pass)
- arb-ruff-80cd86f4147d475a8ea55627c1b151a7 (clean)
- arb-step-typecheck-2ddca96f955f452a859b5b69c721828a (clean)
- arb-step-mkdocs-d2ed496ca041454ebb34cc0792d0c1f5 (mkdocs --strict clean — Gate 3 Heavy lane)
- Mirror parity confirmed by `diff` across .gzkit/skills, src/gzkit/skills, .claude/skills, .github/skills, .agents/skills (all 4 byte-equal).
- Skill discoverability: `uv run gz skill list | grep '^gz-foundation-triage'` shows the slug in the active catalog.

### Implementation Summary


- Files created: .gzkit/skills/gz-foundation-triage/SKILL.md (canonical skill body, three-step structure, diagnosis-only invariants); .gzkit/skills/gz-foundation-triage/scripts/triage.py (stdlib helper, --format json + --format rank); src/gzkit/foundation/__init__.py + src/gzkit/foundation/triage.py (composer subpackage); tests/test_foundation_triage_skill.py (13 REQ-derived tests); docs/user/skills/gz-foundation-triage.md (operator manpage — coupled surface per AGENTS.md § 1a, required by tests.test_skill_manpage_coverage); vendor mirrors at src/gzkit/skills/, .claude/skills/, .github/skills/, .agents/skills/ regenerated by gz agent sync control-surfaces.
- Files modified: docs/user/skills/index.md (one row added linking the new manpage); data/behave_coverage_waivers.json (waiver entry + new rationale for skill-bundle-bdd-deferred-to-obpi-05).
- Tests added: 13 (TestREQ01–06 + TestFoundationSubpackage); 6/6 REQs covered per `uv run gz covers OBPI-0.0.57-03-foundation-triage-skill --json` (100%).
- BDD: waived under data/behave_coverage_waivers.json key adr-0.0.57-03-skill-bundle-bdd-deferred-to-obpi-05 — no CLI verb in this OBPI; runnable-flow scenarios reserved for OBPI-05 (docs-runbook-fixtures).
- Date completed: 2026-05-23
- Attestation status: attested (operator verbatim "attest completed" on Stage 4 evidence packet).
<!-- gz-validate-skip: brief-cross-references -->
- Defects noted in flight (NOT introduced by this OBPI): `gz validate --documents` flags ADR-0.37.0-govzero-methodology-doc-absorption missing `## Decomposition Scorecard`; verified pre-existing via `git stash`. Will route via /ghi-author after closeout. Also: hook fix `fix(plan-audit-gate): re-check receipt after self-audit regardless of exit code` (commit a186718e) shipped as a separate in-flight direct fix to unblock this pipeline's ExitPlanMode.

## Tracked Defects

<!-- Record GitHub defect linkage when defects are discovered during this OBPI.
     Use one bullet per issue so status surfaces can preserve traceability. -->

_No defects tracked._

## Human Attestation

- Attestor: `Jeffry Babb`
- Attestation: attest completed — operator-verbatim attestation on Stage 4 evidence packet for OBPI-0.0.57-03 (foundation-triage-skill); receipts: arb-ruff-80cd86f4147d475a8ea55627c1b151a7, arb-step-typecheck-2ddca96f955f452a859b5b69c721828a, arb-step-unittest-a9215e3d4b5c4c659d6b3a3cb325b92c (full 5463/5463), arb-step-unittest-97735eb36013473a994ddfca9fb2e73b (scoped 13/13), arb-step-mkdocs-d2ed496ca041454ebb34cc0792d0c1f5; REQ coverage 6/6 via gz covers; vendor mirrors byte-equal across all 4 surfaces; ephemeral invariant verified by before==after diff in TestREQ04.
- Date: 2026-05-23

---

**Date Completed:** 2026-05-23

**Evidence Hash:** -
