hermes - 💡(How to fix) Fix feat: persistent history for background tasks (finished tasks archive) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#16946Fetched 2026-04-29 06:38:09
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×2
RAW_BUFFERClick to expand / collapse

Feature Description

Background tasks started via /background have no history after Hermes restarts. The ProcessRegistry keeps finished tasks in an in-memory _finished dict that is lost on restart. The checkpoint file ~/.hermes/processes.json only persists running tasks for crash recovery — finished tasks vanish entirely.

This means:

  • /tasks shows "Recently finished" only until restart, then they're gone
  • No way to review what a background task did after the session ends
  • No persistent log of background task outputs, exit codes, or file changes

Motivation

Sessions have full SQLite persistence — you can browse, search, and resume any past session. Background tasks should have equivalent lifecycle management. Currently, a task that ran for 2 hours and produced useful output becomes invisible the moment Hermes restarts.

Related: #8568 (background tasks have no observable state), #1144 (closed — background processes lost on restart).

Proposed Solution

Persist finished background task metadata alongside running tasks:

  1. Extend processes.json (or migrate to SQLite) to include finished tasks with:

    • session_id, command, pid, exit_code
    • started_at, finished_at, uptime
    • output preview (last N chars)
    • associated session_id (the foreground session that spawned it)
  2. Add archive subcommands:

    • /tasks history — list recently finished tasks
    • /tasks log <id> — view full output of a finished task
    • /tasks prune — clean old entries (e.g. older than 7 days)
  3. Optional: Write structured logs per task to ~/.hermes/background_tasks/<task_id>/ containing:

    • log.jsonl — tool calls and results
    • summary.txt — final agent response

Alternatives Considered

  • Just use sessions: Background tasks already create separate sessions, so hermes sessions list shows them. But sessions don't expose task-specific info (exit code, uptime, command) and the association between foreground/background is implicit.
  • Log files only: Writing logs to disk without a registry query means no way to list/search finished tasks. A registry entry is needed for discoverability.

Environment

  • Hermes Agent v0.11.0
  • Ubuntu 24.04

extent analysis

TL;DR

To persist finished background task metadata, extend the processes.json file to include finished tasks with relevant information, such as session_id, command, pid, exit_code, and output preview.

Guidance

  • Extend the processes.json file to store finished task metadata, including session_id, command, pid, exit_code, started_at, finished_at, uptime, and output preview.
  • Implement the proposed /tasks subcommands (history, log, and prune) to manage and query finished tasks.
  • Consider writing structured logs per task to a dedicated directory for additional debugging and auditing capabilities.
  • Evaluate the trade-offs between using a JSON file versus migrating to a SQLite database for storing task metadata.

Example

No code snippet is provided as the issue does not contain specific implementation details.

Notes

The proposed solution requires careful consideration of data retention policies, especially when implementing the /tasks prune subcommand to clean old entries.

Recommendation

Apply the proposed workaround by extending the processes.json file and implementing the /tasks subcommands, as this approach provides a clear path forward for persisting finished background task metadata and improving task lifecycle management.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix feat: persistent history for background tasks (finished tasks archive) [2 comments, 2 participants]