hindsight icon indicating copy to clipboard operation
hindsight copied to clipboard

CLI: `memory list` pretty output shows `[UNKNOWN]` for every memory

Open ChampPABA opened this issue 7 months ago • 0 comments

Summary

hindsight memory list <bank> in pretty (default) output displays [UNKNOWN] as the fact type for every memory, regardless of the actual type stored. JSON/YAML output is correct — the data is fine, this is purely a formatter bug.

Reproduction

hindsight memory list claude_code

Every entry renders like:

  [UNKNOWN] 98ba9069-c3e7-4229-b0b4-bed095dfb927
    I analyzed the VPS memory usage ...

Compare to JSON output (correct):

hindsight memory list claude_code -o json -l 2
{
  "fact_type": "experience",
  "id": "98ba9069-...",
  ...
}

Root cause

In hindsight-cli/src/commands/memory.rs around line 95, the list pretty branch reads the wrong JSON key:

let fact_type = item.get("type")          // API returns "fact_type", not "type"
    .and_then(|v| v.as_str())
    .unwrap_or("unknown");

The API response uses the key fact_type (confirmed via -o json), so .get("type") always returns None and falls through to "unknown", which is then uppercased to [UNKNOWN].

Verified the same code still exists on the v0.5.0 tag.

Secondary issue

The gradient match arms in the same block (and in commands/memory.rs get around line 166, and in ui.rs print_fact around line 84) only cover world / experience / opinion (and agent in ui.rs), but the API also returns observation — which currently falls into the default bucket. Worth adding an explicit arm so the color gradient is stable.

Suggested fix

  1. commands/memory.rs:95 — change item.get("type") → item.get("fact_type").
  2. Add an "observation" arm to the three match fact_type blocks (commands/memory.rs list + get, ui.rs print_fact).

Happy to send a PR if helpful.

Environment

  • hindsight v0.5.0 (latest release, verified via GitHub source)
  • Linux (WSL2), self-hosted server

ChampPABA avatar Apr 12 '26 10:04 ChampPABA