TF Code
TF Code is ToothFairyAI's AI coding agent — a command-line interface that brings AI-powered coding assistance to your terminal with deep ToothFairyAI workspace integration.
It ships with three built-in agents:
| Agent | Purpose | Key Ability |
|---|---|---|
| Build | Execute and implement | Full read/write access, the default agent |
| Plan | Explore and plan | Read-only analysis, writes plans to .tfcode/plans/ |
| TF Engineer | Manage ToothFairyAI workspace | Exclusive access to live MCP tools for workspace operations |
Switch between them at any time with Tab or the --agent flag.
Prerequisites
- Node.js 18+
- A modern terminal emulator (WezTerm, Alacritty, Kitty, Ghostty recommended)
- ToothFairyAI API credentials (from Admin → TFCode & API Integration)
Install
npm install -g @toothfairyai/tfcode
Verify:
tfcode --version
Configure
Run the interactive setup to create a profile:
tfcode setup
This prompts for profile name, workspace ID, API key, and region. Alternatively, set environment variables:
export TF_WORKSPACE_ID="your-workspace-id"
export TF_API_KEY="your-api-key"
export TF_REGION="au"
Validate:
tfcode validate
Usage
Interactive session
tfcode
Single command
tfcode run "Explain this codebase"
Ask questions
How is authentication handled in @src/api/index.ts
Plan first, then build
Use Tab to switch to Plan mode, describe what you want, then switch back to Build to implement.
- Plan — describe the feature, review the plan
- Build — switch back and ask it to implement
Workspace management
tfcode run --agent "TF Engineer" "Create a retriever agent called SupportBot"
tfcode run --agent "TF Engineer" "Search documents about refund policy"
Undo changes
/undo
Next Steps
- Config — Profiles, regions, config files, and precedence
- Providers — Multiple providers and model selection
- Agents — Build, Plan, and TF Engineer in detail
- MCP Servers — ToothFairyAI MCP, skills, and functions
- Server Mode — Run TF Code as a headless HTTP server
- Plugins — Extend TF Code with custom plugins