Skip to content

feat!: replace @wiki chat participant with skills, agent plugin and richer MCP server - #124

Merged
Lili Xu (llxu1) merged 3 commits into
mainfrom
feat/replace-chat-participant-with-skills-mcp
Nov 11, 2026
Merged

Lili Xu (llxu1) merged 3 commits into
mainfrom
feat/replace-chat-participant-with-skills-mcp

Conversation

@llxu1

@llxu1 Lili Xu (llxu1) commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

🦄 This PR was prepared by an AI agent on behalf of Lili Xu (@llxu1).

Why

VS Code deprecated chat participants (docs updated with VS Code 1.143, Oct 2026). The Copilot harness, which VS Code 1.142 began rolling out as the default for new chat sessions, doesn't run participants. So @wiki no longer works for most users, and neither does the sidebar Fix Issues button, which only opened @wiki /fix. The recommended replacement is skills plus an MCP server, with an optional custom agent, shipped as an agent plugin. LLM Wiki already had the MCP server.

This PR implements phases 0–2 of the plan: remove @wiki, make the MCP server the chat surface, and ship skills, an agent and a plugin.

What changed

Phase 0: remove @wiki

  • Deleted chatParticipant.ts, chatHistory.ts and their test, and removed contributes.chatParticipants.
  • Fix Issues now applies the deterministic fixes locally (new core fixWiki()), shows what still needs judgment in the Lint Findings view, and offers Fix with Copilot, which opens chat with /wiki-fix. That view was implemented and tested but never registered. Fix Issues no longer lets a model delete pages without confirmation, which /fix used to do.
  • New Run Lint and Fix Remaining Issues with Copilot commands. Refresh uses fixWiki() instead of a duplicated loop.
  • Requires VS Code ^1.109.0 (extension-contributed skills); @types/vscode is pinned to ~1.109.0.

Phase 1: the MCP server becomes the chat surface

  • Annotations and titles on every tool. Read tools are readOnlyHint, so VS Code no longer prompts for every lookup. Tools that overwrite or delete set destructiveHint, based on actual behavior; for example, the create tools overwrite a page with the same slug.
  • Server instructions carry the old participant's guidance plus the wiki's own AGENTS.md, capped at 12k characters.
  • New tools: wiki_fix (with dryRun) and wiki_delete_page (refuses index.md, log.md, non-.md files and traversal; reports pages that still link to it).
  • Structured output (outputSchema + structuredContent) for status, query, lint and fix. Completions for resource templates and prompt arguments. A server icon, title and real version.
  • Finding the wiki when no root is given: plugin servers start in the plugin folder, and I confirmed with a probe that Copilot CLI reports no MCP roots. The server checks LLMWIKI_ROOT, then MCP roots (VS Code sends them), then <cwd>/.wiki, and adds wiki_open / wiki_init. The extension still binds the server to its wiki, so those two tools don't appear there.
  • wiki_create_entity / wiki_create_concept accept sources, and wiki_update_page accepts addSources. Pages created or extended by agents are cleaned up only when all of their sources are removed, matching what the extension's own ingest does. Source paths must be existing pages, and pages without sources are never cleaned up automatically.
  • The provider sets ELECTRON_RUN_AS_NODE=1 explicitly. It runs the VS Code binary as Node and previously relied on inheriting that variable.

