harness

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package harness names the coding agents culi integrates with (Claude Code, Codex CLI) and owns their identity: the typed enum, its validation, and the session-id encoding shared by the hook, learn, and serve layers.

This package is stdlib-only on purpose — it is imported by the hot path (hook, store), so the C2 dependency firewall applies. Do not add heavy deps.

Index

Constants

View Source
const Default = Claude

Default is assumed when no harness is recorded: legacy job files written before the field existed, and Claude hooks that omit the --harness flag.

Variables

All is the registry of known harnesses. Extend it (plus the typed switches in mine's parser routing and init's installer dispatch) to add a harness.

Functions

This section is empty.

Types

type Harness

type Harness string

Harness identifies the coding-agent front end a session came from. It is a string-backed named type (not an int/iota enum) on purpose: the value is serialized verbatim to JSON job files (queue.Job.Source), embedded in session-id prefixes, and folded into the learn dedup sha256 key. Keeping the underlying type a string means the wire form stays exactly "claude"/"codex" with zero custom (un)marshaling, so on-disk and hash compatibility hold.

const (
	Claude Harness = "claude"
	Codex  Harness = "codex"
)

func Parse

func Parse(s string) (Harness, bool)

Parse converts an untrusted string to a Harness, reporting whether it names a known harness. Unknown input yields ("", false) — callers decide whether to fall back to Default or reject.

func SplitSession

func SplitSession(prefixed string) (Harness, string)

SplitSession is the inverse of PrefixSession: it recovers the harness and raw id from a namespaced session id. A missing or unrecognized prefix yields (Default, prefixed) — the whole string is preserved untouched.

func (Harness) Label

func (h Harness) Label() string

Label returns a human-facing name for the review console.

func (Harness) PrefixSession

func (h Harness) PrefixSession(id string) string

PrefixSession namespaces a raw session id with the harness ("codex:<uuid>"), so two harnesses' ids never collide in the dedup/session tables. An empty id stays empty (the hook only prefixes non-empty ids).

func (Harness) String

func (h Harness) String() string

String returns the wire form ("claude"/"codex").

func (Harness) Valid

func (h Harness) Valid() bool

Valid reports whether h is a known harness.

Jump to

Keyboard shortcuts

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