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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
docs: update documentation for M25 Task Learning and M26 Scripts
Adam Eivy52929198abae
diff --git a/PLAN.md b/PLAN.mdindex 7b03e1275a..b261ba00c1 100644--- a/PLAN.md+++ b/PLAN.md@@ -52,6 +52,7 @@ pm2 logs- [x] M23: Self-Improvement System (automated UI/security/code quality analysis with Playwright and Opus)- [x] M24: Goal-Driven Proactive Mode (COS-GOALS.md mission file, always-working behavior, expanded task types)- [x] M25: Task Learning System (completion tracking, success rate analysis, model effectiveness, recommendations)+- [x] M26: Scheduled Scripts (cron scheduling, agent triggers, command allowlist, run history)### Documentation- [Architecture Overview](./docs/ARCHITECTURE.md) - System design, data flow@@ -1135,6 +1136,119 @@ After: Apps on cooldown → Run self-improvement → Always working---+## M25: Task Learning System++Tracks patterns from completed tasks to improve future task execution and model selection.++### Features+1. **Completion Tracking**: Records success/failure for every agent task completion+2. **Success Rate Analysis**: Calculates success rates by task type and model tier+3. **Duration Tracking**: Tracks average execution time per task type+4. **Error Pattern Analysis**: Identifies recurring error categories+5. **Model Effectiveness**: Compares performance across model tiers (light/medium/heavy)+6. **Recommendations**: Generates actionable insights based on historical data++### Data Tracked+| Metric | Grouping | Description |+|--------|----------|-------------|+| Completion count | By task type | Total tasks completed per type |+| Success rate | By task type | Percentage of successful completions |+| Average duration | By task type | Mean execution time |+| Error patterns | By category | Recurring error types with affected tasks |+| Model effectiveness | By tier | Success rate and duration per model |++### API Endpoints+| Route | Description |+|-------|-------------|+| GET /api/cos/learning | Get learning insights and recommendations |+| GET /api/cos/learning/durations | Get task duration estimates by type |+| POST /api/cos/learning/backfill | Backfill learning data from history |++### Data Storage+```+./data/cos/+└── learning.json # Learning metrics and patterns+```++### Implementation Files+| File | Purpose |+|------|---------|+| `server/services/taskLearning.js` | Core learning service |+| `server/routes/cos.js` | Learning API endpoints |++---++## M26: Scheduled Scripts++Cron-based script scheduling with optional agent triggering for automated health checks and maintenance.++### Features+1. **Schedule Presets**: Common intervals (5min, 15min, hourly, daily, weekly, on-demand)+2. **Custom Cron**: Full cron expression support for complex schedules+3. **Command Allowlist**: Security-first design using same allowlist as command runner+4. **Agent Triggering**: Scripts can spawn CoS agents when issues are detected+5. **Run History**: Track last execution, output, and exit codes+6. **Enable/Disable**: Toggle scripts without deleting them++### Schedule Presets+| Preset | Cron Expression |+|--------|-----------------|+| every-5-min | `*/5 * * * *` |+| every-15-min | `*/15 * * * *` |+| every-30-min | `*/30 * * * *` |+| hourly | `0 * * * *` |+| every-6-hours | `0 */6 * * *` |+| daily | `0 9 * * *` |+| weekly | `0 9 * * 1` |+| on-demand | (manual only) |++### Trigger Actions+| Action | Description |+|--------|-------------|+| log-only | Record output, no further action |+| spawn-agent | Create CoS task with output as context |+| create-task | Add task to COS-TASKS.md (not yet implemented) |++### API Endpoints+| Route | Description |+|-------|-------------|+| GET /api/cos/scripts | List all scripts |+| POST /api/cos/scripts | Create a new script |+| GET /api/cos/scripts/presets | Get schedule presets |+| GET /api/cos/scripts/allowed-commands | Get allowed commands |+| GET /api/cos/scripts/jobs | Get scheduled job info |+| GET /api/cos/scripts/:id | Get specific script |+| PUT /api/cos/scripts/:id | Update a script |+| DELETE /api/cos/scripts/:id | Delete a script |+| POST /api/cos/scripts/:id/run | Execute immediately |+| GET /api/cos/scripts/:id/runs | Get run history |++### Data Storage+```+./data/cos/+├── scripts/ # Script output logs+└── scripts-state.json # Script configurations+```++### Socket Events+| Event | Description |+|-------|-------------|+| script:created | New script created |+| script:updated | Script configuration changed |+| script:deleted | Script removed |+| script:started | Execution started |+| script:completed | Execution finished |+| script:error | Execution error |++### Implementation Files+| File | Purpose |+|------|---------|+| `server/services/scriptRunner.js` | Script execution and scheduling |+| `server/routes/scripts.js` | REST API endpoints |+| `client/src/components/cos/tabs/ScriptCard.jsx` | Script UI component |++---+## Security Audit (2026-01-08)Comprehensive security audit performed by CoS Self-Improvement agent.diff --git a/README.md b/README.mdindex ab637071cb..20edaac019 100644--- a/README.md+++ b/README.md@@ -13,6 +13,8 @@ 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+- **Task Learning** — Tracks task success rates and duration to improve model selection+- **Scheduled Scripts** — Cron-based automation with optional agent triggering- **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 accessdiff --git a/docs/API.md b/docs/API.mdindex c852cbaef3..fd4af3a8c7 100644--- a/docs/API.md+++ b/docs/API.md@@ -132,6 +132,29 @@ No authentication is required. PortOS relies on network-level security (Tailscal| POST | `/cos/agents/:id/terminate` | Terminate agent || GET | `/cos/reports` | List reports |+### CoS Task Learning++| Method | Endpoint | Description |+|--------|----------|-------------|+| GET | `/cos/learning` | Get learning insights and recommendations |+| GET | `/cos/learning/durations` | Get task duration estimates by type |+| POST | `/cos/learning/backfill` | Backfill learning data from history |++### CoS Scheduled Scripts++| Method | Endpoint | Description |+|--------|----------|-------------|+| GET | `/cos/scripts` | List all scheduled scripts |+| POST | `/cos/scripts` | Create a new script |+| GET | `/cos/scripts/presets` | Get available schedule presets |+| GET | `/cos/scripts/allowed-commands` | Get allowed commands for scripts |+| GET | `/cos/scripts/jobs` | Get scheduled job info |+| GET | `/cos/scripts/:id` | Get a specific script |+| PUT | `/cos/scripts/:id` | Update a script |+| DELETE | `/cos/scripts/:id` | Delete a script |+| POST | `/cos/scripts/:id/run` | Execute a script immediately |+| GET | `/cos/scripts/:id/runs` | Get script run history |+### Memory System| Method | Endpoint | Description |@@ -244,6 +267,26 @@ socket.on('cos:memory:updated', (memory) => {});```+### Script Events++```javascript+socket.on('script:created', (script) => {+ console.log('Script created:', script.id, script.name);+});++socket.on('script:started', ({ scriptId, name }) => {+ console.log('Script started:', scriptId);+});++socket.on('script:completed', ({ scriptId, exitCode, duration }) => {+ console.log('Script completed:', scriptId, exitCode);+});++socket.on('script:error', ({ scriptId, error }) => {+ console.error('Script error:', scriptId, error);+});+```+### App Detection (Streaming)```javascriptdiff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex e2a79ee980..f058756a0d 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -158,6 +158,18 @@ Server Event → Socket.IO → socket.js → React Component State Update- Vector embeddings via LM Studio- Memory retrieval for context injection+### Task Learning Service (`server/services/taskLearning.js`)+- Completion tracking and success rates+- Duration estimates by task type+- Model tier effectiveness analysis+- Actionable recommendations++### Script Runner Service (`server/services/scriptRunner.js`)+- Cron-based script scheduling+- Command allowlist enforcement+- Agent trigger integration+- Run history tracking+## Error HandlingAll routes use `asyncHandler` wrapper from `server/lib/errorHandler.js`: