---
name: engine-check
description: Comprehensive engine verification — Recoil (53 checks, 8 categories) + Pipeline (30 checks, 6 categories) + systematic semantic audit.
allowed-tools: Read, Write, Bash, Glob, Grep, Task
argument-hint: "[--quick | --full | --fix | --section gui|visual|dead|docsync|security|chain|gates|constants|syntax|logic] [--recoil-only | --pipeline-only]"
---

# /engine-check — Engine & Workflow Verification

Systematic, deterministic audit of both engines. Designed to produce **consistent results across runs** by using modular check systems and numbered checklist protocols.

## Architecture

Two check systems, same pattern:

```
recoil/tools/
  engine_check.py              ← Recoil CLI (53 checks)
  engine_checks/               ← 8 modules (structural → security)

recoil/pipeline/tools/
  recoil_check.py              ← Pipeline CLI (30 checks)
  recoil_checks/               ← 6 modules (api_config → cross_engine)
```

## Usage

```
/engine-check                        # Full audit — both engines
/engine-check --quick                # Quick checks only (both engines)
/engine-check --fix                  # Recoil checks + auto-fixes
/engine-check --recoil-only          # Recoil engine only
/engine-check --pipeline-only        # Pipeline engine only
/engine-check --section gui          # Recoil GUI checks only
/engine-check --section api          # Pipeline API checks only
```

## Check Categories

### Recoil Engine (53 checks)

| Category | Checks | Section Key | What It Covers |
|----------|--------|-------------|----------------|
| Structural | 1-6 | chain, gates, constants | File existence, wiring, sync |
| Semantic | 7-18 | syntax | Stale values, counting, hooks, templates |
| Deep Logic | 19-23 | logic | JSON handling, thresholds, state, runtime |
| GUI Integrity | 24-30 | gui | Routes, onclick, modules, launch, server |
| Visual Pipeline | 31-38 | visual | Config loader, pricing, LoRA, visual bible |
| Dead Code | 39-42 | dead | Unreferenced tools, orphaned editors |
| Documentation | 43-49 | docsync | CLAUDE.md tables, folder structure, costs |
| Security | 50-53 | security | API keys, env vars, path traversal |

### Pipeline Engine (30 checks)

| Category | Checks | Section Key | What It Covers |
|----------|--------|-------------|----------------|
| API & Config | S1-S4 | api | model_profiles, pipeline_config, env vars, model refs |
| Execution Store | S5-S8 | store | DB schema, orphaned shots, takes JSON, WAL mode |
| Review Server | S9-S14 | server | Routes, endpoints, static paths, HTML, port, CORS |
| Console Frontend | S15-S20 | frontend | Tab JS, console app, onclick, morphdom, XSS |
| Pipeline | S21-S26 | pipeline | Sub-pipelines, costs, templates, schema, manifests |
| Cross-Engine | S27-S30 | cross | projects_root, storyboard↔manifest, bridge, recoil |

## Execution

When this skill is invoked:

### 1. Run Recoil Engine Check (unless --pipeline-only)

```bash
python3 ~/CLAUDE_PROJECTS/recoil/tools/engine_check.py ~/CLAUDE_PROJECTS/recoil [flags]
```

### 2. Run Pipeline Engine Check (unless --recoil-only)

```bash
python3 ~/CLAUDE_PROJECTS/recoil/pipeline/tools/recoil_check.py ~/CLAUDE_PROJECTS/recoil/pipeline [flags]
```

### 3. Synthesize Combined Report

```
=================================================================
COMBINED ENGINE CHECK REPORT
=================================================================

RECOIL:   PASS — 53 checks (210 pass, 0 fail, 15 warn)
PIPELINE: PASS — 30 checks (85 pass, 0 fail, 5 warn)

OVERALL:  PASS
=================================================================
```

If `--quick`: output mechanical reports and STOP.

For full audit, also run semantic audit (6 parallel agents) following the agent protocol in `agents/engine_check_agent.md`.

### Fix Mode (--fix)

Recoil only. Runs all checks, applies safe auto-fixes, re-runs to verify.

## Related

- **Recoil agent protocol:** `agents/engine_check_agent.md`
- **Recoil check script:** `tools/engine_check.py`
- **Recoil check modules:** `tools/engine_checks/`
- **Pipeline check script:** `~/CLAUDE_PROJECTS/recoil/pipeline/tools/recoil_check.py`
- **Pipeline check modules:** `~/CLAUDE_PROJECTS/recoil/pipeline/tools/recoil_checks/`
- **Constants (source of truth):** `CONSTANTS.md`
