-
-
Notifications
You must be signed in to change notification settings - Fork 517
Description
- Disable all other plugins besides Copilot (required)
- Log file generated via "Copilot: Create Log File" command or Settings -> Advanced -> Create Log File (required)
- Screenshot of note + Copilot chat pane + dev console added (optional)
Copilot version: 3.1.3
Model used: Kimi
When a note is used as Copilot context, embedded notes/resources using Obsidian embed syntax ![[...]] are expanded into the final prompt, which can massively inflate prompt tokens and exceed the model context limit.
Describe how to reproduce
Steps:
In Obsidian, create a note (e.g. test-embed-token.md) with content similar to:
1. ...
2. ...
![[slides12_ge_production2025.pdf#page=8&rect=...]]
![[slides12_ge_production2025.pdf#page=9&rect=...]]
![[Excalidraw/Drawing 2025-12-06 10.17.07.excalidraw.md]]
The Excalidraw file contains compressed-json (typical Excalidraw saved format).
Open Copilot Chat.
Add the note as context (e.g. “active note” / @{active note} / include current note context, whichever is supported).
Ask any question in Copilot (even a short prompt).
Screenshot
Error occurred 500 The input (140475 tokens) is longer than the model's context length (131072 tokens).
Console
<embedded_note> <title>Drawing 2025-12-06 10.17.07.excalidraw</title> Excalidraw/Drawing 2025-12-06 10.17.07.excalidraw.md --- excalidraw-plugin: parsed tags: [excalidraw] --- ==⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠== You can decompress Drawing data with the command palette: 'Decompress current Excalidraw file'. For more info check in plugin settings under 'Saving' # Excalidraw Data ## Text Elements %% ## Drawing
compressed-json
N4KAkARALgngDgUwgLgAQQQDwMYEMA2AlgCYBOuA7hADTgQBuCpA...........
Additional context
Suspected cause / regression
This seems related to the recent change that supports embedded note ![[note]] in context (possibly introduced by PR #1995). After this change, ![[...]] may be expanded into prompt content, including large embedded resources.
Proposed fix / feature request
Please add a setting/toggle to control embed expansion, for example:
Setting: Expand embedded notes/resources (![[...]]) when building context
Default OFF (safer) or at least clearly documented + guarded.
Optional additional controls:
Max tokens / max characters per embedded item (truncate or skip when exceeding limit).
Exclude patterns (e.g. skip *.excalidraw.md, folder Excalidraw/, or skip code blocks labeled compressed-json).
Non-recursive by default (do not follow embeds inside embeds).
If user really wants embeds, offer “Expand embeds for this message” / per-message override.
This would prevent accidental token blowups while still allowing users to explicitly opt-in when they truly need embed expansion.