config

package
v0.50.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config loads Prism configuration from prism.yaml and environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModelContextWindow

func ModelContextWindow(model string) int

ModelContextWindow maps known model name substrings to their context window. Matching is case-insensitive prefix/substring to handle versioned IDs like "claude-sonnet-4-6" or "gpt-4o-2024-11-20" without exhaustive enumeration.

Types

type Config

type Config struct {
	GroveURL    string
	GroveBinary string
	// Model is the active AI model identifier. There is NO auto-detection —
	// the MCP initialize handshake does not carry the model — so it is set
	// only via prism.yaml, PRISM_MODEL, or a per-call model= argument. When
	// empty, ContextWindow() returns a safe 200k default that covers all
	// current production models.
	Model         string
	Profile       string
	MaxCacheFiles int
	Port          int
	// ArchDeny holds declared architecture rules, one per `arch_deny:` line
	// in prism.yaml: "<from> -> <to>" where each side is a component name
	// (directory), a prefix (covers subdirectories), a glob, or "*".
	// Validated by prism arch / prism_arch_check against the induced
	// component view; every violation cites concrete file:line sites.
	ArchDeny []string
}

Config holds the resolved Prism configuration.

func Default

func Default() *Config

Default returns config values with environment overrides applied. Model intentionally defaults to "" (unset — 200k-window default applies).

func LoadFromDir

func LoadFromDir(dir string) (*Config, error)

LoadFromDir looks for prism.yaml in dir and merges over Default(). Parser is intentionally minimal: KEY: VALUE per line, comments with '#'. This keeps Prism single-binary with no YAML dep.

func (*Config) ContextWindow

func (c *Config) ContextWindow() int

ContextWindow returns the total context window in tokens for the model. When Model is empty or unrecognised, returns a safe 200k default that is correct for all current Claude models and generous for others.

func (*Config) WithModel

func (c *Config) WithModel(model string) *Config

WithModel returns a shallow copy of the config with Model overridden. Use this for per-call effective context windows without mutating state.

Jump to

Keyboard shortcuts

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