Skip to main content

MCP server for extracting and persisting learnings from Copilot conversations

Project description

Canon Keeper MCP Server

An MCP (Model Context Protocol) server that extracts durable learnings from Copilot conversations and persists them to copilot-instructions.md.

No VS Code extension required! Copilot invokes the MCP tool directly.

Quick Install

# From any project directory
python -m canon_keeper_mcp install

# Or specify a workspace
python -m canon_keeper_mcp install --workspace /path/to/project

The installer will:

  1. ✅ Install dependencies (mcp, google-genai)
  2. ✅ Configure .vscode/mcp.json with the canon-keeper server
  3. ✅ Create/update .github/copilot-instructions.md with:
    • Memory Persistence Protocol (@History directive)
    • Best practices template
    • Session Learnings Log table

Features

  • Intelligent Extraction: Uses LLM to identify technical decisions, architectural choices, workarounds, and insights
  • Deduplication: Compares against existing learnings to avoid duplicates
  • Update Detection: Identifies when a learning updates/supersedes an existing entry
  • Markdown Formatting: Returns properly formatted table rows for the Session Learnings Log

Usage

After installation, reload VS Code and use these trigger phrases in any Copilot chat:

User: @History save what we learned
User: save this learning  
User: remember this
User: add to memory

Copilot will:

  1. Gather the full conversation history
  2. Call the MCP tool to extract learnings
  3. Deduplicate against existing entries
  4. Append new learnings to your copilot-instructions.md
  5. Report what was saved/skipped

Manual Installation

If you prefer to install manually:

1. Install dependencies

pip install mcp google-genai

2. Configure MCP server

Add to .vscode/mcp.json:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "mcpServers": {
    "canon-keeper": {
      "command": "${workspaceFolder}/.venv/Scripts/python.exe",
      "args": ["-m", "canon_keeper_mcp"],
      "cwd": "${workspaceFolder}"
    }
  }
}

3. Add directive to copilot-instructions.md

Add this to your .github/copilot-instructions.md:

### Memory Persistence Protocol (@History)

**Rule:** When the user includes `@History`, `save this`, `remember this`, or `add to memory` in any message:

1. Read the current `copilot-instructions.md` file content
2. Collect the full conversation history from this session
3. Call MCP tool `canon_keeper.extract_and_save_learnings` with:
   - `conversation`: The complete conversation text
   - `current_instructions`: The full content of copilot-instructions.md
4. If `markdown_to_append` is non-empty, append it to the Session Learnings Log table
5. Report what was saved and what was skipped as duplicates

**Trigger phrases:** `@History`, `save this`, `remember this`, `add to memory`

4. Add Session Learnings Log table

## Session Learnings Log

| Date | Topic | Decision | Rationale |
|------|-------|----------|----------|

MCP Tools

extract_and_save_learnings

Extracts learnings from conversation and deduplicates against existing entries.

Input:

  • conversation (string): Full conversation text
  • current_instructions (string): Current copilot-instructions.md content

Output:

{
  "status": "success",
  "message": "Found 2 new learning(s), skipped 1 duplicate(s).",
  "new_learnings": [...],
  "duplicates_skipped": [...],
  "markdown_to_append": "| 2026-01-17 | Topic | Decision | Rationale |",
  "target_section": "Session Learnings Log"
}

check_learning_exists

Check if a specific learning already exists.

Input:

  • topic (string): Learning topic
  • decision (string): The decision/learning
  • current_instructions (string): Current copilot-instructions.md content

Output:

{
  "exists": true,
  "similar_to": "Existing Topic Name",
  "reason": "Semantically equivalent to existing entry"
}

LLM Providers

Supports:

  • Google GenAI (default): Uses gemini-2.0-flash-001
  • OpenAI (fallback): Uses gpt-4o-mini

Set appropriate API keys:

  • GOOGLE_API_KEY for Google GenAI
  • OPENAI_API_KEY for OpenAI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canon_keeper_mcp-0.1.3.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

canon_keeper_mcp-0.1.3-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file canon_keeper_mcp-0.1.3.tar.gz.

File metadata

  • Download URL: canon_keeper_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for canon_keeper_mcp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c0c8e1e2fc1d55c55a6fd961da10bbff84581598bc06ca8cb1512949fd9d083f
MD5 94004be760348802f3e98651dc7e33c9
BLAKE2b-256 7b082eb0b7f03dd52d54653a5bc5174ff9e2ff76f451c34fe4e3d8f14e6d9aaf

See more details on using hashes here.

File details

Details for the file canon_keeper_mcp-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for canon_keeper_mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b9ae52da3ce91b37bc9b104406b09b1e3e926b34aa3fa67bc3791adfe5be6178
MD5 f560f94d5961ab5e5114a13471120e8a
BLAKE2b-256 f0debfcb6f047a9ec91b33721f6f5a2975a6308c78a56085de8ae5f922a7b8a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page