packagemain.tech

packagemain.tech

Agentic pre-commit hook with Opencode Go SDK

Alex Pliutau's avatar
Alex Pliutau
Mar 22, 2026
∙ Paid

I’ve been an avid user of Opencode for a long time, even before it became widely popular. It’s not the only coding agent in my toolkit (I also reach for Amp from time to time), but Opencode holds a special place because of its LSP integration and the dead-simple ability to swap models on the fly.

It’s also remarkably extensible. You can write plugins in TypeScript, apply custom themes, build tools and web apps around it, and even extend it with Skills. The community around it is growing fast — check out awesome-opencode or opencode.cafe if you want to explore what people are building.

What I recently discovered, though, is that Opencode has a Go SDK (not to be confused with Opencode Go), and that’s what inspired this whole project. Let’s see what we can build with it.

The Problem: Catching dumb mistakes before commit

I’m the type of developer who absolutely hates typos in code and stray debug print statements — and also the type who produces them constantly. Regular formatters and linters don’t always catch these things, and let’s be honest: other code reviewers aren’t exactly trustworthy either. Nobody really reads the code anymore.

There are tools like CodeRabbit, GitHub Copilot, and Graphite that can review your pull requests after the fact. But what if I want to run similar checks before committing my code? And what if I want those checks to be configurable?

The idea: run an AI-powered code review as a pre-commit hook, using a coding agent that’s already aware of the codebase.

Since I use Opencode daily, let’s build it with that.

User's avatar

Continue reading this post for free, courtesy of Alex Pliutau.

Or purchase a paid subscription.
© 2026 Aliaksandr Pliutau · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture