Decoupling to OSS libraries: Auth | AI for Code Extraction | Centralized SEO


Hey this is Isaac,

I met with some dear friends, Danny and Audrey Roy Greenfeld, in Baltimore for a mini-sprint on the air web-dev framework. Walking around a science museum while brainstorming and cafe-hopping while hacking together was a blast.

During the sprint I created a new testing example (unit, integration, and end-to-end playwright tests) and began extracting features from private codebases into small, public libraries. I also learned that a late evening espresso martini is not the best for restful sleep.

I was tired of having similar code in multiple apps and wanted to build with others more. The fix is to extract private logic into small, shared libraries. I'm introducing three of those extractions today.

I hope you'll take a look and contribute. They are in the very early stages, so they are great projects to join.

If you don't know how to start, just reply to this email. I'm doing this to code with more people and would be happy to help you get started :)


The Build: A Tiny Clerk Auth Wrapper

I had GitHub OAuth in one app and Google OAuth in another. It wasn't ideal, but I kept delaying the fix because of other priorities.

Then Hamel Husain created a great example of using Clerk for authentication with air. Then Danny and Audrey started the airclerk library based on that example, and I quickly joined in on the fun.

Nearly every commercial air app needs auth, so an OSS library that everyone can improve will be invaluable to the air ecosystem.

Clerk is nice because it’s managed auth, and you can easily get many types of authentication without writing much code. Clerk’s generous free tier means I can simplify my code and get more auth options for users in the process.

So we worked on airclerk: a tiny library that provides Air routes and dependencies for Clerk auth.

  • The Setup: You drop it in with a single app.include_router(airclerk.router).
  • The Usage: You protect routes with a require_auth dependency.
  • Demo App: The tests/demo.py file shows how to build a real app around it (SessionMiddleware, Clerk JS, protected routes) without bloating the library itself.

For the full code and demo, check out the repo.


The Learn: Use AI for Extraction

AI is perfect for extracting existing, tested code. I used it to peel a user feedback pattern into a new module, airfeedback.

My apps had similar logic for adding a feedback button and modal that stores user feedback, timestamps, user id, and the current route.

AI came close to one shotting an extraction with this prompt:

"Extract the user feedback feature into a new, self-contained module. I will later move it to a separate pypi library, so I can only extract generalizable pieces without assuming a particular database or storage mechanism."

I got a single file module without changing behavior that used a callback function to keep the storage mechanism separate.

This is one thing AI can do almost perfectly in one shot: transformation without invention. It felt safe because these paths were already tested and running in production. I was only asking for a mechanical refactor to save me some time. The result was a new and cleanly decoupled library very, very quickly.


The Refactor: From Copied Tags to One Clean Import

Every app I build needs the same SEO and social metadata: title, description, Open Graph, Twitter cards, favicons, and JSON-LD.

The old way: Every app had its own block of tags. Setting these up is a pain every time because the details are tedious to check and easy to get wrong. I had small suboptimal SEO or social sharing issues scattered on different apps.

The new way: I pulled all this logic into a single library, airheads. Its only job is to render that sweet, sweet metadata consistently and correctly. One function, build_social_head(), orchestrates everything.

I deleted a bunch of duplicated and inconsistent code from three different applications and replaced it all with a single import. Now, one update to airheads fixes or improves metadata across every single project.


Until next week,

Isaac

Isaac Flath

Every post comes from something I've done on a real project. AI tools, development approaches, how I actually build things. You're getting a curation of my taste, not takes on stuff I don't use. Subscribers also get extras: things that went wrong, how my thinking about AI is changing, hacky workflows I use every day, and the occasional personal update. Stuff I share with subscribers because it's a little too personal or unpolished to blast across the internet.

Read more from Isaac Flath

Today's post is about a project that I will take concepts from to improve my own work. So I studied the OSS prototype of it to understand how it works. Point and Talk: How Clicky’s AI Interface Works Clicky is an AI buddy made by Farza that lives on your Mac. You press a key, talk, and a glowing blue triangle flies across your screen, points at whatever you asked about, and talks you through the answer. Most apps with an agent should have something like this. Point and talk is closer to how...

Last week I shared my knowledge base tool, agentkb. This week I am OSSing my pi harness that uses it, Harpy. The most interesting part of the harness is that knowledge base <-> harness integration so that's what this week post dives into. It covers what RLM is, how it drives a python loop with state, how Pi (typscript) extension talks to python, and how that allows for smart delegation and fan-out to smaller models to give more accurate search results. How My RLM Tool Works An LLM writes...

Hey, This was a week of context switching 😅. Product release weeks are always odd. The goal is super specific, and yet the work is scattered small tasks (testing, polish, docs, marketing copy, etc.). We shipped the stoa beta, and I kept wishing my agents could remember more. That's why I'm open sourcing `agentkb`, my work-in-progress knowledge base framework today. The Pi harness built around it will be open sourced next. AgentKB: A Local Knowledge Base for Agents My agent should learn from...