legendai
v0.1.5
Published
Autonomous agent pipeline — type `legend` in any repo
Maintainers
Readme
Legend
Autonomous agent pipeline — type
legendin any repo.
Legend watches a Slack channel for Linear issue links, then runs a 6-stage AI agent pipeline to analyze, plan, implement, review, and ship code — fully autonomously.
How It Works
Slack message with Linear issue URL
↓
┌─────────┐
│ Analyze │ Read-only codebase scan
└────┬─────┘
↓
┌─────────┐
│ Plan │ Write implementation plan
└────┬─────┘
↓
┌──────────────┐
│ Review Plan │ Approve or revise (loops)
└────┬──────────┘
↓
┌─────────┐
│ Develop │ Implement in worktree, push PR
└────┬─────┘
↓
┌──────────────┐
│ Code Review │ Test + lint + review (loops)
└────┬──────────┘
↓
┌───────────┐
│ Close Out │ Reply in Slack, comment on Linear
└────────────┘Prerequisites
Legend requires the following tools installed and authenticated on your system:
| Tool | Install | Purpose |
|------|---------|---------|
| Node.js ≥ 18 | nodejs.org | Runtime |
| Claude Code CLI | npm install -g @anthropic-ai/claude-code | AI agent engine |
| GitHub CLI (gh) | cli.github.com | PR creation & reviews |
| Git | Comes with most systems | Version control |
You also need:
- A Slack workspace with a bot token (Socket Mode)
- A Linear API key
- A Gemini API key (for plan review)
Installation
npm install -g legend-cliOr try it without installing:
npx legend-cliQuick Start
1. Set up in your project
cd your-project
legend setupThe interactive wizard will walk you through connecting Slack, Linear, GitHub, and configuring your repos.
2. Start watching
legendLegend will watch your configured Slack channel. When someone posts a Linear issue link, the pipeline starts automatically.
3. That's it
Legend will:
- Analyze the codebase to understand context
- Write an implementation plan
- Self-review the plan (with configurable review cycles)
- Implement the changes in a separate git worktree
- Create a pull request
- Run tests, lint, and build — fixing issues automatically
- Submit a GitHub PR review
- Reply in Slack and comment on the Linear issue
Commands
| Command | Description |
|---------|-------------|
| legend | Start the pipeline (watches Slack) |
| legend setup | Run the interactive setup wizard |
| legend status | Show current pipeline status |
| legend runs | List past pipeline runs |
| legend config | Display current configuration |
| legend reset | Clear config and re-setup |
Flags
| Flag | Description |
|------|-------------|
| --verbose | Show full Claude Code turn-by-turn output |
| --quiet | Suppress all logs except errors and the dashboard |
Configuration
Config is stored in .legend/config.json (gitignored) in your project root. It includes:
- Workspace — project name
- Repos — one or more repos with base branch, test/build/lint commands
- Linear — API key, team ID
- Slack — bot token, app token, channel
- GitHub — authenticated user
- Gemini — API key for plan review
- Claude — model selection
- Pipeline — max review cycles, concurrency
Multi-Repo Support
Legend supports mono-repos and multi-repo workspaces. During setup, it auto-discovers git repos in your working directory and lets you configure each one independently.
Architecture
bin/legend.ts — CLI entry point (Commander)
src/cli/ — Setup wizard, dashboard, sub-commands
src/config/ — Config schema and store
src/agents/runner.ts — Claude Code subprocess invocation
src/agents/prompts/*.md — Per-stage prompt templates
src/pipeline/ — Orchestrator state machine, worktree, queue
src/integrations/ — Slack, Linear, GitHub API clients
src/utils/ — Logger, pre-flight checks, themePipeline Artifacts
Each run persists artifacts to .legend/runs/<ISSUE-ID>/:
analysis.md— codebase analysisplan.md— implementation planreview.md— plan review feedbackcode-review.md— code review feedback
Development
git clone https://github.com/akashmunshi/legend-cli.git
cd legend-cli
npm install
npm run dev # Run with tsx (no compile step)
npm run build # Compile to dist/
npm link # Make `legend` available globally for testingLicense
MIT — see LICENSE.
Built by Akash Munshi
