Documentation
¶
Overview ¶
Package selection chooses the most useful representation of collected files under a token budget. It is shared by the non-interactive CLI and the TUI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
Candidate is a collected file plus the mode preference supplied by history or another caller.
type Decision ¶
type Decision struct {
Path string `json:"path"`
Mode Mode `json:"mode"`
Selected bool `json:"selected"`
Score float64 `json:"score"`
Utility float64 `json:"utility"`
Tokens int `json:"tokens"`
FullTokens int `json:"full_tokens"`
SignatureTokens int `json:"signature_tokens"`
Role string `json:"role,omitempty"`
TaskRelevance float64 `json:"task_relevance,omitempty"`
Signals Signals `json:"signals,omitempty"`
Reason string `json:"reason"`
}
Decision explains the automatic decision for one candidate.
type Report ¶
type Report struct {
Result Result
Skipped []walker.SkippedItem
}
Report contains selection decisions and optional scan skips for display.
type Request ¶
type Request struct {
Budget int
MaxStates int // zero uses the default sparse-DP state limit.
Prompt string // optional task text used to improve path relevance.
// Tuning carries the optimizer's numeric knobs. The zero value means the
// built-in defaults; config layers pass an explicit tuning to override.
Tuning Tuning
}
Request controls automatic selection.
type Result ¶
Result contains every decision and the finalized files selected for output.
func Select ¶
Select chooses a mode for every file. With no budget it preserves the established score/filter modes. With a budget it reserves guaranteed slots for high-retention files (entrypoints, docs, config) and uses sparse dynamic programming for the rest, choosing among full, signature, and skip variants to maximize total utility rather than simply taking files in score order.
type Signals ¶
type Signals struct {
Recency float64 `json:"recency,omitempty"`
Churn float64 `json:"churn,omitempty"`
Centrality float64 `json:"centrality,omitempty"`
Role float64 `json:"role,omitempty"`
}
Signals are optional ranking inputs retained for explainable reports.
type Tuning ¶
type Tuning struct {
BaseMin float64
BaseMax float64
RelevanceWeight float64
PreferenceBonus float64
SignatureBonus float64
SkipMultiplier float64
SigQualityMin float64
SigQualityMax float64
// RetentionFloor is the minimum retention value at or above which a file
// is guaranteed a slot under budget (its best affordable variant is
// reserved first). Files below the floor compete through the DP.
RetentionFloor float64
// Retention overrides the lang role defaults per role name (e.g.
// "entrypoint"). Config takes priority over the lang default.
Retention map[string]float64
}
Tuning holds every numeric knob the utility optimizer reads. Values come from the config [scoring] section; the zero value resolves to the defaults below, so no tuning numbers are hardcoded in the DP itself.