Running on GitHub Pages?

This page documents Live Mode setup. The hosted site is Analyse Mode only (mock demos). Clone the repo and run locally to activate Live Mode.

Setup Guide

How to Set Up & Test Your Agent

Complete instructions to install the platform locally, connect Cursor, Claude Code, Codex, or any AI agent, and run a real performance crash test with live chaos tests and scoring.

Running on GitHub Pages?

This hosted site is UI-only. Real agent testing requires cloning the repo and running npm run dev:all on your machine. Follow the steps below.

Prerequisites

Before you begin, make sure you have:

RequirementVersion
Node.js18+ (20+ recommended)
npm9+
GitAny recent version
AI coding agentCursor, Claude Code, Codex, etc.

Optional: Docker (sandbox isolation), empty project folder for agent code

Installation

1

Clone the repository

git clone https://github.com/shubhransh-gupta/failfast-ai.git
cd failfast-ai
2

Install frontend dependencies

npm install
3

Install backend dependencies

cd backend
npm install
cd ..
4

Build the CLI bridge

Connects your terminal agent to FailFast AI. Compiles to cli/dist/index.js.

npm run cli:build
5

(Optional) Build backend for production(optional)

Only needed if running API with npm run start:backend instead of dev mode.

npm run build:backend

First-Time Setup

1

Create a project folder

Your agent will build code here. It can be empty.

mkdir -p ~/my-crash-test-project
2

Start the platform (Terminal 1)

Keep this terminal running.

npm run dev:all
[web]  ▲ Next.js — Local: http://localhost:3000
[api]  FAILFAST AI — API SERVER
       HTTP:  http://localhost:4000/api
       WS:    ws://localhost:4000/ws?runId=<id>
3

Verify the API is online

curl http://localhost:4000/api/health
{"status":"ok","service":"failfast-ai-api"}
4

Open the Launch Pad

You should see: "FailFast API online — ready for live agent testing"

http://localhost:3000/run/

How to Run a Crash Test

Follow these steps every time you want to test an agent's performance.

1

Configure the session (Browser)

  1. Open http://localhost:3000/run/
  2. Choose a challenge (e.g. Stopwatch — 7 levels)
  3. Select your agent (Cursor, Claude Code, Codex…)
  4. Enter your project path (e.g. ~/my-crash-test-project)
  5. (Optional) Enter a GitHub repo URL
  6. Click Launch Crash Test

You receive a Session ID, CLI command, and Live Monitor link.

2

Connect the CLI bridge (Terminal 2)

  1. Connect to the API
  2. Press ENTER when your agent is ready
  3. Crash test starts automatically
cd ~/my-crash-test-project
node /path/to/failfast-ai/cli/dist/index.js connect \
  --session <SESSION_ID> \
  --api http://localhost:4000
3

Open the Live Monitor (Browser)

  1. Real-time terminal feed
  2. Current level and system status
  3. CLI connection status

http://localhost:3000/monitor/?session=<SESSION_ID>

4

Run your agent for each level

  1. Copy the requirement from the CLI
  2. Paste it into your agent (Cursor, Codex, Claude Code…)
  3. Let the agent write code in your project folder
  4. Press ENTER in the CLI when the agent finishes
  5. Platform runs chaos tests automatically
  6. Repeat for the next level
┌──────────────────────────────────────────────────┐
│  LEVEL 1: Happy Path                             │
├──────────────────────────────────────────────────┤
│  Build a stopwatch with Start, Stop, Reset...    │
└──────────────────────────────────────────────────┘
5

View your performance report

  1. Live Monitor shows score and verdict when complete
  2. Click View Detailed Report
  3. Or open http://localhost:3000/results/<SESSION_ID>/

Agent-Specific Instructions

Cursor

  1. Open project: cursor ~/my-crash-test-project
  2. Open Agent or Composer mode
  3. Paste each level requirement from the CLI
  4. Let Cursor build/modify files
  5. Press ENTER in CLI when done

