The Problem

Kenya's Finance Act 2023 Section 16 mandates that no business expense is tax-deductible without an official eTIMS electronic tax invoice. This requirement has created an existential crisis for East Africa's 16 million informal traders, who lack access to the laptops, smartphones, and stable broadband required by existing eTIMS clients. Missing a monthly filing triggers an immediate KES 2,000 fine per trader, exposing millions to financial ruin or exclusion from corporate supply chains.

What This Does

JibuTax transforms any cellular phone line into a government-compliant fiscal point-of-sale terminal. The backend (backend/app/main.py) is a FastAPI application wired with LangGraph to manage a multi-agent workflow. The orchestrator (orchestrator/conversation_state_machine.py) manages the conversation flow, routing user input through agent nodes located in backend/app/agent/nodes/: extraction.py parses spoken trade details (Swahili/Sheng/English), tax_math.py calculates the 1.5% Turnover Tax, and validation.py checks compliance. The KRA integration is handled by backend/app/services/kra_service.py and exposed via backend/app/api/v1/kra.py. On the frontend, frontend/src/App.jsx bootstraps the React application via Vite, with UI components like TaxCalculator.jsx and InvoiceViewer.jsx interfacing with the API through frontend/src/services/api.js. Month-end autonomous filing is handled by backend/app/cron/month_end.py and backend/app/celery_app.py, which aggregate ledger data and submit NIL returns with Obligation Code 7 if sales are zero.

How It Is Wired

Execution begins at backend/app/main.py, which starts the FastAPI server and initializes the Celery app for background task processing. The conversation state machine in orchestrator/conversation_state_machine.py acts as the primary router, passing the dialogue context to the agent graph (backend/app/agent/graph.py). This graph sequences the nodes: extraction extracts structured data from unstructured speech, tax_engine.py (implied by the node list and services) performs the calculations, and kra_service.py submits the return. The resulting invoice is dispatched via backend/app/services/whatsapp_dispatcher.py or SMS. The database layer resides in backend/app/database.py, utilizing models defined in backend/app/models/ (taxpayer.py, tax_return.py, invoice.py, ledger.py). The immutable ledger is a core dependency for the cron job's aggregation logic. Outside the process, the system interfaces with KRA's eTIMS API and, via elevenlabs/agent_config.json and orchestrator/elevenlabs_webhook.py, handles voice input and synthesis.

How To Use It

Setup:

  • Backend: cd backend && pip install -r requirements.txt
  • Frontend: cd frontend && npm install
  • Docker: docker-compose up --build (defined in root docker-compose.yml)

Configuration:

  • Copy .env.example files from the root, backend/, and orchestrator/ to .env.
  • Required keys (inferred from README and service files) include KRA credentials, M-Pesa till numbers, and ElevenLabs API keys. See .env.example for the defined variables.

Running it:

  • Start the API: uvicorn backend.app.main:app --reload
  • The test suite can be invoked from the root: pytest (configurable via pytest.ini).

Real-World Use

A trader dials the JibuTax number. The elevenlabs_webhook.py processes the incoming audio, feeding it into the conversation_state_machine.py. The agent extracts: "I sold goods to a Safari Hotel for 5,000 shillings." The tax_engine calculates the 1.5% turnover tax (75 shillings). kra_service.py submits the eTIMS return, and whatsapp_dispatcher.py sends the official QR-stamped invoice to the trader's WhatsApp within the 500ms target window. On the 18th of the month, cron/month_end.py runs autonomously, aggregating the ledger and filing a NIL return if no sales occurred, protecting the trader from the KES 2,000 late-filing penalty.

Code Health & Issues

  • Medium - No LICENSE file found in root: Usage and redistribution rights are unclear despite the MIT badge in the README.
  • Medium - No CI/CD pipeline detected: No automated build or test gate exists in .github/; the README claims "65/65 Passed," but the static analysis confirms the absence of pipeline configuration.

The Bottom Line

This is a technically dense, well-structured repo that successfully bridges a complex regulatory gap (KRA eTIMS) with a low-friction interface (voice phone calls). The LangGraph multi-agent architecture is the standout feature, providing clear modularity for the extraction, tax, and filing stages. However, the missing license file and complete lack of CI/CD are significant barriers to professional adoption and contribution. It is best suited for fintech teams or NGOs in East Africa needing to modernize tax compliance for informal traders, provided they can secure the necessary API keys and address the SDLC gaps.