Skip to content

Omkar1279/kernelizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kernelizer

Get more accurate answers and use up to 40% fewer tokens — works with Claude Code and Gemini CLI.

License: MIT Built with Rust Claude Code Plugin

Kernelizer intercepts your prompt before it reaches the model and compiles it into a structured KERNEL template — a strict Task / Constraints / Format / Verify layout that eliminates ambiguity.

Research confirms the payoff: structured prompts improve code generation accuracy by up to 20 percentage points (arXiv:2411.10541) and reduce total token consumption by up to 40% by cutting the clarification rounds that vague prompts force. Fewer tokens. Right answer first time.

No API keys. No new accounts. Uses your existing Claude Code session.


Install

cargo install --git https://github.com/Omkar1279/kernelizer kernelizer-rs

Requires ~/.cargo/bin in PATH.


Claude Code

claude plugin add https://github.com/Omkar1279/kernelizer
Command When to use
/kernelize <prompt> Best accuracy — scans codebase patterns, translates via LLM
/kernelize-fast <prompt> Maximum speed — deterministic template, ~50ms, best with @file
/kernelize fix the auth bug in @src/auth.rs
/kernelize-fast add rate limiting to @accounts/views.py

Why Structured Prompts Win

Vague prompts force the model to guess scope, infer constraints, and hedge outputs — which costs tokens and produces generic answers that need correction. Every correction round costs more tokens and time. Kernelizer front-loads the structure so the model gets it right the first time.

Before — vague prompt:

fix the auth bug in @src/auth.rs

After — compiled KERNEL:

# Task
Identify and fix the authentication bug in `auth.rs` causing session tokens
to expire prematurely on concurrent requests.

# Constraints
- Preserve existing session token structure; no schema changes
- Limit scope to auth.rs unless a fix is impossible without touching deps
- Must not break existing test cases in tests/auth_test.rs

# Format
Return only the corrected function(s) with a one-line comment per change.

# Verify
Auth flow passes existing test suite; no regressions in session handling
under concurrent load (simulate with two simultaneous requests).

The model sees an unambiguous specification instead of a request. No follow-up questions. No scope creep. No hedging.

Vague prompt KERNEL prompt
Accuracy on code tasks baseline +20 percentage points ¹
Hallucination rate baseline −25% ²
Token usage (total session) baseline up to −40% ³
Correction rounds needed 3–5 avg 1

¹ arXiv:2411.10541 — prompt format comparison across GPT-3.5 and GPT-4, code generation benchmark. ² DSPy structured prompt optimization, arXiv:2604.04869. ³ CompactPrompt structured prompting research, arXiv:2510.18043.


How It Works

raw prompt + @file tags
        │
        ├─ resolve @file / @dir content             (~1ms, local)
        │
        ├─ tree-sitter repo map ──┐
        ├─ translate via Haiku   ─┘  parallel  (~2–4s)
        │
        └─ compile KERNEL markdown  ──▶  stdout  ──▶  model

Tree-sitter repo map — parses every source file with a real AST parser (Python, Rust, TypeScript, JavaScript, Go) and extracts all function/class/struct signatures. The translation model sees the full project structure so constraints reference real function names and file paths — not generic rules.

Explicit vs advisory patterns — if your prompt says "like we do" or "our pattern", the KERNEL enforces strict project-style adherence. Otherwise the model is free to improve on existing patterns.

Graceful degradation — if claude CLI is unavailable, falls back to a deterministic offline template instantly.


Bash / Universal

# Works with any model tool that reads stdin
aider --message "$(kernelizer-rs optimize 'fix the auth flow')"
kernelizer-rs optimize --fast "@src/api.rs add pagination"

About

Get better answers from your AI, using fewer tokens — Kernelizer compiles vague prompts into structured KERNEL templates before they reach your model. Claude Code plugin + Gemini CLI extension.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages