···4455Social layer: publish/share/remix learning artifacts; follow curators; discuss.
6677+## Personas
88+99+- **Learner**: studies daily; imports content; wants fast "review queue".
1010+- **Creator**: makes decks/notes; publishes updates; wants feedback + forks.
1111+- **Curator/Teacher**: bundles content into learning paths; annotates lectures/articles.
1212+- **Moderator/Community admin**: handles reports, takedowns, spam.
1313+714## Principles
815916- Local-first study experience; offline study must not feel "second-class".
···2027- Article: URL + extracted text (readability style heuristics) + highlights +
2128 linked notes/cards.
2229- Collection/Path: curated bundle of decks + notes + sources.
3030+3131+## System Architecture
3232+3333+### Frontend (SolidJS)
3434+3535+- App shell + router-driven workspaces (Library / Study / Create / Social).
3636+- Signals as primary state primitive; keep study session state in signals/store.
3737+3838+### Backend (Rust)
3939+4040+- Axum API gateway: REST/XRPC-ish endpoints, tower middleware, typed extractors.
4141+- Services (logical, not necessarily microservices):
4242+ - Identity/Auth service (local + optional ATProto OAuth integration)
4343+ - Content service (notes/cards/decks/sources)
4444+ - Study service (queue generation + grading + scheduling)
4545+ - Social service (follows, feeds, comments, notifications)
4646+ - Search service (indexing + query)
4747+ - Moderation service (reports, takedowns, rules)
4848+4949+### Storage
5050+5151+- Postgres: canonical app DB (users, private study state, cache of published records).
5252+- Object storage: images/audio, extracted article snapshots (if you store them).
5353+- Search index: separate system (Meilisearch/Typesense/ZincSearch-pick one later).
5454+5555+### Eventing
5656+5757+- Internal outbox pattern (DB table) for:
5858+ - reindex jobs, notification fanout, federation publish steps
+71
docs/core-user-journeys.md
···11+# Core User Journeys
22+33+This document outlines the five core user journeys for the initial product version.
44+55+## 1. Import Source & Publish Deck
66+77+**Goal**: A creator builds a study deck from an external resource and shares it.
88+99+1. **Import**: User inputs a URL (Article) or pastes text.
1010+2. **Generate**: System extracts metadata (and optionally snapshots content).
1111+3. **Authoring**:
1212+ * User highlights key sections in the source.
1313+ * User creates **Notes** linked to highlights.
1414+ * User generates **Cards** (Flashcards) from Notes or directly from source.
1515+4. **Assembly**: User organizes Cards into a **Deck**.
1616+5. **Publish**: User sets visibility (e.g., Public) and publishes the Deck.
1717+6. **Result**: The Deck is now a shareable Artifact (ATProto record).
1818+1919+## 2. Daily Study Loop
2020+2121+**Goal**: A learner maintains their knowledge using Spaced Repetition (SRS).
2222+2323+1. **Session Start**: User opens the app/daily study mode.
2424+2. **Review Queue**: System presents cards due for review based on SRS algorithm (e.g., SM-2).
2525+3. **Interaction**:
2626+ * User sees **Front** of card.
2727+ * User attempts recall.
2828+ * User reveals **Back**.
2929+4. **Grading**: User self-grades (e.g., 0-5).
3030+5. **Update**: System schedules next review interval.
3131+6. **Progress**: User sees feedback (cards done, streak incremented).
3232+ * *Note: All grading/progress data is strictly private.*
3333+3434+## 3. Social Collaboration (Follow/Fork)
3535+3636+**Goal**: A learner discovers content and improves it.
3737+3838+1. **Discovery**:
3939+ * User follows a Curator.
4040+ * User sees a new Deck in their "New from Follows" feed.
4141+2. **Acquisition**: User saves/pins the Deck to their library.
4242+3. **Contribution (Forking)**:
4343+ * User identifies a gap or error in the Deck.
4444+ * User **Forks** the Deck.
4545+ * User edits cards or adds new ones.
4646+ * User republishes the modified Deck (referencing the original).
4747+4. **Loop**: Original author (or others) can see the fork and potentially merge changes (future scope) or users can switch to the better fork.
4848+4949+## 4. Discussion & Moderation
5050+5151+**Goal**: Community interaction while maintaining safety.
5252+5353+1. **Context**: A User is viewing a public Card or Deck.
5454+2. **Discuss**: User adds a **Comment** (threaded) asking for clarification.
5555+3. **Report** (Unhappy Path):
5656+ * User encounters abusive content/spam.
5757+ * User triggers **Report** flow.
5858+ * Moderation system receives report.
5959+ * Content may be hidden/labeled based on moderation actions.
6060+6161+## 5. Lecture Study Workflow
6262+6363+**Goal**: Deep study of long-form audio/video content.
6464+6565+1. **Import**: User provides a Lecture URL (e.g., YouTube/Video).
6666+2. **Structure**:
6767+ * User creates an **Outline** of the lecture.
6868+ * User adds **Timestamps** to segment the content.
6969+3. **Link**:
7070+ * User creates Cards specific to timestamped segments.
7171+ * Clicking context on a Card jumps video to the specific timestamp.
+65
docs/information-architecture.md
···11+# Information Architecture
22+33+This document defines the application structure, navigation, and data model mapping for Milestone A.
44+55+## Site Map (Navigation)
66+77+### Global Navigation
88+99+- **Home/Feed**: Discover content (Following, Trending).
1010+- **Library**: User's saved Decks, curated Collections, and private progress.
1111+- **Create**: Entry point for Authoring tools.
1212+- **Search**: Global search for Decks, Curators, and Tags.
1313+- **Profile**: User identity and settings.
1414+1515+### Logical View Hierarchy
1616+1717+- **/** (Home)
1818+ - Feed of followed curators
1919+- **/library**
2020+ - Study Queue (What to review today)
2121+ - My Decks (Created & Forked)
2222+ - Saved Collections
2323+- **/deck/:did/:slug** (Deck View)
2424+ - Overview (Description, Stats)
2525+ - Browser/Cards List
2626+ - Study Mode (Launch Session)
2727+- **/note/:rkey** (Note View)
2828+ - Note Content (Markdown)
2929+ - Backlinks / Linked Cards
3030+- **/source/:rkey** (Article/Lecture View)
3131+ - Source Metadata (Title, URL)
3232+ - Snapshot/Content View (if saved)
3333+ - Highlights List
3434+- **/study/:session_id** (Study Session)
3535+ - Active Recall Interface (Front/Back)
3636+- **/editor**
3737+ - New Deck / Edit Deck
3838+ - Import Source (URL/Text)
3939+- **/profile/:handle**
4040+ - Public Decks
4141+ - Followers/Following
4242+4343+## Data Model Mapping
4444+4545+Mapping screens to underlying data entities (Lexicon Records + Private State).
4646+4747+| Screen / Component | Primary Data Entity | Secondary Entities | Private/Public |
4848+| :----------------- | :----------------------------- | :---------------------------------------- | :---------------------------- |
4949+| **Deck Overview** | `app.malfestio.deck` | `app.malfestio.card` (refs), User Profile | **Public** |
5050+| **Study Session** | N/A (Ephemeral) | `app.malfestio.card`, Private Review Log | **Private** |
5151+| **Card View** | `app.malfestio.card` | `app.malfestio.note`, Media Blobs | **Public** |
5252+| **Editor** | Draft State (Local) | Source (`article`), `note` | **Private (Draft) -> Public** |
5353+| **Source View** | `app.malfestio.source.article` | `app.malfestio.note` (linked) | **Public** |
5454+| **Note View** | `app.malfestio.note` | Backlinks (`card`/`deck`) | **Public** |
5555+| **Library** | `app.malfestio.collection` | Bookmarks, User Prefs | **Mixed** |
5656+| **Comments** | `app.malfestio.thread.comment` | User Profile | **Public** |
5757+5858+## URL Structure
5959+6060+- `https://app.example.com/` - Home
6161+- `https://app.example.com/profile/<handle>` - User Profile
6262+- `https://app.example.com/profile/<handle>/deck/<slug>` - Deck Permalink
6363+- `https://app.example.com/profile/<handle>/deck/<slug>/card/<rkey>` - Card Permalink
6464+- `https://app.example.com/profile/<handle>/note/<rkey>` - Note Permalink
6565+- `https://app.example.com/profile/<handle>/source/<rkey>` - Source Permalink
+49
docs/share-vs-private-rules.md
···11+# Share vs Private Rules
22+33+This document defines the strict separation between public "Artifacts" and private "Learning State".
44+This distinction is critical for the application's architecture and user privacy.
55+66+## The Separation Principle
77+88+- **Public Layer ("Artifacts")**: Content that is created to be shared.
99+ These are immutable (or append-only) records published to the AT Protocol.
1010+- **Private Layer ("Learning State")**: Personal study data.
1111+ This includes grades, schedules, and progress.
1212+ This data **NEVER** leaks into the public record automatically.
1313+1414+## Public Record Types (The Lexicon)
1515+1616+These entities are visible to anyone with access to the PDS (essentially public).
1717+1818+- Deck (`app.malfestio.deck`): The collection of cards/notes.
1919+- Card (`app.malfestio.card`): The flashcard content (Front/Back).
2020+- Note (`app.malfestio.note`): The source knowledge note.
2121+- Article (`app.malfestio.source.article`): Metadata/snapshot of an external article.
2222+- Lecture (`app.malfestio.source.lecture`): Metadata/outline of an external video/audio.
2323+- Collection (`app.malfestio.collection`): Curated lists of decks.
2424+- Comment (`app.malfestio.thread.comment`): Public discussion.
2525+2626+> **Rule**: If a user puts sensitive information in a Card, they must be warned that
2727+> publishing the Deck makes it public.
2828+2929+## Private Data Types (Local/Private Sync)
3030+3131+These entities are stored in the user's private database (Local -> Private User Sync).
3232+3333+- **Scheduling Data**:
3434+ - Next due date
3535+ - Ease Factor (EF)
3636+ - Interval history
3737+ - Retrievability estimates
3838+- **Performance Metrics**:
3939+ - Grades (Forget, Hard, Good, Easy)
4040+ - Session duration
4141+ - Response times
4242+- **Drafts**:
4343+ - Decks/Cards currently being written but not yet published.
4444+4545+## Interaction Rules
4646+4747+1. **Forking**: When a user forks a public deck, they create a *new* public record (referencing the original). Their *private* study data for the original deck does NOT transfer to the new fork (or is reset).
4848+2. **Study Session**: A study session is a purely private event. It reads Public Artifacts but writes only to the Private Layer.
4949+3. **Sync**: Public records sync via ATProto (Relay/PDS). Private data syncs via a separate, private channel (e.g., encrypted backup or private PDS blob).
+287
docs/todo.md
···11+# Product + Technical Roadmap
22+33+## Protocol + Lexicon Strategy
44+55+- "Artifacts" are publishable records (ATProto Lexicon).
66+- "Learning state" is private (local DB + your backend sync; not public records).
77+- Records are distributed and hard to migrate globally; keep mutable/private state out.
88+- Lexicon evolution rules strongly encourage forward-compatible extensibility.
99+1010+### Namespace + NSID conventions
1111+1212+- `app.malfestio.note`
1313+- `app.malfestio.card`
1414+- `app.malfestio.deck`
1515+- `app.malfestio.source.article`
1616+- `app.malfestio.source.lecture`
1717+- `app.malfestio.collection`
1818+- `app.malfestio.thread.comment`
1919+2020+### Lexicon basics
2121+2222+- Lexicon defines record types + XRPC endpoints; JSON-schema-like constraints.
2323+- Use "optional fields" heavily; avoid enums that will calcify the product too early.
2424+- Versioning: add fields, don’t rename; never rely on being able to rewrite history.
2525+2626+### Schema boundaries (important)
2727+2828+- **Public share layer**:
2929+ - decks, cards, notes, collections, comments
3030+- **Private layer**:
3131+ - review schedule, lapses, grades, per-card performance, streaks
3232+3333+### Auth direction
3434+3535+- ATProto is moving toward OAuth for client↔PDS authorization.
3636+- Plan for OAuth support even if MVP starts centralized.
3737+3838+## Roadmap Milestones
3939+4040+### Milestone A - Product Spec + IA + UX Flows
4141+4242+#### Deliverables
4343+4444+- Core user journeys (5):
4545+ - Import source -> generate notes/cards -> publish deck
4646+ - Daily study -> review queue -> grade -> progress view
4747+ - Follow curator -> discover deck -> fork -> contribute improvements
4848+ - Discuss a card/deck -> moderation/report flow
4949+ - Lecture workflow -> outline -> timestamps -> linked cards
5050+- Information architecture + navigation map
5151+- "Share vs private" rules doc (what becomes public records; what never does)
5252+5353+#### Acceptance
5454+5555+- Every screen maps to a backend capability + a data model entity.
5656+5757+### Milestone B - Lexicon Design Kit + Data Model Mapping
5858+5959+#### Deliverables
6060+6161+- Lexicon repo folder with:
6262+ - record schemas for note/card/deck/article/lecture/collection/comment
6363+ - schema evolution notes (what can change, what cannot)
6464+- Mapping doc:
6565+ - Public record (lexicon) <-> internal DB row(s)
6666+- Minimal "publish pipeline" spec (draft->published->deprecated)
6767+6868+#### Acceptance
6969+7070+- You can create a deck and serialize it into a stable record shape.
7171+- Follow Lexicon rules; prefer additive evolution.
7272+- Review Bluesky "custom schemas" patterns for compatibility expectations.
7373+7474+### Milestone C - Foundations: Repo, CI, Axum API Skeleton, Solid Shell
7575+7676+#### Deliverables
7777+7878+- Monorepo layout (crates/server/, web/, lexicons/, crates/cli/, crates/core/)
7979+ - core: domain logic, data models
8080+ - server: axum, postgres, search, eventing, auth
8181+ - cli: entry point for local dev, PDS sync
8282+ - web: solidjs app
8383+- CI: format/lint/test + schema validation + typegen
8484+- Axum:
8585+ - health, auth stub, error model, request IDs, structured logging
8686+- Solid:
8787+ - tailwind, router shell, auth gate, initial pages + layout system
8888+8989+#### Acceptance
9090+9191+- End-to-end "hello world" for create/read deck locally.
9292+9393+### Milestone D - Identity + Permissions + Publishing Model
9494+9595+#### Deliverables
9696+9797+- Auth MVP:
9898+ - BlueSky App Passwords
9999+ - ATProto OAuth
100100+- Permission model:
101101+ - private / unlisted / public / shared-with
102102+- Publishing:
103103+ - draft editing, publish, update, deprecate, fork
104104+105105+#### Acceptance
106106+107107+- A user can publish a deck and another user can view it.
108108+109109+### Milestone E - Content Authoring (Notes + Cards + Deck Builder)
110110+111111+#### Deliverables
112112+113113+- Note editor (markdown + attachments + backlinks)
114114+- Card editor:
115115+ - basic front/back + cloze v1
116116+ - images/audio attachments (optional)
117117+- Deck builder:
118118+ - tags, ordering, sections
119119+- Importers v1:
120120+ - article URL -> extracted snapshot + highlights
121121+ - lecture URL -> outline + timestamps (manual entry initially)
122122+123123+#### Acceptance
124124+125125+- A creator can build a deck from an article and publish it.
126126+127127+### Milestone F - Study Engine (SRS) + Daily Review UX
128128+129129+#### Deliverables
130130+131131+- SRS scheduler v1 (SM-2 baseline)
132132+ - grade 0–5, EF, interval, repetition count
133133+- Review queue generation rules
134134+- Study session UI:
135135+ - keyboard-first review loop
136136+ - quick edit card during review
137137+- Progress views (private):
138138+ - due count, retention proxy, streaks
139139+140140+#### Acceptance
141141+142142+- 30-day simulated study test produces stable, believable intervals.
143143+144144+#### Notes
145145+146146+- SM-2 reference behavior is well documented; start there and iterate.
147147+148148+### Milestone G - Social Layer v1 (Follow, Feed, Fork, Comments)
149149+150150+#### Deliverables
151151+152152+- Follow graph + notifications
153153+- Feeds:
154154+ - "New decks from follows"
155155+ - "Trending this week" (simple scoring)
156156+- Forking workflow:
157157+ - fork deck -> edit -> republish
158158+- Threaded comments on decks/cards
159159+160160+#### Acceptance
161161+162162+- A user can follow a curator and see new published decks in a feed.
163163+164164+### Milestone H - Search + Discovery + Taxonomy
165165+166166+#### Deliverables
167167+168168+- Full-text search over:
169169+ - deck title/description, card text, note text, source metadata
170170+- Tag taxonomy:
171171+ - user tags + curator tags + system tags
172172+- Discovery pages:
173173+ - top tags, featured paths, editor picks
174174+175175+#### Acceptance
176176+177177+- Search is fast (<200ms typical) and results feel relevant.
178178+179179+### Milestone I - Moderation + Abuse Resistance
180180+181181+#### Deliverables
182182+183183+- Reporting pipeline + review queue
184184+- Rate limits + spam heuristics
185185+- Takedown/visibility states (shadowed, removed, quarantined)
186186+- Audit logging for moderation actions
187187+188188+#### Acceptance
189189+190190+- You can safely operate an open publishing surface.
191191+192192+### Milestone J - Federation / ATProto Integration Pass
193193+194194+#### Deliverables
195195+196196+- Phase 1 (minimum):
197197+ - export Lexicon records
198198+ - ingest remote records into a read-only "federated library"
199199+- Phase 2:
200200+ - OAuth login to PDS + publish records directly (client or server mediated)
201201+ - reconcile local drafts with remote published state
202202+203203+#### Acceptance
204204+205205+- A published artifact is portable beyond your app.
206206+207207+#### Notes
208208+209209+- ATProto OAuth is the forward path; plan on it.
210210+- XRPC endpoint patterns and legacy session behavior exist, but treat them as transitional.
211211+212212+### Milestone K - Reliability, Observability, Launch
213213+214214+#### Deliverables
215215+216216+- Metrics + tracing + structured logs
217217+- Backups + restore drills
218218+- Load test targets (study session + feed + search)
219219+- Beta program + feedback loop + roadmap iteration
220220+221221+#### Acceptance
222222+223223+- You can run this as a real product with confidence.
224224+225225+## "First Cut" Lexicon Fields (Draft)
226226+227227+### Note (app.malfestio.note)
228228+229229+- title: string
230230+- body: richtext/markdown string
231231+- tags: string[]
232232+- links: { uri, title?, type? }[]
233233+- createdAt, updatedAt
234234+- visibility: "private|unlisted|public" (consider leaving as string + documented values)
235235+236236+### Card (app.malfestio.card)
237237+238238+- deckRef: at-uri / stable ref
239239+- front: string (markdown)
240240+- back: string (markdown)
241241+- cardType: "basic|cloze" (optional)
242242+- hints?: string[]
243243+- media?: { kind, uri, alt? }[]
244244+245245+### Deck (app.malfestio.deck)
246246+247247+- title, description
248248+- tags
249249+- cardRefs: at-uri[]
250250+- sourceRefs: at-uri[] (articles/lectures)
251251+- license?: string (strongly recommended)
252252+253253+### Article (app.malfestio.source.article)
254254+255255+- url
256256+- title
257257+- author?
258258+- publishedAt?
259259+- extractedTextRef? (only if you store it)
260260+- highlights?: { quote, start?, end? }[]
261261+262262+### Lecture (app.malfestio.source.lecture)
263263+264264+- url
265265+- title
266266+- creator?
267267+- timestamps?: { t, label, noteRef? }[]
268268+269269+### Collection/Path (app.malfestio.collection)
270270+271271+- title, description
272272+- items: { type, ref, note? }[]
273273+- tags
274274+275275+### Comment (app.malfestio.thread.comment)
276276+277277+- subjectRef (deck/card/note ref)
278278+- body
279279+- replyTo?
280280+281281+(Keep everything extensible; avoid hard commitments early.)
282282+283283+## Open Questions (Parked Decisions)
284284+285285+- Local-first mechanics: full offline authoring + later publish, or online-only creation?
286286+- Federation depth: read-only ingest first, or publish-to-PDS in the first public beta?
287287+- Content extraction: store extracted article snapshots (legal/ops implications), or store only metadata + highlights?