Skip to main content

Overview

The ftl code command runs a coding task inside an isolated Docker sandbox. The AI agent executes your task, makes changes to your codebase, and creates a snapshot that you can review, test, and merge.

Usage

Parameters

string
required
Description of the coding task to perform. Should be clear and specific.

Example

Prerequisites

Before running ftl code, ensure:
  1. You’ve run ftl setup to configure your agent and credentials
  2. You’ve run ftl init in your project directory to create .ftlconfig
  3. Docker is running

What Happens

When you run ftl code:
  1. Validation - Checks that .ftlconfig exists in the current directory or parent directories
  2. Sandbox Launch - Starts an isolated Docker container with your codebase
  3. Task Execution - The AI agent analyzes your task and makes changes
  4. Snapshot Creation - Changes are captured in a snapshot for review
  5. Review Prompt - You can test, diff, merge, or reject the changes

Error: No Config Found

If you haven’t initialized FTL in your project:
Solution: Run ftl init in your project directory.

Task Description Tips

Write clear, actionable task descriptions: Good examples:
  • “add pagination to the users table”
  • “refactor the auth service to use async/await”
  • “fix the race condition in the cache update logic”
  • “add unit tests for the payment processor”
Avoid vague descriptions:
  • “make it better” (too vague)
  • “fix bugs” (not specific)
  • “update code” (no clear goal)

Working with Snapshots

After a task completes, FTL creates a snapshot with all changes. You can:
  • Review changes with ftl snapshots
  • See detailed diffs
  • Run tests to validate changes
  • Merge accepted changes back to your working directory
  • Reject unwanted changes
See ftl snapshots for snapshot management.

Interactive Shell Mode

If you run ftl without a command, you enter interactive shell mode where you can:
  • Run multiple tasks in sequence
  • Use session commands: test, diff, merge, reject
  • Manage snapshots with list, restore <id>

See Also