Skip to main content

nut context

Manage context documents (project, architecture, role) for your Coconut instance.
nut context [command]

Overview

Context documents provide essential information to AI skills about your project, its architecture, and the roles they should play. These documents help skills make better decisions and produce more relevant code.

Context Types

  • project - High-level project description, goals, and requirements
  • architecture - Technical architecture, patterns, and design decisions
  • role - Role definitions and expectations for AI skills

nut context get

Read a context document.
nut context get <type> [options]
Arguments:
  • type - Context type (project, architecture, or role)
Options:
  • --json - Output as JSON
Examples:
# Read project context
nut context get project

# Read architecture as JSON
nut context get architecture --json

# Read role definition
nut context get role

nut context update

Replace the entire content of a context document.
nut context update <type> [options]
Arguments:
  • type - Context type to update
Options:
  • --file <path> - Path to file containing new content
  • --content <text> - Direct content to set
Examples:
# Update from file
nut context update project --file ./new-project.md

# Update with direct content
nut context update role --content "# Role Definition\n\nAI skills should focus on code quality and testing..."

# Replace architecture document
nut context update architecture --file ./docs/architecture.md
Using update replaces the entire document. Use append to add content without replacing existing text.

nut context append

Append content to a context document.
nut context append <type> [content] [options]
Arguments:
  • type - Context type to append to
  • content - Text to append (optional if using --file)
Options:
  • --file <path> - Path to file to append
Examples:
# Append text directly
nut context append project "## New Section\n\nAdditional project requirements..."

# Append from file
nut context append architecture --file ./additional-notes.md

# Add role clarifications
nut context append role "## Additional Guidelines\n\n- Always write tests\n- Follow the style guide"
Appending is useful for incrementally building up context without having to re-specify everything.

nut context replace

Find and replace text in a context document.
nut context replace <type> --old <text> --new <text>
Arguments:
  • type - Context type to modify
Options:
  • --old <text> - Text to find (required)
  • --new <text> - Replacement text (required)
Examples:
# Update project name
nut context replace project --old "old text" --new "new text"

# Fix terminology
nut context replace architecture --old "microservice" --new "service"

# Update role description
nut context replace role --old "code reviewer" --new "senior code reviewer"

Context Document Examples

Project Context

# Project: E-Commerce Platform

## Overview
A modern e-commerce platform built with Next.js and Node.js.

## Goals
- Fast, responsive user experience
- Secure payment processing
- Scalable architecture

## Tech Stack
- Frontend: Next.js, React, Tailwind CSS
- Backend: Node.js, Express, PostgreSQL
- Deployment: Vercel, AWS

Architecture Context

# Architecture

## System Design
We use a microservices architecture with the following services:
- API Gateway
- Auth Service
- Product Service
- Order Service
- Payment Service

## Design Patterns
- Repository pattern for data access
- Factory pattern for service creation
- Observer pattern for event handling

## Code Organization
- `/src/services` - Business logic
- `/src/models` - Data models
- `/src/controllers` - API controllers
- `/src/utils` - Utility functions

Role Context

# AI Skill Roles

## General Guidelines
- Write clean, maintainable code
- Include comprehensive tests
- Follow existing code patterns
- Document complex logic

## Code Review Focus
- Security vulnerabilities
- Performance implications
- Error handling
- Test coverage

## Communication
- Explain changes clearly
- Ask for clarification when needed
- Suggest improvements proactively

Best Practices

Regularly update context documents as your project evolves. Outdated information can lead to AI skills making incorrect assumptions.
The more detail you provide, the better AI skills can understand your project and make appropriate decisions. Include coding standards, architectural patterns, and specific requirements.
Structure your context documents with clear headings and sections. Markdown formatting makes documents easier to read and parse.
Begin with basic context and expand over time. You don’t need perfect, comprehensive context on day one—add details as you discover what information skills need most.

Context Workflow

1

Initialize with project basics

nut context update project --content "# My Project\n\nA brief description..."
2

Add architecture details

nut context update architecture --file ./ARCHITECTURE.md
3

Define skill roles

nut context update role --file ./ROLES.md
4

Refine incrementally

nut context append project "## New Requirements\n\n..."
5

Review and update

nut context get project
nut context replace project --old "outdated info" --new "current info"