Terminal AI Coding Assistant: Installation, Authorization, and Three Operating Modes
This guide explains how to install and verify a terminal AI coding assistant, resolve PATH and permission issues, complete initialization and folder authorization, and use natural-language chat, slash commands, and project-context collaboration safely. It includes pre-installation checks, troubleshooting tables, sample commands, risk controls, and a repeatable human-review workflow.
A terminal AI coding assistant can read code, explain errors, and draft changes from the command line. Making good use of it depends on three prerequisites: a stable installation, least-privilege authorization, and human review of every change. This article follows the order of environment checks, installation troubleshooting, initialization and authorization, and mode selection. The placeholder <assistant-cli> represents the official command name; replace it with the tool and parameters permitted by your team.
1. Pre-installation Checklist
Confirm the following five items one by one before installation:
- Operating system: Confirm that your system is in the supported list in the tool’s official documentation.
- Runtime version: Use the minimum version stated in the official documentation. The following uses Node.js as an example:
node --versionnpm --version
- Package manager and global directory: Run
npm config get prefixand note the global installation directory. You will need it later when troubleshooting PATH issues. - Network and certificates: If you are behind an enterprise proxy, first confirm that environment variables such as
HTTPS_PROXYare set. Otherwise, installation may stall during download. - Disk space: Reserve enough space for dependencies and cache. For the specific amount, refer to the installation documentation.
The placeholder fields follow these rules: replace <runtime> and <package-manager> with the actual command names, and replace <assistant-cli> with the official package name or executable name. Do not execute the bracketed content as-is.
For permissions, if a global installation reports insufficient permissions, do not simply add sudo. A safer approach is to change the global directory to a user directory, for example:
npm config set prefix "$HOME/.npm-global"export PATH="$HOME/.npm-global/bin:$PATH"
The second line must be added to your shell configuration file, such as ~/.bashrc or ~/.zshrc; otherwise, new terminal sessions will not pick it up.
2. Installation, Verification, and Failure Troubleshooting
The following uses npm as an example. For other package managers, replace the command accordingly.
npm install -g <assistant-cli><assistant-cli> --version
After installation, close and reopen the terminal so that PATH takes effect. Then run the version query. If a version number is printed, you can proceed to the next step.
If installation fails, troubleshoot item by item using the table below:
| Symptom | Check command | Possible cause | Recovery action |
|---|---|---|---|
| “Command not found” | command -v <assistant-cli> (use where <assistant-cli> on Windows) |
The global bin directory is not in PATH, or the terminal session has not been refreshed | Add the global bin directory to PATH, reopen the terminal, and query again |
| Permission error during installation | npm config get prefix |
The global directory requires administrator permissions | Use a user-level prefix instead of relying on sudo long term |
| Download timeout or certificate error | npm config get registry, and check proxy variables |
Enterprise proxy or certificates are not configured | Configure the proxy and certificates according to team network rules; do not disable certificate verification |
| Version number does not match the documentation | <assistant-cli> --version |
An old version remains installed | Uninstall the old version, reinstall, and record the version number in team documentation |
3. Initialization: Login, Theme, and Folder Authorization
On first launch, the assistant enters an initialization flow in sequence: select a theme, select a login method, complete browser authorization, and authorize a folder.
- Theme affects display style only, not functionality.
- Login method usually falls into two categories: subscription-based accounts use existing subscription benefits, while developer pay-as-you-go accounts are billed based on actual usage. Specific pricing, quotas, and billing rules depend on what is shown in the account dashboard. Before choosing pay-as-you-go billing, confirm the billing method and usage limits on the account page.
- If browser authorization fails, check in sequence whether the default browser can open, whether the proxy intercepts the callback URL, and whether the local callback port is already in use.
Folder authorization determines which files the assistant can read. After authorization, the assistant can read files in that directory, analyze context, and propose modification suggestions. Therefore, follow these rules:
- Do not authorize the user home directory, the system drive root directory, or a parent directory containing multiple unrelated projects.
- Start the terminal in a dedicated project directory, then start the assistant, and confirm the current directory only when prompted.
- If the startup directory is wrong, decline authorization, exit, and restart from the correct directory.
4. Choosing and Using the Three Modes
The three modes are not mutually exclusive. You can switch between them at different stages of the same task. The table below helps determine when to use each mode.
| Mode | Typical tasks | Required permissions | Suggested outputs | Unsuitable scenarios | Risk control points |
|---|---|---|---|---|---|
| Natural-language chat | Explain concepts, analyze errors, plan a reading path | Usually read-only permission | Analysis conclusions, reading list | Need to closely read a large number of files one by one | State “analyze only, do not modify” in the question; verify file paths cited in the answer |
| Slash commands | Check status, view help, clear context, exit | No additional permissions | Confirmed status information | Need complex reasoning | Before clearing context, confirm that old information is no longer needed |
| Project-context collaboration | Dependency analysis, test completion, preliminary research for small-scope refactoring | Directory read, possibly write and command execution | Analysis report, minimal change plan, test draft | Operations involving databases, deployment, or secrets | Start read-only, review commands one by one, inspect diffs and run tests after changes |
Mode 1: Natural-Language Chat
Example input:
Analyze only; do not modify. Explain the relationship between the entry file, configuration files, and test directory in the current project, list the three files most worth reading first, and explain why.
The expected output is a directory relationship explanation plus three reading-order items, each with a file path.
After receiving the answer, first verify whether the file paths actually exist. If a path does not exist, the assistant may have read the wrong directory. In that case, use a slash command to check status and confirm the working directory. If the answer starts to drift off topic, clear the context and ask again, keeping each question focused on one goal.
Mode 2: Slash Commands
Enter / to bring up the command list, use the up and down arrow keys to select, and press Enter to execute.
A typical workflow is as follows:
- Enter
/and select status query. - Confirm that the working directory is inside the target project, the authorization scope is correct, and the account type matches expectations.
- If the context is too long and answers become slow or off topic, select clear context and then start a new question.
Before switching directories or changing permissions, confirm that the current task no longer needs historical information. Otherwise, clearing may lose important context.
Mode 3: Project-Context Collaboration
This is the highest-risk of the three modes. Start with read-only use. Example instruction:
In read-only mode, analyze the module dependencies in the src directory, list locations of potential circular dependencies, and do not modify any files.
The expected output is a list of dependency chains and risk locations, with each item labeled with the corresponding file path.
After confirming that the analysis conclusions are credible, proceed through four steps: analyze, propose, confirm, and execute.
- Ask the assistant to output analysis conclusions, and verify whether the cited information is accurate.
- Request a minimal change plan that involves only necessary files.
- Review the plan manually, and allow modifications only after confirming it is correct.
- After modification, inspect the diff with version control and run tests.
Do not delegate the following operations to the assistant for automatic execution. Execute them manually one by one and review them:
- Database table creation, migration, deletion, or bulk update statements.
- Deployment scripts, release pipeline configuration, and rollback commands.
- Creation, modification, and reading of keys, tokens, and certificate files.
- Commands that delete files, force overwrite, or modify file permissions.
After the assistant provides commands, verify the target path, runtime environment (test or production), and scope of impact one by one before deciding whether to execute them.
5. Security Practices and Workflow Checklist
In daily use, the following four rules must be followed:
- Do not paste keys, tokens, personal privacy data, or sensitive production-environment data into the session.
- Do not authorize the system root directory or the user home directory.
- Use version control before modifications, and commit only after confirming the diff.
- Standardize tool versions and installation sources across the team, and record version numbers.
Use the following checklist to build a reusable workflow:
- Step 1: Complete installation, verify the version number, and authorize within the project directory.
- Step 2: Use slash commands to confirm status, and use natural-language chat for read-only analysis.
- Step 3: In project-context collaboration mode, produce a plan first, modify only after human confirmation, then run tests and inspect the diff.
