Skip to content
kacigayaPublic

About

Self-hosted AI code review for GitHub with read-only agents and validated inline findings.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CroCode logo

CroCode

Self-hostable AI code review for GitHub.
Use your Claude Code or Codex subscription. No API key needed.
CroCode runs Claude Code, Codex, or OpenCode in a read-only container, checks every finding against the diff, and posts inline review comments with severity and suggested fixes.

Rust 1.89 or newer Next.js 16 Docker Compose for ARM64 and AMD64 Apache 2.0 License

Use your subscription

CroCode works with the plan you already pay for:

  • Claude Code: Use your Claude subscription. Run claude setup-token and set CLAUDE_CODE_OAUTH_TOKEN.
  • Codex: Use your ChatGPT subscription. Sign in once with codex login --device-auth and set CROCODE_CODEX_AUTH_DIR.

You do not need a per-token API bill. Reviews count against your plan usage limits. API keys also work. See subscription setup.

Note

CroCode is in development. See the releases for available versions.

How it works

flowchart LR
    GH[GitHub webhook] --> API[Rust API]
    API --> DB[(Postgres queue)]
    DB --> Worker[Rust worker]
    Worker --> SAST[Offline OpenGrep scan]
    SAST --> Sandbox[Read-only agent container]
    Sandbox --> Validate[Validate and dedupe]
    Validate --> Review[GitHub review]
    Web[Next.js dashboard] --> API
Loading
  1. The API verifies the webhook signature and queues the pull request.
  2. A worker claims the job and mints a token for that one repository.
  3. The worker reads .crocode.yml from the base commit, not from the pull request.
  4. OpenGrep scans the changed files in an offline sandbox. Its results go to the agent as hints.
  5. The agent reviews the diff in a container with a read-only checkout and no GitHub token.
  6. CroCode drops findings outside the diff, removes duplicates, and redacts secrets.
  7. CroCode posts one COMMENT review. It never approves or blocks a pull request.

A new push cancels the old review. A commit that already has a review is not reviewed again.

Dashboard

Sign in with GitHub. Choose an installation to set its agent and model and to follow its review history. Open a review to read each finding and its suggested fix. Admins can retry failed reviews and cancel queued ones. The overview shows agent health, run time, and token usage. An opt-in weekly security digest posts Dependabot alert changes to a chat webhook. The screenshots use demo data.

CroCode sign-in page Installation settings and review history

Review with findings grouped by severity

Quickstart

You need a Linux host with Docker Compose. The worker starts sandbox containers through the Docker socket, so give CroCode a dedicated host.

git clone https://github.com/kacigaya/crocode.git
cd crocode
cp .env.example .env && chmod 600 .env

To let a coding agent do these steps, open the repository in Claude Code or Codex and ask it to set up CroCode. The crocode-setup skill in .agents/skills/ guides the agent. It asks before sudo commands and never shows secrets.

  1. Set separate database setup and runtime passwords and your agent credentials in .env. Keep each password consistent with its connection URL. For Claude, use a subscription token from claude setup-token or an API key. For Codex, use a ChatGPT subscription login or an API key. Leave the GitHub App values empty. The dashboard creates the app.

  2. Set DOCKER_GID to the output of stat -c '%g' /var/run/docker.sock.

  3. Create the work directory. The host path and the worker path must match.

    sudo install -d -m 0755 -o 10000 -g 10000 /var/lib/crocode/work
  4. Build the sandbox image and start everything.

    sudo docker build -t crocode-sandbox:latest docker/sandbox
    sudo docker compose --profile dashboard up -d --build
  5. Put an HTTPS reverse proxy in front of the stack. Route /webhooks/github to the API on port 8080. Route everything else to the dashboard on port 3000.

  6. Get the setup link from the dashboard logs.

    sudo docker compose logs web | grep setup
  7. Open the link on your public address. Confirm the address and the app name, then click Create the GitHub App. GitHub asks you to confirm. CroCode saves the credentials, and the API and worker start on their own.

  8. Follow the steps on the done page: install the app, upload the logo, and sign in.

To configure the app by hand instead, see GitHub App setup. Environment variables always take precedence over the stored app.

Repository config

Add .crocode.yml to the default branch. Every field is optional.

agent: claude            # claude, codex, or opencode
min_severity: low        # info, low, medium, high, critical
max_comments: 20
review_drafts: false
ignore:
  - "docs/**"
instructions: |
  Focus on authentication and data loss.

See all fields and defaults.

Agents

Agent Read-only mode Credentials
Claude Code --bare --restricted, tools Read,Grep,Glob only Claude subscription token in CLAUDE_CODE_OAUTH_TOKEN, or ANTHROPIC_API_KEY
Codex --sandbox read-only ChatGPT subscription login in CROCODE_CODEX_AUTH_DIR, or CODEX_API_KEY
OpenCode Every permission denied except read, glob, and grep Provider key, for example OPENROUTER_API_KEY

Codex needs bubblewrap namespaces. Docker's default profile blocks them, so the example config enables Claude and OpenCode only. See image builds and checks before you enable Codex.

Documentation

Read the documentation site on GitHub Pages. It needs no sign-in. A local copy is also available at /docs on the dashboard. The source guides are available here:

Development

cargo fmt --all --check
cargo clippy --all-targets -- -D warnings
cargo test --all
DATABASE_URL=postgres://postgres:postgres@127.0.0.1:55432/postgres \
  cargo test --all -- --include-ignored

The dashboard lives in web/ and uses Bun: bun install, bun run lint, bun run typecheck, bun test, and bun run build.

Security

CroCode treats all pull request content as hostile. Agents get read-only tools, credentials stay out of the sandbox, and published text is escaped so it cannot ping users or load images. Sandbox network egress is open by default. Read the security model before you review untrusted code.

License

Apache License 2.0. See LICENSE.

About

Self-hosted AI code review for GitHub with read-only agents and validated inline findings.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages