Configuration

Environment variables

Every KRAFT_* variable Kraft reads or sets, the other variables it reads, and the variables a worker's environment gets.

Variables you set

Set these in the shell that starts kraft, or in the service unit. kraft admin install-service copies KRAFT_HOME, KRAFT_RUN_DIR, KRAFT_CONFIG_DIR (and a KRAFT_TEMPLATES_DIR the shell still has), KRAFT_SKILLS_DIR, KRAFT_HOST, KRAFT_PORT and PATH into the unit it writes.

VariableDefaultWhat it does
KRAFT_HOME~/.kraftThe directory Kraft keeps everything in. just dev points it at .dev/ so a dev instance can't touch the real one.
KRAFT_RUN_DIR$KRAFT_HOME/runDatabases, logs, worktrees, the pidfile and the MCP token.
KRAFT_CONFIG_DIR$KRAFT_HOME/configThe config directory: policy.yaml, repos.yaml, access.yaml, chains and the rest. See Configuration.
KRAFT_TEMPLATES_DIRunsetThe 1.x name of KRAFT_CONFIG_DIR. Kraft reads it when KRAFT_CONFIG_DIR is unset, and sets it nowhere. Use KRAFT_CONFIG_DIR.
KRAFT_SKILLS_DIR$KRAFT_HOME/skillsWhere a skill file overrides the shipped one of the same name. Usually absent.
KRAFT_HOSTbind in access.yamlThe address the server binds and the CLI connects to. access.yaml says which of this, --host and bind wins.
KRAFT_PORTport in access.yamlThe port the server binds and the CLI connects to. access.yaml says which of this, --port and port wins.
KRAFT_NO_UPDATE_CHECKunsetAny value turns off the release check in kraft admin start, in kraft admin doctor and in the web UI. See below.
KRAFT_EDITORthe OS opener (open, xdg-open)The editor kraft view doc --open and the board use when none is named: code, cursor, zed or obsidian. The board's Default editor (editor in theme.yaml) wins over it.
KRAFT_EMBED_CACHE$XDG_CACHE_HOME/kraft/fastembed, else ~/.cache/kraft/fastembedWhere semantic search keeps its model weights.
KRAFT_BD_CWDunsetThe directory bd runs in for bead operations and bead search, instead of each repo.
KRAFT_FRONTEND_DISTthe web UI Kraft shipsThe built web UI to serve. just dev points it at Vite's output.
KRAFT_INDEX_REPOSunsetMore repo paths for the search index to scan, besides the connected ones, separated by :. The end-to-end tests use it.

KRAFT_NO_UPDATE_CHECK

With it set, the web UI no longer checks on every page load. It shows only the result of a check you ran yourself: the About page's Check now or kraft admin update.

It also stops the server from looking for releases on its own once a day, and with it auto_update. About says so. A service unit written by kraft admin install-service carries it, as it carries KRAFT_HOME: run the command again to give an installed service the variable.

Passed to workers

A worker's environment is built from an allowlist, not inherited from the shell that started the server. The variables below are the allowlist and the ones Kraft adds at launch. Any other variable the server has isn't passed on, unless the repo adds it.

A worker's own kraft command and MCP client read the variables below. A sandboxed worker gets only what Sandboxed workers lists.

Set by Kraft for each session

VariableSet toWhat it does
KRAFT_WORK_ITEM_IDThe work item's IDMarks the session as a Kraft worker. The CLI and MCP server use it as the default work item. See KRAFT_WORK_ITEM_ID.
KRAFT_SESSION_ID<work item id>/<session id>Sent with each API call as X-Kraft-Session-Id, so a route can tell the calling session apart. See KRAFT_SESSION_ID.
KRAFT_RESULT_PATHout/result.json in the session's folder, run/items/<work item id>/sessions/<session id>/Where the agent writes its result: status, concerns, a question, usage. Subprocess tasks get it too. See Result file.
KRAFT_DOCS_DIRrun/items/<work item id>/docsThe folder the agent writes the item's documents into, such as spec.md or plan.md. The prompt names the file to write and every document that already exists. A sandbox mounts this folder read-write. Added in 2.1
KRAFT_REVIEW_PACKAGEA file under run/For a review task: the commit list, files changed and diff to review.
KRAFT_BOT_FEEDBACKA file under run/For a task declaring bot_feedback: what each review bot said on the merge request, as JSON. Added in 2.4
KRAFT_OUTPUT_DIRout/outputs in the session's folderFor a task declaring outputs: the folder it writes the files and the variables.env that later tasks read. Kraft keeps only the declared names, then deletes it. A sandbox mounts it read-write. Added in 2.6
KRAFT_READS_DIRrun/items/<work item id>/outputsFor a task declaring reads: the folder holding one read-only folder per writer, named by the writer's path. A sandbox mounts only the writers it names. Added in 2.6
KRAFT_TEST_BASEThe item's base commitOnly for a scope's targeted_command: the commit the whole branch is measured from. Unset when the item has none. Added in 2.4
KRAFT_CHANGED_FILESA file under run/items/<work item id>/test-scopes/Only for a scope's targeted_command: the changed paths, one per line. A sandbox mounts it read-only. Added in 2.4
KRAFT_PERMISSION_FAIL_CLOSED1Set when a hooked harness (Cursor, Codex) runs under an allowed_tools list. The hook then denies a call when it can't reach Kraft. See Permission gate.

