A long run

An agent improves a web page in rounds for half an hour: edit, check it in the browser, commit, push, watch CI, notify you, repeat.

You need complier installed, with complier doctor saying ready (see Install), the GitHub CLI signed in, and Claude in Chrome connected to Claude Code.

  1. Read the contract

    It comes with the project, in .complier/loop/workflow.csp. Each round: check the time, make up to 15 edits, look at the page in the browser (the only way out of editing), commit, push, watch CI, notify you, and check the time again. The time check's result is bound at the start and compared at the end:

    workflow.csp
    Policy = Permit(check_time, Start)
    Start(minutes.t) = Edit(t, 0)
    
    Check(s) = Permit(check_time, \ v @ Decide(s, v))
    Decide(s, minutes.now) = if (now - s + 120) % 120 >= 30 then SKIP else Edit(s, 0)

    Under 30 minutes, another round; otherwise it's done. Until then, complier won't let the agent stop.

  2. Make your own copy of the page

    The agent pushes, so it works on a copy in your own GitHub account, with CI:

    Terminal
    git clone https://github.com/kavishsathia/complier-loop-test ~/loop-long
    cd ~/loop-long
    Terminal
    git remote remove origin
    gh repo create loop-long --private --source . --push

    Serve the page so the browser can open it, and leave this running:

    Terminal
    python3 -m http.server 8799
  3. Start the machine

    In a second terminal, from ~/loop-long:

    Terminal
    complier machine up loop .complier/loop
    complier machine log loop --follow

    For a quick try, lower 30 in .complier/loop/workflow.csp to a few minutes before starting it.

  4. Start Claude Code on it

    In a third terminal, from ~/loop-long. Check the browser is connected with /chrome once it opens:

    Terminal
    COMPLIER_MACHINE=loop COMPLIER_ROLE=dev claude --chrome --plugin-dir ~/.complier/plugin

    Then give it the task, which is also in .complier/loop/prompt.md:

    prompt
    Keep improving the field notes page in this repository (index.html and style.css): for example, add a
    few more birds with a short note on each, and make the page look nicer. Only edit those two
    existing files.
    
    Work in rounds, in exactly this order:
    1. Check the time with `date +%s`.
    2. Make your edits with Edit or Write: at most 15 per round.
    3. Look at the page in Chrome at http://localhost:8799/ (at least one browser action). Once you've
       started checking in the browser, you can't edit again this round.
    4. Commit with `git commit -am "..."`, then push with `git push`.
    5. Watch the CI run for that push with the Monitor tool (for example `gh run watch --exit-status`).
    6. Send me a push notification that the commit is done.
    7. Check the time again with `date +%s`.
    
    complier enforces this order and decides when the work is done: keep going round after round
    until it lets you stop.
  5. When it's done

    The log ends with finished once a round ends 30 minutes after the first time check. Stop the machine with complier machine down loop, and the page server with Ctrl-C.