Huaji: Your Personal Memory Database

Try it out on huaji.app

Inspiration

Most diary apps begin with an empty page. For many people, that empty page is the hardest part.

Important moments rarely arrive as polished stories. They begin as fragments: something said over dinner, a thought on the way home, a photo, a decision, or a feeling that is difficult to name. I wanted to build a diary that starts where those memories actually begin: in conversation.

That idea became Huaji, a name that loosely means “remembering through conversation” in Chinese. Instead of asking users to sit down and formally write every day, Huaji lets them talk naturally, shape meaningful conversations into diary entries, and rediscover those memories later.

The goal is not simply to create another AI chatbot. It is to build a personal memory database that becomes more useful over time while respecting how private a diary should be.

What Huaji Does

Huaji combines conversational journaling, structured diary entries, semantic retrieval, optional AI memory, and long-term personal reviews in one experience.

Users can:

  • Talk naturally about their day without facing a blank page.
  • Turn a conversation into an editable diary draft.
  • Add images or use voice input when typing feels inconvenient.
  • Save diary entries locally first and sync them to the cloud.
  • Find a diary entry by meaning, even when they cannot remember the exact words.
  • Ask the AI questions about past experiences and retrieve the relevant records.
  • Allow Huaji to maintain a short-term and long-term personal context.
  • Generate weekly, monthly, and annual reviews, or a factual personal biography, from sync-ed diary entries.
  • Control whether AI can see saved diary entries and memories in future conversations.

Huaji is available in English and Simplified Chinese. It also works as an installable PWA, making the web experience feel closer to a dedicated diary application.

How I Built It

Huaji is built with Next.js and the Vercel AI SDK. The conversational layer supports tool-capable models through Vercel AI Gateway, allowing the AI to decide when it should search past records, create a diary draft, or help organize a memory. I chose Vercel AI Chatbot as Huaji’s foundational framework, providing a mature and reliable base for its conversational experience.

OpenAI models support several important parts of the product:

  • text-embedding-3-small generates embeddings for semantic diary and image retrieval.
  • gpt-4o-mini-transcribe converts recorded voice notes into text.
  • omni-moderation-latest can protect user and model output across sensitive workflows.
  • OpenAI language models can power conversational and tool-using workflows through the model-routing layer.

The retrieval system combines diary text, memory records, and searchable image descriptions. Instead of relying on hard-coded keywords, Huaji can compare the meaning of a new query with previously saved material and return the most relevant memories.

The review system turns synchronized diary entries into weekly, monthly, and annual records or a factual biography. Short periods can be generated directly from the relevant entries. Longer periods are divided into smaller evidence-backed sections before being assembled into a chronological narrative. This helps preserve dates, uncertainty, and source traceability without inventing missing details.

Postgres and Drizzle ORM handle cloud persistence, Redis supports rate limiting, and private Vercel Blob storage holds uploaded images. Authentication is built with Auth.js and supports credentials as well as optional Google and GitHub sign-in.

For local-first saving, diary entries are encrypted before being written to IndexedDB. If the network is unavailable or automatic synchronization is disabled, an entry remains safely on the current device until it can be synchronized manually or automatically. Cloud content follows Huaji’s application-level encryption and unlock flow through a separate Huaji Key.

How I Used Codex and GPT-5.6

Huaji was built in Codex from the beginning. I used Codex as an engineering collaborator throughout the project: to understand the existing codebase, design features, implement changes, write database migrations, diagnose bugs, improve multilingual copy, and run validation checks.

The product’s original foundation and core architecture were developed with GPT-5.4 and GPT-5.5 in Codex. This included the conversational diary experience, encrypted memory architecture, semantic retrieval, diary drafting, and the broader product structure.

I then used GPT-5.6 in Codex to build and refine several of Huaji’s most important systems:

  • Encrypted local diary storage.
  • Automatic and manual cloud sync.
  • Sync status and pending-entry tracking.
  • English and Simplified Chinese localization.
  • Locale detection and language preference handling.
  • Unicode-aware word counting for multilingual and mixed-language writing.
  • Weekly, monthly, and annual diary reviews.
  • Factual biography generation with traceable source entries.

Codex was especially useful because these features crossed multiple parts of the application. A cloud-sync setting, for example, affected local encrypted storage, browser state, authenticated APIs, database preferences, retry behavior, offline handling, and the settings interface.

