Historical post. This guide describes Stitch v1, which ran inside your CI pipeline and distributed via a Docker image. If you are installing Stitch today, follow Getting started with Stitch 2.0 instead. The
stitch-monitor/stitch-healjobs and theghcr.io/x24labs/stitchimage are no longer maintained.
Setting up Stitch takes under five minutes. You add two jobs to your CI configuration and Stitch handles the rest. No servers, no API keys to manage, no dashboard to monitor.
Prerequisites
- A GitLab CI or GitHub Actions pipeline
- A repository with at least one job that can fail (linting, tests, type checks, builds)
- Access to add jobs to your CI configuration
GitLab CI setup
Add these two jobs to your .gitlab-ci.yml:
stitch-monitor:
stage: .post
image: ghcr.io/x24labs/stitch:latest
script:
- stitch monitor
when: on_failure
stitch-heal:
stage: .post
image: ghcr.io/x24labs/stitch:latest
script:
- stitch heal
needs: ["stitch-monitor"]
when: on_failure
The stitch-monitor job activates when any upstream job fails. It reads the logs and identifies the failure. The stitch-heal job takes the diagnosis and generates a fix.
Both jobs use the .post stage, so they run after all your regular pipeline stages. They only trigger on_failure, meaning they cost zero compute time when your pipeline passes.
GitHub Actions setup
Add a workflow file at .github/workflows/stitch.yml:
name: Stitch
on:
workflow_run:
workflows: ["CI"]
types: [completed]
jobs:
heal:
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/x24labs/stitch:latest
steps:
- uses: actions/checkout@v4
- run: stitch monitor && stitch heal
This workflow triggers when your CI workflow fails. It checks out the code, runs the monitor, and applies the fix.
What happens next
When your pipeline fails:
- Stitch reads the failure logs
- It identifies the error type and affected files
- It generates a targeted patch
- It validates the fix by re-running the failing checks
- If the fix passes, it pushes a commit to a fix branch and opens a merge request
You review the MR like any other code change. By default, auto-merge is off. You decide when the fix lands.
Configuration
Stitch works with zero configuration. For teams that want more control, you can set options via environment variables:
STITCH_AUTO_MERGE: Enable auto-merge for passing fixes (default:false)STITCH_MAX_RETRIES: Maximum fix attempts per failure (default:3)STITCH_BRANCH_PREFIX: Branch naming prefix (default:stitch/fix-)
Verifying the setup
Push a commit that intentionally breaks a lint rule or test. Watch the pipeline fail, then watch Stitch pick it up. You should see a new branch and merge request within a few minutes.
If something is not working, check the Stitch job logs. They contain the full diagnosis and any errors encountered during the fix attempt.
Next steps
- Read How AI agents fix CI pipeline failures for a technical deep dive
- Check the GitHub repository for the latest releases
- Open an issue if you hit a problem. Stitch is open source and contributions are welcome.