The Architecture Behind Cortex

What I built, what failed, and why the boring approach won.

Mohamad Sakkal · March 2026

Most apps store your data and let you search it. Cortex does something different. When you write an entry, AI reads it, understands it, and creates a structured layer on top. Later, when you ask a question, the system uses that structure to find the right entries and lets the AI interpret your original words fresh.

Here's how it works, step by step.

Step 1

You Write

You open the app and write whatever is on your mind. Text or voice. No forms, no prompts, no structure required.

Example entry
I'm noticing that today I'm not feeling very energetic. I don't have energy to talk too much. I'm avoiding complex discussions. I feel drowsy and just want to be left alone.

This is saved as raw text on your device. Nothing leaves your phone yet.

Step 2

AI Reads and Understands

The moment you save, the AI reads your entry and extracts structured information from it:

This happens once, automatically. You don't see any of it. It runs in the background.

Step 3

Everything Stays on Your Device

Both the original text and the AI's structured understanding are stored locally on your phone. Your journal never lives on a server. The structured data sits alongside the raw text like an invisible index.

After a week, you might have 30+ entries. After a month, hundreds. Each one has been read and understood by the AI, and each one still has the original text intact.

Step 4

You Ask a Question

Days or weeks later, you open the chat and ask something.

Example question
What's been happening with my energy levels this week?

Now the system needs to find which of your entries are relevant to this question. It can't send all of them to the AI. It needs to pick the right ones.

Step 5

The System Finds Relevant Entries

This is where the Step 2 processing pays off. The system uses the structured index to:

Out of 30 entries this week, maybe 8 are about energy. Those 8 get selected.

Step 6

AI Reads Your Original Words

Here is the important part. The AI does not read the labels or summaries it created in Step 2. It reads your original journal text from those 8 entries. The raw words you actually wrote.

It then generates a response based on your real entries, with your real details, in your real voice.

Example response from Mimo
Your energy has been inconsistent this week. Monday and Tuesday you logged fatigue and social withdrawal. By Thursday you noted improvement after adjusting your Fluoxetine dose. But Friday the fatigue came back when you went out. The pattern: you're stable at home but social exposure drains you fast right now.

This answer is grounded in your actual entries. Not generic advice. Not guesses. Your own data, interpreted fresh.

Why This Matters

The AI Never Reads Its Own Conclusions

The structured data from Step 2 is only used to find entries. The AI always goes back to the source text when answering.

I learned this the hard way. Early versions of Cortex fed the AI's own conclusions back into future processing. The result was a feedback loop: the AI's guesses became "confirmed patterns," which made it more confident, which produced more guesses, and so on. Confidence grew without any new information.

126 commits went into that approach before I scrapped it. The lesson: the AI is a tool for finding and interpreting. It should never be treated as a source of truth about your life. Your own words are the source of truth.

How It All Connects

When you write
You write an entry
AI understands it
Structured index created
Raw text + index saved on device
When you ask
You ask a question
Index finds relevant entries
AI reads your original text
Fresh answer from your real words