feat(status): append session recap to /status output (#27176)

Adds a pure-local recap of recent session activity — turn counts,
tools used, files touched, last user ask, last assistant reply —
appended to the existing /status output. Useful when juggling multiple
sessions and you want a one-glance reminder of where this one left off.

Inspired by Claude Code 2.1.114's /recap, but folded into /status so
we don't add a 6th info command. Pure local computation: no LLM call,
no auxiliary model, no prompt-cache invalidation, instant and free.

Salvage of #18587 — kept the shared hermes_cli.session_recap.build_recap
helper and its 13 unit tests, dropped the /recap slash command +
ACTIVE_SESSION_BYPASS_COMMANDS entry + Level-2 bypass since /status
already covers both surfaces.

Tailored to hermes-agent's tool vocabulary: file-editing tools
(patch, write_file, read_file, skill_manage, skill_view) surface
touched paths; tool-call counts highlight which classes of work
drove the session.

Source: https://code.claude.com/docs/en/whats-new/2026-w17
This commit is contained in:
Teknium 2026-05-16 16:51:42 -07:00 committed by GitHub
parent 226cee43d9
commit e21cb8d145
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 532 additions and 0 deletions

View file

@ -8663,6 +8663,24 @@ class GatewayRunner:
t("gateway.status.platforms", platforms=', '.join(connected_platforms)),
])
# Session recap — what was this session ABOUT? Pure local compute,
# no LLM call, no prompt-cache impact. Useful when juggling multiple
# gateway sessions and you want a one-glance reminder of where this
# one left off. Inspired by Claude Code 2.1.114's /recap.
try:
from hermes_cli.session_recap import build_recap
history = self.session_store.load_transcript(session_entry.session_id)
recap = build_recap(
history,
session_title=title,
session_id=session_entry.session_id,
platform=source.platform.value if source else None,
)
if recap:
lines.extend(["", recap])
except Exception as exc: # pragma: no cover — defensive
logger.debug("build_recap failed in /status: %s", exc)
return "\n".join(lines)
async def _handle_agents_command(self, event: MessageEvent) -> str: