Documentation
¶
Overview ¶
Package autonomy contains the deterministic daily experiment policy. It does not launch agents, change servers, or grant permissions. Callers persist State before dispatching and enforce QuotaGate before and throughout every run.
Index ¶
- Constants
- func InspectCompletionTree(dir string) (string, error)
- func QuotaGate(c Config, providers []ProviderUsage, required []string, now time.Time) error
- func ValidateRequirements(rs []Requirement) error
- type Assignment
- type BuildReport
- type CompletionOverlayReceipt
- type Config
- type DecisionProposal
- type ExplorationFinding
- type NoWorkBlocker
- type NoWorkReport
- type Phase
- type PlanReport
- type Proposal
- type ProviderUsage
- type Requirement
- type State
- func (s *State) ActiveTaskIDs() []int64
- func (s *State) ApplyReport(c Config, id int64, raw []byte) error
- func (s *State) NeededRoles() []string
- func (s *State) Pause(reason string)
- func (s *State) RegisterTask(role string, id int64) error
- func (s *State) Resume(c Config, providers []ProviderUsage, required []string, now time.Time) error
- type Usage
- type UsageBucket
- type UsageWindow
- type Verdict
Constants ¶
const CompletionOriginalWorkshop = CompletionSupplementDir + "/original-WORKSHOP.md"
const CompletionOverlayPolicy = "documentary-v1"
const CompletionSupplementDir = ".lectern-completion"
Variables ¶
This section is empty.
Functions ¶
func InspectCompletionTree ¶
InspectCompletionTree uses the same path, file and digest rules as overlay reconstruction. The caller must freeze the tree before inspecting it.
func QuotaGate ¶
QuotaGate fails closed for missing, duplicate, invalid, stale, or reset-past data. The five-minute source cache gets only a one-minute delivery allowance. This threshold is headroom, not a guarantee against provider reporting lag.
func ValidateRequirements ¶
func ValidateRequirements(rs []Requirement) error
Types ¶
type Assignment ¶
type BuildReport ¶
type BuildReport struct {
Requirements []Requirement `json:"requirements,omitempty"`
Outcome string `json:"outcome,omitempty"`
Summary string `json:"summary"`
Evidence []string `json:"evidence"`
Decision *DecisionProposal `json:"decision,omitempty"`
}
type CompletionOverlayReceipt ¶
type CompletionOverlayReceipt struct {
Policy string `json:"policy"`
BaselineSHA256 string `json:"baseline_sha256"`
OverlaySHA256 string `json:"overlay_sha256"`
DerivedSHA256 string `json:"derived_sha256"`
Documents []string `json:"documents"`
}
func ReconstructCompletionOverlay ¶
func ReconstructCompletionOverlay(baselineDir, candidateDir, outputDir string) (receipt CompletionOverlayReceipt, err error)
ReconstructCompletionOverlay validates an exact candidate tree, then copies the trusted baseline and only validated documentary bytes into a new output tree. Inputs must be frozen controller-owned snapshots; output's parent must likewise be controller-owned. It never executes candidate content. Reviewers must not execute fenced examples or use documentation-driven test discovery. Only flat .md/.txt supplements are allowed (no scripts, configs, dependencies or fixtures). Output root is always private 0700 and is excluded from tree receipts. Generated descendants have exact policy modes independent of process umask. A changed-back production file cannot affect output: production is read only from baseline and checked against its initial digest while copying.
type Config ¶
type Config struct {
Enabled bool `json:"enabled"`
Continuous bool `json:"continuous"`
Timezone string `json:"timezone"`
MorningHour int `json:"morning_hour"`
ReservePercent float64 `json:"reserve_percent"`
MarginPercent float64 `json:"margin_percent"`
MaxRevisionRounds int `json:"max_revision_rounds"`
MaxItemsPerDay int `json:"max_items_per_day"`
}
func DefaultConfig ¶
func DefaultConfig() Config
type DecisionProposal ¶
type ExplorationFinding ¶
type NoWorkBlocker ¶
type NoWorkBlocker struct {
Key string `json:"key"`
Requirement string `json:"requirement"`
Evidence []string `json:"evidence"`
}
NoWorkReport makes declining work an auditable decision, not an implicit shortcut around the two independent plan auditors. Evidence remains claims to inspect; structure alone never proves novelty, feasibility or exhaustion.
type NoWorkReport ¶
type NoWorkReport struct {
Reason string `json:"reason"`
Blockers []NoWorkBlocker `json:"blockers"`
Exploration []ExplorationFinding `json:"exploration"`
}
type PlanReport ¶
type PlanReport struct {
Requirements []Requirement `json:"requirements,omitempty"`
NoWork *NoWorkReport `json:"no_work,omitempty"`
Items []Proposal `json:"items"`
Backlog []Proposal `json:"backlog,omitempty"`
}
type Proposal ¶
type Proposal struct {
DiagnoseTaskID int64 `json:"diagnose_task_id,omitempty"`
EnvironmentDiagnosisTaskID int64 `json:"environment_diagnosis_task_id,omitempty"`
DiagnoseRequirement string `json:"diagnose_requirement,omitempty"`
DocumentationTaskID int64 `json:"documentation_task_id,omitempty"`
ProjectID int64 `json:"project_id"`
SourceRevision string `json:"source_revision,omitempty"`
RepairTaskID int64 `json:"repair_task_id,omitempty"`
ContinueTaskID int64 `json:"continue_task_id,omitempty"`
Title string `json:"title"`
Why string `json:"why"`
Acceptance []string `json:"acceptance"`
Ambition string `json:"ambition,omitempty"`
Novelty string `json:"novelty,omitempty"`
Score int `json:"score,omitempty"`
Expert bool `json:"expert,omitempty"`
}
type ProviderUsage ¶
type ProviderUsage struct {
ID string `json:"id"`
Status string `json:"status"`
UpdatedAt *float64 `json:"updated_at"`
Buckets []UsageBucket `json:"buckets"`
}
type Requirement ¶
type Requirement struct {
Capability string `json:"capability"`
SchemaVersion int `json:"schema_version"`
Requirements []string `json:"requirements,omitempty"`
Imports []string `json:"imports,omitempty"`
Condition string `json:"condition"`
Evidence []string `json:"evidence"`
}
Requirement is an observation, never permission to execute a remediation. Identities, providers, paths and proof are supplied by the controller/runner.
type State ¶
type State struct {
NoWork *NoWorkReport `json:"no_work,omitempty"`
Date string `json:"date"`
Phase Phase `json:"phase"`
ResumePhase Phase `json:"resume_phase,omitempty"`
Reason string `json:"reason,omitempty"`
Revision int `json:"revision"`
Cycle int `json:"cycle"`
Item int `json:"item"`
Step int `json:"step"`
Items []Proposal `json:"items"`
Backlog []Proposal `json:"backlog,omitempty"`
Decision *DecisionProposal `json:"decision,omitempty"`
DecisionAudits map[string]Verdict `json:"decision_audits,omitempty"`
Assignments []Assignment `json:"assignments"`
Audits map[string]Verdict `json:"audits"`
Reports map[int64]json.RawMessage `json:"reports"`
}
func (*State) ActiveTaskIDs ¶
func (*State) ApplyReport ¶
ApplyReport accepts only the expected, owned task and validates the entire report before changing state. Repeated delivery is rejected without mutation.
func (*State) NeededRoles ¶
NeededRoles is a stable dispatch plan. RegisterTask must be persisted before dispatch; a restart then sees the same outstanding owned task IDs.
type Usage ¶
type Usage struct {
Providers []ProviderUsage `json:"providers"`
RefreshSeconds int `json:"refresh_seconds"`
}
Usage matches homelab-api /api/agent-usage's normalized response. Pointers distinguish absent measurements from legitimate zeroes; all advertised windows, including model-specific ones, constrain dispatch.
type UsageBucket ¶
type UsageBucket struct {
ID string `json:"id"`
Windows []UsageWindow `json:"windows"`
}
type UsageWindow ¶
type Verdict ¶
type Verdict struct {
Requirements []Requirement `json:"requirements,omitempty"`
Outcome string `json:"outcome,omitempty"`
Approve *bool `json:"approve"`
Reason string `json:"reason"`
}
func (Verdict) AcceptsWork ¶
Legacy reports remain interpretable; explicit non-completion never promotes.