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:

    1. # Enter an interactive session
    2. aic

    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:

    1. # One-shot question: pass a file and have the assistant analyze it
    2. aic "Explain the approach behind the implementation of src/utils/date.js"
    3. # Piped input: feed command output to the assistant for analysis
    4. npm test 2>&1 | aic "Analyze why the tests failed and suggest fixes"
    5. # Chained commands: check first, then generate a commit message based on the result
    6. aic "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:

    1. # After adding this to ~/.bashrc or ~/.zshrc, run source ~/.zshrc to apply it
    2. alias 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:

    1. # Everyday development: balance capability and speed
    2. aic --model sonnet
    3. # Hard problems: architecture design, complex debugging, and other deep-reasoning scenarios
    4. aic --model opus
    5. # Simple tasks: renaming variables, generating comments, format conversion
    6. aic --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 /model interactive 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”:

    1. # List past sessions and select one interactively, restoring full context
    2. aic --resume
    3. # Directly resume the most recent session in the current directory
    4. aic --continue
    5. # Combine them: specify a model and resume the most recent session
    6. aic --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:

    1. aic --help # View all command-line parameters and subcommands
    2. aic --version # View the version number, commonly used when troubleshooting
    3. aic config --help # View the usage of a specific subcommand
    4. aic 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.

    1. /init

    After initialization, review it manually and add team conventions, for example:

    1. # Project Context
    2. ## Tech Stack
    3. - Backend: Java 17 + Spring Boot 3.x
    4. - Frontend: TypeScript + React 18
    5. - Build tools: Maven (backend) / Vite (frontend)
    6. ## Common Commands
    7. - Install dependencies: mvn -B dependency:go-offline
    8. - Run tests: mvn test
    9. - Lint: mvn checkstyle:check
    10. ## Conventions
    11. - All public interfaces must have unit tests
    12. - New configuration items must be reflected in the README configuration section
    13. - 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.

    1. /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.

    1. # Compact the current session context
    2. /compact
    3. # Compact while keeping key points
    4. /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:

    1. - Answer in Chinese, with code comments in Chinese
    2. - Give the conclusion first, then the reasoning
    3. - 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:

    1. # Stage one: only let it read code and propose a plan
    2. aic --permission-mode plan "Analyze the login module and propose a refactoring plan"
    3. # Stage two: allow file edits after the plan is confirmed
    4. aic --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:

    1. # Output JSON: easy for programs to parse, reducing the instability of parsing text
    2. aic -p "Check the code for security issues, sorted by severity" --output-format json
    3. # Limit the maximum number of tool-call rounds to avoid automation running indefinitely
    4. aic -p "Analyze failing cases and suggest fixes" --max-turns 10
    5. # Append a system prompt to constrain the tone and format of the output
    6. aic -p "Generate doc comments for the following function" --append-system-prompt "Output only the comment code, no explanation"
    7. # Print usage statistics for this session on exit (parameter name per the actual version)
    8. 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:

    1. # In CI: hand the diff to the assistant for an initial review
    2. aic -p "Review whether the following changes lack exception handling or unit tests; output only a list of issues" \
    3. --allowedTools "Read,Grep" \
    4. < 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. 1. /init establish project context
    2. 2. --permission-mode plan have the assistant analyze first, then act
    3. 3. /compact stage-wise context compaction during long tasks
    4. 4. /clear wrap up the task and clear the conversation
    5. 5. -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.