Skip to content

feat(plugin): the mod draws the status line, dashboard link on the band - #735

Merged
OsherElhadad merged 1 commit into
mainfrom
fix/band-dashboard-link
Oct 26, 2026
Merged

OsherElhadad merged 1 commit into
mainfrom
fix/band-dashboard-link

Conversation

@OsherElhadad

@OsherElhadad OsherElhadad commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  1. Dashboard link on the band. 0.6.0 (feat(plugin): calm band, sectioned pane and a status line that keeps the cold cache #694, fix(plugin): tell the truth about unsupported pings and keep band row 1 on one line #698) left it in the pane only. It is back on band row 1, last: dashboard ↗, or dash ↗ below 80 columns. A terminal without OSC 8 prints the address after the label; the link is last in its own box, so then it wraps alone and row 1 stays whole.
  2. The mod draws the status line. Band row 2 carries the status line's figures, with its rules (_save_segment, _cache_segment, _ctx_numbers, the width order):
    ◆ next message $0.06 · $0.78 if cold [ Ping ]  hide  dashboard ↗
    saved $18.60 of $61.40 session · saved $4.20 of $20.50 subagents ↻ $0.27 pings │ cache ● █████░ 3:59 ↻ │ ctx █░░░░░░░ 9%
    └ agents  ● Explore 5m  ◐ code-reviewer <1m  ○ planner
    try /context-guru:insights — see where your money goes
    
    • ▲ update leads the row; on a Claude subscription 5h 34% · saved 1.2M rd / 85.0k wr replaces the money.
    • The clock counts each second. Once cold it is dim and counts up: cache ○ cold 1:07:04. ⏳ marks a copy older than a minute.
    • ctx uses the engine's own figures ($.session.usage(), session.measure), and the proxy's while its copy is fresh.
    • Narrow terminals drop the subagents phrase, then the labels, then the bars. The figures stay.
    • With no data and the proxy down: cg ✕ proxy offline.
  3. A saving never reads below $0.00, on the band and in the pane.
  4. A rotating command row. When no weekly tip applies, the last row shows one of insights, save-more and remove-mcp-and-skills with 4–5 words, the next one every 12 s.
  5. No status line by default. install.sh writes one only with --statusline. At SessionStart, statusline-repoint retires only the exact default line that an earlier install wrote (ours by record, no flags, refreshInterval 1, no statusline_asked). It takes a backup first and restores what the line replaced. A line with flags or a tuned interval, or one asked for by name, stays, is marked as asked, and is still repointed. Uninstall removes the new record. doctor checks the line only when it is installed.

cg.py cachestate now also returns update, manual_pings and the subscription window's window_saved, through the status line's own cache files and TTLs.

Data dependence

No change. Every new band figure is metadata the plugin already read: dollar totals, counts, timestamps and token counts from /api/cachestate and /api/stats?lean=1, the engine's context and rate-limit figures, and the local update-check.yaml. The band reads no request or response content, and it behaves the same at every storage level.

Test plan

  • claude plugin test context-guru-plugin: 79 pass, 0 fail. New tests cover: the status row, the narrow form, the floor at $0, the per-second clock, the cold count-up, ↻ pings, ▲ update, the subscription view, the offline notice, the rotating row, a sub-agent not lending main its plan or prices, and the redraw check seeing a moved clock. The last two each fail without their fix.
  • Go: TestRouteInstallsStatuslineByDefault (default off, --statusline on), TestSessionStartRetiresTheDefaultStatusLine, …KeepsAStatusLineTheUserAskedFor, …NeverRetiresAForeignStatusLine, …KeepsACustomisedPre061StatusLine, TestRetiringTheDefaultStatusLineTakesABackup, TestSettingsStatuslineRoundTrips (no record left, a created file deleted), TestCGCachestateCarriesTheStatusLinesExtras, TestCGCachestateSaysOfflineOnlyWhenNothingAnswers.
  • go test ./.... Four save-more golden tests (TestCGGoldens/save-more, TestSaveMoreWidthASCIIAndColour, TestCostlySettingsGoldens, TestSaveMoreDefaultIncludesTheSettingsCard) fail on main at ad87e36 too; this PR does not touch save-more. TestFeedbackMailCannotInjectHeaders failed once under full-suite load and passes 5/5 alone; proxy/ is not touched.
  • Live (the same band code, on the internal twin MLT/cg#49): Claude Code 2.1.310 in tmux against a sandbox server showed the migration message, the band at 60/80/150 columns, the counting and cold clocks, and a real Ping (↻ $0.03 pings).
  • Check on a Mac terminal after install.

🤖 Generated with Claude Code

@OsherElhadad OsherElhadad changed the title fix(plugin): put the dashboard link back on the band feat(plugin): the mod draws the status line, dashboard link on the band Oct 26, 2026

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @OsherElhadad) Claude Code 2.1.310 offload-review skill, @OsherElhadad's session fresh 2 of 2 1 of 2 fe2c9cb603fe blocking

Verdict: blocking

Findings

  1. context-guru-plugin/scripts/settings.py:3437 — uninstall leaves the new statusline_asked record in the user's settings file

    • What fails: install.sh --statusline (or add --url … --statusline …), then settings.py remove --url …. The file keeps "$context-guru": {"statusline_asked": true}. Our bookkeeping key outlives the uninstall. A file that context-guru created is not deleted, because data is not empty.
    • Proof: apply_statusline (line 220) now writes meta[STATUSLINE_ASKED_META] = True. remove_statusline_only pops it (line 298). But cmd_remove's routing branch has its own copy of the cleanup. It pops only STATUSLINE_META and STATUSLINE_PREV_META (lines 3437-3438). Then if not meta: data.pop(META) (line 3439) does not run, because statusline_asked is still there. maybe_delete_if_empty (line 2471) returns False for a non-empty data. TestUninstallRestoresTheBaseURLItReplaced asserts "no bookkeeping left behind", but it installs no status line. TestSettingsStatuslineRoundTrips installs one but does not check $context-guru. So no test catches this.
    • Fix: add meta.pop(STATUSLINE_ASKED_META, None) beside line 3438. Extend TestSettingsStatuslineRoundTrips to assert that $context-guru is absent after remove.
  2. context-guru-plugin/scripts/settings.py:269 — the migration also removes lines the user asked for and set up before 0.6.1, with no backup

    • What fails: before 0.6.1, no writer recorded statusline_asked. So retire_statusline removes every line of ours, not only the lines that a default install wrote. Example: a user ran /context-guru:statusline with --layout=detailed --hide=tools (skills/statusline/SKILL.md:188), or set their own refreshInterval. At the first 0.6.1 SessionStart, the line is deleted. /context-guru:statusline brings back a line, but not the flags the user chose. The PR text and docs/plugin/statusline.md:3 say only "a status line an earlier install wrote by default is removed".
    • Proof: retire_statusline returns False only when statusline_asked is True (line 276). Then it calls remove_statusline_only, which removes any line that is ours by record. cmd_statusline_repoint then calls save(real, data) with no backup(). cmd_off takes a backup before the same removal (line 3255).
    • Fix: retire only the exact default form. That is python3 "<…>/statusline.py" with no flags, and no refreshInterval other than the default that install wrote. Keep any other line and mark it as asked. Also take a backup() before save in the retire branch. Add a test with a flagged pre-0.6.1 line that must stay.
  3. context-guru-plugin/scripts/cg.py:277 — the band says cg ✕ proxy offline when the proxy is up but answers with an error or is slow

    • What fails: the proxy runs without --dashboard (a 404 on /api/cachestate), returns a 500, or takes more than 5 s. Each case gives {"error": "proxy not answering"}, and the band then shows "proxy offline". The status line uses those words only for an unreachable proxy (STATS_DOWN). It shows "stats loading…" for a timeout and shows no offline notice for an HTTP error (STATS_EMPTY).
    • Proof: Api.get (cg.py:79-82) catches OSError. urllib.error.HTTPError and TimeoutError are both subclasses of OSError, so they also return None. cachestate_cached turns None into "proxy not answering" (line 224). The backoff path also returns that error with no fetch. Line 277 maps this error to the offline notice. The new comment says "for an unreachable proxy", but the code cannot tell an unreachable proxy from the other cases. In statusline.py, lines 506-510 keep the three cases apart.
    • Fix: let cachestate_cached say why it failed. Use Api.send, which keeps the status, or record the failure kind as _fetch_stats does. Set the offline notice only for a refused connection. Add a cg.py test for a 404 proxy that expects no offline notice.
  4. PR description — no data-dependence statement

    • What fails: CLAUDE.md requires every PR that adds or changes a feature to state its data dependence and its behavior at each storage level. This PR adds band features: manual pings, the window's saved tokens, the ctx bar and the rotating row. The description has no such section.
    • Proof: the PR body has Summary and Test plan only. docs/data-dependence.md is not touched.
    • Fix: add a short section. My reading is that every new figure is metadata (counts, $ totals, timestamps and token counts from /api/cachestate, /api/stats?lean=1, and the local update-check file). So the dependence is probably unchanged, but the PR must say so.

Non-blocking

  • skills/statusline/SKILL.md:108-113 still says "It is on by default. /context-guru:install's own orchestrator … installs it". The model reads this skill, so it will tell users the wrong default. Update it to match install/SKILL.md.
  • start-proxy.sh:284-287: suppose the user later replaced our line by hand but our installed_statusline record stays. Then the grep matches at every SessionStart, and python3 starts each time, but retire_statusline changes nothing. The block's comment says "cheap by construction… once per update". This was true before this PR only for the plugin-cache branch. Consider dropping the stale record in that case.
  • cmd_add, statusline-only path (settings.py:2903): when the line is already identical, the call returns unchanged before apply_statusline. So statusline_asked is not set for a pre-0.6.1 line that has not been retired yet. Rare, but the next SessionStart then removes a line the user just asked for.
  • register.test.tsx "nothing ever read" test uses notice: 'cg ✕ token refused · /context-guru:status'. cg.py never produces this text. Add a test through cg.py for the proxy offline notice that the code really makes.
  • model.ts cacheClock: critical && true ? '!' : '' — && true does nothing.
  • The 1 s tick bumps tick while the band is hidden too, and it does so forever while a cold clock shows. It does no reads, so the cost is small.

What I checked

  • The full diff ad87e369..fe2c9cb6, all 14 files, every changed line. I read both commits.
  • settings.py: apply_statusline, retire_statusline, remove_statusline_only, repoint_statusline, cmd_statusline_repoint, cmd_off, both branches of cmd_remove, cmd_add's statusline gate, and maybe_delete_if_empty.
  • start-proxy.sh step 0b: the new grep gate and its fall-through to the old repoint case.
  • install.sh: --statusline / --no-statusline parsing and the statusline=off output, against install/SKILL.md.
  • cg.py: status_extras against the statusline.py helpers it calls (_update_available_segment, _fetch_stats, _bg_json, _saved_tokens_text, WINDOW_TTL_SECONDS, the win- cache tag), cachestate_cached, Api.get, and the doctor change. The Codex copy has no statusline.py. The import fails inside the try, so it fails open.
  • model.ts: mainEntry against statusline.py _main_cs, clockOf / cacheClock, ctxNumbers, moneyPair's $0 floor, the anchor in signature, and the window / sameModel rule.
  • register.tsx: load (the window start in ms, matching _window_start_ms), ticked, engineFigures against the 2.1.307 SessionMeasureInput / SessionRateLimit types, statusRow's width order, the row priority, the notice branch, the link, and the pane floor.
  • dash/cachestate.go cacheState: the none document, window / window_exact / keepalive.
  • The new and changed tests in register.test.tsx, plugin_test.go and statusline_repoint_test.go, and the docs in docs/plugin/statusline.md and doctor.md.
  • I did not run tests (not approved). Go is not installed.

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (claude, user of @OsherElhadad) Claude Code 2.1.310 offload-review skill, @OsherElhadad's session fresh 1 of 2 1 of 2 fe2c9cb603fe blocking

Verdict: blocking

Findings

  1. context-guru-plugin/scripts/settings.py:3437 — uninstall leaves statusline_asked behind, so a file context-guru created is no longer deleted

    • What fails: install.sh --statusline (or /context-guru:statusline), then /context-guru:uninstall. cmd_remove pops installed_statusline and previous_statusline, but not the new statusline_asked. The file keeps {"$context-guru": {"statusline_asked": true}}. maybe_delete_if_empty then sees a non-empty dict and keeps the file. Uninstall used to delete a settings file that context-guru created. Now it leaves a stub.
    • Proof: I ran settings.py add --file F --url http://127.0.0.1:8787/anthropic --statusline /opt/cg/statusline.py, then settings.py remove --file F --url …, on a temp HOME.
      • Base ad87e369: file_deleted=true, and the file is gone.
      • Head: result=removed, and F still holds {"$context-guru": {"statusline_asked": true}}. With a theme key in the file, the stub sits next to it.
      • remove_statusline_only (line 298) pops the key. The full-remove branch at lines 3436-3437 does not.
    • Fix: add meta.pop(STATUSLINE_ASKED_META, None) next to line 3437. Add a Go test: add --statusline then remove on a new file gives file_deleted=true (TestSettingsStatuslineRoundTrips checks only statusLine).
  2. context-guru-plugin/scripts/settings.py:269 — the migration also removes lines the user asked for by name before 0.6.1

    • What fails: before this PR, apply_statusline never wrote statusline_asked. So a line from /context-guru:statusline on 0.6.0 or earlier looks the same on disk as a default install. That includes a custom one, for example --layout=detailed --hide=tools from skills/statusline/SKILL.md:188. At the next SessionStart, retire_statusline removes it. The docstring ("Never a line the user asked for by name") and docs/plugin/statusline.md:3 ("A status line an earlier install wrote by default is removed") say this does not happen. The user also loses their layout flags.
    • Proof: git show ad87e369:context-guru-plugin/scripts/settings.py. apply_statusline there writes only installed_statusline and previous_statusline. retire_statusline returns False only when statusline_asked is True. start-proxy.sh:284-287 sends every file that has installed_statusline and no statusline_asked to statusline-repoint.
    • Fix: retire only the exact default command that install.sh wrote: python3 "<…>/scripts/statusline.py" with no flags (install.sh:1373). Keep any command that has flags. Or say in the docs and the SessionStart message that this also removes a line made by hand on an older version, and how to get it back.
  3. context-guru-plugin/scripts/cg.py:277 — cg ✕ proxy offline shows for a proxy that answers

    • What fails: cachestate_cached returns {"error": "proxy not answering"} for any Api.get failure: refused, a 5 s timeout, 401, 404, 500, or a body that is not JSON. The new branch turns all of these into cg ✕ proxy offline. The status line keeps that text for an unreachable proxy only (statusline.py:28-37, STATS_DOWN). For slow or hung it says cg? not responding or stats loading…, and for a non-2xx answer it shows nothing (STATS_EMPTY). So a slow proxy, a dashboard that is off, or a refused token now shows "offline" on the band.
    • Proof: I started a local HTTP server that answers 404, then 401, and ran cg.py cachestate --json --session sess-1 --port <p> against each. Both printed {"error":"proxy not answering","notice":"cg ✕ proxy offline"} with exit 1.
    • Fix: make cachestate_cached tell the cases apart, using Api.send's status (0 = no answer, -1 = timeout, HTTP code). Set notice only for 0. Optional: cg? not responding for a timeout.
  4. context-guru-plugin/cg_test.go — the new cg.py cachestate output has no test

    • What fails: nothing tests status_extras (update, manual_pings, window_saved), --window-start-ms, or notice. The TSX tests mock the helper's stdout. The offline-notice test (register.test.tsx, "nothing ever read, and the proxy is down") feeds cg ✕ token refused · /context-guru:status, a string cg.py never makes. A rename in statusline.py (_fetch_stats, _bg_json, _saved_tokens_text, _update_available_segment) would silently blank these fields, because status_extras catches every exception.
    • Proof: grep -n 'window-start-ms\|status_extras\|"notice"' context-guru-plugin/*_test.go finds nothing.
    • Fix: add a cg_test.go case on the existing stub (statuslineCounting). It must check manual_pings and window_saved with --window-start-ms, update from a fake update-check.yaml, and notice for a dead port only (finding 3).
  5. Commits 5871cd9 and fe2c9cb — the commit rules in CLAUDE.md are not met

    • What fails: CLAUDE.md says "DCO sign-off is mandatory" and "AI attribution uses Assisted-By: — never Co-Authored-By".
    • Proof: git log --format=%B ad87e369..HEAD. 5871cd9 has no Signed-off-by:. Both commits use Co-Authored-By: Claude Opus 5.5 ….
    • Fix: reword both commits with git commit -s and an Assisted-By: line.

Non-blocking

  • register.tsx ticked: the tick runs once a second for the whole session, also while the cache is cold, while the band is hidden, and while a survey shows. Each tick reads the snapshot and redraws the band. Skip the tick when isHidden is true.
  • model.ts: row 1 (isWarm, from coldAt) lets held_until_ms hold the cache warm even after the entry has expired. The new clock (clockOf) correctly does not. When a planned ping fails, row 1 can say warm with a Ping button while row 2 says cache ○ cold. This is older code, but now both are on one band.
  • cacheClock: critical && true is the same as critical.
  • The migration removes the status line for every user at the next session, including users on a host that cannot load the mod (modules in hooks.json). Is there a minimum Claude Code version for the band? If an older host shows no band, those users lose both displays.
  • The PR body does not state the data dependence, as CLAUDE.md asks. The band reads only metadata (money, counts, timestamps, token counts), so this is a sentence in the PR body, not a change to docs/data-dependence.md.
  • skills/statusline/SKILL.md:107 still says "It is on by default. /context-guru:install … installs it". This PR makes that text wrong.

What I checked

  • CLAUDE.md, and docs/design.md for the layout rules. The change stays in the plugin, and no library package changed.
  • Every changed line in all 14 files. Both commit messages. The PR body.
  • model.ts against statusline.py: remaining_seconds, held_seconds, _until_cold, _cache_segment, _main_cs, _ctx_numbers, _money_pair, _manual_ping_mark, _subscription/_window_start_ms. The clock, the colour bands, ↻, the main-thread merge, the window-model rule and the cache tag win-<s> match.
  • dash/cachestate.go: the JSON field names the mod reads (window, window_exact, money.others.threads, held_until_ms, keepalive), and the none: true answer before a first touch (the band then stays empty, no notice).
  • The mod API types (SessionMeasureInput, SessionRateLimit, SessionContextUsage) for rateLimits, resetsAt and context.window.
  • settings.py apply_statusline, retire_statusline, remove_statusline_only, cmd_statusline_repoint, cmd_remove. start-proxy.sh grep gate. install.sh flag parsing and statusline=off.
  • The Codex copy of cg.py is the same file. Its folder has no statusline.py, so status_extras fails open there (ImportError is caught).
  • I ran Python only, on temp folders: findings 1 and 3. I ran no Go and no TSX tests.

@OsherElhadad
OsherElhadad force-pushed the fix/band-dashboard-link branch from fe2c9cb to f2c5e16 Compare October 26, 2026 17:31
@OsherElhadad

Copy link
Copy Markdown
Collaborator Author

Replies to round 1 (both reviewers). All fixes are in f2c5e16. The branch is now one commit with Signed-off-by and Assisted-By.

R1 #1, R2 #1: uninstall leaves statusline_asked. Fixed. cmd_remove pops it. TestSettingsStatuslineRoundTrips now checks that no $context-guru record stays. It also checks that a file context-guru created is deleted (file_deleted=true). The test fails without the fix.

R1 #2, R2 #2: the migration removes lines that the user asked for before 0.6.1. Fixed. retire_statusline removes only the exact default form: python3 "<…>/scripts/statusline.py", no flags, and refreshInterval 1. Any other line of ours stays and gets statusline_asked: true. The retire branch now takes a backup() first. New tests: TestSessionStartKeepsACustomisedPre061StatusLine (flags, and a tuned interval) and TestRetiringTheDefaultStatusLineTakesABackup. The non-blocking cmd_add case is fixed too: an unchanged re-ask records statusline_asked.

R1 #3, R2 #3: proxy offline for a proxy that answers. Fixed. cachestate_cached now uses Api.send and records down, timeout or empty, as _fetch_stats does. Only down (status 0) gives the notice. TestCGCachestateSaysOfflineOnlyWhenNothingAnswers: 404 and 500 give no notice, a dead port does.

R1 #4: no test for the new cg.py cachestate output. Fixed. TestCGCachestateCarriesTheStatusLinesExtras checks update (from a fake update-check.yaml), manual_pings, and window_saved with --window-start-ms.

R1 #5: commit rules. Fixed: DCO sign-off, and Assisted-By: instead of Co-Authored-By.

R2 #4: data dependence. Added to the PR body: no change, metadata only.

Non-blocking:

  • skills/statusline/SKILL.md: now says off by default.
  • critical && true: removed.
  • The tick: it now does nothing while the band is hidden.
  • Older hosts that cannot load the mod: not changed. The plugin's mod has needed modules since feat(plugin): Claude Code band with cache state and a Ping button #651 (0.5.x), and hooks.json already lists it. A host with no mod support also had no band or Ping before. Such a user can run /context-guru:statusline.
  • Row 1 (coldAt, with held_until_ms) against row 2 (clockOf): kept as it is. Row 1 says what the next message costs while a plan holds the cache. Row 2 is the status line's clock, which also does not revive an expired entry. I will look at this in a follow-up if you want.
  • The "nothing ever read" TSX test feeds a notice string through a stub. The real string from cg.py is now tested in Go.
  • start-proxy.sh running python3 every SessionStart when the record stays but the line was replaced by hand: retire_statusline returns False there. This is rare, and it costs one python3 start. Not changed.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.310 offload-review skill, @amiddavid's session fresh 2 of 2 2 of 2 f2c5e16dfc33 blocking

Verdict: blocking

Findings

  1. docs/plugin/statusline.md:309 — the doc still says the install writes the status line by default
    • What fails: a user reads the "Turn it on, off, or change it" section. It says "/context-guru:statusline installs it (the install also does this by default)". After this PR, the install writes no line unless asked. The sentence contradicts line 3 of the same file ("the install no longer writes a status line"), which this PR itself added, and skills/install/SKILL.md:192 ("off is the default").
    • Proof: docs/plugin/statusline.md:309. The PR edits this file (33 lines changed) and fixed the same stale claim in skills/statusline/SKILL.md, but missed this one.
    • Fix: delete "(the install also does this by default)", or replace with "(or install.sh --statusline)". One line, doc only.

Non-blocking

  • The band shows nothing when the proxy times out (failure: "timeout"). The status line says cg? not responding there. The doc (statusline.md:201) promises the notice only for a proxy that is down, so this is a divergence in words, not a defect.
  • cmd_add with both --url and --statusline for a line already present: the full-unchanged return at settings.py:2943 still does not record statusline_asked. install.sh never combines the two flags and the skill uses the statusline-only path, so I found no caller that reaches it. Noted because the same gap in the statusline-only path was fixed this round.
  • The kept-line branch of cmd_statusline_repoint (settings.py:3107) saves without a backup. It only adds the statusline_asked record and removes nothing, so no backup is owed. Agree with the design.

What I checked

  • Last review: round 1, fe2c9cb, 2026-10-26T17:19:45Z.
  • New commits read: 1 — f2c5e16d "feat(plugin): the mod draws the status line, dashboard link on the band". The branch was force-pushed: this one commit squashes the two round-1 commits (5871cd9d, fe2c9cb6) and adds the fixes. fe2c9cb6 is not an ancestor of the new head, so I read git diff fe2c9cb6..HEAD in full (390 lines, 9 files) plus the changed code around each hunk.
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files).
  • New items since my last review, and what I did about each:
    • Reviewer 1's round-1 review (17:25:56Z). Findings 1-3 match mine. Finding 4 (no test for the new cg.py cachestate output) and 5 (commit rules) — both checked as fixed, below.
    • The author's reply (17:31:41Z). Every fix claim in it checked against the code, line by line.
    • The new head commit. Reviewed as a first review below.
  • Earlier findings, both reviewers:
    • R1#1 / R2#1, uninstall leaves statusline_asked: fixed. cmd_remove pops it (settings.py:3463); the statusline-only branch pops it through remove_statusline_only (settings.py:310). TestSettingsStatuslineRoundTrips now asserts no $context-guru record stays and that a file we created is deleted (file_deleted=true). The assertion fails without the fix, as the author claims.
    • R1#2 / R2#2, the migration removes lines asked for before 0.6.1: fixed. retire_statusline now retires only the exact default form: _DEFAULT_STATUSLINE fullmatch (the bare python3 "<…>/scripts/statusline.py" that install.sh:1373 writes) and refreshInterval 1 (settings.py:287). Any other line of ours is kept and marked asked; meta is a dict whenever that branch runs, because is_ours_statusline requires the record. The retire branch takes a backup() before the removal (settings.py:3109), and the kept branch saves without one, which is right because it removes nothing. cmd_statusline_repoint's identity check (data.get(STATUSLINE_KEY) is kept) separates the two cases correctly: a removal either deletes the key or restores a different object. Tests: TestSessionStartKeepsACustomisedPre061StatusLine (flags, tuned interval) and TestRetiringTheDefaultStatusLineTakesABackup (glob matches backup()'s real path and name pattern). The non-blocking cmd_add unchanged case is fixed too (settings.py:2916-2922).
    • R1#3 / R2#3, proxy offline for a proxy that answers: fixed. cachestate_cached uses Api.send, which returns 0 for no answer, -1 for a timeout, the HTTP code otherwise; the failure kind is recorded and returned, and only down sets the notice (cg.py:286-287). The backoff path carries the recorded kind. TestCGCachestateSaysOfflineOnlyWhenNothingAnswers covers 404, 500 and a dead port with fresh cache dirs, so no cross-run backoff pollution.
    • R1#4, no test for the cachestate extras: fixed. TestCGCachestateCarriesTheStatusLinesExtras drives the real cg.py against a stub proxy. I checked its expectations against the helpers it exercises: update-check.yaml with answer: ask gives ▲ update v0.6.9 (_update_available_segment, no proxy-version file to suppress it); manual_pings comes from the session-scoped /api/stats; saved 1.2M rd / 85.0k wr matches _saved_tokens (read = replay_tokens, write = saved_unique) and _human's format. runCG/runCGCode exist in cg_test.go and set CLAUDE_CODE_SESSION_ID=session-A, matching the stub.
    • R1#5, commit rules: fixed. f2c5e16d carries Signed-off-by: and Assisted-By:, no Co-Authored-By.
    • R2#4, data dependence: fixed. The PR body now has a "Data dependence" section: no change, metadata only, same at every storage level.
  • Rejections I checked and accept:
    • Row 1 (coldAt, held_until_ms) vs row 2 (clockOf): the author's reason holds. Row 1 prices the next message while a plan holds the cache; row 2 is the status line's clock. A follow-up is offered. Not a defect I can prove.
    • start-proxy.sh starting python3 each SessionStart when the record stays but the line was replaced by hand: rare, one python3 start, fails open. The new kept-line marking shrinks this case further. Accept.
    • Older hosts with no mod support: hooks.json already needs modules since 0.5.x, and /context-guru:statusline remains. Accept.
  • New commit, first-review pass: cachestate_cached's new shape against both other callers (cg.py:434, cg.py:1504 — neither passes fetch, so the changed injected-fetcher contract touches nothing in-tree); the codex copy of cg.py is byte-identical; model.ts (critical && true removed); register.tsx ticked returns early while hidden; the two new Go test files' imports, helpers and package; skills/statusline/SKILL.md now says off by default; the PR body.
  • I did not run tests (not approved). Go is not installed.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.310 offload-review skill, @amiddavid's session fresh 1 of 2 2 of 2 f2c5e16dfc33 approve

Verdict: approve

Findings

None. Every round-1 finding is fixed, and the fix code has no defect I can show.

Status of the round-1 findings

  1. Uninstall leaves statusline_asked (R1 #1, R2 #1) — fixed. cmd_remove pops it (settings.py:3463). remove_statusline_only pops it too (settings.py:310). I ran add --statusline then remove on a fresh temp file: file_deleted=true, and the file is gone. TestSettingsStatuslineRoundTrips now checks both: no $context-guru after remove, and file_deleted=true for a file we created.
  2. The migration removed lines asked for before 0.6.1 (R1 #2, R2 #2) — fixed. retire_statusline (settings.py:273) now retires only the exact default form: _DEFAULT_STATUSLINE fullmatch, no flags, refreshInterval 1. Anything else of ours stays and is marked asked. The retire branch takes a backup() first (settings.py:3109). I ran all six cases through the real function on temp data: flags kept, interval 5 kept, exact default removed, default with no refreshInterval removed, a recorded previous line restored, an asked line untouched.
  3. proxy offline for a proxy that answers (R1 #3, R2 #3) — fixed. cachestate_cached uses Api.send and records down (status 0), timeout (-1) or empty (any other status). Only down gets the notice (cg.py:286). I read Api.send: connection refused gives 0, a read timeout gives -1, an HTTP error gives its code. So 404 and 500 give empty, no notice. TestCGCachestateSaysOfflineOnlyWhenNothingAnswers covers 404, 500 and a dead port.
  4. No test for the cachestate output (R1 #4) — fixed. TestCGCachestateCarriesTheStatusLinesExtras checks update (fake update-check.yaml in CONTEXT_GURU_STATE), manual_pings and window_saved with --window-start-ms. I checked the helpers it goes through (_update_available_segment, _fetch_stats, _bg_json, _saved_tokens_text) and the strings it expects: all match, and a duplicate CONTEXT_GURU_STATE in the child env resolves to the test's value (checked: Python keeps the last entry).
  5. Commit rules (R1 #5) — fixed. One commit, Signed-off-by: present, Assisted-By: instead of Co-Authored-By:.
  6. Data dependence (R2 #4) — fixed. The PR body has a Data dependence section: no change, metadata only.

Non-blocking items from round 1: SKILL.md now says off by default; critical && true removed; the tick does nothing while hidden; the real offline string is now tested in Go. The author declined three with reasons I checked and accept: the start-proxy.sh python3 start (rare, one start, retire_statusline returns False there), the row-1/row-2 warm wording (documented intent, follow-up offered), and older hosts without mod support (the mod has needed modules since 0.5.x, so those users had no band before either).

Non-blocking

  • settings.py:2943 — add --url … --statusline … on an already complete install does not record statusline_asked. The early unchanged return (line 2948) skips apply_statusline, so a pre-0.6.1 default line re-asked for this way is still retired at the next SessionStart. I ran it: result=unchanged, no statusline_asked written. No shipped caller passes both flags — install.sh's routing add passes no --statusline, its statusline add passes no --url, and the skill passes no --url — so only a hand-run command hits it, and the retire is backed up and reversible. Fix: the same marking the no---url branch now does (settings.py:2916).
  • settings.py:3111 — the retire message is wrong when a previous line was restored. If our default line had replaced a user line (recorded previous_statusline), the retire restores it, but the print still says the status line "moved into the Context Guru band". The behavior is right; only the words mislead.
  • settings.py:2916 — the unchanged re-ask marking has no test. I verified it by hand (result=unchanged, statusline_asked written). The round-trip test's re-add passes --url, so it goes around this branch.

What I checked

  • Last review: round 1, fe2c9cb, 2026-10-26T17:25:56Z.
  • New commits read: 1 — f2c5e16 "feat(plugin): the mod draws the status line, dashboard link on the band". The branch was force-pushed into this single commit; fe2c9cb is not an ancestor, so I read the tree diff fe2c9cb..f2c5e16d (390 lines, 8 files) as the change since my last review, and the round-1 diff for the rest.
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files).
  • New items since my last review: the commit f2c5e16 (whole delta read, file by file below) and the author's reply comment (each claim checked against the code, as above).
  • settings.py: retire_statusline, _DEFAULT_STATUSLINE against install.sh's default command (python3 "<…>/scripts/statusline.py", refreshInterval 1), remove_statusline_only, cmd_statusline_repoint's kept/removed identity split and its backup order, cmd_add's unchanged re-ask marking and the --url early return, cmd_remove's cleanup, backup()'s file naming against the new test's glob.
  • cg.py (both copies are byte-identical): cachestate_cached's new status handling against Api.send's contract (0 / -1 / HTTP code), record_failure/backoff kinds in cgcache.py, cmd_cachestate's notice gate, status_extras against the statusline.py helpers it calls and their URLs, and the new Go tests' stubs against those URLs and strings.
  • register.tsx ticked (the hidden check and what happens on unhide), model.ts cacheClock.
  • The new and extended tests: cg_cachestate_test.go, statusline_repoint_test.go (both new tests, against the repointEnv helpers), plugin_test.go's round-trip extension.
  • The PR body's data-dependence section, skills/statusline/SKILL.md's new default, and the commit message's trailers.
  • I ran Python only, on temp folders: the six retire cases, add --statusline + remove on a fresh file, the re-ask with and without --url, and the duplicate-env resolution. I ran no Go and no TSX tests.

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (claude, user of @OsherElhadad) Claude Code 2.1.310 offload-review skill, @OsherElhadad's session resumed 1 of 2 2 of 2 f2c5e16dfc33 blocking

Verdict: blocking

Findings

  1. docs/plugin/statusline.md:309 — agree with reviewer 2 (round 2), finding 1
    • What fails: the line says "/context-guru:statusline installs it (the install also does this by default)". Line 3 of the same file says the install no longer writes a status line. install.sh now emits statusline=off by default.
    • Proof: I read line 309 at f2c5e16d. No new proof beyond reviewer 2's.
    • Fix: replace "(the install also does this by default)" with "(or install.sh --statusline)". This is a doc-only fix. With it, I have no other finding.

Non-blocking

  • cmd_statusline_repoint (settings.py:3106-3108): a kept pre-0.6.1 line (it has flags or a tuned interval) is marked asked, and then continue skips repoint_statusline for this session. So the line points at the old plugin version for one more session. The next SessionStart repoints it, because the start-proxy.sh plugin-cache case still matches. The old version stays in the cache, so the line works. To fix it, fall through to the repoint instead of continue.
  • _DEFAULT_STATUSLINE also matches a bare line that a user made with /context-guru:statusline and no flags. That skill writes the same string as the install. The two cannot be told apart on disk. The SessionStart message names the command that brings the line back, so I accept this.

What I checked

  • Last review: round 1, fe2c9cb, 2026-10-26T17:25:56Z
  • New commits read: 1. f2c5e16d feat(plugin): the mod draws the status line, dashboard link on the band. The author force-pushed. This one commit replaces 5871cd9 and fe2c9cb, so git log fe2c9cb6..HEAD lists it alone. I read git diff fe2c9cb6 HEAD in full (9 files) and the code around each hunk. The Codex copy of cg.py is still the same byte for byte.
  • Read in full: 3 reviews, 1 comment, 0 inline comments (from the three files).
  • New items since my last review:
    • The author's reply (17:31:41Z). I checked each fix claim against the code and with runs (below).
    • Reviewer 2, round 2 (17:38:47Z, glm). I checked finding 1 myself: agree, see Findings. I checked its non-blocking points. The timeout case shows no notice, by design. cmd_add with --url and --statusline has no in-tree caller. The kept line saves with no backup, which is correct because nothing is removed.
    • The new head commit: reviewed as in round 1.
  • Earlier findings:
    • R1#1 / R2#1 (uninstall leaves statusline_asked): fixed. cmd_remove pops it (settings.py:3463). TestSettingsStatuslineRoundTrips checks that the record is gone and that file_deleted=true.
    • R1#2 / R2#2 (the migration removes lines asked for before 0.6.1): fixed. I ran retire_statusline on 6 temp documents:
      • the bare default: removed;
      • the default that replaced a line: removed, and the old line comes back;
      • with --layout=detailed: kept, marked asked;
      • with refreshInterval 5: kept, marked asked;
      • already asked: no change;
      • no refreshInterval (pre-cbaa4041): removed.
      • git tag --contains shows that no release ever wrote refreshInterval 5. 11f465d and cbaa404 are in the same tags. So != 1 keeps only lines that a user tuned. The regex matches both forms that the install ever wrote: ${CLAUDE_PLUGIN_ROOT}/scripts/statusline.py and the resolved route_here path. The retire takes backup() first. cmd_add records statusline_asked when the same line is asked for again.
    • R1#3 / R2#3 (proxy offline for a proxy that answers): fixed. I ran cg.py cachestate --json two times against a 404 server: failure: empty, no notice, also on the second run inside the back-off. Two times against a dead port: failure: down and cg ✕ proxy offline both times. statusline.py writes timeout or error into the same cs- back-off file. Neither is down, so the band shows no offline notice for them.
    • R1#4 (no test for the new cachestate output): fixed. cg_cachestate_test.go checks update, manual_pings, window_saved with --window-start-ms, and the notice for 404, 500 and a dead port. I checked the expected strings against _update_available_segment, _saved_tokens_text and _human.
    • R1#5 (commit rules): fixed. f2c5e16d has Signed-off-by: and Assisted-By:, and no Co-Authored-By.
    • R2#4 (data dependence): fixed. The PR body has a "Data dependence" section: no change, metadata only. I agree.
    • My non-blocking points:
      • Tick while hidden: fixed (register.tsx:140).
      • critical && true: fixed.
      • skills/statusline/SKILL.md: fixed.
      • Row 1 against row 2: the author kept it and gave a reason. I accept it: row 1 shows what the next message costs, and it is older code.
      • Hosts with no mod: I accept the reason. modules has been in hooks.json since 0.5.x, and /context-guru:statusline stays.
  • I ran Python only, on temp folders. I ran no Go and no TSX tests (not approved).

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @OsherElhadad) Claude Code 2.1.310 offload-review skill, @OsherElhadad's session resumed 2 of 2 2 of 2 f2c5e16dfc33 approve

Verdict: approve

Findings

None. All round-1 findings from both reviewers are fixed. The fixes add no new defect that I can show.

Status of the round-1 findings

  • R2 #1 / R1 #1 (uninstall leaves statusline_asked): fixed. cmd_remove pops it now (settings.py:3463). TestSettingsStatuslineRoundTrips checks that $context-guru is gone. It also checks that a file context-guru created is deleted (file_deleted=true).
  • R2 #2 / R1 #2 (the migration removes lines the user asked for before 0.6.1): fixed. retire_statusline now removes only python3 "<…>/scripts/statusline.py", with no flags and refreshInterval 1 or absent. It keeps any other line and marks it as asked. I checked the old releases: v0.4.0 and v0.4.2 wrote no refreshInterval, and v0.5.0 to v0.6.0 wrote 1 (git show vX:…/settings.py). The value 5 was only in commit 11f465d, between two tags, so no release wrote it. All default installs therefore match the rule, and a line with flags stays. The retire branch now calls backup() before save(). New tests: TestSessionStartKeepsACustomisedPre061StatusLine and TestRetiringTheDefaultStatusLineTakesABackup.
  • R2 #3 / R1 #3 (proxy offline for a proxy that answers): fixed. cachestate_cached now uses Api.send. A refused connection gives URLError → 0 → down. A timeout gives -1 → timeout. An HTTP error or a body that is not a JSON object gives empty. Only down sets the notice. The back-off path keeps the recorded kind. An old record with kind: "error" gives no notice, and that is the safe side. TestCGCachestateSaysOfflineOnlyWhenNothingAnswers covers 404, 500 and a dead port.
  • R2 #4 (data dependence): fixed. The PR body has a Data dependence section: "No change", metadata only. I agree with it.
  • R1 #4 (no test for the cg.py cachestate extras): fixed. TestCGCachestateCarriesTheStatusLinesExtras checks update, manual_pings and window_saved with --window-start-ms. Go's exec keeps the last duplicate env key, so the test's CONTEXT_GURU_STATE replaces the one in runCGCode.
  • R1 #5 (commit rules): fixed. f2c5e16 has Signed-off-by: Osher Elhadad and Assisted-By:, and no Co-Authored-By.
  • My round-1 non-blocking points: SKILL.md fixed. critical && true fixed. The cmd_add re-ask now records statusline_asked. The tick now stops while the band is hidden. The author did not change the start-proxy.sh python3 start when the record is stale. The reason is that it is rare and costs one python3 start. I accept this.

Non-blocking

  • cmd_statusline_repoint (settings.py:3106-3108): when a customised pre-0.6.1 line is marked as asked, the loop runs continue. So repoint_statusline does not run in that session. The line moves to the new plugin version at the next SessionStart, when the grep's *plugins/cache* branch runs. One session runs the old script. This is harmless, but you can call repoint_statusline(data, running) before that save.
  • status_extras calls statusline.py helpers. Their _http_get stops at _T0 + 0.36 s, counted from the import. On a loaded machine the first _bg_json read for window_saved can time out. That starts the detached refresher and leaves the field out for one poll. In the real band the next poll fills it in. In TestCGCachestateCarriesTheStatusLinesExtras the field is asserted on the first call, so the test can fail now and then under full-suite load.

What I checked

  • Last review: round 1, fe2c9cb, 2026-10-26T17:19:45Z
  • New commits read: 1. The author squashed the branch into one commit, f2c5e16 "feat(plugin): the mod draws the status line, dashboard link on the band". git log fe2c9cb6..HEAD lists only f2c5e16, and the merge base is ad87e36. So I read git diff fe2c9cb6 f2c5e16d (9 files, +220/−25) in full as the new work. I also read the new commit message.
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files).
  • New items since my last review:
    • Reviewer 1's round-1 review (17:25:56Z). I checked each of its findings above, against the new code.
    • The author's reply comment (17:31:41Z). I checked each claim against the diff. For the refreshInterval rule, I also checked the git history of the release tags.
  • Changed files read around each change: settings.py (retire_statusline, is_ours_statusline, _statusline_value, cmd_add's statusline-only path, cmd_statusline_repoint, cmd_remove, backup), cg.py (Api.send, cachestate_cached, cmd_cachestate; the Codex copy is the same), cgcache.py (backoff, record_failure), register.tsx ticked, model.ts cacheClock, skills/statusline/SKILL.md, and the new and changed Go tests (cg_cachestate_test.go, plugin_test.go, statusline_repoint_test.go, and the runCGCode helper).
  • start-proxy.sh: save() writes json.dump(indent=2), so the result has "statusline_asked": true. The shell grep '"statusline_asked": *true' matches it.
  • The PR body: the Data dependence section and the updated test plan.
  • I did not run tests (not approved). Go is not installed.

The dashboard link is back on band row 1, last: `dashboard ↗`, or
`dash ↗` below 80 columns. 0.6.0 left it in the pane only.

The band now carries what the status line drew, with the same rules:
`▲ update`, `saved $x of $y session · saved $z of $q subagents
↻ $p pings` (on a subscription `5h 34% · saved … rd / … wr`), the
cache clock that counts each second (dim `cache ○ cold m:ss` once
cold) and `ctx`. Its last row rotates through /context-guru:insights,
/context-guru:save-more and /context-guru:remove-mcp-and-skills with a
few words each, unless the weekly tip applies. A saving never reads
below $0.00. With nothing read and no proxy answering, the band says
`cg ✕ proxy offline`; a proxy that answers with an error is not
offline.

install.sh writes the statusLine only with --statusline. At
SessionStart, statusline-repoint retires the exact default line an
earlier install wrote (ours by record, no flags, refreshInterval 1),
after a backup, and restores what it replaced. A line with flags or a
tuned interval, or one asked for by name, stays and is marked as
asked. Uninstall removes the new record too. doctor checks the line
only when it is installed.

Assisted-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Osher Elhadad <[email protected]>
@OsherElhadad

Copy link
Copy Markdown
Collaborator Author

Replies to round 2. Both changes are in the head commit.

R1 #1 / R2 (first round-2 review) #1: docs/plugin/statusline.md:309 said the install writes the line by default. Fixed. It now reads "(or install.sh --statusline)". That was reviewer 1's only finding.

R1 non-blocking: a kept pre-0.6.1 line was not repointed in the same run. Fixed. The kept branch now calls repoint_statusline before save, as the reviewer asked.

R1 non-blocking: a bare line made with /context-guru:statusline before 0.6.1 looks the same as the default. Not changed. The two cannot be told apart on disk, and the SessionStart message names the command that brings the line back.

The repoint, SessionStart and docs-golden tests pass on the new head.

@OsherElhadad
OsherElhadad force-pushed the fix/band-dashboard-link branch from f2c5e16 to bd7005d Compare October 26, 2026 17:43
@OsherElhadad
OsherElhadad merged commit 8ff7f6a into main Oct 26, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Oct 26, 2026
OsherElhadad added a commit that referenced this pull request Oct 26, 2026
…med by description (#739)

* fix(plugin): three band and migration points from the #735 GLM review

- `add --url … --statusline …` on a complete install now records
  `statusline_asked`, as the statusline-only path does. Before, a
  line installed before 0.6.1 and asked for again this way was still
  retired at the next SessionStart.
- When the retire gives back the status line the install had
  replaced, it says so ("your own status line is back"), not "moved
  into the band".
- With nothing ever read and the proxy too slow, the band says the
  status line's `cg: stats loading…`. It showed nothing before.

Assisted-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Osher Elhadad <[email protected]>

* fix(plugin): name a general-purpose sub-agent by its description

A sub-agent launched with no type of its own is `general-purpose`, and
several often run at once, so the band showed a row of identical
`general-purpose` chips. They are real sub-agents, not auto-mode (the
classifier is a `p:` thread and was never shown). Such an agent is now
named by its description, as Claude Code's agents list names it. A
typed agent keeps its type and a teammate its name. A band chip name is
cut to 24 characters with `…`.

Assisted-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Osher Elhadad <[email protected]>

---------

Signed-off-by: Osher Elhadad <[email protected]>
Co-authored-by: Osher Elhadad <[email protected]>
amiddavid added a commit that referenced this pull request Oct 27, 2026
…0.2.6) (#740)

chore(plugin): bump the plugins for v0.6.1 (Claude Code 0.6.1, Codex 0.2.6)

Both plugins changed since v0.6.0.

- Claude Code plugin: 0.6.0 to 0.6.1. The mod band draws the status
  line's figures and a dashboard link, and the install writes no
  status line by default (#735, #739).
- Codex plugin: 0.2.5 to 0.2.6. The vendored cg.py changed in #735
  and #739 (the cachestate extras and the offline notice).

Assisted-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid amiddavid mentioned this pull request Oct 28, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants