Skip to main content
ClaudeWave
Skill832 repo starsupdated yesterday

creating-a-coral-task

Author a new CORAL task — the three pieces that must line up (`task.yaml`, `seed/`, a packaged `grader/`), the `coral init` → `coral validate` → smoke-test loop, and how to pick a grader pattern (stdout float, test pass-rate, ratio-vs-baseline, multi-metric, or an LLM rubric judge). Use whenever the user wants to create a CORAL task, write or wire a grader, port a benchmark into CORAL, score open-ended outputs (reports/memos) with a judge, or debug a grader that crashes on the seed / ranks the leaderboard backwards / leaks the answer key. Deep references for the TaskGrader API, grader patterns, rubric judges, and the full task.yaml schema live alongside this skill.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/Human-Agent-Society/CORAL /tmp/creating-a-coral-task && cp -r /tmp/creating-a-coral-task/plugin/skills/creating-a-coral-task ~/.claude/skills/creating-a-coral-task
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Creating a CORAL task

A CORAL task is **three things that must line up**. Scaffold them with `coral init`, then iterate `edit → coral validate` until the grader scores the seed.

```
my-task/
├── task.yaml      # config: name, description, grader entrypoint, agent count
├── seed/          # starter code agents see at t=0 (this is workspace.repo_path)
│   └── solution.py
└── grader/        # standalone Python package — gets its own isolated venv
    ├── pyproject.toml
    └── src/my_task_grader/
        ├── __init__.py
        └── grader.py     # class Grader(TaskGrader): ...
```

The packaged grader is the **only supported form** — it gives the grader an isolated venv and bundles everything the eval needs (grader code, helpers, hidden answer keys). There is no `eval/grader.py` auto-discovery anymore.

> **Optimizing code the user already has?** Scaffold inside a `.coral_workspace/` at the root of their project (gitignored), and copy the code to optimize into `seed/` — keeps CORAL's task/results out of their source tree. The `coral-quickstart` skill has the end-to-end `.coral_workspace/` flow; this skill covers the grader you'll write once the code is in `seed/`.
>
> **"Optimize this" is a build instruction, not a question — never answer it with a process menu.** A 1/2/3 like "point me to a task / create one / optimize outside coral" is the failure mode; do not produce it. The absence of a `task.yaml` is not ambiguity — it just means you build one from the current repo. Concretely: (1) dig for what's already measurable — a research/framework repo almost always ships an eval/benchmark script, a test suite, or a metric in its README/paper; that's your target and metric. (2) If no single number is obvious, **construct** one by wrapping the repo's existing evaluation — don't conclude "no measurable objective" just because there's no CORAL scaffold. (3) Scaffold the most plausible target and start building (a `.coral_workspace/` + draft grader is cheap and reversible); state your assumption in one line and proceed. (4) Only as a last resort, if you've actually read the repo and it exposes nothing scorable, propose 2-3 **concrete** optimization targets you found (each with its metric), pick the most likely, and scaffold that — still not a process menu.

## The loop

```bash
coral init my-task        # scaffold all three pieces (a runnable end-to-end example)
cd my-task
# ... edit the three pieces for your problem ...
coral validate .          # bootstraps the grader venv, runs the grader on seed/, prints a score
# repeat edit → validate until the seed scores as you expect
```

**`coral validate` succeeding is the one checkpoint that matters** — it proves the grader can score the seed. Most "agents are stuck, every eval fails" reports trace to a grader that crashes on the seed, which validate would have caught. Always start from `coral init` rather than hand-writing the layout; the generated files are the canonical minimal example.

## The three pieces

**1. The seed** (`seed/`) — what the agent checks out at t=0 and what the grader later scores. The contract between seed and grader is the **program file**: a file (e.g. `solution.py`) with a function or stdout convention the grader invokes, named in `grader.args.program_file`. Put a **real, runnable baseline** here — agents should `coral eval` immediately and get a non-zero score to beat. A skeleton that crashes is a bad baseline. Runtime data goes under `seed/data/` and is read by relative path.

**2. The grader** (`grader/`) — subclass `TaskGrader`, implement `evaluate()`, return a number (or `ScoreBundle`). The minimum:

```python
from coral.grader import TaskGrader

class Grader(TaskGrader):
    def evaluate(self) -> float:
        result = self.run_program(self.args.get("program_file", "solution.py"))
        if result.returncode != 0:
            return self.fail(f"crashed: {result.stderr[:200]}")
        try:
            return float(result.stdout.strip())
        except ValueError:
            return self.fail(f"expected a float, got {result.stdout[:80]!r}")
```

This stdout-float shape is one of several. **Pick the pattern that matches how your task scores** → [references/cookbook.md](references/cookbook.md):

| Score by... | Pattern |
|---|---|
| A number the program prints | stdout float |
| Fraction of hidden tests passing | test pass-rate |
| Improvement over a baseline | ratio vs baseline |
| Several weighted criteria | multi-metric `ScoreBundle` |
| An LLM judging a report/memo/doc | rubric judge → [references/rubric-judges.md](references/rubric-judges.md) |

