Highlights
- Preserved the SMB PWA's cash/margin analysis, forecasting, scenarios, replenishment, and action workflows while adding an authenticated procurement pipeline.
- Implemented OCR/extraction review, versioned catalogs, BM25 + neural retrieval, specification checks, and explicit product decisions with provenance.
- Built bounded native tool research with immutable execution receipts, coverage-aware planning, citation-only backend fact materialization, and separate native/backend attribution.
- Evaluated the preselected hybrid on 60 held-out RFQs: 52 verified completions and all 324 lines source-covered. Coverage-aware native planning completed 56/60; neither reached the 57/60 target.
- Kept quote amounts deterministic and approvals human-controlled; finite-sample evidence checks do not establish production accuracy or authorize ordering, payments, or external delivery.
Key metrics
Media
Tech stack
Business problem and motivation
Small-business owners need usable explanations of cash, margin, inventory, and supplier decisions without a dedicated analytics team. Procurement adds another problem: messy RFQs, near-matching products, incomplete commercial facts, and proposals that need human review.
I built the application, workflow contracts, retrieval/rules integration, agent controller, evidence verification, and evaluation tooling. The project uses existing models, OCR, database, and web frameworks; it does not claim to train a foundation model or replace commercial judgment.
Original SMB operating copilot
The original PWA remains an owner operating workspace: preview and confirm CSV/Excel records, track sales/purchases/expenses and recurring obligations, inspect cash and margin, investigate evidence-backed recommendations, and move actions through open/watching/snoozed/resolved states.
Forecast Lab exposes baseline forecasts, assumptions, warnings, and scenarios. Cash-aware replenishment combines stock, sales velocity, supplier costs, expiry, and obligation pressure. The India-first pharmacy showcase uses sanitized fixtures; it is a demonstration domain rather than a verified multi-industry deployment.
System architecture
A Next.js/TypeScript PWA and Better Auth session layer call a signed same-origin proxy. FastAPI enforces workspace membership, roles, revisions, and source freshness. PostgreSQL stores immutable RFQ/catalog/research/quote history; Redis and Celery provide durable background delivery with retries and explicit publication boundaries.
The original analytics/AI interfaces coexist with the procurement modules. Local Ollama handles extraction and native tool inference; pgvector stores learned catalog embeddings. Shared contracts keep API and UI state explicit. Docker Compose supports self-hosted operation without implying that a production deployment has been performed.
Self-hosted AI infrastructure
The SMB analyst supports local-open, BYO cloud-provider, and hybrid model modes with provider/runtime metadata. The procurement evaluations use actual local Ollama calls and pinned model identity: qwen3:4b was selected for the documented extraction configuration, while the Phase 3.2 research campaign uses qwen3:8b.
These are different workloads and evaluation runs. Local inference supports data control, but model choice alone does not make extraction reliable, evidence true, or agent planning complete. Explicit source checks and review remain necessary.
RFQ document-processing pipeline
The RFQ workflow accepts PDF, CSV, XLSX, and UTF-8 text, persists processing jobs, parses native content, and invokes Tesseract for scanned pages. Structured line-item extraction runs through schema and source-association checks before a reviewer corrects or approves an immutable RFQ revision.
PostgreSQL jobs and receipts survive worker delivery; Redis/Celery coordinate execution. A successful parse is not an approved business record. Authentication, workspace isolation, revision checks, and explicit human confirmation remain separate gates.
OCR and structured extraction
Phase 1.1 adds bounded OCR preprocessing, geometry-aware word/row/column associations, selective source routing, and conservative merging. Reliable deterministic values are retained, unresolved regions can reach the local model, and disagreements remain reviewable rather than silently replacing source text.
Extraction quality remains weak on difficult scans. In the independent v2 synthetic evaluation, scanned manufacturer-part-number exact match was 0/40; the selected hybrid's broader MPN accuracy was 48.75%. Low-resolution identifiers, orientation, and incomplete added rows prevent unattended extraction readiness. These historical extraction results are separate from the later research benchmark, which starts with explicitly approved records.
Hybrid retrieval and catalog intelligence
Catalog imports have preview/confirmation, versioned offers and product variants, and durable neural indexing. Exact manufacturer/part-number matching, genuine BM25, local Nomic embeddings, pgvector exact-cosine search, reciprocal rank fusion, and transparent specification reranking expose why a candidate was returned.
Retrieval and compatibility are different: a semantically similar item may have the wrong capacity or configuration. Missing specs remain insufficient information; manufacturer conflict and variant ambiguity need explicit review. Plain fusion ranked worse than BM25 on the documented fictional corpus, so the project reports that failure alongside the reranked hybrid. No open-world production relevance guarantee follows from the synthetic benchmark.
Tool-using procurement agents
Research starts from an approved RFQ, reviewed product resolutions, immutable catalog versions, and user-attested supplier offers. Actual Ollama native tool calls request bounded read-only local information. Durable receipts bind each execution to the captured workspace/revision and expose whether it came from a native model decision or backend scheduling.
Phase 3.2 adds a closed four-line batch RPC and backend-defined remaining-work tracking. Planning, tool execution, finalization, and one bounded citation correction have distinct budgets. Required source reads come from the backend contract; the model cannot redefine completeness or grant itself more scope.
Evidence and citation verification
Phase 3.1 changes finalization to citation-only selection: the model chooses subject-bound receipt/pointer groups, while the backend materializes exact commercial scalar values. Phase 3.2 carries those bindings through physical parent batch receipts. Ownership, type, RFQ line, product, offer, source version, and fingerprints are independently checked.
Unknown price or availability remains explicit. A rejected invalid reference cannot become an accepted fact because a summary sounds plausible. Source inspection, required citation verification, published research completion, and quote input readiness are four distinct states; complete inspection can still end in needs-attention when citation finalization fails.
Human-in-the-loop decisions
People correct and approve RFQs, resolve products, attest sources, choose offers, and review quotes. Research does not make those decisions implicitly. Supplier attestations are local human source claims, not independently verified live distributor feeds.
The UI exposes source coverage, per-line progress, partial/staged/published evidence, remaining unknowns, native/backend execution origins, and durable activity. A complete research run may correctly report a missing price and still need human follow-up before any quote can be ready.
Internal quote preparation
Financial calculations use deterministic backend Decimal logic and explicit human-selected immutable offers. Pack/MOQ policy, quantity, currency, margin/markup, shipping, discounts, taxes, and validity remain declared inputs. Model-generated amounts never become authoritative financial values.
Human review creates immutable internal approvals with source snapshots and audit history; later drafts link to prior versions. The implementation does not automatically place orders, send quotes to suppliers/customers, deliver external messages, or perform payments. The retained strict JPY fractional-quantity oracle expected failure remains disclosed.
Reliability and authorization boundaries
Admission, each tool receipt, and publication recheck membership, captured revisions, freshness, and cancellation state. Pending calls, immutable receipts, attempt counters, and single-publication boundaries support worker recovery and repeated delivery without treating a retry as new authority.
Actual worker SIGKILL and Redis interruption checks are recorded separately from controlled PostgreSQL-outage fixtures. Recovery was safe but could still end incomplete. Coverage display caches can lag committed receipts until recomputation; persisted evidence is authoritative. The 240-second publication deadline does not forcibly cancel all remote computation, and no automatic scope continuation is provided.
AI evaluation methodology
Phase 3.2 freezes an independently authored fictional corpus of 96 RFQs and 514 lines: 16 development, 20 validation, and 60 held-out cases, with distinct product/source families. Line counts range from one to twelve. Expected facts, unknowns, required reads, tool permissions, and quote readiness are authored independently of production tools and scores.
D/four was selected before the final held-out run. Four configurations then executed real local qwen3:8b inference on each of the 60 cases, giving 240 held-out executions. An independent standard-library oracle verifies materialized values, exact associations, required coverage, unknowns, and readiness. Initial failures and within-run corrections stay in their original denominators.
Quantitative results
The selected bounded hybrid completed 52/60 RFQs (86.7%) with 324/324 lines source-covered. Coverage-aware native B completed 56/60 (93.3%), native batching A completed 51/60, and frozen Phase 3.1 completed 4/60 on this new corpus. Neither selected D nor best-scoring B met the frozen 57/60 verified-completion target.
Across all 240 held-out executions, the independent oracle inspected 5,274 materialized facts and 651 tool receipts, detecting zero unsupported/misbound accepted facts and zero unauthorized successful tools. These are finite-sample observations, not universal safety guarantees. The report records 473 backend passes with one retained strict expected failure and 21 passing browser scenarios.
A separate zero-model deterministic source-report baseline passed 96/96, including 60/60 held-out. That simpler pipeline was more reliable for mandatory source reporting; its result is not evidence of agent planning or optional research utility. Timing interference and later serialized development-only timing trials are separately documented, so this page makes no production latency claim.
Known limitations and future development
This is a controlled fictional-corpus evaluation using one small local research model. Complete sources do not prevent omitted/misbound references, and all eight hybrid completion failures remain counted. Larger scopes can exceed source/reference/byte budgets; extraction scan failures and realistic no-match evaluation remain unresolved.
The next milestone should close research-quality and extraction gates with a newly frozen independent evaluation, explicit comparison to the deterministic pipeline, more varied documents/sources, and serialized performance measurements. Live supplier connectors and external commercial actions require separate implementation and review; they are not current capabilities.
Related projects
Adaptive Digital Assistant (ADA) — Privacy-First Personal AI System
AI Systems Engineering · 2026
A privately hosted personal AI system connecting local LLM inference, source-linked memory, document retrieval, and an encrypted Kotlin Android client. I built explicit review, consent, and recovery boundaries across the stack, with separately recorded host validation and remaining physical-device voice acceptance gates.
Mission-X CityCar — Autonomous Mobile Robotics Platform
Robotics · 2026
A ROS 2 mobile robotics platform connecting Gazebo city simulation, graph navigation, mecanum-drive control, sensor feedback, and a React control interface. I implemented reusable command and hardware interfaces, with explicit separation between source-supported simulation workflows and Raspberry Pi functionality that still needs measured physical validation.
Event-Based Star Tracking for Spacecraft Attitude Estimation
Space Autonomy · 2026
A Speed-Aware EBS-EKF research prototype for event-camera star tracking that improves low-light spacecraft attitude estimation by making centroid correction depend on both brightness and image-plane speed.

Automated Goalie: Ping Pong Ball Trajectory Prediction System
Robotics · 2025
A closed-loop robot-learning prototype that detects a ping pong ball, estimates its 3D motion, predicts the landing point, and rotates a servo-driven blocker in real time on a Raspberry Pi-based hardware setup.