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

# CLI Reference

> Guide to the LaserSell CLI: daemon behavior, log output, and configuration.

The LaserSell CLI runs as a daemon that monitors your wallet and automatically executes exits when your strategy conditions are met.

## How it works

After unlocking your wallet, the CLI connects to the LaserSell stream and begins monitoring. All activity is logged to the terminal via structured log output.

```shellscript theme={null}
lasersell
```

The daemon runs until you press **Ctrl+C** to gracefully shut down.

## Log output

The CLI outputs structured events as they happen:

| Event                 | Meaning                                     |
| --------------------- | ------------------------------------------- |
| `startup`             | CLI started, wallet unlocked                |
| `stream_connected`    | Connected to the LaserSell stream           |
| `wallet_registered`   | Wallet ownership verified with the server   |
| `balance_update`      | SOL balance polled                          |
| `session_started`     | New position detected and monitoring began  |
| `pnl_update`          | Profit/loss update for an active position   |
| `sell_scheduled`      | Exit condition triggered, sell queued       |
| `sell_attempt`        | Sell transaction submitted                  |
| `sell_complete`       | Sell confirmed on-chain                     |
| `session_closed`      | Position fully exited                       |
| `liquidity_snapshot`  | Pool liquidity update (trend + depth bands) |
| `stream_disconnected` | Stream connection lost                      |

## CLI flags

| Flag                   | Short | Description                                        |
| ---------------------- | ----- | -------------------------------------------------- |
| `--setup`              |       | Force-run the onboarding wizard                    |
| `--config <path>`      | `-f`  | Path to a custom config file                       |
| `--debug`              |       | Write debug-level logs to `~/.lasersell/debug.log` |
| `--smoke`              |       | Run a connectivity health check and exit           |
| `--export-private-key` |       | Export your wallet's base58 private key to stdout  |

`--smoke`, `--setup`, and `--export-private-key` are mutually exclusive.

## Headless operation

The CLI is designed for headless server deployments. For automated unlock, set the passphrase via environment variable:

```shellscript theme={null}
export LASERSELL_WALLET_PASSPHRASE="your-passphrase"
lasersell
```

On a VPS, run in a `tmux` or `screen` session, or use `systemd` to manage the process.

## Exit strategies

The CLI supports all LaserSell exit strategies, configured in `~/.lasersell/config.yml`:

| Strategy           | Config field         | Description                                            |
| ------------------ | -------------------- | ------------------------------------------------------ |
| Take-profit        | `target_profit`      | Exit when profit reaches this % of entry               |
| Stop-loss          | `stop_loss`          | Exit when loss reaches this % of entry                 |
| Trailing stop      | `trailing_stop`      | Exit when profit drops this % from peak                |
| Deadline timeout   | `deadline_timeout`   | Force exit after N seconds                             |
| Sell on graduation | `sell_on_graduation` | Exit when token migrates to a new DEX                  |
| Exit ladder        | `take_profit_levels` | Sell partial amounts at multiple profit thresholds     |
| Liquidity guard    | `liquidity_guard`    | Exit when pool liquidity drops below safe threshold    |
| Breakeven trail    | `breakeven_trail`    | Trailing stop that activates once position breaks even |

At least one exit condition must be enabled. See [Example Configuration](/onboarding/example-configuration) for the full config reference.

## Copy trading

Monitor other wallets and optionally auto-buy when they buy:

```yaml theme={null}
watch_wallets:
  - pubkey: "TraderWallet1..."
    label: "whale"
  - pubkey: "TraderWallet2..."
    auto_buy:
      amount: 0.1       # SOL
      amount_usd1: 0.0   # USD1
```

Positions from watched wallets are managed by the same exit strategy as your own positions.

## Modifying your strategy

Edit `~/.lasersell/config.yml` and restart the daemon. Changes take effect on the next launch.

To re-run the setup wizard:

```shellscript theme={null}
lasersell --setup
```
