kradle
v0.6.0
Published
Kradle's CLI. Manage challenges, experiments, agents and more!
Readme
Kradle CLI
Kradle's CLI for managing Minecraft challenges, experiments, agents, and more!
- Installation
- Autocomplete
- Configuration
- Challenge
- Experiments
- Worlds
- Agents
- AI Docs
- Publishing a New Version
- Development
- Architecture
Installation
Make sure you have NodeJS 22.18 or higher installed.
- Install Kradle's CLI globally
npm i -g kradle@latest- Initialize a new directory to store challenges, and other Kradle resources:
kradle init- Congrats 🎉 You can now create a new challenge:
kradle challenge create <challenge-name>In addition, you can enable autocomplete.
Autocomplete
Kradle CLI supports shell autocomplete for faster command entry. After installation, enable autocomplete for your shell:
kradle autocomplete
# Follow the instructions printedThe command will display instructions for your specific shell.
After setup, you will be able to use Tab to autocomplete:
kradle challenge <TAB> # Shows: build, create, list, run, upload, watch, etc.Configuration
The CLI requires a .env file with your Kradle API key and environment settings.
For new projects: Run kradle init which will prompt for your API key and create the .env automatically.
Manual setup: Create a .env file in your project root:
KRADLE_API_KEY=your-api-key-here
KRADLE_API_URL=https://dev.kradle.ai/apiGet your API key at: https://dev.kradle.ai/settings#api-keys
Challenge Commands
Create Challenge
Create a new challenge locally and in the cloud:
kradle challenge create <challenge-name>This creates a challenges/<challenge-name>/ folder with:
challenge.ts: The entrypoint defining challenge behaviorconfig.ts: TypeScript file with challenge metadata (auto-generated from cloud API)
Build Challenge
Build challenge datapack and upload both config and datapack:
kradle challenge build <challenge-name>This command:
- Creates the challenge in the cloud (if it doesn't already exists)
- Uploads
config.tsto cloud (if it exists) - Builds the datapack by executing
challenge.ts - Uploads the datapack to GCS
Delete Challenge
Delete a challenge locally, from the cloud, or both:
# Will ask confirmation for local & cloud deletion
kradle challenge delete <challenge-name>
# Doesn't ask for confirmation
kradle challenge delete <challenge-name> --yesList Challenges
List all challenges (local and cloud):
kradle challenge listPull Challenge
Download a challenge from the cloud and extract source files locally:
kradle challenge pull # Interactive selection
kradle challenge pull <challenge-name> # Pull your own challenge
kradle challenge pull <team-name>:<challenge-name> # Pull a public challenge from another team
kradle challenge pull <challenge-name> --yes # Skip confirmation when overwritingThis downloads the challenge tarball, extracts challenge.ts and config.ts, and builds the datapack locally.
Watch Challenge
Watch a challenge for changes and auto-rebuild/upload:
kradle challenge watch <challenge-name>Uses file watching with debouncing (300ms) and hash comparison to minimize unnecessary rebuilds.
Run Challenge
Run a challenge with agents specified inline or via interactive selection:
# Interactive mode - prompts for agent selection
kradle challenge run <challenge-name>
# Inline agent specification
kradle challenge run <challenge-name> team-kradle:gemini-3-flash,team-kradle:grok-4-1-fast
# Team-based challenge with roles
kradle challenge run capture-the-flag \
red=team-kradle:gemini-3-flash \
blue=team-kradle:claude-sonnet-4
# Other options
kradle challenge run <challenge-name> --studio # Run in local studio environment
kradle challenge run <team-name>:<challenge-name> # Run a public challenge from another team
kradle challenge run <challenge-name> --no-open # Don't open browser
kradle challenge run <challenge-name> --no-wait # Fire and forget (don't wait for completion)Inline Agent Syntax:
agent1,agent2- Assign agents to the "default" rolerole=agent1,agent2- Assign agents to a specific role- Same role can be specified multiple times and agents are merged
When no agents are specified, the command enters interactive mode, fetching the challenge configuration and prompting for agent selection for each role.
By default, the command opens the run URL in your browser and polls until the run completes, then displays the outcome.
List Runs
List your recent runs:
kradle challenge runs list # List 10 most recent runs
kradle challenge runs list --limit 20 # List 20 most recent runsGet Run Details
Get details and logs for a specific run:
kradle challenge runs get <run-id>
kradle challenge runs get <run-id> --no-logs # Skip fetching logs
kradle challenge runs get <run-id> --no-summary # Skip AI summaryThis displays:
- Run metadata (status, duration, end state)
- Participant results (agent, winner status, score)
- AI-generated summary (unless
--no-summaryis used) - Log entries with timestamps and levels (unless
--no-logsis used)
Experiment Commands
Experiments allow you to run batches of challenge runs with different agents and configurations, then analyze the results. This is useful for benchmarking agents, testing challenge difficulty, or gathering statistics across many runs.
Concepts
Experiment: A named collection of run configurations defined in a config.ts file. Each experiment lives in experiments/<name>/.
Version: A snapshot of an experiment execution. When you run an experiment, it creates a version containing:
- A copy of the
config.tsat that point in time - A
manifest.jsonwith the generated list of runs - A
progress.jsontracking the status of each run
Versions are stored in experiments/<name>/versions/001/, 002/, etc. This allows you to:
- Resume an interrupted experiment from where it left off
- Re-run the same experiment with
--newto create a fresh version - Compare results across different versions
Create Experiment
Create a new experiment with a template config file:
kradle experiment create <name>This creates experiments/<name>/config.ts with a template that you can customize. The config exports a main() function that returns a manifest with:
runs: Array of run configurations (challenge + participants)tags: Optional tags applied to all runs for filtering in analytics
Run Experiment
Execute or resume an experiment:
kradle experiment run <name> # Resume current version or create first one
kradle experiment run <name> --new-version # Start a new version
kradle experiment run <name> --max-concurrent 10 # Control parallelism (default: 5)
kradle experiment run <name> --download-recordings # Auto-download recordings as runs complete
kradle experiment run <name> --download-logs # Auto-download logs as runs completeThe run command:
- Creates a new version (or resumes the current one)
- Generates a manifest by executing
config.ts - Displays an interactive TUI showing run progress
- Saves progress periodically (allows resuming if interrupted)
- Opens Metabase dashboard with results when complete
Download Recordings
Download gameplay recordings from completed experiment runs:
kradle experiment recordings <name> # Interactive selection of run and participant
kradle experiment recordings <name> <run-id> # Download specific run
kradle experiment recordings <name> --all # Download all runs and participants
kradle experiment recordings <name> --version 2 # Download from specific version
kradle experiment recordings <name> <run-id> --all # Download all participants for a runRecordings are saved to experiments/<name>/versions/<version>/recordings/<run-id>/.
Download Logs
Download logs and run results from completed experiment runs:
kradle experiment logs <name> # Interactive selection of run
kradle experiment logs <name> <run-id> # Download specific run
kradle experiment logs <name> --all # Download all runs
kradle experiment logs <name> --version 2 # Download from specific versionFiles are saved to experiments/<name>/versions/<version>/logs/<run-id>/:
run.json- Run result with status, end_state, and participant resultslogs.json- Log entries from the run
List Experiments
List all local experiments:
kradle experiment listWorld Commands
Worlds are Minecraft world saves that can be used as starting points for challenges.
Import World
Import a Minecraft world folder from your local filesystem:
kradle world import ~/minecraft/saves/MyWorld # Auto-generate slug from folder name
kradle world import ~/minecraft/saves/MyWorld --as my-world # Specify custom slugThis validates the folder contains level.dat, packages it as a tarball, creates a config.ts, and uploads to the cloud.
Push World
Upload world config and tarball to the cloud:
kradle world push my-world # Push single world
kradle world push my-world another-world # Push multiple worlds
kradle world push --all # Push all local worlds
kradle world push my-world --public # Push and set visibility to publicPull World
Download a world from the cloud:
kradle world pull # Interactive selection
kradle world pull my-world # Pull specific world
kradle world pull username:their-world # Pull from another user
kradle world pull my-world --yes # Skip confirmation when overwritingList Worlds
List all worlds (local and cloud):
kradle world listShows sync status for each world (synced, cloud only, or local only).
Delete World
Delete a world locally, from the cloud, or both:
kradle world delete my-world # Interactive confirmation
kradle world delete my-world --yes # Skip confirmationAgent Commands
List Agents
List all agents registered in the system:
kradle agent listAI Docs Commands
Output LLM-focused documentation to stdout. These commands are designed to provide AI agents with comprehensive reference material about the Kradle CLI and API.
CLI Reference
Output the CLI reference documentation:
kradle ai-docs cliChallenges SDK Reference
Output the API reference documentation for the @kradle/challenges-sdk package:
kradle ai-docs challenges-sdk # Uses locally installed or latest version
kradle ai-docs challenges-sdk 0.2.1 # Uses specific versionThis fetches the documentation from unpkg.com, matching the SDK version in your project.
Publishing a New Version
The CLI uses GitHub Actions for automated releases. To publish a new version:
- Go to Actions in the GitHub repository
- Select "Create Release PR" workflow from the sidebar
- Click "Run workflow" and choose the release type:
patch- Bug fixes (0.0.5 → 0.0.6)minor- New features (0.0.5 → 0.1.0)major- Breaking changes (0.0.5 → 1.0.0)
- Review and merge the automatically created PR
- Done! The package is automatically published to npm when the PR is merged
Development
Setup
This CLI requires linking to be used locally:
npm install
npm run build
npm linkThe repository provides the kradle CLI command. It runs compiled JavaScript from dist/:
- It requires running
npm run buildafter every code change - You can use
npm run watchto make sure your code automatically recompiles after any change
Build & Lint
npm run build # Compile TypeScript to dist/
npm run lint # Check for linting issues
npm run lint:fix # Auto-fix linting issues
npm run format # Format code with BiomeRunning Tests
The CLI has integration tests that verify commands work correctly with the dev API.
Setup:
- Copy
.env.test.exampleto.env.test - Add your Kradle API key (from https://dev.kradle.ai/settings/api-keys)
cp .env.test.example .env.test
# Edit .env.test and add your API keyRun tests:
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:integration # Run integration testsNote: Integration tests make real API calls to the dev environment and may create/delete challenges.
CI Configuration: Integration tests run in GitHub Actions on PRs. The KRADLE_API_KEY secret must be configured in the repository settings.
Challenge Structure
Each challenge is a folder in challenges/<slug>/ containing:
challenge.ts: Entrypoint that defines challenge behavior using the Sandstone APIconfig.ts: TypeScript file exporting challenge metadata (name, visibility, roles, objectives, etc.)
Workflow:
kradle challenge create <slug>creates the folder withchallenge.ts- The create command automatically builds, uploads, and downloads the config from the cloud API
- The downloaded JSON is converted into a typed TypeScript
config.tsfile kradle challenge build <slug>automatically uploadsconfig.ts(if it exists) before building the datapack- You can modify
config.tslocally and runbuildto sync changes to the cloud
Architecture
The CLI is built with:
- oclif: CLI framework
- enquirer: Interactive prompts
- listr2: Task list UI
- ink: React-based terminal UI (for experiments)
- react: UI components for ink
- picocolors: Terminal colors
- zod: Schema validation
- chokidar: File watching
- biome: Linting and formatting
Project Structure
kradle-cli/
├── src/
│ ├── commands/ # CLI commands
│ │ ├── agent/ # Agent commands
│ │ ├── ai-docs/ # AI documentation commands
│ │ ├── challenge/ # Challenge management commands
│ │ │ └── runs/ # Run listing and logs commands
│ │ ├── experiment/ # Experiment commands
│ │ └── world/ # World management commands
│ └── lib/ # Core libraries
│ └── experiment/ # Experiment system
├── tests/ # Integration tests
│ ├── helpers/ # Test utilities
│ └── integration/ # Integration test suites
│ ├── challenge/ # Challenge command tests
│ ├── experiment/ # Experiment command tests
│ └── world/ # World command tests
└── static/ # Template files
└── project_template/ # Files for kradle init