Skip to content

feat(ai): add GitHub Copilot as memory provider#14

Open
akinard wants to merge 1 commit intotickernelz:mainfrom
akinard:akinard/github-copilot-support
Open

feat(ai): add GitHub Copilot as memory provider#14
akinard wants to merge 1 commit intotickernelz:mainfrom
akinard:akinard/github-copilot-support

Conversation

@akinard
Copy link

@akinard akinard commented Feb 5, 2026

Summary

This PR adds GitHub Copilot as a new memory provider for opencode-mem, enabling auto-capture and user profile analysis using GitHub Copilot's API without requiring separate API keys.

Changes

New Files

  • src/services/ai/providers/github-copilot-auth.ts - Reads OAuth tokens from opencode's auth storage (~/.local/share/opencode/auth.json)
  • src/services/ai/providers/github-copilot.ts - GitHubCopilotProvider class using OpenAI-compatible Chat Completions API

Modified Files

  • src/services/ai/session/session-types.ts - Added "github-copilot" to AIProviderType
  • src/services/ai/ai-provider-factory.ts - Registered the new provider
  • src/config.ts - Added "github-copilot" to provider type definitions and config template

Usage

// ~/.config/opencode/opencode-mem.jsonc
{
  "memoryProvider": "github-copilot",
  "memoryModel": "claude-haiku-4.5",  // or gpt-4o, gemini-3-flash, etc.
  "autoCaptureEnabled": true
}

No API key needed - the provider automatically reads GitHub Copilot OAuth tokens from opencode's auth storage.

Testing

  • Auth token retrieval works
  • Basic API completion works
  • Tool calling (for memory extraction) works
  • Plugin loads without errors
  • Manual memory operations work (add, list)
  • Web UI accessible and functional
  • Vector search working (confirmed via web UI API)

Notes

  • Supports both public GitHub Copilot and GitHub Copilot Enterprise
  • Uses proper headers: Openai-Intent: conversation-edits, x-initiator: agent
  • Compatible with all GitHub Copilot models (Claude, GPT, Gemini)

Add support for using GitHub Copilot as the AI provider for auto-capture
and memory analysis. Uses opencode's stored OAuth tokens for authentication,
eliminating the need for separate API key configuration.

New files:
- github-copilot-auth.ts: Token retrieval from opencode auth storage
- github-copilot.ts: GitHubCopilotProvider implementing BaseAIProvider

Changes:
- Register github-copilot in AIProviderType and factory
- Add github-copilot option to config types and template
- Document available models (claude-haiku-4.5 recommended for auto-capture)

Supported models: claude-opus-4.5, claude-sonnet-4.5, claude-haiku-4.5,
gemini-3-pro, gemini-3-flash, gpt-4o, gpt-4o-mini
@tickernelz
Copy link
Owner

works fine on your local? and pls remove the GITHUB_COPILOT_PLAN.md

@evertonstz
Copy link

I want to test it in my machine, but I swear to god I can't find a way to load the plugin manually. Any guide for it other than the vague opencode wiki?

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