Overview
Project scripts are configured per-project and can:- Execute any shell command
- Be triggered via keyboard shortcuts (see Keybindings)
- Run automatically when creating new worktrees
- Display with custom icons in the UI
Script Configuration
Scripts are configured through the T3 Code UI in project settings. Each script has the following properties:Script Properties
Unique identifier for the script.
- Must be 1-24 characters
- Start with lowercase letter or digit
- Can contain lowercase letters, digits, and hyphens
- Used in keybinding commands:
script.{id}.run
test, build, dev, lint-fixDisplay name shown in the UI.This is what users see in the interface. Can contain spaces and special characters.Examples:
Run Tests, Build Production, Start Dev ServerThe shell command to execute.This can be any valid shell command. It runs in the project’s workspace root.Examples:
npm testbun run buildcargo test --allpython -m pytest
Icon displayed in the UI.Choose an icon that best represents the script’s purpose:
play- General execution, start commandstest- Test runnerslint- Linters, formattersconfigure- Setup, configuration scriptsbuild- Build commandsdebug- Debugging tools
Whether to automatically run this script when creating a new worktree.Useful for setup scripts that need to run in fresh worktrees (e.g., installing dependencies).Default:
falseCreating Scripts via UI
Configure Script
Fill in the script details:
- ID (for keybindings)
- Display name
- Command to execute
- Icon
- Auto-run on worktree creation (optional)
Example Scripts
Testing
Building
Linting and Formatting
Development Servers
Setup and Installation
Binding Scripts to Keybindings
Once you’ve created a script, you can bind it to a keyboard shortcut using thescript.{id}.run command format.
In your ~/.t3/keybindings.json:
The script ID in the keybinding must exactly match the ID configured in your project settings.
Script Execution Context
Working Directory
Scripts execute in the project’s workspace root directory. For worktree-based threads, scripts run in the worktree directory.Environment Variables
Scripts inherit the environment from the T3 Code server process. This includes:- System environment variables
- Shell profile variables (if the server was started from a shell)
- Any custom environment variables set when launching T3 Code
Shell
Scripts are executed using the system’s default shell:/bin/shon Unix-like systemscmd.exeon Windows (when not using WSL)
Output and Logging
Script output (stdout and stderr) is displayed in the T3 Code terminal. You can:- View real-time output
- See exit codes
- Cancel running scripts
Best Practices
Use descriptive IDs
Use descriptive IDs
Choose IDs that clearly indicate what the script does:
Keep commands simple
Keep commands simple
If your command is complex, consider moving it to a shell script:
Use runOnWorktreeCreate wisely
Use runOnWorktreeCreate wisely
Only enable auto-run for scripts that are:
- Fast (< 30 seconds)
- Idempotent (safe to run multiple times)
- Required for the worktree to function
npm installgit submodule update
- Long-running dev servers
- Database migrations
- Deployment scripts
Test scripts before adding keybindings
Test scripts before adding keybindings
Run scripts manually from the UI first to ensure they work correctly before binding them to shortcuts.
Use package.json scripts
Use package.json scripts
Instead of duplicating commands, reference scripts defined in your package.json:
package.json
T3 Code script
Common Use Cases
Full Stack Project
Python Data Science Project
Rust Project
Schema Reference
TheProjectScript type from the source code:
~/workspace/source/packages/contracts/src/orchestration.ts:118-125
Troubleshooting
Script Not Found in Keybindings
If your keybinding commandscript.{id}.run isn’t working:
- Verify the script ID matches exactly (case-sensitive)
- Check that the script is saved in project settings
- Ensure the ID follows naming rules (lowercase, alphanumeric, hyphens only)
Script Fails to Execute
If your script runs but fails:- Check the command: Test it manually in a terminal first
- Verify working directory: Ensure paths are relative to workspace root
- Check permissions: Scripts may need execute permissions
- Review environment: Some tools require specific environment variables
Auto-run Scripts Not Running
IfrunOnWorktreeCreate scripts don’t execute:
- Check server logs for errors
- Verify the script command is valid
- Ensure the worktree creation completed successfully
Limits and Constraints
Must match pattern:
^[a-z0-9][a-z0-9-]*$However, performance may degrade with excessive scripts. Recommended: < 20 scripts.
Limited by your shell’s command length limit (typically 128KB+).
Related
Keybindings
Bind scripts to keyboard shortcuts
Server Options
Server configuration and CLI flags
