> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coconut.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# nut knowledge

> Manage knowledge base documents

# `nut knowledge`

Manage knowledge base documents in your Coconut instance.

```bash theme={null}
nut knowledge [command]
```

## Overview

The knowledge base stores important information, documentation, and reference materials that AI skills can access when working on tasks. Unlike context documents which provide project-wide information, knowledge documents can cover specific topics, APIs, patterns, or any other reference material.

<Note>
  `nut knowledge` manages knowledge documents in the current local workspace. To search, create, or update knowledge on a remote peer Coconut through the Coconut Dashboard, use [`nut coconut knowledge`](/cli/coconut).
</Note>

***

## `nut knowledge list`

List all knowledge documents.

```bash theme={null}
nut knowledge list [options]
```

**Options:**

* `--search <query>` - Search documents by title or content
* `--json` - Output as JSON

**Examples:**

```bash theme={null}
# List all knowledge documents
nut knowledge list

# Search for specific topics
nut knowledge list --search "authentication"
nut knowledge list --search "API"

# Output as JSON
nut knowledge list --json
```

***

## `nut knowledge get`

Get a specific knowledge document by filename.

```bash theme={null}
nut knowledge get <filename> [options]
```

**Arguments:**

* `filename` - The document filename (e.g., `api-design.md`)

**Options:**

* `--json` - Output as JSON

**Examples:**

```bash theme={null}
# Read a document
nut knowledge get api-design.md

# Get as JSON
nut knowledge get api-design.md --json

# Read coding standards
nut knowledge get coding-standards.md
```

***

## `nut knowledge create`

Create a new knowledge document.

```bash theme={null}
nut knowledge create <title> [options]
```

**Arguments:**

* `title` - Document title

**Options:**

* `--file <path>` - Path to file containing document content
* `--content <text>` - Direct content for the document
* `--filename <name>` - Optional custom filename

**Examples:**

```bash theme={null}
# Create from file
nut knowledge create "API Design Guidelines" --file ./content.md

# Create with inline content
nut knowledge create "Quick Note" --content "# Quick Note\n\nSome important information here"

# Custom filename (stored as QuickNote.md)
nut knowledge create "Quick Note" --content "..." --filename QuickNote

# Create coding standards doc
nut knowledge create "TypeScript Best Practices" --file ./docs/typescript.md
```

<Tip>
  Use descriptive titles that make it easy to find documents later. Without `--filename`, filenames are generated from the title automatically; use `--filename` when you need to preserve specific casing or spelling in the `.md` filename.
</Tip>

***

## `nut knowledge update`

Update an existing knowledge document.

```bash theme={null}
nut knowledge update <filename> [options]
```

**Arguments:**

* `filename` - The document filename to update

**Options:**

* `--file <path>` - Path to file with new content
* `--title <title>` - Update the document title
* `--content <text>` - Direct content update

**Examples:**

```bash theme={null}
# Update from file
nut knowledge update api-design.md --file ./updated.md

# Update title
nut knowledge update api-design.md --title "API Design Guidelines v2"

# Update content directly
nut knowledge update api-design.md --content "# Updated Content\n\n..."

# Update both title and content
nut knowledge update api-design.md --title "New Title" --file ./new-content.md
```

***

## `nut knowledge delete`

Delete a knowledge document.

```bash theme={null}
nut knowledge delete <filename>
```

**Arguments:**

* `filename` - The document filename to delete

**Examples:**

```bash theme={null}
nut knowledge delete api-design.md
nut knowledge delete old-notes.md
```

<Note>
  Deleting a knowledge document is permanent. Make sure you no longer need the information before confirming.
</Note>

***

## Knowledge Base Use Cases

### API Documentation

```bash theme={null}
# Create API reference
nut knowledge create "REST API Reference" --file ./docs/api-reference.md

# Document authentication
nut knowledge create "Authentication Guide" --content "# Authentication\n\nOur API uses JWT tokens..."
```

### Coding Standards

```bash theme={null}
# Add style guide
nut knowledge create "JavaScript Style Guide" --file ./docs/js-style.md

# Document patterns
nut knowledge create "Design Patterns" --content "# Common Design Patterns\n\n## Factory Pattern..."
```

### Third-Party Integration

```bash theme={null}
# Document external services
nut knowledge create "Stripe Integration" --file ./docs/stripe.md
nut knowledge create "AWS S3 Usage" --file ./docs/s3-guide.md
```

### Project History & Decisions

```bash theme={null}
# Architecture decisions
nut knowledge create "Why We Chose PostgreSQL" --file ./docs/decisions/postgres.md

# Migration guides
nut knowledge create "v1 to v2 Migration Guide" --file ./docs/migration.md
```

***

## Best Practices

<AccordionGroup>
  <Accordion title="Organize by topic">
    Create separate documents for different topics rather than one large document. This makes it easier for AI skills to find relevant information.
  </Accordion>

  <Accordion title="Keep documents current">
    Regularly review and update knowledge documents as your project evolves. Outdated information can lead to incorrect implementations.
  </Accordion>

  <Accordion title="Use clear formatting">
    Structure documents with headings, bullet points, and code examples. Well-formatted documents are easier for both humans and AI to parse.
  </Accordion>

  <Accordion title="Include examples">
    Whenever possible, include code examples and real-world use cases. Examples help AI skills understand how to apply the information.
  </Accordion>

  <Accordion title="Link related docs">
    Reference related knowledge documents within your content to help create connections between topics.
  </Accordion>
</AccordionGroup>

***

## Knowledge Base Workflow

<Steps>
  <Step title="Create foundational docs">
    ```bash theme={null}
    nut knowledge create "API Guidelines" --file ./docs/api.md
    nut knowledge create "Database Schema" --file ./docs/schema.md
    nut knowledge create "Deployment Process" --file ./docs/deploy.md
    ```
  </Step>

  <Step title="Add as you learn">
    When you encounter something worth documenting:

    ```bash theme={null}
    nut knowledge create "Redis Caching Strategy" --content "# Redis Usage\n\n..."
    ```
  </Step>

  <Step title="Update regularly">
    ```bash theme={null}
    nut knowledge update api-guidelines.md --file ./docs/api-v2.md
    ```
  </Step>

  <Step title="Search when needed">
    ```bash theme={null}
    nut knowledge list --search "caching"
    nut knowledge get redis-caching-strategy.md
    ```
  </Step>

  <Step title="Clean up outdated docs">
    ```bash theme={null}
    nut knowledge delete old-api-docs.md
    ```
  </Step>
</Steps>

***

## Knowledge vs Context

**Context Documents** provide high-level, project-wide information:

* Project goals and requirements
* Overall architecture
* Team roles and expectations

**Knowledge Base** contains specific, topic-focused information:

* API documentation
* Specific patterns and practices
* Integration guides
* Technical specifications

Both work together to give AI skills a complete understanding of your project.
