Configuration
gitq reads its configuration from the rt settings store: the CLI reads gitq.workSlots and gitq.forges. A key nobody set reads its default.
The app root
One root holds everything gitq owns: ~/.mattstack/gitq, whether gitq runs from a checkout or as the bundled binary in the horsey app (mattstack.app; src/core/app-root.ts). Running both forms against one root is what makes gitq stacks answer the same whichever copy is on PATH. It is also the horsey rule for a bundled helper: a helper never writes inside the read-only app bundle, and never anywhere cwd-relative.
GITQ_APP_ROOT moves the root, resolved to an absolute path. GITQ_CONFIG_DIR still moves the CLI's own subset within it and wins where they overlap (below).
gitq's files used to live in ~/.config/gitq. The first run after the move copies that directory into the app root, verifies every file, and writes migrated-from.json recording where it came from. The old directory is copied, never moved: it stays exactly as it was, yours to delete once you are satisfied. Rerunning is a no-op. If both directories hold files and no marker connects them, gitq uses the app root and names the other one once rather than merging two stack stores, since nothing tells it which is current. See Where state lives.
The settings store
Two keys, read through @mattstack/rt-client's getSetting:
| Key | Scope | Shape | With nothing set |
|---|---|---|---|
gitq.workSlots | machine | { maxWorkSlots?, workSlotLocation? } | { "workSlotLocation": "auto", "maxWorkSlots": 3 } |
gitq.forges | user | host-keyed map, tokenEnv names only, never a live token | {} |
A resolver throw (an unreadable or malformed store file, never the daemon) reads the key's default after one warning.
Set a key with rt settings set <key> <json-value> --scope user|team|machine. This replaces the whole value stored at that key and scope. It is not a merge. For a multi-field value (workSlots) or a multi-host map (forges), put every field or host you want to keep in the JSON you send. Check what's already there first with rt settings explain <key>.
The CLI's directory
gitq's config directory defaults to the app root, ~/.mattstack/gitq, and can be moved on its own with GITQ_CONFIG_DIR, an environment variable read once, at process start (src/core/config-paths.ts, const DEFAULT_CONFIG_DIR = envConfigDir ? resolve(envConfigDir) : APP_ROOT). It wins over GITQ_APP_ROOT when both are set. An empty value counts as unset, and a relative one is resolved against the directory gitq was started in, so the config directory is always an absolute path. Every path the CLI derives, the stack stores and the operation log, comes from this one directory. Export it in your shell profile rather than expecting a mid-session change to take effect, and remember that a gitq run with a different GITQ_CONFIG_DIR sees a different set of tracked stacks entirely.
The work slots gitq leases for cascades follow the same directory, with no carve-out: a non-pool repo gets its slots under <config dir>/work/<hash>/ (getWorkSlotRoot, src/core/config-paths.ts). Pool repos are unaffected: their slots are siblings of your own worktrees, unless workSlotLocation says otherwise (below). Slots created before the move to the app root, under the old ~/.cache/gitq/work root, keep working and are not migrated: a slot is recognised by its gitq-<n> name in the repo's own git worktree list, and leases record absolute paths. See Work slots and leases.
What the variable does not move is anything gitq writes into the repo you point it at. The lease registry (<commonDir>/gitq/leases.json), a paused cascade's <gitdir>/gitq-pause.json, and the core.hooksPath gitq pins per work slot all land in the operated-on repo's git directory regardless. A throwaway GITQ_CONFIG_DIR gets you a throwaway gitq state directory, not a run that leaves no trace; see Where state lives for the full inventory.
The cap on work slots is the maxWorkSlots field of gitq.workSlots:
rt settings set gitq.workSlots '{"maxWorkSlots":5}' --scope machine
Read by getMaxWorkSlots (src/core/worktrees.ts). The value must be a number of at least 1, and it is floored. Anything else, or nothing set, gives the default of 3. It caps how many cascades can run per repo at once, one work slot each. See Work slots and leases for what the cap actually gates. A stack with a running or parked cascade already blocks other mutations regardless of the cap. So raising it only helps when several different stacks want to cascade at the same time.
The workSlotLocation field of the same key decides where a new work slot is created:
rt settings set gitq.workSlots '{"workSlotLocation":"root"}' --scope machine
Two values. auto, the default, keeps the pool-aware placement: a repo whose primary worktree has a sibling worktree of its own gets its slots next to them, everything else gets them under the work-slot root. root skips the pool detection and always uses the work-slot root, wherever the config directory puts it. Read by getWorkSlotLocation (src/core/worktrees.ts); anything other than "root" is auto. Because rt settings set replaces the whole value, include maxWorkSlots too if you want to keep a cap you set.
Reach for root when the pool detection is technically right but practically wrong. Take a clone that lives directly in a directory of unrelated repos (~/repos/myrepo, next to twenty other checkouts). It reads as a pool the moment you add one sibling worktree of it, and gitq-1 then appears in that directory alongside the repos. The setting only governs slots gitq creates: an existing slot is still reused wherever it already sits, so remove it with git worktree remove if you want it relocated.
The gitq.forges key tells gitq which forge a self-hosted host is running. It is keyed by the host of the repo's git remote:
rt settings set gitq.forges '{"gitlab.acme.com":{"provider":"gitlab"},"ghe.acme.com":{"provider":"github","tokenEnv":"GHE_ACME_TOKEN"},"work":{"provider":"gitlab","baseUrl":"https://gitlab.acme.com"}}' --scope user
provider is required and must be gitlab or github; anything else is an error naming the entry, not a silently skipped line. baseUrl defaults to https://<host>, so a host that is already the instance's address needs only the provider. tokenEnv is covered under the forge token below. Read by resolveForge (src/core/forges.ts) through readForgeOverrides, which takes the whole map: a new value replaces the old map, it is not merged host by host.
You need an entry only for a host gitq cannot identify on its own. github.com and gitlab.com are known outright (src/core/forges.ts:38-41), and an entry for either still wins, which is how you route one through a proxy. The third example above is an ~/.ssh/config alias: a remote like git@work:acme/web.git names no domain at all, so an alias entry has to give a baseUrl and is refused without one.
Do not look for other keys. The stack stores and the operation log live in this directory too, but those are state gitq writes for itself, not settings you configure. See Where state lives for the full inventory of what is written and when.
The forge token
publish and import both need a token, and which one they need follows from the repo's remote rather than from configuration. gitq reads the remote's host, resolves the forge from it, and then resolves that forge's credential (createForgeProvider, src/cli/provider.ts:44-78). A GitHub remote is never offered a GitLab token.
resolveForgeToken (src/core/secrets.ts) takes the forge's environment variable first: GITLAB_TOKEN for gitlab, GITHUB_TOKEN for github. If that is unset, it asks the rt daemon for a grant-gated token instead. That is the secrets:forge-token verb, backed by rt's own encrypted store (set with rt secrets set rt gitlabToken), not a plaintext file gitq reads itself. The daemon lookup needs the repo tracked with rt (rt daemon track <repo> live branches); gitq never reads or writes any secrets file directly, at either step.
Missing both is a hard failure before any network call is made, naming the forge, the host, and why: for a repo not tracked with rt, gitq: no github token for github.com (set GITHUB_TOKEN or track the repo with rt (rt daemon track <repo> live branches); <repoPath> is not registered with rt (~/.mattstack/rt/repos.json)) (src/cli/provider.ts, src/core/secrets.ts). A linked worktree of a tracked checkout counts as tracked: gitq falls back to the checkout that owns the shared git dir.
A self-hosted instance can carry its own credential with tokenEnv on its forges entry, since a github.com token is not a GitHub Enterprise token. When an entry names a variable, that variable is the only place gitq looks: it does not fall back to GITHUB_TOKEN or the rt daemon, because falling back would hand the instance a credential it never issued. The error then names just that variable: no github token for ghe.acme.com (set GHE_ACME_TOKEN).
Two failures happen before the token is ever considered, both from the remote alone. A host with no forges entry that gitq does not know is refused rather than guessed at. Defaulting an enterprise GitHub host to GitLab would fail somewhere a long way from the cause. The refusal reads: cannot tell which forge "git.acme.com" is (from remote ...); check the current map with rt settings explain gitq.forges, then set it with rt settings set gitq.forges '{"git.acme.com": {"provider": "gitlab"}, ...}' --scope user ... (src/cli/provider.ts:61-74; the full message spells out that the write replaces the whole host-keyed map). A remote that names no host at all, a local path or a bare clone directory, gets no forge host in remote "..." (src/cli/provider.ts:49-53).
Next
- Where state lives: every file gitq writes, as opposed to the settings you write for it.
- Work slots and leases: what
maxWorkSlotsactually caps.