Skip to content

feat(tui): list and drop attached files from the /context dialog#3465

Merged
dgageot merged 1 commit into
mainfrom
feat/context-drop-attachments
Jul 5, 2026
Merged

feat(tui): list and drop attached files from the /context dialog#3465
dgageot merged 1 commit into
mainfrom
feat/context-drop-attachments

Conversation

@Sayt-0

@Sayt-0 Sayt-0 commented Jul 3, 2026

Copy link
Copy Markdown
Member

Closes #3435. Builds on the /context dialog from #3432: an Aider-style inventory to see which files are in context and remove them.

Changes

Area Change
/context dialog New "Attached files" and "Prompt files" sections, one row per file with a token estimate. Up/Down selects an attached file, d/x/del drops it (optimistic removal, same pattern as the session browser delete)
/drop command /drop <path> drops directly, resolving exact path, then relative path, then unique base name (ambiguity is rejected). Bare /drop opens the /context dialog
runtime.ContextBreakdown New AttachedFiles and PromptFileItems inventories (ContextFile{Path, Tokens, Missing})
session.Session New RemoveAttachedFile, symmetric with AddAttachedFile
Docs Command table rows and a short paragraph under File Attachments
Attached files
▶ main.go      2.1K    2%  /proj/main.go
  readme.md    300    <1%  /proj/docs/readme.md
  deleted.txt  -       -   /tmp/deleted.txt (missing)

Prompt files
  AGENTS.md    600    <1%  /proj/AGENTS.md

Behavior notes

  • Per-file estimates mirror the send pipeline: inlined text uses the calibrated heuristic, supported binaries use the flat attachment charge, oversized or unsupported files show -. They detail content already counted in Messages, so the estimated total is unchanged.
  • Missing files stay listed and droppable, so dangling references can be cleaned up.
  • Dropping stops propagation to sub-agents and skill prompts; content already inlined in past messages stays until compaction (a note in the dialog says so). Re-attaching via @ or /attach works as before.
  • Prompt files are config-driven and re-injected every turn, so they are listed read-only.

Testing

  • Unit tests: session removal, breakdown inventory (text, binary, missing, oversized), dialog rendering, navigation and drop, /drop parsing, App.DropAttachedFile resolution.
  • go build ./..., full test suite, golangci-lint run and go run ./lint . are clean.

Extends the /context dialog with a per-file inventory: attached files
(selectable, droppable with d/x/del) and resolved prompt files, each
with a token estimate. Adds /drop [path] to remove an attachment
directly, RemoveAttachedFile on Session, and per-file details on
ContextBreakdown. Dropping stops propagation to sub-agents and skills;
inlined content in past messages is unaffected.

Closes #3435
@Sayt-0
Sayt-0 requested a review from a team as a code owner July 3, 2026 23:28
@Sayt-0 Sayt-0 added area/tui For features/issues/fixes related to the TUI area/sessions For features/issues/fixes related to session lifecycle (resume, persistence, export) kind/feat PR adds a new feature (maps to feat:). Use on PRs only. area/core Core agent runtime, session management labels Jul 3, 2026
@dgageot
dgageot merged commit 458cd02 into main Jul 5, 2026
18 checks passed
@dgageot
dgageot deleted the feat/context-drop-attachments branch July 5, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Core agent runtime, session management area/sessions For features/issues/fixes related to session lifecycle (resume, persistence, export) area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tui): context inventory — list and remove attached/prompt files (/drop)

2 participants