kata

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package kata is a fourth agent engine for tomo, a code-as-action loop built from scratch on the lessons the oi engine proved on real traces. Like oi, the model acts by writing one fenced code block per reply; the engine runs it, feeds the output back, and the turn ends when a reply carries no runnable block. What kata changes is the shape of the machinery around that loop: the finish checks are a declarative guard table instead of a grown chain of branches, the pacing signals carry a whole-turn round budget so a run that keeps finding new work still converges, and the prompt and a bounded guard ask the model to reproduce a reported failure before fixing it, so a green finish proves the fix rather than the suite's prior state. Parsing is shared through pkg/fence, so every dialect and salvage fix proven there applies to both engines identically; the comparison between kata and oi is then about policy, not parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SystemPrompt

func SystemPrompt(now time.Time, workspace, persona, memoryIndex, skillsIndex string) string

SystemPrompt renders the kata engine's system prompt for a run. It mirrors the signature of the other engines so all four are drop-in swappable at the call site.

Types

type Engine

type Engine struct {
	Provider provider.Provider
	Model    string
	System   string
	// Box runs a code block. A nil box is the unconfined default.
	Box  sandbox.Sandbox
	Gate agent.Gate
	// Workspace is carried for the audit trail and the sink; the sandbox already
	// roots execution there.
	Workspace string
	// MaxRounds caps the model calls in one turn. Zero is unbounded and leaves the
	// pace table (governor.go) as the only bound, which is the normal mode.
	MaxRounds int
}

Engine runs the kata loop. Its fields mirror the oi engine exactly, so a caller swaps one for the other with no other change, and an A/B between them isolates the loop policy.

func (*Engine) Turn

func (e *Engine) Turn(ctx context.Context, history []provider.Message, user provider.Message, sink agent.Sink) ([]provider.Message, error)

Turn runs one user turn to completion and returns every message it generated, the user message first, so the caller can persist them. On error the messages so far come back too. The stop condition is the code-as-action one: the turn ends when the model's reply carries no runnable code block and no finish guard objects.

Jump to

Keyboard shortcuts

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