Skip to content

feat(hud): add optional week forecast to status line - #810

Merged
dean0x merged 13 commits into
mainfrom
feat/805-hud-tokenmeter-forecast
Nov 23, 2026
Merged

dean0x merged 13 commits into
mainfrom
feat/805-hud-tokenmeter-forecast

Conversation

@dean0x

@dean0x dean0x commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Summary

The devflow status line shows the Claude week percent (7d). It does not show the forecast of that percent at the reset time. This change adds an optional forecast, which is off by default.

Changes

Features

  • Add the devflow hud --forecast option and the devflow hud --no-forecast option.
  • Add the forecast field to ~/.devflow/hud.json. The default value is false.
  • When the option is on, show a dim part after 7d. For example: → 80% by reset.
  • When the week limit runs out before the reset, also show runs out in 21h 30m.
  • Use the same formula as the tokenmeter forecast. The forecast uses only the status line input. It does not read tokenmeter data and does not start a process.
  • Keep the stored forecast value when devflow init runs.

Documentation

  • Update the CLI reference, the README, the file organization reference and the changelog.

Bug Fixes

  • Fix: when more than one hud flag is given, all of them now take effect. For example, --detail --enable.

Breaking Changes

None expected. With the option off, the status line output is byte-identical.

Testing

Test Coverage

  • 8 test files modified.
  • 3 golden snapshot files modified.

Testing Gaps

  • This description does not list test results. Check the CI checks of this pull request.

Known Limits

  • The forecast uses the render time as the reading time.
  • At 100% used, devflow does not print a runs-out clause. tokenmeter prints runs out in <1m.
  • devflow prints spans as 21h 30m. tokenmeter prints 21h.
  • A runs-out span under 1 minute prints 0m.
  • A reset time in milliseconds shows no forecast.
  • Line 2 has no width drop rule.
  • If --status is given with a change flag, devflow only prints the status.

Related Issues

Closes #805

Show the estimate at reset from the Claude week data on stdin.
Keep the saved forecast option in both init paths.

Task: feat/805-hud-tokenmeter-forecast
Save detail and forecast changes together before the HUD switch.
Show the forecast state in status output without a config change.

Task: feat/805-hud-tokenmeter-forecast
Keep the default render bytes fixed. Check the opt-in config,
invalid input fallback, capacity line order, and import boundary.

Task: feat/805-hud-tokenmeter-forecast
Check that init keeps each stored forecast choice. Compare HUD
arithmetic with the pinned tokenmeter status line. Check that the
installed HUD can show a forecast from stdin alone.

Task: feat/805-hud-tokenmeter-forecast
The install now includes an opt-in HUD week forecast component.
Record its file in all three install snapshots.

Task: feat/805-hud-tokenmeter-forecast
Explain the forecast flags, input, and fallback. Record how the HUD
applies detail and forecast changes with enable or disable flags.

Task: feat/805-hud-tokenmeter-forecast
Show where Devflow saves the forecast option and name the component
that displays it.

Task: feat/805-hud-tokenmeter-forecast
Compare forecast values at the start limit, usage limits, and reset.
Check the display cap with the pinned CLI.

Task: resolve-batch-1
Return no forecast when the reset is not in the future.
Test a direct call with a past reset and check both sides of the display cap.

Task: resolve-batch-1
@dean0x

dean0x commented Nov 23, 2026

Copy link
Copy Markdown
Owner Author

Test Plan Evidence — c7cced0

Verified 24/24: VERIFIED-CI 21, ATTESTED-LOCAL 3, UNVERIFIED 0, STALE 0, FAILED 0, INDETERMINATE 0

  • TP-1 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:c36cbd93b1e8
  • TP-2 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:4fdc2fcd5863
  • TP-3 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:4b65f23ad423
  • TP-4 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:ef93ad3cb6b0
  • TP-5 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:5a8ac28b0756
  • TP-6 ATTESTED-LOCAL sha:f3d44938d40470781488b090ae4be262f702ac42 out:PASS h:fe6ef2da8c8a
  • TP-7 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:b3b051780a61
  • TP-8 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:bacb35a111a7
  • TP-9 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:6df406492265
  • TP-10 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:232a23ee0777
  • TP-11 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:08506936f224
  • TP-12 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:1381e5d5daf5
  • TP-13 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:71475c6fac75
  • TP-14 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:47519ca8a837
  • TP-15 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:901e13fa6c4e
  • TP-16 ATTESTED-LOCAL sha:f3d44938d40470781488b090ae4be262f702ac42 out:PASS h:9331510061fb
  • TP-17 ATTESTED-LOCAL sha:aac0708cc7757c977e3fc97a32fc9966da448a34 out:PASS exit:0 h:1d39d3349b0c
  • TP-18 VERIFIED-CI sha:f3d44938d40470781488b090ae4be262f702ac42 out:PASS run:45189959886/1 exit:0 h:0616e22682ab
  • TP-19 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:d46b5eebe633
  • TP-20 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:ea336060e396
  • TP-21 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:c9ef76f967a7
  • TP-22 VERIFIED-CI sha:fd3352743c91c4ad33fe0161ea03b704879c5391 out:PASS run:45189959886/1 exit:0 h:7a5abc7ec227
  • TP-23 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:9a6639560cef
  • TP-24 VERIFIED-CI sha:ad6c452a631fcce61826a4f695332d5a37ecc8cf out:PASS run:45187469071/1 exit:0 h:ba573b91aa10

