fix: humanize search, sessions, and mutation output#39
Merged
Conversation
Reformat the text-mode output of search, sessions, and mutations show so
they are scannable, and accept short id prefixes everywhere a stored id is
required. JSON output is unchanged (new report fields are `#[serde(skip)]`).
- search rows: abbreviated event id, compact time, project basename, plain
match kind, percentage score, and a cleaned command snippet (JSON framing
stripped, `[...]` match highlights preserved).
- sessions: aligned columns, abbreviated session id, compact time,
`~`-relative project path.
- mutations show: a labeled lesson block (hypothesis, intervention, trigger
selectors, evidence counts, promotion gates as percentages) before the
audit trail.
- percentages replace basis points in every text surface (findings support,
search score, shadow precision/recall, near-miss support).
- near-miss list shows only candidates with >=2 occurrences (capped at 5),
prints a summary line when none recur, uses plain-language gate reasons
("needs 3+ occurrences, saw 2"), and truncates commands at word
boundaries.
- short id prefixes (>=6 chars past the type prefix) resolve to a unique
stored id for mutations show/challenge/reject/replay/replay-draft/shadow/
shadow-draft/install/uninstall and delete session; ambiguous prefixes
error with the candidates; next-step hints echo the id form the user gave.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claim
The text-mode output of
search,sessions, andmutations showis now scannable, basis-points jargon is gone from every text surface, the zero-finding digest no longer buries the signal under one-occurrence giants, and short id prefixes are accepted everywhere a stored id is a required argument.--output jsonis byte-for-byte unchanged — every new report field is#[serde(skip)](or a transparent#[serde(flatten)]wrapper), so machine consumers see no change.Before / after
search(text)Before:
After:
Full event ids, raw snippets, and the basis-points ranking fields remain in
--output json(noted insearch --help).sessions(text)Before:
After:
Home-relative (
~/...) projects; compact times; full ids and RFC3339 timestamps stay in JSON.mutations show(text)Before: header line + transitions only; the lesson lived in JSON.
After:
Near-miss / digest (text)
Before: five 1-occurrence rows ending in
… bps support unmet: min_occurrences.After (recurring candidate):
After (nothing recurs):
Short ids
mutations show mut_6b51ef819fresolves the unique prefix; an ambiguous prefix errors with the candidates; next-step hints echo the short id the user typed. Applies tomutations show/challenge/reject/replay/replay-draft/shadow/shadow-draft/install/uninstallanddelete session.Evidence
New unit tests (bin
autophagy):short_id_keeps_prefix_and_eight_digest_chars,short_id_leaves_already_short_ids_untouched,percent_renders_basis_points_to_one_decimal,clean_snippet_extracts_command_and_preserves_highlights,clean_snippet_handles_truncated_command_payload,clean_snippet_strips_json_framing_without_a_command_field,clean_snippet_leaves_plain_text_alone,truncate_words_cuts_at_a_word_boundary,truncate_words_leaves_short_text_unchanged,shorten_project_and_basename,resolve_stored_id_matches_a_unique_prefix,resolve_stored_id_passes_through_an_exact_full_id,resolve_stored_id_reports_an_ambiguous_prefix,resolve_stored_id_passes_missing_and_too_short_prefixes_through.New integration tests (
tests/cli.rs):search_text_humanizes_rows_while_json_keeps_full_fields,sessions_text_aligns_and_compacts_while_json_stays_stable,digest_summarizes_when_no_candidate_recurs,mutations_show_text_renders_the_lesson,short_mutation_id_prefix_resolves_and_hint_echoes_it. Updatedsetup_digest_surfaces_scan_stats_and_observations_when_nothing_qualifiesfor the plain-language gate phrasing.mise run checkis green (ci + docs + fmt + lint + test).Privacy
Presentation only. Snippets rendered in text mode are the same redaction-approved projection already used for search; no new data is read, persisted, or exposed. JSON output is unchanged, so the spec-versioned surface is untouched.
🤖 Generated with Claude Code
https://claude.ai/code/session_015LY7xtercMc3NtLeX2z4YV