plan

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plan implements Plan learning (ADR-0014): plans are a closed menu of capability sequences — the ledger's second bet target. The LLM never generates a plan; new variants come from pure mutation operators, entry is a proposal, selection is math (変異は純関数、採否は数式).

Index

Constants

View Source
const (
	// K is the per-capability survival cap on menu variants (Decision 5).
	K = 5

	// ProposalWindowMs is the proposal budget: at most one plan.generated in
	// the trailing window, checked across the whole event log — not
	// per-capability. It borrows the question budget's shape (ADR-0007's
	// `tomo.asked` check), and that budget is a single harness-wide gate,
	// not one per Preference Gap topic; K's "per-capability" scope
	// (Decision 5) is a separate knob and doesn't extend to this one.
	ProposalWindowMs = 24 * 3600 * 1000
)

Knobs (ADR-0014 Consequences).

Variables

View Source
var Vocabulary = []string{
	"analyze", "implement", "review", "refactor", "summarize",
	"test", "benchmark", "commit", "deploy", "notify",
}

Vocabulary is the closed capability vocabulary plans are built from (EXECUTION_MODEL.md — Capability). Mutation legality closes over it.

Functions

func Initial

func Initial(capability string) [][]string

Initial returns the hand-written starting menu for a capability (Decision 2: 初期メニューは手書きの2〜3変種). Capabilities without a richer menu get the one-step plan of themselves — the current behavior, expressed as a plan.

func Legal(steps []string) bool

Legal reports whether a step sequence is a valid plan: non-empty, closed over the vocabulary, no consecutive duplicates, bounded length (Decision 3's legality constraints).

func Live

func Live(s *store.Store, capability string, nowMs int64) ([]string, error)

Live derives the current menu for a capability: the initial variants (always offered) plus every proposed variant recorded in plan.generated events — minus retirements. Menu membership is derived from truth (events), so `tomobit rebuild` cannot lose it; retirement is the connection lifecycle doing its job (Decision 5: 勝てないPlanは減衰し Retireへ — a dormant plan connection drops its variant from the menu).

func Name

func Name(steps []string) string

Name is a plan's canonical identity: its steps joined by ">". The steps ARE the plan, so the identity is self-describing and collision-free with provider names.

func Propose

func Propose(s *store.Store, capability string, menu []string, nowMs int64) (string, error)

Propose runs the Curiosity proposal (Decision 3/5): if the menu has room and the budget allows, generate the first legal mutation of the current menu that has never been proposed before, record plan.generated, and return the new variant's name. Priority within the mutation space is deterministic enumeration order — every candidate is a blank slate with identical wobble, so VoI cannot separate them yet (ADR-0016's tie falls back to a fixed order). Returns "" when nothing is proposed.

"Never proposed" is checked against the full plan.generated history, not just the live menu: a retired variant has left the menu but its name is still spent. Checking against the menu alone would make Propose retrace the same drop→swap→insert prefix every window a variant retires — the same mutation coming back as "the first one not in the menu" forever, starving every candidate after it. Retired names stay excluded from enumeration permanently; that's fine because it's not the only way back in — an explicit `--plan <steps>` still resolves and records plan.selected regardless of retirement, so evidence can revive a retired plan's connection (CONNECTION_ENGINE Revived) without Propose's help.

func Resolve

func Resolve(capability, arg string) (string, bool)

Resolve maps a --plan argument to a canonical plan name: an initial-menu label (implement: full / direct / quick) or a canonical ">"-joined steps name. ok=false for anything outside the closed vocabulary.

func Steps

func Steps(name string) []string

Steps parses a canonical name back into its steps.

Types

type Mutation

type Mutation struct {
	Op    string // "drop" | "insert" | "swap"
	Steps []string
}

Mutation is one structural edit of an existing plan.

func Mutations

func Mutations(steps []string) []Mutation

Mutations enumerates every legal mutation of steps, deterministically: drops (left to right), swaps (left to right), inserts (position-major, vocabulary order). Pure — same input, same list.

Jump to

Keyboard shortcuts

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