Overview
Theftl 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 runningftl code, ensure:
- You’ve run
ftl setupto configure your agent and credentials - You’ve run
ftl initin your project directory to create.ftlconfig - Docker is running
What Happens
When you runftl code:
- Validation - Checks that
.ftlconfigexists in the current directory or parent directories - Sandbox Launch - Starts an isolated Docker container with your codebase
- Task Execution - The AI agent analyzes your task and makes changes
- Snapshot Creation - Changes are captured in a snapshot for review
- Review Prompt - You can test, diff, merge, or reject the changes
Error: No Config Found
If you haven’t initialized FTL in your project: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”
- “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
Interactive Shell Mode
If you runftl 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
- ftl init - Initialize FTL in a project
- ftl snapshots - Manage snapshots
- ftl logs - View session history