AI powered specification verification

Use AI to verify that your code matches your specification. Define semantic rules and let Semcheck handle the comparison.

Why Semcheck?

Semcheck is a tool that helps developers who use specification driven developement to keep their code and their specification in sync. Use semcheck in pre-commit hooks and CI/CD pipelines as a last line of defense against implementation drift.

Example: HTTP Status Codes

RFC 9110: 15.3.1. 200 OK
The 200 (OK) status code indicates that
the request has succeeded. The content
sent in a 200 response depends on the
request method.
function handleGetUser(r: Request): Response {
  const user = getUser(r.userId);

  if (user) {
    return new Response(user, { status: 201 });
  }
  return new Response(null, { status: 404 });
}

Semcheck: GET request returns 201 (Created) instead of 200 (OK) as specified in RFC 9110

Read on our blog how Semcheck was built and our take on spec-driven development with LLMs.

Read the blog post ->

Non-intrusive

No changes required to existing code or specification files

Multiple AI Providers

OpenAI, Anthropic, Gemini, Cerebras, and local models via Ollama

Remote Specs

Support for remote specification files like RFC documents

Quickstart

Install

go install github.com/rejot-dev/semcheck@latest

Initialize

semcheck -init

Link Specs to Implementation

Semcheck supports two ways to link specifications to implementation files. Both can be used together.

1. Inline spec references

Link specifications directly in your code using special comment syntax:

# semcheck:rfc(8259)
class JsonParser:
    def parse(self, data: bytes):
        # ... implementation

Available commands:

semcheck:file(./local/spec.md)  # Link repo local files
semcheck:url(https://example.com/docs/api)  # Link to remote documents
semcheck:rfc(8259)  # Shorthand for linking to RFC documents on datatracker.ietf.org

# Target specific sections using fragments:
semcheck:url(https://www.rfc-editor.org/rfc/rfc7946.html#section-3.1.1)  # HTML sections
semcheck:file(./docs/api-spec.md#authentication)  # In Markdown refer to heading text directly
semcheck:rfc(8259#section-8.3)  # Shorthand for https://datatracker.ietf.org/doc/html/rfc8259#section-8.3

2. Rules

Define rules in your semcheck.yaml configuration that tie specification files to implementation files:

version: "1.0"
provider: "anthropic"
model: "claude-sonnet-4-0"
api_key: "${ANTHROPIC_API_KEY}"

rules:
  - name: api-compliance
    files:
      include: ["src/**/*.go"]
      exclude: ["*_test.go"]
    specs:
      - path: "docs/api-spec.md"

Run

# Check all rules
semcheck

# Check specific files
semcheck src/auth.go

# Run semcheck on staged files
semcheck -pre-commit