10 Essential Commands Every Beginner Should Master for AI Coding Assistants
Terminal-based AI coding assistants let developers read code, edit files, and run tests without leaving the terminal, yet many beginners use them only in a "chat" style that forces them to re-explain the project every session. This article explains why conversational use falls short and walks through ten practical commands organized into four layers—startup and session management, context governance, safe and controllable changes, and automation integration. It covers interactive and one-shot launches, model selection, session resume, the help command, context initialization with an /init file, /clear and /compact, cross-session memory, permission modes, and non-interactive calls with structured output for scripts and CI. A quick-reference table and practical tips help turn vague "chatting" into precise, reproducible, scriptable commands.
Terminal-based AI coding assistants (referred to as the “AI assistant” below) are becoming a daily tool for many developers. Without switching windows, you can have them read code, edit files, and run tests. Yet many beginners only use them in a “chat” style, and the result is predictable: every new session forces you to re-introduce your project, long conversations start drifting off-topic, and when you want to plug the tool into an automation pipeline, you have no idea where to start.
The root cause is that a conversation is stateless, while real engineering work spans multiple sessions and steps. The fix is to turn vague “chatting” into precise, reproducible, scriptable commands. This article goes from the basics to more advanced usage, covering ten commands that every beginner should master across four layers: startup and session management, context governance, safe and controllable changes, and automation integration.
1. Why Beginners Shouldn’t Rely on “Chatting” Alone
| Common frustration | Underlying cause | Relevant command |
|---|---|---|
| Re-explaining the project every time | A new session has no project background | Context initialization |
| Off-topic answers after a long chat | Context bloat drowns out earlier instructions | Clear / compact context |
| Unsure when to “keep chatting” | No way to resume a session | Session resume |
| Same task, very different results across sessions | Model tier and usage chosen arbitrarily | Model selection, command combinations |
| Can’t be called reliably from scripts | Only interactive “one question, one answer” is available | Non-interactive calls, help command |
A handful of commands can resolve all of these. The value of a command is that it fixes an operation into something that can be written into a script, shared with teammates, and reviewed after an incident. The following sections go from simple to advanced.
2. Startup and Session Management: Connecting the Workflow
1. Launch: From Interactive Mode to One-Shot Calls
Interactive launch is the default for day-to-day development. Type the launch command directly in the terminal (we’ll use aic as a placeholder below) to enter a continuous conversation interface:
# Enter an interactive sessionaic
Interactive mode suits working alongside the assistant and iterating step by step. But it isn’t the only way. Add an argument to give a task directly, and the assistant runs once, prints the result, and exits—ideal for quick Q&A and script calls:
# One-shot question: pass a file and have the assistant analyze itaic "Explain the approach behind the implementation of src/utils/date.js"# Piped input: feed command output to the assistant for analysisnpm test 2>&1 | aic "Analyze why the tests failed and suggest fixes"# Chained commands: check first, then generate a commit message based on the resultaic "Check whether there are any unhandled exceptions in the code" && aic "Generate a commit message based on this change"
It also helps to set an alias for the launch command to reduce repetitive typing:
# After adding this to ~/.bashrc or ~/.zshrc, run source ~/.zshrc to apply italias aic='aic --model sonnet'
2. Model Selection: Match Compute to Task Complexity
Different models make different trade-offs in reasoning depth, response speed, and cost. Most mainstream AI assistants let you specify a model through a parameter, for example --model. Choosing the right tier is the first step toward balancing quality and cost:
# Everyday development: balance capability and speedaic --model sonnet# Hard problems: architecture design, complex debugging, and other deep-reasoning scenariosaic --model opus# Simple tasks: renaming variables, generating comments, format conversionaic --model haiku
| Model tier | Characteristics | Recommended scenarios |
|---|---|---|
| Fast tier | Fast response, low cost | Simple Q&A, code explanation, comments and doc generation |
| Balanced tier | Balanced capability and speed | Everyday coding, debugging, unit test writing |
| Deep tier | Stronger reasoning | Architecture design, cross-file refactoring, hard problem diagnosis |
A few practical tips:
- Don’t use the deep tier the whole time: fast tier is enough for simple tasks; switch to deep tier only for complex reasoning, which keeps a balance between quality and cost.
- Factor in billing and usage rules: some AI assistants support
--fallback-model, which automatically switches to a backup model when the primary model is unavailable or rate-limited. For team use, evaluate overall cost against the provider’s billing and rate-limit policies. - Models can be switched mid-session: some tools support switching models within a session (e.g., the
/modelinteractive command) without restarting the session. - Cloud access needs authentication configured: when calling model services through a cloud platform, you usually need to set access credentials in environment variables or a configuration file; follow the documentation of the platform you use.
3. Session Resume: Pick Up Where You Left Off
A half-fixed bug or a multi-day refactor often means re-explaining the background from scratch when you start a new session. Session resume lets the assistant “continue the previous conversation”:
# List past sessions and select one interactively, restoring full contextaic --resume# Directly resume the most recent session in the current directoryaic --continue# Combine them: specify a model and resume the most recent sessionaic --continue --model sonnet
Two things to keep in mind:
- Directory association: sessions are usually tied to the working directory at launch, so switch back to the original project directory before resuming.
- Converge promptly: a long-running history session may carry a lot of irrelevant content; if you notice the assistant “mixing things up” after resuming, compact or clear the context before continuing.
3. Context Governance: Help the AI Truly Understand Your Project
In terms of experience, context is the single most important factor in the quality of an AI assistant’s output. Context is all the information the model can read during a task—conversation history, file contents, command output, and project descriptions. Its capacity is limited, and both too much and too little information hurt results.
4. Help Command: The Most Reliable Reference for Parameters and Usage
AI assistants evolve fast, and parameters and commands change across versions. Online tutorials may be outdated; the most reliable reference is always the help output of the version installed on your machine:
aic --help # View all command-line parameters and subcommandsaic --version # View the version number, commonly used when troubleshootingaic config --help # View the usage of a specific subcommandaic doctor # Provided by some tools: check installation and configuration health
When you encounter an unfamiliar parameter, run --help before acting—it saves a lot of trial and error.
5. Context Initialization: Let the AI Read the Project in One Pass
This is the interactive command beginners should learn first. In an interactive session, type /init, and the AI assistant analyzes the codebase—for example the tech stack, directory structure, and build and test methods—and generates a project context file (typically a Markdown file such as AGENTS.md in the project root). From then on, every new session reads this file automatically.
/init
After initialization, review it manually and add team conventions, for example:
# Project Context## Tech Stack- Backend: Java 17 + Spring Boot 3.x- Frontend: TypeScript + React 18- Build tools: Maven (backend) / Vite (frontend)## Common Commands- Install dependencies: mvn -B dependency:go-offline- Run tests: mvn test- Lint: mvn checkstyle:check## Conventions- All public interfaces must have unit tests- New configuration items must be reflected in the README configuration section- Never log sensitive information directly in business code
This brings three benefits:
- Less repetition: no need to introduce the project background every time.
- Constrained behavior: clear conventions reduce changes that violate team standards.
- Easy to share across the team: the file can be version-controlled so everyone shares the same context.
6. Clear Context: Draw a Line Around the Conversation
The longer you chat, the more bloated the context. Three common problems appear: early instructions get forgotten, information from different tasks interferes with each other, and requests slow down while usage rises.
/clear
After running /clear, the current conversation memory is wiped—effectively starting over in a clean context. The best practice is “one task, one session”: clear promptly when you finish or switch tasks, and persist any key conclusions in written form into the project context file or a task record.
7. Context Compaction: “Repack the Bags” Mid-Task
Some tasks can’t be wrapped up midway, such as a large refactor spanning dozens of files. Here you can compact the context first: the AI assistant summarizes the current conversation into a concise summary, keeping key conclusions and to-dos, then continues on that basis.
# Compact the current session context/compact# Compact while keeping key points/compact keep the database schema changes and the three interfaces that are not yet done
Compaction is a form of “selective forgetting”: it discards procedural details and keeps core conclusions, so you control context usage without losing task continuity.
8. Custom Memory: Retain Long-Term Preferences Across Sessions
Clearing and compacting solve the memory problem within a single session. To retain long-term personal preferences or team standards, use the memory command (such as /memory) to maintain a memory file. A memory file in the user’s home directory applies to all projects, while a context file in the project root applies only to the current project.
For example, you can write the following in the user-level memory file:
- Answer in Chinese, with code comments in Chinese- Give the conclusion first, then the reasoning- Follow standard Java naming conventions in sample code
In practice, keep a clear division of responsibilities:
- Project context file: records project facts such as tech stack, directory structure, and build commands, evolving with the project.
- User memory file: records personal preferences and general habits, applying across projects.
Following the principle of “clear within a session, persist long-term in files” keeps context within a controllable and effective range.
4. Safe and Controllable: Make Changes Predictable
9. Permission Modes: “Read-Only” for Exploration, “Go” for Changes
An AI assistant can read and write files and run commands; the stronger the capability, the more it needs clear boundaries. The permission-mode parameter (such as --permission-mode) decides whether it needs human confirmation before performing an action:
| Permission mode | Behavior | Suitable stage |
|---|---|---|
| Default mode | Requests confirmation for sensitive operations before executing | Everyday development |
| Auto-accept edits | File edits applied automatically; commands still need confirmation | Small, well-defined changes |
| Plan mode | Analyzes and produces a plan first, then implements after confirmation | Exploration, solution design |
| Skip confirmation | No longer requests confirmation (not recommended for beginners) | Isolated experimental environments only |
Use a “read first, then write” rhythm:
# Stage one: only let it read code and propose a planaic --permission-mode plan "Analyze the login module and propose a refactoring plan"# Stage two: allow file edits after the plan is confirmedaic --permission-mode acceptEdits "Implement the refactoring according to the plan"
Some AI assistants also support maintaining allow and deny lists through a configuration file. For example, adding production configuration file paths or the directory holding key files to the deny list prevents accidental changes at the mechanism level.
Whatever permission mode you use, hold two bottom lines:
- Version control as a safety net: ensure the working tree is clean before making changes, create a new branch if needed, and use diff review to inspect each change afterward.
- Deny list as a safety net: add sensitive paths to the deny list so you don’t rely solely on human confirmation as the “last line of defense.”
5. Automation Integration: Bring the AI into the Pipeline
10. Non-Interactive Calls and Help Queries: Put It in Scripts and CI
Running one task smoothly doesn’t mean it can scale. To fold the AI assistant into daily workflows, you need non-interactive mode and its companion parameters:
# Output JSON: easy for programs to parse, reducing the instability of parsing textaic -p "Check the code for security issues, sorted by severity" --output-format json# Limit the maximum number of tool-call rounds to avoid automation running indefinitelyaic -p "Analyze failing cases and suggest fixes" --max-turns 10# Append a system prompt to constrain the tone and format of the outputaic -p "Generate doc comments for the following function" --append-system-prompt "Output only the comment code, no explanation"# Print usage statistics for this session on exit (parameter name per the actual version)aic --usage
Here -p (i.e., --print) means print the result once and exit, and --output-format json returns the result as structured data. That way, a downstream program can read fields such as status, elapsed time, and usage directly, without parsing natural-language text.
In a CI pipeline, you can pass the change content as input and let it do an initial review automatically:
# In CI: hand the diff to the assistant for an initial reviewaic -p "Review whether the following changes lack exception handling or unit tests; output only a list of issues" \--allowedTools "Read,Grep" \< changes.diff > review.json
6. Quick Reference for the Ten Commands
| # | Command (illustrative) | Core purpose | Typical scenario |
|---|---|---|---|
| 1 | Launch command / -p |
Enter an interactive session or run once | Everyday development, quick Q&A |
| 2 | --model |
Specify the model tier | Balance cost and quality by complexity |
| 3 | --resume / --continue |
Resume a past session | Multi-day tasks, continued bug fixes |
| 4 | --help |
View parameters and usage | Look up usage, troubleshoot |
| 5 | /init |
Scan the project and generate a context file | Project setup, onboarding new members |
| 6 | /clear |
Clear conversation memory | Switch tasks, tangled conversation |
| 7 | /compact |
Compress a long conversation into a summary | Large refactors, long sessions |
| 8 | /memory |
Maintain cross-session memory | Fix personal preferences and team standards |
| 9 | --permission-mode |
Control the operation-confirmation policy | Exploration, safe changes |
| 10 | -p + --output-format |
Non-interactive run, structured output | Script and CI integration |
In practice, these commands are often combined. A complete development loop can be strung together like this:
1. /init establish project context2. --permission-mode plan have the assistant analyze first, then act3. /compact stage-wise context compaction during long tasks4. /clear wrap up the task and clear the conversation5. -p --output-format json trigger a check or review from a script
7. Conclusion: From “Using It” to “Using It Well”
These ten commands boil down to four principles:
- Manage sessions: launch, resume, clear, and compact so every conversation has a clear goal and boundary.
- Govern context: keep the initialization, memory, and convention files with distinct responsibilities so the AI reliably “understands the project.”
- Keep changes controllable: use permission modes to draw read/write boundaries, with version control and deny lists as safety nets.
- Integrate into the workflow: use non-interactive calls and structured output to upgrade the AI from a “chat tool” to a “pipeline stage.”
It’s worth stressing that commands solve “how to use it well”; code quality and architecture decisions still need a developer’s judgment. Real efficiency gains come from treating the AI assistant as a “pair partner” that you brief clearly and bound explicitly, and managing it with a unified context convention.
Many intelligent coding tools support connecting custom models through interfaces or extension mechanisms. When choosing tools, many enterprises prioritize large-model services from cloud platforms such as Baidu AI Cloud, valuing their unified authentication system, comprehensive logging and monitoring capabilities, and integration with cloud products like object storage and message queues. After embedding an AI assistant into the development workflow, it’s also advisable to bring call volume, latency, and success rate into the team’s unified observability system and continuously optimize cost and stability.
