Documentation
¶
Overview ¶
Package harness is what a workspace's harness learns from its runs (spec_048_harness_learning): the evidence of what went wrong in its sessions, drawn from the audit log without a model, for the reflector and /skills update and /agents update to propose changes from.
Index ¶
Constants ¶
const MaxItems = 200
MaxItems bounds the evidence, so the reflector's prompt stays small.
Variables ¶
This section is empty.
Functions ¶
func IsCorrection ¶
IsCorrection reports whether a prompt rejects the last answer.
Types ¶
type Evidence ¶
type Evidence struct {
Since time.Time
// Items are patterns first, then the most frequent and most recent.
Items []Item
// Dropped is how many items MaxItems left out.
Dropped int
// Used counts the turns each skill and agent was in ("skill/deploy",
// "agent/qa"), whether they went well or not.
Used map[string]int
// NoAudit means the audit log is off, so there's no evidence.
NoAudit bool
}
Evidence is what went wrong in a workspace's sessions since a time.
func (Evidence) About ¶
About is the evidence about skills, agents or rules (with guardrails) only, for /skills update, /agents update and /rules update; "" all of it.
func (Evidence) Patterns ¶
Patterns is how many items are patterns: what the welcome tile counts (HE-05).
type Inputs ¶
type Inputs struct {
// Since is where the evidence starts.
Since time.Time
// Audit is the workspace's audit log since then, in the order written.
Audit []audit.Entry
// NoAudit means the audit log is off, so there's no evidence.
NoAudit bool
// Sessions are the workspace's sessions, by ID. Unless it's nil, the
// entries of sessions it leaves out (evals' cases) are skipped, and so
// are those that name neither a session nor a workspace.
Sessions map[string]Session
// Fixes are the health judge's latest suggestions, by item
// ("skill/deploy", HL-10).
Fixes map[string][]string
}
Inputs are what the evidence is made from.
type Item ¶
type Item struct {
Kind Kind
// Subject is the tool, rule, guardrail, skill or agent it's about.
Subject string
// Target is the command or path, or for a limit which one.
Target string
Count int
First time.Time
Last time.Time
// Seen are the latest occurrences, at most three, newest first.
Seen []Seen
// Fixes are the health judge's suggestions for the subject.
Fixes []string
// contains filtered or unexported fields
}
Item is one thing that happened, as often as it happened.
type Kind ¶
type Kind string
Kind is what an evidence item is about.
const ( ToolFailed Kind = "tool_failed" // a tool call that failed, or a command that exited nonzero Denied Kind = "denied" // an action the user, the auto reviewer or a permission rule refused Blocked Kind = "blocked" // a guardrail's block Revised Kind = "revised" // a rule that sent the work back, or blocked it Steered Kind = "steered" // a message the user sent while the agent worked Corrected Kind = "corrected" // a prompt that rejects the last answer Undone Kind = "undone" // /undo, or a rewind Stopped Kind = "stopped" // a turn the user stopped Limited Kind = "limited" // a turn that reached a limit (Target: steps, cost or time) Skill Kind = "skill" // a skill used in turns that went wrong Agent Kind = "agent" // an agent invoked in turns that went wrong // ScratchRemade is a file under .agents/scratch written again in // another session; ScratchScript a script there run again in another // session (HE-61). Each counts sessions, not writes or runs. ScratchRemade Kind = "scratch_remade" ScratchScript Kind = "scratch_script" )
Kinds of evidence (HE-02).
type Seen ¶
type Seen struct {
Session string
Title string
Origin string
// Turn counts the session's prompts within the evidence, from 1.
Turn int
Time time.Time
Excerpt string
// Agent is the agent that was refused or whose tool failed, when the
// audit log says.
Agent string
// Then is, for a failed call, what worked after it in the same turn:
// the next call of the same tool that succeeded, by its command or
// path, or "the same call, retried" (HE-60); "" when none did.
Then string
}
Seen is one occurrence of an item.