27. Programs
Status: unimplemented โ design draft. This chapter is a plan for the owner to edit. It ships no code yet, and paths marked planned do not exist.
Premise
Plans so far are a step or a few. This chapter names the multi-step ones and stores them: a program is a typed workflow whose steps decide, call members or hand off work.
Draft
Some work has a known shape. Solving an issue is: read it, find the files, change them, run the checks, fix what failed, open the pull request. Reviewing a change has its own shape. So does answering a question from the knowledge base.
A program writes that shape down. It is a typed workflow, and each step is one of a few kinds. A decide step asks a decision model a pinned question. A call step runs a member. A delegate step hands a bounded task to an engine. Because the steps are typed, a program can be read, checked, measured and improved one step at a time.
The idea comes from the graphs of plugins in [Episode 75](../../docs/transcripts/075.md), through the separately improvable programs of Episode 242, to the state machines of Episode 286. The old tree shipped eight programs, among them solve-issue, review-changes, delegate-fan-out and answer-question. It also shipped twenty recipes, small workflows built on decision models for jobs such as ticket triage, log classification and citation checks.
A program is one of the four kinds of thing a person can contribute. The others are a plugin, a skill and a knowledge entry. Like any member, a program is a candidate until it is measured. A search for a better version of a program ships only through that measurement.
The front can call a program by name, and a program can call the front's members.
What we build
A plan for what this chapter ships once the draft is approved:
- A program format with decide, call and delegate steps, and a runner that logs each step.
- Ports of the first programs: solve-issue, review-changes and answer-question.
- A check that a program only calls members its grant covers.
It builds on what exists today:
- `openagents/core/query_loop.coax` and `openagents/core/tasks.coax` (unified execution loop and
/goalstate machine,#14083โ#14086; replaces deprecatedcoax/lib/microcoder/loop.coax,#13983) - `apps/openagents-desktop/page/goal.coax`
- `coax/lib/nostr/opt`
- `coax/lib/nostr/cj`
- `coax/lib/systemone`
On the protocol (chapter 65):
| Record | Schema | Carriage | Today |
|---|---|---|---|
| Program and its steps | openagents.program.v1 Program, Step, published by a ProgramHead (spec 20.1) | Nostr kind 30182 (NIP-PRG) | Spec sketch; no .proto file |
| A recorded step | openagents.program.v1 StepEnvelope (spec 20.1) | In the run journal (chapter 18) | Spec sketch; no .proto file |
The chapter's check
- Source: the program runner in
openagents/agent/programs/and the answer-question port, with a fake decision service and fake members. - Trace: the runner logs each step: the decide step with its pinned question's digest, the call step with its member, and the result. Each step is written to the run journal as a step record.
- Refusal: a program that calls a member its grant doesn't cover is refused before that step runs, with a reason that names the step and the member.
- Independent check: the old tree's answer-question program at
coder-v1.0.0, run on the same recorded inputs, takes the same sequence of steps.
Planned paths: openagents/agent/programs/.
Sources
- Episodes:
- Episode 75, *Run All Plugins*: running a graph of plugins
- Episode 114, *Planning & Execution*
- Episode 242, *Khala, Collective Intelligence*: independently optimizable programs
- Episode 286, *System One in Coding Agents*: explicit state and conditional instructions
- Old code at
coder-v1.0.0, crates:program-launch,workflow-run,briefed-agent - NIPs: NIP-PRG, NIP-OPT, NIP-DEC
- Also:
programs/*.jsonandrecipes/*.recipe.jsonatcoder-v1.0.0- Coder book, chapter 8: Programs as tool calls
- Promises covered (audit): P5, P6
Open questions for the owner
- Which of the twenty recipes come back, and are they members of the general agent or examples in this book?