# Incident To Regression

> Convert incident artifacts into deterministic regression fixtures and CI-ready outputs. Use when users ask to reproduce a failure, build repeatable graders, or emit junit evidence.

- Skill: `clyra-ai/incident-to-regression` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add clyra-ai/incident-to-regression`
- Raw SKILL.md: https://api.skillmd.com/api/skills/clyra-ai/incident-to-regression/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Clyra-AI (https://skillmd.com/u/clyra-ai)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/clyra-ai/incident-to-regression

---

# Incident To Regression

Use this skill to transform an observed incident into deterministic regression checks.

## Gait Context

Gait is the offline-first policy-as-code runtime for AI agent tool calls. It enforces tool-boundary policy, emits signed and verifiable evidence artifacts, and supports deterministic regressions.

Use this skill when:
- incident triage needs repeatable regression fixtures
- CI gate failures need deterministic reproduction
- evidence outputs must be generated from Gait artifacts

Do not use this skill when:
- Gait CLI is unavailable in the environment
- no Gait run/pack artifact or run identifier is available as input

## Required Inputs

- `run_source`: run id, runpack path, or equivalent source accepted by `gait capture` / `gait regress add` / `gait regress init`.
- `workdir`: writable working directory where fixtures and outputs will be created.

## Workflow

1. Resolve `run_source` before changing directories:
   - keep identifiers unchanged (for example run ids)
   - if `run_source` is a relative file path, normalize to absolute path
   - `run_source_ref="$(python3 -c 'import os,sys; v=sys.argv[1]; print(os.path.abspath(v) if os.path.exists(v) else v)' <run_source>)"`
2. Enter the declared working directory before generating artifacts:
   - `mkdir -p <workdir> && cd <workdir>`
3. Create deterministic fixture from the incident source:
   - explicit path: `gait capture --from <run_source_ref> --json`
   - then `gait regress add --from ./gait-out/capture.json --json`
   - legacy fallback: `gait regress init --from <run_source_ref> --json`
4. Parse fields from the fixture-creation output and record them:
   - `ok`, `run_id`, `fixture_name`, `fixture_dir`, `config_path`, `next_commands`
5. Execute regression graders:
   - `gait regress run --json`
6. If CI evidence is needed, rerun with JUnit output:
   - `gait regress run --json --junit <junit_path>`
7. Return a concise summary with:
   - source identifier
   - fixture directory and config path
   - status and failed grader count
   - evidence output paths

## Safety And Portability Rules

- Use CLI outputs only; do not infer grader results from config text.
- Treat non-zero regress exit codes as actionable outcomes, not warnings.
- Do not assume repository-specific fixture paths.
- Keep paths relative to the active workspace unless the user explicitly asks for absolute paths.

## Usage Example

```bash
run_source_ref="$(python3 -c 'import os,sys; v=sys.argv[1]; print(os.path.abspath(v) if os.path.exists(v) else v)' run_demo)"
mkdir -p ./regress-workdir && cd ./regress-workdir
gait demo --json
gait capture --from "${run_source_ref}" --json
gait regress add --from ./gait-out/capture.json --json
mkdir -p ./artifacts
gait regress run --json --junit ./artifacts/junit.xml
```

Expected result:
- fixture creation output includes `ok=true` and a `fixture_dir`
- run output includes stable `status` and grader failure details
- JUnit file exists at `./artifacts/junit.xml`

## Validation Example

```bash
mkdir -p ./regress-workdir && cd ./regress-workdir
gait demo --json
gait capture --from run_demo --json
gait regress add --from ./gait-out/capture.json --json
mkdir -p ./artifacts
gait regress run --json > ./artifacts/regress_result.json
python3 - <<'PY'
import json
from pathlib import Path
p = json.loads(Path('./artifacts/regress_result.json').read_text(encoding='utf-8'))
assert p.get('status') in {'pass', 'fail'}
print('validated status:', p.get('status'))
PY
```

Expected result:
- script prints `validated status: pass` or `validated status: fail`

