Unofficial Hacker News companion — get notified on comment replies, and more.

A Visual Guide to Agent Harnesses (opens external site)

452 points by mariuz 2 days ago | newsletter.maartengrootendorst.com | 80 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (13)

  1. How does pi let the agent edit the harness?
    Replies (2)
    1. There is pretty much no sandbox behaviour at all, so it can read and write files across the entire system. What pi does in its system prompt is tell the agent where it can find markdown files that explain skills and extensions alongside examples. If you prompt it to make a new skill or extension it will then go about doing so and inserts them into either ~/.pi/ or the current directory .pi depending on what makes most sense on what you asked.

      I have made one extension called globalstats which iterates over all the sessions and costs up everything across various agents (with locals being negative price of the most common used cloud option, sort of money saved) and I have some skills about accessing dev servers and where to find the docker settings and up/down aliases so it can add things.

      Replies (2)
      1. I use pi extensions liberally, but I also used claude config for similar extensions. For sure, pi is way more extensible and I prefer it. I just don't think it's so mind blowing as people think. It's basically the simplest harness you can get, with well defined extension mechanisms.
      2. > There is pretty much no sandbox behaviour at all, so it can read and write files across the entire system.

        It does provide hooks, so tool calls can be intercepted/gated/etc. The first thing I did with pi was have it write an extension that asks for permission for each Bash invocation. I've extended that with a simple Python script which auto-denies known-bad things (e.g. running find on /), auto-allows known-safe things (e.g. non-destructive text processing pipelines), and asks me for anything else.

        Its tools can also be switched-out; e.g. I've replaced its read/write/edit tools with alternatives which invoke emacsclient. There's no reason you couldn't replace its tools with sandboxed alternatives, if you wanted.

    2. pi injects docs for extending itself into the system prompt. You just tell the agent what features you want, and it knows how to do the rest.
      Replies (1)
      1. Do you have an example of how you'd use this?
        Replies (2)
        1. I use pi from Emacs, via its RPC interface (I hate TUIs). I've replaced pi's reading/writing tools with alternatives which invoke emacsclient. That way:

          - Emacs buffers remain up to date (rather than the on-disk content changing underneath it).

          - I can use ordinary undo, etc. on changes made by pi.

          - Various editor conveniences are automatically applied, e.g. auto-formatting of code; showing the contents of compressed files; etc.

          - The LLM is given extra metadata, like warnings from linters/compilers/LSP/etc.

          - The same tools work for buffers which aren't files (e.g. shells, Web browser, etc.)

          Replies (2)
          1. I for one would love this!
          2. Clever. So pi drives emacs via emacsclient, and you use emacs.

            So it's pair programming with the machine in the best sense.

            Though I don't understand how read/write works with emacsclient and pi. Care to share?

            Replies (1)
        2. I said I want it to support voice dictation. It downloaded whisper, cursed at ALSA, and eventually gave me a button to press to talk.

          ...and 20 features later I realized I just need to download omp.sh

          Replies (1)
          1. Great... New rabbit hole.