drob518 24 minutes ago

So, writing an agent in Lisp is interesting but not particularly novel. If there’s a big idea here it’s giving Lisp’s eval function to the AI as a tool. Yes, AIs write Python and Bash all day long already, but those scripts are run out of process. In this case, the AI can modify the process running the harness, extending it directly and potentially changing it (evolving it). That’s powerful. And obviously quite dangerous. Definitely only for a sandbox. But I wonder how far that can go…

  • Shorel 19 minutes ago

    Now this is AI going full circle, back to their roots. Yeah, I want to see that system working.

goranmoomin 5 hours ago

I like Lisp, I’ve used Common Lisp with a passion, but this doesn’t seem like a valid argument for Lisp.

Homoiconicity, as I understand, is that the code is structured data that is easy to programmatically modify, hence allowing Lisp macros. While some might disagree, I see Rust macros as the closest thing that demonstrates homoiconicity in mainstream Algol-based languages, as Rust macros modify the loosely structured token stream to produce new Rust code.

Eval, on the other hand, that’s more of a capability that comes from Lisp’s runtime, which used to be unique when Lisp was thriving, but not anymore — JS, Python, Ruby, all of the runtime-based languages have an eval function. The fact that they are not used as much is more of a security issue, not a capability issue, and I am not sure how having eval can be argued as Lisp being the language of agents.

  • galaxyLogic 4 hours ago

    A Lisp program that writes a Lisp program really just needs to produce a list of (nested lists) of tokens. A JavaScript program that writes a javascript program needs to generate a string that is syntactically valid JavaScript code. That is a much bigger task than just constructing a (nested) list.

    Because Lisp syntax is so much simpler than that of JavaScript etc. it is much easier to avoid errors when generating code. In JavaScript you can use JSON to generate data, but JSON can not carry functions around.

    I think this idea makes a lot sense. Instead of making the LLM generate JSON or XML, why not make it generate Lisp, which can carry both programs and data?

    • goranmoomin 4 hours ago

      > A Lisp program that writes a Lisp program really just needs to produce a list of (nested lists) of tokens. A JavaScript program that writes a javascript program needs to generate a string that is syntactically valid JavaScript code. That is a much bigger task than just constructing a (nested) list.

      > Because Lisp syntax is so much simpler than that of JavaScript etc. it is much easier to avoid errors when generating code. In JavaScript you can use JSON to generate data, but JSON can not carry functions around.

      First of all, the LLM does not produce structured tokens, it produces (tokens of) text. It does not have a concept of nested or structured tokens. Which means that producing a Lisp program and a JavaScript program is basically the same difficulty, i.e. LLMs producing function foo () {} is about the same task as producing (defun foo () ()).

      In fact, because most Lisps uses the same token ( and ) for almost all delimiters, the LLM in fact gets confused a lot more than Algol-family languages that uses various different tokens for different purposes. It generates thinking traces that are a few screens long while trying to count the closing parenthesis and the depth, something that I have not found to be the case for other languages, even with languages much more obscure than Lisp. (And no, it is not a training data issue, because the Lisp family as a whole is pretty well represented in the data set, due to Emacs Lisp.)

      > I think this idea makes a lot sense. Instead of making the LLM generate JSON or XML, why not make it generate Lisp, which can carry both programs and data?

      You do realize that all programming languages contains both programs and data, right? i.e. JSON is literally a subset of the JavaScript language, all JSON documents are valid JavaScript code, can be embedded in JavaScript programs, and so on. This isn't even a JavaScript-specific thing, almost all recent programming languages have data structure literals.

      The thing that makes Lisp unique is that it can modify programs as data in the language easily, and why would that be a unique capability that would be beneficial for LLMs, when it can just sed/awk or tree-sitter-parse programs with more conventional languages and modify it as easily?

  • miki123211 2 hours ago

    > I see Rust macros as the closest thing that demonstrates homoiconicity in mainstream Algol-based languages

    I don't know if you consider Elixir mainstream, but IMO their macro system is much closer to lisp's ideal.

    Elixir is basically Lisp, but with better syntax, a modern ecosystem, and running on the Beam. Unlike languages like Rust, Elixir's conditionals and function definitions are just calls in the AST, even though the syntax looks mainstream and not like paren soup.

    • embedding-shape 2 hours ago

      > Elixir is basically Lisp, but with better syntax

      Which so helpfully removes many of the benefits of lisps :P I don't understand this argument at all, if it's not s-expressions nor quacks like a lisp, in what way is it lisp at all? Making it algol/C-like already makes it like the rest of the 99% of the languages, without any of the easy benefits of the neat and simple syntax of lisps.

      • drob518 35 minutes ago

        Agreed. You can tell when someone “gets it” or not by whether they see sexprs as a problem to be overcome or a benefit to be embraced. Count me firmly in the benefit camp.

  • Shorel 18 minutes ago

    It's not just eval. It's LISP macros what makes it an interesting powerful language for agents.

  • ignoreusernames 11 minutes ago

    > Homoiconicity, as I understand, is that the code is structured data that is easy to programmatically modify

    I think a more accurate description is that lisp code is just cons cells and cons cells is both how we write the code and how the runtime itself implements lists. So there’s basically no distinction between a lisp list and the text representation of the source. Rust and its macros is a different situation because the text representation of the code and the syntax tree have completely different shapes

