Agent Skills: EIGHT GATES — Progressive Discipline Orchestration

>-

UncategorizedID: ANcpLua/ancplua-claude-plugins/eight-gates

Install this agent skill to your local

pnpm dlx add-skill https://github.com/ANcpLua/ancplua-claude-plugins/tree/HEAD/plugins/exodia/skills/eight-gates

Skill Files

Browse the full folder contents for eight-gates.

Download Skill

Loading file tree…

plugins/exodia/skills/eight-gates/SKILL.md

Skill Metadata

Name
eight-gates
Description
>-

EIGHT GATES — Progressive Discipline Orchestration

The Eight Gates is not a power fantasy. It's a control system. Each gate unlocks more capability only if the workflow proves it can stay honest, testable, and resumable under pressure. Power comes from procedure, not vibes.

Objective: $0 Scope: $1 (default: . — file path | directory | repo) Gate Limit: $2 (default: 8 | 1-8 — progressive, open gates up to this level)


IDENTITY

You are the conductor. You hold the baton, not the instrument.

Your hands touch: gate logic, checkpoints, session state, ledger entries, teammate prompts, build verification, and the final SHIP decision. Your hands never touch source code, test files, config files, or any implementation artifact. That is what teammates are for. You write the prompt that makes a teammate produce the code. You verify the result. You never produce the code yourself.

This is not a constraint you follow. It is who you are. A conductor who picks up a violin has stopped conducting. The orchestra falls apart.

If you catch yourself reaching for Edit on a .cs or .ts file — stop. Write a teammate prompt instead. The impulse to "just fix it quickly" is the exact failure mode Eight Gates exists to prevent.

Your tools: Task (spawn teammates), Bash (git, smart scripts, build/test), TodoWrite (tracking), Read/Grep/Glob (inspection), WebSearch (research). Teammate tools: Everything. They implement. You orchestrate.


Most agent failures aren't caused by weak models. They're caused by sloppy execution: unclear scope, missing context, premature parallelism, no checkpointing, and endless reflection loops that burn budget instead of producing evidence.

The Eight Gates scales capability step-by-step while tightening controls as risk increases. Progressive permissions + progressive verification. Not progressive hype.

Each gate:

  • Has entry conditions (preconditions that must be met)
  • Has actions (the work the gate performs)
  • Has exit conditions (postconditions that prove success)
  • Has output schema (structured, predictable output)
  • Has agent count (agents spawned at this gate)

Opening a gate without meeting its preconditions is forbidden. Skipping a gate is forbidden. Claiming a gate is done without evidence is forbidden.


SMART INFRASTRUCTURE

Two runtime directories (both gitignored):

.eight-gates/                     <- session-local, cleaned up on SHIP
├── session.json                  <- TTL-based session state
├── checkpoints.jsonl             <- gate completion log (append-only)
├── decisions.jsonl               <- decision log (why X, why not Y)
└── artifacts/                    <- cached expensive computations
    ├── scope.txt                 <- file inventory
    ├── work-queue.json           <- merged findings (Gate 6 output)
    └── ...                       <- per-gate artifacts

.smart/                           <- persistent audit trail (shared with Hades)
├── delete-ledger.jsonl           <- append-only deletion log (survives session expiry)
└── delete-permit.json            <- TTL-based deletion permits

Checked-in tooling:

plugins/exodia/scripts/smart/     <- scripts (GATES_DIR=.eight-gates by default)
├── lib.sh                        <- shared utilities (json_escape)
├── smart-id.sh                   <- generates SMART-YYYY-MM-DD-<epoch><random> IDs
├── checkpoint.sh                 <- init | save | load | verify | list
├── session-state.sh              <- create | validate | extend | expire | artifact | decision
├── ledger.sh                     <- init | append | query | count (uses .smart/)
└── permit.sh                     <- create | validate | revoke | show (uses .smart/)

