Skip to content

· #open-source · #ai

Letting an agent find the code worth sharing

Nine small Python packages pulled out of my private projects, and what an AI audit gets right and wrong.

My favorite part of working with AI agents isn’t writing new code. It’s the effort it takes to find a whole part of the code that can be split out and shared. Code that is useful.

I have a few large private projects, like an options trading system and a backtesting study. They’re full of small pieces that solve general problems. I knew that, but finding them, pulling them out cleanly, and writing the tests and docs was never going to reach the top of my list.

Now I ask an agent to audit a project for code that could stand on its own. It comes back with a list of candidates and the reason for each. I pick the ones worth doing, and it extracts them into their own packages with their own tests. I read everything before it goes public.

It isn’t perfect. Sometimes it pulls the code out and misses the secondary and tertiary impacts of that code, which makes it hard to actually separate it as a module. I’ve also been focusing on no dependencies, but some of the code is tied directly to other SDKs. That turns a simple creation into a difficult endeavor. That’s why I still choose what gets pulled out.

So far that’s nine packages, all Python, and most with no dependencies at all:

  • optionstruct: multi-leg options structures, payoff and defined-risk math, without tying you to a broker. It’s my favorite.
  • bookpolicy: scoring terms for deciding whether to open, close or hold, given a book of options positions.
  • strikemetrics: option-chain positioning, like gamma exposure, max pain, strike walls and put/call ratios.
  • pivotstructure: swing-pivot market structure, from higher highs and lower lows to named structure states.
  • equityladder: the math for a price-step ladder of whole-share buys and sells around an anchor price.
  • episodecount: the real sample size of a backtest whose windows overlap, so you don’t trust a result built on repeated data.
  • svifit: fits an SVI curve to one expiry’s volatility smile and checks whether the fit allows arbitrage, instead of assuming it doesn’t.
  • pitconstituents: which companies were in the S&P 500 on a given day, as it was known that day.
  • alertbudget: rate-limited push alerts for a small unattended system, recorded so nothing held back gets lost.

If you’re a developer with private projects, point an agent at one and ask what could be shared. There’s probably something useful in there. If you trade options or write backtests, try the packages and open an issue if something’s off.