goalloop

package
v0.107.40 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package goalloop holds the session-goal rules shared by the TUI and the backend: the round prompts, the GOAL_MET completion and GOAL_NEEDS_INPUT checks, and the round limit resolution.

Index

Constants

View Source
const DefaultVerifyMaxRejections = 3

DefaultVerifyMaxRejections is how many times the verifier may turn down a GOAL_MET claim for one goal before the next claim is accepted without another check, so a verifier that never agrees cannot keep a finished goal running forever.

View Source
const MetToken = "GOAL_MET"

MetToken is the literal a reply must lead with to declare the goal accomplished.

View Source
const NeedsInputToken = "GOAL_NEEDS_INPUT"

NeedsInputToken is the literal a reply leads with when the goal cannot advance without the user's answer; the goal then pauses until the user replies.

View Source
const VerifyInstructions = `You are an independent reviewer. An agent was given a goal and has just claimed it is accomplished (its reply began with ` + MetToken + `). You cannot run tools: judge only from the goal and the transcript excerpt you are given.

Be skeptical. Every part of the goal needs concrete evidence in the excerpt — commands that ran and passed, files that were written, behavior that was observed. If any part is missing, unverified, contradicted by a tool result, or only promised, the goal is NOT met.

Reply with ONLY one JSON object and nothing else — no prose, no code fence:
{"met": true or false, "reason": "one or two sentences; when not met, name exactly what is missing or what to do next"}`

VerifyInstructions is the system prompt of the verification request.

Variables

This section is empty.

Functions

func ClearedNotice

func ClearedNotice(goal string) string

ClearedNotice is the request-only text of a plain user turn after the user cleared the goal that history still shows.

func ContinueGoal added in v0.107.31

func ContinueGoal(prompt string) (string, bool)

ContinueGoal reports whether prompt is a ContinuePrompt and, if so, its goal.

func ContinuePrompt

func ContinuePrompt(goal string) string

ContinuePrompt is the user turn submitted after every unfinished round.

func MaxRounds

func MaxRounds(dir string, global int) int

MaxRounds resolves the continuation limit: a project override for dir wins over the global config value, which wins over the built-in default.

func Met

func Met(final string) bool

Met reports whether a final reply declares the goal accomplished. As the continuation prompt demands, the reply must lead with the token: only whitespace and Markdown emphasis, heading, quote or code markers may precede it, and it must end at a word boundary. A mention later in the reply ("not GOAL_MET yet") never counts.

func NeedsInput

func NeedsInput(final string) bool

NeedsInput reports whether a final reply asks the user for input the goal cannot advance without. It follows the same leading-token rule as Met.

func PausedNotice

func PausedNotice(goal string) string

PausedNotice is the request-only text of a plain user turn while the goal is paused by the user (or restored paused). The goal stays visible in history, so without it the model tends to pick the goal back up on its own.

func RejectedPrompt added in v0.107.40

func RejectedPrompt(goal, reason string) string

RejectedPrompt is the user turn submitted after the verifier turned down a GOAL_MET claim. It is a goal check (ContinueGoal recognizes it) with the verifier's reason in a clearly labelled section ahead of the usual round rules.

func ReplyPrompt

func ReplyPrompt(goal string) string

ReplyPrompt is the request-only instruction of the round that carries the user's answer to a goal that paused for input; the visible user turn is the answer itself.

func StartPrompt

func StartPrompt(goal string) string

StartPrompt is the request-only instruction of the round that sets a goal. It carries the same rules as later rounds, so even the first round can finish the goal or ask for the user's input.

func VerifyEnabled added in v0.107.40

func VerifyEnabled(cfg *config.Config) bool

VerifyEnabled reports whether a GOAL_MET claim is checked by an independent, hidden verification request before the goal completes. It is on unless the config turns it off.

func VerifyMaxRejections added in v0.107.40

func VerifyMaxRejections(cfg *config.Config) int

VerifyMaxRejections resolves the verifier rejection cap from the config.

func VerifyPrompt added in v0.107.40

func VerifyPrompt(goal, transcript, claim string) string

VerifyPrompt is the user message of the verification request: the goal, the excerpt of recent work and the reply that claimed the goal.

Types

type Verdict added in v0.107.40

type Verdict struct {
	Met    bool   `json:"met"`
	Reason string `json:"reason"`
}

Verdict is the verifier's judgement of a GOAL_MET claim.

func ParseVerdict added in v0.107.40

func ParseVerdict(reply string) (Verdict, error)

ParseVerdict reads the verifier's reply. It tolerates a code fence or text around the object, but the object must carry a boolean "met"; anything else is an error and the caller falls back to accepting the claim.

Jump to

Keyboard shortcuts

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