Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions plugins/claude-code-hermit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@

### Changed

- **env defaults: `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` bumped 50 → 65** — auto-compact was firing well before the quality-degradation zone (~73%); 65 reduces premature context loss while staying conservative.
- **env defaults: `COMPACT_THRESHOLD` bumped 50 → 75** — the tool-call-based nudge was firing mid-session for any non-trivial work; 75 quiets the fallback path while `context_usage > 60%` continues to drive real nudges in `suggest-compact.js`.
- **docs: `COMPACT_THRESHOLD` description corrected to tool-call-count fallback** — config-reference previously called it a "context % threshold," which contradicted `suggest-compact.js`. Now matches the code: tool-call counter consulted only when `context_usage` is unavailable.

### Upgrade Instructions

1. Read `.claude-code-hermit/config.json`.
- If `env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE == "50"`, set it to `"65"`. If absent or any other value, leave it alone.
- If `env.COMPACT_THRESHOLD == "50"`, set it to `"75"`. If absent or any other value, leave it alone.
- Write the file back only if either key changed.
2. Read `.claude/settings.local.json` (or `.claude/settings.json` per `hatch_target`). Apply the same only-if-still-50 guard for both keys; update to `"65"` / `"75"` respectively. Otherwise leave them alone.
3. Report to the operator, one line per key:
- "Bumped `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` 50 → 65 — auto-compact triggers later." or "Left `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` at `<value>` (custom override preserved)."
- "Bumped `COMPACT_THRESHOLD` 50 → 75 — fewer mid-session nudges." or "Left `COMPACT_THRESHOLD` at `<value>` (custom override preserved)."
- **hatch: push_notifications now defaults to true** — derived from channel choice in `/hatch` (no channel → on, channel → off); explicit opt-in removed. Toggle via `/hermit-settings push-notifications`.

### Upgrade Instructions
Expand Down
2 changes: 1 addition & 1 deletion plugins/claude-code-hermit/docs/always-on.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ Container restarts trigger recovery automatically:

| Setting | Value | Effect |
| ---------------------------------- | ------- | -------------------------------- |
| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | `50` | Compacts at 50% context |
| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | `65` | Compacts at 65% context |
| `MAX_THINKING_TOKENS` | `10000` | Prevents runaway reasoning costs |

Adjust with `/hermit-settings env`.
Expand Down
4 changes: 2 additions & 2 deletions plugins/claude-code-hermit/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ config.json "env" → hermit-start.py → .claude/settings.local.json "env"

| Field | Value | Purpose |
| --------------------------------- | ---------- | -------------------------------------------------- |
| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | `50` | Auto-compact at 50% context |
| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | `65` | Auto-compact at 65% context |
| `MAX_THINKING_TOKENS` | `10000` | Cap thinking budget |
| `AGENT_HOOK_PROFILE` | `standard` | Active hook profile |
| `COMPACT_THRESHOLD` | `50` | Compaction suggestion threshold |
| `COMPACT_THRESHOLD` | `75` | Tool-call-count fallback for compact suggestion |
| `DISCORD_STATE_DIR` | (derived) | Derived from `channels.discord.state_dir` at boot |
| `TELEGRAM_STATE_DIR` | (derived) | Derived from `channels.telegram.state_dir` at boot |

Expand Down
8 changes: 4 additions & 4 deletions plugins/claude-code-hermit/docs/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Written to `.claude/settings.local.json` at boot by `hermit-start`. Exported to
| Key | Default | Purpose |
|-----|---------|---------|
| `AGENT_HOOK_PROFILE` | `"standard"` | Hook profile: `minimal`, `standard`, `strict`. Protected in always-on mode. |
| `COMPACT_THRESHOLD` | `"50"` | Context % threshold for compact suggestion. |
| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | `"50"` | Auto-compact at this % of context window. |
| `COMPACT_THRESHOLD` | `"75"` | Tool-call-count threshold for compact suggestion (fallback when `context_usage` is unavailable). |
| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | `"65"` | Auto-compact at this % of context window. |
| `MAX_THINKING_TOKENS` | `"10000"` | Cap on thinking tokens per turn. |
Modify with `/hermit-settings env`.