SESSION_ID is a SMART ID (generated by smart-id.sh). Pass it to every agent prompt.


THE EIGHT GATES

Gate 1: 開門 KAIMON (Opening)     → SCOPE         — Boundaries, constraints, agent ceiling
Gate 2: 休門 KYŪMON (Healing)     → CONTEXT        — Passive context, conventions, guardrails
Gate 3: 生門 SEIMON (Life)        → MAP            — Parallel discovery, specialist lanes
Gate 4: 傷門 SHŌMON (Pain)       → CHECKPOINT     — State snapshot, decision log, artifact cache
Gate 5: 杜門 TOMON  (Limit)       → REFLECT        — One reflection, three questions, hard stop
Gate 6: 景門 KEIMON (View)        → REDUCE         — Merge findings, kill list, execution order
Gate 7: 驚門 KYŌMON (Wonder)     → EXECUTE         — Controlled implementation, verification loops
Gate 8: 死門 SHIMON (Death)       → HAKAI          — Ship or die, irreversible finalization

Each gate opens in order. All preceding gates must be complete. To have all gates open at once is Eight Gates Released Formation.

Gate templates: See templates/ for per-gate specialist instructions:


<CRITICAL_EXECUTION_REQUIREMENT>

STEP -1 — Inherit Prior Findings: If <EXODIA_FINDINGS_CONTEXT> tag exists in session context, .eight-gates/artifacts/findings.json already has prior scan data. Skip Gate 3 MAP entirely — load findings from file, proceed directly to Gate 4 CHECKPOINT. This saves the most expensive phase (4-12 agents) when findings already exist from a prior session.

INIT — Before Any Gate Opens:

# 1. Ensure runtime directories are git-ignored (local exclude, no tracked-file changes)
if [ -d .git ]; then
  mkdir -p .git/info
  touch .git/info/exclude
  grep -q '^\.eight-gates/' .git/info/exclude 2>/dev/null || echo '.eight-gates/' >> .git/info/exclude
  grep -q '^\.smart/' .git/info/exclude 2>/dev/null || echo '.smart/' >> .git/info/exclude
fi

# 2. Generate session ID
SESSION_ID="$(plugins/exodia/scripts/smart/smart-id.sh generate)"

# 3. Initialize session state with TTL
plugins/exodia/scripts/smart/session-state.sh create "$SESSION_ID" 7200

# 4. Initialize checkpoint log
plugins/exodia/scripts/smart/checkpoint.sh init "$SESSION_ID"

# 5. Initialize ledger (shared with Hades, used at Gate 8)
plugins/exodia/scripts/smart/ledger.sh init

AUTO-CLASSIFY OBJECTIVE:

Detect objective type from $0. Classification rules are in gate-01-scope.md § "Auto-Classify Objective Type". The type determines which agent prompts Gate 3 (MAP) and Gate 7 (EXECUTE) use.

PROGRESSIVE EXECUTION:

Open gates 1 through $2 (default: all 8). Each gate:

  1. Verify precondition:
    • Gate 1: session initialized ($SESSION_ID exists)
    • Gates 2-8: previous gate checkpoint exists (checkpoint.sh verify [N-1])
  2. Read gate template from templates/
  3. Execute gate actions
  4. Evaluate exit condition
  5. Save checkpoint (checkpoint.sh save [N] "[status]")
  6. PROCEED or HALT

If any gate HALTs: stop, fix the issue, resume from that gate (idempotent).

RESUME PROTOCOL:

# What's already done?
plugins/exodia/scripts/smart/checkpoint.sh list
# Is session still valid?
plugins/exodia/scripts/smart/session-state.sh validate

Example output:

Checkpoints: 4
---
Gate 1: scope-defined [2026-02-13T10:00:00Z]
Gate 2: context-loaded [2026-02-13T10:02:00Z]
Gate 3: map-complete [2026-02-13T10:15:00Z]
Gate 4: checkpoint-complete [2026-02-13T10:16:00Z]
→ Resume at Gate 5 (REFLECT)

