/session) saves the conversation history, context management (/context) saves the content of your working environment. It is the most powerful feature for those working on multiple projects or who frequently need to consult the same codebase.
A Context is a named “snapshot” of one or more files and directories, processed and saved to disk for reuse at any time.
The Lifecycle of a Context
Context usage follows a simple and powerful flow:Create (/context create)
You define a set of files and folders, process them with a specific mode (e.g.,
smart, chunked), and save the result with a name.Attach (/context attach)
You “attach” one or more saved contexts to your current conversation session.
Use
While attached, the context content is automatically sent to the AI with all your prompts, providing deep and continuous knowledge about your project.
Context Management Commands
Here are all the available subcommands for managing your contexts.create: Create a New Context
Creates and saves a new context from files and directories.
Syntax:
| Flag | Description |
|---|---|
--mode <mode> or -m | Defines how files will be processed. Modes: full, summary, chunked, or smart. |
--description <text> or -d | Adds a text description to help identify the context. |
--tags <tag1,tag2> or -t | Adds tags for easier filtering and organization. |
--force or -f | Overwrites an existing context with the same name. |
attach and detach: Attach and Detach from Session
These commands control which contexts are active in your current conversation.
| Command | Description |
|---|---|
/context attach <context-name> | Attaches a context to the session. |
/context detach <context-name> | Removes a context from the session. |
/context attached | Lists all currently attached contexts. |
Advanced Chunk Attachment
If a context was created with--mode=chunked, you can attach specific parts of it:
| Flag | Description |
|---|---|
--chunk <N> | Attaches only chunk number N. |
--chunks <N,M,...> | Attaches a list of specific chunks. |
--priority <num> | Defines the order in which attached contexts are sent (lower number = higher priority). |
list, show, and inspect: View Contexts
These commands help you understand what is in your saved contexts.
| Command | Description |
|---|---|
/context list | Lists all available contexts with basic metadata. |
/context show <name> | Displays detailed information about a context, including the complete list of files. |
/context inspect <name> | Provides a deep statistical analysis of the context, such as file type distribution, line counts, and chunk size analysis. Use --chunk N to inspect a specific chunk. |
Other Management Commands
/context delete <name>
/context delete <name>
Permanently deletes a context.
/context merge <new-name> <ctx1> <ctx2>
/context merge <new-name> <ctx1> <ctx2>
Combines multiple contexts into a new one, removing duplicate files.
/context export <name> <path.json>
/context export <name> <path.json>
Exports a context to a JSON file, making backup and sharing easier.
/context import <path.json>
/context import <path.json>
Imports a context from a JSON file.
/context metrics
/context metrics
Shows global statistics about all your contexts (total count, size, etc.).
/context help
/context help
Displays a help screen specific to context commands.
Next Steps
You now know the most powerful automation and context management features of ChatCLI. To wrap up, let’s document the features that ensure portability and tool integration in scripts.Non-Interactive Mode
Use ChatCLI in scripts, automations, and CI/CD pipelines.
Session Management
Save and restore complete conversation histories.