Examples

naoru examples

An illustrative target repo + leaf sets you can run end-to-end without any toolchain.

Try it (the LLM is inherited from your host config — see onboarding):

cp -r examples/sample_repo /tmp/naoru-demo && (cd /tmp/naoru-demo && git init -q && git add -A && git commit -qm seed)
naoru run --accept-license "I ACCEPT" --mission test-and-fix-bugs --leaves examples/leaves.toml --repo /tmp/naoru-demo

The fix loop runs the check (RED), lets the model edit the repo in an isolated worktree, re-runs the check, and commits only if the red-first oracle accepts RED→GREEN.

These leaves are illustrative. For a real project, point each command at that project's own machine-checkable command and refine the predicate, timeout, and fix_focus. See leaf authoring guide for real project leaf design; this sample stays toolchain-free and is illustrative rather than production-quality.

leaves.toml

# naoru example leaf set (TOML — the human-authoring format).
# Illustrative only: `sample_repo/status.txt` ships seeded to "failing"; the bug leaf below is
# RED until the file reads "passing". A
# `naoru run --accept-license "I ACCEPT" --mission test-and-fix-bugs` drives the fix loop.
#
# `command` is an arbitrary argv for ANY ecosystem — here a portable shell check so the example
# needs no toolchain. Point `command` at your personal test repo's check command for real use.
# For real project leaf design, see docs/guides/leaf-authoring.md or `naoru help leaf-authoring`.

[[leaves]]
id = "status-passing"
command = ["sh", "-c", "grep -qx passing status.txt"]
description = "GREEN when status.txt reads 'passing'. Seeded RED to demonstrate the fix loop."
fix_focus = "Make the status check pass."
max_fix_loops = 2

  [leaves.predicate]
  kind = "exit_code"
  expected_exit = 0

# An illustrative performance leaf (disabled by default). For `--mission improve-performance`,
# a METRIC predicate parses a number from stdout and the gate commits only a measured improvement
# with no regression. Enable + point at your own benchmark command to use it.
[[leaves]]
id = "benchmark-latency"
command = ["sh", "-c", "echo elapsed=1.00s"]
description = "Illustrative perf leaf: parses 'elapsed=<n>s' and improves it (lower is better)."
enabled = false

  [leaves.predicate]
  kind = "metric"
  metric_pattern = "elapsed=([0-9.]+)s"
  metric_direction = "lower"
  min_improvement = 0.05

leaves.json

{
  "_comment": "naoru example leaf set (JSON — the LLM-authoring format; equivalent to leaves.toml). 'command' is an arbitrary argv for any ecosystem; point it at your personal test repo's check command. For real project leaf design, see docs/guides/leaf-authoring.md or `naoru help leaf-authoring`.",
  "leaves": [
    {
      "id": "status-passing",
      "command": ["sh", "-c", "grep -qx passing status.txt"],
      "description": "GREEN when status.txt reads 'passing'. Seeded RED to demonstrate the fix loop.",
      "fix_focus": "Make the status check pass.",
      "max_fix_loops": 2,
      "predicate": { "kind": "exit_code", "expected_exit": 0 }
    },
    {
      "id": "benchmark-latency",
      "command": ["sh", "-c", "echo elapsed=1.00s"],
      "description": "Illustrative perf leaf: parses 'elapsed=<n>s' and improves it (lower is better).",
      "enabled": false,
      "predicate": {
        "kind": "metric",
        "metric_pattern": "elapsed=([0-9.]+)s",
        "metric_direction": "lower",
        "min_improvement": 0.05
      }
    }
  ]
}

sample_repo/status.txt

failing