Linear Copilot π€
An intelligent issue analysis system that automatically processes Linear issues using specialized AI agents. Built with Upstash Workflow and Cloudflare Workers, it provides deep insights, technical analysis, and smart prioritization for your Linear issues.
β¨ Features
π€ Multi-Agent System - Specialized agents for different types of analysis:
- Manager Agent - Orchestrates task distribution and workflow coordination
- Bug Agent - Deep analysis of bug reports with automatic research
- Feature Agent - Market research and technical feasibility analysis
- Improvement Agent - Technical debt and performance optimization analysis
π Intelligent Analysis Tools
- Code Quality Analysis - Evaluates code patterns and suggests improvements
- Performance Analysis - Analyzes metrics and provides optimization recommendations
- Dependency Analysis - Checks for updates, security issues, and breaking changes
- Security Analysis - Identifies potential vulnerabilities and security implications
- Market Research - Evaluates similar products and features (via ProductHunt)
- Technical Feasibility - Assesses implementation approaches and challenges
π― Smart Prioritization
- Context-aware priority assessment
- Impact and effort-based scoring
- Automatic priority updates with detailed explanations
π Integrated Research
- Stack Overflow integration for technical solutions
- GitHub Issues search for similar problems
- DuckDuckGo search for broad context gathering
- Competitor analysis for feature research
π Getting Started
Prerequisites
- Node.js (v18 or higher)
- Wrangler (Cloudflare Workers CLI)
- Linear account with API access
- Upstash account with Workflow access
Installation
Clone the repository:
git clone https://github.com/yourusername/linear-copilot.git cd linear-copilot
Install dependencies:
npm install
Create a development environment file:
cp wrangler.example.toml wrangler.toml
Configure your development environment in
.dev.vars
:# Linear API KeysMANAGER_API_KEY=your_manager_api_keyBUG_API_KEY=your_bug_api_keyFEATURE_API_KEY=your_feature_api_keyIMPROVEMENT_API_KEY=your_improvement_api_key# Linear Webhook ConfigurationLINEAR_WEBHOOK_SECRET=your_webhook_secret# Upstash ConfigurationUPSTASH_REDIS_URL=your_redis_urlUPSTASH_REDIS_TOKEN=your_redis_token# Agent ConfigurationQSTASH_TOKEN=your_qstash_tokenOPENAI_API_KEY=your_openai_api_key
Development
Start the development server:
npm run dev
For local webhook testing, use a tool like ngrok:
ngrok http 8787
Deployment
Login to Cloudflare:
npx wrangler login
Configure your production secrets:
npx wrangler secret put MANAGER_API_KEY npx wrangler secret put BUG_API_KEY npx wrangler secret put FEATURE_API_KEY npx wrangler secret put IMPROVEMENT_API_KEY npx wrangler secret put LINEAR_WEBHOOK_SECRET npx wrangler secret put UPSTASH_REDIS_URL npx wrangler secret put UPSTASH_REDIS_TOKEN
Deploy to Cloudflare Workers:
npm run deploy
Your webhook endpoint will be available at:
https://<your-worker>.<your-subdomain>.workers.dev/
Linear Webhook Setup
- Go to your Linear workspace settings
- Navigate to "Webhooks" and click "New Webhook"
- Enter your Cloudflare Worker URL
- Select the following events:
- Issue: Created
- Issue: Updated (for label changes)
- Save the webhook and copy the secret
- Update your
LINEAR_WEBHOOK_SECRET
environment variable
π§ Architecture
Agent System
The system uses a multi-agent architecture where each agent is specialized in analyzing different aspects of issues:
- Manager Agent: Routes issues to appropriate specialized agents and coordinates workflow
- Bug Agent: Analyzes bug reports, searches for similar issues, and provides solution recommendations
- Feature Agent: Evaluates feature requests, performs market research, and assesses technical feasibility
- Improvement Agent: Analyzes technical improvements, performance metrics, and provides optimization recommendations
Analysis Tools
Each agent has access to specialized tools based on their focus:
Bug Agent Tools
- Error Analysis - Searches for similar issues and solutions
- Stack Overflow Integration - Finds technical solutions and workarounds
- GitHub Issues Search - Identifies similar bug reports and fixes
- Code Quality Analysis - Examines potential code-related causes
Feature Agent Tools
- Market Research - Evaluates similar products via ProductHunt
- Competitor Analysis - Researches competitor implementations
- Technical Feasibility - Assesses implementation approaches
- Requirements Analysis - Evaluates feature scope and impact
Improvement Agent Tools
- Performance Analysis - Evaluates metrics and suggests optimizations
- Code Quality Assessment - Analyzes maintainability and patterns
- Dependency Analysis - Checks for updates and security issues
- Technical Debt Evaluation - Assesses improvement impact
Technology Stack
- Upstash Workflow - Serverless task orchestration
- Cloudflare Workers - Edge computing platform
- Linear SDK - Issue tracking integration
- TypeScript - Type-safe development
π Usage
The system automatically processes issues when:
- A new issue is created in Linear
- An issue's labels are updated
The appropriate agent will:
- Analyze the issue based on its type (bug, feature, improvement)
- Perform relevant analysis using specialized tools
- Add detailed comments with findings and recommendations
- Update issue priority based on comprehensive analysis
- Suggest next steps or additional requirements
Example Workflow
Bug Report Analysis:
- Bug Agent searches for similar issues on Stack Overflow and GitHub
- Analyzes error patterns and potential solutions
- Provides code quality recommendations if applicable
- Sets priority based on impact and urgency
- Adds detailed comments with findings and next steps
Feature Request Analysis:
- Feature Agent researches similar products on ProductHunt
- Analyzes competitor implementations
- Assesses technical feasibility and challenges
- Sets priority based on business value and implementation effort
- Provides detailed market and technical recommendations
Improvement Analysis:
- Improvement Agent analyzes performance metrics and thresholds
- Evaluates code quality patterns and technical debt
- Checks dependencies for updates and security issues
- Sets priority based on technical impact and implementation risk
- Provides optimization recommendations with context-aware priorities
Each analysis includes:
- Detailed findings from specialized tools
- Context-aware recommendations
- Automatic priority updates with explanations
- Integration with external knowledge bases
- Clear next steps and requirements
π Security
- Secure storage of API keys using Cloudflare Workers' environment variables
- Linear webhook signature validation
- IP allowlist validation
- Rate limiting implementation
- Sanitized error outputs
π¨ Error Handling
The system implements robust error handling:
- Webhook request validation
- Tool execution error handling
- Detailed error reporting
- Graceful failure recovery