Claude Code

  1. Run: cd ~/my-crash-test-project && claude
  2. Paste each level requirement
  3. Let Claude Code implement changes
  4. Press ENTER in CLI when done

OpenAI Codex

  1. Run: cd ~/my-crash-test-project && codex
  2. Paste each level requirement
  3. Let Codex write the code
  4. Press ENTER in CLI when done
🐙

GitHub Copilot

  1. Open project in VS Code
  2. Use Copilot Chat with each requirement
  3. Apply suggested changes
  4. Press ENTER in CLI when done

Google Gemini

  1. Run: cd ~/my-crash-test-project && gemini
  2. Paste each level requirement
  3. Press ENTER in CLI when done

Custom Agent

  1. Use any AI coding agent you prefer
  2. Paste CLI requirements into your agent
  3. Implement in the project folder
  4. Press ENTER in CLI after each level

What Happens During a Test

Each challenge has 7 progressive levels:

LevelNameWhat It Tests
L1Happy PathBasic correctness
L2PersistenceState survives restarts
L3OfflineWorks without network
L4Kill TestRecovery after termination
L5Race ConditionConcurrent operations
L6Corrupted StateRecovery from bad data
L7Requirement MutationAdapts when requirements change

After each level, the Chaos Engine runs adversarial tests (process kill, state corruption, network failure, race conditions, requirement mutation). The Evaluation Engine scores correctness, robustness, architecture, recovery, security, and more.

Reading Your Performance Report

After completion, open /results/<SESSION_ID>/

ScoreMeaning
80–100Strong — survived most chaos levels
60–79Moderate — some failures under pressure
40–59Weak — broke under adversarial conditions
0–39Critical — failed early levels

Demo Mode vs Real Testing

FeatureGitHub PagesLocal
View UI
Simulated crash test
Connect your agent
CLI bridge
Live WebSocket monitor
Chaos tests on your code
Real performance report

Available Commands

Run from the repo root unless noted.

npm installInstall frontend dependencies
cd backend && npm installInstall backend dependencies
npm run cli:buildBuild the CLI bridge
npm run dev:allStart web dashboard + API (recommended)
npm run devStart web dashboard only (port 3000)
npm run dev:backendStart API only (port 4000)
npm run buildProduction build for web
npm run build:backendCompile backend TypeScript
npm run start:backendRun compiled backend
npm run cli:connect -- --session <id> --api http://localhost:4000Connect CLI to session
npm run lintRun ESLint

CLI usage

npx failfast-ai connect --session <SESSION_ID> --api http://localhost:4000

Troubleshooting

"API offline" on Launch Pad

Cause: Backend is not running.

Fix: Run npm run dev:all and refresh http://localhost:3000/run/

"Cannot reach API" in CLI

Cause: CLI cannot connect to port 4000.

Fix: Ensure npm run dev:all is running. Verify with curl http://localhost:4000/api/health

"Session not found" on Live Monitor

Cause: Session expired or API was restarted.

Fix: Create a new session from Launch Pad.

CLI shows no level requirements

Cause: Session not started yet.

Fix: Press ENTER after 'agent is ready' and wait a few seconds.

Agent finished but tests didn't run

Cause: Forgot to press ENTER in the CLI.

Fix: Always press ENTER in CLI after each level to trigger chaos tests.

Port 3000 or 4000 already in use

Cause: Another process is using the port.

Fix: lsof -ti:4000 | xargs kill -9 OR PORT=4001 npm run dev:backend

cli/dist/index.js not found

Cause: CLI not built.

Fix: npm run cli:build

Quick Reference

Terminal 1 (repo root):     npm run dev:all
Browser:                    http://localhost:3000/run/
Terminal 2 (project):       npx failfast-ai connect --session <ID> --api http://localhost:4000
Monitor:                    http://localhost:3000/monitor/?session=<ID>
Report:                     http://localhost:3000/results/<ID>/

Ready to crash test your agent?

Once setup is complete, open the Launch Pad to pick a challenge, select your agent, and start a live session.