subtask

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: 3 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 subtask implements the split-proposal protocol (ADR-0023, always-on since ADR-0028): every `do` target run carries the protocol, and a Provider that judges the task too large returns a small JSON marker instead of doing the work. This package turns that marker into the subtask groups tomobit runs next — a group being subtasks the Provider declared independent (ADR-0028 Decision 2). Pure — no I/O, no store — so the protocol's parsing and framing can be pinned by recorded-text fixtures the same way an Adapter's Translate is (ADR-0006 Decision 3).

Index

Constants

View Source
const (
	Min = 2
	Max = 5
)

Min and Max bound a legal proposal's subtask count (ADR-0023 Decision 1). The bound is on the flattened total — sum across all groups — not the group count, since a group is only a parallelism declaration (ADR-0028 Decision 2).

Variables

This section is empty.

Functions

func Instruction

func Instruction(prompt string) string

Instruction appends the split-proposal protocol to prompt. The text is deterministic harness text (ADR-0023 Decision 1): a model-authored version of this offer would make the offer itself unauditable — the harness always asks the same way, so a proposal's absence is a model decision, not a wording accident. The example shows the group form (ADR-0028 Decision 2): a string is a lone subtask, a string array is subtasks the Provider declares independent and safe to run in parallel.

func Parse

func Parse(text string) ([][]string, error)

Parse reads text (a run's concatenated provider.output) for a split proposal. Three outcomes distinguish "nothing was offered" from "something was offered but is broken" (ADR-0023 Decision 1: 警告して通常フロー続行, never a silent fallback either way):

  • (nil, nil): no marker anywhere — an ordinary run, use its output as-is
  • (nil, err): the marker is present but no legal proposal could be read from it (too few/many subtasks after flattening, a non-string or blank element, an empty group, or the surrounding text isn't valid JSON)
  • (groups, nil): accepted; each group is a slice of trimmed subtasks the Provider declared independent (ADR-0028 Decision 2). A flat proposal comes back as one single-element group per subtask ([["a"],["b"]]).

It reads both a fenced ```json block and bare JSON with no fence at all — providers are not guaranteed to wrap their marker in a code fence just because the instruction showed one. A candidate equal to the instruction's own example is the harness's text quoted back (models routinely cite their prompt while declining to split) and reads as no proposal, not a proposal.

func Prompt

func Prompt(parentIntent, sub string, i, total int) string

Prompt frames one subtask deterministically for its own run (the stepPrompt harness-text pattern, cmd/tomobit/main.go): the parent intent rides along so the subtask's session records what it was cut from, but no split protocol text is added — a subtask cannot itself propose a further split (ADR-0023 Decision 4: depth stays 1).

Types

This section is empty.

Jump to

Keyboard shortcuts

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