Continue CLI (cn) Cheatsheet - Terminal Open-source Coding Agent

Continue CLI's distinguishing feature is not the terminal interface itself but that it shares one agent engine and one configuration with Continue's VS Code and JetBrains extensions: the model you chose, the rules you wrote and the MCP servers you attached all apply in the terminal, so moving to the command line does not mean configuring everything a second time. Whether to adopt it therefore depends on whether your day actually moves between IDE and terminal - if both need assistance, being same-source is worth far more than the cost of yet another standalone agent. Three things need doing once authentication is settled, which comes first because headless environments need an environment variable rather than an interactive login; second, context should be named explicitly rather than by scanning, since pointing at exact files is both faster and more accurate than walking a whole directory; third, separate generating a plan from changing your files. This sheet covers installation and auth, the TUI, headless mode, and threads and configuration.

AI CLI·25 commands·Last updated 2026-08-23
continuecnaicliagentCoding AgentOpen Source

Install & Auth 5

curl -fsSL https://raw.githubusercontent.com/continuedev/continue/main/extensions/cli/scripts/install.sh | bash
Install cn via official script
cn --version
Show installed version
cn login
Browser sign-in (assistants/MCP/models)
cn logout
Sign out of the session
export CONTINUE_API_KEY=...
Headless/CI auth via API key

Interactive (TUI) 5

cn
Start an interactive session in the project dir
@src/auth/middleware.ts why does it reject valid tokens
@-reference files/dirs as context
/clear
Clear conversation history
/compact
Compact chat to free context
/whoami
Show current signed-in identity

Headless (scripts/CI) 5

cn -p "add tests for the auth module"
-p runs once and exits after printing
cn -p "..." --auto
Auto-approve all tool calls (no prompt)
cn -p "..." --readonly
Read-only plan mode, no file changes
cn -p "..." --config ./my-config.yaml
Run with a specific config file
cn -p "..." --verbose
Verbose logging

Threads & Config 5

cn --resume
Resume the most recent session
/resume
Reopen history from the picker in-session
cn --model <slug>
Specify a model at launch
cn --mcp <slug>
Attach a named MCP server
cn --agent <slug>
Load a named agent file

Tips 5

cn TUI shares the agent with IDE plugins
Config/habits carry over
CI: -p + CONTINUE_API_KEY
Headless env needs no login state
@-reference feeds precise context
More accurate/cheaper than full-project scan
--readonly to plan first
Plan before big changes
--rule injects rules
cn --rule "use TS strict mode" persists

Tips

  • Continue CLI (command cn) shares the same agent as the Continue VS Code/JetBrains extensions — reuse your IDE models/MCP/rules in the terminal.
  • cn -p "..." is headless: it prints and exits, ideal for scripts/CI; pair with CONTINUE_API_KEY to automate in browser-less envs.
  • @file/dir feeds precise context — more accurate and cheaper than a full-project scan; use --readonly to plan before big changes.
  • --rule repeatedly injects constraints (e.g. "use TypeScript strict mode"); --mcp/--agent attach external capabilities and custom agents.

FAQ

How do I run cn in CI?

Use -p for a single run that prints and exits, with CONTINUE_API_KEY for headless authentication so it does not depend on a local login. Before a large change, run once with --readonly to get a plan and confirm the approach before letting it write. Add --auto only when you genuinely want unattended approval of every tool call.

Is @-referencing files better than letting it scan the project?

Yes. @src/auth/middleware.ts feeds exactly that file into context — precise and cheap in tokens — whereas a full-project scan is slow, pulls in a lot of irrelevant content, and can lead it to advise based on code that has nothing to do with the task. When cross-file understanding is needed, reference the few key entry files rather than the whole directory.

Can cn share configuration with the Continue IDE plugins?

Yes. They share the same agent engine, so model selection, MCP servers and assistant configuration carry over. Habits built up in the TUI continue to work in the IDE, which keeps switching cost low. For the same reason, a configuration you have validated locally can be committed to a config file that both sides read, preventing the two from drifting apart.

How do I attach MCP servers and custom agents in Continue?

cn --mcp <slug> mounts an MCP server so the agent can call external tools, and cn --agent <slug> loads a custom agent file with predefined prompts and flow. These configurations are shared with the Continue IDE plugins, so setting them up once serves both. Before CI, verify with readonly mode and only then allow unattended approval.

How do I inject a rule repeatedly inside cn?

Use the --rule flag, for example cn --rule "use TypeScript strict mode", which injects the constraint so it stays in effect across turns instead of being repeated in every prompt. Compared with a system prompt, rules are finer-grained and suit checkable requirements such as language choice or code style.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Aug 23, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us