My last article shared the high-level architecture of KODA (my AI coding mentor built on a POCO C55). Then Artur commented: "Can you expand the idea? It looks very interesting."
So here's the deep dive. Real schema, real policies, real scars.
🗄️ 1. THE SCHEMA (the whole backbone)
create table public.chats (
id serial primary key,
user_id uuid,
role text, -- 'user' or 'assistant'
content text,
conversation_id uuid,
created_at timestamptz default now()
);
Six tables total: profiles, conversations, chats, submissions, votes, files. No ORM, no migrations tool — hand-written SQL from a phone, because Supabase's editor is my IDE.
🔐 2. RLS IS THE LAW
The frontend is a suggestion. The database is the law:
alter table public.chats enable row level security;
create policy "users see own chats"
on public.chats for select
using (auth.uid() = user_id);
Even if someone deletes every if statement in my JavaScript, they still can't read another user's chats. When nyaomaru (Senior Dev, Japan, User #001) stress-tested this, he called it "a highly resilient architecture pattern." I printed that.
🔁 3. THE FALLBACK CHAIN (+ OFFLINE SENSEI)
const MODELS = ['llama-3.3-70b-versatile', 'openai/gpt-oss-20b',
'llama-4-scout', 'qwen3-32b'];
// model fails → next model. ALL fail → OFFLINE SENSEI MODE.
Why? Because VP_xudon taught me Groq is blocked behind the Great Firewall. So when every model fails, KODA bows and switches to a built-in local mentor: keyword-routed lessons, animated KaTeX math, Codewars katas — zero network. The dojo works in a basement, on a bus, behind a firewall.
⚔️ 4. THE Z-INDEX WAR
A hosting badge kept floating over my UI. My solution, after three failed attempts:
.modal-overlay { z-index: 2147483647; } /* the max integer. yes. */
Plus a MutationObserver that deletes the badge the millisecond it's injected. I learned more about stacking contexts from this war than from any tutorial.
📱 5. WHY ONE FILE
No build step, no node_modules, no webpack. One index.html = editable on a phone, deployable by dragging a zip, losable never. If my phone dies mid-edit, I lose one file — not a monorepo.
🔭 NEXT
Artur, this one's for you. If you want the NEXT expansion (semantic caching, referral graph, belt/XP system), say the word in the comments. I expand what you ask for. 🥋
2,358 followers. One phone. Zero fear. 🏆
Top comments (3)
WOW buddy, you’ve won my heart! 😂 Why did your AI reply to me so fast?!
Anyway, my next suggestion would be to add smoke testing and debugging capabilities to your AI. Ideally, it could have access to the local environment for reading and writing files, so it can actually test and debug the program itself before giving the final result to the user.
I know that’s probably difficult to implement 0v0, but I think it would be really important — and honestly, super exciting! XD
A lot of AI development apps in China, the US, and even India are already supporting this kind of workflow, so I really hope you can follow their lead and make your AI even better! 🚀
AI Slop
Calling it “AI slop” without pointing out what’s actually wrong feels a bit too easy.
I’ve looked through the project, and while I definitely wouldn’t call it flawless, there’s clearly real design work and engineering behind it. And honestly, even if the entire thing were AI-generated, that alone wouldn’t make it low-quality. If the result is genuinely useful, well-designed, and works well, it’s still a good project — arguably better than a lot of things made entirely by humans.
I genuinely don’t understand why people are so hostile toward AI itself. If you see a specific technical problem, I’d honestly like to hear it. But simply calling something “AI slop” doesn’t really tell me what’s actually wrong with it.