KRAFT_WORK_ITEM_ID

The CLI and MCP server refuse a worker's decisions about its own item (see MCP tools). KRAFT_WORK_ITEM_ID isn't set for an escalation turn, which runs as a person's session.

KRAFT_SESSION_ID

A session ID is unique only within its work item, so the variable names both, such as k7m2x9qa/p3n8w2. An escalation turn gets it too. A session started before session IDs were per item, and still running after the upgrade, keeps its bare 32-character ID, which is unique on its own. Kraft accepts both forms, and a bare ID only at those 32 characters. The server answers 400 to an X-Kraft-Session-Id that is neither, a bare 6-character session ID included.

Copied from the server's environment

Kraft copies each of these into a worker's environment when the server has it, and leaves it unset when the server doesn't.

GroupVariables
Running a processPATH, HOME, USER, LOGNAME, SHELL, LANG, LC_ALL, TERM, TZ, TMPDIR, SSH_AUTH_SOCK
ProxyHTTP_PROXY, HTTPS_PROXY, NO_PROXY, ALL_PROXY, and the same four in lower case
CA certificatesSSL_CERT_FILE, SSL_CERT_DIR, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, GIT_SSL_CAINFO, NODE_EXTRA_CA_CERTS
Locating this instanceKRAFT_HOME, KRAFT_RUN_DIR, KRAFT_CONFIG_DIR, KRAFT_TEMPLATES_DIR, KRAFT_SKILLS_DIR, KRAFT_HOST, KRAFT_PORT, so the worker's kraft command reaches the instance that started it
Server pid and portKRAFT_DAEMON_PID and KRAFT_DAEMON_PORT. The names say daemon; the process is the Kraft server. A worker uses them to tell the server apart from a stray process before it kills anything on a port.
Claude Code's credentialsANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN. See Other variables.

Set at launch

Kraft adds these to the launch that needs them.

VariableSet whenWhat it does
GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAILEvery launchThe identity a worker commits under: the server's own values where it has them, else user.name and user.email from the repo's git config. A repo's env outranks it in a sandbox.
CURSOR_CONFIG_DIRA cursor harness launchA config directory Kraft owns for the run, so your own Cursor config isn't read or touched.
OPENCODE_CONFIG_CONTENTAn opencode launch whose policy has tool rulesThe permission block that enforces allowed_tools and deny_tools.
PYTHONDONTWRITEBYTECODEA subprocess or test command1, so a fix loop's re-run tests never import stale bytecode.
HTTP_PROXY, HTTPS_PROXY, NO_PROXY, their lower-case forms and NODE_USE_ENV_PROXYA sandboxed launch under network:Point the worker at Kraft's proxy and nowhere else. See Network policy.

A sandboxed container may carry more than this list; Sandboxed workers says what reaches it.

Added by the repo

A repo's env and env_passthrough add to this list; how to set them is in the env field of repos.yaml.

Any other KRAFT_* variable the server has stays behind: set it in env, or name it in env_passthrough. The same goes for another agent's API key, such as CODEX_API_KEY, unless you name it in env_passthrough.

Set by Kraft for itself

You don't set these.

VariableWhat it does
KRAFT_CLIENTTells the API whether a call is an agent's or a person's: kraft admin mcp sets mcp. Details below.
KRAFT_DETACHEDSet on the child of kraft admin start --detach, so kraft admin restart starts it the same way.
KRAFT_LOG_REDIRECTEDSet on the same child, whose output already goes to run/logs/server.log.
A forge account's env token variableRemoved from the server's environment at start, so no worker, hook or git inherits it. Naming it in a repo's env_passthrough is refused.

KRAFT_CLIENT

Added in 2.6

kraft admin mcp sets it to mcp, so the API can tell an agent's call from a person's.

The kraft command sends agent-shell itself in a coding agent's shell, today Claude Code's, through CLAUDE_CODE_CHILD_SESSION. That needs Claude Code 2.1.172 or later, and an IDE's integrated terminal doesn't set it.

A value set here wins. Set KRAFT_CLIENT=cli to be recorded as a person in an agent's shell.

Other variables

VariableRead byWhat it does
PATHthe serverWhere Kraft finds claude, the other agent CLIs, git, gh, glab and bd. Under a service, this is the unit's PATH, not your shell's.
ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKENworkersClaude Code's credentials. Passed to every worker, sandboxed or not, unless the repo's sandbox credentials lists the name: then a sandboxed worker gets a sentinel and the egress proxy adds the real value.
CODEX_API_KEY, GEMINI_API_KEY, CURSOR_API_KEY, and other agents' keysworkersNot passed by default. Name one in the repo's env_passthrough.
CODEX_HOMEkraft admin permission-hook codexCodex's config directory. Default ~/.codex.
NO_COLORthe CLITurns off coloured output.
PAGERthe CLIThe pager for long output. Default less -R.
SHELLkraft admin doctorWhich shell's completion line to suggest.
XDG_CONFIG_HOMEkraft admin install-serviceWhere the systemd user unit goes. Default ~/.config.
XDG_CACHE_HOMEsemantic searchThe base of the default KRAFT_EMBED_CACHE.
SSL_CERT_FILEthe sandboxAn extra CA bundle a sandboxed worker trusts, for a TLS-intercepting proxy.

Kraft doesn't read EDITOR or VISUAL.

Copyright © 2026