A webhook server that connects Linear issues to Claude Code for automated implementation. When you mention @Claude in a Linear comment, this server will:
- Fetch the full context of the issue (description, comments, labels)
- Clone the associated repository
- Run Claude Code to implement the requested changes
- Create a new branch and open a Pull Request
- Comment back on Linear with the PR link and implementation details
- Node.js 20+
- Git
- GitHub CLI (
gh) - A Linear account with API access
- An Anthropic API key
- A GitHub Personal Access Token
# Clone the repository
git clone https://github.com/michaeljelly/CLinear-Code.git
cd CLinear-Code
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Edit .env with your credentials (see Configuration section)
nano .env
# Build and run
npm run build
npm start
# Or run in development mode with hot reload
npm run dev# Copy environment template
cp .env.example .env
# Edit .env with your credentials
# Build and run
docker compose up --buildAll configuration is done via environment variables. Copy .env.example to .env and fill in:
| Variable | Description | Where to get it |
|---|---|---|
LINEAR_API_KEY |
Linear API key | Linear Settings > API |
GITHUB_TOKEN |
GitHub Personal Access Token with repo scope |
GitHub Settings > Tokens |
ANTHROPIC_API_KEY |
Anthropic API key | Anthropic Console |
| Variable | Default | Description |
|---|---|---|
LINEAR_WEBHOOK_SECRET |
- | Webhook signature secret (recommended for production) |
GITHUB_DEFAULT_REPO |
- | Default repository if not specified in issue |
CLAUDE_MODEL |
claude-sonnet-4-20250514 |
Claude model to use |
CLAUDE_MAX_TURNS |
200 |
Maximum API calls per task |
PORT |
3000 |
Server port |
LOG_LEVEL |
info |
Logging level (error, warn, info, debug) |
- Go to Linear Settings > API > Webhooks
- Click "New Webhook"
- Configure:
- URL:
https://your-server.com/webhook/linear - Events: Select "Comments" (create)
- Secret: Generate a random secret and add it to your
.envasLINEAR_WEBHOOK_SECRET
- URL:
- Save the webhook
Once deployed and connected, mention @Claude in any Linear issue comment:
@Claude Please implement a function that validates email addresses
and add unit tests for it.
Claude will:
- Acknowledge the request with a comment
- Clone the repository
- Implement the changes
- Create a PR
- Comment back with the PR link
The webhook determines which repository to use in this order:
- GitHub URL in issue description: If the issue contains
https://github.com/owner/repo, that repo is used - Label: Add a label
repo:owner/nameto the issue - Default: Falls back to
GITHUB_DEFAULT_REPOenvironment variable
# Install Fly CLI
curl -L https://fly.io/install.sh | sh
# Login
fly auth login
# Launch the app
fly launch --no-deploy
# Set secrets
fly secrets set LINEAR_API_KEY=your_key
fly secrets set LINEAR_WEBHOOK_SECRET=your_secret
fly secrets set GITHUB_TOKEN=your_token
fly secrets set ANTHROPIC_API_KEY=your_key
# Deploy
fly deployYour webhook URL will be: https://your-app.fly.dev/webhook/linear
# Install Modal
pip install modal
# Create secrets
modal secret create linear-claude-webhook-secrets \
LINEAR_API_KEY=your_key \
LINEAR_WEBHOOK_SECRET=your_secret \
GITHUB_TOKEN=your_token \
ANTHROPIC_API_KEY=your_key
# Deploy
modal deploy modal_app.py# Build the image
docker build -t linear-claude-webhook .
# Run with environment variables
docker run -d \
--name linear-claude-webhook \
-p 3000:3000 \
--env-file .env \
linear-claude-webhook┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ │ │ │ │ │
│ Linear │────▶│ Webhook Server │────▶│ Claude Code │
│ │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
│ │ │
▼ ▼ ▼
Comment with Fetches issue Implements
@Claude mention context, clones changes, creates
repository PR on GitHub
src/index.ts: Express server with health check and webhook endpointsrc/linear/webhook-handler.ts: Validates webhooks, detects @Claude mentionssrc/linear/api-client.ts: Fetches issue context from Linear APIsrc/claude/executor.ts: Runs Claude Code CLI to implement tasks
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/webhook/linear |
POST | Linear webhook receiver |
# Run in development mode
npm run dev
# Type checking
npm run typecheck
# Linting
npm run lint
# Build for production
npm run build- Check the webhook is active in Linear Settings
- Verify the URL is publicly accessible
- Check server logs for incoming requests
- Verify
ANTHROPIC_API_KEYis valid - Check
CLAUDE_MAX_TURNSis sufficient - Review server logs for error messages
- Ensure the repository is accessible with your
GITHUB_TOKEN - Add a GitHub URL to the issue description
- Set
GITHUB_DEFAULT_REPOin your environment
MIT