Skip to content

Commit 2469adb

Browse files
oleg-kovalclaudecoderabbitai[bot]CodeRabbit
authored
Elide long branch names, and add a hydration reminder (#8)
* Elide long branch names, and add a hydration reminder Your screenshot showed the problem: a 69 character branch (dubo-175-retire-k8s-lease-leader-election-from-the-sync-path-kill-gic) filled the line, and the markers you actually watch while working, the dirty count and ahead/behind, got pushed past the edge. Branch names longer than 28 cells are now elided in the middle, keeping the ticket prefix and the subject and losing the words between them: dubo-175-retir...path-kill-gic. Budget is GLINT_BRANCH_MAX, with a floor of 8 cells so it can never elide to nothing. Hydration joins the rest group on the same terms as the break nudge: invisible until due, 45 minutes by default, firmer at twice that. It shares the idle-gap clock rather than keeping its own, so both are read and written by one function (two writers on one state file would race). A break resets water too, since getting up is when you refill the glass, which leaves --drank for the times you drink at your desk. --rest-status now prints both clocks. The long-branch test builds a real git repo with a commit, because an unborn branch makes rev-parse answer HEAD and the git segment never renders at all. 79 tests. Co-Authored-By: Claude Code <[email protected]> * fix: apply CodeRabbit auto-fixes Fixed 3 file(s) based on 6 unresolved review comments. Co-authored-by: CodeRabbit <[email protected]> * Codex CLI support: session-log adapter and tmux output No agent CLI other than Claude Code lets you supply the status line as a command. Verified rather than assumed: Codex 0.146's tui.status_line takes a fixed list of built-in item ids (openai/codex#20244, #17827), opencode 1.17 has no statusLine anywhere in its shipped config schema or its 130MB bundle (the proposal is anomalyco/opencode#30295, and a search summary claiming it shipped is wrong), Hermes documents its bar as fixed, and the installed Cursor CLI binary contains no statusline strings at all. Codex does not need a hook. It already writes what matters to ~/.codex/sessions/<date>/rollout-*.jsonl: token_count records carrying last_token_usage, cached_input_tokens and model_context_window, plus rate_limits with used_percent, window_minutes and resets_at. codex_payload() translates those into the same shape Claude Code pipes in, so nothing downstream changes, and --tmux renders it into the tmux status bar instead of Codex's own. main() split into argument handling plus build_line(payload), which is what makes a second harness possible at all. The cache segment now prefers numbers an adapter supplies, since only Claude Code has a transcript to derive them from. to_tmux() rewrites SGR colours as tmux formats, doubles literal '#' (tmux reads it as the start of a format) and strips hyperlinks. Cost and lines changed are omitted for Codex because Codex does not record them; better a missing segment than an invented number. Two bugs the installer only revealed when run: --print fetched and overwrote glint.py before previewing (it clobbered a working copy once), and the tmux value nested double quotes inside a double-quoted string, which ended it mid-path. --print is now a true dry run and the inner path is single-quoted. 88 tests. Co-Authored-By: Claude Code <[email protected]> * fix: apply CodeRabbit auto-fixes Fixed 4 file(s) based on 9 unresolved review comments. Co-authored-by: CodeRabbit <[email protected]> * Update glint.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: oleg koval <[email protected]> * Update glint.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: oleg koval <[email protected]> * fix(ci): drop the orphaned try/with left by two overlapping edits codex_payload had two stacked attempts at the same context-manager change: try: with open(path, ...) as f: <- no body, so this is a syntax error try: with open(path, ...) as fh: head = list(_records(fh.read(65536))) IndentationError on import, so every job failed at `import glint` on both 3.8 and 3.12. Removed the orphaned two lines and kept the `fh` version, which is the one with a body. Nothing else touched. Co-Authored-By: Claude Code <[email protected]> --------- Signed-off-by: oleg koval <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: CodeRabbit <[email protected]>
1 parent 6887c8a commit 2469adb

5 files changed

Lines changed: 839 additions & 57 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,42 @@ preferences you already chose and every unrelated setting untouched:
1212
curl -fsSL https://raw.githubusercontent.com/oleg-koval/glint/main/install.sh | bash
1313
```
1414

15+
## [1.3.0] - 2026-08-05
16+
17+
### Added
18+
19+
- **Hydration reminder**: `💧 47m` joins the rest group once it has been 45
20+
minutes since your last drink, turning into `💧 1h40m drink` at twice that.
21+
Same rules as the break nudge: invisible until due, and it shares the same
22+
idle-gap clock. A break resets it too, on the assumption that getting up is
23+
when you refill the glass, so `glint.py --drank` is only for the times you
24+
drink at your desk. Interval is `GLINT_WATER_EVERY`, off with `GLINT_WATER=0`.
25+
- `--rest-status` now reports both clocks, and `--rested` resets both.
26+
27+
- **Codex CLI support** (`install-codex.sh`). Codex has no status-line hook, so
28+
glint reads the rollout log Codex already writes to
29+
`~/.codex/sessions/<date>/rollout-*.jsonl` and renders into the tmux status
30+
bar instead: `--harness codex --tmux`. The adapter translates Codex's session
31+
records into the same payload shape Claude Code pipes in, so every segment
32+
downstream is unchanged. Context comes from `model_context_window`, the cache
33+
ratio from the cached share of the last turn, and quota is bucketed by the
34+
`window_minutes` Codex reports. Cost and lines changed stay hidden because
35+
Codex does not record them. `to_tmux()` rewrites our ANSI colours as tmux
36+
format strings, doubles literal `#`, and drops hyperlinks, which a tmux status
37+
cannot render.
38+
- `--tmux` and `--width N` output flags, and `--harness claude|codex`.
39+
40+
### Changed
41+
42+
- **Long branch names are elided in the middle** instead of running off the
43+
line: `dubo-175-retire-k8s-lease-leader-election-from-the-sync-path-kill-gic`
44+
renders as `dubo-175-retir…path-kill-gic`. A ticket-prefixed branch carries
45+
its meaning at both ends and the words in between are the ones you can lose,
46+
so both ends are kept. This is a fix for a real loss of information: a 69
47+
character branch pushed the dirty count and ahead/behind markers, the part you
48+
actually watch while working, off the end of the line. Budget is 28 cells,
49+
configurable with `GLINT_BRANCH_MAX`.
50+
1551
## [1.2.0] - 2026-08-05
1652

1753
### Added
@@ -122,6 +158,7 @@ ahead/behind, session cost and duration, lines changed, and the live
122158
context-window gauge. One file, zero dependencies, graceful degradation, and a
123159
bare `✻ Claude` fallback so the prompt never breaks.
124160

161+
[1.3.0]: https://github.com/oleg-koval/glint/compare/v1.2.0...v1.3.0
125162
[1.2.0]: https://github.com/oleg-koval/glint/compare/v1.1.0...v1.2.0
126163
[1.1.0]: https://github.com/oleg-koval/glint/compare/v1.0.0...v1.1.0
127164
[1.0.0]: https://github.com/oleg-koval/glint/releases/tag/v1.0.0

‎README.md‎

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT"></a>
44
<img src="https://img.shields.io/badge/python-3.8%2B-3776AB.svg" alt="Python 3.8+">
55
<img src="https://img.shields.io/badge/deps-zero-2ea44f.svg" alt="Zero dependencies">
6-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/changelog-v1.2.0-blue.svg" alt="Changelog"></a>
6+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/changelog-v1.3.0-blue.svg" alt="Changelog"></a>
77
</p>
88

99
<p align="center">
@@ -29,7 +29,7 @@ Segments are **grouped by topic** (`session ┃ place ┃ change ┃ budget ┃
2929

3030
One Python file. Zero dependencies. ~75 ms per render. Never crashes your status bar.
3131

32-
> **New in v1.2.0**: topic groups, a break reminder, the open-PR segment, cache-hit ratio, quota pace, gauges that are now opt-in, an optional [compaction alert hook](#companion-compaction-alert-glint_alertpy), and Windows support. See the [changelog](CHANGELOG.md).
32+
> **New in v1.3.0**: a hydration reminder, middle-elided long branch names, topic groups, a break reminder, the open-PR segment, cache-hit ratio, quota pace, gauges that are now opt-in, an optional [compaction alert hook](#companion-compaction-alert-glint_alertpy), and Windows support. See the [changelog](CHANGELOG.md).
3333
3434
## Features
3535

@@ -40,12 +40,13 @@ One Python file. Zero dependencies. ~75 ms per render. Never crashes your status
4040
| ⏩ **Fast mode** | `⏩` | Shown when fast mode is on |
4141
| 📁 **Directory** | `my-repo` | Workspace basename, `~` for home |
4242
| 🌳 **Worktree** | `wt-refactor` | Active git worktree: from the payload's `worktree.name`, or detected via git on older versions. Hidden unless it differs from the directory segment, so normal repos stay quiet |
43-
| 🌿 **Git** | `main ●3 ↑1 ↓2` | Branch + uncommitted count + ahead/behind upstream. **Green when clean, yellow when dirty** |
43+
| 🌿 **Git** | `main ●3 ↑1 ↓2` | Branch + uncommitted count + ahead/behind upstream. **Green when clean, yellow when dirty**. A branch longer than 28 cells is elided in the middle (`dubo-175-retir…path-kill-gic`) so the counts you watch while working never get pushed off the line; budget is `GLINT_BRANCH_MAX` |
4444
| 💰 **Cost · time** | `$0.42 · 4m` | Session spend and duration. **Green < $1, gold < $5, red beyond** |
4545
| **Lines** | `+1.2k/-340` | Lines added / removed this session, `k`-shortened |
4646
| 🧠 **Context** | `75% 150k/200k → 50k left` | **Live** token usage. Gradient **green → yellow → red** as you fill up. From 70% a `→ 50k left` runway countdown appears; from 85% it turns into a bold red `⚠ 12k left` so you compact before you're forced to |
4747
| ♻️ **Cache hit** | `♻️ 94%` | Share of your context served from prompt cache (cache reads are ~10x cheaper than fresh input). **Green ≥ 80%, yellow ≥ 50%, red below** |
4848
| ⏱📅 **Rate limits** | `⏱5h 88% ↻59m ⚡110%` | Session (5h) and weekly (7d) rate-limit usage, same gradient, plus `↻` time until each window resets. Hidden if your plan doesn't report them |
49+
| 💧 **Hydration** | `💧 47m` | Minutes since your last drink, hidden until 45 of them, firmer (`💧 1h40m drink`) at twice that. Shares the break state file; a break resets both clocks, so getting up resets it; `--drank` covers drinking at your desk |
4950
| 🪑☕🛑 **Rest** | `☕ 52m break` | Minutes of **unbroken work**, hidden until 30 of them. Dim `🪑 34m` while you're fine, `☕ 52m break` at 50 minutes, bold red `🛑 1h35m stand up` at 90: each rung says what it wants, and the later ones survive a narrow line where the cost segment gets dropped. Reset it by walking away for 10 minutes, or tell it directly with `--rested` |
5051
| ▕███░░▏ **Gauges** | `36% ▕███░░░░░▏` | **Opt-in** (`GLINT_BARS=1`). Draws a block gauge beside the context and rate-limit percentages. Off by default: the colour already carries the signal, and the blocks cost ~10 columns a narrow window would rather spend on a segment |
5152
| ⚡ **Pace** | `⚡110%` | Appears **only when you're burning faster than the window elapses**: the share of quota you'd need by reset at the current rate. `⚡110%` = you run out ~10% early. Yellow past 105%, bold red past 150% |
@@ -130,6 +131,9 @@ Thresholds live in the `WARN_PCT` / `CRIT_PCT` constants at the top of the file.
130131
| `GLINT_REST_NUDGE` | `50` | Minutes of unbroken work before the yellow `☕`. The red `🛑` follows at 1.8× it; the quiet `🪑` starts at 60% of it **or 30 minutes, whichever is sooner** (so raising the nudge doesn't hide the clock for an hour) |
131132
| `GLINT_REST_SHOW` / `GLINT_REST_HARD` | `30` / `90` | Override those two derived thresholds directly |
132133
| `GLINT_REST_GAP` | `10` | Minutes of no renders that count as a break and reset the clock |
134+
| `GLINT_WATER` | on | `0` hides the hydration reminder |
135+
| `GLINT_WATER_EVERY` | `45` | Minutes between drinks before `💧` appears; it firms up at 2x |
136+
| `GLINT_BRANCH_MAX` | `28` | Cells a branch name may fill before its middle is elided |
133137
| `GLINT_REST_STATE` | temp dir | Where the work clock is kept (one file per user, shared by all your windows) |
134138
| `GLINT_COST` | on | `0` hides the cost · duration segment |
135139
| `GLINT_LINES` | on | `0` hides lines added/removed |
@@ -169,8 +173,9 @@ The thresholds aren't a single method, they're where three lines of evidence agr
169173
Walking away for ten minutes resets the clock by itself. A shorter stretch break doesn't, so there's a button for it:
170174

171175
```bash
172-
python3 ~/.claude/glint.py --rested # ☕ break logged: work clock back to zero
173-
python3 ~/.claude/glint.py --rest-status # 42 min since your last break (nudge at 50)
176+
python3 ~/.claude/glint.py --rested # break: resets the work clock and the water clock
177+
python3 ~/.claude/glint.py --drank # drank at my desk: resets water only
178+
python3 ~/.claude/glint.py --rest-status # prints both clocks and both thresholds
174179
```
175180

176181
Worth an alias (`alias rested='python3 ~/.claude/glint.py --rested'`) and inside Claude Code you can run it without leaving the session by typing `!rested`. The reminder disappearing is the receipt.
@@ -183,6 +188,42 @@ Treat them as defaults, not doctrine: `GLINT_REST_NUDGE=40` moves the whole ladd
183188
- **Python 3.8+** (standard library only: no `pip install`)
184189
- **git** (optional; the branch segment simply hides without it)
185190

191+
## Other harnesses (Codex CLI)
192+
193+
Claude Code is currently the only agent CLI that lets you supply the status line as a command. Verified in August 2026:
194+
195+
| Harness | Status line | External command hook |
196+
|---------|-------------|-----------------------|
197+
| Claude Code | `statusLine.command`, session JSON on stdin | **yes** |
198+
| Codex CLI 0.146 | built-in `tui.status_line`, a fixed set of item ids | no ([#20244](https://github.com/openai/codex/issues/20244), [#17827](https://github.com/openai/codex/issues/17827)) |
199+
| opencode 1.17 | built-in TUI bar | no ([#30295](https://github.com/anomalyco/opencode/issues/30295) is a proposal; `statusLine` appears nowhere in the shipped config schema) |
200+
| Hermes Agent | built-in bar, width-adaptive | no |
201+
| Cursor CLI | - | no |
202+
203+
Codex does not need a hook, though, because it already writes everything worth showing to `~/.codex/sessions/<date>/rollout-*.jsonl`. glint reads that and renders into your **tmux status bar** instead of Codex's own:
204+
205+
```bash
206+
curl -fsSL https://raw.githubusercontent.com/oleg-koval/glint/main/install-codex.sh | bash
207+
```
208+
209+
```text
210+
✻ G5.6-sol M │ 📁 glint 🌿 dubo-175-retir…kill-gic ●3 │ 🧠 8% 20k/258k ♻️ 50% 📅7d 100% ↻4.1d ⚡240% │ ☕ 52m break 💧 47m
211+
```
212+
213+
Use `--print` first to see the tmux block and a live preview without changing anything. The installer keeps a marked, idempotent block in `~/.tmux.conf`, so re-running refreshes it rather than stacking copies, and it leaves the rest of your config alone.
214+
215+
What you get and what you do not:
216+
217+
- **Works**: model with reasoning effort, context against the real `model_context_window`, cached share of the last turn, quota windows with reset ETAs and the pace marker, plus everything that never needed the harness (directory, git, break, hydration).
218+
- **Missing**: session cost and lines changed. Codex does not record them, and glint would rather omit a segment than invent one.
219+
- Quota is bucketed by the window length Codex reports (`window_minutes`), so a 300-minute window shows as `⏱5h` and 10080 as `📅7d`.
220+
221+
For any other tool, the harness-independent half still works next to it, including in a plain shell:
222+
223+
```bash
224+
python3 ~/.claude/glint.py --harness codex --tmux # or drop --harness for stdin JSON
225+
```
226+
186227
## Upgrading
187228

188229
Re-run the installer: it overwrites `~/.claude/glint.py` and leaves your settings alone:

0 commit comments

Comments
 (0)