| 1 | --- |
| 2 | title: "Continue CLI (cn)" |
| 3 | description: "Context engineering on the command line" |
| 4 | --- |
| 5 | |
| 6 | <Warning>Continue CLI (cn) is currently in Alpha</Warning> |
| 7 | |
| 8 | `cn` is an open-source, modular coding agent for the command line. |
| 9 | |
| 10 | It provides a battle-tested agent loop so you can simply plug in your model, rules, and tools. |
| 11 | |
| 12 |  |
| 13 | |
| 14 | ## Quick start |
| 15 | |
| 16 | <Info> |
| 17 | Make sure you have [Node.js 18 or higher |
| 18 | installed](https://nodejs.org/en/download/). |
| 19 | </Info> |
| 20 | |
| 21 | ```bash |
| 22 | # Install |
| 23 | npm i -g @continuedev/cli |
| 24 | |
| 25 | # Interactive mode |
| 26 | cn |
| 27 | |
| 28 | # Headless mode |
| 29 | cn -p "Generate a conventional commit name for the current git changes" |
| 30 | ``` |
| 31 | |
| 32 | ## Basic usage |
| 33 | |
| 34 | Out of the box, `cn` comes with tools that let it understand your codebase, edit files, run terminal commands, and more (if you approve). You can ask `cn` to: |
| 35 | |
| 36 | - Fix failing tests |
| 37 | - Find something in the codebase |
| 38 | - Execute a refactor |
| 39 | - Write a new feature |
| 40 | - And a lot more |
| 41 | |
| 42 | Use '@' to give it file context, or '/' to run slash commands. |
| 43 | |
| 44 | If you want to resume a previous conversation, run `cn --resume`. |
| 45 | |
| 46 | ## Headless mode (`-p` flag) |
| 47 | |
| 48 | In headless mode, `cn` will only output its final response, making it perfect for Unix Philosophy-style scripting and automation. For example, you could pipe your git diff into `cn` to generate a commit message, and write this to a file: |
| 49 | |
| 50 | ```bash |
| 51 | echo "$(git diff) Generate a conventional commit name for the current git changes" | cn -p > commit-message.txt |
| 52 | ``` |
| 53 | |
| 54 | ## Configuration |
| 55 | |
| 56 | `cn` uses [`config.yaml`](./reference.mdx), the exact same configuration file as Continue. This means that you can log in to [Continue Hub](./hub/introduction.mdx) or use your existing local configuration. |
| 57 | |
| 58 | To switch between configurations, you can use the `/config` slash command in `cn`, or you can start it with the `--config` flag (e.g. `cn --config continuedev/default-agent` or `cn --config ~/.continue/config.yaml`). |
| 59 | |
| 60 | ### Models |
| 61 | |
| 62 | Learn how to add custom models [here](./customization/models.mdx). Then, you can use the `/model` slash command to switch between them in `cn`. |
| 63 | |
| 64 | ### Rules |
| 65 | |
| 66 | `cn` supports [rules](./customize/deep-dives/rules.mdx) in the same way as the Continue IDE extensions. You can also use the `--rule` flag to manually include a rule from the hub. For example, `cn --rule nate/spanish` will tell `cn` to use [this rule](https://hub.continue.dev/nate/spanish) to always speak in Spanish. |
| 67 | |
| 68 | ### Tools |
| 69 | |
| 70 | `cn` supports MCP tools, which can be configured in the [same way](./customize/deep-dives/mcp.mdx) as with the Continue IDE extensions. |
| 71 | |
| 72 | #### Tool Permissions |
| 73 | |
| 74 | `cn` includes a tool permission system to make sure you approve of the agent's actions. It will begin with minimal permissions but as you approve tool calls, it will add policies to `~/.continue/permissions.yaml` to remember your preferences. |
| 75 | |
| 76 | If you want to explicitly allow or deny tools for a single session, you can use the command line flags `--allow`, `--ask`, and `--exclude`. For example: |
| 77 | |
| 78 | ```bash |
| 79 | # Always allow the Write tool |
| 80 | cn --allow Write() |
| 81 | |
| 82 | # Always ask before running curl |
| 83 | cn --ask Bash(curl*) |
| 84 | |
| 85 | # Never use the Fetch tool |
| 86 | cn --exclude Fetch |
| 87 | ``` |
| 88 | |
| 89 | ## Troubleshooting |
| 90 | |
| 91 | Run `cn` with the `--verbose` flag to see more detailed logs. These will be output to `~/.continue/logs/cn.log`. |
| 92 | |
| 93 | If you have feedback on the alpha, please [share in our Discord](https://discord.com/invite/EfJEfdFnDQ). |