Skip to content

Conversation

@krissetto
Copy link
Contributor

Makes @ references for files actually send the file contents along with the message to the LLM, so the agent doesn't have to round-trip to then get the files contents (if it has access to a tool with which to do that).

Files references via @somefile get attached to a structured section at the end of the user message, while the @somefile references remain in the message where the user typed them so the LLM has a better idea of the context and where the file contents are referenced by the user

Full attachment contents are not shown in the TUI to keep things easier to read

Also fixes a visual bug where historical completions were showing alongside @ file completions

Example

What the user sees:

image

What actually gets sent as the contents of the user message:

hey whats in here? @minimal.yaml

<attachments>
@minimal.yaml:
```
agents:
    root:
        model: openai/gpt-5-mini
        description: Writes a nice story about a subject
        instruction: You are helpful assistant
```
</attachments>

- Hide completion menu when no items match the query
- Include @ prefix in file completion value (since handler removes trigger)
- Expand file references with actual file contents when sending message

Signed-off-by: Christopher Petito <[email protected]>
@krissetto krissetto requested a review from a team as a code owner December 1, 2025 17:47
cmd := p.processMessage(msg.Content)
return p, cmd
// Add user message to UI immediately using the display content (with @filename placeholders)
displayCmd := p.messages.AddUserMessage(msg.DisplayContent)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change needed for this feature? I guess it's fine to have optimistic rendering, my idea of the UserMessageEvent was for times when you connect the tui to a remote server

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good Q, honestly i didn't think too much about it.. maybe we should consolidate and have only one way to do things

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean only one way to do things? We do have one way to do things: react to the events sent from the runtime :D

case *runtime.UserMessageEvent:
cmd := p.messages.AddUserMessage(msg.Message)
return p, cmd
// User message is already added in the SendMsg handler with display content,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this comment IMO

Copy link
Member

@rumpl rumpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it

@rumpl rumpl merged commit 8cecb92 into docker:main Dec 1, 2025
5 checks passed
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.

2 participants