Skip to content

[Bug]: AGENTS.md file triggers automatic prompt injection that overrides user's message #132

@urfv

Description

@urfv

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

When working in a repository that contains an AGENTS.md file, DeepCode appears to silently inject or prepend a system-generated task into the user's message. The injected text asks the agent to convert AGENTS.md into a "Repository Guidelines" contributor guide — with sections on build commands, testing, coding style, PR guidelines, etc. This overrides whatever the user actually typed.

The injected message looks like:

   │ Update ./AGENTS.md that serves as a contributor guide for this repository.
   │
   │ Your goal is to produce a clear, concise, and well-structured document with descriptive headings and actionable explanations for each section. Follow the outline below, but adapt as needed...
   │
   │ Document Requirements
   │ - Title the document "Repository Guidelines".
   │ - Use Markdown headings...
   │
   │ Recommended Sections
   │ - Project Structure & Module Organization
   │ - Build, Test, and Development Commands
   │ - Coding Style & Naming Conventions
   │ - Testing Guidelines
   │ - Commit & Pull Request Guidelines

The user's actual message (whatever they have in their AGENTS.md) is prepended by a system prompt. The agent responds to the injected prompt instead of the user's real intent. In repos where AGENTS.md serves a non-standard purpose (agent operating manual, knowledge base kernel, etc.), this creates confusing loops where the agent tries to rewrite a file that explicitly forbids being rewritten.

Steps to reproduce

  1. Open a repository that contains an AGENTS.md file (especially one whose content is NOT a standard contributor guide — e.g., a knowledge vault, personal notes, or any non-coding project).
  2. /init
  3. {the SKILL.md described in the AGENTS.md file is loaded)
  4. Observe: the agent gets confused and /init fails to work properly

Expected Behavior

The agent should receive exactly what the user put in their AGENTS.md. Automatic prompt injection based on file heuristics should not modify or replace user messages. If DeepCode wants to suggest tasks based on repo contents, those should be surfaced as UI suggestions the user can accept or dismiss — not silently injected into the message stream.

DeepCode Config Used

{
"env": {
"MODEL": "deepseek-v4-pro",
"BASE_URL": "https://api.deepseek.com",
"API_KEY": ""
},
"thinkingEnabled": true,
"reasoningEffort": "high"
}

Logs and screenshots

No response

Additional Information

  • DeepCode version: v.0.1.21
  • OS: Windows 11
  • Repository type: Obsidian vault with LLM Wiki structure inspired by karpathy's gist (non-code project, but PKM in Obsidian)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions