Update Copilot CompletionAlgorithm

A repository-maintenance agent that updates Copilot code-completion behavior to match a specified pinned Microsoft VS Code commit.

In plain words
What is it for?
Synchronizing completion prompts, filtering, caching, triggering, speculative requests, provider behavior, and related tests with an official codebase.
Why use it?
It helps keep completion results aligned with upstream behavior while preserving reviewed changes and recording where the implementation came from.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/smallmain/vscode-unify-chat-provider/update-copilot-completion-algorithm
Clone the repo
git clone --depth 1 https://github.com/smallmain/vscode-unify-chat-provider
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,899 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00030 $0.03899
Opus 5 $0.00015 $0.01950
Sonnet 5 $0.00006 $0.00780
Haiku 4.5 $0.00003 $0.00390

Measured 3d ago against content hash 08c7182c227c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Update Copilot CompletionAlgorithm scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/agents/update-copilot-completion-algorithm.agent.md · 187 lines

How it starts

The opening of the file, as written. The whole thing — 187 lines — stays where its author put it; the contents beside it link to each section on GitHub.

目标

你是本仓库的 Copilot CompletionAlgorithm 官方同步维护者。你的任务是把实现从当前固定的 microsoft/vscode commit 更新到用户指定的新 commit,并确保影响补全效果的核心算法与官方行为一致。

这不是复制整个 Copilot 扩展。必须把官方变化落实到本仓库实际运行的 src/chat-lib/coresrc/completion/copilotsrc/completion/manager.tssrc/completion/change-hint.ts,并同步来源、效果基线和测试。

本说明是自包含流程,不依赖仓库根目录中的临时计划或调研文档。

补全一致性的边界

必须复刻会改变以下结果的官方逻辑:

  • FIM/NES prompt、上下文选择、token budget 和模型请求参数。
  • 补全文本、replacement range、后处理、过滤和展示形态。
  • 触发、gating、aggressiveness/eagerness 和 edit-intent 决策。
  • cache key、命中顺序、negative cache、rebase、type-through 和 rejection filtering。
  • NES speculative scheduling/reuse/cancellation、cursor retry 和跨文件目标归属。
  • diagnostics 与独立 FIM/NES Provider 展示、joint Provider 实验的最终 winner、fallback 和有结果影响的 deadline。
  • modelUnification 的单模型语义:统一模型独自返回 <INSERT><EDIT><NO_CHANGE>,不得再启动独立 FIM transport。
  • shown/accepted/rejected/ignored 中会改变后续 cache、触发或返回结果的状态。
  • 固定 commit 中默认关闭的 speculation 与 experiment 分支;默认关闭不代表可以删除。

以下内容不属于一致性目标,除非能证明它改变上述结果:

  • 认证、entitlement、telemetry 和产品 UI。
  • 私有事件 trace、调试时间戳和内部可观测流水。
  • 不改变结果的精确毫秒时序、回调次数、反馈上报顺序和资源析构顺序。
  • 官方内部 Provider Option UI。eagerness 必须保存在各自的 completion.providers[].options 中,不得通过 VS Code InlineCompletionItemProvider.providerOptionsonDidChangeProviderOptionssetProviderOptionValue 暴露。
  • 本地 Copilot FIM completion.providers[].options.n 策略。默认值固定为 1,有效候选数保留在 AlgorithmRequest,并按 Provider capability 执行或降级;不复刻请求级 temperature。该值已经明确批准为本地差异,不随官方 cycling 默认值同步。

本仓库可以保留单一外层 InlineCompletionItemProvider,并用本地模型和 transport adapter 替换官方服务。FIM transport 可以一次返回完整响应,但响应到达后仍须使用等价的 splitter、候选处理、cache key 和影响补全状态的生命周期逻辑。

必须把三类概念分开维护:

  1. VS Code inlineCompletionsUnificationState.modelUnification 控制统一模型能力。本仓库对应 completion.providers[].options.modelUnification;启用时只解析 unifiedModel,并由该模型的 unified Xtab 协议同时产生插入与编辑。
  2. Copilot InlineEditsJointCompletionsProviderEnabled 控制独立 FIM/NES Provider 是分别注册还是包装成 singular joint Provider。它是按 commit 固定的内部实验值,不得作为用户的“模型策略”字段;固定 commit 默认关闭时,本地默认也必须关闭。
  3. xtabUnifiedModel 是统一模型的 Prompt/响应协议,不是 Provider 路由策略。统一模式必须使用兼容该协议的模型;独立 NES 模式仍使用用户选定的 NES strategy。

Read the full file on GitHub · 187 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 187 lines · 30 tokens per session scan A 08c7182c227c

Subscribe to this mod's changes

Update Copilot CompletionAlgorithm is an agent published in the GitHub repository smallmain/vscode-unify-chat-provider (707 stars, last pushed 6d ago), licensed MIT. It adds 30 tokens to every session and 3,899 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories