Skip to content

[Gastown] PR 13: Molecule/Formula System #219

@jrf0110

Description

@jrf0110

Parent: #204 | Phase 2: Multi-Agent Orchestration

No major architectural changes — molecules work the same in the container model. Tool calls go through the same DO RPCs.

Goal

Multi-step workflows so polecats can self-navigate through complex tasks.

Molecule Lifecycle

  1. Work bead is created with a formula (JSON step definitions)
  2. On sling, the Rig DO creates a molecule record with current_step = 0
  3. gt_mol_current returns the current step
  4. gt_mol_advance closes current step, increments to next
  5. When all steps are closed, the molecule is complete → triggers gt_done equivalent

New Tools (added to plugin)

Tool Description
gt_mol_current Get current molecule step (title, instructions, step N of M)
gt_mol_advance Complete current step with summary, advance to next

Rig DO Changes

  • Molecule CRUD methods
  • Step advancement logic with validation
  • Auto-trigger done flow when final step completes
  • Molecule status tracking (active, completed, failed)

Formula Format

{
  "steps": [
    { "title": "Set up database schema", "instructions": "Create the migration..." },
    { "title": "Implement API endpoints", "instructions": "Add REST endpoints for..." },
    { "title": "Write tests", "instructions": "Add unit tests covering..." }
  ]
}

Dependencies

  • PR 1 (Rig DO — molecules table)
  • PR 3 (Tool Plugin — new tools)

Acceptance Criteria

  • Molecule CRUD in Rig DO
  • gt_mol_current and gt_mol_advance tools in plugin
  • Step advancement with validation (can't skip, can't go back)
  • Auto-done on final step completion
  • Formula JSON schema defined and validated
  • Sling mutation updated to support molecule creation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions