Shared rule file for ALL coding agents working on MangoLearningOS. Read this before any work. Update project-memory after any meaningful change.
MangoOS (MangoLearningOS) is an AI-native learning operating system for university students.
Its core promise: turn courses, files, exams, anxiety, and learning goals into concrete outputs — Study Packs, review handouts, practice tasks, feedback reports, emotional recovery templates, and learning history.
- Stability over new features. Working production > new decoration.
- Real end-to-end logic over mock UI. No fake buttons, no hardcoded responses.
- Source-grounded generation over generic AI output. Every research/content feature must use real data sources before generation.
- Export-ready documents over raw text. Major outputs must support Word/PDF export.
- Privacy-first handling of Mind Garden data. Local mode default, explicit consent for cloud.
- No hardcoded secrets. All credentials via environment variables.
- No fake online research. Do not invent sources, URLs, or citations.
- No production paths using mock data. Mock/demo data is for development previews only.
- Always update project-memory after meaningful changes.
- Product implementation
- UI/UX refinement and interaction polish
- Visual consistency and design system
- New experience construction
- Feature output Contracts
- Engineering audit and production readiness
- Bug fixing and regression testing
- TypeScript and data-flow hardening
- PDF/Word export reliability
- Persistence verification (Supabase + guest/local)
- Mock/fake logic detection
- Route stability and build/lint reliability
- Architecture cleanup (only when necessary)
- Agents do not automatically know each other's latest work. Sync through Git commits, branches, and project-memory files.
- No two agents may work on the same branch at the same time.
- No two agents may modify the same core directories unless explicitly coordinated.
- Codex's first task must be audit-only with no code changes.
- Codex changes must be reviewed through diff before merge.
- Production readiness requires: lint + typecheck + build + core workflow verification.
- Stability > visual decoration or new feature expansion.
- No agent may assume another agent's work is known unless committed and recorded in project-memory.
Before any agent starts work:
- Check current branch:
git branch --show-current - Check git status:
git status --short - Pull or confirm the latest intended branch
- Read
AGENTS.md(this file) - Read
project-memory/PROJECT_STATE.md - Read
project-memory/FEATURES.md - Read
project-memory/UPDATE_LOG.md - Read
project-memory/BUGFIX_HISTORY.md - Read
project-memory/REGRESSION_CHECKLIST.md - Report current understanding before editing any file
After any agent completes work:
- Update relevant project-memory files
- Run
npm run lint(ornpx next lint) andnpx next build --no-lint - Run
npx tsc --noEmitif TypeScript is configured - Commit with a clear message describing what changed and why
- Report: branch name, commit hash, files changed, checks run, known risks, next recommended task
main— stable branch only. No direct work.claude/*— ClaudeCoda product branchescodex/*— Codex audit/hardening branches- Merge to main only after checks pass and diff is reviewed
| Variable | Purpose |
|---|---|
AI_API_KEY |
DeepSeek / OpenAI-compatible API key |
AI_BASE_URL |
AI provider base URL (default: https://api.deepseek.com) |
AI_MODEL |
Model name (default: deepseek-chat) |
SUPABASE_URL |
Supabase project URL |
SUPABASE_ANON_KEY |
Supabase anonymous key |
GITHUB_TOKEN |
GitHub API token (optional, raises rate limit) |
YOUTUBE_API_KEY |
YouTube Data API key (optional) |
PADDLEOCR_URL |
PaddleOCR Docker service URL (optional) |
NEXT_PUBLIC_APP_URL |
Public app URL |
EMAIL_APP_PASSWORD |
Email send password |
DEEPGRAM_API_KEY |
Deepgram API key for STT |
Next.js 15.5 (App Router) · React 19 · TypeScript 5.8 · Tailwind CSS 4.1 shadcn/ui (New York) · Supabase (PostgreSQL + RLS) · DeepSeek AI · Vercel
claude/v10-study-pack had all V12-V14 features but was never merged to main.
The UI redesign branch was created from main (missing features), merged back, and deployed — losing features.
- Single source of truth:
mainis the ONLY deployable branch. No feature silos. - Merge immediately: Feature branches must merge to
mainbefore any other branch is created frommain. - Never branch from stale main:
git pull origin mainbefore creating any branch. - Protected files: Do NOT delete or overwrite:
app/api/**(20+ routes)lib/agent/**,lib/ai/**,lib/auth/**,lib/plan/**,lib/quota/**,lib/mango-code/**components/profile/*(all 9 components)components/mobile/premium-mobile.tsxapp/globals.css(design token section)
- Build gate:
npm run buildmust pass with 0 errors before any push. - Version token:
lib/version.ts→APP_VERSIONis the single version source. - No update modal on startup: User preference. UpdateModal is disabled.
- Post-deploy smoke test: After deploy, curl
/hub,/agent,/pack,/profile,/grow— all must return 200.