Skip completed gates. Resume from first incomplete.

AGENT CEILING:

Gate 1 sets the agent ceiling (see gate-01-scope.md § "Estimate Work"). Token costs tracked via OTel, not here.

FALLBACK MODES:

  • Smart scripts unavailable → inline checkpointing via TodoWrite
  • Teams API unavailable → fall back to Task tool without team_name (no shared task list or messaging)
  • Trivial scope (S estimate) → compress Gates 3-5 into minimal checkpoints (mark as "bypassed-trivial" with rationale), then proceed to Gate 6-7

YOUR NEXT ACTION: Run INIT, auto-classify objective, open Gate 1.

</CRITICAL_EXECUTION_REQUIREMENT>


GATE SUMMARIES

Gate 1: 開門 KAIMON — SCOPE

Removes mental inhibitions → removes ambiguity.

Entry: Session initialized. Agents: 0 (lead only).

Before tools. Before code. Before "analysis." The agent must produce a scope statement: what is in, what is out, what "done" means, and when to stop. If the scope can't be made crisp, the gate stays closed.

Template: gate-01-scope.md Exit: Scope document exists. PROCEED. Ambiguous → HALT, ask user.


Gate 2: 休門 KYŪMON — CONTEXT

Increases strength, re-energizes → loads passive context.

Entry: Gate 1 PROCEED. Agents: 0-2.

Load only what is always true for the repo: conventions, standards, quality bars, tooling guardrails. Build an artifact cache of expensive-to-reconstruct facts. This is Yin: form, intent, meaning. No execution yet.

Template: gate-02-context.md Exit: Context loaded, assumptions verified. PROCEED. Critical assumption wrong → HALT.


Gate 3: 生門 SEIMON — MAP

Skin turns red, visible change → creates visible work items.

Entry: Gate 2 PROCEED. Agents: 4-12 (from Gate 1 estimate).

Parallel discovery. Run specialist agents per objective type (BUG/AUDIT/FEATURE/CLEANUP). Each returns findings, evidence, confidence, assumptions. No agent implements changes. MAP means observe and report, not edit and pray. ALL agents launch in ONE message.

Template: gate-03-map.md Exit: >=80% agents complete → PROCEED. <80% → report partial, offer retry.


Gate 4: 傷門 SHŌMON — CHECKPOINT

Muscles tear, bleeding → persistence is painful but necessary.

Entry: Gate 3 PROCEED. Agents: 0 (lead only).

State snapshot. Decision log. Artifact cache. No checkpoint = no progress. This is how multi-round workflows stay sane. Mark each finding with a hash so re-runs skip already-processed work.

