Inspiration

Every AI coding assistant in the world was built for a developer in Virginia. They default to Stripe. They don't know what USSD is. They've never heard of Moniepoint. They assume stable internet, dollar payments, and AWS.

I'm a developer in Port Harcourt, Nigeria. That's not my reality. The African developer stack is Paystack, Flutterwave, Moniepoint, USSD flows, NGN/kobo currency handling, and BVN verification. No existing AI coding tool knows this stack deeply. None of them run offline.

What it does

StacksNG is an offline AI coding assistant that answers questions about the African developer stack. Ask it how to verify a Paystack webhook, handle a Flutterwave bank transfer, implement USSD flows, or format NGN currency: it answers correctly, with citations, entirely on-device. No internet. No API fees. No cloud dependency.

How I built it

RAG system built on qwen2.5-coder:7b via Ollama. 780 chunks scraped from Paystack, Flutterwave, Monnify, and Termii documentation, chunked, embedded with nomic-embed-text, stored in SQLite. Vector similarity retrieval injects relevant context before generation. Fully offline on an Intel i5 11th Gen with Iris Xe integrated graphics.

Challenges I ran into

  • An adversarial test batch asking about payment providers deliberately left out of the corpus (Kuda, PalmPay, Interswitch, Paga, OPay) found the model fabricating full, plausible-looking API integrations for 3 of 5, complete with a fake source citation for content that didn't exist anywhere. A retrieval-confidence threshold looked like the obvious fix; the actual similarity numbers proved it wouldn't have worked, since the worst fabrication scored higher similarity than the cleanest correct "not in my knowledge base" response. A one-paragraph system-prompt fix looked like it solved it: 5 of 5 declining correctly on one run. It wasn't solved. An independent 15-trial re-test (5 providers × 3 reps, run by a second AI agent with no access to my prompts) found it was actually 66.7% reliable, and unevenly: 3 providers held at 100%, 2 as low as 0-33% (the two whose webhook-verification content was most similar in shape to Paystack/Monnify's), and the chat call ran at temperature 0.2 with no fixed seed. Fixed for real with a deterministic pre-generation gate: a known-out-of-corpus-provider list checked before retrieval or generation ever runs, independent of sampling. Re-verified independently at 15 of 15.
  • Paystack uses TLS fingerprinting that blocks Python requests, solved with subprocess curl
  • Flutterwave embeds its full API spec as JSON inside the page, extracted directly from #ssr-props
  • nomic-embed-text 500s silently above ~8KB input, fixed with 6000-char truncation
  • SQLite write locks when scraper and embedder run concurrently, sequenced them

Accomplishments that I'm proud of

780 chunks, 100% embedded. POC verified: Paystack webhook HMAC SHA512 answered correctly offline with the right header name, algorithm, and working Node.js code, citing the exact source URL. Runs within the ADTC standard laptop profile on an Intel i5 with Iris Xe integrated graphics. Final official profiler pass (participant → audit → compare, container-capped at 7.5 GB / 4 CPUs): verdict PASS, all four checks within tolerance, Stotal ≈ 49 (Sacc 78 on arc_easy, Sperf 29.6, Seff 7.1).

What I learned

The corpus is the product. A generic qwen2.5-coder:7b doesn't know how to verify a Paystack webhook. With 340 Paystack chunks in context, it answers correctly every time. The African stack isn't a niche. It's the infrastructure millions of developers across the continent build on every day. It just hasn't had an AI tool that knows it.

A fix that scores 5/5 once isn't a fix, it's a sample. At temperature 0.2 with no fixed seed, one clean run and one bad run are both real draws from the same distribution. The number that counts is the one from an independent, repeated, adversarial retest, not the first result that happened to look good.

What's next for StacksNG

  • Africa's Talking USSD docs to strengthen offline coverage
  • CLI polish for developer experience
  • Hybrid dense + keyword (BM25) retrieval, the more robust fix for the entity-grounding problem above, deferred for this submission since it adds a new dependency against a tight memory budget
  • Expanding to Ghana (MTN MoMo), Kenya (M-Pesa), and South Africa (Ozow) developer stacks

Built With

  • docker
  • flutterwave-api
  • llama.cpp
  • monnify-api
  • nomic-embed-text
  • ollama
  • paystack-api
  • python
  • qwen2.5-coder:7b
  • rag
  • retrieval-augmented-generation
  • sqlite
  • termii
Share this project:

Updates