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
feat: PLAN.md-driven feature-ideas task with plan_question notifications
Adam Eivycf412aea92cc
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdnew file mode 100644index 0000000000..3704727500--- /dev/null+++ b/.changelog/NEXT.md@@ -0,0 +1,7 @@+## Added++- **M49 P1: Goal Todos & Progress Tracking** — Enhanced goal model with explicit progress percentage, todo sub-tasks (with priority and time estimates), velocity tracking (percent/month with trend), projected completion dates, and time tracking aggregates. Progress bar and todos visible in both goal list rows and detail panel.++## Changed++- **CoS feature-ideas task** — Agents now implement the next unchecked PLAN.md item instead of inventing features. When user clarification is needed, agents create a `.plan-questions.md` marker and a `plan_question` notification linking to the Documents tab. Added `{appId}` template variable for prompt linking.diff --git a/client/src/components/NotificationDropdown.jsx b/client/src/components/NotificationDropdown.jsxindex b28bb898fe..df816fa45e 100644--- a/client/src/components/NotificationDropdown.jsx+++ b/client/src/components/NotificationDropdown.jsx@@ -1,6 +1,6 @@import { useState, useRef, useEffect } from 'react';import { useNavigate } from 'react-router-dom';-import { Bell, X, CheckCheck, Trash2, Brain, ListTodo, AlertTriangle, Code } from 'lucide-react';+import { Bell, X, CheckCheck, Trash2, Brain, ListTodo, AlertTriangle, Code, HelpCircle } from 'lucide-react';const NOTIFICATION_TYPE_CONFIG = {memory_approval: {@@ -22,6 +22,11 @@ const NOTIFICATION_TYPE_CONFIG = {icon: AlertTriangle,color: 'text-red-400',bgColor: 'bg-red-500/20'+ },+ plan_question: {+ icon: HelpCircle,+ color: 'text-emerald-400',+ bgColor: 'bg-emerald-500/20'}};diff --git a/server/services/cos.js b/server/services/cos.jsindex 386dfd9034..f6a298290a 100644--- a/server/services/cos.js+++ b/server/services/cos.js@@ -1906,7 +1906,8 @@ async function generateManagedAppImprovementTask(app, state) {// Replace template variables in the promptconst description = promptTemplate.replace(/\{appName\}/g, app.name)- .replace(/\{repoPath\}/g, app.repoPath);+ .replace(/\{repoPath\}/g, app.repoPath)+ .replace(/\{appId\}/g, app.id);// Get interval settings to determine provider/modelconst interval = await taskSchedule.getTaskInterval(nextType);@@ -1983,7 +1984,8 @@ async function generateManagedAppImprovementTaskForType(taskType, app, state) {// Replace template variables in the promptconst description = promptTemplate.replace(/\{appName\}/g, app.name)- .replace(/\{repoPath\}/g, app.repoPath);+ .replace(/\{repoPath\}/g, app.repoPath)+ .replace(/\{appId\}/g, app.id);// Get interval settings to determine provider/modelconst interval = await taskSchedule.getTaskInterval(taskType);diff --git a/server/services/notifications.js b/server/services/notifications.jsindex 7d62089d24..5a1275abb4 100644--- a/server/services/notifications.js+++ b/server/services/notifications.js@@ -33,7 +33,8 @@ export const NOTIFICATION_TYPES = {CODE_REVIEW: 'code_review',HEALTH_ISSUE: 'health_issue',BRIEFING_READY: 'briefing_ready',- AUTOBIOGRAPHY_PROMPT: 'autobiography_prompt'+ AUTOBIOGRAPHY_PROMPT: 'autobiography_prompt',+ PLAN_QUESTION: 'plan_question'};// Priority levelsdiff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.jsindex dcc5593f54..dbea0245ca 100644--- a/server/services/subAgentSpawner.js+++ b/server/services/subAgentSpawner.js@@ -1828,6 +1828,10 @@ async function handleAgentCompletion(agentId, exitCode, success, duration) {// Process memory extraction and app cooldownawait processAgentCompletion(agentId, task, success, outputBuffer);+ // Fetch agent state once for JIRA and plan-question blocks+ const { getAgent: getAgentState } = await import('./cos.js');+ const agentState = await getAgentState(agentId).catch(() => null);+// JIRA integration: push branch, create PR, comment on ticketconst jiraTicketId = agent.task?.metadata?.jiraTicketId;const jiraBranch = agent.task?.metadata?.jiraBranch;@@ -1835,9 +1839,6 @@ async function handleAgentCompletion(agentId, exitCode, success, duration) {const jiraCreatePR = agent.task?.metadata?.jiraCreatePR;if (jiraTicketId && jiraBranch && success) {- // Get workspace from registered agent state (runnerAgents doesn't store it)- const { getAgent: getAgentState } = await import('./cos.js');- const agentState = await getAgentState(agentId).catch(() => null);const workspace = agentState?.metadata?.workspacePath || ROOT_DIR;// Resolve JIRA ticket URL for linking in PR description@@ -1897,6 +1898,34 @@ async function handleAgentCompletion(agentId, exitCode, success, duration) {});}+ // Check for plan questions marker file (feature-ideas task needing user input)+ if (task?.metadata?.analysisType === 'feature-ideas') {+ const planWorkspace = agentState?.metadata?.workspacePath || task?.metadata?.repoPath || ROOT_DIR;+ const markerPath = join(planWorkspace, '.plan-questions.md');++ const markerContent = await readFile(markerPath, 'utf8').catch(() => null);+ if (markerContent) {+ const titleMatch = markerContent.match(/^#\s+Plan Question:\s*(.+)/m);+ const title = titleMatch?.[1]?.trim() || 'PLAN.md item needs your input';+ const appId = task.metadata?.app;++ const { addNotification, NOTIFICATION_TYPES, PRIORITY_LEVELS } = await import('./notifications.js');+ await addNotification({+ type: NOTIFICATION_TYPES.PLAN_QUESTION,+ title,+ message: markerContent,+ priority: PRIORITY_LEVELS.MEDIUM,+ link: appId ? `/apps/${appId}/documents` : undefined,+ metadata: { appId, agentId, taskType: 'feature-ideas' }+ }).catch(err => {+ emitLog('warn', `Failed to create plan_question notification: ${err.message}`, { agentId });+ });++ await rm(markerPath).catch(() => {});+ emitLog('info', `📋 Plan question notification created: ${title}`, { agentId, appId });+ }+ }+// Clean up worktree if agent was using one (skip merge when JIRA branch — PR handles merge)if (!jiraBranch) {await cleanupAgentWorktree(agentId, success);diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.jsindex e0d70d51c0..f72f382319 100644--- a/server/services/taskSchedule.js+++ b/server/services/taskSchedule.js@@ -324,42 +324,49 @@ Use Playwright MCP to test the app at different viewport sizes:4. Fix CSS responsive classes as needed5. Test fixes and commit changes`,- 'feature-ideas': `[Improvement: {appName}] Implement a Feature Idea+ 'feature-ideas': `[Improvement: {appName}] Implement Next Planned Feature-You are working in a git worktree on a feature branch. Your goal is to implement ONE feature and open a PR.+You are working in a git worktree on a feature branch. Your goal is to implement the next planned item from PLAN.md.Repository: {repoPath}-## Research Phase+## Phase 1 — Find the Next Task-1. Read GOALS.md from {repoPath} for context on the app's goals and priorities.- If no GOALS.md exists, focus on general improvements.-2. Read PLAN.md from {repoPath} for the current roadmap and planned work.-3. Search for existing feature idea documents:- - Check .planning/ directory for feature specs, research docs, or FEATURES.md- - Check for any TODO.md, IDEAS.md, or similar feature tracking files-4. Review recent completed tasks and user feedback to understand patterns-5. Review recent git log to see what's been implemented recently+1. Read PLAN.md from {repoPath}+2. Find the first unchecked item (\`- [ ]\`) that does NOT have a \`<!-- NEEDS_INPUT -->\` annotation+3. If no unchecked items exist, stop and report: "PLAN.md has no remaining items."-## Selection Phase+## Phase 2 — Evaluate Feasibility-6. Choose ONE feature to implement that:- - Aligns with GOALS.md priorities- - Is NOT already planned in PLAN.md (avoid duplicating roadmap work)- - Is NOT already documented in existing feature idea files- - Is a small, self-contained improvement (completable in one session)- - Saves user time, improves the developer experience, or makes the app more useful+4. Read relevant source files to understand the scope of the item+5. Determine: can this be implemented without user clarification?+ - Consider: are requirements clear? Are there ambiguous design choices? Does it depend on external decisions?-## Implementation Phase+## Phase 3a — Implement (if feasible)-7. Implement the feature:- - Write clean, tested code- - Follow existing patterns in the codebase+6. Implement the feature:+ - Write clean, tested code following existing patterns- Run tests to ensure nothing is broken+7. Run \`/simplify\` to review changed code for reuse, quality, and efficiency. Fix any issues found.+8. Check the PLAN.md item: change \`- [ ]\` to \`- [x]\`+9. Commit with a clear description referencing the PLAN.md item-8. Run \`/simplify\` to review changed code for reuse, quality, and efficiency. Fix any issues found.+## Phase 3b — Request Clarification (if not feasible)-9. Commit with a clear description of the feature and rationale`,+6. Create a file named \`.plan-questions.md\` in the repository root with this format:+ \`\`\`+ # Plan Question: <short title summarizing the PLAN.md item>++ ## PLAN.md Item+ <the exact text of the unchecked item>++ ## Questions+ - <question 1>+ - <question 2>+ \`\`\`+7. Annotate the PLAN.md item by appending \` <!-- NEEDS_INPUT -->\` to its line+8. Commit both changes with message "chore: flag PLAN.md item needing user input"+9. Do NOT open a PR — stop here`,'error-handling': `[Improvement: {appName}] Improve Error Handling@@ -554,7 +561,7 @@ Repository: {repoPath}// Prompt versions — bump when a default prompt changes so existing instances auto-upgrade.// Only non-customized prompts (promptCustomized !== true) are upgraded.const PROMPT_VERSIONS = {- 'feature-ideas': 2 // v2: implement feature in worktree+PR with /simplify, check GOALS/PLAN/FEATURES+ 'feature-ideas': 3 // v3: implement next PLAN.md item, flag items needing user input};// Known previous default prompts for legacy migration.@@ -589,7 +596,44 @@ Repository: {repoPath}6. Commit with a clear description of the change and rationale-Think critically about what we have before adding more.`+Think critically about what we have before adding more.`,+ // v2 default prompt+ `[Improvement: {appName}] Implement a Feature Idea++You are working in a git worktree on a feature branch. Your goal is to implement ONE feature and open a PR.++Repository: {repoPath}++## Research Phase++1. Read GOALS.md from {repoPath} for context on the app's goals and priorities.+ If no GOALS.md exists, focus on general improvements.+2. Read PLAN.md from {repoPath} for the current roadmap and planned work.+3. Search for existing feature idea documents:+ - Check .planning/ directory for feature specs, research docs, or FEATURES.md+ - Check for any TODO.md, IDEAS.md, or similar feature tracking files+4. Review recent completed tasks and user feedback to understand patterns+5. Review recent git log to see what's been implemented recently++## Selection Phase++6. Choose ONE feature to implement that:+ - Aligns with GOALS.md priorities+ - Is NOT already planned in PLAN.md (avoid duplicating roadmap work)+ - Is NOT already documented in existing feature idea files+ - Is a small, self-contained improvement (completable in one session)+ - Saves user time, improves the developer experience, or makes the app more useful++## Implementation Phase++7. Implement the feature:+ - Write clean, tested code+ - Follow existing patterns in the codebase+ - Run tests to ensure nothing is broken++8. Run \`/simplify\` to review changed code for reuse, quality, and efficiency. Fix any issues found.++9. Commit with a clear description of the feature and rationale`]};@@ -1392,7 +1436,7 @@ function getTaskTypeDescription(taskType) {'performance': 'Performance optimization','test-coverage': 'Improve test coverage','documentation': 'Update documentation',- 'feature-ideas': 'Brainstorm and implement features',+ 'feature-ideas': 'Implement next planned feature','accessibility': 'Accessibility audit','dependency-updates': 'Update dependencies','release-check': 'Check dev for release readiness',