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 API, architecture, and README with new features

Adam Eivy431ad8601e06
diff --git a/PLAN.md b/PLAN.md
index 6788621f4c..6ba29b16a9 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -104,7 +104,6 @@ Based on recent work and incomplete milestones:
2. **Digital Twin P3: Behavioral Feedback Loop** - Add "sounds like me" response validation and adaptive weighting
3. **Vision API Polish** - Continue refining LM Studio vision integration based on test results
4. **Memory Consolidation** - Implement automatic memory consolidation for similar memories
-5. **Documentation Updates** - Keep ARCHITECTURE.md and API.md current with M35 features
---
diff --git a/README.md b/README.md
index 0a9fbac06c..a2a68ed7f3 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,11 @@ Think Umbrel, but for your active git repos and dev environments. Access your de
- **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
+- **Digital Twin** — Identity scaffold documents for AI persona modeling with personality trait extraction
+- **Web Shell** — Full terminal emulator in the browser using xterm.js and node-pty
- **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
+- **File Uploads** — Generic file storage with drag-and-drop upload interface
- **Mobile Ready** — Responsive design with collapsible sidebar for on-the-go access
## Screenshots
diff --git a/docs/API.md b/docs/API.md
index a022bcefa5..99d31b293c 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -249,6 +249,132 @@ PortOS is designed for personal/developer use on trusted networks. It implements
| POST | `/brain/review/run` | Trigger weekly review |
| GET | `/brain/settings` | Get Brain settings |
| PUT | `/brain/settings` | Update Brain settings |
+| GET | `/brain/summary` | Get brain statistics summary |
+
+### Brain Links
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/brain/links` | List saved links |
+| GET | `/brain/links/:id` | Get link details |
+| POST | `/brain/links` | Save a new link |
+| PUT | `/brain/links/:id` | Update link |
+| DELETE | `/brain/links/:id` | Delete link |
+| POST | `/brain/links/:id/clone` | Clone GitHub repo |
+| POST | `/brain/links/:id/pull` | Pull updates for cloned repo |
+| POST | `/brain/links/:id/open-folder` | Open cloned repo in file manager |
+
+### File Uploads
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/uploads` | List all uploaded files |
+| POST | `/uploads` | Upload file (base64) |
+| GET | `/uploads/:filename` | Download/serve file |
+| DELETE | `/uploads/:filename` | Delete file |
+| DELETE | `/uploads?confirm=true` | Delete all files |
+
+### Task Attachments
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/attachments` | List all attachments |
+| POST | `/attachments` | Upload task attachment |
+| GET | `/attachments/:filename` | Download attachment |
+| DELETE | `/attachments/:filename` | Delete attachment |
+
+### Digital Twin
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/digital-twin/documents` | List all documents |
+| GET | `/digital-twin/documents/:id` | Get document content |
+| POST | `/digital-twin/documents` | Create document |
+| PUT | `/digital-twin/documents/:id` | Update document |
+| DELETE | `/digital-twin/documents/:id` | Delete document |
+| GET | `/digital-twin/categories` | List document categories |
+| GET | `/digital-twin/export` | Export twin in various formats |
+| POST | `/digital-twin/tests/run` | Run behavioral tests |
+| GET | `/digital-twin/tests/results` | Get test results |
+| GET | `/digital-twin/enrichment/categories` | List enrichment categories |
+| POST | `/digital-twin/enrichment/generate` | Generate content from answers |
+| GET | `/digital-twin/traits` | Get extracted personality traits |
+| POST | `/digital-twin/traits/analyze` | Analyze traits from documents |
+| GET | `/digital-twin/confidence` | Get confidence scores |
+| POST | `/digital-twin/confidence/calculate` | Calculate confidence |
+| GET | `/digital-twin/gaps` | Get enrichment recommendations |
+| GET | `/digital-twin/completeness` | Get completeness validation |
+| POST | `/digital-twin/contradictions` | Detect contradictions |
+| POST | `/digital-twin/import/analyze` | Analyze external data import |
+| POST | `/digital-twin/import/save` | Save analyzed import as document |
+
+### Agent Personalities
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/agent-personalities` | List all agent personalities |
+| GET | `/agent-personalities/:id` | Get personality details |
+| POST | `/agent-personalities` | Create personality |
+| PUT | `/agent-personalities/:id` | Update personality |
+| DELETE | `/agent-personalities/:id` | Delete personality |
+| POST | `/agent-personalities/generate` | AI-generate personality |
+| POST | `/agent-personalities/:id/toggle` | Toggle personality active state |
+
+### Platform Accounts
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/platform-accounts` | List linked platform accounts |
+| POST | `/platform-accounts` | Link new account |
+| PUT | `/platform-accounts/:id` | Update account |
+| DELETE | `/platform-accounts/:id` | Unlink account |
+| POST | `/platform-accounts/:id/test` | Test account connection |
+
+### Automation Schedules
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/automation-schedules` | List all schedules |
+| GET | `/automation-schedules/stats` | Get schedule statistics |
+| GET | `/automation-schedules/:id` | Get schedule details |
+| POST | `/automation-schedules` | Create schedule |
+| PUT | `/automation-schedules/:id` | Update schedule |
+| DELETE | `/automation-schedules/:id` | Delete schedule |
+| POST | `/automation-schedules/:id/toggle` | Toggle schedule on/off |
+| POST | `/automation-schedules/:id/run` | Run schedule immediately |
+
+### Agent Activity
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/agent-activity` | List activity logs |
+| GET | `/agent-activity/timeline` | Get activity timeline |
+| GET | `/agent-activity/agent/:agentId` | Get agent's activity |
+| GET | `/agent-activity/agent/:agentId/stats` | Get agent statistics |
+| POST | `/agent-activity/cleanup` | Clean up old activity logs |
+
+### Notifications
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/notifications` | List notifications |
+| GET | `/notifications/count` | Get unread count |
+| GET | `/notifications/counts` | Get counts by type |
+| POST | `/notifications/:id/read` | Mark as read |
+| POST | `/notifications/read-all` | Mark all as read |
+| DELETE | `/notifications/:id` | Delete notification |
+| DELETE | `/notifications` | Clear all notifications |
+
+### Media (Audio/Video Capture)
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/media/devices` | List available media devices |
+| GET | `/media/status` | Get capture status |
+| POST | `/media/start` | Start capture |
+| POST | `/media/stop` | Stop capture |
+| GET | `/media/video` | Get video stream |
+| GET | `/media/audio` | Get audio stream |
## WebSocket Events
@@ -361,6 +487,36 @@ socket.on('detect:complete', (appData) => {
});
```
+### Shell Terminal
+
+```javascript
+// Start a shell session
+socket.emit('shell:start', { id: 'my-session' });
+
+// Send input to shell
+socket.emit('shell:input', { id: 'my-session', data: 'ls -la\n' });
+
+// Receive shell output
+socket.on('shell:output', ({ id, data }) => {
+ console.log(data); // Terminal output
+});
+
+// Resize terminal
+socket.emit('shell:resize', { id: 'my-session', cols: 120, rows: 40 });
+
+// Stop shell session
+socket.emit('shell:stop', { id: 'my-session' });
+```
+
+### Provider Status
+
+```javascript
+// Provider availability changed
+socket.on('provider:status:changed', ({ providerId, status, reason }) => {
+ console.log(`Provider ${providerId}: ${status}`, reason);
+});
+```
+
## Request Examples
### Register an App
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 12f2c43b6c..b18137bd37 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -83,14 +83,21 @@ PortOS/
│ │ ├── 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
+│ ├── 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
+│ │ ├── links.json # Saved links
+│ │ └── digests.jsonl # Daily/weekly digests
+│ ├── digital-twin/ # Digital twin identity documents
+│ │ ├── meta.json # Settings and state
+│ │ └── documents/ # Markdown identity documents
+│ ├── uploads/ # Generic file uploads
+│ ├── repos/ # Cloned GitHub repositories
+│ └── agent-personalities/ # Agent personality configs
│
├── docs/ # Documentation
├── .github/workflows/ # CI/CD
@@ -183,6 +190,23 @@ Server Event → Socket.IO → socket.js → React Component State Update
- CRUD for People, Projects, Ideas, Admin
- Daily digest and weekly review generation
- Classification correction workflow
+- Link capture with GitHub auto-clone
+
+### Digital Twin Service (`server/services/digital-twin.js`)
+- Identity scaffold document management
+- Personality trait extraction (Big Five, values hierarchy)
+- Behavioral test generation and execution
+- External data import (Goodreads, Spotify, Letterboxd, iCal)
+- Confidence scoring and gap recommendations
+
+### Agent Personalities (`server/services/agentPersonalities.js`)
+- Agent personality CRUD and AI generation
+- Custom communication styles, tones, and quirks
+
+### Shell Service (`server/services/shell.js`)
+- PTY-based web terminal via node-pty
+- Session management with WebSocket I/O
+- Terminal resize handling
## Error Handling