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
- Variables
- func Initial(capability string) [][]string
- func Legal(steps []string) bool
- func Live(s *store.Store, capability string, nowMs int64) ([]string, error)
- func Name(steps []string) string
- func Propose(s *store.Store, capability string, menu []string, nowMs int64) (string, error)
- func Resolve(capability, arg string) (string, bool)
- func Steps(name string) []string
- type Mutation
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.