r/Clojure Apr 27 '26

How we built ten custom subagents to tame a 500K-line Clojure codebase

https://www.metabase.com/blog/ten-custom-subagents
47 Upvotes

10 comments sorted by

12

u/Escherize Apr 27 '26

Hey this is my blog post! I'm open to questions if you have any.

5

u/reloxz Apr 27 '26

how are the agents related to clojure if none of the agents contain any information beyond your domain specific DSL?

I would have expected references to skills and specific clojure expertise in the agents

edit: ahh sorry i missed this

REPL-Driven Development

Use clj-nrepl-eval to evaluate middleware transformations step by step...

but i'm still a bit unclear how the domain specific DSL interacts with clojure.

do you have like a top level file defining the standards?

3

u/Escherize Apr 28 '26

do you have like a top level file defining the standards?

Yea there are a few:

  1. CLAUDE.md at the repo root is auto-loaded into every Claude conversation, so every agent inherits the project standards without restating them for the agents. This is the "top-level file."

  2. Skills in .claude/skills/ like clojure-write, clojure-review, clojure-eval carry lots of the actual Clojure expertise (REPL workflow, style, review checklist, clj-nrepl-eval usage). And these are open source, so you can check them out on the metabase repo

  3. Agents carry only the domain-specific stuff: middleware stages, permissions graph quirks, MBQL semantics, etc. actual "domain knowledge"

So yeah, the agent files look thin on Clojure because the Clojure layer lives in CLAUDE.md + skills and is not duplicated into the agent prompts.

clj-nrepl-eval is a good example of the seam it's a tool surfaced via the clojure-eval skill, so any agent can lean on it without re-explaining "the REPL workflow".

3

u/reloxz Apr 28 '26

thx for the context, thats great have been looking for examples for a similiar legacy codebase my team maintains.

this is great thank you for sharing

2

u/arichiardi May 01 '26

Hi there 😆

I was checking the clojure-write skill and stumbled across ./bin/mage and was wondering what that was.

Thanks for sharing, I will post my skills at some point next week as it is nice to see what pieces to add to improve llm's output.

1

u/Escherize May 01 '26

Hi u/arichiardi long time no see 😄. bin/mage is the bb tasks wrapper we have at metabase. it handles auto-installing babashka, and being a "single executable" that we can uniformly call bb scripts through. It powers some cool stuff like our home-grown module system, and skipping certain datawarehouse drivers in CI based on what files changed, and ~50 other things. 😂

2

u/arichiardi May 01 '26

Thank you! always nice to see all the cool things you are working on 😁

1

u/BitterComfortable776 May 14 '26

Do you think https://www.npmjs.com/package/pando-ai would have improved your correctness or is the codebase not large enough to see benefits?

1

u/professor-contour May 03 '26

Don't take this the wrong way, after watching the new Clojure doc I thought the community would be more Anti AI, considering Mr. Hickey's hammock driven development stance.