The project is currently under heavy development, so expect a lot of changes and breaking changes. v2.0.0 is coming soon with a managed private alpha. If you want to be notified when we release, please fill this survey here.
Create environment file and update it with the required secret variables.
# Setup environment files
cp .env.local .envEnsure you have the following tools installed and configured:
- bun - Package manager
- Install via curl:
curl -fsSL https://bun.com/install | bash - Install specific version (check
.bun-versionfile):curl -fsSL https://bun.com/install | bash -s "bun-v1.3.1" - For other installation methods see Bun installation
- Install via curl:
- Docker Desktop or OrbStack - Required for running PostgreSQL and Nextjs locally
- Docker Desktop - Traditional Docker solution
- OrbStack - Lightweight, faster alternative for macOS (Recommended)
- just - Command runner for project tasks
- Install via Homebrew:
brew install just - Or see alternative installation methods
- Install via Homebrew:
- nvm (Node Version Manager) - Optional, only needed if running linting/tests locally
- Install from github.com/nvm-sh/nvm
- The project includes a
.nvmrcfile to automatically use Node.js 22.20.0
- GitHub OAuth App - For user authentication and accessing user repositories (import functionality)
- Go to GitHub Developer Settings
- Click OAuth Apps β New OAuth App
- Fill in the application details:
- Application name:
Kosuke Core Local(or your preferred name) - Homepage URL:
http://localhost:3000 - Authorization callback URL:
https://YOUR_CLERK_DOMAIN/v1/oauth_callback(you'll get this from Clerk in the next step)
- Application name:
- Click Register application
- Copy the Client ID (you'll need this for Clerk setup)
- Click Generate a new client secret and copy it immediately (you'll need this for Clerk setup)
- Keep this tab open - you'll configure the callback URL after setting up Clerk
- GitHub App - For Kosuke organization operations (creating repos, pull/push etc.)
- Go to your organization settings:
https://github.com/organizations/YOUR-ORG/settings/apps - Click New GitHub App
- Configure the app with required permissions:
- Repository permissions: Contents (Read & Write), Administration (Read & Write), Pull requests (Read & Write)
- Organization permissions: Members (Read-only)
- Generate a private key (download the
.pemfile) - Install the app on your organization
- Get your credentials and add to
.env:GITHUB_APP_ID- Found on your app's settings pageGITHUB_APP_PRIVATE_KEY- The private key content (format with\nfor newlines)GITHUB_APP_INSTALLATION_ID- From the installation URLGITHUB_WEBHOOK_SECRET- Generate withopenssl rand -hex 32
- Go to your organization settings:
- ngrok (optional) - For testing GitHub webhooks locally
- Install ngrok:
brew install ngrokor from ngrok.com - Create a free static domain at dashboard.ngrok.com/domains
- Start tunnel:
ngrok http 3000 --domain=your-domain.ngrok-free.app - Update
NEXT_PUBLIC_APP_URLin.envwith your static domain
- Install ngrok:
- Clerk Account - Authentication provider
- Sign up at clerk.com
- Create a new application:
- Click Create Application
- Enter your application name
- Under Sign-in options, select Email, Google and GitHub
- Click Create Application
- Configure GitHub OAuth in Clerk:
- In your Clerk dashboard, go to Configure β SSO Connections
- Click on GitHub
- Toggle Use custom credentials
- Enter your GitHub Client ID (from step 5 of GitHub OAuth App setup)
- Enter your GitHub Client Secret (from step 6 of GitHub OAuth App setup)
- Copy the Authorized redirect URI shown (e.g.,
https://your-app.clerk.accounts.dev/v1/oauth_callback) - Save the settings
- Update GitHub OAuth App callback URL:
- Go back to your GitHub OAuth App settings
- Update the Authorization callback URL with the redirect URI from Clerk
- Click Update application
- Get Clerk API Keys:
- Navigate to API Keys in the Clerk dashboard
- Copy the following keys to your
.envfile:NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY- Found under "Publishable key"CLERK_SECRET_KEY- Found under "Secret keys"
- Enable Organizations in Clerk:
- Go to Configure β Organizations in the Clerk dashboard
- Toggle Enable organizations
- Toggle Allow personal accounts
- Set max organizations per user (recommended: 10)
- Keep default roles:
org:admin(owner) andorg:member(member) - Note: The app is organization-first - all projects belong to an organization (either personal workspace or team workspace)
# Start all services (Postgres + Next.js)
just runThe application will be available at:
- Next.js app: http://localhost:3000
- Postgres: localhost:54323
For pre-commits and IDE linting install the dependencies locally:
just installNote: On first run, you may need to run database migrations. Open a new terminal and run:
# Run database migrations inside the Next.js container
just migrateThe sandbox/ directory contains the infrastructure for preview environments and isolated development sandboxes:
For local development, build the sandbox Docker image:
# Build the local sandbox image
just build-sandboxThis builds kosuke-sandbox-local:latest. The .env.local file is pre-configured to use this image via SANDBOX_IMAGE=kosuke-sandbox-local:latest.
To work with kosuke-cli locally alongside kosuke-core with hot-reload:
# Clone kosuke-cli into the sandbox directory
cd sandbox
git clone https://github.com/Kosuke-Org/cli.git kosuke-cli
cd kosuke-cli && npm install
# Enable hot-reload: watches .ts files β auto-compiles β auto-restarts in preview containers
just watch-agentThe
just watch-agentcommand runsnpm run build:watchwhich watches TypeScript files and auto-compiles todist/. Preview sandbox containers (created dynamically viasrc/lib/sandbox/manager.ts) mountsandbox/kosuke-cli/at/app/kosuke-cliwhenHOST_PROJECT_PATHis set, andnodemoninside the container auto-restarts the agent on changes. Seesandbox/Dockerfile,sandbox/entrypoint.sh, andsandbox/scripts/start-agent.shfor implementation details.
- If it is needed for local development, add it to
.env.local - If it is a
NEXT_PUBLICvariable, add it in.env.prod.public - If it is a server-side variable with a non-secret value, add it in
.env.prod - If it is a server-side variable with a secret value, add it in
.env.prodwith the syntaxVARIABLE=${VARIABLE}, then add the variable in the GitHub kosuke-core repo using the dedicated GitHub workflow: Actions > Add secret > Run workflow
Kosuke is licensed under the MIT License.
For questions or support, you can create an issue in the repo or drop me a message at filippo.pedrazzini (at) kosuke.ai