GitHub Copilot CLI offers two distinct modes to help you work efficiently from the command line: interactive and non-interactive. Each serves a different purpose, whether you need an ongoing dialogue for complex tasks or a quick, one-off answer. This guide explains both modes, how to use them, and when to choose each, so you can get the most out of Copilot CLI.
What is GitHub Copilot CLI?
GitHub Copilot CLI brings the power of AI pair programming directly to your terminal. Instead of using a graphical interface, you interact with Copilot through text commands. It can suggest commands, explain code, generate scripts, and even run commands for you. There are two primary ways to interact: interactive mode (a chat-like session) and non-interactive mode (a single prompt inline). Understanding both modes ensures you pick the right tool for each task.

What is Copilot CLI Interactive Mode?
Interactive mode provides a back-and-forth, conversational experience. When you launch Copilot CLI with the command copilot, you enter this mode by default. You can ask questions, review responses, and follow up with additional prompts—all within the same session. This is ideal for exploration, debugging, or iterating on a solution. For example, you might ask “How do I run this project locally?” and then say “Can you run it for me?” The AI can analyze your project files and execute tasks collaboratively. Interactive mode is perfect when you need to refine your request or work through a problem step by step.
How Do You Enter Interactive Mode?
Getting into interactive mode is simple. Follow these steps:
- Open your terminal and type
copilot, then press Enter. - If prompted, trust the folder—Copilot needs permission to read and modify files in your current project.
- Ask a question, such as “How do I run this project locally?” Copilot will respond with instructions.
- If you want Copilot to execute the instructions, type “Can you run it for me?” The AI will analyze the project and run the server.
- You can continue the conversation, reviewing output and making new requests, all within the same session. This persistent context makes interactive mode great for complex tasks.
What is Copilot CLI Non-Interactive Mode?
Non-interactive mode is designed for speed and simplicity. Instead of starting a session, you pass a single prompt directly in the command line using the -p flag. Copilot processes your request and returns an answer almost immediately, then exits. This mode is perfect for quick, one-shot tasks like summarizing a repository, generating a code snippet, or integrating Copilot into automated scripts. For example, typing copilot -p "Quickly summarize this repository and list key folders" gives you a concise answer without needing to start a conversation. Once you have your answer, you’re right back in your normal terminal workflow.
How Do You Enter Non-Interactive Mode?
To use non-interactive mode, follow these steps:

- Ensure you are not already inside an interactive Copilot session (if you are, type
exitto leave). - At the regular command prompt, type
copilot -pfollowed by your prompt. For instance:copilot -p "Generate a Python script to sort a list of numbers". - Press Enter. Copilot will analyze the request based on the context of your current directory and output an answer instantly.
- You can use this mode in shell scripts or chained commands for automation. The result is displayed directly in your terminal, and you’re ready to continue working. Non-interactive mode is all about getting fast, focused answers with zero overhead.
When Should You Use Each Mode?
Choose interactive mode when you have open-ended or multi-step tasks. For example: debugging a failing build, exploring an unfamiliar codebase, or writing a complex script that requires iterative refinement. The ability to ask follow-up questions and run commands within the session saves time. Choose non-interactive mode for simple, known questions. For instance: summarizing a file, looking up a command syntax, or generating a quick code snippet for a one-time use. It’s also ideal for embedding Copilot in automated workflows (e.g., CI pipelines) where you need a single response without manual interaction. By matching the mode to the task, you work more efficiently.
Can You Resume a Previous Copilot Session?
Currently, GitHub Copilot CLI does not automatically save and restore sessions across terminal restarts. If you exit an interactive session, you cannot resume it later—you start fresh next time. However, within a single terminal window, you can keep the session alive indefinitely as long as you don’t exit or let it time out. To get the most out of interactive mode, plan to complete your work in one sitting. For longer projects, consider noting key findings outside the session or using non-interactive mode for quick checks that don’t require persistent context. Future updates may bring session persistence, so keep an eye on release notes.