Goal-Driven Autonomy
Set a target with --goal and the run loop checks it when the agent tries to stop. Since v0.4, Goal is a dedicated agent mode: when --agent is omitted, swust-code run --goal ... routes to the goal agent and injects goal-specific prompts and reminders.
Usage
bash
swust-code run --goal "fix all TypeScript errors" "start working"Flow
- User sets a goal with
--goal - CLI selects the
goalagent unless--agentis explicit - The agent runs normal tool calls
- Goal Gate triggers when the agent is ready to stop
- The runner builds a transcript and resolves the current model
- Goal Judge calls
LLM.generateObject()for{ ok, impossible, reason } - If not satisfied, a synthetic reminder is published and the agent continues
- If satisfied or impossible, the goal is cleared and the run stops
Goal Judge
The Judge uses a separate system prompt and is instructed to evaluate concrete evidence such as code changes, tests, file state, and tool output.
| Behavior | Current implementation |
|---|---|
| Output | Verdict schema: ok, impossible, reason |
| Sampling | temperature: 0, maxTokens: 500 |
| Context | User text, assistant text, reasoning, tool success/error results, shell output, compaction summaries |
| Failure policy | If Judge evaluation fails, it returns not-satisfied and continues |
Re-entry Control
| Role | Max Re-entries |
|---|---|
| Main Agent | 12 |
After the cap is exceeded, the goal is cleared to prevent an infinite loop.
Task Gate
taskGate() can force continuation for non-terminal tasks. v0.4 also adds durable Task Registry and actor task binding, so task-oriented subagents can start, complete, or block tasks through the runtime.