schematic

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package schematic implements the pre-worker that analyses bead scope before Smith starts. The schematic is drawn before the smith starts forging.

Schematic can:

  1. Emit a focused implementation plan appended to Smith's prompt
  2. Decompose large beads into sub-beads via bd, blocking the parent
  3. Skip entirely for small/simple beads
  4. Request human clarification for ambiguous beads and block work until clarified

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldRun

func ShouldRun(cfg Config, bead poller.Bead) bool

ShouldRun determines whether the Schematic should analyse this bead based on the configuration and bead metadata.

Types

type Action

type Action string

Action describes what the Schematic decided to do.

const (
	// ActionPlan means the bead is implementable as-is; a focused plan was
	// produced to guide Smith.
	ActionPlan Action = "plan"

	// ActionDecompose means the bead was too large or multi-part and has been
	// split into sub-beads. The parent bead should be blocked.
	ActionDecompose Action = "decompose"

	// ActionSkip means the bead was simple enough that no schematic was needed.
	ActionSkip Action = "skip"

	// ActionClarify means the bead requires human clarification and should not
	// be worked on yet.
	ActionClarify Action = "clarify"
)

type Config

type Config struct {
	// Enabled controls whether Schematic runs at all. Defaults to true when
	// the global setting is enabled.
	Enabled bool
	// WordThreshold is the minimum word count in the bead description to
	// trigger automatic schematic analysis. Beads below this are skipped
	// unless they have the decompose tag. Default: 100.
	WordThreshold int
	// MaxTurns limits the AI session length. Default: 10.
	MaxTurns int
	// ExtraFlags are additional CLI flags forwarded to the Claude session
	// (e.g. model selection, auth tokens). Mirrors pipeline.Params.ExtraFlags.
	ExtraFlags []string
}

Config controls Schematic behavior.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns sensible defaults for Schematic.

type Result

type Result struct {
	// Action is what the Schematic decided.
	Action Action
	// Plan is a focused implementation plan for Smith (only when Action=ActionPlan).
	Plan string
	// SubBeads is the list of sub-beads created (only when Action=ActionDecompose).
	SubBeads []SubBead
	// Reason is a human-readable explanation of the decision.
	Reason string
	// Duration is how long the analysis took.
	Duration time.Duration
	// CostUSD is the estimated cost of the AI session.
	CostUSD float64
	// Error is set if the schematic failed.
	Error error
}

Result captures the outcome of a Schematic analysis.

func Run

func Run(ctx context.Context, cfg Config, bead poller.Bead, anvilPath string, pv provider.Provider) *Result

Run executes the Schematic analysis for a bead. It spawns a lightweight AI session to determine whether the bead should be decomposed, planned, or skipped.

type SubBead

type SubBead struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

SubBead holds the ID and title of a created sub-bead.

Jump to

Keyboard shortcuts

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