Inspiration
Artisanal and small-scale gold miners use mercury to separate gold from ore. Much of that mercury is lost to the air when amalgam is burned in the open, and much of the rest ends up in soil and water. Published estimates put about 41% of global ASGM mercury emissions into the atmosphere. Most miners have no simple way to know how much they lose per batch, or what a cleaner method would save. I wanted a tool that could answer that question in the language miners actually use.
What it does
A miner describes a batch in Swahili or English, for example "Used 50g mercury on 200kg whole ore, burned in the open." Zebaki:
- Extracts the ore weight, mercury used, amalgamation method and burning method. Anything unclear is marked
UNKNOWN, never guessed. - Asks the miner to review the extracted values. Nothing is saved until they confirm.
- Estimates how much mercury goes to air and to tailings, with a risk rating.
- Compares three methods (open burning, retort, and concentrate with a retort), showing the grams that would stay out of the air and tailings.
- Adds the batch to the cooperative's totals, shown on a dashboard with charts, a per-miner table and a printable summary.
Every figure carries an evidence label: ESTIMATED for air releases, NOT VALIDATED for tailings, and MODELLED for savings.
How I built it
- Jac and byLLM for the agents, the graph of cooperatives, miners and batches, and the web server.
- Claude (Anthropic API) for two language tasks: extracting batch details from free text, and writing short Swahili advice.
- Plain HTML, CSS and JavaScript for the page, with Chart.js for the charts. The page is available in English and Kiswahili.
The main design decision was to keep AI out of the calculations. Language tasks go to the model. Loss estimates use fixed, documented rules, so every figure can be checked and cited.
For retort use, the air estimate is
$$ \text{to_air} = (m - m \cdot t) \cdot (1 - c) $$
where $m$ is mercury used, $t$ is the tailings share for the method, and $c = 0.9$ is the retort capture rate. Open burning sends the whole amalgam to air. The tailings shares are placeholders, so treat them as illustrative until they are calibrated.
Challenges we ran into
- Keeping the numbers honest. Some sources give figures that look like tailings factors but are actually shares of national losses. I checked each one and wrote down what each source does and does not support, in the README's source table.
- Reliable extraction. Free-text reports can be ambiguous. The review step, and the rule that unclear details count as the worst case, were my response.
- Deployment. The server needs more memory than the cheapest hosting plans provide, and I could not keep a live demo within my budget. The project runs locally, and the README explains how.
Accomplishments that we're proud of
- A working prototype that goes from a free-text report to a reviewed, saved batch and a cooperative dashboard.
- Honest evidence labels on every figure, so no placeholder is presented as a measurement.
- A bilingual interface, in English and Kiswahili, with a summary report that can be printed or saved as PDF.
- A README that lists each factor with its source, value and status.
What we learned
- Being explicit about uncertainty builds more trust than a confident-looking number.
- Separating AI from rules makes a system easier to audit.
- A working local demo, with clear documentation, is more useful to a reviewer than a broken hosted one.
What's next for Zebaki
- Calibrate the tailings factors against field measurements from a cooperative.
- Add measured mercury recovery from retort operators, labelled MEASURED.
- Add reporting periods, so cooperatives can compare progress over time.
- Add follow-up questions to the intake agent when information is missing.
- Validate the Kiswahili text with a native speaker, and test the tool with miners and cooperatives.