Skip to content

bug: Instructions from avante.md are appended twice to user input for agents #2907

@ChuBL

Description

@ChuBL

Describe the bug

Instructions from avante.md are appended to my user input twice before being sent to agents. This causes all instructions in that file to appear twice, leading to verbose and confusing prompt contexts.

To reproduce

  1. Place an avante.md file in the project root with some instructions.
  2. Use the Avante agent to send a request or open a code session in the normal way.
  3. Observe that the contents from avante.md are appended twice to the prompt before being sent to the language agents (e.g. via verbose logs, or reviewing the actual input sent).

Expected behavior

Instructions from avante.md should only be appended once to the user input before being sent to agents. The prompt context should not contain duplicate instruction blocks.

Installation method

NeoVim built-in pack.

Environment

NeoVim 0.12 nightly,
official update avante repo,
macOS 26.3

Repro

The issue is in `lua/avante/llm`. lua in the generate_prompts function. The `avante.md` file is being appended to both `opts.instructions` and `messages`.
The problem is: generate_prompts modifies opts.instructions directly (mutating the passed object), and if this function gets called multiple times with the same opts object, the avante.md content gets appended each time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions