Feature: notation that forces inline expansion of references to prevent reference-following failures

Resolved 💬 1 comment Opened May 7, 2026 by queglay Closed Jun 5, 2026

Problem

LLMs are unreliable at following references. When a prompt, doc, or config contains a pointer like \"see X\", \"as defined in Y.md\", a URL, or even a file path, the model frequently:

  • Duplicates content instead of consulting the referenced source (because it half-remembers or guesses what's there).
  • Skips the reference entirely and answers from priors.
  • Partially expands the reference, mixing stale recall with fresh content.

This shows up in CLAUDE.md authoring, slash commands, skill files, agent prompts, and user messages — anywhere a single source of truth is intended to be reused by reference rather than copied.

Claude Code already supports @path/to/file includes in CLAUDE.md, which the harness expands before the model sees the prompt. That's exactly the right pattern. The problem is it's scoped to specific file types and contexts, so authors fall back to prose references in the many places it doesn't apply, and the reference-following failure recurs.

Proposed solution

A first-class \"force-expand\" notation that the harness detects and inlines before the prompt reaches the model — usable consistently across:

  • User messages in the chat
  • CLAUDE.md (already works) and any other markdown the harness loads
  • Slash command and skill bodies
  • Subagent system prompts and dispatch briefs
  • Output styles, hook outputs, and other harness-injected text

Strawman syntax (open to bikeshedding): something visually distinct from @file so it can also wrap URLs, anchored sections, or named blocks — e.g. {{include: path/to/file.md}}, {{include: path/to/file.md#section}}, {{include: https://...}}. The key property is that it is resolved by the harness, not by the model, and the model only ever sees the expanded text.

Behavior:

  • Resolved recursively, with a depth limit and cycle detection.
  • Failures are loud: if a target can't be fetched/read, the harness substitutes a visible error marker rather than silently dropping it, so the model doesn't proceed on a phantom reference.
  • Scoped: web URLs only resolved with the same trust/permission semantics already used for WebFetch.
  • Optional cap on expanded size with a clear truncation marker.

Why this helps

  • Eliminates a whole class of \"the model didn't read the doc\" bugs by removing the model's option to not read it.
  • Lets prompt authors keep a single source of truth without copy-pasting (the workaround people reach for today, which causes drift).
  • Makes prompt composition predictable: expansion happens deterministically, before inference.

Related

  • Closed: #13614 (Support @include directive for composable CLAUDE.md files) — shipped as @-includes. This issue asks to generalize that idea into a harness-level mechanism available anywhere prompts are assembled.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