contextzip
Documentation · 5 of 6

Configuration.

Three layers, from most personal to most shared: your own machine, your project's committed defaults, and a visual editor for both when you'd rather not hand-write JSON.

Where .contextzip/ lives

By default, .contextzip/ is created at your git root — so running contextzip from a subdirectory of a monorepo (cd frontend && contextzip) still lands the workspace at the repo root instead of scattering folders across every subproject. Outside a git repo, it falls back to the current directory. This can be overridden at three levels, checked in this order:

PriorityMethodScope
1CONTEXTZIP_WORKSPACE_LOCATION env varOne-off, single run
2.contextzip/config.json → workspace_locationTeam-shared, applies to everyone who clones the repo
3contextzip config --set-workspacePersonal, per-machine default
Built-in default"git-root"

~/projects/my-app

$ contextzip config --set-workspace cwd

Personal default set — always use ./.contextzip wherever you run it

$ contextzip config --reset-workspace

Workspace override removed — back to the default resolution order

Personal config

Per-machine settings that never get committed — your Gemini API key, your personal workspace override, and whether you've already been offered (and declined) the visual config UI once.

Stored in your OS config directory

Linux/macOS: ~/.config/contextzip/config.json (or $XDG_CONFIG_HOME). Windows: %APPDATA%\contextzip\config.json. The file may hold an API key in plaintext, so on every save its permissions are locked to owner-only (0600 on POSIX systems) — other accounts on a shared machine can't read it off disk.

CommandEffect
contextzip configShow current key status and workspace resolution
contextzip config --reset-keyClear the stored key and re-run setup
contextzip config --show-key-pathPrint the config file path and exit
contextzip config --set-workspace LOCATIONSet a personal workspace default ("git-root", "cwd", or a path)
contextzip config --reset-workspaceClear the personal workspace override

Project config

Committed to the repo at .contextzip/config.json, so every contributor gets the same defaults automatically — no per-machine setup required. .contextzip/ is git-ignored by default, but this one file is deliberately carved out of that rule so it stays trackable. All keys are optional.

.contextzip/config.json
{
  "workspace_location": "git-root",
  "scan_depth": 2,
  "always_include": ["docs/architecture.md"],
  "always_exclude": ["*.snap"],
  "ai": {
    "enabled": true,
    "provider": "gemini",
    "max_files": 10,
    "prompt_template": "We use pytest, not unittest."
  },
  "limits": {
    "max_file_size_mb": 1,
    "redact_secrets": false
  },
  "applied_zip_retention": 1,
  "webui": {
    "auto_open": true,
    "port": null
  }
}
KeyDescription
workspace_locationSame values as the personal setting — team-shared, wins over it
scan_depthHow many levels deep the monorepo ecosystem scan goes (default 2)
always_includeStanding negation — force-includes matching files even if an auto-rule or .gitignore would exclude them
always_excludeStanding --exclude patterns applied on every run, gitignore syntax
ai.*AI-selection preferences — see AI file selection
limits.max_file_size_mbFiles at or above this size are flagged as large before packaging (still included, just surfaced)
limits.redact_secretsReserved for a future best-effort scrub of secret-shaped values inside included files — persisted but not yet enforced
applied_zip_retentionHow many past apply-zip archives to keep before pruning the oldest (default 1)
webui.auto_openWhether contextzip config --ui opens a browser tab automatically
webui.portBind the config UI to a fixed port instead of a random free one — useful behind strict local firewall rules

Deprecation: a legacy .contextzip.json at the project root is still read as a fallback when .contextzip/config.json doesn't exist, so older projects keep working. contextzip prints a one-time notice suggesting the move.

Visual config UI

contextzip config --ui opens a local browser tab with a live file tree — check or uncheck any file or folder and watch the included/excluded counts and total size update instantly, with one-click suggestions for things like PDFs, design files, or other non-code assets that slipped past the automatic rules. Saving writes straight to .contextzip/config.json. On a brand-new project with no config yet, contextzip offers to open it for you the first time you run the tool interactively.

~/projects/my-app

$ contextzip config --ui

contextzip config UI is running locally

→ http://127.0.0.1:53214/?token=x7f2…

Bound to 127.0.0.1 only — nothing about this project leaves your machine.

Press Ctrl+C here at any time to stop.

Local by design
  • · Binds to 127.0.0.1 only, never 0.0.0.0 — nothing about your project reaches the network.
  • · Zero outbound calls of its own — no telemetry, no phone-home. The only network activity is your browser talking to this same-machine server.
  • · Every request needs a random, single-use session token (the same approach Jupyter Notebook uses), so another local process or browser tab can't read or reconfigure your project by guessing a port.
  • · Shuts itself down on a successful save, after 15 minutes of tab inactivity, or after a 60-minute hard ceiling — so a forgotten run doesn't linger as an open port.
  • · The file tree is scanned from disk once at startup; every checkbox toggle re-classifies that same in-memory list, which is what keeps the live preview feeling instant even on larger projects.

Everything editable from the CLI or by hand — always_include, always_exclude, workspace location, scan depth, AI settings, size limits, applied-zip retention, and the UI's own auto-open/port preferences — is editable visually here too, seeded from whatever's already in config.json so re-opening the UI shows what's actually in effect, not a blank slate.

Looking for a specific flag?