ulc-loop

$npx mdskill add Kastalien-Research/thoughtbox/ulc-loop

Starts an autonomous improvement loop using Ralph Wiggum and ULC.

  • Solves the need for continuous autonomous task execution and backlog processing.
  • Depends on Ralph Wiggum plugin, Read, Bash, and Write tools.
  • Decides actions via ULC prompt and QD exploration when idle.
  • Delivers results by iterating through backlog and dispatching agents.

SKILL.md

.github/skills/ulc-loopView on GitHub ↗
---
name: ulc-loop
description: Start a Unified Loop Controller session via Ralph Wiggum. Autonomously works through backlog, dispatches agents, and explores via QD when idle.
argument-hint: "[--budget N] [--max-iterations N]"
user-invocable: true
allowed-tools: Read, Bash, Write
---

# ULC Loop

Start an autonomous improvement loop powered by Ralph Wiggum.

## Setup

Parse arguments from: $ARGUMENTS

Defaults:
- `--budget`: 5 (USD)
- `--max-iterations`: 20

## Workflow

### Step 1: Pre-flight Checks

1. Verify Ralph Wiggum plugin is installed:
   ```bash
   ls .claude/plugins/cache/claude-code-plugins/ralph-wiggum/ 2>/dev/null || echo "NOT INSTALLED"
   ```
   If not installed, tell the user to run: `claude plugin install ralph-wiggum@claude-code-plugins`

2. Check for existing Ralph loop:
   ```bash
   cat .claude/ralph-loop.local.md 2>/dev/null && echo "ACTIVE" || echo "INACTIVE"
   ```
   If ACTIVE, warn: "A Ralph loop is already running. Run `/cancel-ralph` first."

3. Check git state is clean:
   ```bash
   git status --porcelain
   ```
   If dirty, warn and suggest committing first.

### Step 2: Read the ULC Prompt

Read the ULC decision procedure from `.claude/skills/ulc-loop/ulc-prompt.md`.

### Step 3: Initialize ULC State

Create the initial ULC state file if it doesn't exist:

```bash
cat > .claude/ulc-state.local.json << 'EOF'
{
  "iteration": 0,
  "cumulative_cost_usd": 0,
  "budget_usd": <BUDGET>,
  "actions": [],
  "exploration_misses": 0,
  "started_at": "<ISO timestamp>"
}
EOF
```

Replace `<BUDGET>` with the parsed budget value.

### Step 4: Create Ralph State File

Write `.claude/ralph-loop.local.md` with YAML frontmatter and the ULC prompt as the body:

```
---
active: true
iteration: 1
max_iterations: <MAX_ITERATIONS>
completion_promise: "BUDGET EXHAUSTED OR ALL WORK COMPLETE"
started_at: "<ISO timestamp>"
---

<contents of ulc-prompt.md>
```

### Step 5: Confirm and Start

Output:
```
ULC Loop activated via Ralph Wiggum.

Budget: $<budget> USD
Max iterations: <max_iterations>
Completion promise: "BUDGET EXHAUSTED OR ALL WORK COMPLETE"

The loop will:
1. Check backlog for ready work
2. Dispatch sub-agents for substantial tasks
3. Explore via QD when backlog is empty
4. Stop when budget is exhausted or all work is complete

State file: .claude/ulc-state.local.json
Ralph state: .claude/ralph-loop.local.md

Starting first OODA cycle...
```

Then immediately begin executing the ULC prompt — perform the first OODA cycle (Observe → Orient → Decide → Act).

## Notes

- The ULC prompt is re-fed by Ralph's stop hook on each iteration
- Inter-iteration continuity is via `.claude/ulc-state.local.json` and git
- Sub-agents are dispatched via Task tool with `subagent_type: "general-purpose"`
- Cost tracking is approximate — the agent estimates based on model and turns
- The loop does NOT push to remote — human reviews and pushes

More from Kastalien-Research/thoughtbox

SkillDescription
assumptionsManage the assumption registry — track, verify, and query assumptions about external dependencies and system behavior. Prevents costly rediscovery of known failures.
capture-learningCapture significant learnings from the current work session. Structures insights for future sessions and updates agent memory.
claude-opus-4-6-prompting>
claude-promptWrite or improve prompts for Claude using Anthropic's official best practices. Creates system prompts, agent prompts, tool descriptions, and MCP resource templates. Pass an existing prompt to improve it, or describe what you need to create one from scratch.
coolify-composeConvert Docker Compose files to Coolify templates. Use when creating Coolify services, converting docker-compose.yml for Coolify deployment, working with SERVICE_URL/SERVICE_PASSWORD magic variables, or troubleshooting Coolify compose errors.
crafting-effective-readmesUse when writing or improving README files. Not all READMEs are the same — provides templates and guidance matched to your audience and project type.
diagramGenerate architecture diagrams for a codebase subsystem or module. Explores source files and produces Mermaid diagrams in docs/.
diataxisStructure, classify, and write documentation using the Diátaxis framework. Use when writing docs, README files, guides, tutorials, how-to guides, API references, or organizing documentation architecture. Also use when asked to improve documentation, restructure docs, decide what type of doc to write, or classify existing content. Covers tutorials, how-to guides, reference, and explanation.
escalateFormat a structured escalation to the human decision-maker (Chief Agentic). Use when hitting an escalation threshold.
frontend-design-principlesCreate polished, intentional frontend interfaces. Use this skill when building any UI — dashboards, admin panels, landing pages, marketing sites, or web applications. Routes to specialized guidance based on context.