rcarmo 2 hours ago

This is a thing of beauty, no matter what the general feeling in the comments seems to be against LISP. And yeah, you can do it in JS/TS/Python/etc., but somehow it doesn’t feel as elegant.

skapadia 1 hour ago

This is beautiful, I can't deny that. But the claim that Claude Code is a fixed set of tools is quite wrong. Claude Code regularly generates new code to carry out tasks, and you can choose to promote those tasks to skills, workflows, etc.

hankbond 8 hours ago

Maybe this is a reductive comment, but how does this differ from just letting your agent bash tool a `python -c` command (or anything of that class)? I'm not really getting where this is a "wow" moment?

It is always nice to appreciate how much power you get out of (Model + the absolute bare minimum of control flow). There is just so much baked into the models now that given an inch they will take a mile.

  • pama 7 hours ago

    The blog is about writing an agent when you dont already have an agent, but only a plain LLM. It stitches the minimal pieces together. Agents dont need lots of supporting infra, so it is good to keep the code concise. Not a wow moment for sure, though some people think that agents and harnesses are complicated.

    • jstanley 4 hours ago

      Right but given that the agent only outputs text, and agents are perfectly happy writing python, the supposed benefit of Lisp is completely irrelevant here.

      • embedding-shape 1 hour ago

        > the supposed benefit of Lisp is completely irrelevant here

        Yeah, it's a small example (it's in the title, "100 lines") so obviously doesn't highlight the best benefits once you reach larger codebase size.

        Still think ~8 lines for the core loop is probably more elegant, readable and concise than you can achieve in other algol/C-like languages, but happy to be shown that I'm wrong :)

  • lelandbatey 7 hours ago

    By my eye it's not that different, it's riffing in it from a Lisp perspective.

    It's pretty amazing to write your own agent BTW. I've got a zero-dependency all-in-one-file agent harness I wrote myself. I use it all the time now because I can get it from anywhere and I can know EXACTLY what it'll do (as much as you can with any model), what it's been told vs not. Using it as a harness for models I'm hosting myself makes me feel like some kind of LLM homesteader: it's a set of tools I'll always have that will only change as much as I want it to change.

  • wild_egg 7 hours ago

    You're not wrong. I did a similar agent in lisp back with Sonnet 3.5 and had a wow moment, but the wow was mostly for seeing an agent working effectively at all at that point in time.

    The part that killed it for me was losing everything if the lisp crashed (sonnet 3.5 was prone to doing that) and solving persistence had too many edge cases and confused the model.

    Later realized that writing the agent as 20 lines of bash was equivalently powerful to the lisp agent, but made persistence trivial from the easy file system interop.

    • josefrichter 2 hours ago

      you can use LFE (Lisp flavored erlang) = lisp on BEAM runtime.

      you get a snippet from LLM, compile it to module, and hot-load it into the running node. the module lives in the node's code table, so it persists and every other agent can call it. not just the one that wrote it.

      the agents themselves are seaprate supervised processes, so if one crashes - e.g. because the snippet was crap, it doesn't take down whole system.

      of course you can do that in just elixir too, the lisp is just cosmetics really.

  • slim 4 hours ago

    this is as if python was written in python, and you added support for llm in python so that it can write it's own code

  • kmeaw 3 hours ago

    If you give your agent a `bash` or `python -c` tool, it starts a separate process that produces some output and then exits. After that, only the output and the exit code are available.

    In contrast, `eval` runs the code in the same execution context as the agent loop. When `eval` finishes, that execution context still exists. For example, any functions defined during an `eval` call remain available for later use.

    • vikramkr 2 hours ago

      That's technically true but practically an agent can just save the script file/rerun it/write a tool that lets it call a reply with memory etc.This aspect is a bit more elegant when it's in the execution context, but the core of "you don't need to predefine tools, the agent can dynamically write its own code" is not exactly new - that's pretty much the basis of why Claude code and codex and all the other agent harnesses are so much more effective than old ways if working with llms - they can just write giant incomprehensible bash scripts on the fly to accomplish random things without having pre-defined tools, write state to files, etc

