Skip to content

feat(memory): add token-friendly brief retrieval - #122

Merged
Grivn merged 1 commit into
masterfrom
codex/issue-43-token-friendly-output
Aug 30, 2026
Merged

feat(memory): add token-friendly brief retrieval#122
Grivn merged 1 commit into
masterfrom
codex/issue-43-token-friendly-output

Conversation

@Grivn

@Grivn Grivn commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

  • add optional --brief output to recall and search
  • add a Unicode-safe --excerpt-chars limit, defaulting to 240 characters
  • add mnemon show <id> for retrieving one complete active insight
  • keep existing/default JSON output unchanged for compatibility
  • document the new retrieval flow in English and Chinese

Brief responses contain only the retrieval fields needed to choose a result (id, excerpt, category, score/confidence) plus a single detail_command. JSON is compact and does not HTML-escape the command placeholder. --brief and --verbose are mutually exclusive.

The public output remains JSON rather than making the current TOON Working Draft a protocol dependency.

Token benchmark

For ten deliberately long results with the o200k tokenizer:

  • current compact output: 10,576 tokens
  • brief output: 732 tokens (93.1% reduction)
  • brief plus one full show: 1,819 tokens (82.8% reduction)

Verification

  • focused brief/show and Unicode truncation tests
  • make test
  • 156/156 CLI E2E assertions
  • go test -race ./cmd/memory
  • git diff --check

Closes #43.

Keep existing JSON contracts intact while adding bounded, unindented discovery projections for recall and search. Add a show command for fetching one selected insight in full, with Unicode-safe excerpts and end-to-end coverage.
@Grivn
Grivn force-pushed the codex/issue-43-token-friendly-output branch from 68a55f3 to 8c767ba Compare August 30, 2026 20:03
@Grivn
Grivn merged commit e04c3b5 into master Aug 30, 2026
2 checks passed
@Grivn
Grivn deleted the codex/issue-43-token-friendly-output branch August 30, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output should be more token-friendly

1 participant