> ## Documentation Index
> Fetch the complete documentation index at: https://chatcli.edilsonfreitas.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Context (@ Commands)

> Learn how to use @file, @git, @command, and @env to give ChatCLI full awareness of your working environment.

The true power of **ChatCLI** lies in its ability to understand the context you are working in. The `@` commands collect information from your system and attach it to the prompt, enabling precise and relevant responses.

***

## `@file`: Code Context

The most essential command for developers. Sends file contents or the structure of entire directories for analysis.

```bash theme={"system"}
@file ./src/database/connection.go explain how the connection is made.
```

### Processing modes

<Tabs>
  <Tab title="full">
    **Scenario:** Deep analysis of a file or small component.

    Sends the complete content of all files, respecting a size limit.

    ```bash theme={"system"}
    @file db.go explain this query
    ```
  </Tab>

  <Tab title="summary">
    **Scenario:** Understanding the architecture of an unfamiliar project.

    Sends a file tree and metadata (sizes, types), **without** the code.

    ```bash theme={"system"}
    @file . give me an architecture overview
    ```
  </Tab>

  <Tab title="chunked">
    **Scenario:** Complete analysis of a large codebase.

    Splits the project into manageable chunks. Use `/nextchunk` to navigate.

    ```bash theme={"system"}
    @file . let's analyze this legacy project in parts
    ```
  </Tab>

  <Tab title="smart">
    **Scenario:** Specific question about a large project.

    The AI receives the file list and chooses which ones are most relevant to read.

    ```bash theme={"system"}
    @file ./src how does the authentication flow work?
    ```
  </Tab>
</Tabs>

<Info>
  Set the mode using the `--mode` flag. Example: `@file --mode=smart ./src`
</Info>

***

## `@command`: Bridge to the Terminal

Execute any shell command and use its output as context, and even add your question — without copy and paste, just use the `>` (GREATER THAN) sign.

| Without ChatCLI (before)                                      | With ChatCLI (now)                       |
| :------------------------------------------------------------ | :--------------------------------------- |
| Run command, redirect to file, open, copy, paste into browser | A single command with integrated context |

```bash theme={"system"}
@command kubectl get pods -n prod > why is the login pod in CrashLoopBackOff?
```

### Special flags

| Flag                                                              | Description                                                              |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `@command -i`                                                     | Interactive mode — for commands like `vim` or `ssh`                      |
| `@command --ai`                                                   | Sends the output directly to the AI, without an additional question      |
| `@command --ai <command> > <your question or additional context>` | Sends the output directly to the AI, with an additional question/context |

```bash theme={"system"}
@command --ai cat /var/log/nginx/error.log
```

***

## `@git`: Repository Context

Attaches the status (`git status -s`), branch, diffs of modified files, and the 5 most recent commits. Perfect for generating commit messages or summarizing changes.

```bash theme={"system"}
@git help me write a clear commit message for these changes.
```

***

## `@env`: Environment Variables

Adds the current environment variables to the conversation context.

<Warning>
  ChatCLI automatically detects and removes values of sensitive variables (such as `API_KEY`, `TOKEN`, `PASSWORD`), replacing them with `[REDACTED]`.
</Warning>

***

## Combining Commands

The real magic happens when you combine multiple context commands in a single prompt:

```bash theme={"system"}
@git @file ./src/main.go based on the recent changes, review this file and suggest improvements.
```

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Agent Mode" icon="robot" href="/core-concepts/agent-mode">
    Give ChatCLI "hands" — delegate tasks for it to execute.
  </Card>

  <Card title="Coder Mode" icon="code" href="/core-concepts/coder-mode">
    AI that reads, edits, and tests code in an automated loop.
  </Card>
</CardGroup>