Instead of treating each request as an isolated code change, I used Codex to follow those connections through the codebase, update the relevant architecture rules, and verify that the feature remained consistent with Huaji’s privacy model.

GPT-5.6 also helped refine the product language and user experience. This mattered because Huaji handles concepts such as memory, synchronization, privacy, and AI access, where unclear wording can easily create the wrong expectations.

AI did not replace the product decisions. I still had to define what Huaji should do, decide which trade-offs were acceptable, and review the resulting behavior. Codex made it possible to move from those decisions to a working, coherent product much faster.

Challenges

Balancing Memory and Privacy

The most difficult design problem was also the most important one: an AI memory system needs context to be useful, but a diary contains some of the most sensitive information a person can create.

I had to treat encryption, access controls, local storage, image delivery, logging, synchronization, and model context as one connected privacy boundary. Signing in is intentionally not enough to read protected diary content. Users must also unlock it with their Huaji Key.

Users can independently control whether AI may access diary entries, recent context, long-term memory, and memories at different sensitivity levels.

I also avoided describing Huaji as “end-to-end encrypted,” because that would overstate the current architecture. Being precise about security boundaries is more important than using a stronger marketing phrase.

Making Local and Cloud Data Behave Like One Diary

Local-first saving introduced a second source of truth. Entries can be pending, synchronizing, saved to the cloud, or temporarily failed. Automatic synchronization may also be disabled by the user.

The interface needs to remain understandable throughout that process without creating duplicate entries, silently losing edits, or claiming that another offline device has synchronized when the server cannot observe it.

The hardest part was not storing data locally. It was designing predictable transitions between local encrypted records and authenticated cloud records.

Generating Long-Term Reviews Without Inventing a Life Story

A weekly review may contain only a few entries, while a biography may span years of writing. Sending everything to a model at once would be unreliable and could blur the distinction between recorded facts and generated interpretation.

I designed the review process to preserve chronology and source relationships. Longer periods are processed in sections before the final narrative is generated. The model is instructed to preserve uncertainty, acknowledge gaps, and avoid inventing scenes, dialogue, motives, diagnoses, or life conclusions.

This was especially important for biography generation. The goal is factual personal history, not an AI-written novel.

Searching Memories Across Languages

Huaji needs to work with English, Chinese, and mixed-language writing. Traditional whitespace-based word counting and keyword tokenization fail quickly in that environment.

I learned to separate several concepts that are often treated as the same thing: visible character count, Unicode-aware word segmentation, exact keyword matching, and semantic similarity. Each solves a different product problem.

Preserving the Meaning of a Day

A diary entry written late at night in one time zone should not move to a different day when viewed elsewhere. Huaji stores the entry’s original local date and time-zone context instead of recalculating its diary day from the viewer’s current location.

This seemed like a small detail at first, but it became an important lesson: in a memory product, dates are part of the content, not merely presentation metadata.

What I Learned

Building Huaji changed how I think about both AI products and AI-assisted development.

A model should not become the database. Durable memories need explicit records, user-controlled saving, retrieval rules, provenance, and clear privacy boundaries. AI is most useful as the layer that helps people capture, organize, and retrieve those records.

I also learned that memory features need consent at multiple levels. A user may want to save a diary entry without allowing it to influence future conversations. They may want recent context but not a permanent profile. They may want local storage without automatic cloud synchronization. These choices cannot be reduced to one generic “AI memory” switch.

Working with Codex taught me that AI-assisted development is most effective when the model can understand the architecture surrounding a feature. The value was not only generating code. It was tracing how a decision affected storage, APIs, encryption, localization, interfaces, and failure states, then helping verify the complete workflow.

Most importantly, I learned that the best AI interaction can feel almost invisible. Huaji is successful when users are thinking about their lives rather than thinking about prompts, models, embeddings, or databases.

The Vision

Huaji is still evolving, but its direction is clear: a private place where conversations become diary entries, diary entries become searchable memories, and those memories gradually form a record of a life.

In the future, I hope Huaji can become a natural part of everyday life: not simply an app people open when they remember to write, but a personal space they return to regularly to record experiences, understand themselves, and stay connected with the people who matter to them.

Huaji will also expand beyond private reflection with carefully designed social features. This may include creating shared diaries for partners, families, or close friends, as well as ways to share selected diary entries with others.

The long-term ambition is to help people preserve not only their individual memories, but also the stories they create together.

Huaji helps people preserve more of their lives, with less pressure to write perfectly.

Built With

Share this project:

Updates