How to Send Web Pages to GitHub Copilot with Share2Agent
Send documentation, tutorials, and error pages directly into your GitHub Copilot Chat context. Share2Agent extracts clean text from any web page, saves it as Markdown in your workspace, and Copilot can reference it via @workspace.
Prerequisites
- VS Code with the GitHub Copilot extension (Copilot Chat enabled)
- Share2Agent Chrome extension installed
- Python 3.10+ with PyYAML (
pip install pyyaml)
Step 1: Set Up the Receiver
The receiver saves shared pages as Markdown files. Copilot reads them from your workspace.
git clone https://github.com/mnardit/share2agent.git
cd share2agent/examples/receiver
pip install pyyamlStep 2: Save Pages to Your Workspace
Point the receiver at a directory inside your VS Code workspace:
export PAGES_DIR=~/my-project/shared-pages
python3 -u receiver.pyThe receiver listens on port 9876. Every shared page is saved as a .md file with YAML frontmatter (URL, title, metadata) and the full extracted text.
Step 3: Configure Share2Agent
- Click the Share2Agent extension icon in Chrome.
- Open Settings.
- Set the Webhook URL to
http://localhost:9876. - Save.
Step 4: Share a Page
- Open a documentation page, GitHub issue, or any reference you need.
- Click the Share2Agent icon.
- Add an optional comment describing why this page matters (e.g., "auth example for our API").
- Click Share.
The page is saved to your workspace:
~/my-project/shared-pages/2026-03-28-1430-github-api-authentication.md
Step 5: Use with Copilot Chat
GitHub Copilot Chat supports @workspace to search your entire project for context. Since the saved Markdown files live in your workspace, Copilot indexes them automatically.
Open Copilot Chat in VS Code and ask:
@workspace Based on the GitHub API authentication docs I saved,
how should I implement token refresh in our auth module?
Copilot finds the relevant .md file and uses it as context for its answer.
You can also reference files directly:
#file:shared-pages/2026-03-28-1430-github-api-authentication.md
Explain the rate limiting strategy described here.
Tips
- Keep the directory in
.gitignore-- shared pages are ephemeral reference material, not source code. Addshared-pages/to your.gitignore. - Use comments as instructions -- the comment you add in Share2Agent is saved in the Markdown frontmatter. Include context like "compare this with our current approach" so you remember why you saved it.
- Copilot in terminal -- if you use Copilot in VS Code's integrated terminal (
Ctrl+I), you can paste the file path directly and ask Copilot to explain or summarize it.
Running as a Background Service
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/share2agent-receiver.service << 'EOF'
[Unit]
Description=Share2Agent Webhook Receiver
[Service]
Environment=PAGES_DIR=%h/my-project/shared-pages
ExecStart=/usr/bin/python3 -u /path/to/receiver.py
Restart=on-failure
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now share2agent-receiverWhat's Next?
- Auto-summarize on save -- extend
receiver.pyto call an LLM and prepend a summary to each saved file, so Copilot gets the key points faster. - Organize by topic -- use the comment field to route pages into subdirectories (e.g.,
shared-pages/auth/,shared-pages/testing/). - Pair with Copilot Edits -- share a reference page, then use Copilot Edits to refactor your code based on the documented pattern.