Expand Down Expand Up @@ -280,8 +280,8 @@ A realistic `config.json` for an always-on Docker hermit with Discord:
],
"env": {
"AGENT_HOOK_PROFILE": "strict",
"COMPACT_THRESHOLD": "50",
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "50",
"COMPACT_THRESHOLD": "75",
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "65",
"MAX_THINKING_TOKENS": "10000"
},
"scheduled_checks": [
Expand Down
2 changes: 1 addition & 1 deletion plugins/claude-code-hermit/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Scheduled checks run during idle reflection via `reflect`. If configured checks

## Costs Unexpectedly High

- Check `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` in `config.json` `env` (default 50). Adjust with `/hermit-settings env`.
- Check `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` in `config.json` `env` (default 65). Adjust with `/hermit-settings env`.
- Check heartbeat interval — 5m with Opus is expensive. Default is 2h; use 15m-30m only if you need faster monitoring.
- Check if watches are running with short intervals (`/claude-code-hermit:watch stop`).
- Review SHELL.md size — bloated files cost tokens on every read.
Expand Down
4 changes: 2 additions & 2 deletions plugins/claude-code-hermit/scripts/hermit-start.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
'monitors': [],
'env': {
'AGENT_HOOK_PROFILE': 'standard',
'COMPACT_THRESHOLD': '50',
'CLAUDE_AUTOCOMPACT_PCT_OVERRIDE': '50',
'COMPACT_THRESHOLD': '75',
'CLAUDE_AUTOCOMPACT_PCT_OVERRIDE': '65',
'MAX_THINKING_TOKENS': '10000',
},
'boot_skill': None,
Expand Down
2 changes: 1 addition & 1 deletion plugins/claude-code-hermit/scripts/suggest-compact.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const path = require('path');
const os = require('os');

const MAX_STDIN = 1024 * 1024; // 1MB safety limit
const COMPACT_THRESHOLD = parseInt(process.env.COMPACT_THRESHOLD || '50', 10) || 50;
const COMPACT_THRESHOLD = parseInt(process.env.COMPACT_THRESHOLD || '75', 10) || 75;
const SUBSEQUENT_INTERVAL = 25;
const MAX_COUNTER = 1_000_000;
const CONTEXT_USAGE_THRESHOLD = 0.6; // 60%
Expand Down
2 changes: 1 addition & 1 deletion plugins/claude-code-hermit/skills/hermit-evolve/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ For each new key, check the table below. If the key is interactive, ask the oper
- `heartbeat.waiting_timeout` (0.3.0): `null` | `heartbeat.stale_threshold` (0.0.9): `"2h"`
- `idle_budget` (0.0.9): `"$0.50"` | `routines` (0.0.9): `[]`
- `scheduled_checks` (0.3.1): `[]`
- `env` (0.0.7): `{"AGENT_HOOK_PROFILE":"standard","COMPACT_THRESHOLD":"50","CLAUDE_AUTOCOMPACT_PCT_OVERRIDE":"50","MAX_THINKING_TOKENS":"10000"}`
- `env` (0.0.7): `{"AGENT_HOOK_PROFILE":"standard","COMPACT_THRESHOLD":"75","CLAUDE_AUTOCOMPACT_PCT_OVERRIDE":"65","MAX_THINKING_TOKENS":"10000"}`
- `docker` (0.0.7): `{"packages":[],"recommended_plugins":[]}`
- `compact` (0.0.7): `{"monitoring_threshold":30,"monitoring_keep":20,"summary_threshold":30,"summary_keep":15}`
- `knowledge` (0.4.0): `{"raw_retention_days":14,"compiled_budget_chars":1000,"working_set_warn":20}`
Expand Down
8 changes: 4 additions & 4 deletions plugins/claude-code-hermit/skills/hermit-settings/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ Compaction:

Environment (env):
AGENT_HOOK_PROFILE standard
COMPACT_THRESHOLD 50
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE 50
COMPACT_THRESHOLD 75
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE 65
MAX_THINKING_TOKENS 10000
→ run: /claude-code-hermit:hermit-settings env

Expand Down Expand Up @@ -258,8 +258,8 @@ Update `permission_mode` in config.json.
Environment Variables (config.json env → .claude/settings.local.json)

AGENT_HOOK_PROFILE standard
COMPACT_THRESHOLD 50
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE 50
COMPACT_THRESHOLD 75
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE 65
MAX_THINKING_TOKENS 10000
```
- **Protected keys** that cannot be changed via this command: `AGENT_HOOK_PROFILE`. These are managed by the boot script and docker-setup. If the operator tries to set one, respond: "AGENT_HOOK_PROFILE is managed by the boot script (standard for interactive, strict for Docker). To change it, edit config.json directly — the boot script validates on next start."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"monitors": [],
"env": {
"AGENT_HOOK_PROFILE": "standard",
"COMPACT_THRESHOLD": "50",
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "50",
"COMPACT_THRESHOLD": "75",
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "65",
"MAX_THINKING_TOKENS": "10000"
},
"boot_skill": null,
Expand Down
Loading