fileSuggestion: support structured output with display metadata (description/annotation)
Feature Request
Problem
The current fileSuggestion API only supports plain file paths as output (one per line). There's no way to display additional context alongside suggestions — such as last modified time, git diff stats, or custom descriptions — without that metadata being inserted into the input box when a suggestion is selected.
Current Behavior
# fileSuggestion script output (stdin → stdout)
src/lib/saveSessionMemory.ts
src/hooks/useSessionMemory.ts
docs/architecture/memory-system.md
Each line is treated as both the display text and the inserted value. Appending any metadata (e.g. src/foo.ts 2h ago +5/-3) causes Claude Code to treat the entire line as a file path, which fails.
Proposed Solution
Support a structured output format that separates display text from insert value, similar to VS Code's CompletionItem (label + detail + insertText).
Option A: Tab-separated format
src/lib/saveSessionMemory.ts\t2h ago +12/-3
src/hooks/useSessionMemory.ts\t1d ago +5/-0
docs/architecture/memory-system.md\t3d ago
- First field = file path (inserted on selection)
- Second field (after
\t) = display-only annotation (shown but not inserted) - Backward compatible: lines without tabs work as before
Option B: JSON format
[
{"path": "src/lib/saveSessionMemory.ts", "description": "2h ago +12/-3"},
{"path": "src/hooks/useSessionMemory.ts", "description": "1d ago +5/-0"}
]
Either option would enable richer file suggestion UX without breaking existing scripts.
Use Cases
- Last modified time: helps users pick the file they were recently working on
- Git diff stats (
+12/-3): shows which files have uncommitted changes at a glance - Branch/status indicators:
[modified],[untracked],[staged] - File size or type hints: useful in large monorepos
Environment
- Claude Code (CLI)
- macOS / Linux
- Using custom
fileSuggestioncommand in.claude/settings.json
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