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(cos): add plan-task scheduled type and stop caching index.html

[._.]/ Adam Eivy68ab36fb5830
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index dfe8ae6b63..79ef96b3bd 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,24 @@
## Added
+- **`plan-task` scheduled task — strict PLAN.md executor.** New task type in
+ `server/services/taskSchedule.js` that picks the next unchecked PLAN.md
+ item, implements it (worktree + `/simplify` + PR by default), and **moves**
+ the item from PLAN.md to DONE.md in the same commit (mirrored entry under
+ today's `## YYYY-MM-DD` section). Unlike `feature-ideas`, it has no
+ `runAfter` dependencies and no brainstorm fallback — when PLAN.md is empty
+ or every unchecked item is annotated `<!-- NEEDS_INPUT -->`, the task exits
+ cleanly. Phase 3b mirrors `feature-ideas`: an infeasible item emits a
+ `.plan-questions.md` marker, which `agentLifecycle.js` now converts into a
+ `plan_question` notification for both task types. Default schedule: daily,
+ disabled, `useWorktree+openPR+simplify`. Surfaces in the workflow visualizer
+ alongside `feature-ideas` under the `build` stage; gets a `✅` icon in the
+ Upcoming Tasks widget. `TaskItem.jsx#extractTaskType` learned the new
+ description shape and matches it ahead of `do-replan` so the substring
+ `plan.md` doesn't steal the icon. Touches `taskSchedule.js`, `cos.js`,
+ `workflow.js`, `agentLifecycle.js`, `UpcomingTasksWidget.jsx`,
+ `TaskItem.jsx`.
+
- **Comic pages + cover: proof vs final renders, with i2i upscale from
proof.** Each comic page (and the cover) now carries two render slots —
`proofImage` (fast layout render) and `finalImage` (hi-res print render).
@@ -1061,6 +1079,17 @@
## Fixed
+- **`index.html` now revalidates on every navigation, so rebuilds are picked
+ up without a hard refresh.** The SPA fallback in `server/index.js` was
+ serving `index.html` with no `Cache-Control` header, so browsers fell back
+ to default heuristics and happily cached the file — which embeds the
+ current build's hashed asset filenames. After a rebuild + restart, the
+ stale HTML pointed at chunks that no longer existed on disk
+ (`index-CwBEDqDF.css: 404` class of error). The fallback now sets
+ `Cache-Control: no-cache` on the HTML response, forcing an etag
+ revalidation on every request; hashed assets continue to cache normally
+ because their filenames change on every build.
+
- **Scheduled tasks no longer block forever on disabled dependencies.** `checkRunAfterDeps`
in `server/services/taskSchedule.js` previously required every `runAfter`
dependency to have run since the dependent task's last execution — but if a
diff --git a/client/src/components/UpcomingTasksWidget.jsx b/client/src/components/UpcomingTasksWidget.jsx
index 7524121d00..e3cfde70f7 100644
--- a/client/src/components/UpcomingTasksWidget.jsx
+++ b/client/src/components/UpcomingTasksWidget.jsx
@@ -56,6 +56,7 @@ const UpcomingTasksWidget = memo(function UpcomingTasksWidget() {
'test-coverage': '🧪',
'documentation': '📝',
'feature-ideas': '💡',
+ 'plan-task': '✅',
'accessibility': '♿',
'dependency-updates': '📦',
'do-replan': '📋'
diff --git a/client/src/components/cos/tabs/TaskItem.jsx b/client/src/components/cos/tabs/TaskItem.jsx
index c75ef3963e..b3313f6fb1 100644
--- a/client/src/components/cos/tabs/TaskItem.jsx
+++ b/client/src/components/cos/tabs/TaskItem.jsx
@@ -51,6 +51,9 @@ function extractTaskType(description) {
if (d.includes('dependency')) return 'task:dependency-updates';
if (d.includes('jira') && d.includes('report')) return 'task:jira-status-report';
if (d.includes('jira') || d.includes('sprint')) return 'task:jira-sprint-manager';
+ // plan-task matches before do-replan because its description ("Execute next
+ // PLAN.md item and archive it to DONE.md") also contains "plan.md".
+ if (d.includes('plan-task') || (d.includes('execute next') && d.includes('plan.md'))) return 'task:plan-task';
if (d.includes('replan') || d.includes('audit plan.md') || d.includes('plan.md')) return 'task:do-replan';
}
diff --git a/server/index.js b/server/index.js
index ed3e1416fc..df2dbf6b29 100644
--- a/server/index.js
+++ b/server/index.js
@@ -494,6 +494,13 @@ if (existsSync(CLIENT_DIST)) {
if (req.path.match(/\.\w+$/) && !req.path.endsWith('.html')) {
return next();
}
+ // index.html embeds the current build's hashed asset filenames. After a
+ // rebuild + restart, a browser still holding a cached copy would point at
+ // chunks that no longer exist on disk (the `index-CwBEDqDF.css` class of
+ // 404). `no-cache` lets the browser keep the file but forces an etag
+ // revalidation on every navigation, so a fresh build is picked up on the
+ // very next request without a hard refresh.
+ res.set('Cache-Control', 'no-cache');
const stampedIndexHtml = getStampedIndexHtml();
if (stampedIndexHtml) {
res.type('html').send(stampedIndexHtml);
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.js
index 489b6377d2..9ae0eb5f1c 100644
--- a/server/services/agentLifecycle.js
+++ b/server/services/agentLifecycle.js
@@ -1086,8 +1086,9 @@ export 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') {
+ // Check for plan questions marker file (feature-ideas / plan-task needing user input)
+ const planAnalysisType = task?.metadata?.analysisType;
+ if (planAnalysisType === 'feature-ideas' || planAnalysisType === 'plan-task') {
const planWorkspace = agentState?.metadata?.workspacePath || task?.metadata?.repoPath || ROOT_DIR;
const markerPath = join(planWorkspace, '.plan-questions.md');
@@ -1104,7 +1105,7 @@ export async function handleAgentCompletion(agentId, exitCode, success, duration
message: markerContent,
priority: PRIORITY_LEVELS.MEDIUM,
link: appId ? `/apps/${appId}/documents` : undefined,
- metadata: { appId, agentId, taskType: 'feature-ideas' }
+ metadata: { appId, agentId, taskType: planAnalysisType }
}).catch(err => {
emitLog('warn', `Failed to create plan_question notification: ${err.message}`, { agentId });
});
diff --git a/server/services/cos.js b/server/services/cos.js
index a2e95d1d7c..d7b6685548 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -1086,6 +1086,7 @@ function getTaskDescription(taskType, appName) {
'ui-bugs': `Review UI for visual bugs in ${appName}`,
'mobile-responsive': `Check mobile responsiveness of ${appName}`,
'feature-ideas': `Implement a feature idea for ${appName} aligned with GOALS.md and PLAN.md (worktree+PR)`,
+ 'plan-task': `Execute next PLAN.md item for ${appName} and archive it to DONE.md (worktree+PR)`,
'release-check': `Verify release readiness for ${appName}`,
'jira-sprint-manager': `Triage and implement JIRA sprint tickets for ${appName} (worktree+PR)`,
'jira-status-report': `Generate JIRA weekly status report for ${appName}`,
@@ -1103,6 +1104,7 @@ function getTaskDescription(taskType, appName) {
'test-coverage': 'Add missing tests for uncovered code paths',
'documentation': 'Update documentation, comments, and README files',
'feature-ideas': 'Implement a feature idea aligned with GOALS.md and PLAN.md (worktree+PR)',
+ 'plan-task': 'Execute next PLAN.md item and archive it to DONE.md (worktree+PR)',
'accessibility': 'Audit and fix accessibility issues (ARIA, keyboard nav, contrast)',
'dependency-updates': 'Check for and safely update outdated dependencies',
'error-handling': 'Improve error handling patterns and recovery logic',
@@ -1133,6 +1135,7 @@ const IMPROVEMENT_TYPES = [
'documentation',
// Goal 4: User Engagement
'feature-ideas',
+ 'plan-task',
// Goal 5: System Health
'accessibility',
'dependency-updates',
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index fcd0430309..922ded7a2b 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -395,6 +395,62 @@ When PLAN.md is missing, empty, or fully completed, brainstorm and implement a n
\`\`\`
8. Commit with a clear description of the feature and rationale`,
+ 'plan-task': `[Plan Task: {appName}] Execute Next PLAN.md Item
+
+Your goal is to implement the next unchecked item from PLAN.md and archive it to DONE.md in the same commit. No brainstorming, no scope expansion — just execute what is already planned.
+
+Repository: {repoPath}
+
+## Phase 1 — Find the Next Task
+
+1. Read PLAN.md from {repoPath}
+2. Read DONE.md from {repoPath} (if it exists) so you understand the archive format
+3. Find the first unchecked item (\`- [ ]\`) that does NOT have a \`<!-- NEEDS_INPUT -->\` annotation
+4. If PLAN.md is missing, has no unchecked items, or every unchecked item is annotated \`<!-- NEEDS_INPUT -->\`, **stop here** — exit cleanly without commits or PR. This task is a strict executor of planned work; brainstorming is handled by the \`feature-ideas\` task.
+
+Capture the exact text of the item you selected (without the leading \`- [ ]\`) — you will need it verbatim for the DONE.md entry.
+
+## Phase 2 — Evaluate Feasibility
+
+5. Read relevant source files to understand the scope of the item
+6. Decide: can this be implemented without user clarification? (requirements clear, no ambiguous design choices, no blocking external decisions)
+
+## Phase 3a — Implement (if feasible)
+
+7. Implement the change:
+ - Write clean, tested code following existing patterns
+ - Run tests to ensure nothing is broken
+8. Run \`/simplify\` to review changed code for reuse, quality, and efficiency. Fix any issues found in the same diff.
+9. **Move the item from PLAN.md to DONE.md (do NOT leave a checked \`- [x]\` behind in PLAN.md):**
+ - Remove the item's line(s) from PLAN.md entirely. If the item was a nested bullet under a heading and removing it leaves the surrounding section empty, leave the heading alone — separate plan curation is the \`do-replan\` task's job.
+ - Append a corresponding entry to DONE.md under today's date heading (\`## YYYY-MM-DD\`). Insert today's date heading directly below the top-of-file preamble if no section for today exists; otherwise append under the existing section.
+ - DONE.md entry format: \`- **<short title pulled from the PLAN.md item>** — <1–3 sentences describing what was actually implemented, key files touched, and any caveats>\`. Mirror the prose style of recent DONE.md entries.
+10. Commit the code change, the PLAN.md removal, and the DONE.md append **together in a single commit**. Commit message should reference the PLAN.md item title.
+
+## Phase 3b — Request Clarification (if not feasible)
+
+7. Create a file named \`.plan-questions.md\` in {repoPath} 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>
+ \`\`\`
+8. Annotate the PLAN.md item by appending \` <!-- NEEDS_INPUT -->\` to its line (do NOT remove it from PLAN.md)
+9. Commit both changes with message \`chore: flag PLAN.md item needing user input\`
+10. Do NOT open a PR — stop here
+
+## Constraints
+
+- This task has **no \`runAfter\` dependencies** — it runs independently of \`do-replan\`, \`pr-reviewer\`, etc.
+- Do NOT brainstorm new features. Do NOT propose items not already in PLAN.md.
+- Do NOT touch unrelated PLAN.md items, even to tidy them.
+- One commit. One PR (or no PR if clarification was needed).`,
+
'code-reviewer-review': `[Review: {appName}] Deep Codebase Review (Stage 1)
Perform a comprehensive review of {appName} and write your findings to REVIEW.md.
@@ -1025,6 +1081,7 @@ For each reference above:
// Only non-customized prompts (promptCustomized !== true) are upgraded.
const PROMPT_VERSIONS = {
'feature-ideas': 6, // v6: remove hardcoded worktree language (worktree context injected by agentPromptBuilder)
+ 'plan-task': 1, // v1: strict PLAN.md executor — move item to DONE.md in same commit, no brainstorm fallback, no runAfter deps
'pr-reviewer': 3, // v3: multi-stage pipeline (security scan → code review + merge)
'code-reviewer-a': 1, // v1: 2-stage pipeline (codebase review → triage & implement)
'code-reviewer-b': 1, // v1: 2-stage pipeline (codebase review → triage & implement)
@@ -1400,7 +1457,7 @@ Before reviewing code quality, scan each PR for malicious content:
export const SELF_IMPROVEMENT_TASK_TYPES = [
'security', 'code-quality', 'test-coverage', 'performance',
'accessibility', 'branch-cleanup', 'console-errors', 'dependency-updates', 'documentation',
- 'ui-bugs', 'mobile-responsive', 'feature-ideas', 'error-handling',
+ 'ui-bugs', 'mobile-responsive', 'feature-ideas', 'plan-task', 'error-handling',
'typing', 'release-check', 'pr-reviewer', 'code-reviewer-a', 'code-reviewer-b',
'jira-sprint-manager', 'jira-status-report', 'do-replan',
// Watches `referenceRepos` configured on the app — fetches each upstream
@@ -1427,6 +1484,10 @@ const DEFAULT_TASK_INTERVALS = {
// feature-ideas waits for do-replan so new work is grounded in a fresh PLAN.md
// that already accounts for any in-flight or unmerged work.
'feature-ideas': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, runAfter: ['do-replan'], taskMetadata: { useWorktree: true, openPR: true, simplify: true } },
+ // plan-task is a strict executor of PLAN.md items — no brainstorm fallback, no
+ // runAfter deps. Picks the next unchecked item, implements it, and moves it
+ // from PLAN.md to DONE.md in the same commit.
+ 'plan-task': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: true, openPR: true, simplify: true } },
'error-handling': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null },
'typing': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null },
'release-check': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null },
@@ -2363,6 +2424,7 @@ function getTaskTypeDescription(taskType) {
'test-coverage': 'Improve test coverage',
'documentation': 'Update documentation',
'feature-ideas': 'Implement next planned feature or brainstorm new one',
+ 'plan-task': 'Execute next PLAN.md item and archive it to DONE.md (worktree+PR)',
'accessibility': 'Accessibility audit',
'branch-cleanup': 'Clean up merged branches',
'dependency-updates': 'Update dependencies',
diff --git a/server/services/workflow.js b/server/services/workflow.js
index 49815f07ec..c1b1d8f26c 100644
--- a/server/services/workflow.js
+++ b/server/services/workflow.js
@@ -76,7 +76,7 @@ export const WORKFLOW_STAGES = [
id: 'build',
label: 'Build',
description: 'Implement the next planned feature. Gated on do-replan so new work is grounded in a fresh plan.',
- taskTypes: ['feature-ideas'],
+ taskTypes: ['feature-ideas', 'plan-task'],
jobIds: []
},
{