sroerick 3 hours ago

I made an interpreted lisp and stored the AST in postgres and exposed the functions with htmx, and honestly it works pretty great.

scarredwaits 2 hours ago

Nice, but this is the equivalent of always running with `--dangerously-skip-permissions` with all the security implications of that.

  • markasoftware 2 hours ago

    Pi does this by default. Since the frontier lab agents are vibe coded you really should sandbox any agent you run period.

  • embedding-shape 2 hours ago

    Which realistically, is the only way to be productive with agents. If you aren't running them inside of something that limits their scope/impact/potential damage, you're already doing it wrong.

    Most of those "permission"-systems are built on the idea that an LLM can decide what to ask for approval to run or not anyways, which obviously don't work out great in practice. Might as well give them blanket permission to do whatever, then put them in an isolated environment.

emp17344 7 hours ago

Littered with AI writing tells.

  • lgas 4 hours ago

    This doesn't need to be posted on every post. Everyone that cares is well aware. It's like saying "this was written in english" on every post.

    • hack1312 4 hours ago

      Why should I bother reading something that the “author” couldn’t even be bothered to write themselves?

      • lgas 4 hours ago

        I'm not saying you should, I'm saying you shouldn't clutter up every thread with this type of useless comment. It just detracts from the people that do want to engage with it.

      • pseudony 3 hours ago

        Similarly, why should I be bothered reading this kind of comment in each and every discussion thread?

        What does it contribute? I can read and discern this for myself, I can then stop reading or decide I don’t care.

        Seriously, at some point all you “ai writing sleuths” should just get your own discussion thread together. It’s been months of this , we get it already.

        (Not directly just at you, but anyone who feels the need to drop these comments in every thread)

        • tgv 56 minutes ago

          > why should I be bothered reading this kind of comment in each and every discussion thread?

          To help other people who don't care about it so they can skip it. A subject tag would be nicer.

          > It’s been months of this , we get it already.

          And I am tired of the constant barrage of AI proselytizing.

      • josefrichter 1 hour ago

        he's sharing an idea, not "text". text is just a medium.

  • josefrichter 2 hours ago

    is that wrong though? you write all your code with AI already, but you still need to supervise and steer it. same with blog posts - as long as you steer it towards converying your point, it doesn't matter the text itself was written by AI rather than typed by you, does it?

    • derdi 1 hour ago

      It doesn't matter if a human or a machine wrote it, it's just unpleasant to read. I don't know what the OP's motivation for their post was, but I think it's reasonable to point out that something is harder to read than it should be.

  • rcarmo 2 hours ago

    Actually, not really. The vocabulary is sophisticated, but there isn’t a single “the honest value” or A bunch of itemized bold fluff.