All case studies / Case study 10 / 12

Calvera Assurances

Legacy code modernisation with AI agents

Modernising 30-year-old software without risking how premiums are calculated

In short

Three AI agents work together: one maps the COBOL code and its business rules, one rewrites it in modern Python, and the third proves, with tests, that the new code gives exactly the same results.

Client
Calvera Assurances
Sector
Insurance
Size
1,100 staff, 400,000 lines of COBOL

The context

Calvera Assurances calculates its premiums on a COBOL system written in the 1990s. The developers who know it are retiring, and every regulatory change takes weeks. A full manual rewrite had been estimated at several years.

The challenge

  1. 01

    The business rules are documented nowhere but in the code.

  2. 02

    A single rounding difference in a premium affects thousands of customers.

  3. 03

    The new code must be readable and maintainable, not a word-for-word translation.

  4. 04

    The in-house team must stay in control of every change.

Our approach

An Analyser agent walks the code with Tree-sitter, builds the dependency graph and documents every business rule. A Translator agent rewrites the modules one by one into idiomatic Python. A Tester agent generates unit tests and replays thousands of real contracts through the old and new systems: as long as outputs differ, the module goes back for correction. Each validated module arrives as a GitHub pull request.

The solution, step by step

  1. 01

    30-year-old code

    400,000 lines of COBOL, barely documented, that no one dares touch.

  2. 02

    Mapped

    The Analyser reads the syntax tree, links the modules and documents the business rules.

  3. 03

    Translated, module by module

    The Translator rewrites each module as readable Python, with comments.

  4. 04

    Proven by tests

    The Tester compares old and new outputs on 10,000 real contracts.

  5. 05

    Delivered as pull requests

    Each module lands for review with your developers, ready to merge.

Results

What we deliver

  • Code map and dependency graph
  • Business rule documentation
  • Modernised Python code, module by module
  • Unit tests and an old-vs-new comparison bench
  • GitHub pull requests ready for review

Technologies

  • CrewAI
  • AutoGen
  • Tree-sitter
  • GitHub API
  • DeepSeek Coder / CodeLlama
  • Python

Timeline

8-week pilot, then in batches

Team

2 AI engineers, 1 software architect

A similar project? Let’s talk
Next case · Ravelto TelecomAn AI analyst that triages alerts so the security team can focus on real threats

Illustrative cases: clients and figures are fictional, representative of the solutions we deliver.