Pen calculator: how the build went
What happened when an AI got only the pen calculator brief: versions it found, 55 tests passing first time, two rounds of fixes, an APK without internet and what was checked on the emulator.
Warning. The app is only a calculator working with the numbers the user enters. Counting clicks is not part of the pen’s instructions. A doctor or pharmacist has to confirm the pen values and every conversion. The app is not a medical device. This article is not a guide to adjusting the amount of a medicine; treatment decisions are made by a doctor. The numbers in this article are made-up values from the brief, not values of a real pen. I do not publish the app or the APK.
One run, one brief
Part twelve has the whole brief for the pen calculator. I prepared the brief with the help of AI from the app I have had on my phone since October. This is what happened when an AI (Claude Code) got it with nothing else. It built the app in one run. I did not write the code.
The brief requires an honest build log: the time, the exact command, the result, and for an error an excerpt of the message and the fix. Everything in this article comes from that log and from the instructions the AI wrote for the app. Where the log says nothing, I say nothing here either.
Two things differed from the published brief. The build used the Slovak brief, and part 0 had a different path to the project folder. And the run had an operating instruction to start the emulator without a window. The brief asks for an emulator with a window if the environment allows it. The AI followed the instruction and recorded it in the log as a deviation.
The build ran on 24 November 2026. The first entry in the log is at 20:43, the final checks at 21:10.
The result was checked on the emulator. I did not install this new build on my phone; my phone still has the app from October.
What the AI found on the machine
The brief says versions are not guessed from memory. So the first step was to find out what was on the computer:
- the
ANDROID_HOMEandJAVA_HOMEvariables were empty, the Android SDK was in its default place, - Android platforms 35, 36 and 37.0, build tools 35.0.0 and 36.0.0,
- two Javas: 25 from Android Studio, and 21,
- Gradle 8.13, 9.3.1 and 9.7.1 unpacked,
- one virtual device,
Medium_Phone_API_37.0, and no phone connected.
The virtual device existed, so the brief’s “When to stop” point did not apply.
Versions: a library that wanted a newer Android
The AI read the current stable versions straight from the library repositories and from the compatibility tables. It wrote the decisions and their reasons into the log:
| What | Version | Why |
|---|---|---|
| Android Gradle Plugin | 9.5.2 | newest stable |
| Gradle | 9.7.0 | the plugin needs at least 9.6.0, Kotlin is tested up to 9.7.0; the highest Gradle in the overlap |
| Kotlin | 2.4.21 | newest stable |
| Compose BOM | 2026.09.00 | the newest, 2026.11.01, needs platform 37.1; the machine has 37.0 |
| compileSdk, targetSdk, minSdk | 37, 37, 26 | the highest platform on the machine; minSdk from the brief |
| build tools | 36.0.0 | already on the machine, nothing was downloaded |
The brief asks for the requirements of every library to be read, not just one. The AI did that before writing the build files: it downloaded the package of each library and read which lowest platform it needs. The libraries from the newest Compose BOM wanted platform 37.1. The brief forbids downloading a platform, so the AI tried older BOMs until it found the newest one whose requirements fit 37.0.
With the weight log the same thing only showed up as one of the rounds of fixes. Here the project skeleton passed the library check the first time.
The AI recorded one deviation openly: plugin 9.5.2 is newer than what Kotlin’s own table says it is tested with (up to 9.3.1). The brief says that when the tables disagree, the plugin wins, and the deviation is written down.
The machine had Gradle 9.7.1 unpacked. The AI used it to create the Gradle launcher (the wrapper) set to 9.7.0, because 9.7.1 is already above the limit in Kotlin’s table.
Calculations and 55 tests passing first time
Next came the calculations, as pure functions with no dependency on Android: parsing and formatting numbers, the conversion, input checks, what is left in the pen, the schedule, alarms, the prefilled amount, the pen form check, export, import and colours. Plus storage and tests with the made-up values from the brief.
While writing the start script, the AI noticed a zsh trap the brief does not mention: the local command inside a loop prints the variable’s value on the second pass. It fixed that before the first run and checked the script with zsh -n.
./start.sh test then reported 55 tests, none failed or skipped. The brief asks for at least 30. The calculations and the tests passed the first time, with no fix.
Decisions the brief does not make
The brief says that where something is missing, the AI decides and writes down why. The log has, for example:
- Text with more than three decimal places has its own error code, so the message at the field can say why.
- The app does not accept negative numbers at all.
- A restore from backup also rejects a file with an entry for a pen that does not exist or with nonsensical pen values, so that a backup cannot break the app.
- The pen form hides the bottom navigation, like Settings. An empty required field is reported only after tapping Save; other errors appear while typing.
- A new pen gets a colour by its order, so pens look different.
- The export of the log to a spreadsheet starts with a marker that tells the spreadsheet the text is in an encoding with accented letters.
Screens, reminders and the APK
The AI wrote storage, state handling, the screens, reminders, the texts in two languages and the manifest in one go, because the screens depend on both. Compilation passed the first time.
The first ./start.sh apk showed two small things:
- One permission appeared twice in the list. The AI found out why: the app both defines it and uses it. Since then the script marks each line “defines” or “uses”.
- The compiler reported one warning, an unnecessary operator in the Calculator screen code. Removed.
The debug APK is 12,154 kB, without shrinking. Its permissions:
POST_NOTIFICATIONS: showing reminders on Android 13 and newer,RECEIVE_BOOT_COMPLETED: scheduling the alarms again after a phone restart,SCHEDULE_EXACT_ALARM, only up to Android 12: exact alarms,USE_EXACT_ALARM: exact alarms from Android 13,- a permission of the app’s own, added by the AndroidX library; it opens nothing.
The INTERNET permission is not in the APK and is explicitly removed in the manifest. Because of the exact alarms and the conversion of a medicine amount, the app is not meant for an app store; it is installed only from a computer.
The emulator check
The virtual phone with Android 17 booted without a window in 5 seconds. ./start.sh instaluj installed the app and started it. (In the Slovak brief the command is instaluj; in the English brief it is install.) The emulator also had the app from part eleven on it; the AI did not touch it.
One deviation from the order: the brief wants the app’s language switched and the notification permission granted in advance. Both commands work on an installed app, so the AI ran them after the install and restarted the app.
A button nobody could see
The AI controlled the app over adb: a list of the elements on screen, taps and typing text. It finds elements by the tags the brief told it to put into the interface. The very first button, “Rozumiem” (“I understand”, the app ran in Slovak) in the opening notice, had no tag in the list.
The cause: a dialog has its own window, and the setting on the root of the interface does not apply to it. The first attempt, the setting directly on the button, did not help. The second attempt, wrapping the dialog buttons in an element with that setting, worked. Meanwhile the AI checked that neither Back nor a tap outside closes the notice.
What was checked
The AI went through the steps in the brief with the test pen from the brief. Its values are made up and match no real pen.
- On first launch the notice closes only with the “Rozumiem” button.
- A new pen has empty value fields. Only the waste per administration has a default of zero, as the brief requires.
- The test pen was saved with the administration reminder on.
- Calculator: for an amount that does not land on a whole click, two options appeared and neither was chosen. The result card and the log button did not appear. For an amount that does land on a whole click, one result and the log button appeared.
- In the log dialog no injection site was preselected.
- The app’s data file held an entry with exactly the values the brief expects.
- Home showed 2.70 ml left of 2.88 ml, as the brief expects.
- Schedule showed the next administration on 29 November 2026 at 9:00, that is the day of the administration plus five days at the reminder time.
- History, Settings with the list of scheduled reminders, and returning from Settings with Back.
- The system had the app’s exact alarm scheduled for 29 November 2026 at 9:00.
The check produced eight screenshots.
Not everything went smoothly here either, but the errors were in the AI’s commands, not in the app. Once a folder listing failed because a zsh pattern did not work in the environment where the AI ran it. Another time the AI used a row of equals signs as a separator in the output, which zsh reads as a command, and the output ended with an error. Both times it repeated the command differently.
Final checks
At the end the AI ran the checks from the definition of done:
- the tests again, really run and not taken from the cache: 55 tests in seven classes, none failed,
- the APK with only the permissions listed in the brief,
- a search of the app code for words about advice and dosing found nothing,
- a search for paths with the user’s name found nothing,
- in addition, a test of the script with a device that does not exist and an unknown command: both ended with an error and an explanation.
In total: compilation and tests passed the first time. There were four small fixes: one compiler warning, one change to the permission list and two rounds for the dialog buttons, the first of them unsuccessful. The weight log had three rounds of fixes. The traps that stopped that build did not come back here; this brief names them in advance.
What was not checked
The log lists it itself:
- whether the reminder really appears on time and with what text (the alarm is five days away, there was no waiting),
- scheduling after a phone restart and after an app update,
- the request for notification permission (the permission was granted in advance),
- exporting and restoring a backup, exporting the log, deleting everything, the buttons into system settings,
- the pen menu, several pens and switching the active one, editing and deleting an entry with undo, an administration from the technical reserve in the interface,
- picking a date and time, a custom colour shade, the dark theme, English, the plunger animation.
The tests cover the logic behind many of these, but not the interface. So the app is checked on the emulator along its main path, not all of it and not on a phone.
What I would change in the brief
These are my conclusions from the log, not entries in it:
- Tags in dialogs too. The brief should say that the setting for element tags also has to go inside dialogs. The AI wrote this into its ideas list itself.
- Order on the emulator. The app’s language and the notification permission can only be set after the first install; the brief says “in advance”.
- Another zsh trap.
localinside a loop belongs in the list of traps in part 7. - A longer check. The emulator steps cover the main path. Restoring a backup, the pen menu and an administration from the reserve deserve steps of their own.
The AI also listed in its ideas: automated interface tests, a build with a smaller APK, a check with the Android Lint tool, and a line in Settings showing whether the app may schedule exact alarms.
The brief in part twelve is the one the build ran from. These changes are not in it.
Onto a phone
I did not install this build on my phone. The instructions the AI wrote for the app describe the steps like this: on the phone turn on Developer options and USB debugging in them, connect the phone with a cable and run ./start.sh install (./start.sh instaluj in the Slovak brief). The script never uninstalls the app, because that would delete all entries. The app is signed with the key of the computer it was built on, and a build from another computer will not install over it; in that case export a backup in the app first. What caught me out installing on a Samsung is in part four.
Anyone who builds the app from the brief does so at their own risk and only for themselves. A doctor or pharmacist has to confirm the pen values and every conversion.
There is no app code or APK to download here. The whole process is also in a video on YouTube, in Slovak; the voice in it is AI-generated from my own.
I prepared this text with the help of AI from my own notes and the build log.