Skip to main content

nut code

Start implementing a proposal using an AI assistant in terminal mode.
nut code [options] <proposal-id>
Arguments:
  • proposal-id - The ID of the proposal/task to implement (e.g., cp-1234567890)
Options:
  • --model <model> - AI model to use (default: “claude”)
  • --api <url> - API base URL (default: “http://localhost:3000”)
  • --autonomous - Skip permission prompts (use with caution)
  • --auto - Alias for --autonomous
  • --custom-instructions <instructions> - Custom instructions for the agent
  • --new-worktree - Create a new git worktree for this session
  • --worktree-suffix <suffix> - Append custom suffix to worktree branch
  • --worktree-branch <name> - Override the generated worktree branch name

Overview

The code command launches an interactive AI coding session in your terminal to help you implement a specific change proposal. The AI assistant understands your codebase, the proposal’s intent, and can help write, modify, and review code.

Usage

Start coding on a task:
# Basic usage
nut code cp-1234567890

# Use a specific model
nut code cp-1234567890 --model claude
nut code cp-1234567890 --model gpt-4

# Autonomous mode (skip permission prompts)
nut code cp-1234567890 --autonomous
nut code cp-1234567890 --auto

# With custom instructions
nut code cp-1234567890 --custom-instructions "Focus on performance optimization"

# Create a git worktree for isolated development
nut code cp-1234567890 --new-worktree
nut code cp-1234567890 --new-worktree --worktree-suffix feature
nut code cp-1234567890 --worktree-branch my-custom-branch

# Connect to remote instance
nut code cp-1234567890 --api https://my-coconut.example.com
Make sure you’ve created a task first using nut task create. You can find task IDs with nut task list.

What Happens

When you run nut code:
  1. Loads the proposal - The AI reads the proposal description and understands the task
  2. Analyzes your codebase - Reviews relevant files and project structure
  3. Starts interactive session - Opens a terminal interface where you can chat with the AI
  4. Implements changes - The AI suggests and applies code changes with your approval
  5. Tracks progress - Updates the proposal status as work progresses

Interactive Session

Once the session starts, you can:
  • Ask questions about implementation approaches
  • Request code changes by describing what you need
  • Review suggestions before they’re applied
  • Iterate on solutions until you’re satisfied
  • Run tests to verify changes work correctly

Example Workflow

1

Create a proposal

nut propose "Add user search functionality"
2

Start coding

nut code cp-001
3

Interact with AI

The AI assistant will help you:
  • Plan the implementation
  • Write the necessary code
  • Create or update tests
  • Review and refine changes
4

Complete implementation

Once finished, the AI will mark the proposal as implemented and you can commit the changes.

Tips for Success

Clear, detailed requests help the AI understand exactly what you want. Instead of “add a search”, try “add a search function that queries users by email and username”.
Always review the AI’s suggested changes before accepting them. You’re in control of what gets applied to your codebase.
Work in small steps rather than asking for everything at once. This makes it easier to verify each change.
Keep your code committed in git so you can easily revert changes if needed.

Advanced Options

Git Worktrees

The --new-worktree option creates an isolated git worktree for your coding session. This allows you to work on a task in a separate directory without affecting your main working tree.
# Create a worktree automatically
nut code cp-1234567890 --new-worktree

# Worktree will be created at: ../repo-worktree-cp-1234567890/
Benefits of using worktrees:
  • Keep your main branch clean while experimenting
  • Easy to abandon changes if needed
  • Work on multiple tasks simultaneously in different directories

Autonomous Mode

Use with caution: Autonomous mode (--autonomous or --auto) allows the AI to make changes without asking for permission. Only use this in safe environments or for well-scoped tasks.
# Enable autonomous mode
nut code cp-1234567890 --autonomous

Custom Instructions

Provide specific guidance to the AI for this session:
nut code cp-1234567890 --custom-instructions "Use functional programming patterns and avoid mutations"
nut code cp-1234567890 --custom-instructions "Prioritize code readability over performance"

Remote Instances

Connect to a Coconut instance running on a different machine or server:
nut code cp-1234567890 --api https://coconut.mycompany.com
nut code cp-1234567890 --api http://192.168.1.100:3000
The code command requires API keys to be configured. Make sure you’ve set up your AI provider keys using nut config set-key.

Exiting the Session

To exit the coding session:
  • Type exit or quit
  • Press Ctrl+C (may require confirmation)
Your progress is automatically saved, and you can resume later by running nut code <proposal-id> again.