AIFeed

Touring Pulley’s Software Factory

Summary

I don’t normally talk about my job on here, but I thought today I would in order to share some details about how our software engineering process has evolved since I wrote about being a 5x engineer last year. I’m Head of Engineering at Pulley , where we’re literally building the future by reducing the time it takes to get construction permits. We do it by combining AI with local permitting experts to get permits approved in about half the time it would otherwise take. To deploy AI on such a challenging task, we have to solve a lot of technical problems, and that means writing code. When Pulley started, all that code was written by hand. Now, AI agents write the code, allowing us to ship 40+ PRs per engineer per week—up from an average of 6 PRs per engineer per week a year ago—and if trends continue, that number is only going to keep going up. That rate of shipping is possible only because we’ve built a software factory that automates much of the software development lifecycle (SDLC). L…

Original text(via LessWrong)

I don’t normally talk about my job on here, but I thought today I would in order to share some details about how our software engineering process has evolved since I wrote about being a 5x engineer last year.

I’m Head of Engineering at Pulley, where we’re literally building the future by reducing the time it takes to get construction permits. We do it by combining AI with local permitting experts to get permits approved in about half the time it would otherwise take.

To deploy AI on such a challenging task, we have to solve a lot of technical problems, and that means writing code. When Pulley started, all that code was written by hand. Now, AI agents write the code, allowing us to ship 40+ PRs per engineer per week—up from an average of 6 PRs per engineer per week a year ago—and if trends continue, that number is only going to keep going up. That rate of shipping is possible only because we’ve built a software factory that automates much of the software development lifecycle (SDLC).

Let’s go on a tour and see how our software factory works.

Overview

At a high level, a software factory is a semi-automated way of turning signals into software. It starts with a variety of inputs, including customer feedback, employee feedback, market research, logs, metrics, traces, and other telemetry. These inputs are fed into product research and automated maintenance processes, which in turn kick off agents that build software, test it, and put it up for review. After automated reviews, humans request changes and verify the software works as expected before shipping and releasing it. Once released, changes are verified in production, and we gather new signals to begin the cycle again.

A typical small change can go from concept to shipped in about 40 minutes, with medium-sized changes taking an hour or two to hit production. Larger changes usually take a day or two, but that’s because we’re iterating on designs, trying to figure out the right thing to build before we merge it.

Inside the factory is also an inner loop where the factory improves itself. We’ll explore both the outer and inner loops on our tour.

The outer loop

Signals

Everything we build starts with signals, which are pieces of information that suggest there might be something worth doing.

Some signals come from people, like our customers, who tell us what’s broken or missing, and our own team, who use the product every day to get permits approved. We also do market research that tells us what potential customers might want. These signals usually come to Product, Design, and Engineering in written form, whether that be a Granola transcript, a Slack message, a Linear ticket, or a Notion page, though sometimes we get screenshots and videos of user sessions, too.

Other signals come from the software itself. We have logs, metrics, traces, and more. They tell us about errors, performance, security issues, and sources of user frustration.

Many of these signals automatically kick off work without a human looking at anything first, but not always. Sometimes we need a human in the loop to do one of our most important processes as a business: product research.

1a. Product research

Agents can build whatever we ask them to. That’s great! But it doesn’t matter what they build if they build the wrong thing. So product research is, in many ways, the most critical station in our software factory.

Internally, product research is also a looped process. We gather information, propose ideas, build prototypes, and validate them, which feeds us more information to run the loop again. We iterate quickly to build confidence in which product bets we should make and send through to the rest of the factory.

For example, not long ago we built a feature we call Packaging Agent. It’s an AI assistant that helps our Permit Ops team assemble plan sets and other documents ahead of permit submission. It started as a signal: Permit Ops was spending too much time manipulating PDFs to get them ready for submission. We considered several ideas, built a prototype (these are often built by a PM or designer rather than an engineer), got feedback, iterated, and by the time we handed work off to engineering, we already knew the feature would be a success—it saw nearly 100% adoption within its first week!

I could say a lot more about our product research process, but if I did we’d be here all day, and there’s a lot more to see, so let’s continue the tour!

1b. Maintenance

Not everything needs a human to get it into the factory. Security patches, crashes, and performance issues can all be discovered from telemetry, and fixes can be created autonomously. We have several bots that run on a schedule to find these issues:

  • [sentry-bot] triages Sentry errors, finds their cause, and opens PRs to fix them.
  • [perf-bot] monitors changes in endpoint performance week over week and looks for negative trends that need attention.
  • [acl-bot] scans for access control violations that missed security review and made it into production.
  • [vuln-bot] scans for package vulnerabilities and puts up fixes.
  • [security-bot] does full security scans of repos to look for potential issues that were missed.

We also have bots that are running various code migrations and refactors. For example, we recently completed a migration to make our TypeScript code 100% strict-mode compliant, fixing roughly 10,000 violations over the course of a few months. We’re also using bots to manage some long-tail data migrations we were putting off. And we’ve used them to refactor parts of the code to conform to new standards we’ve set.

All of this work matters, but it’s also “boring” in that none of it adds unique value for the business. It’s just the table stakes of running a successful company, and we’re extremely happy to let AI do the heavy lifting.

