🧬 Copilot-LD

An intelligent agent leveraging GitHub Copilot and Linked Data

Getting Started

This guide helps you quickly set up and run Copilot-LD for the first time. Follow these steps to configure GitHub integration, prepare your knowledge base, and start interacting with the system.

Prerequisites

1. Initial Setup

Clone the repository and install dependencies:

git clone https://github.com/copilot-ld/copilot-ld.git
cd copilot-ld
npm install

Copy configuration templates:

cp .env.example .env
cp config.example.yml config.yml

2. GitHub App Configuration

To use the Copilot Extension, you need to configure GitHub App integration:

Create GitHub App

  1. Go to GitHub Settings > Developer settings > GitHub Apps > New GitHub App
  2. Fill in required fields:
    • GitHub App name: Your app name
    • Homepage URL: http://localhost:3001
    • Callback URL: http://localhost:3001/auth/callback
  3. Under Permissions, grant:
    • Repository permissions: Contents (Read)
    • Account permissions: Copilot Chat (Write)
  4. Save the app and note the Client ID

Configure Client ID

Add your GitHub App Client ID to the environment file:

# Edit .env file
GITHUB_CLIENT_ID=your_20_character_client_id_here

3. Token Setup

Generate a GitHub token for API access:

node tools/token.js

This creates a token with appropriate permissions. Store the token securely and add it to your environment configuration.

Service Authentication

Generate a shared secret for service-to-service authentication:

node tools/secret.js

This command automatically updates your .env file with the generated secret.

4. Offline Knowledge Processing

Prepare your knowledge base through the offline processing pipeline:

Download Knowledge Data

Configure the download source in config.yml and download knowledge assets:

# Edit config.yml to set your source repository
tool:
  download:
    owner: "your-github-owner"
    repo: "your-knowledge-repo"

# Download the data
node tools/download.js

Process Content into Chunks

Extract and process content from HTML files:

node tools/chunk.js

This scans HTML files for microdata items, extracts content, and creates searchable chunks stored in data/chunks/.

Build Vector Indices

Create vector embeddings and search indices:

node tools/index.js

This generates embeddings for all chunks and builds scope-specific vector indices for efficient similarity search.

5. Example HTML Content

If you don't have existing knowledge assets, create an example HTML file with microdata:

<!-- Save as data/knowledge/example.html -->
<html>
<head>
    <title>Example Knowledge</title>
</head>
<body>
    <article itemscope itemtype="http://schema.org/Article">
        <h1 itemprop="headline">Docker Security Best Practices</h1>
        <div itemprop="articleBody">
            <p>Always use specific image tags instead of 'latest' to ensure reproducible builds and security.</p>
            <p>Implement multi-stage builds to reduce attack surface and image size.</p>
        </div>
    </article>
    
    <article itemscope itemtype="http://schema.org/Article">
        <h1 itemprop="headline">Kubernetes Deployment Strategies</h1>
        <div itemprop="articleBody">
            <p>Rolling updates provide zero-downtime deployments by gradually replacing instances.</p>
            <p>Use readiness and liveness probes to ensure application health during deployments.</p>
        </div>
    </article>
</body>
</html>

The chunking process looks for elements with microdata attributes and extracts them as individual knowledge items using structured data.

6. Start the System

Launch all services in development mode:

npm run dev

This starts all microservices (agent, vector, scope, llm, history, text) and extensions (web, copilot) concurrently.

7. Interactive Chat

Use the chat tool to interact with your configured knowledge base:

Interactive Mode

node tools/chat.js
> What are Docker security best practices?
> How do I implement rolling updates in Kubernetes?

Scripted Testing

echo "Tell me about container security" | node tools/chat.js

Web Interface

Access the web interface at:

Troubleshooting

Common Issues

Validation

Verify your setup by running:

# Check code quality
npm run check

# Test basic functionality
echo "hello" | node tools/chat.js

Next Steps