Review Summary (cycle 1, reviewed head a30bb33)

Recommendation: APPROVED WITH COMMENTS. Gate level: lean. Focuses: security, testing, reliability.

Category CRITICAL HIGH MEDIUM LOW
Blocking 0 0 1 -
Should Fix - 0 0 -
Suggestions - - - 2
  • MEDIUM (testing): the forecast contract test checked only three interior points of the copied formula. It had no row for 0% used, 100% used, a run-out at the reset or the >999% cap. So a tokenmeter release that moves an edge did not fail a test.
  • Suggestion (testing): the >999% cap had no boundary row.
  • Suggestion (reliability): weekForecastFrom did not check its own precondition (the reset is after the reading time).

The reviewers checked these points and found no issue:

  • The formula matches tokenmeter 0.3.0 forecastFrom term for term, at the reset edge and at 0% and 100% used. The known differences are in the Known Limits section of this PR.
  • Bad, missing or odd week values give no forecast. They do not stop the status line and do not remove other parts.
  • With the option off, the output is byte-identical.
  • --detail or --forecast with --enable or --disable keeps all changes. --status writes nothing.

Resolution Summary

Outcome Count
Fixed 3
False Positive 0
By Design 0
Deferred 0
Blocked 0
Escalated 0
  • 21c83b9c test(hud): the contract test now compares the HUD formula with the package formula at a fixed time. It checks 1 ms before and at the start limit, 0% and 100% used, and a run-out at the reset and just after it. A CLI case reaches the >999% cap.
  • ad6c452a fix(hud): weekForecastFrom returns no forecast unless the reset is after the reading time. New rows pin both sides of the >999% cap and a direct call with a past reset.
  • c7cced00 docs(knowledge): the feature knowledge base states the new contract checks.

Verification at ad6c452: build PASS, full test suite PASS (413 files, 19,720 tests), CI PASS. The 10 test-plan items that the fixes touched were run again and pass. CI at c7cced0: PASS.

@dean0x
dean0x merged commit 416186f into main Nov 23, 2026
3 checks passed
@dean0x
dean0x deleted the feat/805-hud-tokenmeter-forecast branch November 23, 2026 14:13
@dean0x dean0x mentioned this pull request Nov 24, 2026
dean0x added a commit that referenced this pull request Nov 24, 2026
## Summary

This PR sets the version to 3.21.0 and moves the `[Unreleased]` notes to
the 3.21.0 section. After the merge, a `v3.21.0` tag on the merge commit
starts the release workflow.

## Changes

- `package.json` and `package-lock.json`: version 3.20.0 to 3.21.0.
- `CHANGELOG.md`: new `## [3.21.0] - 2026-11-24` section, new empty
`[Unreleased]` section, and the 3.21.0 compare link.
- `CHANGELOG.md`: the `[Unreleased]` compare link now starts at
`v3.21.0`. It started at `v3.8.0` before.

## Shipped in 3.21.0

- #794: Code Mode flag (closes #792).
- #810: week forecast in the status line (closes #805).
- #811: working memory is opt-in, and the note has an 8 KB limit (closes
#807).
- #809: acceptance criteria under level 2 to 4 headings (closes #808).

## Breaking Changes

None. Working memory is off by default for new installs. Existing
installs keep their choice. `devflow memory --enable` turns it on.

## Testing

- `npm run build`: pass.
- `npm run test`: 417 files, 20084 passed, 8 skipped, 0 failed.
- `npm run test:integration`: 5 files, 55 passed.
- `npm run version:bump -- 3.21.0` a second time changes no file.
- The tests ran on the base commit c8282b1. This PR changes only the
version and the changelog.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(hud): show the tokenmeter week share and forecast on the status line

1 participant