caveman

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package caveman injects token-compression rules into the system prompt.

Caveman is prompt-injection, not code. The four levels (off/lite/full/ultra) produce progressively terser model output. Rules text is embedded at build time from rules/*.md so the binary stays self-contained.

Compression rules adapted from JuliusBrussee/caveman (https://github.com/JuliusBrussee/caveman).

Index

Constants

View Source
const Default = Full

Default is the level used when none specified.

Variables

This section is empty.

Functions

func Inject

func Inject(systemPrompt string, level Level) string

Inject prepends the level's rules to systemPrompt. Returns systemPrompt unchanged when level is Off or rules empty. Each call prepends — caller decides idempotency.

func Rules

func Rules(level Level) string

Rules returns the rules markdown for the given level. Off returns "". Unknown levels return "" as well — callers should validate with ParseLevel first.

Types

type Level

type Level string

Level selects the compression intensity.

const (
	Off   Level = "off"
	Lite  Level = "lite"
	Full  Level = "full"
	Ultra Level = "ultra"
)

func ParseLevel

func ParseLevel(s string) (Level, error)

ParseLevel validates user input. Empty string → Default.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL