outputstyle

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package outputstyle implements output styles: thin, stackable prompt overlays that change how the active persona *talks* without redefining who it is. A style is either a built-in (ported from ref/src/constants/outputStyles.ts) or a Markdown file whose frontmatter names it and whose body becomes the style prompt.

Styles compose with personas rather than replacing them: any style stacks on any main-tier persona. The sysprompt package renders the resolved style; this package owns the catalog (built-ins + disk, layered) and the resolve rules. See docs/roadmap/PRD/output-styles.md.

Index

Constants

View Source
const (
	SourceBuiltIn = "built-in"
	SourceUser    = "user"
	SourceProject = "project"
)
View Source
const DefaultName = "default"

DefaultName is the reserved no-overlay style name. A disk style may deliberately shadow it (same as ref) — that pins a custom voice as the session default for a machine (user tier) or a repo (project tier).

View Source
const DirName = "output-styles"

DirName is the flat directory both tiers load styles from: <appHome>/output-styles/*.md (user) and <workdir>/.evva/output-styles/*.md (project). Same two-root layout as skills, but one flat dir — a style is a single file, not a bundle.

Variables

This section is empty.

Functions

func BuiltIns

func BuiltIns() map[string]Style

BuiltIns returns the three shipped styles keyed by name: default (no overlay), Explanatory, and Learning. A fresh map each call — callers layer disk styles on top without mutating shared state.

func LoadAll

func LoadAll(appHome, workdir string) (map[string]Style, []string)

LoadAll returns the merged style catalog: built-ins, overlaid by the user tier, overlaid by the project tier (project wins on a name clash, mirroring pkg/skill's AppHome-then-WorkDir precedence and ref's built-in < user < project order). Non-fatal problems — an unreadable dir entry, a style file with an empty body — are skipped and reported as warnings; a broken style file must never break a session.

Types

type Style

type Style struct {
	Name        string
	Description string
	Prompt      string // "" only for the default style
	// KeepCodingInstructions keeps the main prompt's "Doing tasks" coding
	// doctrine alongside the style prompt. Mirrors ref's exact check
	// (keepCodingInstructions === true): a disk style that omits the
	// frontmatter key REPLACES the coding doctrine; built-ins set it true.
	KeepCodingInstructions bool
	Source                 string // "built-in" | "user" | "project"
}

Style is one resolved output style. A zero Prompt means "no overlay" — the default style, which must leave the system prompt byte-identical to a style-less build.

func Resolve

func Resolve(all map[string]Style, name string) (Style, string)

Resolve returns the style for name from the merged catalog. Empty name means default. An unknown name falls back to the default style and the second return carries a human-readable warning ("" when clean) — the session must boot even when the configured style file was deleted.

func Sorted

func Sorted(all map[string]Style) []Style

Sorted flattens the catalog for pickers: default first, then the remaining built-ins, then disk styles, alphabetical within each group.

Jump to

Keyboard shortcuts

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