If you’re interested in learning more about this part of our factory, I recently gave a conference talk on it. Video is not yet online, but you can find the slides here.

2. Build

Once we know what to build, we hand tasks off to the agents and let them work. We give them guidance on how to do this in the form of AGENTS.md as well as a variety of skills that document procedures for completing specific tasks. We also give our agents a full development environment (including application, database, and seed data that’s continually refreshed) that runs in their VMs, so they can test changes for themselves as they make them.

Bigger projects require more coordination, so for those we’ll often spin up an agent that works with a human to orchestrate the work across multiple tasks, since decisions made earlier in the build impact what gets built later.

3. Test

AI learned to write code from humans. Thus, unsurprisingly, we still have to test changes to make sure they work.

We have the standard suite of tests here: unit tests, functional tests, integration tests, linters, compilers, the works! We also ask agents to test their own work. We have a skill that walks them through how to design a test plan, then hand it off to a subagent to run. When successful, it not only verifies for itself that the changes are as requested, but also produces artifacts like screenshots and videos to make it easier for humans to do the next step: reviewing the work.

4. Review

Agents write more code than humans can review. To keep us from being the bottleneck, we also have to use AI during the review process.

Every PR goes through automated review first. In our case that’s Greptile, plus a custom security reviewer for applicable PRs.

Some PRs get auto-approved by this process if they’re deemed low risk, and the human overseeing the work can merge without the approval of a second human. Other PRs are high risk, and so require explicit human review by someone other than the ticket author (who is also usually listed as the author of the PR). Still other PRs, regardless of risk, trip required review rules, in which case specific people are asked for review because some parts of the code need owners to maintain quality, consistency, and correctness.

We also rely a lot on AI to help us humans review PRs. Every PR gets AI-generated descriptions following a template that highlights what changed, what decisions humans made, and which decisions AI made. Further, it’s easy to spin up another agent to chat about the PR, and so it’s common to start a chat saying “hey, explain what’s going on at this line here” or “why is this PR doing this and not that”, just like we used to ask the author. Most of the time the agent knows the answer, and this usefully informs what, if any, feedback is given on a PR.

Finally, we want to verify that each PR works as expected, so they all get an isolated preview environment running the full stack with the PR’s changes. This makes testing easy: just click the link, log in, and check to see if everything’s working—or have an agent do the testing in the browser for you!

5. Ship

When code lands on main, it deploys to staging automatically. Production deploys later go from main after a successful staging deploy.

6. Release

We use feature flags, which separate deploy from release. Many features go out behind LaunchDarkly flags, so we can verify changes work in production without turning a feature on for everyone. We often choose to roll a feature out internally or to a small beta group first, validate the feature works as expected, make any necessary improvements, and then release for everyone. This process ensures we can both ship quickly and maintain a high quality bar.

7. Verify

After a feature is released, we still want to verify that it’s working. This is done a few different ways. Both humans and agents can run end-to-end tests on production using test accounts set apart for that purpose. We also monitor Sentry and can alert on issues if they pop up. Rollback isn’t fully automated, but it is simple, as for most changes we simply turn the flag off if it’s not working and go back to the old experience.

And in the days and weeks following the release of a feature, we get more signals, which feed back into product research (and, alas, automated maintenance) to begin the cycle again.

The inner loop

One of the incredible things about a software factory is that you can use it to improve itself. That said, some of the actions we take to improve the factory don’t look quite like regular product work. These include:

  • Revise prompts. We have a bot that regularly audits coding agent guidance based on PR feedback and updates the guidance. This keeps our AGENTS.md and skills files maximally useful.
  • Add skills. We also add new skills when there’s new standard processes we want agents to follow.
  • Upgrade models. We need to upgrade the models we use in our factory, just like we upgrade the models we use in our product. We’re constantly trying new ones out, seeing what works best, and changing our default models based on what’s state of the art.
  • Automate more. We’re constantly building additional automations to further reduce toil.

In case it isn’t obvious, being able to continuously improve the factory is the real “secret sauce” of having a software factory. Just like agile development methods made the development process something that could be improved, a software factory makes the development process into code that can improve itself. This is what separates the idea of a software factory from more traditional SDLCs.

What’s next

The obvious next step is more automation. For example, I would love to have automated reviews with better taste so that humans have to cycle with their agents less often to improve PRs. Similarly, I’d love more automation at the Verify step with more comprehensive end-to-end tests.

That said, I’m not ready to see us run a dark software factory with no humans in the loop. Right now, humans are the only thing keeping the factory on track. Without us, it would Goodhart on signals and risk producing something that’s almost but not quite useful. Fighting specification gaming is already what we spend a good chunk of time doing on automated maintenance PRs, and I worry even more about what would happen with customer feedback if we let the agents run without any supervision.

It’s also quite impressive how far we’ve come in a short period of time. Two years ago AI was just getting good at autocomplete. Twelve months ago it was okay at writing code but only with a lot of supervision. Only in the last six months has the software factory become a reality. I don’t know what the factory will look like six months from now, but I expect there will still be humans in it.

Thanks for coming along for the tour!

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by LessWrong
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