Phase 2: skills, the Wiki Librarian agent, and the agent plugin

  • plugin/ (Agent Plugins 1.0) is the single source for the skills (wiki-ask, wiki-research, wiki-ingest, plus on-demand wiki-save and wiki-fix), the Wiki Librarian agent, and a .wiki/** instructions rule.
  • The extension contributes the same files through chatSkills / chatAgents / chatInstructions (gated on llmwiki.isWikiWorkspace); esbuild.config.mjs copies them into out/chat/.
  • The plugin ships a self-contained, committed MCP server bundle (plugin/server/llmwiki-mcp.cjs). It is minified, deterministic and marked linguist-generated, and CI fails if it's stale. Install with copilot plugin install microsoft/llmwiki:plugin, or through .github/plugin/marketplace.json (llmwiki@llmwiki).

Existing bugs found and fixed

  • wiki_ingest_with_context resolved relative sourcePath against the server's cwd, so raw/x.md never worked; the docs and prompts used it anyway. It now resolves against the wiki root.
  • lintFix({ fixOrphans: true }) indexed an unindexed orphan page twice, duplicating its index entry. Confirmed against main with a regression test.
  • gray-matter cache leak in readPage. Cached data objects are shared, so after lintFix added created to a page, a later read of identical content returned the mutated frontmatter. The live CLI run exposed this: the agent rewrote a page, and wiki_lint reported zero findings when there was one. Fixed and covered by unit and MCP regression tests, both confirmed to fail without the fix.
  • The ingest-and-integrate prompt named the parameter source_path instead of sourcePath. The AGENTS.md template referenced @wiki /lint and a command that doesn't exist.

Fixes from code review

An independent review of this diff, plus a follow-up pass, found more issues. All are fixed here:

  • Multi-source pages. Remove Source and the raw/ deletion watcher deleted any page that listed the removed source, even if it also drew on another source. Both now use the new core removeSourcePages(), which keeps pages that still have an existing source. Agents record extra sources with addSources.
  • Untracked sources entries. Only sources/<name>.md summary paths take part in provenance, and only ENOENT counts as missing. Previously a hand-written page listing raw/paper.pdf or a URL as a source would be deleted by Refresh or Fix Issues; that is a pre-existing bug that wiki_fix would have widened. The MCP tools accept only existing summary pages.
  • Ingest overwrites (VS Code). The extension's LLM ingest overwrote existing entity and concept pages and reset their sources. That was a pre-existing data-loss bug when two sources mention the same entity, and it also raced with /wiki-ingest. The new core upsertDerivedPage() extends existing pages (content, tags, sources). The ingest keeps a summary edited while the model runs, and repeated creates no longer duplicate index entries. A skipped ingest now returns summary_page, and its message no longer pushes agents to force a re-ingest.
  • Docs. The docs now describe the actual discovery order: <cwd>/.wiki at startup first, then client roots.

Fixes from the Copilot review

  • Concurrent writes. Two ingests, or an ingest and an MCP tool, could read the same entity page and overwrite each other's merged content and sources. Losing a source could later let cleanup delete a page that still had one. The new core withWikiLock is a wiki/.llmwiki.lock file shared by the extension and every MCP server process. It is re-entrant within one call chain, and a stale lock is broken after 10 seconds. Every page and index read-modify-write runs under it: ingest, upsertDerivedPage, crosslinks, the MCP write tools, index updates, fixes and source cleanup. Cleanup checks a page's sources and deletes it under the same lock.
  • Deletion through symlinks and case variants. deletePage now resolves symlinked folders and requires the real path to stay inside the wiki, so wiki/linked -> ../raw can't delete a raw source. It also refuses index.md and log.md in any letter case, at both the given and the resolved location. wiki_delete_page checks case-insensitively too.
  • wiki_fix preview. The dry run used to lint the current wiki and filter out findings about pages it would delete. Now it lints the wiki as it would be after the deletions, so links to those pages show up as broken, and the preview matches what applying reports.
  • Missing index.md. MCP discovery now uses the same test as wiki_init and the extension (.wiki/wiki/ exists). A wiki whose index went missing therefore opens, and wiki_fix rebuilds the index. Before, wiki_open sent agents to wiki_init, which then failed.
  • Approval before wiki_fix deletes. The /wiki-fix skill, the lint-and-fix prompt, the server instructions and the wiki_fix description now say to apply only after the user approves the removed_pages from the preview. If the user declines, the agent must not apply the fixes.

Breaking changes / migration

Before Now
@wiki <question> Ask in Agent mode, or /wiki-ask
@wiki /status Status bar, Show Status, or wiki_status
@wiki /lint Run Lint (Lint Findings view) or wiki_lint
@wiki /fix Fix Issues, then /wiki-fix / Fix with Copilot
@wiki /save /wiki-save [title] (previously only printed a suggested path)

llmwiki-mcp without a path now starts in discovery mode instead of exiting when ./.wiki is missing.

Testing

  • Unit + integration (vitest): 619 tests in 35 files pass. Coverage rose to 86.7% statements, 77.4% branches and 89.7% functions, from 82.1%, 72.5% and 83.2%. New coverage includes:

    • fixWiki, the lintFix dry run, removeSourcePages, normalizeSourceRef, upsertDerivedPage;
    • the wiki write lock: waiting while a lock file exists, taking over a stale one, re-entrancy, and release after a failure;
    • concurrent upsertDerivedPage calls, and wiki_update_page calls overlapping with an ingest, on one page; all of these lose sources without the lock;
    • deletion through symlinked folders and of case variants of index.md / log.md (all 8 cases fail on the previous deletePage), and a wiki_fix preview that matches what applying reports;
    • tool metadata and annotation semantics, structured output (validated by the MCP SDK client), instructions, completions;
    • discovery (cwd, roots, roots-changed, wiki_open / wiki_init, a wiki with no index.md, bound mode), the maintenance tools, provenance (sources / addSources);
    • the provider definition and the new commands;
    • plugin and manifest validation, and a check that skills, prompts and instructions only mention tools that exist.
  • Cross-process lock check: the committed plugin server ran as a child process and handled wiki_update_page calls. Meanwhile this process extended the same page with upsertDerivedPage, the way the extension does: 12 concurrent writers, 3 rounds. No sources or content were lost, and no lock file was left behind.

  • MCP stdio e2e: spawns the committed plugin/server/llmwiki-mcp.cjs with node from the plugin folder, the way plugin clients do. Covers discovery, open, ingest with a relative path, structured status and dry-run fix, plus bound mode and LLMWIKI_ROOT.

  • VS Code e2e (npm run test:integration, newly runnable, VS Code 1.145.3): 7 tests pass in a real VS Code on a fixture wiki with known problems:

    • activation, no participant, every contributed skill / agent / instruction file present, commands registered;
    • Run Lint leaves the wiki unchanged; Fix Issues repairs it on disk;
    • the MCP server starts through VS Code's own binary with only the provider's ELECTRON_RUN_AS_NODE.

    No contribution-point warnings appear in the logs.

  • Live Copilot CLI 1.0.105 e2e (--plugin-dir plugin, only llmwiki tools allowed, on a seeded sample wiki):

    • /llmwiki:wiki-ask → wiki_open → wiki_query → 3× wiki_read_page; answered only from the wiki, with .wiki/wiki/... citations.
    • /llmwiki:wiki-save → queries/computability-basics.md with valid relative links and an index entry.
    • /llmwiki:wiki-fix → dry run, apply, the remaining broken link rewritten, lint clean, nothing deleted, raw/ untouched.
    • /llmwiki:wiki-ingest raw/grace-hopper.md → summary, 6 entities and 2 concepts, all tagged with sources, 9 crosslinks. A dry-run wiki_fix after removing the source would delete exactly those 8 pages.
    • --agent llmwiki:wiki-librarian → auto-loaded a skill, answered with a citation.
    • After the review fixes, /llmwiki:wiki-ingest of a second source that overlaps existing pages extended cobol.md and grace-hopper.md with addSources instead of overwriting them. Simulating removal of the first source then deletes only its summary and keeps both shared pages. Lint is clean.
  • Packaging: npm run package → the VSIX (18 files) contains out/chat/** and out/mcp-server.cjs, and no participant or test files.

  • A clean npm ci with the updated lockfile, then build, lint, the bundle freshness check, and coverage, all pass.

  • Manual check in VS Code 1.144, signed in to Copilot (Copilot harness, extension VSIX installed): asked /wiki-ask Is JWST a replacement for Hubble? against a sample wiki.

    • The harness synced the extension's wiki-ask skill and llmwiki.instructions.md.
    • It found the extension's LLM Wiki MCP tools through tool search, then called wiki_query once and wiki_read_page three times. None of them asked for confirmation, since they're annotated read-only.
    • The answer linked the wiki pages it used. This run is the new README screenshot.

Not covered:

  • The Wiki Librarian agent inside VS Code. It was only tested through Copilot CLI.
  • Automated Copilot Chat tests in VS Code, because the test instance can't sign in to Copilot.

Notes for reviewers

  • Versions are unchanged; the release PR should bump to 2.0.0 (breaking). Plugin and marketplace versions are tied to the extension version by a test. The CHANGELOG entry is under [Unreleased].
  • package-lock.json: this machine resolves npm through an internal mirror. I rewrote the new @types/vscode@1.109.0 entry to registry.npmjs.org with a sha512 that I computed from the tarball and confirmed against a public lockfile.
  • docs/images/interface.png was retaken in VS Code 1.144. The old one showed @wiki and listed JWST twice under Entities. The new one shows /wiki-ask, the MCP tool calls and the Lint Findings view.
  • @llmwiki/core doesn't appear to be published on npm. The README's npx snippets now also show the bundled-server alternative.

Lili Xu (llxu1) and others added 2 commits November 9, 2026 17:27
…icher MCP server

VS Code deprecated chat participants and the Copilot harness does not run
them, so @wiki no longer works for most users. Replace it with:

- The MCP server as the chat surface: tool titles and annotations
  (read-only tools run without confirmation), server instructions that
  include the wiki's AGENTS.md, structured output, completions, an icon
  and real version, new wiki_fix and wiki_delete_page tools, and wiki
  discovery (wiki_open/wiki_init) for servers started without a root.
- Skills (wiki-ask, wiki-research, wiki-ingest, wiki-save, wiki-fix), a
  Wiki Librarian custom agent and .wiki/** instructions, authored once in
  plugin/ and contributed by the extension through chatSkills, chatAgents
  and chatInstructions.
- An Agent Plugins 1.0 plugin with a committed, self-contained MCP server
  bundle (CI checks it is current) and a marketplace index.
- Fix Issues applies the deterministic fixes (new core fixWiki) and lists
  the rest in the Lint Findings view with a Fix with Copilot action; new
  Run Lint command.

Also fixes relative sourcePath resolution in wiki_ingest_with_context,
duplicate index entries from lint-fix and page re-creation, a gray-matter
cache leak in readPage, source removal deleting pages that still have
another source, and the extension's LLM ingest overwriting existing pages.
Requires VS Code 1.109.

BREAKING CHANGE: the @wiki chat participant is removed. See the migration
table in the README.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the old @wiki chat participant screenshot with one from VS Code 1.144. It shows the /wiki-ask skill answering through the LLM Wiki MCP tools in Copilot Chat, and the sidebar's new Lint Findings view.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Page deletion can traverse directory symlinks and remove raw sources, files outside the wiki, or protected files, creating a critical safety risk.

6 open issues
What changed in this PR

Replaces LLM Wiki’s @wiki chat participant with shared Copilot skills, a Wiki Librarian agent, and an expanded MCP server for VS Code and agent-plugin clients.

Changes:

  • Packages shared skills, agent instructions, and a bundled MCP server as an agent plugin.
  • Adds MCP discovery, maintenance tools, structured results, annotations, and completions.
  • Centralizes wiki fixes, improves ingestion provenance handling, and expands tests and migration documentation.
File Description
vitest.config.ts Updates coverage exclusions for participant removal and provider tests.
tests/​vscode/​mcpProvider.test.ts Tests server definitions and explicit Node-mode environment.
tests/​vscode/​integration/​suite/​index.ts Increases integration-test timeout.
tests/​vscode/​integration/​suite/​extension.test.ts Tests activation, contributions, maintenance commands, and MCP startup.
tests/​vscode/​integration/​runTest.ts Creates a fixture workspace for real-editor tests.
tests/​vscode/​integration/​build.mjs Bundles the integration runner and suite as CommonJS.
tests/​vscode/​commands.test.ts Covers maintenance commands and source removal.
tests/​vscode/​chatHistory.test.ts Removes tests for deleted participant history handling.
tests/​shared/​wiki.test.ts Adds frontmatter mutation-isolation regression coverage.
tests/​shared/​wiki-create-pages.test.ts Tests derived-page merging and index-entry updates.
tests/​shared/​mcp/​server-metadata.test.ts Tests metadata, schemas, annotations, and server instructions.
tests/​shared/​mcp/​server-integration.test.ts Updates expected maintenance tools and bound-mode behavior.
tests/​shared/​mcp/​maintenance-tools.test.ts Tests fixes, deletion, provenance, and relative source paths.
tests/​shared/​mcp/​discovery.test.ts Covers discovery, workspace roots, opening, and initialization.
tests/​shared/​mcp/​completions.test.ts Tests resource and prompt argument completions.
tests/​shared/​ingest-context.test.ts Updates expectations for previously ingested sources.
tests/​shared/​fix.test.ts Covers cleanup, dry runs, provenance, and index regressions.
tests/​plugin/​server-stdio.test.ts Exercises the committed plugin server over stdio.
tests/​plugin/​plugin.test.ts Validates manifests, customizations, versions, and tool references.
README.md Documents replacement workflows, plugin installation, and MCP capabilities.
plugin/​skills/​wiki-save/​SKILL.md Defines the conversation-to-wiki saving workflow.
plugin/​skills/​wiki-research/​SKILL.md Defines cross-page research and gap analysis.
plugin/​skills/​wiki-ingest/​SKILL.md Defines ingestion, provenance recording, and crosslinking.
plugin/​skills/​wiki-fix/​SKILL.md Defines preview, repair, and verification steps.
plugin/​skills/​wiki-ask/​SKILL.md Defines wiki-grounded answers with page citations.
plugin/​README.md Explains plugin contents, installation, and development.
plugin/​plugin.json Declares the agent-plugin manifest.
plugin/​mcp.json Configures the bundled MCP server launcher.
plugin/​com.github.copilot/​rules/​llmwiki.instructions.md Adds file-scoped wiki editing guidance.
plugin/​com.github.copilot/​agents/​wiki-librarian.agent.md Defines the Wiki Librarian agent.
packages/​vscode/​src/​mcpProvider.ts Explicitly starts the editor executable in Node mode.
packages/​vscode/​src/​llmIngest.ts Extends derived pages and preserves summaries edited during ingestion.
packages/​vscode/​src/​extension.ts Registers lint findings and removes participant wiring.
packages/​vscode/​src/​commands.ts Adds local maintenance commands and shared source cleanup.
packages/​vscode/​src/​chatParticipant.ts Removes the legacy @wiki participant implementation.
packages/​vscode/​src/​chatHistory.ts Removes participant-specific conversation conversion.
packages/​vscode/​README.md Documents skills, maintenance commands, and migration.
packages/​vscode/​package.json Replaces participant contributions and raises VS Code requirements.
packages/​vscode/​esbuild.config.mjs Copies customizations and builds the plugin server bundle.
packages/​vscode/​CHANGELOG.md Records breaking changes, new capabilities, and fixes.
packages/​core/​src/​wiki.ts Isolates frontmatter reads and adds derived-page upserts.
packages/​core/​src/​mcp/​write-tools.ts Adds maintenance tools, provenance inputs, and annotations.
packages/​core/​src/​mcp/​workspace-tools.ts Adds wiki opening and initialization tools.
packages/​core/​src/​mcp/​wiki-root.ts Tracks configured, discovered, and explicitly selected wiki roots.
packages/​core/​src/​mcp/​server.ts Integrates discovery, metadata, structured output, and completions.
packages/​core/​src/​mcp/​schemas.ts Defines structured tool-result schemas.
packages/​core/​src/​mcp/​resources.ts Resolves resource roots on demand.
packages/​core/​src/​mcp/​read-tools.ts Adds read-only annotations, titles, and output schemas.
packages/​core/​src/​mcp/​prompts.ts Corrects ingest parameter guidance and updates maintenance steps.
packages/​core/​src/​mcp/​instructions.ts Builds server guidance with a bounded wiki-schema excerpt.
packages/​core/​src/​mcp/​index.ts Exports new MCP capabilities and types.
packages/​core/​src/​mcp/​completions.ts Supplies page, source, and topic suggestions.
packages/​core/​src/​mcp/​bin.ts Supports environment configuration and discovery-mode startup.
packages/​core/​src/​lint.ts Adds dry-run support and prevents duplicate orphan indexing.
packages/​core/​src/​init.ts Updates generated provenance and maintenance guidance.
packages/​core/​src/​ingest.ts Returns the existing summary path for skipped ingestion.
packages/​core/​src/​ingest-context.ts Recommends extending previously ingested content.
packages/​core/​src/​index.ts Exports shared wiki-fix operations.
packages/​core/​src/​index-ops.ts Adds index upserts that preserve existing summaries.
packages/​core/​src/​fix.ts Centralizes provenance cleanup and deterministic wiki fixes.
packages/​core/​src/​constants.ts Adds the package version reported by MCP.
packages/​core/​README.md Documents discovery and environment-based root selection.
package.json Adds the real-editor integration-test command.
package-lock.json Updates VS Code types and engine metadata.
docs/​workflows/​smart-ingest.md References the ingestion skill and removes fixed tool counts.
docs/​mcp-tools.md Documents new tools, provenance, discovery, and structured results.
.github/​workflows/​ci.yml Checks committed plugin-bundle freshness after building.
.github/​plugin/​marketplace.json Adds the plugin marketplace entry.
.gitattributes Marks the server bundle generated and preserves its bytes.

Review effort: Max

Comment thread packages/core/src/mcp/write-tools.ts Resolved
Comment thread packages/core/src/fix.ts Resolved
Comment thread packages/core/src/mcp/wiki-root.ts Resolved
Comment thread packages/core/src/mcp/write-tools.ts Resolved
Comment thread packages/core/src/wiki.ts Resolved
Comment thread plugin/skills/wiki-fix/SKILL.md Resolved
Address the Copilot review of #124:

- Add withWikiLock, a cross-process wiki write lock (wiki/.llmwiki.lock,
  re-entrant, broken when stale). Page and index read-modify-writes in
  core, the MCP write tools and the extension's ingest use it, so
  concurrent ingests no longer lose each other's content or sources.
- deletePage resolves symlinked folders and checks that the real path
  stays inside the wiki; index.md and log.md are protected in any letter
  case.
- The wiki_fix dry run lints the wiki as it would be after the planned
  deletions instead of filtering the findings afterwards.
- MCP discovery accepts a wiki whose index.md is missing (the same test
  as wiki_init and the extension), so wiki_fix can rebuild the index.
- The wiki-fix skill, the lint-and-fix prompt, the server instructions
  and the wiki_fix description require the user's approval before
  applying fixes that delete pages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@llxu1
Lili Xu (llxu1) merged commit 31f36f4 into main Nov 11, 2026
2 checks passed
Lili Xu (llxu1) added a commit that referenced this pull request Nov 11, 2026
Release 1.1.0 replaces the deprecated @wiki chat participant with skills, a custom agent and a richer MCP server (#124), and ships the dependency security fixes merged since 1.0.1 (#111-#123).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants