Messing around with LLMs and typed clojure. Here is a very basic example, https://github.com/iwillig/csb/blob/main/src/csb/db.clj#L31-L58 I found it to be a positive experience. I been thinking that maybe typed clojure could make LLM’s more effective. Will let people know how it goes.
I experimented a bit with using LLMs to add annotations themselves as a way to try GitHub Models. Might be of interest https://github.com/typedclojure/typedclojure/blob/4edaa0d63bb8ed9b93fa38e97bbd77f14256b39d/typed-clojure-port.prompt.yml
btw there should already be clj-kondo configs for typed clojure on the classpath at https://github.com/typedclojure/typedclojure/tree/main/typed/clj.runtime/resources/clj-kondo.exports/org.typedclojure/typed.clj.runtime, you might need to call --copy-configs https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#importing
my biggest friction so far with LLM's + clojure has been paren matching.
I looked into parinfer (matching parens based on indentation, the latter of which LLM's are good at) but it's quite difficult to get a standalone impl that a coding agent can use. Most require editor integration.
I am using clojure-lsp with opencode to prevent bad parens from getting into the code base.
https://github.com/iwillig/csb/blob/main/opencode.json#L30-L44
But sometimes Claude gets mad at the linters and uses python to write the bad clojure to a file. Its a little frustrating.
Thanks for the clj-kondo advice
I was thinking a more positive directive like "if you have a syntax error, try running parinfer on the code and study the output to learn where the syntax error might be"
which tools consume opencode.json ?
looks like you mention clj-paren-repair-claude-hook in the project, maybe that's what I want
clj-paren-repair works pretty well.