Keep Claude, Cursor, and Codex output consistent, and prevent Claude's /config selection from reverting after chezmoi apply. Verified the rendered Claude settings patch and the three applied target files.
68 lines
3 KiB
Markdown
68 lines
3 KiB
Markdown
# Claude Code
|
|
|
|
## Settings
|
|
|
|
`~/.claude/settings.json` is **merged, not replaced** — Claude Code writes to it
|
|
too (`autoMode.environment`, `/config`), so an owned file would revert its work.
|
|
The asserted keys live in `.chezmoitemplates/claude-settings.json` as plain JSON;
|
|
edit that. `modify_settings.json.tmpl` folds it in with `jq -s '.[0] * .[1]'`,
|
|
a recursive merge, so unmanaged keys survive at any depth.
|
|
|
|
A key listed there is *asserted*: change `model` with `/config` and the next
|
|
`chezmoi apply` sets it back. Remove the key to stop managing it.
|
|
|
|
There is no user-level override file — `settings.local.json` is project-scoped,
|
|
and `claude --settings <file>` has to be passed per invocation.
|
|
|
|
## Output style
|
|
|
|
`ASD-STE100` is in `~/.claude/output-styles`. The settings patch selects it.
|
|
Claude uses it after you start a new session. `/config` can change the style,
|
|
but the next `chezmoi apply` selects `ASD-STE100` again.
|
|
|
|
## Status line
|
|
|
|
```
|
|
Opus 5+xhigh | 27% | $15.38 | ⚡99% | 5h 4% (4h 10m) | 7d 90% (2d 20h)
|
|
main
|
|
```
|
|
|
|
Segments are joined from an array, so an absent one takes its separator with
|
|
it. `+effort` is appended to the model name and omitted when the current model
|
|
doesn't support the effort parameter.
|
|
|
|
`rate_limits` is sent **only to Claude.ai Pro/Max**, and its two windows can be
|
|
absent independently. On a team/Console account it never arrives and the line
|
|
degrades to `Sonnet 5 | 12% | $0.42 | ⚡98%`. The payload carries no
|
|
credit-balance field, so `$cost` is the only usage signal there.
|
|
|
|
The git branch (`<worktree>: <branch>` inside a worktree, else just `<branch>`)
|
|
renders on its own second line, omitted entirely outside a repo, so it doesn't
|
|
get pushed off screen by the usage segments on a long first line.
|
|
|
|
### Cache hit rate
|
|
|
|
```
|
|
cache_read_input_tokens
|
|
────────────────────────────────────────────────────────────────────
|
|
input_tokens + cache_creation_input_tokens + cache_read_input_tokens
|
|
```
|
|
|
|
from `.context_window.current_usage`. Cache reads bill at roughly a tenth of base
|
|
input while writes bill at rather more than base, so a falling rate alongside
|
|
rising `cache_creation` means something early in the context keeps changing and
|
|
invalidating the prefix — re-billing the same tokens at many times the price.
|
|
`$cost` alone does not reveal that until the bill arrives.
|
|
|
|
`current_usage` is null before the first API call and again after `/compact`, so
|
|
the segment does not render then.
|
|
|
|
## Requirements
|
|
|
|
- `jq`, declared in the `common` metapac group.
|
|
- `LC_NUMERIC=C` is forced in the script. `printf` is locale-aware: under
|
|
`LC_NUMERIC=es_ES` it renders the cost as `1,23` and rejects `31.2` outright
|
|
with `invalid number`. `LC_ALL` is unset first — it overrides `LC_NUMERIC`
|
|
per POSIX precedence, so if it's set the `export LC_NUMERIC=C` below it is
|
|
silently ineffective and `$cost`, the only usage signal on a credit-pool
|
|
account, breaks.
|