plan

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package plan provides plan-mode guidance and approval-gated exit, matching core/plan-mode. The fixed plan:policy section (order 500) appears in the system prompt only while plan mode is active. Entering emits plan/mode(on). The exit_plan_mode tool asks through M14 User Questions: approval removes the section and emits plan/mode(off); rejection keeps plan mode active.

Index

Constants

View Source
const PlanPolicySectionName = "plan_policy"

PlanPolicySectionName names the plan:policy section.

Variables

This section is empty.

Functions

func Enter

func Enter(sl *session.SessionLog, sys *sysprompt.Assembler) error

Enter emits plan/mode(on) and installs the plan:policy section.

func Exit

func Exit(sl *session.SessionLog, sys *sysprompt.Assembler) error

Exit emits plan/mode(off) and removes the plan:policy section.

func IsActive

func IsActive(sl *session.SessionLog) bool

IsActive reports whether plan mode is active.

Types

type ExitPlanModeResult

type ExitPlanModeResult struct {
	// Approved reports whether approval was granted.
	Approved bool
	// Exited reports actual exit, which requires approval.
	Exited bool
}

ExitPlanModeResult reports exit_plan_mode approval.

type ExitPlanModeTool

type ExitPlanModeTool struct {
	// contains filtered or unexported fields
}

ExitPlanModeTool removes plan:policy only after UserQuestion approval.

func NewExitPlanModeTool

func NewExitPlanModeTool(sl *session.SessionLog, sys *sysprompt.Assembler) *ExitPlanModeTool

NewExitPlanModeTool creates the exit_plan_mode tool.

func (*ExitPlanModeTool) Description

func (t *ExitPlanModeTool) Description() string

Description returns the tool description.

func (*ExitPlanModeTool) Execute

func (t *ExitPlanModeTool) Execute(ctx context.Context, input map[string]any) (any, error)

Execute requests approval, exiting and removing plan:policy only if approved.

func (*ExitPlanModeTool) Name

func (t *ExitPlanModeTool) Name() string

Name returns the tool name.

func (*ExitPlanModeTool) SetAsker

func (t *ExitPlanModeTool) SetAsker(f func(ctx context.Context, prompt string, choices []string) (int, error))

SetAsker injects a question callback; the default test stub approves.

Jump to

Keyboard shortcuts

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