Skip to content

mauriciompj/alma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ALMA — An emotional legacy archive

Live Demo

MIT License Claude AI Neon Netlify i18n

Leia em Português · Lee en Español · Try the Demo · Quick Start · Contributing


ALMA Chat — a son asking his father about courage
A son asks: "Dad, what is courage to you?" — ALMA responds using real memories, adapted to his age.


What is ALMA?

ALMA is a platform that lets you preserve your voice, values, and memories for the people you love — so they can talk to you even when you're no longer there.

It's not a chatbot. It's not a memorial page. It's a living archive of who you are, powered by RAG (Retrieval-Augmented Generation) and AI, that your children, partner, parents, or friends can have real conversations with — and hear answers that sound like you, because they're built from your own words.

Think of it as a backup of your soul.

Try it now

alma-demo.netlify.app — Login: Lucas / demo123

The demo uses fictional data (a character named Rafael Mendes). No real personal information.


The Story Behind ALMA

ALMA started from a real emotional-legacy use case.

The core idea is simple: many people want to leave behind more than photos, documents, and assets. They want to leave voice, context, values, mistakes, stories, and guidance for the people they love.

The project was then turned into an open-source platform so anyone can run their own version with their own writing, relationships, memories, and tone.

ALMA is free. ALMA is open source. Because every person who wants to leave something real behind deserves the tools to do it.


What Makes ALMA Different

Feature ALMA Typical "memorial" tools
Conversations Real-time AI chat based on your actual words Pre-recorded video clips
Context-aware Adapts tone per person (child vs. partner vs. parent) Same content for everyone
Self-correcting Author can correct AI responses in real-time Static, no feedback loop
Content moderation AI-powered moderation on all user inputs None
Searchable memory Full-text search across all memories (RAG) Manual browsing only
Directive system Per-person behavioral rules for the AI No customization
Multi-language i18n ready (PT-BR, EN, ES — add your own) Single language
Free & open MIT License, zero cost to run $100+/month subscriptions
Self-hosted Your data stays yours (Netlify + Neon free tier) Vendor lock-in

How It Works

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│   Your Son   │────▶│  ALMA Chat   │────▶│  Claude AI   │
│  asks a      │     │  (Frontend)  │     │  (Anthropic) │
│  question    │     └──────┬───────┘     └──────▲───────┘
└──────────────┘            │                    │
                            ▼                    │
                   ┌──────────────┐     ┌──────────────┐
                   │   Netlify    │────▶│   RAG Engine  │
                   │  Functions   │     │  Search your  │
                   │  (Backend)   │     │  memories in  │
                   └──────────────┘     │  Neon DB      │
                                        └──────────────┘
  1. Someone asks a question — "Dad, what do I do when I feel like I'm not enough?"
  2. ALMA searches your memories — Full-text search with person-aware reranking
  3. Builds context — Pulls relevant memories + corrections + directives + tone config
  4. AI responds as you — Using your actual words as foundation, not generic responses
  5. You can correct it — If the AI gets your voice wrong, correct it. ALMA learns.

Quick Start

ALMA runs on free infrastructure. You can deploy your own instance in under 30 minutes.

Prerequisites

  • A Netlify account (free tier)
  • A Neon PostgreSQL database (free tier)
  • An Anthropic API key (for Claude AI)
  • (Optional) An ElevenLabs API key (for voice synthesis)
  • Node.js 18+

Setup

# 1. Clone the repository
git clone https://github.com/your-user/alma.git
cd alma

# 2. Install dependencies
npm install

# 3. Configure environment
cp .env.example .env
# Edit .env with your DATABASE_URL and ANTHROPIC_API_KEY

# 4. Initialize the database
node db/run-seed.mjs

# 5. Deploy to Netlify
npx netlify-cli deploy --prod --dir=. --functions=netlify/functions

First Steps After Deploy

  1. Open your ALMA site
  2. Log in as admin
  3. Start adding your memories — write about your values, your stories, your mistakes, your love
  4. Share the login with the people you want to talk to
  5. Correct the AI when it doesn't sound like you — ALMA learns from every correction

Architecture