Full `TaskGrader` surface — every attribute (`self.codebase_path`, `self.private_dir`, `self.args`, `self.eval_logs_dir`, `self.tune`) and method (`run_program`, `run_script`, `run_script_json`, `score`, `fail`, `bundle`) — is in [references/grader-api.md](references/grader-api.md).

**3. The task.yaml** — wiring. The fields that must be right are `grader.entrypoint`, `grader.direction`, and `workspace.repo_path: ./seed`. Full annotated schema (agents, islands, sharing, gateway, all defaults) → [references/task-yaml.md](references/task-yaml.md).

## Hidden data

Answer keys, hidden fixtures, and any secret the agent must not see go under **`grader.private`** in task.yaml — CORAL copies those paths into `.coral/private/` (which every runtime is denied read access to) and the grader reads them via `self.private_dir`. Do **not** rely on a packaged `taskdata/` dir (`Path(__file__).parent / "taskdata"`) to hide answer keys: graders are installed editable (`uv pip install -e ./grader`), so the package source stays in the task tree and agents can read it by absolute path — `taskdata/` is bundled with the grader, but it is **not** hidden. Reserve `Path(__file__).parent` for grader code and non-secret helper data. Never put an answer key under `seed/` either — agents read `seed/` and will game the score.

## Smoke-test, then scale

```bash
coral start -c task.yaml agents.count=1 r
coral-debugSkill

Verify and debug changes to CORAL itself — smallest reproduce loop per area (grader / daemon / CLI / hooks / manager / workspace / hub / template / config / web), where to look when something breaks (hung graders, agent restart loops, stalled agents, missing heartbeat actions, corrupted shared state, broken worktree symlinks, grader import errors, wrong-task resume), how to inspect a live or finished run under `.coral/public/`, and the canonical lint/test commands. Use when editing code under `coral/` or chasing a CORAL bug, NOT when adding a new task or extending the framework.

coral-extendSkill

Add a new component to the CORAL framework itself — a new agent runtime under `coral/agent/builtin/` (claude_code/codex/cursor_agent style), a new CLI command in `coral/cli/`, a new bundled skill or subagent template under `coral/template/skills/` or `coral/template/agents/`, a new hook in `coral/hooks/`, a new field in `coral/config.py`, or a framework-level extension to the grader stack under `coral/grader/`. NOT for writing a per-task grader or adding an example task — use `coral-new-task` for that. NOT for debugging existing code — use `coral-debug`.

coral-new-taskSkill

End-to-end recipe for adding a new task under `examples/` — the three pieces that have to line up (`task.yaml`, `seed/`, and `grader/`), what to put in each, the `TaskGrader` API surface, the `coral validate` → smoke-test loop, and the common mistakes (repo_path pointing at the wrong dir, score direction backwards, hidden answer keys leaking into seed/, grader writing to codebase_path which the daemon force-removes, private-vs-public confusion, missing `run()` signature). Use whenever the user wants to add a new CORAL task or port an existing benchmark into CORAL.

deep-researchSkill

Research the problem domain before coding. Web search for techniques, save raw sources, write structured findings, update the index.

organize-filesSkill

Organize the shared notes directory when it becomes hard to navigate. Restructure within research/ and experiments/, deduplicate, update index.md.

skill-creatorSkill

Autonomously create, test, and optimize skills by detecting reusable patterns in your own work. Use when you notice repeated tool sequences, recurring code patterns across attempts, or insights that should be captured as a packaged skill. Also use to benchmark and iterate on existing skills.

coral-quickstartSkill

The fast path from zero to a running CORAL experiment — what CORAL is and when to reach for it, installing the `coral` CLI, registering a runtime with `coral setup`, and the `.coral_workspace/` convention for pointing CORAL at code you already have and want optimized. Use this whenever the user asks "what is coral", "should I use coral for this", wants to install or get coral set up, hits a "command not found" for coral or doesn't have it installed yet, or says "use coral to optimize / speed up / improve this code" and you need the end-to-end onboarding from install to a launched run. Hands off to `setting-up-coral` (runtime bindings), `creating-a-coral-task` (grader authoring), and `running-coral-experiments` (operating a run) for depth.

running-coral-experimentsSkill

Run and manage CORAL experiments from the operator side — launch agents with `coral start` (dotlist overrides, model/count, tmux vs local), monitor with `coral status` / `coral log` / `coral show` / the web dashboard, and drive the loop with `coral resume` (inject instructions, fork from an attempt), `coral heartbeat` (tune reflection cadence), and `coral stop`. Use whenever the user wants to start a CORAL run, check on agents, read scores/leaderboard, steer or resume a run, diagnose agents that keep restarting or fail every eval, scale to more agents or islands, or stop a run. Deep references for steering/heartbeat tuning and scaling/troubleshooting live alongside this skill.