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

# CLI

> Full command-line interface reference for the Loom command.

Loom provides a full command-line interface via the `loom` command.

## Init

Initialize the project — generates config and template files (run once):

```bash theme={null}
loom init

# Re-generate all files, overwriting existing ones
loom init --force

# Use a custom config filename
loom init -o configs/loom_myproject.yaml
```

## Build

Process text into structured memory:

```bash theme={null}
# Build from a file
loom build --input conversation.md --session user1

# Build with a preset template
loom build --template general --text "I'm Bob" --session user1

# Build from stdin
cat notes.md | loom build --session user1
```

## Chat

Chat with memory-augmented responses:

```bash theme={null}
# Single-shot chat
loom chat --message "What do I like?" --session user1

# Interactive chat
loom chat --session user1
```

### Interactive chat commands

When in interactive chat mode (`loom chat`):

| Command         | Description             |
| --------------- | ----------------------- |
| `/build <text>` | Add memory inline       |
| `/schemas`      | List registered schemas |
| `quit` / `exit` | End the session         |

## Schemas

Inspect registered schemas:

```bash theme={null}
loom schemas
```

## Serve

Start the API server in the foreground:

```bash theme={null}
# Default settings
loom serve

# Custom host and port
loom serve --host 0.0.0.0 --port 8666

# With preset template
loom serve --port 8666 --template general
```

When invoked without a subcommand, `loom serve` runs the server in the foreground (Ctrl+C to stop). For background service management, see the subcommands below.

### Service management subcommands

Only one Loom daemon can run at a time. If a daemon is already running, `start` will refuse to launch a new one regardless of the port specified. Use `stop` first, then start with a new port.

Port can be set via the `--port` flag (highest priority) or in `configs/loom.yaml` under `server.port` (default: `8666`).

| Command                              | Description                                        |
| ------------------------------------ | -------------------------------------------------- |
| `loom serve start`                   | Start as a background daemon                       |
| `loom serve start --autostart`       | Start daemon + enable auto-start on boot (systemd) |
| `loom serve stop`                    | Stop the daemon                                    |
| `loom serve stop --remove-autostart` | Stop daemon + disable auto-start on boot           |
| `loom serve restart`                 | Restart the daemon                                 |
| `loom serve status`                  | Show running status, PID, uptime, memory           |
| `loom serve logs`                    | View server logs                                   |

```bash theme={null}
# Start as a background daemon (port from config, default 8666)
loom serve start

# Specify port via flag (overrides config)
loom serve --port 9000 start

# Start daemon + enable auto-start on boot
loom serve start --autostart

# Check status
loom serve status

# Stop the daemon
loom serve stop

# Stop + disable auto-start
loom serve stop --remove-autostart

# Restart with a different port
loom serve --port 9000 restart

# View logs
loom serve logs -n 100       # last 100 lines
loom serve logs -f           # follow in real time
```

See [Service management](/interfaces/service-management) for details on daemon mode, auto-start, and log management.

## Summary

| Command                        | Description                             |
| ------------------------------ | --------------------------------------- |
| `loom init`                    | Initialize project (config + templates) |
| `loom build`                   | Process text into memory                |
| `loom chat`                    | Chat with memory                        |
| `loom schemas`                 | Inspect schemas                         |
| `loom serve`                   | Start API server + Web UI (foreground)  |
| `loom serve start`             | Start as background daemon              |
| `loom serve start --autostart` | Start daemon + enable boot auto-start   |
| `loom serve stop`              | Stop background daemon                  |
| `loom serve status`            | Show daemon status                      |
