Skip to content

AI Agent "Closure"

Closure began as a GitHub App that reviewed pull requests.

It would run when a pull request was opened or when someone left a /closure comment. You could also add review guidelines to .github/closure-review-rules.md, and Closure would use them when reviewing the pull request.

A code review posted on a GitHub pull request by Closure

The system ran on a dedicated server. A service written in Go received webhooks from GitHub and asked Closure to perform the review.

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub
    participant SV as Go Server
    participant CL as Closure

    Dev->>GH: Open PR / Mark ready for review
    GH->>SV: Webhook POST (pull_request)
    SV->>SV: Verify signature
    SV->>GH: Authenticate with JWT → Get installation token
    SV->>GH: Fetch PR diff
    SV->>GH: Fetch .github/closure-review-rules.md
    SV->>CL: Request review
    CL-->>SV: Return review results
    SV->>GH: Post PR review (closure-review[bot])

I liked the quality of its reviews, but soon found myself wishing it could make the fixes as well. That led me to start expanding it.

My first idea was to let users leave comments such as “Fix this” on a pull request and have Closure respond. The workflow became increasingly complicated, however, and the implementation overhead kept growing.

I was also frustrated that Closure could not review code until a pull request existed. Eventually, I decided it would make more sense to build the agent itself.

I initially considered a desktop chat application. Because GUI development differs considerably across operating systems, I chose to build Closure as a CLI instead.

I started the implementation in Rust with future Windows support in mind.

One thing I cared about was creating a rich terminal interface similar to Claude Code or Codex. In practice, that was much harder than I expected.

Small mistakes in calculating cursor positions or visible line counts caused the cursor to appear in the wrong place and scrolling to behave incorrectly.

Even so, the MVP already felt useful. As I used it in my daily work, I kept tailoring it to my workflow and gradually added more features.

Closure significantly reduced the time I had been spending on review and verification—the main bottlenecks in my development process.

Chat interface for interacting with the AI agent in Closure CLI

The original pull request review workflow is also available as a command.

Closure CLI showing the command that performs the original GitHub App review

Closure CLI now provides both a chat interface for working with an AI agent and a review feature that can inspect code before a pull request is created.

By moving the review workflow from a GitHub App to a local CLI, I can now complete the implementation, review, and revision cycle before opening a pull request.

I plan to keep using Closure in real development work and improve its capabilities and usability a little at a time.