GitHub Copilot CLI offers two powerful ways to interact with AI assistance directly from your terminal. Whether you prefer an ongoing conversation or a quick one-shot command, understanding these modes will boost your productivity. Below, we answer common questions to help you get started.
What is GitHub Copilot CLI and what two modes does it offer?
GitHub Copilot CLI brings AI-powered coding assistance to your command line. It comes in two distinct flavors: interactive mode and non-interactive mode. Interactive mode is a chat-like session where you can have a back-and-forth conversation with Copilot, asking multiple questions or giving follow-up commands. Non-interactive mode, on the other hand, is designed for quick, single-shot prompts—you issue a command and get an immediate answer without starting a full session. Both modes help you leverage Copilot's capabilities directly in your terminal, but they suit different workflows. Interactive mode is ideal for exploratory tasks like debugging or understanding a project, while non-interactive mode shines when you need a fast answer or want to integrate Copilot into automated scripts.

How does interactive mode work and when should you use it?
Interactive mode functions as a persistent conversation. When you launch Copilot CLI with the copilot command, you automatically enter interactive mode. Inside this session, you can ask questions, review responses, and then refine your requests or ask new ones—all without leaving the session. Copilot remembers the context of your conversation, allowing you to iterate on solutions. This mode is perfect for in-depth tasks: exploring a new codebase, troubleshooting complex issues, or gradually building a script. For example, you might start with “How do I run this project locally?” and then ask “Can you run it for me?” to have Copilot execute the commands. Use interactive mode when you anticipate needing multiple clarifications or want a collaborative assistant working alongside you.
How do you enter interactive mode step by step?
Entering interactive mode is straightforward. Follow these steps:
- Open your terminal and type
copilot, then press Enter. - If prompted, grant Copilot permission to access your current folder (it needs to read and modify files to assist effectively).
- Once the session starts, ask your first question, for example: “How do I run this project locally?”
- Copilot will provide instructions. You can follow them manually or ask Copilot to execute actions directly, like “Can you run it for me?”
- Continue the conversation—review output, ask follow-ups, and refine until you achieve your goal.
Remember, you stay in the same session until you explicitly exit (e.g., by typing exit). This makes interactive mode ideal for sustained collaboration.
What is non-interactive mode and what are its benefits?
Non-interactive mode is designed for speed and simplicity. Instead of launching a full session, you append a -p flag and your prompt directly to the copilot command, like copilot -p "Quickly summarize this repository". Copilot processes your request immediately and outputs the result, then returns control to your shell. There is no ongoing conversation—just a one-shot answer. Benefits include minimal overhead, fast responses, and easy integration into scripts or automated workflows. For example, you can use it to generate code snippets, check documentation, or summarize a project without interrupting your terminal flow. Non-interactive mode is best when you know exactly what you need and don't require follow-up.
How do you use non-interactive mode from the command line?
Using non-interactive mode is as simple as typing a single command. Start from your regular shell prompt (if you are in an interactive Copilot session, exit it first with exit). Then type:

copilot -p "Your prompt here"
For example, to quickly understand a repository's structure, you could use: copilot -p "Summarize what this repository does and list the key folders". Copilot will scan the project files and return a concise answer. That's it—the response appears in your terminal, and you are back to your normal workflow. This mode is especially useful for generating code examples, explaining functions, or checking syntax without interrupting your command-line session.
What are the key differences between interactive and non-interactive modes?
The main differences boil down to session length and interaction style. Interactive mode is session-based: you enter a chat where you can ask multiple related questions, with Copilot remembering context. It’s best for exploratory, iterative work. Non-interactive mode is command-based: you issue a single prompt and get a single answer, with no memory of previous requests. It’s faster and ideal for quick, focused tasks. Another difference is how you enter each mode: interactive starts with just copilot; non-interactive requires the -p flag. Finally, consider automation: non-interactive mode can be easily scripted, while interactive mode is more hands-on. Together, they cover a wide range of use cases from deep dives to rapid queries.
Can you switch between modes? How do you exit one to enter the other?
Yes, you can switch between modes, but not within the same session. To move from interactive to non-interactive, you must first exit the interactive session. Type exit or press Ctrl+C to return to your regular shell. Then, use the non-interactive command copilot -p "...". To go from non-interactive to interactive, simply run copilot without the -p flag. Essentially, you cannot combine them—you choose one or the other for each invocation. This clear separation keeps each mode simple and focused. For most workflows, you'll decide based on whether you need a conversation or a quick answer.
What are example use cases for each mode?
Interactive mode excels at tasks like debugging a failing test, exploring a new codebase, or building a multi-step automation. For instance, you could ask Copilot to explain a complex function, then request an alternative implementation, and finally ask it to test the change—all in one session. Non-interactive mode is perfect for one-off prompts: summarizing a repository, generating a code snippet for a specific task, or checking a command syntax. It also integrates with CI/CD pipelines or shell scripts—for example, automatically generating documentation from a prompt. In short: use interactive when you need a partner; use non-interactive when you need a quick tool.