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: add progress log to goals system for tracking activity sessions

Adam Eivyfeeb279b6a57
diff --git a/client/src/components/goals/GoalDetailPanel.jsx b/client/src/components/goals/GoalDetailPanel.jsx
index 60030bcbf0..2bd5ed6c6a 100644
--- a/client/src/components/goals/GoalDetailPanel.jsx
+++ b/client/src/components/goals/GoalDetailPanel.jsx
@@ -1,8 +1,8 @@
import { useState, useEffect } from 'react';
import {
- Target, X, Check, Trash2, Milestone, Calendar,
+ Target, X, Check, Trash2, Milestone, Calendar, Clock,
Heart, DollarSign, Lightbulb, Users, Flame, AlertTriangle, Tag,
- Link2, Unlink, Activity
+ Link2, Unlink, Activity, Plus, NotebookPen
} from 'lucide-react';
import * as api from '../../services/api';
@@ -36,6 +36,8 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh })
const [newMilestone, setNewMilestone] = useState({ title: '', targetDate: '' });
const [activities, setActivities] = useState([]);
const [selectedActivity, setSelectedActivity] = useState('');
+ const [showProgressForm, setShowProgressForm] = useState(false);
+ const [progressForm, setProgressForm] = useState({ date: new Date().toISOString().slice(0, 10), note: '', durationMinutes: '' });
useEffect(() => {
api.getActivities().then(setActivities).catch(() => {});
@@ -102,6 +104,23 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh })
onRefresh();
};
+ const handleAddProgress = async () => {
+ if (!progressForm.note.trim() || !progressForm.date) return;
+ await api.addGoalProgress(goal.id, {
+ date: progressForm.date,
+ note: progressForm.note,
+ ...(progressForm.durationMinutes ? { durationMinutes: parseInt(progressForm.durationMinutes, 10) } : {})
+ });
+ setProgressForm({ date: new Date().toISOString().slice(0, 10), note: '', durationMinutes: '' });
+ setShowProgressForm(false);
+ onRefresh();
+ };
+
+ const handleDeleteProgress = async (entryId) => {
+ await api.deleteGoalProgress(goal.id, entryId);
+ onRefresh();
+ };
+
const handleUnlinkActivity = async (activityName) => {
await api.unlinkGoalActivity(goal.id, activityName);
onRefresh();
@@ -373,6 +392,103 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh })
</div>
</div>
+ {/* Progress Log */}
+ <div>
+ <div className="flex items-center justify-between mb-2">
+ <div className="flex items-center gap-1">
+ <NotebookPen className="w-3.5 h-3.5 text-gray-500" />
+ <span className="text-xs font-medium text-gray-400">
+ Progress ({goal.progressLog?.length || 0})
+ </span>
+ {goal.progressLog?.length > 0 && (
+ <span className="text-xs text-gray-600 ml-1">
+ {goal.progressLog.reduce((sum, e) => sum + (e.durationMinutes || 0), 0)}min total
+ </span>
+ )}
+ </div>
+ <button
+ onClick={() => setShowProgressForm(!showProgressForm)}
+ className="p-0.5 text-gray-500 hover:text-port-accent"
+ title="Log progress"
+ >
+ <Plus className="w-3.5 h-3.5" />
+ </button>
+ </div>
+ {showProgressForm && (
+ <div className="space-y-1.5 mb-2 p-2 rounded bg-port-bg border border-port-border">
+ <input
+ type="date"
+ value={progressForm.date}
+ onChange={e => setProgressForm({ ...progressForm, date: e.target.value })}
+ className="w-full bg-port-card border border-port-border rounded px-2 py-1 text-xs text-white"
+ />
+ <textarea
+ value={progressForm.note}
+ onChange={e => setProgressForm({ ...progressForm, note: e.target.value })}
+ placeholder="What did you work on?"
+ rows={2}
+ className="w-full bg-port-card border border-port-border rounded px-2 py-1 text-xs text-white resize-none"
+ />
+ <div className="flex items-center gap-1">
+ <Clock className="w-3 h-3 text-gray-500" />
+ <input
+ type="number"
+ value={progressForm.durationMinutes}
+ onChange={e => setProgressForm({ ...progressForm, durationMinutes: e.target.value })}
+ placeholder="Minutes (optional)"
+ min="1"
+ max="1440"
+ className="flex-1 bg-port-card border border-port-border rounded px-2 py-1 text-xs text-white"
+ />
+ </div>
+ <div className="flex gap-1">
+ <button
+ onClick={handleAddProgress}
+ disabled={!progressForm.note.trim()}
+ className="px-2 py-1 text-xs rounded bg-port-accent text-white disabled:opacity-50"
+ >
+ Log
+ </button>
+ <button
+ onClick={() => setShowProgressForm(false)}
+ className="px-2 py-1 text-xs rounded bg-port-border text-gray-300"
+ >
+ Cancel
+ </button>
+ </div>
+ </div>
+ )}
+ {goal.progressLog?.length > 0 && (
+ <div className="space-y-1.5 max-h-40 overflow-y-auto">
+ {[...goal.progressLog].reverse().map(entry => (
+ <div key={entry.id} className="flex items-start gap-2 text-xs group">
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-1.5 text-gray-500">
+ <span>{new Date(entry.date + 'T00:00:00').toLocaleDateString()}</span>
+ {entry.durationMinutes && (
+ <span className="flex items-center gap-0.5">
+ <Clock className="w-3 h-3" />
+ {entry.durationMinutes >= 60
+ ? `${Math.floor(entry.durationMinutes / 60)}h${entry.durationMinutes % 60 ? ` ${entry.durationMinutes % 60}m` : ''}`
+ : `${entry.durationMinutes}m`}
+ </span>
+ )}
+ </div>
+ <p className="text-gray-300 mt-0.5">{entry.note}</p>
+ </div>
+ <button
+ onClick={() => handleDeleteProgress(entry.id)}
+ className="p-0.5 text-gray-700 hover:text-red-400 opacity-0 group-hover:opacity-100 shrink-0"
+ title="Delete"
+ >
+ <Trash2 className="w-3 h-3" />
+ </button>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+
{/* Linked Activities */}
<div>
<div className="flex items-center gap-1 mb-2">
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 9bc62c5c19..280fa7ed4f 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -1379,6 +1379,12 @@ export const linkGoalActivity = (goalId, data) => request(`/digital-twin/identit
});
export const unlinkGoalActivity = (goalId, activityName) =>
request(`/digital-twin/identity/goals/${goalId}/activities/${encodeURIComponent(activityName)}`, { method: 'DELETE' });
+export const addGoalProgress = (goalId, data) => request(`/digital-twin/identity/goals/${goalId}/progress`, {
+ method: 'POST',
+ body: JSON.stringify(data)
+});
+export const deleteGoalProgress = (goalId, entryId) =>
+ request(`/digital-twin/identity/goals/${goalId}/progress/${entryId}`, { method: 'DELETE' });
// Feature Agents
export const getFeatureAgents = () => request('/feature-agents');
diff --git a/server/lib/identityValidation.js b/server/lib/identityValidation.js
index 60d80c9e00..886189932c 100644
--- a/server/lib/identityValidation.js
+++ b/server/lib/identityValidation.js
@@ -72,6 +72,14 @@ export const addMilestoneInputSchema = z.object({
targetDate: validCalendarDate.optional()
});
+// --- Goal Progress Log Schemas ---
+
+export const addProgressEntrySchema = z.object({
+ date: validCalendarDate,
+ note: z.string().min(1).max(1000),
+ durationMinutes: z.number().int().min(1).max(1440).optional()
+});
+
// --- Goal-Activity Link Schemas ---
export const linkActivityInputSchema = z.object({
diff --git a/server/routes/identity.js b/server/routes/identity.js
index d083e7c8d7..bb07483961 100644
--- a/server/routes/identity.js
+++ b/server/routes/identity.js
@@ -8,6 +8,7 @@ import {
createGoalInputSchema,
updateGoalInputSchema,
addMilestoneInputSchema,
+ addProgressEntrySchema,
linkActivityInputSchema
} from '../lib/identityValidation.js';
@@ -130,6 +131,25 @@ router.put('/goals/:id/milestones/:milestoneId/complete', asyncHandler(async (re
res.json(milestone);
}));
+// POST /api/digital-twin/identity/goals/:id/progress — Log progress entry
+router.post('/goals/:id/progress', asyncHandler(async (req, res) => {
+ const data = validateRequest(addProgressEntrySchema, req.body);
+ const entry = await identityService.addProgressEntry(req.params.id, data);
+ if (!entry) {
+ throw new ServerError('Goal not found', { status: 404, code: 'NOT_FOUND' });
+ }
+ res.status(201).json(entry);
+}));
+
+// DELETE /api/digital-twin/identity/goals/:id/progress/:entryId — Delete progress entry
+router.delete('/goals/:id/progress/:entryId', asyncHandler(async (req, res) => {
+ const result = await identityService.deleteProgressEntry(req.params.id, req.params.entryId);
+ if (!result) {
+ throw new ServerError('Goal or progress entry not found', { status: 404, code: 'NOT_FOUND' });
+ }
+ res.status(204).send();
+}));
+
// POST /api/digital-twin/identity/goals/:id/activities — Link activity to goal
router.post('/goals/:id/activities', asyncHandler(async (req, res) => {
const data = validateRequest(linkActivityInputSchema, req.body);
diff --git a/server/services/identity.js b/server/services/identity.js
index 1b9622492b..49003b4cf7 100644
--- a/server/services/identity.js
+++ b/server/services/identity.js
@@ -946,6 +946,45 @@ export async function addMilestone(goalId, { title, targetDate }) {
return milestone;
}
+export async function addProgressEntry(goalId, { date, note, durationMinutes }) {
+ const goals = await loadJSON(GOALS_FILE, DEFAULT_GOALS);
+ const goal = goals.goals.find(g => g.id === goalId);
+ if (!goal) return null;
+
+ if (!goal.progressLog) goal.progressLog = [];
+
+ const entry = {
+ id: `prog-${uuidv4()}`,
+ date,
+ note,
+ durationMinutes: durationMinutes || null,
+ createdAt: new Date().toISOString()
+ };
+
+ goal.progressLog.push(entry);
+ goal.updatedAt = new Date().toISOString();
+ goals.updatedAt = new Date().toISOString();
+ await saveJSON(GOALS_FILE, goals);
+
+ console.log(`📝 Progress logged for "${goal.title}": ${note} (${durationMinutes ? durationMinutes + 'min' : 'no duration'})`);
+ return entry;
+}
+
+export async function deleteProgressEntry(goalId, entryId) {
+ const goals = await loadJSON(GOALS_FILE, DEFAULT_GOALS);
+ const goal = goals.goals.find(g => g.id === goalId);
+ if (!goal) return null;
+
+ const idx = (goal.progressLog || []).findIndex(e => e.id === entryId);
+ if (idx === -1) return null;
+
+ goal.progressLog.splice(idx, 1);
+ goal.updatedAt = new Date().toISOString();
+ goals.updatedAt = new Date().toISOString();
+ await saveJSON(GOALS_FILE, goals);
+ return { deleted: true };
+}
+
export async function completeMilestone(goalId, milestoneId) {
const goals = await loadJSON(GOALS_FILE, DEFAULT_GOALS);
const goal = goals.goals.find(g => g.id === goalId);