Guide · Business rules

Business rules extraction from code

The rules that run a business usually live in code nobody fully remembers. Extracted by hand, they take months and are out of date by the time they are written down.

In short

Business rules extraction is recovering the rules a system enforces — validations, conditions, limits, who may do what, how records change status — from its source code, so that people can review them, migrate them or change them safely. GitMir reads a repository into a model of its rules, status flows, customer paths and records, each traceable to the code it came from, and keeps that model current with every push. It reads TypeScript, JavaScript, Python, Ruby, Go, Java, Kotlin, C#, Swift, PHP, Rust and Dart, plus Vue, Svelte and Astro files today.

Why teams extract business rules

Four reasons, one missing document

Migration and modernization

Before anything moves you need to know what it does and what depends on it — including the connections no import shows.

Audit and compliance

Who may do what, and under which conditions, written down from what the code actually enforces.

Knowledge that walks out

When the person who knew leaves, the rules stay in the code and the explanation goes with them.

AI agents

An agent that does not know a rule will break it in a clean-looking diff.

By hand or from a model

The same rules, a different shelf life

By handFrom a GitMir model
HowInterviews, reading code, spreadsheetsRead from the repository
Traceable to codeOnly if someone wrote the reference downEvery statement traces to the source it came from
Stays currentUntil the next changeUpdated on every push
Who can use itPeople who read the documentPeople, in answers and a drawing; agents, over MCP
What comes out

Rules with everything they touch

Rules

What must hold, and where in the product it is enforced.

Status flows

The states a record moves through and what moves it.

Customer paths

The steps people take, screen by screen.

Records

What the product keeps, with its fields and how sensitive they are.

Connections

What changes, watches, grants or depends on what — across areas.

Gaps

Statuses nothing enters or leaves, and steps that point at nothing — found without being asked.

An example from Supabase Studio: An unpaid invoice restricts the organization. Warning → grace period → restricted

Limits

What it does not read today

COBOL and other mainframe languages are not read today. A repository that holds only compiled output is read with a notice that names may have been shortened; connect the source if you have it.

Work that is not committed is outside the model, and any part GitMir could not read is named as such — it costs nothing, and the next update reads it again.

With GitMir

Rules out of the code, and kept there

GitMir Intelligence

The model of your product's rules, status flows and customer paths, current with every push.

GitMir Intelligence →

Legacy and migrations

Ghost dependencies, rules nobody wrote down, and the map of what depends on what before you move it.

Legacy and migrations →

GitMir Enterprise

The same, inside your own infrastructure, for many systems at once.

GitMir Enterprise →

Questions

Asked about business rules extraction

What is business rules extraction?

Recovering the rules a system enforces — validations, conditions, limits, permissions and status changes — from its source code, so that people can review, migrate or change them safely.

Can AI extract business rules from legacy code?

For the languages GitMir reads — TypeScript, JavaScript, Python, Ruby, Go, Java, Kotlin, C#, Swift, PHP, Rust and Dart, plus Vue, Svelte and Astro files — yes, from the repository, with each rule traceable to its source. COBOL and other mainframe languages are not read today.

How do I document legacy code?

Start from what the code enforces rather than what people remember: read the repository into a model of its rules, status flows and customer paths, review it with the people who know, and keep it current from the code instead of by hand.

Is the extracted rule traceable to the source code?

Yes. Every statement in the model traces to the source it came from, and every answer names the commit it is current to.

What does it cost?

Reading a repository uses credits — about 1 credit for 10 lines, so a repository of 200,000 lines is about 20,000 credits — and GitMir shows the estimate before it reads. A new account starts with 10,000 credits.

Try it on your own code

Give your AI the business logic of your product

Connect a repository and ask it in plain words — 10,000 credits to start, no card.