taskclass

package
v2.9.0-dev.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Debug     = "debug"
	Implement = "implement"
	Chat      = "chat"
	Research  = "research"
	Review    = "review"
)

Canonical task-class names. Use these constants rather than string literals so future class renames are mechanically findable.

View Source
const (
	TierFrontier = "frontier"
	TierMid      = "mid"
	TierSmall    = "small"
)

Tier names mirror pkg/modeltier's TierFrontier / TierMid / TierSmall — duplicated as constants here so taskclass can be referenced without pulling in modeltier when only the labels are needed. Resolution (which provider's model for which tier) lives in ModelForTier below.

View Source
const (
	AskAuto  = "auto"
	AskAsk   = "ask"
	AskAllow = "allow"
)

Ask-mode aliases for the AskMode field. The CLI's --ask flag accepts these strings + "yolo" + "plan" + "acceptEdits"; the ones listed here are the only values task-class profiles actually use.

Variables

This section is empty.

Functions

func Classes

func Classes() []string

Classes returns the canonical task-class names in a stable order suitable for CLI usage messages and validation errors. Order reflects the design doc's table layout (debug, implement, chat, research, review) rather than alphabetical so the most common operator choices appear first.

func ModelForTier

func ModelForTier(provider, tier string) string

ModelForTier returns the default model ID for a (provider, tier) pair. Returns "" when no mapping exists — caller should fall through to whatever model would've been chosen without --task.

Provider names match pkg/models's registration strings ("gemini", "vertex", "anthropic", "anthropic-vertex"). Mock providers (echo, scripted) don't appear here — they have no tier concept.

The table embeds knowledge that also lives in pkg/modeltier's reverse direction (model → tier). When a new model ships, both need bumping. Not worth fusing into one table (the two directions have different shape needs: modeltier wants substring matching, taskclass wants canonical-string outputs).

POLICY: each entry names the LATEST model in its line. Picking Opus means picking the newest Opus, not whichever Opus was current when the line was last edited. That is not enforceable from LiteLLM — the catalog has no recency field, and auto-promoting would ship an un-UAT'd model to every operator on a Monday regen — so it is enforced instead by TestModelForTier_ReturnsLatestInLine, which fails the build when pricing.Builtin() contains a newer model in the same line than the one returned here.

func Providers added in v2.8.0

func Providers() []string

Providers returns the provider names ModelForTier has tier mappings for. Extend together with ModelForTier's switch when a provider is added — consumers iterate this list to verify cross-table invariants for every default (pricing's TestBuiltin_CoversTaskclassTierDefaults walks Providers() × tiers, so a provider missing here silently loses that coverage).

Types

type Profile

type Profile struct {
	// Tier hints which model class to pick. Resolved to a specific
	// model ID per-provider via ModelForTier. Empty = don't change
	// the model.
	Tier string

	// CompactionThreshold goes into the compactor's fallback
	// Threshold field. 0 = leave the substrate default in place.
	// Note: per-tier overrides from config still win for their
	// specific tier (see compactor's resolveThreshold precedence).
	CompactionThreshold float64

	// AgenticToolsEnabled is the desired agentic-tools state. The
	// substrate already defaults to on (PR #118), so today every
	// profile sets this true and the field is mostly informational.
	// Stays as an explicit field so a future "monitor" class that
	// wants agentic-tools off can express that.
	AgenticToolsEnabled bool

	// UseAgenticSmallModel controls whether agentic subtasks route
	// through a cheap-tier model (true) or inherit the parent's
	// model (false). True for tool-heavy task classes; false for
	// chat where subtask overhead doesn't pay off.
	UseAgenticSmallModel bool

	// AskMode is the desired permissions ask-mode default. Empty =
	// don't override the operator / config setting.
	AskMode string

	// DisableTools names built-in tools this class drops from the
	// default registration. Nil = register the usual suite.
	//
	// This is the profile's opinion, not the operator's: an operator
	// who explicitly disables a tool (tools.disable / --disable-tools)
	// is never overruled, and one who wants a profile-dropped tool
	// back passes --enable-tools=<name>. See resolveProfileDisables
	// in cmd/core-agent.
	//
	// Investigation-shaped classes drop `bash` because that is where
	// the measured failure lives: in the 2026-06-10 debug session the
	// model reached for `bash $ grep -rn` on call #1 with the native
	// grep tool right there in the schema. #158's search gate refuses
	// the search-shaped subset; this is the blunter version for the
	// classes where the shell earns its keep least.
	DisableTools []string

	// RequirePlanArtifact turns plan-first gating on for this class —
	// mutating tools stay denied until the model calls record_plan.
	// It maps to permissions.plan_mode: "required".
	// False = leave permissions.plan_mode as configured;
	// the profile only ever turns the gate ON, never off, since an
	// operator who put `true` in config meant it.
	//
	// Only honored when a .agents/ directory exists to persist plans
	// into: record_plan doesn't register without one (see
	// tools.Build), and a gate with no way to record a plan denies
	// every mutating call for the life of the session.
	RequirePlanArtifact bool
}

Profile is the bundle a task class maps to. Applied to whatever flags the operator left unspecified; explicit flags win. All fields are optional in the sense that an empty / zero value means "don't override the substrate / operator default" — the CLI's resolution logic walks each field independently.

func Resolve

func Resolve(class string) (Profile, bool)

Resolve returns the Profile for class. Empty class returns (Profile{}, false) — caller should not apply anything. Unknown class also returns (Profile{}, false); caller is expected to surface a useful error listing Classes().

Jump to

Keyboard shortcuts

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