Projects, permissions, and context
How the cruxy CLI scopes work to a project, what asks for your approval, what stays on your machine, and what it sends to the Cruxy API.
The CLI works inside one project directory, reads it through a fixed set of tools, and asks before it changes anything. The sections below cover each part of that, and list exactly what leaves your machine on each request.
The project root
The directory you start cruxy in is the project root. File tools resolve
every path against it and refuse a path that leaves it, whether through ../,
an absolute path elsewhere, or a symlink that points outside. A refused path
fails with CRUXY_E_PATH_ESCAPE. Shell commands run with the project root as
their working directory.
To work across more than one directory, declare each as a root:
cruxy run --root api=../api --root web=../web "rename the shared User type"The first root is the primary one. Reads search every root. Writes reach every
root when checkpoints are on, each root with its own checkpoint, and only the
primary root when they are off. MCP servers load from the primary root only.
In a session, /add-root <name> <path> checks a new root and prints the
--root flag to relaunch with; the root becomes active only after you
relaunch, and it starts untrusted.
Project instructions
The CLI reads CRUXY.md from the project root into every turn, or AGENTS.md
when there is no CRUXY.md. It reads the first 32 KB and marks the rest as
truncated. It does not look in parent directories for these files.
cruxy init and /init write a starter CRUXY.md, and /reload re-reads it
in a running session.
How it reads the codebase
The agent reads through tools. These are available by default:
| Tool | Does |
|---|---|
read_file, list_files, glob | Read a file, list a directory, match paths. |
grep_files | Search file contents. |
git_status | Read the repository's status. |
search_codebase | Semantic search over the local index. |
list_skills, load_skill | Find and load skills. |
write_file, edit_file, apply_patch | Change files. tools.fileEdit: false removes all three. |
run_command, run_tests | Run shell commands and tests. tools.shell: false removes both. |
create_pull_request | Open a pull request. |
Some tools exist only when you turn them on: remember with local memory (on
by default), the language-server tools with lsp.enabled, web_search and
web_fetch with web.enabled, MCP server tools with mcp.enabled and a
trusted server, spawn_subagent and spawn_subagents while
subagent.maxDepth is above 0 (it is 1 by default), and
run_in_background with jobs.enabled.
Semantic search
search_codebase reads from a local index that the CLI builds on your machine:
- Embeddings are computed locally. The embedding runtime is not part of the
install:
cruxy index --installdownloads it into~/.cruxy/runtime/embedderafter telling you what it fetches, and the model is downloaded fromhuggingface.coonce and cached in~/.cruxy/models. - The index lives in the project, at
.cruxy/index.db, on Node.js 22.13 or later. On older Node.js it is kept in memory for the session. - It skips files you would not want indexed: anything matched by
.gitignoreor.cruxyignore, the.git,node_modules, and.cruxydirectories, binary files, files overindex.maxFileBytes(1 MB), and secret-bearing files such as.env*, SSH private keys,.pemand.keyfiles,.npmrc,.netrc, and.aws/credentials.
The secret-file rule applies to the index and to checkpoints. It does not stop
read_file: a file the agent reads is sent to the API like any other tool
result.
Permissions
Every action that changes something passes one approval gate before it runs, and the gate fails closed.
- Read-only tools never ask.
- File writes, edits, and patches show a diff preview and ask. A patch that deletes a file is marked destructive.
- Shell commands and test runs show the command and ask.
- Pull requests, rollbacks, and MCP tool calls show what will happen and ask.
- Without a terminal, the gate cannot ask, so the first such action ends the
run with
CRUXY_E_APPROVAL_REQUIREDand exit10. It never approves on its own.
At a prompt, a grants a standing permission for the rest of the session. The
grant is narrow: for a shell command or test run, the same command in the same
root; for a file change, the common directory of the changed files, or the one
file when it sits directly in the project root. Some actions offer no standing
grant, such as a command that uses shell operators. Irreversible actions, MCP
calls among them, cannot be granted and always ask. /permissions lists what now runs
without asking, and /permissions revoke <n> drops one.
Irreversible actions
An action the run's checkpoint cannot undo is marked irreversible, and it always asks, in every mode. That includes:
- Commands that reach beyond the working tree, such as
curl,wget,ssh,scp,rsync,npx,bunx,pnpx,gh,docker,kubectl,terraform, and theaws,gcloud, andazCLIs. - Commands that run with other privileges or change the machine, such as
sudo,su,systemctl,shutdown, anddd. - Any
gitcommand except read-only ones such asstatus,diff,log, andshow, because the checkpoint does not capture refs, the index, or the stash. - Package-manager commands other than
runandtest, such asnpm installorpnpm add. - Commands that change what a snapshot does not record, such as
chmod,chown, andln. - Commands with a path argument that resolves outside the project root.
- Commands that use shell features the CLI cannot analyze.
- File writes, edits, and patches the checkpoint cannot restore: secret-bearing
files, anything under the project root's
.git/,node_modules/, or.cruxy/,*.tfstate, local database files,*.local.*files, targets outside the project root, and changes with no target the CLI can resolve. - Opening a pull request, MCP tool calls, and rollbacks.
Session modes
The mode sets how much runs without asking. Shift+Tab cycles through the modes
in the full-screen session, and /mode <name> sets one. cruxy run --plan, or
agent.planMode: true, starts in plan.
| Mode | What it does |
|---|---|
manual | Every action asks first. The default. |
auto-approve | Reversible actions run without asking. Irreversible ones still ask. |
plan | The agent proposes a plan for your approval, then asks before each action. |
full-auto | The agent proposes a plan, then runs it without asking. Irreversible actions still ask. |
There is no flag or config key that starts a new session in auto-approve or
full-auto, and approval.mode accepts only prompt. A session resumed with
--resume comes back in the last mode you switched to during it.
Checkpoints and rollback
Before a turn's first approved change (a file change, shell command, test run,
or pull request), the CLI snapshots the working tree, leaving
out gitignored files and the secret-bearing files listed above. Each
checkpoint's record lives in .cruxy/checkpoints. In a git repository the file
contents go into git's object database without touching your branch, index, or
stash; elsewhere they are copied into .cruxy/checkpoints too.
cruxy rollback and /undo-last restore a snapshot after showing you what will
change. A checkpoint covers working-tree files only: commits, pushes, and pull
requests made during a run stay.
Sandbox
cruxy run --sandbox, or sandbox.enabled: true, runs shell and test commands
in a container through Docker, with no network by default
(sandbox.network: none). If the container runtime is not available, the run
fails with CRUXY_E_SANDBOX_UNAVAILABLE rather than running on your machine.
Hooks, MCP servers, and project memory
A repository can carry hooks, MCP server config, and project memory written by
someone else, so none of them runs until you trust it for that repository:
cruxy hooks trust <path>, cruxy mcp trust, and cruxy memory trust. Trust
decisions are stored in ~/.cruxy, never in the repository, so a clone carries
none. Hooks, MCP, and web access are off by default.
An MCP server you trust runs its code on your machine with your full privileges, and is not sandboxed. A changed MCP config must be trusted again, and each of its tool calls still asks for approval.
What it sends to the Cruxy API
Every request goes to cruxy.gatewayUrl, by default https://api.cruxy.ai.
| Request | When |
|---|---|
POST /api/v2/chat | Every model turn. Also when the CLI compacts history, writes commit and pull request text, and checks a key pasted into cruxy login --paste. |
GET /api/v1/limits | At the start of each turn, in the background, to keep the session's budget current; after a successful reading, at most once every 15 seconds. Also for cruxy limits. |
POST /api/v1/device/code, POST /api/v1/device/token | During device login. |
DELETE /api/v1/me/key | cruxy logout, to revoke the saved credential. |
Each chat request carries these headers: Authorization: Bearer <key>,
Cruxy-Client: cli/<version>, Cruxy-Version: 2026-09-26, and an
Idempotency-Key that is new for each request and the same on its retries.
Its body has model, messages, stream: true, max_tokens (from
model.maxTokens), temperature (from model.temperature), tools, and the
memory and rules fields described in
Gateway memory and rules. It sends no vault
fields.
messages holds:
- A system prompt with the CLI's operating instructions; your working
directory's absolute path, platform, today's date, and the model; the git
branch and whether it has uncommitted changes; the names of the available
tools; your
CRUXY.mdorAGENTS.md; and any recalled local memory. - The conversation: your messages, the model's replies, and every tool call
with its result. Tool results include the contents of files the agent read,
search results, and command output up to
shell.maxOutputBytes.
tools holds the name, description, and parameter schema of each available
tool, including MCP server tools.
Once the conversation passes context.compactThreshold of context.maxTokens,
the CLI sends the older part in a separate chat request to be summarized, and
replaces it with the summary. /compact does the same on demand.
The CLI does not mask secrets before sending them; it only keeps them out of
gateway memory capture, as described in
Gateway memory and rules. If one lands in the
conversation, /redact masks the secrets it recognizes so later requests no
longer carry them. It does not change requests already sent, or the session log
on disk.
Gateway memory and rules
The gateway can recall your saved memory into a turn, capture new memory from it, and add your organization's standing rules to it. The CLI states all three on every chat request in a session, so what happens follows your config and not the kind of key you use:
| Setting | Default | Sent as |
|---|---|---|
cruxy.memory.recall | true | memory.recall |
cruxy.memory.capture | false | memory.capture |
cruxy.rules | true | rules |
Capture is off by default in coding sessions, because a coding turn carries
whatever the agent read: file contents, command output, and search results.
For one run, --no-memory turns recall and capture off, and
--memory-capture turns capture on with recall as configured. Both flags work
on cruxy and cruxy run, and passing both fails with CRUXY_E_USAGE. The
run header prints the result as gateway: memory recall on, capture off; rules on, and /status shows the same.
With capture on, a request is still sent with capture off when it carries a
secret: a secret-named path in a tool call, such as .env*, SSH private keys,
*.pem, *.key, .npmrc, .netrc, .pgpass, or .aws/credentials, or
secret-shaped content anywhere in the request, such as a private key, a provider
token, a JWT, or secret = <long value>. The whole request is checked, so
capture stays off until /clear, compaction, or /redact removes the secret.
This check is a backstop: it catches known names and shapes, not every secret.
Recall is not affected.
Some requests send memory off whatever the config says: history compaction,
commit and pull request text, and the key check in cruxy login --paste.
Every chat request pins Cruxy-Version: 2026-09-26. A gateway too old to honor
memory.capture: false refuses the pinned request instead of capturing. See
Memory and Standing rules for
what each feature does.
Other places it connects to
| Destination | When |
|---|---|
| The npm registry | cruxy index --install, through your npm config. |
huggingface.co | The first time semantic search needs the embedding model. |
| GitHub's API and your git remote | cruxy pr and create_pull_request, which push a branch and open the pull request. |
| Tavily | web_search, when web.enabled is on. |
| The page being fetched | web_fetch, when web.enabled is on. Private and loopback hosts are refused unless web.allowPrivateHosts is on. |
| Your MCP servers | When mcp.enabled is on and you trust them. |
What stays on your machine
| What | Where |
|---|---|
| Your credential | ~/.cruxy/credentials.json, owner-only. |
| Global config | ~/.cruxy/config.json. |
| Session logs | ~/.cruxy/projects/, one folder per project, pruned by sessions.retention and sessions.maxAgeDays. |
| Usage records | ~/.cruxy/usage/runs.json. They are never sent anywhere. |
| Local memory | ~/.cruxy/memory/entries.json for you, and .cruxy/memory/entries.json in the project. |
| Trust decisions | ~/.cruxy/trust.json, ~/.cruxy/memory-trust.json, and ~/.cruxy/mcp-trust.json. |
| Codebase index | .cruxy/index.db in the project. |
| Checkpoints | .cruxy/checkpoints in the project, with file contents in git's object database inside a git repository. |
| Embedding runtime and model | ~/.cruxy/runtime/embedder and ~/.cruxy/models. |
Local memory
The CLI keeps its own memory, separate from the gateway's. The agent saves a
note with the remember tool, and the CLI refuses a note that looks like a
secret. At the start of a session it adds the saved notes to the system prompt,
up to memory.maxRecallTokens. Notes in your user scope are recalled in every
project. Notes in a project's .cruxy/memory are recalled only after you run
cruxy memory trust, because a cloned repository can bring them.
cruxy memory list, cruxy memory forget <id>, and cruxy memory clear
manage these local notes. They do not touch the gateway's memory; see
Gateway memory and rules.