Skip to content

feat: make default caveman mode configurable#86

Closed
mcalhoun wants to merge 1 commit intoJuliusBrussee:mainfrom
mcalhoun:main
Closed

feat: make default caveman mode configurable#86
mcalhoun wants to merge 1 commit intoJuliusBrussee:mainfrom
mcalhoun:main

Conversation

@mcalhoun
Copy link
Copy Markdown

@mcalhoun mcalhoun commented Apr 11, 2026

Summary

  • Add hooks/caveman-config.js — shared config resolver with XDG-compliant path resolution across all platforms
  • Remove hard-coded 'full' default from caveman-activate.js and caveman-mode-tracker.js, replaced with getDefaultMode() call
  • Update install.sh to include the new config module

Config resolution order

  1. CAVEMAN_DEFAULT_MODE environment variable (highest priority)
  2. Config file defaultMode field at:
    • $XDG_CONFIG_HOME/caveman/config.json (any platform, if XDG_CONFIG_HOME is set)
    • ~/.config/caveman/config.json (macOS / Linux fallback)
    • %APPDATA%\caveman\config.json (Windows fallback)
  3. 'full' (unchanged default)

Example config

{ "defaultMode": "ultra" }

Or per-harness via environment variable:

CAVEMAN_DEFAULT_MODE=lite

Test plan

Manual smoke tests — all passing:

Test 1: No config (default behavior)

$ node -e "const c = require('./hooks/caveman-config'); console.log('default:', c.getDefaultMode()); console.log('configPath:', c.getConfigPath()); console.log('configDir:', c.getConfigDir());"
default: full
configPath: /Users/matt/.config/caveman/config.json
configDir: /Users/matt/.config/caveman

Test 2: Environment variable override

$ CAVEMAN_DEFAULT_MODE=ultra node -e "const c = require('./hooks/caveman-config'); console.log('default:', c.getDefaultMode());"
default: ultra

Test 3: XDG config file override

$ mkdir -p /tmp/caveman-xdg-test/caveman
$ echo '{"defaultMode":"lite"}' > /tmp/caveman-xdg-test/caveman/config.json
$ XDG_CONFIG_HOME=/tmp/caveman-xdg-test node -e "const c = require('./hooks/caveman-config'); console.log('default:', c.getDefaultMode());"
default: lite

Validation

  • No config → defaults to full (backward compatible)
  • CAVEMAN_DEFAULT_MODE env var respected
  • XDG config file with defaultMode respected
  • Invalid modes in config/env are ignored (falls through to default)

@mcalhoun mcalhoun changed the title Make default caveman mode configurable feat: make default caveman mode configurable Apr 11, 2026
Add caveman-config.js with XDG-compliant config resolution.
Default mode resolves via: CAVEMAN_DEFAULT_MODE env var >
$XDG_CONFIG_HOME/caveman/config.json > 'full'.
hansenc added a commit to hansenc/caveman that referenced this pull request Apr 11, 2026
Extends JuliusBrussee#86 with a single new defaultMode value. When resolved to
'off' via env var or config file, the SessionStart hook early-exits
without emitting the rules block and cleans up any stale
~/.claude/.caveman-active flag file (symlink-safe via lstat/isFile).

Slash commands stay available. The mode tracker never persists 'off'
to the flag file; '/caveman full' (or bare '/caveman') during an
off session enables full mode as a mid-session override.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Rolloniel
Copy link
Copy Markdown

@JuliusBrussee please take a look, its painful to build workarounds locally for this

@mcalhoun
Copy link
Copy Markdown
Author

@JuliusBrussee Thanks for merging this feature.

One small note: I noticed the change was cherry-picked onto another branch without attribution to my original contribution. I’ve been contributing to open source for more than 30 years, so I’m not raising this because I need personal credit. But attribution matters, and when it gets dropped, it can discourage people from contributing. I’m sure there was no bad intent here, but I’d appreciate it if attribution were preserved going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants