necessity

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 7 Imported by: 0

Documentation

Overview

Package necessity answers one read-only question about a task-context packet: which of the files the packet included does the packet actually depend on? Each included path is removed from a copy of the index and the packet is recompiled; a path whose removal costs the packet an anchor, grows its missing-critical set, or moves it off a resolved answerability verdict is `load-bearing`, and every other included path is `supporting`.

The label is a counterfactual under the current ranker at one immutable revision, never a claim about relevance to a human reader. The original index is never mutated, nothing is written to the repository, and a packet that abstains is emitted unchanged with no labels (AGENTS.md invariants 1, 2, 4).

Index

Constants

View Source
const (
	// DefaultLimit bounds both the packet and the counterfactual budget when
	// no --limit is given.
	DefaultLimit = 12
	// MaxReruns is the hard ceiling on counterfactual recompiles for one
	// invocation, whatever --limit asks for.
	MaxReruns = 12

	// Disclosure is fixed text emitted with every labelled answer.
	Disclosure = "Labels are counterfactual under the current ranker at this revision, not proof of relevance: " +
		"`load-bearing` says only that this packet lost an anchor, gained a missing critical selector, or left a " +
		"resolved verdict when the file was removed from the index, and `supporting` does not say the file is " +
		"unnecessary to a reader."
)

Variables

This section is empty.

Functions

func Render

func Render(ctx context.Context, options Options, stdout io.Writer) error

Render compiles one labelled packet and writes it as a single canonical JSON line.

func Resolve

func Resolve(ctx context.Context, options Options) (map[string]any, error)

Resolve loads the index the context verb loads, compiles the packet, and attaches the necessity block without emitting it.

Types

type Error

type Error struct{ Message string }

Error is a necessity failure. An abstention is not an Error: it is a successful answer carrying no labels.

func (*Error) Error

func (err *Error) Error() string

type Options

type Options struct {
	Root, Task, Subject string
	Limit               int
}

Options is one necessity request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL