UNOUNOCODE

AUTOMATE

CI and scripts

Because uno -p never waits for input and always ends with a clear exit code, it drops into CI jobs, git hooks and cron.

IN ONE LINEInstall with the one-liner, pass the key as a secret, cap the cost, check the exit code.

A CI job that fixes lint

# .github/workflows/uno-lint.yml
name: uno lint fix
on: workflow_dispatch
jobs:
  fix:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: sudo apt-get install -y bubblewrap
      - run: curl -fsSL https://unocode.motiontic.com/install.sh | sh
      - run: |
          ~/.local/bin/uno -p "run the linter and fix every error it reports" \
            --allow "bash(npm run lint)" --max-cost 0.50 --output json > uno.json
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
          UNO_SPEND_CAP_USD: "2"
      - run: jq -r .result uno.json >> "$GITHUB_STEP_SUMMARY"
      - run: git diff --stat

Add a step that commits or opens a pull request if you want the fix kept. Uno does not push on its own.

MIND THE ALLOW RULE

bash(npm run lint) runs whatever package.json says lint is, outside the sandbox, and Uno can edit package.json. Prefer naming the tool itself, such as bash(npx eslint), in a job that holds secrets.

A pre-commit review

#!/bin/sh
# .git/hooks/pre-commit: ask Uno to look over the staged diff, read-only
uno -p "list real bugs in this diff, or say LGTM: $(git diff --cached)" --mode plan --model claude-haiku-4-5

A very large diff can be too long for one argument (128 KB on Linux). Pipe it instead, without -p: the piped text is the whole prompt.

{ echo "list real bugs in this diff, or say LGTM:"; git diff --cached; } | uno --mode plan

A nightly job with cron

# crontab -e
0 3 * * * cd ~/code/my-app && uno -p "update minor dependencies and make the tests pass" --max-cost 1 >> ~/uno-nightly.log 2>&1

Check the result in a script

uno -p "make the tests pass" --output json > out.json
case $? in
  0) echo "done: $(jq -r .cost_usd out.json) USD" ;;
  2) echo "needs a say-so: $(jq -r '.error // "\(.refused) calls were refused"' out.json)" ;;
  3) echo "stopped early: $(jq -r .exit out.json)" ;;
  *) echo "failed: $(jq -r '.error // .exit' out.json)" ;;
esac

With --output json the summary is printed however the run ends, even when it fails before it starts: exit is done, max_tokens, turn_limit, too_long, refusal (with refusal_category when the provider gives one), deadline (--deadline reached), error (with error, such as the cost limit or no key), blocked (a UserPromptSubmit hook stopped the prompt; with error), or interrupted (stopped by a signal, such as a CI timeout; with signal). cost_usd, turns, usage and output_limit_continues (how many replies cut off at the output limit the run carried on from) are always there.

Give a job with a time limit --deadline a little under it, so Uno finishes and reports before the job is killed.

PIPE LONG PROMPTS

A prompt given with -p is part of Uno's command line, which any process on the machine can read with ps. A command the model runs, such as pkill -f "node server.js", matches it too when the prompt names that program, and stops Uno itself. Pipe a task's prompt on standard input instead: uno --output json < prompt.txt. The piped text is the whole prompt, and the other flags work as with -p, except --image: name an image in the text with @ instead.

COMING

--output stream-json (events as they happen) and uno schedule (writes the cron or launchd entry for you) are planned. Until then, cron plus -p does the job.