How a Codebase Learns Chemistry

AI makes chemistry mistakes. ChemIllusion turns those failures into tests, reusable functions, and agent skills so each new feature starts from a better chemistry foundation — told through the commit and line-of-code history of this codebase.

Building on what came before

AI makes mistakes, and in a chemistry codebase those mistakes can make the content meaningless or misleading. AI can often mishandle a charge or format a chemical expression incorrectly. Much of the work of building ChemIllusion has involved finding those failures, correcting them, and then making the correction part of the project so that future work begins from a better starting point.

Over time, those corrections accumulate in several forms. Some become tests. Others become reusable functions, documentation, or Markdown skills that describe how a particular chemistry problem should be handled. There is, for example, specific guidance for handling subscripts and superscripts in chemical structures because that was added while writing the OER textbook. Once that knowledge is written down and kept with the project, the next AI agent working on a related feature can use it directly.

A great deal of the learning is also contained in the code itself. Before modifying a mature part of ChemIllusion, an agent reads the surrounding implementation and sees how earlier problems were solved. It encounters the molecular representations, chemistry calculations, and conventions that have survived previous rounds of development and testing. The accumulated code therefore provides examples of what works in this particular environment.

This matters because each new feature begins with more chemistry already solved.

Chemistry capabilities accumulate

A complicated chemistry feature rarely consists of one isolated piece of code. Even a relatively focused tool may depend on molecular parsing, structure generation, chemical validation, graphical output, and a user interface that connects those pieces together. Early in the development of ChemIllusion, many of those supporting capabilities had to be created while the feature itself was being built.

That changes as the project grows. Once reliable patterns exist, later tools can reuse them. An agent asked to build something new can inspect related implementations and combine existing components.

The result is a compounding effect. A complicated feature that might once have required days of iteration can now sometimes be built in only a few cycles of planning, coding, testing, and correction. Better foundation models contribute to that improvement, but so does the accumulated scientific infrastructure of the project. The model arriving today is working in a very different environment from the model that arrived a year ago.

This is especially important for the Python portion of the repository. Much of the chemistry lives there: molecular manipulation, cheminformatics, scientific calculations, and the logic behind many of the tools. The Python curve in the plots below therefore represents more than application growth alone. A substantial fraction of it is an expanding computational chemistry foundation on which later features can be built.

Mistakes can become lessons

The iterative advantage depends on catching errors. When a chemistry feature fails in a recognizable way, the useful response is to fix the immediate problem and preserve enough of that experience to make the same failure less likely in the future.

Sometimes that means adding a regression test using the molecule that exposed the problem. When the issue is more general, the lesson may be recorded as an explicit skill or project instruction that describes the correct approach for future agents.

The growing collection of Markdown files in the repository reflects part of this process. ChemIllusion contains large amounts of educational content and conventional documentation, but Markdown is also increasingly used to describe scientific conventions, development practices, and specialized instructions for AI agents. These files provide context that would previously have existed mainly in the memory of the people maintaining the software.

That makes the repository useful in two ways at once. It contains the working implementation, and it contains an increasingly detailed account of how work in this chemistry environment should be done.

Iteration changes what a prompt can accomplish

This accumulated context helps explain why a short request to an AI coding agent can now lead to a surprisingly sophisticated chemistry tool.

The prompt is only the beginning of the task. The agent can examine existing chemistry code, identify related tools, reuse tested components, read project-specific instructions, run tests starting from existing code, and revise its implementation. Much of the detail that would have needed to appear explicitly in the prompt has already been encoded in the project.

The same request given to a general chat model without that environment has a much harder problem. It has to reconstruct assumptions from general knowledge. Within ChemIllusion, many of those decisions have already been made and tested.

As the repository grows, more complicated requests become variations on things the project already knows how to do. Building the next molecular visualization tool draws on previous visualization tools. Building another spectroscopy feature draws on existing numerical and plotting work. For example, we recently added an NMR processing tool, and it was able to use the topicity tool we already had in place to make the NMR assignment process even easier for students. Each successful feature increases the set of components and examples available to the next agent.

The history in charts

The graphs below come from the git history of the codebase that runs ChemIllusion, beginning with the first commit on April 1, 2025 and continuing through September 20, 2026.

The first combines commits per month with cumulative commits.

Commit history since inception (Apr 2025 – Sep 2026)

Commits per month rose from single digits in April and May 2025 to a peak of 1,388 in August 2025, dipped to 30 in October 2025, and rebounded through a second wave in mid-2026 (760, 774, 947, and 920 in June through September 2026). Cumulative commits reached 9,245 by September 20, 2026.

Lines of code by language over time

Cumulative net lines of code grew to about 1,036,600 for Python, 974,600 for JavaScript plus TypeScript combined, and 517,000 for Markdown by September 2026. Generated and vendored files are excluded.

Cumulative net lines (added minus removed), generated/vendored files excluded. Python .py; JS+TS .js/.jsx/.mjs/.cjs/.ts/.tsx; Markdown .md/.mdx.

By September 2026, cumulative net lines had reached approximately:

  • 1.04 million lines of Python
  • 975,000 lines of JavaScript and TypeScript
  • 517,000 lines of Markdown

The three curves represent different parts of the same process. JavaScript and TypeScript largely reflect the expanding product surface and the interfaces through which people use the chemistry tools. Python contains much of the scientific machinery beneath those interfaces. Markdown contains course material and documentation alongside a growing body of instructions and skills mentioned above.

The value is therefore not the line count itself. What has accumulated inside those lines is a large collection of chemistry capabilities that can now be recombined.

The human role

As coding becomes faster, more of the important work shifts toward deciding what should be built and defining what a correct result looks like. Chemistry is especially useful in this respect because many requirements can be checked computationally, while others still require scientific judgment about whether a representation or visualization is actually correct and meaningful.

The plots above show a rapidly growing codebase, but the more consequential growth is in the set of chemistry problems that have already been solved. Every well-built tool adds another piece to that foundation, so the next AI agent starts with more capability than the one before it.

If something is missing from the list of tools, reach out and let us know.