Skip to content

Commit 30f49d9

Browse files
committed
Fix CLI recall output truncation: use terminal width instead of hardcoded 80
The recall command was truncating content at 80 chars, hiding important information. Now uses terminal width minus margin (min 80).
1 parent 0cd5577 commit 30f49d9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/memory_core/cli.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,22 @@ def recall(
281281
key = r.get("source", r.get("layer", "unknown"))
282282
by_source.setdefault(key, []).append(r)
283283

284+
# Determine display width: use terminal width minus margin, min 80
285+
try:
286+
term_width = shutil.get_terminal_size().columns
287+
except Exception:
288+
term_width = 120
289+
content_width = max(80, term_width - 20) # leave room for prefix/score
290+
284291
for src, items in by_source.items():
285292
console.print(f"\n── {src.capitalize()} {'─' * 40}")
286293
for r in items:
287294
score = r.get("final_score", 0)
288295
entity = r.get("entity_type", r.get("category", ""))
289-
console.print(f" [{entity}] {r.get('content', '')[:80]} (score={score:.2f})")
296+
content = r.get("content", "").replace("\n", " ")
297+
if len(content) > content_width:
298+
content = content[:content_width] + "…"
299+
console.print(f" [{entity}] {content} (score={score:.2f})")
290300

291301

292302
_UUID_PATTERN = re.compile(r'^[0-9a-f]{8}(-[0-9a-f]{4}){0,3}', re.IGNORECASE)

0 commit comments

Comments
 (0)