Building Nodus: A Masterclass in Human-AI Pairing
Building Nodus: A Masterclass in Human-AI Pairing
In the world of software development, new tools often promise to increase speed. But occasionally, a technology comes along that doesn't just make you faster—it changes how you think.
Over the last few months, I’ve been building Nodus, a Clinical Decision Support System (CDSS) for Functional Medicine. What started as a simple Python script aimed at automating root cause analysis has evolved into a production-ready Next.js application powered by advanced RAG architectures.
But the real story isn't just about the code. It’s about the process. This project served as my laboratory for testing a new way of working: Agentic Pairing.
The Evolution: From Prototype to Nodus
Every great product starts as a messy prototype.
- Phase 1 (Prototype): A Streamlit app. It was a monolithic script (
main.py) that did everything: PDF parsing, vector search, and UI rendering. It was quick to build but impossible to scale. - Phase 2 (Nodus): A modular Microservices architecture. Next.js for the frontend, FastAPI for the backend, and a dedicated RAG engine.
Moving from Phase 1 to Phase 2 wasn't just a refactor; it was a complete paradigm shift. And I didn't do it alone. My pair programmer was an AI Agent.
The "Third Brain" in Architecture Decisions
As a developer with ~20 years of experience in the enterprise .NET world, I have strong opinions on architecture. However, entering the GenAI space required a different mindset.
1. The PDF Trap
Early in the project, I insisted on generating PDF reports for doctors. It felt "enterprises."
My AI partner pushed back: "Generating PDFs on the server adds unnecessary overhead and binary dependencies. For an MVP, why not render Markdown and let the browser handle the printing?"
Result: We cut development time by 30% and removed complex dependencies like libcairo from our Docker containers.
2. The Multilingual RAG Strategy
I assumed we needed to translate medical documents into Turkish for our local users. The Agent suggested a bolder approach: Cross-Lingual RAG. "Keep the Knowledge Base in English. Medical literature is standardized in English. Use a multilingual embedding model to match Turkish queries to English content, then let LLM generate the response in Turkish." Result: We avoided translation errors in critical medical terms and tapped into a much larger (English) knowledge base without sacrificing the local user experience.
Technical Deep Dive: Safety Guardrails
In Functional Medicine, "context" is everything. A standard RAG system might suggest "Betaine HCl" for low stomach acid. But what if the patient has Gastritis?
We implemented a "Safety Injection" layer.
Instead of relying on the model's training data, we created a safety_guidelines.md file—a constitutional document for the AI.
This file is injected into the System Prompt at runtime, ensuring that even if the vector search misses a contraindication, the Model knows the hard rules.
Reflections on "Agentic" Development
Working with advanced agents like Antigravity isn't about copy-pasting code. It's about intent engineering.
- Level 1: Asking AI to write a function.
- Level 2: Asking AI to refactor a class.
- Level 3 (Agentic): Debating architectural trade-offs, simulating edge cases (like "What if the vector score is 1.04?"), and having the AI proactively suggest guardrails.
Nodus is now live, assisting doctors in analyzing complex patient data. But the biggest takeaway for me is this: The future of coding isn't doing less work; it's doing higher-leverage work.