Skip to content

feat(status): show model, provider, context, and cumulative tokens#4678

Open
WolframRavenwolf wants to merge 1 commit into
NousResearch:mainfrom
WolframRavenwolf:feat/status-model-context
Open

feat(status): show model, provider, context, and cumulative tokens#4678
WolframRavenwolf wants to merge 1 commit into
NousResearch:mainfrom
WolframRavenwolf:feat/status-model-context

Conversation

@WolframRavenwolf

@WolframRavenwolf WolframRavenwolf commented Apr 3, 2026

Copy link
Copy Markdown

Summary

Rebuilds this PR on current upstream/main and ports the current /status cockpit metadata implementation.

The gateway /status response now includes, when available:

  • model name
  • provider name
  • context usage and context window
  • cumulative token label for session token totals

The implementation prefers live or cached agent runtime metadata, then falls back to persisted SessionDB/session state so /status remains useful between turns without making provider billing/account calls.

Motivation

/status is the quick chat-side health check users reach for while an agent is running or between turns. Tokens alone are not enough to understand context pressure: users need the active model/provider and context window/usage in the same cockpit view.

Verification

  • python3 -m py_compile gateway/run.py hermes_cli/commands.py tests/gateway/test_status_command.py
  • uv run pytest tests/gateway/test_status_command.py::test_status_command_includes_live_agent_model_and_context tests/gateway/test_status_command.py::test_status_command_includes_persisted_model_and_context_when_agent_not_running -q -o addopts= -> 2 passed

Related work

This overlaps conceptually with open PRs #8355 and #16079. Those were still open when this branch was rebuilt, and current upstream/main did not yet include equivalent model/provider/context/cumulative-token output in gateway /status.

Notes

This update force-pushes the existing PR branch from the current upstream base rather than opening a duplicate PR.

@malaiwah

Copy link
Copy Markdown
Contributor

Nice work on the idle context fallback — PR #8355 incorporates the same idea (using get_model_context_length() when no live agent exists) as part of a broader /status overhaul that also adds token breakdown, cost, cache stats, compression tracking, and CLI support. Credit to @WolframRavenwolf for the approach.

malaiwah pushed a commit to malaiwah/hermes-agent that referenced this pull request Apr 12, 2026
Replace the basic /status output with a comprehensive session snapshot
showing model, provider, token breakdown, cost, context window, and more.

- Extract shared formatting helpers to hermes_cli/status_format.py
- Add SessionDB.get_session_token_totals() — fixes Tokens: 0 (NousResearch#5960)
- Add SessionDB.get_session_last_active() for relative timestamps
- Idle context fallback via get_model_context_length (inspired by NousResearch#4678)
- Persist compression_count in SessionEntry so idle sessions show
  compression history (NousResearch#7317)
- 42 unit tests covering all code paths

Closes NousResearch#7317, closes NousResearch#7714, supersedes NousResearch#4678 and NousResearch#5989.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
malaiwah pushed a commit to malaiwah/hermes-agent that referenced this pull request Apr 13, 2026
When no live agent is running, estimate the context window limit from
model metadata (get_model_context_length) and show last_prompt_tokens
as current usage. Inspired by upstream PR NousResearch#4678.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels May 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #16079 (also adds model/provider info to /status) — these likely overlap significantly.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #16079

PROBLEM: The old public /status PR drifted out of the current Amy patch stack, leaving /status without the model/provider, context window, or explicit cumulative token label that Wolfram uses to monitor context pressure from chat.

SOLUTION: Re-port the feature onto the current gateway status handler. Prefer live/cached agent runtime metadata, fall back to SessionDB + SessionStore state between turns, add localized status model/context lines, and keep token totals explicitly labeled cumulative.

Verification: tests/gateway/test_status_command.py, tests/hermes_cli/test_commands.py
@WolframRavenwolf WolframRavenwolf changed the title feat(status): show model, context usage, and cumulative label in /status feat(status): show model, provider, context, and cumulative tokens Jun 8, 2026
@WolframRavenwolf WolframRavenwolf force-pushed the feat/status-model-context branch from 2c52cf1 to 3a63ac2 Compare June 8, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants