Files
poimen-workflows/tasks/T0.2.md
T
Test 11a1c1196a Add testable task descriptions: T0.1 through T0.9
Each task includes:
- Scope: what to build
- Implementation: code sketches + details
- Verification: concrete test criteria
- Done criteria: acceptance checklist
2026-08-20 22:41:54 -07:00

2.9 KiB

T0.2: Shared Types

Scope

Implement statemachine/types.go with all config/input/output structs and document defaults.

Implementation

File: statemachine/types.go

type ModelSpec struct {
    ModelID  string // e.g. "claude-opus-5", "claude-sonnet-5"
    Thinking string // "adaptive" or ""
    Effort   string // "low", "medium", "high", "xhigh", "max"
}

type PromptSpec struct {
    TemplateRef string            // e.g. "planner/default.tmpl"
    RawTemplate string            // overrides TemplateRef if non-empty
    Variables   map[string]any
    Model       ModelSpec
    LessonsRef  string            // key into lessons store
}

type PiRetryPolicy struct {
    ScheduleToCloseTimeout time.Duration // default: 5m
    InitialInterval        time.Duration // default: 2s
    MaximumInterval        time.Duration // default: 30s
    BackoffCoefficient     float64       // default: 2.0
    StreamTimeout          time.Duration // default: 30s
    StreamTimeoutMax       time.Duration // default: 2m
}

type ActivityTuning struct {
    ImplementerBaseTimeout time.Duration // default: 10m
    ImplementerMaxRetries  int           // default: 3
    JudgeTimeout           time.Duration // default: 5m
    PiRetry                PiRetryPolicy
}

type OrchestratorConfig struct {
    SystemPrompt string                    // shared prompt prefix
    Skills       []SkillRef                // required skill sources
    RolePrompts  map[string]PromptSpec     // per-role: "planner", "judge", "implementer"
    Tuning       ActivityTuning
}

type OrchestratorInput struct {
    TargetRepoPath string
    RemoteURL      string
    Milestone      string // e.g. "T0"
    Config         OrchestratorConfig
    DryRun         bool
    CycleCount     int
    MaxCyclesBeforeCAN int // default: 100
}

type OrchestratorOutput struct {
    MilestoneComplete bool
    Done              bool
    LastError         string
}

type TaskUnitInput struct {
    TaskID          string
    TargetRepoPath  string
    JudgeSpec       PromptSpec
    ImplementerSpec PromptSpec
    BaseTimeout     time.Duration
    MaxJudgeRetries int
}

type TaskUnitOutput struct {
    TaskID  string
    Verdict string // "pass" or "fail"
    Critique string
    Branch  string
}

type SkillRef struct {
    Name string // skill identifier
    URL  string // source to clone
}

Verification

cd /Users/rockliang/workplace/Poimen/workflows
go build ./statemachine/

# Run unit test:
go test -v ./tests -run TestTypesDefaults

Test file: tests/types_test.go

func TestTypesDefaults(t *testing.T) {
    // Verify all defaults are correctly set
    pr := PiRetryPolicy{}
    assert.Equal(t, 5*time.Minute, pr.ScheduleToCloseTimeout)
    // ... more assertions
}

Done Criteria

  • go build ./statemachine/ succeeds
  • go test ./tests -run TestTypesDefaults passes
  • All struct fields documented with default values
  • No compilation errors