Short answers to the questions that come up after the first session. Each answer names the page or source file that owns the behavior. When an answer stops working, the symptom-first fixes are in TROUBLESHOOTING.md.
No. With no provider configured, the TUI and -p both answer from the offline
EchoProvider, which quotes your prompt back (src/Cli/LaunchContext.php:2198).
TUTORIAL.md walks that first run.
Eleven built-in type keys, listed under CANDY_CODE_PROVIDER in
ENVIRONMENT.md, plus any provider the shipped
.candy-code/config.dev.json declares (dev-sglang in this repository's copy).
candy-code models prints the same providers with each one's default model,
and marks the one this install has selected.
Every provider is built in src/Providers/ProviderFactory.php.
No provider is selected for that run. candy-code doctor reports
WARN provider in that state. The selection order is the environment variable
first, then the provider saved by a previous model switch
(src/Cli/LaunchContext.php:2268). If CANDY_CODE_PROVIDER is set but the
provider cannot be constructed, the run also falls back to echo
(src/Cli/LaunchContext.php:2198). candy-code models shows which provider
the run selected.
To the provider you select, plus whichever network tools you enable. WebSearch
sends its model-composed queries, which often quote code, to the backend named by
webSearchBackend. With the default searxng backend that is the endpoint in
CANDY_CODE_SEARCH_ENDPOINT. The hosted brave, tavily and exa backends dial
their own fixed service hosts, and the anthropic backend runs the search inside your
Anthropic request. WebFetch sends its model-composed URLs to the host they name. MCP servers
you trust receive their tool arguments, and Bash commands can reach the network. The
echo provider contains no HTTP client code, so a run without a configured provider
sends no code or prompts. The egress notes for each tool are in
ENVIRONMENT.md.
Two background GETs run at launch, and neither carries your prompts, code or a
credential. The first refreshes LiteLLM's model database from
raw.githubusercontent.com, on every install type; CANDY_CODE_DISABLE_MODEL_METADATA=1
stops it. The second is phar-only: one GET a day to the GitHub release list for the
"update available" notice, which CANDY_CODE_NO_UPDATE_CHECK=1 stops. The shipped
dev-sglang block in config.dev.json sends no API key, and this repository does not
say who operates its endpoint, so do not use it for private code. The details are in
ENVIRONMENT.md.
Under ~/.candy-code/. config.json holds settings and any saved key,
session.db holds sessions, transcripts and checkpoints
(src/Cli/Bootstrap.php:10345), and logs/candy-code.log holds the TUI's
error log (src/Diagnostics/TuiErrorLog.php:73). Project settings live in
<project>/.candy-code/.
Yes. Implement src/Providers/ProviderInterface.php or use custom, and see
ADDING_A_PROVIDER.md for the contract. sglang is the
type for a model server you run yourself.
The TUI starts in default mode, where a tool call that the gate does not
already allow waits for your reply (src/Permissions/PermissionMode.php:13).
The six modes and the rules that override them are in
PERMISSIONS.md.
An unattended run has no one to answer a prompt. Each call that would ask is
refused, and the refusal is written to stderr
(src/Cli/HeadlessPermissionPrompt.php:483). Pass --permission-mode to
change the mode. Use bypass-permissions only for a prompt you trust, because
it runs everything.
Start with default. accept-edits runs Edit, Write and NotebookEdit
without asking, but only for a file strictly inside the project root and not
under .git, .candy-code or .mcp.json (Permissions\WritePathScope, as
PERMISSIONS.md describes). auto hands risky
calls to SafetyClassifier before they run. The full table, with the cost of
each mode, is in PERMISSIONS.md.
It runs at once, without a prompt, and its output goes into the transcript. The
command is yours, so it starts no turn and costs nothing until your next prompt
(src/Commands/BangShell.php, class doc). The policy you configured still
applies.
/commit commits every changed file, not only the ones the agent touched
(COMMANDS.md, /commit). Run /diff before you commit.
A project's MCP servers start only after you trust that project. The trust
decision is per project root, through trustedProjectMcp, and it records each
server's command, arguments and environment. candy-code mcp list shows the
servers without starting any of them, and candy-code mcp trust approves the
file as it stands (candy-code --help). A later change to a server's command,
arguments or environment is refused until you approve it again
(src/MCP/McpTrustPins.php:44-48). The full model is in MCP.md.
Hooks in <root>/.candy-code/hooks.yaml load only when you have trusted that
project. The trustedProjectHooks key controls it (src/Config/LayeredSettings.php:112,
src/Hooks/HookManager.php:141). Your own ~/.candy-code/hooks.yaml is read
without that check. The hook events and exit codes are in HOOKS.md.
Not unless you trust that project. A project's settings file is ignored until the
project root is listed under trustedProjectSettings (src/Config/LayeredSettings.php:234),
a grant recorded in your user config.json. Once trusted, the file can fill in only
what your own files leave unset, so a trusted clone cannot override a value you chose
(src/Config/LayeredSettings.php, class doc). The trust keys
(trustedProject*) cannot be written from a lower layer at all
(src/Config/LayeredSettings.php:109-118).
In ~/.candy-code/config.json, as plain text, unless you saved it with
candy-code login --keychain, which keeps it in the OS keychain and writes only a
reference. The file is written at mode 0600, so only your user can read it
(src/Cli/Bootstrap.php:5159).
Anything that can read files as you can read the key too, including backups and
dotfile sync. The full list of stored secrets is in
SECURITY.md.
/undo takes back the last turn, or reverts the last auto-commit. /rewind
restores an earlier checkpoint, and /redo steps forward again
(COMMANDS.md). In a git repository, checkpoints are built with git
(src/Workspace/WorkspaceCheckpointer.php:18-27). A project outside one is
snapshotted into a shadow repository beside session.db
(src/Workspace/WorkspaceCheckpointer.php:30-33), so /rewind --files still has
a point to restore. Two cases have none. Your home directory and its Desktop,
Documents and Downloads folders are refused (src/Workspace/WorkspaceCheckpointer.php:42-46,
:176-202), and a session store kept only in memory keeps no shadow repository
(src/Session/EnhancedSessionStore.php:1361-1363, src/Workspace/WorkspaceCheckpointer.php:539-541).
/rewind --files says why there is nothing to restore in either case
(src/Workspace/WorkspaceCheckpointer.php:48-53). The agent's edits are written
to disk either way.
candy-code session list lists the stored sessions, pinned first. /sessions
opens the same list inside the TUI. candy-code -c continues the most recent
one, and candy-code --resume <id> reopens a named one (candy-code --help).
candy-code session pin <target>. A pinned session is listed first and never
pruned (candy-code --help). candy-code gc inspects and reclaims session
storage. Run it with no action to list the actions it offers (candy-code --help).
Use --max-cost <amount> at launch, or /budget <amount> inside a session.
/budget off removes the cap, and /budget alone shows the reported spend
(COMMANDS.md, /budget).
Yes, with -p and --output-format json. The JSON envelope is one document on
the last line, with schema: 1 (src/Cli/NonInteractive.php:84). The exit
codes are 0, 1 and 2, and the CI page covers the fork-PR and
prompt-injection rules (CI.md).
Only with --allow-remote. The server binds 127.0.0.1 by default
(src/Server/ServerConfig.php:27). Any other bind address is refused unless
--allow-remote is given (src/Server/ServerConfig.php:753). Put TLS in front
of it, as the refusal message says. Also set --allowed-ips to narrow who may
connect, because an empty list admits every address beside loopback
(src/Server/ServerConfig.php:115). The full model is in SERVER.md.
Because both modes answer every permission ask without a human: bypass-permissions
approves it, and dont-ask refuses it. The server refuses either mode unless you
pass --allow-bypass or set server.allowBypass
(src/Server/ServerConfig.php:262-305, and the check at :677).
candy-code self-update downloads the phar, checks it against the pinned
Ed25519 key (src/Cli/SelfUpdate.php:75), and refuses a payload that does not
verify. A build with an empty key constant is keyless, and binds its bytes only
through the SHA-256 sidecar (src/Cli/SelfUpdate.php:70-75). The dev/test-only
--allow-unsigned flag is the one exception: it skips the signature check for
that run, removing the signature protection, while the SHA-256 sidecar still
applies. The root policy
describes the release channels in
SECURITY.md.
- GLOSSARY.md for the terms used above.
- TROUBLESHOOTING.md for error messages and their fixes.
- SECURITY.md for the trust model behind the permission answers.