Skip to content

GitHub Copilot Integration

GitHub Copilot reads project-specific instructions from .github/copilot-instructions.md. Contox injects your project brain into this file so Copilot has access to your full project memory.

How it works

  1. Contox writes your project brain between <!-- contox:start --> and <!-- contox:end --> markers in .github/copilot-instructions.md
  2. Copilot reads the instructions file and uses the context for AI interactions
  3. At session end, you save work via the CLI: contox save "summary"

Your own custom instructions outside the markers are never modified.

Prerequisites

  • Contox CLI installed: npm install -g contox-cli
  • CLI authenticated: contox login -k <your-api-key>
  • Project initialized: contox init -t <team-id> -p <project-id>

Option 1: Setup via VS Code extension

  1. Run Contox: Setup Wizard from the VS Code command palette
  2. In Step 4, check GitHub Copilot
  3. The extension creates the .github directory if needed and writes copilot-instructions.md with Contox instructions

Option 2: Setup via CLI export

Generate the Copilot instructions file from the command line:

bash
contox export -f copilot

This creates or updates .github/copilot-instructions.md in your project root.

To preview the output without writing files:

bash
contox export -f copilot --stdout

Option 3: Manual setup

Create .github/copilot-instructions.md in your project:

bash
mkdir -p .github

Then add the Contox instructions:

markdown
# Contox AI Memory

At the START of each session, run: `contox memory`
At the END of each session, run: `contox save "Brief summary"`

For structured saves: `echo '{"summary":"...","changes":[...]}' | contox save --json`
Categories: architecture, conventions, implementation, decisions, bugs, todo

Keeping memory up to date

Refresh the brain document after new sessions or scans:

bash
contox export -f copilot

If you use the VS Code extension, running Contox: Load Memory automatically refreshes the injection in .github/copilot-instructions.md.

Combining with your own instructions

Place your custom Copilot instructions outside the contox markers:

markdown
# Project Instructions

- This is a Next.js 14 project with TypeScript
- Use server components by default
- Follow the existing code style

<!-- contox:start -->
# Contox — Project Memory
...auto-generated brain content...
<!-- contox:end -->

The section between the markers is replaced on each sync. Everything else is preserved.

Next steps