All work

AI Repo Inspector

A code review tool for humans and AI agents

Role
Take-home engineering assessment
Year
2026
Code
Private repository
Terminal
$ inspector review --repo document-assistant --base-ref HEAD~3 --validate "python -c pass" --stdout

# Review Report: document-assistant

- Base ref: `HEAD~3`
- Changed files: 2 (1 added, 1 modified)
- Validations: 1 run, 0 failed
Real output, reviewing the Document Assistant repo

Overview

The tool lists the files changed against a base ref, optionally runs validation commands, and renders the result as Markdown or JSON. The CLI sets its exit code from the outcome; the MCP server exposes the same review to an AI agent.

The assessment was to investigate and improve an existing implementation. I fixed four issues, worst first, and documented how each was reproduced.

What I built

Architecture

src/cli.ts, src/mcp-server.ts

Two thin adapters over one shared core, so the agent path and the human path cannot drift apart.

Hard parts

Arbitrary file write through a crafted ref

The base ref was interpolated into one argv token, so a ref of --output=/tmp/x reached git diff as its own option and wrote the diff to that path. It was reachable over MCP, where the ref comes from an agent.

An MCP tool that was wrong on every call

The schema declared repo_path while the handler read repoPath. The path was always undefined, so every call silently reviewed the server's own directory and never raised an error. The fix ships with a test that spawns the real server, because the bug is invisible to any test that imports the handler directly.

Stack

Known limits