nut code
Start implementing a proposal using an AI assistant in terminal mode.
proposal-id- The ID of the proposal/task to implement (e.g.,cp-1234567890)
--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
Thecode 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:What Happens
When you runnut code:
- Loads the proposal - The AI reads the proposal description and understands the task
- Analyzes your codebase - Reviews relevant files and project structure
- Starts interactive session - Opens a terminal interface where you can chat with the AI
- Implements changes - The AI suggests and applies code changes with your approval
- 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
Interact with AI
The AI assistant will help you:
- Plan the implementation
- Write the necessary code
- Create or update tests
- Review and refine changes
Tips for Success
Be specific in your requests
Be specific in your requests
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”.
Review before accepting
Review before accepting
Always review the AI’s suggested changes before accepting them. You’re in control of what gets applied to your codebase.
Iterate incrementally
Iterate incrementally
Work in small steps rather than asking for everything at once. This makes it easier to verify each change.
Use with version control
Use with version control
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.
- 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.Custom Instructions
Provide specific guidance to the AI for this session:Remote Instances
Connect to a Coconut instance running on a different machine or server: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
exitorquit - Press
Ctrl+C(may require confirmation)
nut code <proposal-id> again.