Skip to content

Customizing Pipelines

RaiSE pipelines are data, not code. When you run a slash command like /rai-story-run, the AI loads a YAML pipeline definition and orchestrates each phase using skills and MCP tools. You customize pipelines by editing those YAML files — no programming required.

How Pipelines Run

You never run pipelines directly. Instead, you use slash commands inside Claude Code:

Slash Command Pipeline Definition What It Does
/rai-story-run story.yaml Full story lifecycle: start, design, plan, implement, review, close
/rai-bugfix-run bugfix.yaml 7-phase bugfix pipeline with 3 HITL gates
/rai-epic-run epic.yaml Epic lifecycle with delegation gates

Behind the scenes, these slash commands use MCP tools (pipeline_start, pipeline_advance, pipeline_status) to load the YAML definition, execute each phase, and enforce gates. The AI manages the orchestration — you review and approve at gate checkpoints.

Loading Hierarchy

The pipeline loader checks three locations in order:

Priority Location Use case
1 (highest) ~/.rai/pipelines/ Personal overrides
2 .raise/pipelines/ Project-specific pipelines
3 (lowest) Built-in (pipelines_base/) Shipped defaults

A pipeline at a higher priority replaces one with the same name at a lower priority. This means you can override story.yaml for your project without modifying the built-in.

Customization Points

Editing Pipeline Definitions

To customize the story pipeline for your project, create your own override:

mkdir -p .raise/pipelines

Then create .raise/pipelines/story.yaml. Your version takes precedence over the built-in. The next time you run /rai-story-run, the AI loads your custom definition instead.

Adding or Removing Phases

Each pipeline is a sequence of phases. Add, remove, or reorder them:

name: story
description: "Minimal 4-phase story pipeline"
issue_types:
  - story

phases:
  - id: start
    type: llm
    skill: rai-story-start

  - id: design
    type: llm
    skill: rai-story-design
    gate:
      type: hitl
      level: REVIEW

  - id: implement
    type: llm
    skill: rai-story-implement
    gate:
      type: hitl
      level: REVIEW

  - id: close
    type: llm
    skill: rai-story-close

This stripped-down pipeline skips the plan and review phases — useful for small projects where the overhead is not justified.

Customizing Which Skills Run

Each llm phase references a skill by name. Swap in your own skill to change what the AI does at that phase:

- id: design
  type: llm
  skill: my-custom-design    # Your skill in .claude/skills/
  context:
    graph:
      - types: [pattern]
        limit: 5

Adding and Removing Gates

Gates control when the pipeline pauses for review or runs automated checks.

HITL gates pause for human review:

gate:
  type: hitl
  level: REVIEW        # REVIEW, NOTIFY, or AUTO
  mandatory: true      # Cannot be overridden by delegation level

Deterministic gates run automated checks — pass/fail based on exit code:

gate:
  type: deterministic
  command: "uv run pytest --tb=no -q"

Remove a gate to let the AI proceed without stopping. Add gates to phases where you want a checkpoint.

Conditional Phases with when

Skip phases based on metadata:

- id: architecture-review
  type: llm
  skill: rai-architecture-review
  when: "story_type == 'code'"    # Skipped for docs/analysis stories

Variables available in when expressions come from defaults and the story type metadata.

Phase Types

llm --- AI-Driven Phases

Loads a skill and delegates to Claude:

- id: design
  type: llm
  skill: rai-story-design
  context:
    graph:
      - types: [pattern]
        limit: 5

deterministic --- Shell Command Phases

Runs commands sequentially. Fails on first non-zero exit:

- id: lint
  type: deterministic
  commands:
    - "uv run ruff check src/"
    - "uv run pyright src/"

Artifact Validation

Require specific files to exist after a phase completes:

validates:
  - pattern: "**/*-design.md"
    description: "Story design document"
  - pattern: "**/*-plan.md"
    description: "Story plan document"

The engine blocks progression if any required artifact is missing.

Context Injection

Inject knowledge graph context into LLM phases:

context:
  graph:
    - types: [pattern]
      limit: 5
    - types: [module, decision]
      limit: 3

Available types: pattern, module, decision, principle, guardrail, epic, story.

Review Modes

For review phases, enable adversarial review templates:

- id: quality-review
  type: llm
  skill: rai-quality-review
  review_mode: adversarial
  review_template: adversarial-qr

Creating a New Pipeline

Create .raise/pipelines/deploy.yaml for a custom pipeline:

name: deploy
description: "3-phase deployment pipeline"
issue_types:
  - task

phases:
  - id: validate
    type: deterministic
    commands:
      - "rai release check"
      - "rai gate check --all"

  - id: build
    type: deterministic
    commands:
      - "uv build --out-dir dist"
      - "twine check dist/*"
    gate:
      type: hitl
      level: REVIEW

  - id: publish
    type: deterministic
    commands:
      - "twine upload dist/*"

Once defined, a corresponding slash command or MCP tool call can reference it by name.

Advanced: Direct CLI Access

For debugging or scripting outside Claude Code, the pipeline CLI is available:

# List available pipelines and their phases
rai pipeline list

# Start a pipeline run directly
rai pipeline run deploy

# Check status of a running pipeline
rai pipeline status

Most developers will not need the CLI — slash commands and MCP tools handle orchestration automatically.

Next Steps