Documentation
¶
Overview ¶
Package unplannedread measures reads that Corvint failed to prevent: tool calls that opened a project file the delivered context packet did not already carry. It is an explicitly opt-in, bounded, local, private ledger. It is never an input to ranking, evidence, or authority, is read as labels only by the operator-invoked slot-weight learning step (decision 0368), and stores no file contents.
Index ¶
- func Append(root string, event Event) error
- func Disable(root string) error
- func Enable(root string) error
- func Enabled(root string) bool
- func HookPostTool(root string, packetPaths []string, payload map[string]any) error
- func HookPostToolSession(root, session string, payload map[string]any) error
- func PacketDigest(packetPaths []string) string
- func RecordPacket(root, session string, packetPaths []string) error
- func RefusePacket(root, session string) error
- func Render(root string, limit int, output io.Writer) error
- type Digest
- type Event
- type PathBytes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append writes one row, and only when the opt-in marker exists. Without the marker it is a no-op returning nil, so no default install ever gains a file.
func Enable ¶
Enable and Disable are the only mutations in this package that a read command never performs; they are explicit operator verbs.
func HookPostTool ¶
HookPostTool is the orchestrator entry point. It is log-and-drop: it never returns an error that could fail a host hook, and the dropped error is persisted as an error row the digest reports as LastError.
func HookPostToolSession ¶
HookPostToolSession is the host adapter's post-tool entry point. It judges a read against the newest packet recorded for the same session; when no such packet is retained it abstains and writes nothing, because a read with no known packet cannot be called unplanned (URE-V0-009). It never returns an error.
func PacketDigest ¶
PacketDigest names the packet a read was judged against without retaining its paths.
func RecordPacket ¶
RecordPacket stores the planned set of the packet just delivered to a session, so a later post-tool call in that session has a denominator. It is marker-gated and log-and-drop like HookPostTool: it never returns an error.
func RefusePacket ¶
RefusePacket records that a session's newest prompt delivered no packet, so later reads in that session abstain rather than score against its older packet (URE-V0-008). It is marker-gated and log-and-drop like RecordPacket.
Types ¶
type Digest ¶
type Digest struct {
Unplanned int
Planned int
TotalBytes int64
Tools map[string]int
TopPaths []PathBytes
SkippedRows int
// LastError is the reason code of the newest retained error row and
// DroppedErrors counts every retained error row.
LastError string
DroppedErrors int
}
Digest is the read-only summary of the ledger.
type Event ¶
type Event struct {
Timestamp string `json:"ts"`
Tool string `json:"tool"`
Path string `json:"path,omitempty"`
Bytes int64 `json:"bytes"`
SizeKnown bool `json:"size_known"`
PacketDigest string `json:"packet"`
Planned bool `json:"planned"`
}
Event is one classified read. Planned rows carry no path: only the counts needed to compute the unplanned share.
func Classify ¶
func Classify(packetPaths []string, toolName string, toolInput map[string]any, root string) (Event, bool)
Classify decides whether one post-tool payload is a project-relative read and whether the packet already planned it. It reads filesystem metadata to resolve containment and the worktree path's byte size. The second result is false when the call is not a recognized read or its target is not inside the worktree.