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

feat(apps): add archive/unarchive to exclude apps from COS tasks

Adam Eivy360b7282f8ba
diff --git a/.changelog/v0.10.x.md b/.changelog/v0.10.x.md
index e08cb87785..d96632ce09 100644
--- a/.changelog/v0.10.x.md
+++ b/.changelog/v0.10.x.md
@@ -392,6 +392,14 @@ This release introduces a structured changelog documentation system for creating
- **Learning System Visibility**: Makes CoS learning data visible at the task level, showing how well similar tasks have performed historically
- **Informative Tooltips**: Hover reveals "high/moderate/low success rate" with sample size (e.g., "67% of 12 similar tasks succeeded")
+### Chief of Staff - App Archive/Unarchive
+- **Archive Apps**: Apps can now be archived to exclude them from COS scheduled tasks (improvement, review, security audit, etc.)
+- **Unarchive Apps**: Archived apps can be unarchived to re-include them in COS scheduled tasks
+- **Visual Indicators**: Archived apps display an "Archived" badge with dimmed styling in the app list
+- **Archive Toggle Button**: New archive/unarchive button appears next to Edit/Delete for each app
+- **Filtered Views**: Toggle between active apps and archived apps view using the header button
+- **Preserved Data**: Archiving is a soft-delete - all app data and activity history is preserved for unarchiving
+
### Web Shell PTY Compatibility Fix
- **Node.js 25 Support**: Upgraded node-pty from 1.1.0 to 1.2.0-beta.10 to fix `posix_spawnp failed` error on Node.js 25.x
- **Error Handling**: Added error handling to shell session creation to catch PTY spawn failures and report them to the client instead of silently failing
diff --git a/client/src/pages/Apps.jsx b/client/src/pages/Apps.jsx
index f1cf0625e4..35d0da71a6 100644
--- a/client/src/pages/Apps.jsx
+++ b/client/src/pages/Apps.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
import { Link } from 'react-router-dom';
-import { ExternalLink, Play, Square, RotateCcw, FolderOpen, Terminal, Code, RefreshCw, Wrench } from 'lucide-react';
+import { ExternalLink, Play, Square, RotateCcw, FolderOpen, Terminal, Code, RefreshCw, Wrench, Archive, ArchiveRestore } from 'lucide-react';
import toast from 'react-hot-toast';
import StatusBadge from '../components/StatusBadge';
import IconPicker from '../components/IconPicker';
@@ -16,6 +16,8 @@ export default function Apps() {
const [actionLoading, setActionLoading] = useState({});
const [refreshingConfig, setRefreshingConfig] = useState({});
const [standardizing, setStandardizing] = useState({});
+ const [archiving, setArchiving] = useState({});
+ const [showArchived, setShowArchived] = useState(false);
const fetchApps = useCallback(async () => {
const data = await api.getApps().catch(() => []);
@@ -103,6 +105,25 @@ export default function Apps() {
setExpandedId(prev => prev === id ? null : id);
};
+ const handleArchive = async (app) => {
+ setArchiving(prev => ({ ...prev, [app.id]: true }));
+ await api.archiveApp(app.id).catch(() => null);
+ setArchiving(prev => ({ ...prev, [app.id]: false }));
+ toast.success(`${app.name} archived - excluded from COS tasks`);
+ };
+
+ const handleUnarchive = async (app) => {
+ setArchiving(prev => ({ ...prev, [app.id]: true }));
+ await api.unarchiveApp(app.id).catch(() => null);
+ setArchiving(prev => ({ ...prev, [app.id]: false }));
+ toast.success(`${app.name} unarchived - included in COS tasks`);
+ };
+
+ // Filter apps based on archive status
+ const activeApps = apps.filter(app => !app.archived);
+ const archivedApps = apps.filter(app => app.archived);
+ const displayedApps = showArchived ? archivedApps : activeApps;
+
if (loading) {
return (
<div className="flex items-center justify-center h-64">
@@ -119,30 +140,52 @@ export default function Apps() {
<h2 className="text-2xl font-bold text-white">Apps</h2>
<p className="text-gray-500 text-sm sm:text-base">Manage registered applications</p>
</div>
- <Link
- to="/apps/create"
- className="px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors text-center"
- >
- + Add App
- </Link>
- </div>
-
- {/* App List */}
- {apps.length === 0 ? (
- <div className="bg-port-card border border-port-border rounded-xl p-12 text-center">
- <div className="text-4xl mb-4">📦</div>
- <h3 className="text-xl font-semibold text-white mb-2">No apps registered</h3>
- <p className="text-gray-500 mb-6">Add your first app to get started</p>
+ <div className="flex items-center gap-3">
+ {/* Archive Toggle */}
+ {archivedApps.length > 0 && (
+ <button
+ onClick={() => setShowArchived(prev => !prev)}
+ className={`px-3 py-2 rounded-lg text-sm flex items-center gap-2 transition-colors ${
+ showArchived
+ ? 'bg-port-warning/20 text-port-warning border border-port-warning/30'
+ : 'bg-port-border text-gray-400 hover:text-white'
+ }`}
+ >
+ <Archive size={16} />
+ {showArchived ? `Active (${activeApps.length})` : `Archived (${archivedApps.length})`}
+ </button>
+ )}
<Link
to="/apps/create"
- className="inline-block px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors"
+ className="px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors text-center"
>
- Add App
+ + Add App
</Link>
</div>
+ </div>
+
+ {/* App List */}
+ {displayedApps.length === 0 ? (
+ <div className="bg-port-card border border-port-border rounded-xl p-12 text-center">
+ <div className="text-4xl mb-4">{showArchived ? '📦' : '🗂️'}</div>
+ <h3 className="text-xl font-semibold text-white mb-2">
+ {showArchived ? 'No archived apps' : 'No apps registered'}
+ </h3>
+ <p className="text-gray-500 mb-6">
+ {showArchived ? 'Archived apps will appear here' : 'Add your first app to get started'}
+ </p>
+ {!showArchived && (
+ <Link
+ to="/apps/create"
+ className="inline-block px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors"
+ >
+ Add App
+ </Link>
+ )}
+ </div>
) : (
<div className="space-y-4">
- {apps.map(app => (
+ {displayedApps.map(app => (
<div
key={app.id}
className="bg-port-card border border-port-border rounded-xl overflow-hidden"
@@ -162,7 +205,12 @@ export default function Apps() {
</button>
<div className="min-w-0 flex-1">
<div className="flex flex-wrap items-center gap-2">
- <span className="font-medium text-white">{app.name}</span>
+ <span className={`font-medium ${app.archived ? 'text-gray-400' : 'text-white'}`}>{app.name}</span>
+ {app.archived && (
+ <span className="px-1.5 py-0.5 bg-port-warning/20 text-port-warning text-xs rounded">
+ Archived
+ </span>
+ )}
<StatusBadge status={app.overallStatus} size="sm" />
</div>
<div className="text-xs text-gray-500 flex flex-wrap gap-x-2 mt-1">
@@ -261,21 +309,37 @@ export default function Apps() {
</div>
</div>
) : (
- <div className="inline-flex rounded-lg overflow-hidden border border-port-border">
+ <div className="flex items-center gap-2">
+ {/* Archive/Unarchive button */}
<button
- onClick={() => setEditingApp(app)}
- className="px-3 py-1.5 bg-port-accent/20 text-port-accent hover:bg-port-accent/30 transition-colors text-xs focus:outline-none focus:ring-2 focus:ring-port-accent"
- aria-label={`Edit ${app.name}`}
+ onClick={() => app.archived ? handleUnarchive(app) : handleArchive(app)}
+ disabled={archiving[app.id]}
+ className={`px-3 py-1.5 rounded-lg text-xs flex items-center gap-1 transition-colors disabled:opacity-50 border ${
+ app.archived
+ ? 'bg-port-success/20 text-port-success border-port-success/30 hover:bg-port-success/30'
+ : 'bg-port-border text-gray-400 border-port-border hover:text-white hover:bg-port-border/80'
+ }`}
+ aria-label={app.archived ? `Unarchive ${app.name}` : `Archive ${app.name}`}
>
- Edit
- </button>
- <button
- onClick={() => setConfirmingDelete(app.id)}
- className="px-3 py-1.5 bg-port-error/10 text-port-error hover:bg-port-error/20 transition-colors text-xs border-l border-port-border focus:outline-none focus:ring-2 focus:ring-port-error"
- aria-label={`Delete ${app.name}`}
- >
- Delete
+ {app.archived ? <ArchiveRestore size={14} /> : <Archive size={14} />}
+ {archiving[app.id] ? '...' : app.archived ? 'Unarchive' : 'Archive'}
</button>
+ <div className="inline-flex rounded-lg overflow-hidden border border-port-border">
+ <button
+ onClick={() => setEditingApp(app)}
+ className="px-3 py-1.5 bg-port-accent/20 text-port-accent hover:bg-port-accent/30 transition-colors text-xs focus:outline-none focus:ring-2 focus:ring-port-accent"
+ aria-label={`Edit ${app.name}`}
+ >
+ Edit
+ </button>
+ <button
+ onClick={() => setConfirmingDelete(app.id)}
+ className="px-3 py-1.5 bg-port-error/10 text-port-error hover:bg-port-error/20 transition-colors text-xs border-l border-port-border focus:outline-none focus:ring-2 focus:ring-port-error"
+ aria-label={`Delete ${app.name}`}
+ >
+ Delete
+ </button>
+ </div>
</div>
)}
</div>
diff --git a/client/src/services/api.js b/client/src/services/api.js
index d31e0284e4..2ace771f6a 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -49,6 +49,8 @@ export const deleteApp = (id) => request(`/apps/${id}`, { method: 'DELETE' });
export const startApp = (id) => request(`/apps/${id}/start`, { method: 'POST' });
export const stopApp = (id) => request(`/apps/${id}/stop`, { method: 'POST' });
export const restartApp = (id) => request(`/apps/${id}/restart`, { method: 'POST' });
+export const archiveApp = (id) => request(`/apps/${id}/archive`, { method: 'POST' });
+export const unarchiveApp = (id) => request(`/apps/${id}/unarchive`, { method: 'POST' });
export const openAppInEditor = (id) => request(`/apps/${id}/open-editor`, { method: 'POST' });
export const openAppFolder = (id) => request(`/apps/${id}/open-folder`, { method: 'POST' });
export const refreshAppConfig = (id) => request(`/apps/${id}/refresh-config`, { method: 'POST' });
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 4d305673cb..8f2fcece6d 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -144,7 +144,8 @@ export const appSchema = z.object({
envFile: z.string().optional(),
icon: z.string().nullable().optional(),
editorCommand: z.string().optional(),
- description: z.string().optional()
+ description: z.string().optional(),
+ archived: z.boolean().optional().default(false)
});
// Partial schema for updates
diff --git a/server/routes/apps.js b/server/routes/apps.js
index 900ea1c2a5..91ab819ea3 100644
--- a/server/routes/apps.js
+++ b/server/routes/apps.js
@@ -121,6 +121,32 @@ router.delete('/:id', asyncHandler(async (req, res, next) => {
res.status(204).send();
}));
+// POST /api/apps/:id/archive - Archive app (exclude from COS tasks)
+router.post('/:id/archive', asyncHandler(async (req, res) => {
+ const app = await appsService.archiveApp(req.params.id);
+
+ if (!app) {
+ throw new ServerError('App not found', { status: 404, code: 'NOT_FOUND' });
+ }
+
+ console.log(`📦 Archived app: ${app.name}`);
+ notifyAppsChanged('archive');
+ res.json(app);
+}));
+
+// POST /api/apps/:id/unarchive - Unarchive app (include in COS tasks)
+router.post('/:id/unarchive', asyncHandler(async (req, res) => {
+ const app = await appsService.unarchiveApp(req.params.id);
+
+ if (!app) {
+ throw new ServerError('App not found', { status: 404, code: 'NOT_FOUND' });
+ }
+
+ console.log(`📤 Unarchived app: ${app.name}`);
+ notifyAppsChanged('unarchive');
+ res.json(app);
+}));
+
// POST /api/apps/:id/start - Start app via PM2
router.post('/:id/start', asyncHandler(async (req, res, next) => {
const app = await appsService.getAppById(req.params.id);
diff --git a/server/services/apps.js b/server/services/apps.js
index d8fa60439c..2f4aeed03e 100644
--- a/server/services/apps.js
+++ b/server/services/apps.js
@@ -77,10 +77,25 @@ export function notifyAppsChanged(action = 'update') {
/**
* Get all apps (injects id from key)
+ * @param {Object} options - Filter options
+ * @param {boolean} options.includeArchived - Include archived apps (default: true for backwards compatibility)
*/
-export async function getAllApps() {
+export async function getAllApps({ includeArchived = true } = {}) {
const data = await loadApps();
- return Object.entries(data.apps).map(([id, app]) => ({ id, ...app }));
+ const apps = Object.entries(data.apps).map(([id, app]) => ({ id, ...app }));
+
+ if (!includeArchived) {
+ return apps.filter(app => !app.archived);
+ }
+
+ return apps;
+}
+
+/**
+ * Get all active (non-archived) apps
+ */
+export async function getActiveApps() {
+ return getAllApps({ includeArchived: false });
}
/**
@@ -113,6 +128,7 @@ export async function createApp(appData) {
envFile: appData.envFile || '.env',
icon: appData.icon || null,
editorCommand: appData.editorCommand || 'code .',
+ archived: false,
createdAt: now,
updatedAt: now
};
@@ -167,6 +183,20 @@ export async function deleteApp(id) {
return true;
}
+/**
+ * Archive an app (soft-delete that excludes from COS tasks)
+ */
+export async function archiveApp(id) {
+ return updateApp(id, { archived: true });
+}
+
+/**
+ * Unarchive an app (restore to active status)
+ */
+export async function unarchiveApp(id) {
+ return updateApp(id, { archived: false });
+}
+
/**
* Get reserved ports from all registered apps
*/
diff --git a/server/services/cos.js b/server/services/cos.js
index f1a60999ba..1798c37111 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -15,7 +15,7 @@ import { v4 as uuidv4 } from 'uuid';
import { getActiveProvider } from './providers.js';
import { parseTasksMarkdown, groupTasksByStatus, getNextTask, getAutoApprovedTasks, getAwaitingApprovalTasks, updateTaskStatus, generateTasksMarkdown } from '../lib/taskParser.js';
import { isAppOnCooldown, getNextAppForReview, markAppReviewStarted, markIdleReviewStarted } from './appActivity.js';
-import { getAllApps } from './apps.js';
+import { getAllApps, getActiveApps } from './apps.js';
import { getAdaptiveCooldownMultiplier, getSkippedTaskTypes, getPerformanceSummary, checkAndRehabilitateSkippedTasks } from './taskLearning.js';
import { schedule as scheduleEvent, cancel as cancelEvent, getStats as getSchedulerStats } from './eventScheduler.js';
import { generateProactiveTasks as generateMissionTasks, getStats as getMissionStats } from './missions.js';
@@ -548,7 +548,8 @@ export async function evaluateTasks() {
task = await generateSelfImprovementTaskForType(request.taskType, state);
} else if (request.category === 'appImprovement' && state.config.appImprovementEnabled) {
// Generate app improvement task for the specific app requested (or next eligible if no appId)
- const apps = await getAllApps().catch(() => []);
+ // Only consider active (non-archived) apps for COS tasks
+ const apps = await getActiveApps().catch(() => []);
let targetApp = null;
if (request.appId) {
@@ -768,8 +769,8 @@ async function generateIdleReviewTask(state) {
// Try app reviews (if enabled)
if (state.config.appImprovementEnabled) {
- // Get all managed apps
- const apps = await getAllApps().catch(() => []);
+ // Get all active (non-archived) managed apps
+ const apps = await getActiveApps().catch(() => []);
if (apps.length > 0) {
// Find next app eligible for review (not on cooldown, oldest review first)
@@ -895,7 +896,8 @@ async function queueEligibleImprovementTasks(state, cosTaskData) {
// Queue eligible app improvement tasks for managed apps (if enabled)
if (state.config.appImprovementEnabled) {
- const apps = await getAllApps().catch(() => []);
+ // Only queue tasks for active (non-archived) apps
+ const apps = await getActiveApps().catch(() => []);
for (const app of apps) {
// Check if app is on cooldown
const onCooldown = await isAppOnCooldown(app.id, state.config.appReviewCooldownMs);