alma/
├── index.html              # Dashboard / home
├── chat.html               # Chat interface
├── admin.html              # Admin panel (memories, corrections, directives)
├── login.html              # Authentication with i18n
├── css/
│   ├── style.css           # Main styles
│   └── admin.css           # Admin panel styles
├── js/
│   ├── alma.js             # Chat engine + correction system + directives
│   └── i18n.js             # Internationalization system
├── netlify/
│   └── functions/
│       ├── auth.mjs        # Auth with bcrypt + auto-migration
│       ├── chat.mjs        # RAG chat engine with person-aware reranking
│       ├── memories.mjs    # Memory CRUD + corrections + directives + moderation
│       └── alma-voice.mjs  # TTS proxy (ElevenLabs voice synthesis)
├── locales/
│   ├── en.json             # English
│   ├── es.json             # Spanish
│   └── pt-BR.json          # Portuguese (Brazil)
├── db/
│   ├── seed.sql            # Database schema
│   ├── run-seed.mjs        # Schema runner
│   ├── seed-demo.sql       # Demo data (fictional)
│   ├── run-seed-demo.mjs   # Demo seeder
│   ├── backup.mjs          # Database backup to JSON
│   └── import-json.mjs     # CLI tool to import memory chunks from JSON
├── docs/
│   └── banner.svg          # README banner
├── netlify.toml            # Netlify config (redirects, headers, security)
└── package.json

Tech Stack

  • Frontend: Vanilla HTML/CSS/JS — no framework, no build step, fast everywhere
  • Backend: Netlify Functions (serverless) with ESBuild bundling
  • Database: Neon PostgreSQL (serverless) with configurable full-text search (SEARCH_LANGUAGE — supports any language)
  • AI: Anthropic Claude (Sonnet) via API
  • Voice: ElevenLabs TTS (optional — hear ALMA speak)
  • Security: bcrypt password hashing, CORS lockdown, content moderation
  • Auth: Token-based sessions stored in database
  • i18n: JSON locale files with auto-detection (PT/EN/ES)

Security

ALMA takes data protection seriously:

  • Bcrypt password hashing — Passwords auto-migrate from plain text on first login
  • CORS lockdown — API only responds to the configured domain
  • Content moderation — All corrections and directives pass through AI moderation before saving
  • Sensitive data removed from code — Children's psychological profiles stored in DB only, not in source code
  • Database isolation — Demo and production use completely separate databases

For Developers

Key Concepts

  • Chunks: Your memories are stored as searchable text chunks in PostgreSQL with tsvector indexing. The search language is configurable via SEARCH_LANGUAGE env var (simple for universal, portuguese, english, spanish, etc.)
  • RAG: When someone asks a question, ALMA searches for relevant chunks using full-text search + tag mapping + person-aware reranking, then injects them as context for the AI
  • Person-aware reranking: Memories tagged with the current person's name get boosted in search results
  • Corrections: If the AI gets something wrong, the author corrects it. Corrections are injected into future prompts with highest priority
  • Directives: Per-person or global behavioral rules (e.g., "Avoid comparing siblings")
  • Person Context: ALMA adapts its tone based on who's talking — a child hears "Dad", a sibling hears "bro", a mother hears "son"

Adding a New Language

  1. Copy locales/en.json to locales/your-language.json
  2. Translate all strings
  3. Submit a pull request

That's it. The community can help translate ALMA into every language on Earth.


Contributing

ALMA is bigger than one person. We welcome contributions of all kinds:

  • Translations — Help ALMA speak your language
  • Code — Bug fixes, new features, performance improvements
  • Documentation — Guides, tutorials, how-tos
  • Stories — Share how you're using ALMA (with permission)

See CONTRIBUTING.md for guidelines.


Roadmap

  • Core chat with RAG memory search
  • Per-person tone adaptation
  • Correction system (human-in-the-loop)
  • Directive system (per-person + global)
  • Admin panel for memory management
  • Multi-language support (PT/EN/ES)
  • Bcrypt auth + CORS lockdown
  • Content moderation (AI-powered)
  • Person-aware memory reranking
  • Demo site with fictional data
  • Age-aware responses (adapts tone to child's current age)
  • Conversation history (persistent, saved per person)
  • PWA support (installable, offline-capable)
  • Voice synthesis via ElevenLabs TTS (hear ALMA speak)
  • Visual memory browser (BD Revisor — browse, filter, edit chunks)
  • SQL import system for structured memory batches
  • Self-hosted AI mode (Ollama/LM Studio) — see proposal
  • One-click setup wizard
  • Import from journals, WhatsApp exports, voice memos
  • "Letter mode" — scheduled messages for future dates

License

MIT License — free for everyone, forever. See LICENSE.


A Final Word

"Legacy is context, not just remembrance."

ALMA started as a deeply personal project and became something bigger — an invitation for anyone who wants to leave behind more than photos and possessions.

Your voice matters. Your story matters. Your mistakes and your love and your values — they matter.

ALMA gives you the tools to make sure they're never lost.


Built with love by the ALMA community.

About

An emotional legacy archive — preserve your voice, values, and memories for the people you love. Mobile capture from Android.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors