feat(hooks): add config option to disable context window warnings (#1073)
Add hooks.context_warnings config option (default: true) that allows users to disable the context monitor hook's advisory messages. When set to false, the hook exits silently, allowing Claude Code to reach auto-compact naturally without being interrupted. This is useful for long unattended runs where users prefer Claude to auto-compact and continue rather than stopping to warn about context. Changes: - hooks/gsd-context-monitor.js: Check config before emitting warnings - get-shit-done/templates/config.json: Add hooks.context_warnings default - get-shit-done/workflows/settings.md: Add UI for the new setting Fixes #976
This commit is contained in:
@@ -43,6 +43,20 @@ process.stdin.on('end', () => {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Check if context warnings are disabled via config
|
||||
const cwd = data.cwd || process.cwd();
|
||||
const configPath = path.join(cwd, '.planning', 'config.json');
|
||||
if (fs.existsSync(configPath)) {
|
||||
try {
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
if (config.hooks?.context_warnings === false) {
|
||||
process.exit(0);
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore config parse errors
|
||||
}
|
||||
}
|
||||
|
||||
const tmpDir = os.tmpdir();
|
||||
const metricsPath = path.join(tmpDir, `claude-ctx-${sessionId}.json`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user