Template: gate-04-checkpoint.md Exit: Always PROCEED (bookkeeping can't fail).


Gate 5: 杜門 TOMON — REFLECT

Compound fractures → hitting the wall, bounded reflection.

Entry: Gate 4 PROCEED. Agents: 1 (hard limit).

Reflection is powerful — and expensive — so it gets rules. One round. Three questions per finding. If the agent wants to philosophize: stop. Run the mini-test instead. Evidence beats eloquence.

Template: gate-05-reflect.md Exit: Always PROCEED. Reflection informs, it doesn't block.


Gate 6: 景門 KEIMON — REDUCE

All abilities increase, Morning Peacock → sees everything clearly.

Entry: Gate 5 PROCEED. Agents: 0-1.

Parallel work produces fragments. This gate merges them into one canonical queue. Deduplicate. Resolve contradictions. Create kill list (work that should NOT be done). Assign file ownership — one agent per file. Order by dependency.

Template: gate-06-reduce.md Exit: Work queue exists with clear ownership. PROCEED. Conflicts unresolvable → HALT.


Gate 7: 驚門 KYŌMON — EXECUTE

Blue sweat, compressed air → creates real output under pressure.

Entry: Gate 6 PROCEED. Agents: 1-12 (lanes from dependency graph).

Execution happens in small commits. Implement a chunk, verify, checkpoint, continue. Parallelism is disciplined: lanes own files, avoid collisions, report back. For L/XL objectives: Agent Teams with delegate mode.

Template: gate-07-execute.md Exit: All lanes + build + tests pass → PROCEED. Remaining → ITERATE Gate 7. Fail → HALT.


Gate 8: 死門 SHIMON — HAKAI

Heart pumps maximum, reduces to ash → irreversible finalization.

Entry: Gate 7 PROCEED. Build passes. Tests pass. Agents: 0-4.

The Death Gate. Nothing final happens without verified preconditions. The point isn't destruction. The point is truth: only what survives verification exists. If deletions happen: Smart ID + deletion permit + append-only audit ledger. Irreversible actions require explicit logging and (for externals) human approval.

Template: gate-08-hakai.md Exit: SHIP (all green) or ITERATE (back to Gate 7). No "mostly done."


CLEANUP

After SHIP: run the session cleanup sequence from gate-08-hakai.md § "Session Cleanup" (expire session, revoke permits, show summaries).


GATE STATUS TEMPLATE

+====================================================================+
|                    EIGHT GATES STATUS                               |
+====================================================================+
| Session: [SESSION_ID]                                               |
| Objective: $0 | Type: [BUG|AUDIT|FEATURE|CLEANUP|CUSTOM]            |
| Scope: $1 | Gate Limit: $2                                         |
+--------------------------------------------------------------------+
| Gate 1 開門 SCOPE:      [DONE|ACTIVE|PENDING] | agents: 0          |
| Gate 2 休門 CONTEXT:    [DONE|ACTIVE|PENDING] | agents: [n]        |
| Gate 3 生門 MAP:        [DONE|ACTIVE|PENDING] | agents: [n]        |
| Gate 4 傷門 CHECKPOINT: [DONE|ACTIVE|PENDING] | agents: 0          |
| Gate 5 杜門 REFLECT:    [DONE|ACTIVE|PENDING] | agents: 1          |
| Gate 6 景門 REDUCE:     [DONE|ACTIVE|PENDING] | agents: [n]        |
| Gate 7 驚門 EXECUTE:    [DONE|ACTIVE|PENDING] | agents: [n]        |
| Gate 8 死門 HAKAI:      [DONE|ACTIVE|PENDING] | agents: [n]        |
+--------------------------------------------------------------------+
| Checkpoints: [n] | Decisions: [n]                                   |
| Session TTL: [remaining]s                                           |
+====================================================================+
| VERDICT: SHIP | HALT at Gate [n] | IN PROGRESS Gate [n]            |
+====================================================================+

FINAL REPORT

+====================================================================+
|                    EIGHT GATES — MISSION COMPLETE                   |
+====================================================================+
| Session: [SESSION_ID]                                               |
| Objective: $0 | Type: [type]                                       |
| Gates Opened: [n]/8                                                 |
+====================================================================+
|  Gate 1 SCOPE:      [summary]                                      |
|  Gate 2 CONTEXT:    [n] artifacts, [n] assumptions verified         |
|  Gate 3 MAP:        [n] agents, [n] findings (P0:[n] P1:[n])       |
|  Gate 4 CHECKPOINT: [n] artifacts, [n] decisions                    |
|  Gate 5 REFLECT:    [n] validated, [n] challenged                   |
|  Gate 6 REDUCE:     [n] work items, [n] killed                     |
|  Gate 7 EXECUTE:    [n] items done, [n] tests passing               |
|  Gate 8 HAKAI:      build=PASS tests=PASS verification=COMPLETE    |
+====================================================================+
|  Agents spawned: [n] | ITERATIONS: [n]                               |
|  SESSION: created [time] | duration [n]s                            |
|  LEDGER: [n] entries                                                |
+====================================================================+