# Orion Workflow — Pipeline Spec
> ForgeAI Studio · Owner: Anthony Kautz · Orchestrator: orion@2.2.0

---

## pipeline sequence

```
Persona Pack → System Prompt → Red-Team → Patch → Re-test → Eval Pack → Judge Prompt → Production
```

---

## stage definitions

| # | Stage | Deliverable | Gate condition |
|---|---|---|---|
| 1 | **Persona Pack** | `persona@x.0.0.md` with bias facet result | Bias facet: PASS |
| 2 | **System Prompt** | Versioned system prompt with tag block | Schema validation: PASS |
| 3 | **Red-Team** | Red-team report: findings, exploits, fixes | All P0 issues identified |
| 4 | **Patch** | Updated system prompt `@x.y.z` | Each issue assigned a fix |
| 5 | **Re-test** | Re-test results per issue | All issues: FIXED or ACCEPTED-RISK |
| 6 | **Eval Pack** | `eval-pack@x.y.z` — cases, axes, hard gates | Pack covers all behavioral dimensions |
| 7 | **Judge Prompt** | `judge-persona@x.y.z` — calibrated | Golden-set agreement ≥85%; consistency prompt-enforced (no temp param on this model) |
| 8 | **Production** | Promoted asset with CI/CD gate | All hard gates PASS; Judge agreement ≥85% |

---

## mandatory tag block

Every artifact must carry:

```
`name@version` | eval-status | temp | max_tokens | red-team state | bias facet | eval-pack state
```

**eval-status values:** draft · tested · gated · production · deprecated
**red-team state:** pending · N/N fixed · waived (reason)
**bias facet:** PASS · PASS-with-notes · FAIL (blocked)
**eval-pack state:** none · draft · active · retired

---

## current asset states

| Asset | Version | Stage | Status |
|---|---|---|---|
| orion | 2.2.0 | Production | ✅ Active |
| sage | 1.0.0 | Persona Pack | Draft — 41/42 eval PASS |
| maura | 1.x.x | Retired | ❌ Superseded by morgan (an earlier, never-completed attempt) |

---

## hard gate policy

Hard gates are non-negotiable. A FAIL on any hard-gated axis:

1. Halts promotion immediately
2. Triggers a repair loop (mandatory, not best-effort)
3. Requires re-test and re-judge before promotion resumes
4. Is logged in the Failure Registry with issue ID and fix version

Currently gated axes: **AX-05, AX-06** (sage)

---

## ci/cd integration

```
Judge run → JSON verdicts → Gate check:
  - All hard gates PASS?          → continue
  - Any hard gate FAIL?           → halt, raise alert, block merge
  - Golden-set agreement ≥85%?    → promote
  - Agreement <85%?               → repair loop, re-calibrate
```

The hard-gate half of this flow is real, not aspirational: `pipeline.html`'s Stage 08 enforces exactly this today — locked until a real Judge verdict exists, blocking outright on any hard-gate FAIL with no override. Stage 08 also live-generates a CI/CD config implementing this same gate-check flow for the persona's own downstream deployment repo (see `docs/tech_stack.md`'s Evaluation Infrastructure section, and `context/features/archive/cicd-eval-gate-feature.md`).

---

## repair loop protocol

1. Judge emits `overall_verdict: "REPAIR"` with `repair_flags[]`
2. Flags routed to persona maintainer
3. Patch applied → new version tagged
4. Judge re-run on affected cases
5. If PASS → resume promotion
6. If FAIL → escalate to human reviewer

---

*Pipeline spec current as of orion@2.2.0. Update on each major pipeline change.*
