Skip to main content

Sensei

AI-powered code review CLI for GitLab Merge Requests. Sensei learns your review style from past comments and applies it consistently to new MRs using Claude as the review engine.

What it does

  1. Learns your style — Scrapes your past GitLab review comments, analyzes tone/priorities/patterns, and builds a reusable style profile.
  2. Reviews MRs — Fetches diffs, reads full file context, and generates review comments that match your voice.
  3. Posts intelligently — Must-fix issues go inline on the exact line. Nits get grouped into one summary comment. Test coverage gaps get a single consolidated table.

Prerequisites

  • Python 3.9+
  • Claude Code CLI installed and authenticated
  • A GitLab personal access token with api scope

Install

From PyPI:

pip install sensei-review

Or from source:

git clone https://github.com/pulkit004/sensei.git && cd sensei
python -m venv .venv && source .venv/bin/activate
pip install -e .

Setup

# Initialize with your GitLab credentials
sensei init --pat <your-gitlab-pat>

# Learn your review style (scrapes last 365 days of comments)
sensei learn

Config is stored at ~/.sensei/ with restricted permissions (0600).

Usage

# Review a single MR
sensei review https://gitlab.com/org/project/-/merge_requests/123

# Dry run (preview without posting)
sensei review https://gitlab.com/org/project/-/merge_requests/123 --dry-run

# Review multiple MRs in parallel
sensei review-batch --file mrs.txt

# Or pass URLs directly
sensei review-batch \
  https://gitlab.com/org/project/-/merge_requests/123 \
  https://gitlab.com/org/project/-/merge_requests/456

# Control concurrency (default 3, max 10)
sensei review-batch --file mrs.txt --concurrency 5

# Dry run batch
sensei review-batch --file mrs.txt --dry-run

The --file option reads MR URLs from a text file (one per line, # comments and blank lines ignored).

After review, you're prompted to approve (post to GitLab), edit (save to file for manual editing), or discard. In batch mode, results are shown sequentially after all reviews complete.

Comment types

Type Confidence How it's posted
Must-fix >= 90% Inline on the exact diff line
Nit 80-89% Grouped into one summary comment
Test gap any Consolidated into a single test coverage table

Comments below 80% confidence are dropped.

Project rules

Sensei loads rules from multiple sources (in order):

  1. ~/.sensei/rules/{org_project}.md — Per-project rules you write
  2. CLAUDE.md — From the repo being reviewed
  3. .claude/rules.md — From the repo
  4. CODING_PRINCIPLES.md — From the repo

How the review works

Each file is reviewed in two phases:

  1. Code review — Bugs, type safety, naming, architecture, security
  2. Silent failure hunting — Only runs if the diff has error handling patterns (try/catch, optional chaining, etc.)

Files are reviewed in parallel (up to 8 concurrent workers, configurable batch size).

Development

source .venv/bin/activate
pip install -e ".[dev]"
pytest tests/ -v          # Run tests
pytest tests/ -v -x       # Stop on first failure

Project structure

src/sensei/
  cli.py            # Click CLI commands
  config.py         # ~/.sensei config management
  gitlab_client.py  # GitLab API (diffs, file content, posting comments)
  reviewer.py       # Review prompts, parsing, consolidation
  learner.py        # Style profile learning from past comments
  formatter.py      # Comment formatting for terminal and GitLab
tests/              # Unit and integration tests

License

MIT — see LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sensei_review-0.2.0.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sensei_review-0.2.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file sensei_review-0.2.0.tar.gz.

File metadata

  • Download URL: sensei_review-0.2.0.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for sensei_review-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4cd5338b623255123d98c8af6514f52a56c654fbf3d57d23f0ec2a27a2d215c6
MD5 6eabbe2715f06de4484c60ef12c8b3ff
BLAKE2b-256 39badbb62d89233d92709b67f06dbaf92f9b5eb24f0f2607203474c95f2bc6c1

See more details on using hashes here.

File details

Details for the file sensei_review-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sensei_review-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for sensei_review-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcb6df1d6b28cfeeb16cd5866d86f8c22bb4abf5dfbf626a258247a478e97c13
MD5 07143207c1c3f0220ae90dab486d55f8
BLAKE2b-256 e239934919c39e7bf1db0f5b3bb2bc97d4284ed968ba11622bf80953fb6dac90

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page