Documentation
¶
Overview ¶
Package effects checks the claims an agent makes about the world ("pushed", "restarted the service", "it is live at …") by probing the effect itself.
A pilot on real sessions showed that the false completions a human catches are mostly effect claims that were only proxy-verified: a test ran, and then the agent said "pushed". Extract finds those claims in the agent's final message, deterministically and without a model. Probe (probe.go) then looks at the machine with read-only commands. The package never changes state.
Index ¶
Constants ¶
const ( ModeOff = "off" ModeShow = "show" ModeEnforce = "enforce" )
The values of projects.effect_checks (docs/effect-checks.md).
Variables ¶
This section is empty.
Functions ¶
func MessageHash ¶
MessageHash identifies a message for the dedupe. It is a digest, not the text, so the table never stores a second copy of the agent's message.
Types ¶
type Claim ¶
type Claim struct {
Kind Kind
// Target is what the claim is about: a unit name, URL, port, path, commit
// or remote ref. It is empty when the sentence names none.
Target string
// Sentence is the sentence the claim was found in, for evidence.
Sentence string
}
Claim is one completion claim found in a message.
type Facts ¶
type Facts struct {
Since time.Time
LastCheck *store.SessionCheck
CurrentFingerprint string
}
Facts is what the probes may compare against: when the turn began, the most recent test run in the session, and the fingerprint of the tree now.
type SessionSender ¶
SessionSender is how a machine-originated message reaches a session; *sessions.Manager satisfies it (its SendNotice).
type Status ¶
type Status string
Status is the outcome of probing one claim.
const ( // StatusVerified means the probe observed the claimed effect. StatusVerified Status = "verified" // StatusContradicted means the probe observed the opposite. StatusContradicted Status = "contradicted" // StatusUnknown means the probe could not decide: no evidence either way. StatusUnknown Status = "unknown" )
type Watcher ¶
type Watcher struct {
DB *store.DB
Reg *executor.Registry
Bus *bus.Bus
Notifier Notifier
Sessions SessionSender
Log *slog.Logger
// CheckTimeout bounds how long a claim about tests waits for a running
// check. checks.DefaultTimeout is used when unset.
CheckTimeout time.Duration
// contains filtered or unexported fields
}
Watcher evaluates the completion claims in each agent turn's final message. It is a subscriber on the hook path, so HandleHookEvent does no probing: it only decides whether a turn is worth checking and starts a goroutine. The evaluation then runs without holding the agent's HTTP hook response.
func New ¶
func New(db *store.DB, reg *executor.Registry, b *bus.Bus, notifier Notifier, sessions SessionSender, timeout time.Duration, log *slog.Logger) *Watcher
New builds a Watcher.
func (*Watcher) HandleHookEvent ¶
func (w *Watcher) HandleHookEvent(sess *store.Session, event string, body []byte, state string, changed bool)
HandleHookEvent is the events.OnHookEvent subscriber. It returns at once. A UserPromptSubmit starts a new turn, so its time becomes the Since fact that restart claims are compared against. A Stop, or codex's AgentTurnComplete, with a last message that makes a claim starts one evaluation in the background.