CLI Reference
Complete command reference for cx.
cx
USAGE cx [command]
COMMANDS completion Generate the autocompletion script for the specified shell diff Compare the current context with a named rule set edit Open the rules file in your editor or print its path fix Automatically fix context validation issues from-cmd Generate context from a shell command’s output from-git Generate context based on git history generate Generate .grove/context from .grove/context-files list List files in context list-cache List cached cold context files repo Manage Git repositories used in context reset Reset the rules file to project defaults resolve Resolve a single rule pattern to a list of files rules Manage and switch between different context rule sets set-rules Set the active rules from an external file show Print the entire context file stats Provide detailed analysis of context composition validate Verify context file integrity and accessibility version Print the version information for this binary view Display an interactive visualization of context composition workspace Interact with discovered workspaces write-rules Write the current active rules to a file
Flags: -c/—config, —cpu-profile, -h/—help, —json, —mem-profile, —timing, -v/—verbose
Use “cx [command] —help” for more information.
cx diff
Compare the current context with a named rule set from .cx/ or .cx.work/ to see added/removed files, token count changes, and size differences.
USAGE cx diff [ruleset-name] [flags]
FLAGS -h, —help help for diff
cx edit
Opens .grove/rules in your system’s default editor (specified by $EDITOR environment variable), or prints the path if —print-path is used.
USAGE cx edit [flags]
FLAGS -h, —help help for edit —print-path Print the absolute path to the rules file instead of opening it
cx fix
Remove missing files and duplicates from the context file list.
USAGE cx fix [flags]
FLAGS -h, —help help for fix
cx generate
Reads the .grove/context-files list and generates a concatenated .grove/context file with all specified files.
USAGE cx generate [flags]
FLAGS -h, —help help for generate —xml Use XML-style delimiters (default: true) (default: true)
cx list
Lists the absolute paths of all files in the context.
USAGE cx list [flags]
FLAGS -h, —help help for list
cx repo
Commands for managing Git repositories that are cloned and used in grove context.
USAGE cx repo [command]
COMMANDS add Add and clone a new repository to be tracked audit Perform an interactive LLM-based security audit for a repository list List all tracked repositories rules Manage rulesets for a cloned repository sync Sync all tracked repositories
Flags: -h/—help
Use “cx repo [command] —help” for more information.
cx repo add
Clones a new Git repository, adds it to the manifest, and creates a worktree to make it available for context. You can pin the repository to a specific version (branch, tag, or commit hash) by appending @version. If no version is specified, it will use the repository’s default branch. GitHub repositories can be specified using the shorthand ‘owner/repo’.
USAGE cx repo add <url>[@version] [flags]
FLAGS -h, —help help for add
EXAMPLES cx repo add my-org/my-repo cx repo add https://github.com/my-org/[email protected] cx repo add [email protected]:my-org/my-repo.git@main
cx repo audit
Initiates an interactive workflow to audit a repository at a specific version. This creates a worktree, allows context refinement via ‘cx view’, runs an LLM analysis for security vulnerabilities, and prompts for approval to update the manifest.
USAGE cx repo audit <url>[@version] [flags]
FLAGS -h, —help help for audit —status Update audit status without running the full audit
cx repo list
List all Git repositories that have been cloned and are tracked in the manifest.
USAGE cx repo list [flags]
FLAGS -h, —help help for list —json Output in JSON format
cx repo rules
Create, edit, list, and remove rulesets for external Git repositories.
USAGE cx repo rules [command]
COMMANDS edit Create or edit a ruleset for a repository
Flags: -h/—help
Use “cx repo rules [command] —help” for more information.
cx repo rules edit
Creates or opens a rules file for a cloned repository in your default editor. The rules file is stored within the repository’s local clone at .cx.work/<ruleset-name>.rules. If no ruleset name is provided, it defaults to ‘default’.
USAGE cx repo rules edit <url>[@version] [ruleset-name] [flags]
FLAGS -h, —help help for edit
EXAMPLES cx repo rules edit my-org/my-repo cx repo rules edit https://github.com/my-org/[email protected] my-feature-rules
cx repo sync
Fetch the latest changes for all tracked repositories and checkout their pinned versions.
USAGE cx repo sync [flags]
FLAGS -h, —help help for sync
cx reset
Resets the .grove/rules file to the default rules defined in grove.yml. If no default is configured, creates a basic rules file with sensible defaults.
USAGE cx reset [flags]
FLAGS -f, —force Reset without confirmation prompt -h, —help help for reset
cx resolve
Accepts a single inclusion rule (glob or alias) and prints the list of files it resolves to. Primarily for use by editor integrations.
USAGE cx resolve [rule] [flags]
FLAGS -h, —help help for resolve —line-number Line number in rules file (1-indexed) for context-aware resolution (default: 0) —rules-file Path to rules file for context-aware resolution
cx rules
Provides commands to list, set, and save named context rule sets stored in the .cx/ directory.
USAGE cx rules [flags] cx rules [command]
COMMANDS list List available rule sets load Copy a named set to .grove/rules as a modifiable working copy print-path Print the absolute path to the active rules file rm Remove a named rule set save Save active rules to a named set in .cx/ or .cx.work/ select Select the active rule set interactively set Set a named rule set as active (read-only) unset Unset the active rule set and fall back to .grove/rules
Flags: -h/—help
Use “cx rules [command] —help” for more information.
cx rules list
USAGE cx rules list [flags]
FLAGS —for-project List rule sets for a specific project alias -h, —help help for list —json Output results in JSON format
cx rules load
Copy a named rule set from .cx/ or .cx.work/ to .grove/rules. This creates a working copy that you can edit freely without affecting the original. The state is automatically unset so .grove/rules becomes active.
You can also provide a direct file path to a rules file (including plan-specific rules).
USAGE cx rules load <name-or-path> [flags]
FLAGS -h, —help help for load
EXAMPLES cx rules load default # Copy .cx/default.rules to .grove/rules cx rules load dev-no-tests # Copy from either .cx/ or .cx.work/ cx rules load /path/to/plan/rules/file.rules # Copy from absolute path
cx rules rm
Deletes a named rule set from .cx/ or .cx.work/. Rule sets in .cx/ are considered version-controlled and require the —force flag to delete. Rule sets in .cx.work/ can be deleted without force.
USAGE cx rules rm <name> [flags]
FLAGS -f, —force Force delete a version-controlled rule set from .cx/ -h, —help help for rm
cx rules save
Saves the currently active rules (from .grove/rules or another set) to a new named file. By default, saves to .cx/ for version-controlled rule sets. Use the —work flag to save to .cx.work/ for temporary, untracked sets.
USAGE cx rules save <name> [flags]
FLAGS -h, —help help for save -w, —work Save to .cx.work/ for temporary, untracked rule sets
cx rules select
USAGE cx rules select [flags]
FLAGS -h, —help help for select
cx rules set
Sets a named rule set from .cx/ or .cx.work/ as the active context source. This makes the context read-only from that file. To create a modifiable copy, use ‘cx rules load’.
You can also provide a direct file path to a rules file (including plan-specific rules).
USAGE cx rules set <name-or-path> [flags]
FLAGS -h, —help help for set
cx rules unset
USAGE cx rules unset [flags]
FLAGS -h, —help help for unset
cx show
Outputs the contents of .grove/context for piping to other applications.
USAGE cx show [flags]
FLAGS -h, —help help for show
cx stats
Show language breakdown by tokens/files, identify largest token consumers, and display token distribution statistics.
If a rules file path is provided, stats will be computed from that file. Otherwise, stats will be computed from the active rules file (.grove/rules).
USAGE cx stats [rules-file] [flags]
FLAGS —chat-file Provide token stats for a chat file and its context -h, —help help for stats —per-line Provide stats for each line in the rules file —top Number of largest files to show (default: 5)
EXAMPLES cx stats # Use active .grove/rules cx stats plans/my-plan/rules/job.rules # Use custom rules file
cx validate
Check all files in .grove/context-files exist, verify file permissions, detect duplicates, and report any issues.
USAGE cx validate [flags]
FLAGS -h, —help help for validate
cx version
USAGE cx version [flags]
FLAGS -h, —help help for version —json Output version information in JSON format
cx view
Launch an interactive terminal UI that shows which files are included, excluded, or ignored in your context based on rules and git ignore patterns.
USAGE cx view [flags]
FLAGS -h, —help help for view -p, —page The page to open on startup (tree, rules, stats, list) (default: tree)
cx workspace
List and manage workspaces (projects, ecosystems, worktrees) discovered by Grove.
USAGE cx workspace [command]
COMMANDS list List all discovered workspaces
Flags: -h/—help
Use “cx workspace [command] —help” for more information.
cx workspace list
Outputs a list of all projects, ecosystems, and worktrees discovered from your Grove configuration.
USAGE cx workspace list [flags]
FLAGS -h, —help help for list —json Output workspace information in JSON format