The Shifting Sands
In which our protagonist discovers that nature is also a system, and systems can be debugged.
The creek died on a Tuesday and the town bell rang three times, which was the signal for water emergency, and Kenji was in the market square teaching Lian how to define a water_purify function when he heard it and his stomach dropped the specific way a stomach drops when an alert page arrives in the middle of a Tuesday afternoon.
He knew what the bell meant. He had been in Oakhaven for two months. He had walked the streets. He had asked the questions. He had run the numbers in his head the way he had once run them in production dashboards, and the numbers had been bad for weeks.
[detect_water_sources: 4 sources online (7 days ago)]
[detect_water_sources: 3 sources online (3 days ago)]
[detect_water_sources: 1 source online (now)]
[Compiler note: this is the minimum viable hydrology. Please advise if you would like to update.]
The creek was gone. The northern well was half what it should be. The southern reservoir had mud at the bottom. The crop wells were dry. Eleven days, the engineers had said. Maybe fourteen if they rationed strictly. After that, the wells would start to fail too.
Pip pulsed on his shoulder, urgent, blue. The pulse felt like: "The system is dying."
Kenji sent back, in the language he and Pip had built together: "I know. Let me see the request."
The emergency council was in session before the sun hit the western wall. Mayor Aldric at the head of the table, pale and sweating. Captain Elara at his right, writing in her book. The three engineers on his left, arguing about wells. And Kenji, who had been invited as a "consultant," standing by the window, looking at the dry creek bed and running numbers in his head.
"We have eleven days," the head engineer said. "Maybe fourteen. After that, the wells will start failing too."
"Options?" the mayor said.
"None good. We can send people south to buy water, but the roads are bad and the southern kingdoms are hoarding. We can dig deeper wells, but that takes weeks. We can pray, but that has a poor track record."
The room was quiet. Kenji was quiet. Pip pulsed again. The pulse felt like: "Say it."
Then Kenji said: "What about an aquifer?"
The room looked at him. Elara's pen stopped moving.
"Underground water," Kenji said. "There is a layer of it somewhere below us, between two rock strata, like a sandwich. We just need to reach it."
"The engineers have looked," one of them said, irritated. "The geology here is sandstone. The water table is too deep."
"Not a well. A network. We drill down to the aquifer, then we use a controlled spell to draw the water up through permeable stone. The water fills a small reservoir. The reservoir feeds the wells. The wells feed the town. The whole thing runs on gravity and a small mana cost."
"Run on gravity," the engineer repeated, flatly. "You want to redesign our water infrastructure in the middle of a drought, with magic, in a week."
"I want to debug the town," Kenji said. "The water system has been failing for years. You have been patching it. I am proposing a refactor."
The engineer opened his mouth to argue. Elara's voice cut him off.
"How much will it cost?"
"Mana cost is low. The infrastructure is mostly stone and wood, which we have. The drilling takes three days if I can get fifty volunteers. The spell work takes another two. We have water by day six, with five days of margin."
Elara looked at the engineers. The engineers looked at each other. The head engineer said, slowly: "It might work. The sandstone is porous enough. The mana cost is the unknown. We do not have a mage who can do controlled spell work at that scale."
"You do now," Kenji said.
The mayor looked at Elara. Elara looked at Kenji. She said: "You will work with our engineers. You will explain every step. You will not do anything without their approval. And you will do it in five days, not six."
"Five days," Kenji agreed.
[Skill: structured_engineering (passive, range: town-scale) acquired through use of new_function()]
[Compiler note: this is a function the developer did not ask for. The system is, in a small way, ahead of the developer.]
[Compiler note: the developer is, in a small way, learning.]
The system was proud of him. The system was, in a small way, a colleague. Kenji had not had a colleague in ten years, and the first one he had was a debug overlay inside his own skull, and the colleague had just told him, in the driest possible language, that the developer was learning to scale.
He left the council room with a deadline, a team of skeptical engineers, and a small glowing dragonfly on his shoulder. He also left with, for the first time in this world, the specific feeling of a person who has been given a problem and is now allowed to solve it. It felt, he realized, exactly like getting a really good ticket at his old job. The kind of ticket you wake up early for.
Pip pulsed. The pulse felt like: "Time to debug."
Kenji sent back: "Yeah. Time to debug."
He walked out into the dry evening, and the work began.
The first day was chaos. Kenji wrote the spell definition on a piece of paper, in the careful pseudocode he had developed over two months of trial and error, and handed it to the head engineer.
[aquifer_draw]
inputs: depth, radius, draw_rate, mana_cost
outputs: water_volume_per_hour
cost: low
side_effects: reduces ambient mana by 3% within 100m
stability: medium (collapses on miscasting)
The head engineer read it. He read it again. He looked up at Kenji with the expression of a man who has been asked to compile a language he has never seen.
"This is a spell," the engineer said, slowly, as if testing the word.
"This is a function," Kenji said. "Spells are functions. You define them. The system compiles them. You run them. You debug them when they fail."
"We do not debug spells."
"You do now. Same principle, different vocabulary."
By the end of the first day, the engineers were arguing. By the end of the second day, three of them were helping. By the end of the third day, they were deferring to him on mana-related questions and he was deferring to them on stone-related questions, and the work had the specific rhythm of a system coming online.
Lian ran the spell calibration. The volunteers dug. The mana reservoir filled, slowly. The town watched, in the worried way a town watches when the water is dying and the strange foreigner has said the water can come back.
Pip orbited Kenji's head, blue and steady, and pulsed once, very quietly, in a tone that was, in a small way, ahead of him.
[Compiler note: 47% of spell functions are now defined by the apprentice. The system approves.]
He would need every one of those functions, and every one of those engineers, and the principle of drawing water through permeable stone, in a year and a half when a much larger drought would hit a much larger region, and the same spell, scaled up and out, would be the one that saved a continent. He did not know that yet. He knew only that the creek was dry, and the town was watching, and the spell had to work.
Day four. Day five. The water came up through the rock, slow and clear, filling the small reservoir, feeding the wells, returning to the town in the way that water returns when the system that holds it is finally understood.
The mayor cried. Kenji did not. The engineers did not. Elara, who had been on the wall every night watching the dark fields, allowed herself one quiet smile, the kind of smile that reaches the eyes, and went back to her rounds.
Pip pulsed, very softly, and the pulse felt like: "It worked."
Kenji sent back: "Yeah. It worked."
But that night, late, while the town slept and the new water ran through the new pipes, Kenji was still up, looking at the dry creek bed from the window of the guild hall, and Pip pulsed, sharp, urgent, and the pulse was not a celebration. The pulse was a warning.
To the south, past the dark fields, past the empty farms, past the tree line where the cult had been quiet for two months, a small grey-robed figure was writing in a notebook by the light of a sickly green candle, and the notebook was filling with the same numbers the engineers had been using, and the same diagrams, and the same careful observations, and at the top of the page, in handwriting that was not quite human, was a single word: Oakhaven.
The drought was not random. The drought was a test. And the spell that had just saved the town was, in the driest possible language, the kind of thing that the cult had been told to look for.