File size: 2,279 Bytes
135650a
 
519b0ae
 
 
135650a
41871c3
 
135650a
 
 
 
519b0ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9caa92e
519b0ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88ce265
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: Second Brain
emoji: 🧠
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 6.6.0
python_version: '3.10'
app_file: app.py
pinned: false
---

# 🧠 Second Brain

An intelligent personal productivity app that learns how you work and schedules your day accordingly.

## Features

- **Task Capture** β€” type or speak tasks; AI classifies them across 4 dimensions automatically
- **Life Areas** β€” every task belongs to one of your personal life areas (Work, Health, etc.)
- **Smart Scheduling** β€” AI builds a time-blocked daily plan based on your tasks, context, and learned patterns
- **Habit Tracking** β€” mark tasks as habits with a recurrence interval; they auto-spawn each day
- **Goals** β€” define big-picture goals; AI factors them in when prioritizing
- **Journaling** β€” end-of-day reflection that updates the AI's knowledge of how you work best

## Project Structure

```
second_brain/
β”œβ”€β”€ app.py                  ← Main Gradio app, all UI + event wiring
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ database.py         ← SQLite: users, tasks, life areas, goals, AI context
β”‚   β”œβ”€β”€ ai_engine.py        ← All Groq API calls (task parsing, scheduling, journaling)
β”‚   └── styles.py           ← CSS
└── ui/
    └── __init__.py
```

---

## Deploying to HuggingFace Spaces

#### Add your Groq API key as a Secret

In your Space on HuggingFace:

1. Go to **Settings** β†’ **Repository secrets**
2. Click **New secret**
3. Name: `GROQ_API_KEY`
4. Value: your Groq key (starts with `gsk_`)
5. Click **Add secret**

> ⚠️ Never paste your API key directly into any file β€” use secrets only.

---


## Notes

- **Database**: SQLite file `second_brain.db` is created automatically on first run in the app's working directory
- **Voice transcription**: Uses OpenAI Whisper `small` model (~250MB), downloaded on first voice task
- **AI model**: Groq `llama-3.3-70b-versatile` (free tier, ~0.3s response time)
- **Persistence on HF Spaces**: HuggingFace Spaces have ephemeral storage β€” the SQLite DB resets on each restart. For permanent storage, upgrade to a paid Space with persistent storage, or swap `database.py` to use an external DB (Supabase, PlanetScale, etc.)