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

# CLI Reference

> Complete command line reference for Basic Memory including auth, import, project management, and tool commands

## Core Commands

### import

Imports external knowledge sources with support for project targeting:

```bash theme={null}
# Claude conversations
basic-memory import claude conversations

# Claude projects
basic-memory import claude projects

# ChatGPT history
basic-memory import chatgpt

# Memory JSON format
basic-memory import memory-json /path/to/memory.json

# Import to specific project
basic-memory --project=work import claude conversations
```

### status

Shows system status information:

```bash theme={null}
# Basic status check
basic-memory status

# Detailed status
basic-memory status --verbose

# JSON output
basic-memory status --json
```

### project

Manage multiple projects with the new unified database architecture. Projects can now be switched instantly during conversations without restart.

```bash theme={null}
# List all configured projects with status
basic-memory project list

# Create a new project
basic-memory project add work ~/work-basic-memory

# Create a project using an existing directory (like an Obsidian vault)
basic-memory project add notes ~/Documents/MyObsidianVault

# Set the default project
basic-memory project default work

# Remove a project (doesn't delete files)
basic-memory project remove personal

# Show detailed project statistics
basic-memory project info
```

> [!NOTE]
>
> You can also manage projects within an LLM chat via mcp tools.

#### Using Projects in Commands

All commands support the `--project` flag to specify which project to use:

```bash theme={null}
# Run MCP server for a specific project
basic-memory --project=personal mcp
```

### tools

Direct access to MCP tools via CLI with new editing and file management capabilities:

```bash theme={null}
# Create notes
basic-memory tool write-note --title "My Note" --content "Content here"

# Search notes
basic-memory tool search-notes --query "authentication"
```

### help

The full list of commands and help for each can be viewed with the `--help` argument.

```bash theme={null}
basic-memory --help
```

> [!WARNING]
>
> You need to install Basic Memory via `uv` or `pip` to use the command line tools. See the [Getting Started guide](https://memory.basicmachines.co/getting-started.md) for installation instructions.

## Using stdin with Basic Memory's `write_note` Tool

The `write-note` tool supports reading content from standard input (stdin), allowing for more flexible workflows when creating or updating notes in your Basic Memory knowledge base.

### Use Cases

This feature is particularly useful for:

1. **Piping output from other commands** directly into Basic Memory notes
2. **Creating notes with multi-line content** without having to escape quotes or special characters
3. **Integrating with AI assistants** like Claude Code that can generate content and pipe it to Basic Memory
4. **Processing text data** from files or other sources

### Basic Usage

#### Method 1: Using a Pipe

You can pipe content from another command into `write_note`:

```bash theme={null}
# Pipe output of a command into a new note
echo "# My Note\n\nThis is a test note" | basic-memory tool write-note --title "Test Note" --folder "notes"

# Pipe output of a file into a new note
cat README.md | basic-memory tool write-note --title "Project README" --folder "documentation"

# Process text through other tools before saving as a note
cat data.txt | grep "important" | basic-memory tool write-note --title "Important Data" --folder "data"
```

#### Method 2: Using Heredoc Syntax

For multi-line content, you can use heredoc syntax:

```bash theme={null}
# Create a note with heredoc
cat << EOF | basic-memory tool write_note --title "Project Ideas" --folder "projects"
# Project Ideas for Q2

## AI Integration
- Improve recommendation engine
- Add semantic search to product catalog

## Infrastructure
- Migrate to Kubernetes
- Implement CI/CD pipeline
EOF
```

#### Method 3: Input Redirection

You can redirect input from a file:

```bash theme={null}
# Create a note from file content
basic-memory tool write-note --title "Meeting Notes" --folder "meetings" < meeting_notes.md
```

## Integration with Claude Code

This feature works well with Claude Code in the terminal:

### CLI

In a Claude Code session, let Claude know he can use the basic-memory tools, then he can execute them via the cli:

```bash theme={null}
echo "# Test Note from Claude\n\nThis is a test note created by Claude to test the stdin functionality." | basic-memory tool write-note --title "Claude Test Note" --folder "test" --tags "test" --tags "claude"
```

```bash theme={null}
# Stable releases
pip install basic-memory

# Beta/pre-releases
pip install basic-memory --pre

# Latest development builds (auto-published)
pip install basic-memory --pre --force-reinstall

# Check current version
basic-memory --version
```

## Troubleshooting Common Issues

### Sync Conflicts

If you encounter a file changed during sync error:

1. Check the file referenced in the error message
2. Resolve any conflicts manually
3. Run sync again

### Import Errors

If import fails:

1. Check that the source file is in the correct format
2. Verify permissions on the target directory
3. Use --verbose flag for detailed error information

### Status Issues

If status shows problems:

1. Note any unresolved relations or warnings
2. Restart your MCP Client (e.g. Claude Desktop)
3. Check file permissions if database access errors occur
4. If the errors continue please contact us and we will fix it


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.