Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

docs: update documentation for M31-M32 features

Adam Eivy0395dc0755ff
diff --git a/PLAN.md b/PLAN.md
index 7be1d1562a..2a255468d8 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -42,7 +42,7 @@ pm2 logs
- [x] M13: Autofixer Integration (PM2 crash detection, Claude CLI auto-fix, session history UI)
- [x] M14: Chief of Staff (autonomous agent manager, TASKS.md, system health, self-improvement)
- [x] M15: Graceful Error Handling (error normalization, auto-fix integration, Socket.IO events)
-- [~] M16: Memory System (semantic memory, LM Studio embeddings, auto-extraction, agent context injection)
+- [x] M16: Memory System (semantic memory, LM Studio embeddings, auto-extraction, agent context injection)
- [x] M17: PM2 Ecosystem Config Enhancement (per-process port detection, CDP_PORT support, refresh button)
- [x] M18: PM2 Standardization (LLM-powered config refactoring, import integration, button trigger)
- [x] M19: CoS Agent Runner (isolated PM2 process for agent spawning, prevents orphaned processes)
@@ -56,6 +56,8 @@ pm2 logs
- [x] M28: Weekly Digest UI (visual digest tab with insights, accomplishments, week-over-week comparisons)
- [x] M29: Comprehensive App Improvement (self-improvement operations extended to managed apps, 10 analysis types, rotation system)
- [x] M30: Configurable Task Intervals (per-task-type scheduling: daily, weekly, once, on-demand; schedule UI tab; execution history tracking)
+- [x] M31: LLM-based Memory Classification (intelligent memory extraction using LM Studio, quality filtering, rejection of task echoes)
+- [x] M32: Brain Second-Brain System (capture-classify-store thoughts, People/Projects/Ideas/Admin databases, daily digests, weekly reviews)
### Documentation
- [Architecture Overview](./docs/ARCHITECTURE.md) - System design, data flow
@@ -1642,3 +1644,87 @@ Agent completes task
└─► Auto-approve high confidence (≥0.8)
└─► Queue medium confidence for approval
```
+
+---
+
+## M32: Brain Second-Brain System (2026-01-10)
+
+Offline-first "second brain" management system for capturing, classifying, and surfacing thoughts.
+
+### Overview
+
+Brain provides a capture-classify-store-surface workflow:
+1. **Capture**: Dump thoughts into a single inbox
+2. **Classify**: AI routes thoughts to appropriate databases
+3. **Store**: Persist to People, Projects, Ideas, or Admin
+4. **Surface**: Daily digests and weekly reviews
+
+### Features
+
+1. **Chat-like Inbox**: Single input for capturing thoughts
+2. **AI Classification**: LM Studio classifies with confidence scores
+3. **Four Databases**: People, Projects, Ideas, Admin
+4. **Needs Review Queue**: Low-confidence items await user decision
+5. **Fix/Correct Flow**: Reclassify misrouted thoughts
+6. **Daily Digest**: AI-generated summary of actions and status
+7. **Weekly Review**: GTD-style open loops and accomplishments
+8. **Trust Panel**: Full audit trail of classifications
+
+### Data Storage
+
+```
+./data/brain/
+├── meta.json # Settings and scheduler state
+├── inbox_log.jsonl # All captured thoughts with classifications
+├── people.jsonl # People records
+├── projects.jsonl # Projects with status tracking
+├── ideas.jsonl # Ideas and concepts
+├── admin.jsonl # Administrative tasks
+├── digests.jsonl # Daily digest history
+└── reviews.jsonl # Weekly review history
+```
+
+### API Endpoints
+
+| Route | Description |
+|-------|-------------|
+| POST /api/brain/capture | Capture and classify thought |
+| GET /api/brain/inbox | List inbox log with filters |
+| POST /api/brain/review/resolve | Resolve needs_review item |
+| POST /api/brain/fix | Correct misclassified item |
+| GET/POST/PUT/DELETE /api/brain/people/:id? | People CRUD |
+| GET/POST/PUT/DELETE /api/brain/projects/:id? | Projects CRUD |
+| GET/POST/PUT/DELETE /api/brain/ideas/:id? | Ideas CRUD |
+| GET/POST/PUT/DELETE /api/brain/admin/:id? | Admin CRUD |
+| GET /api/brain/digest/latest | Get latest daily digest |
+| GET /api/brain/review/latest | Get latest weekly review |
+| POST /api/brain/digest/run | Trigger daily digest |
+| POST /api/brain/review/run | Trigger weekly review |
+| GET/PUT /api/brain/settings | Get/update settings |
+
+### Prompt Templates
+
+| Template | Purpose |
+|----------|---------|
+| brain-classifier | Classify captured thoughts |
+| brain-daily-digest | Generate daily summary |
+| brain-weekly-review | Generate weekly review |
+
+### Implementation Files
+
+| File | Purpose |
+|------|---------|
+| `server/lib/brainValidation.js` | Zod schemas for all Brain entities |
+| `server/services/brain.js` | Core business logic |
+| `server/services/brainStorage.js` | JSONL/JSON file operations |
+| `server/services/brainScheduler.js` | Daily/weekly job scheduler |
+| `server/routes/brain.js` | API endpoints |
+| `client/src/pages/Brain.jsx` | Main page with tabs |
+| `client/src/components/brain/tabs/*.jsx` | Tab components |
+
+### UI Tabs
+
+- **Inbox**: Chat-like capture interface with classification results
+- **Memory**: CRUD views for People, Projects, Ideas, Admin
+- **Digest**: Daily and weekly summaries with run buttons
+- **Trust**: Audit trail with classification confidence and reasoning
diff --git a/README.md b/README.md
index 20edaac019..0a9fbac06c 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,10 @@ Think Umbrel, but for your active git repos and dev environments. Access your de
- **Real-time Logs** — Stream PM2 logs via Socket.IO with tail length control
- **Smart Import** — Point to a directory and auto-detect project config from package.json, vite.config, and ecosystem.config
- **Chief of Staff** — Autonomous task manager that monitors TASKS.md and dispatches AI agents
+- **Weekly Digest** — Visual insights, accomplishments, and week-over-week comparisons
- **Task Learning** — Tracks task success rates and duration to improve model selection
- **Scheduled Scripts** — Cron-based automation with optional agent triggering
+- **Brain** — Second-brain system for capturing thoughts and auto-classifying to People/Projects/Ideas/Admin
- **Dev Tools** — Process monitor, AI agent tracker, action history, git status, and shell runner
- **AI Runner** — Execute prompts via Claude Code, Codex, Gemini CLI, Ollama, or LM Studio
- **Mobile Ready** — Responsive design with collapsible sidebar for on-the-go access
diff --git a/docs/API.md b/docs/API.md
index f1328ff1ad..a022bcefa5 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -165,6 +165,18 @@ PortOS is designed for personal/developer use on trusted networks. It implements
| POST | `/cos/scripts/:id/run` | Execute a script immediately |
| GET | `/cos/scripts/:id/runs` | Get script run history |
+### CoS Weekly Digest
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/cos/digest` | Get current week's digest |
+| GET | `/cos/digest/list` | List all available weekly digests |
+| GET | `/cos/digest/progress` | Get current week's live progress |
+| GET | `/cos/digest/text` | Get text summary for notifications |
+| GET | `/cos/digest/:weekId` | Get digest for specific week |
+| POST | `/cos/digest/generate` | Force generate digest for a week |
+| GET | `/cos/digest/compare` | Compare two weeks |
+
### Memory System
| Method | Endpoint | Description |
@@ -203,6 +215,41 @@ PortOS is designed for personal/developer use on trusted networks. It implements
| GET | `/usage/daily` | Get daily activity |
| GET | `/usage/hourly` | Get hourly activity |
+### Brain (Second Brain)
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| POST | `/brain/capture` | Capture and classify thought |
+| GET | `/brain/inbox` | List inbox log with filters |
+| POST | `/brain/review/resolve` | Resolve needs_review item |
+| POST | `/brain/fix` | Correct misclassified item |
+| GET | `/brain/people` | List people |
+| POST | `/brain/people` | Create person |
+| GET | `/brain/people/:id` | Get person |
+| PUT | `/brain/people/:id` | Update person |
+| DELETE | `/brain/people/:id` | Delete person |
+| GET | `/brain/projects` | List projects |
+| POST | `/brain/projects` | Create project |
+| GET | `/brain/projects/:id` | Get project |
+| PUT | `/brain/projects/:id` | Update project |
+| DELETE | `/brain/projects/:id` | Delete project |
+| GET | `/brain/ideas` | List ideas |
+| POST | `/brain/ideas` | Create idea |
+| GET | `/brain/ideas/:id` | Get idea |
+| PUT | `/brain/ideas/:id` | Update idea |
+| DELETE | `/brain/ideas/:id` | Delete idea |
+| GET | `/brain/admin` | List admin tasks |
+| POST | `/brain/admin` | Create admin task |
+| GET | `/brain/admin/:id` | Get admin task |
+| PUT | `/brain/admin/:id` | Update admin task |
+| DELETE | `/brain/admin/:id` | Delete admin task |
+| GET | `/brain/digest/latest` | Get latest daily digest |
+| GET | `/brain/review/latest` | Get latest weekly review |
+| POST | `/brain/digest/run` | Trigger daily digest |
+| POST | `/brain/review/run` | Trigger weekly review |
+| GET | `/brain/settings` | Get Brain settings |
+| PUT | `/brain/settings` | Update Brain settings |
+
## WebSocket Events
Connect to Socket.IO at `http://localhost:5554`.
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index f058756a0d..12f2c43b6c 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -79,10 +79,18 @@ PortOS/
│ ├── TASKS.md # User task file
│ ├── COS-TASKS.md # System task file
│ ├── COS-GOALS.md # Mission and goals
-│ └── cos/ # CoS state and agents
-│ ├── state.json # Daemon state
-│ ├── agents/ # Agent outputs
-│ └── memory/ # Memory storage
+│ ├── cos/ # CoS state and agents
+│ │ ├── state.json # Daemon state
+│ │ ├── agents/ # Agent outputs
+│ │ └── memory/ # Memory storage
+│ └── brain/ # Brain second-brain data
+│ ├── meta.json # Settings
+│ ├── inbox_log.jsonl # Captured thoughts
+│ ├── people.jsonl # People records
+│ ├── projects.jsonl # Project records
+│ ├── ideas.jsonl # Ideas
+│ ├── admin.jsonl # Admin tasks
+│ └── digests.jsonl # Daily/weekly digests
│
├── docs/ # Documentation
├── .github/workflows/ # CI/CD
@@ -170,6 +178,12 @@ Server Event → Socket.IO → socket.js → React Component State Update
- Agent trigger integration
- Run history tracking
+### Brain Service (`server/services/brain.js`)
+- Thought capture and AI classification
+- CRUD for People, Projects, Ideas, Admin
+- Daily digest and weekly review generation
+- Classification correction workflow
+
## Error Handling
All routes use `asyncHandler` wrapper from `server/lib/errorHandler.js`: