Use Cases - a VIP codebase entrance for agents (and humans!)

A VIP entrance for agents and humans

Use Cases is an abstraction over a codebase in plain English built with Swift.

Giving agents (and humans!) a VIP entrance into a codebase despite zero context or knowledge of where the code lives.

Behaviours map directly to the code that brings them to life, via tests, source code and even other resources like json files or anything else related to the behaviour.

                 ┌────────────────────────────────────────────┐
                 │ checkout.discount                          │
                 │ "A valid code takes 10% off the basket;    │
                 │  an expired code is refused."              │
                 └─────────────────────┬──────────────────────┘
                                       │ linked
         ┌───────────────────┬─────────┴─────────┬───────────────────┐
         ▼                   ▼                   ▼                   ▼
       tests            source code          resources         anything else
  discount.test.ts      discount.ts          codes.json         a migration
   checkout.snap         basket.ts           prices.md         a config file

     change any of them ──▶ the use case is stale until it is proven again

The problem

Repositories get complicated fast.

Agents write code hundreds of times faster than people, so a codebase can go from new to complex in a few hours.

Use Cases keeps an abstraction layer over the code, so you can understand it, manage it and keep track of changes as they happen.

Agents changing code and running tests can leave blind spots with no humans in the loop, unintentionally breaking other parts of the software/app being developed or falling foul to ‘unit tests pass so it’s fine’.

  • Find the behaviour, then the code. Pick a use case and follow it to the tests and source that back it. You need no knowledge of the codebase to find the relevant parts, which also makes it easier to judge a repo's safety before you trust it.
  • Fewer tokens spent hunting. An agent reads a clear statement of what the code does, rather than reading many files and inferring it.
  • Refactor with confidence. The use cases stay put while the code underneath changes, even in the extreme (JavaScript to Swift, say).

Behaviour intrinsically linked with the implementation

Agents or humans can find the use case and have immediate access to all the code that directly implements it, despite never seeing the codebase before.

Additionally, the two layers are intrinsically linked, so if any of the underlying implementation details change (the code, the tests or any other linked file), the use case goes stale. It stays stale until the behaviour is proven again, by an agent or a human running the tests, or by someone trying the app/software by hand and recording the result.

This means a behaviour must be explicitly proven on change, so ’the tests passed’ becomes a thing of the past.

Proof can be automated or done by hand, and sign-off is separate from proof. Turn sign-off on and a critical use case can't ship until a person has approved what it promises, and again whenever that promise changes.

  ┌──────────────┐    linked code, tests or files change    ┌──────────────┐
  │  verified    │ ───────────────────────────────────────▶ │  stale       │
  │  ships       │                                          │  blocks ship │
  └──────────────┘ ◀─────────────────────────────────────── └──────────────┘
                       proven again: the tests pass, or
                   a person tries it and records the result

  if the proof fails ──▶ failed, blocks ship until fixed and proven again

Showcases and demos

Because agents have the full understanding of a use case, from the human plain English description and expectations to all of the related code, they can create and run showcases, taking the weight off humans and setting up all their proofs in one go.

The person signing off can physically watch agents take behaviours, plan and run the showcase and prove first hand the behaviour works allowing full confidence in a final shipping app instead of relying on more contrived or limited tests.

A person with little to no ability in software development can design a complex tool with their favourite agent, focusing on the behaviours as an end user instead of being lost in implementation details.

Once the design is finished the human user can leave their laptop alone and agents can take over, write the software and have full confidence they are doing the right thing based on the human approved behaviours.

At the end of the build, the agents can plan and build a showcase to show off all of their new features to the user in the real running app, allowing users to become feature and product designers if they wish without ever having to learn a line of code or software architecture.

First class citizen tooling

CLI commands and a built-in MCP server are first-class citizens here, so agents have complete control in managing the entire life of a use case with very little effort.

Feedback

This is a rewrite from the ground up of a v0.0.1 which I've been using for months now, especially on larger more complicated apps and projects and am really enjoying, so feedback would be great, from the concept/idea in general to the install/setup and any use people have tried.

Thanks!

                 ┌────────────────────────────────────────────┐
                 │ checkout.discount                          │
                 │ "A valid code takes 10% off the basket;    │
                 │  an expired code is refused."              │
                 └─────────────────────┬──────────────────────┘

to my eyes it looks a bit like a 'user story' so i'm curious what are the big differences to using a 'use case' vs a 'user story'?

or is 'use case' more like a 'product requirement'?