Cairn is an open-source background-agent system for coding. To set it up, you must install both the Python backend and the Node.js frontend dependencies, and configure GitHub App credentials for repository access.
1. Clone and Install Dependencies
Backend (Python):
git clone git@github.com:cairn-dev/cairn.git
cd cairn
python -m venv cairn-env
source cairn-env/bin/activate # On Windows: cairn-env\Scripts\activate
pip install -r requirements.txt
Frontend (Node.js):
Requires Node.js version 16 or higher.
cd frontend
npm install
cd ..
2. Configure GitHub Access
You must create a self-hosted GitHub App to allow Cairn to read/write to your repositories.
App Configuration Requirements:
- Permissions:
- Contents: Read & write
- Pull requests: Read & write
- Metadata: Read
- Webhooks: Disable the "Active" checkbox.
- Installation: Select "Only on this account".
3. Environment and Repository Configuration
Copy the example environment file and populate it with your credentials:
cp .env.example .env
Required/Optional keys in .env:
GITHUB_APP_ID: Your GitHub App ID.GITHUB_PRIVATE_KEY_PATH: Path to your downloaded .pem file.GITHUB_TOKEN: (Optional) GitHub Personal Access Token for repository analytics.ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY: (Optional) LLM API keys.
Create a repos.json file in the project root to map owners to their installation IDs and connected repositories:
{
"your-github-username-or-org": {
"connected_repos": ["your-repo-name", "another-repo"],
"installation_id": 12345678
}
}
git clone git@github.com:cairn-dev/cairn.git
cd cairn
python -m venv cairn-env
source cairn-env/bin/activate
pip install -r requirements.txt
cd frontend
npm install
cd ..