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
register the pre-unification prompt bodies so frozen installs can upgrade
[._.]/ Adam Eivy3dc8d6dd0c93
diff --git a/server/services/autonomousJobs/portosCatalogRefresh.js b/server/services/autonomousJobs/portosCatalogRefresh.jsindex 6255e616c7..a1fd2f1286 100644--- a/server/services/autonomousJobs/portosCatalogRefresh.js+++ b/server/services/autonomousJobs/portosCatalogRefresh.js@@ -7,7 +7,7 @@*/import { PORTOS_APP_ID } from '../../lib/appIdentity.js'-import { DEFAULT_TASK_PROMPTS, PREVIOUS_DEFAULT_PROMPTS } from '../taskPromptDefaults.js'+import { DEFAULT_TASK_PROMPTS, promptMatchesShippedDefault } from '../taskPromptDefaults.js'import { isValidCron } from '../eventScheduler.js'import { DAY, WEEK } from './constants.js'@@ -93,8 +93,7 @@ export function buildMigratedCatalogRefreshJob({ task = {}, appOverride = {}, exconst globalMetadata = isObject(task.taskMetadata) ? task.taskMetadata : {}const appMetadata = isObject(appOverride.taskMetadata) ? appOverride.taskMetadata : {}const storedPrompt = task.prompt || DEFAULT_TASK_PROMPTS[PORTOS_CATALOG_REFRESH_TASK_TYPE]- const promptWasShipped = storedPrompt === DEFAULT_TASK_PROMPTS[PORTOS_CATALOG_REFRESH_TASK_TYPE]- || (PREVIOUS_DEFAULT_PROMPTS[PORTOS_CATALOG_REFRESH_TASK_TYPE] || []).includes(storedPrompt)+ const promptWasShipped = promptMatchesShippedDefault(storedPrompt, PORTOS_CATALOG_REFRESH_TASK_TYPE)const prompt = promptWasShipped ? DEFAULT_TASK_PROMPTS[PORTOS_CATALOG_REFRESH_TASK_TYPE] : storedPromptreturn {diff --git a/server/services/taskPromptDefaults.js b/server/services/taskPromptDefaults.jsindex 7c60ea5ab9..68c291234e 100644--- a/server/services/taskPromptDefaults.js+++ b/server/services/taskPromptDefaults.js@@ -25,4 +25,4 @@export { DEFAULT_TASK_PROMPTS } from './taskPromptDefaults/prompts.js';export { PROMPT_VERSIONS, REFERENCE_WATCH_AUDITED_VERSION } from './taskPromptDefaults/versions.js';export { PREVIOUS_DEFAULT_PROMPTS } from './taskPromptDefaults/previousDefaults.js';-export { promptMatchesShippedDefault, normalizeLegacyPromptHeader } from './taskPromptDefaults/shippedPrompts.js';+export { promptMatchesShippedDefault } from './taskPromptDefaults/shippedPrompts.js';diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.jsindex 2296876c76..b90e460568 100644--- a/server/services/taskPromptDefaults.test.js+++ b/server/services/taskPromptDefaults.test.js@@ -9,6 +9,7 @@ import {PREVIOUS_DEFAULT_PROMPTS,} from './taskPromptDefaults.js';import { hashPromptBody, buildPromptIntegritySnapshot } from './taskPromptDefaults/integrityHash.js';+import { DEFAULT_TASK_INTERVALS } from './taskScheduleRegistry.js';import { EPIC_DECOMPOSED_LABEL } from './perpetualWork.js';// The claim prompts build their contributor-label release from this helper, so the// test asserts against the same source rather than re-typing the command text.@@ -141,6 +142,10 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(current).toContain('REJECTED.md');expect(current).toContain('is:unmerged');expect(current).toContain('`PRD.md`');+ expect(current).toContain('`GOALS.md`');+ // Precedence, not just presence: the PRD instruction must come first.+ expect(current.indexOf('`PRD.md`')).toBeLessThan(current.indexOf('`GOALS.md`'));+ expect(current).toContain('follow the PRD\'s concrete requirements');expect(PROMPT_VERSIONS['feature-ideas']).toBe(11);const previous = PREVIOUS_DEFAULT_PROMPTS['feature-ideas'];@@ -284,6 +289,20 @@ describe('taskPromptDefaults integrity snapshot', () => {}});+ // The other direction, and the one that actually bites: taskScheduleStore's+ // auto-upgrade block is gated on `PROMPT_VERSIONS[taskType] && …`, so a+ // SCHEDULE prompt with no entry is silently exempt from upgrade forever — a+ // body change ships and no install ever receives it. console-errors,+ // error-handling and typing were frozen exactly that way. Pipeline stage+ // bodies are excluded because they are never persisted (see the+ // "unversioned pipeline stage body" cases below).+ it('every scheduled default prompt is versioned, so none is silently exempt from auto-upgrade', () => {+ for (const key of Object.keys(DEFAULT_TASK_PROMPTS)) {+ if (!DEFAULT_TASK_INTERVALS[key]) continue;+ expect(PROMPT_VERSIONS[key], `PROMPT_VERSIONS['${key}']`).toBeTypeOf('number');+ }+ });+// Claim worktrees are created under PortOS's shared worktrees dir// ({worktreesRoot} → data/cos/worktrees, resolved in taskPromptService) rather// than inside the managed app repo, so an agent's checkout no longer pollutesdiff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex 8ab11b5f17..efef421386 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -67,6 +67,8 @@"console-errors": 2,"error-handling": 2,"typing": 2,+ "jira-sprint-manager": 1,+ "jira-status-report": 1,"dependency-updates": 4,"documentation": 6,"ui-bugs": 2,@@ -190,23 +192,30 @@"b199739b21a8c45ed3778b2339ebf55f"],"code-quality": [+ "62752723eba7a39aa94e010911923cc8","b1cce8f89218844746746ceb576553c1"],"test-coverage": [+ "ec70fb2b8e193b6a98bec2fbf337b190","c2b0f0dee5bc881239684e706ea88324"],"performance": [+ "c8224243c15f6897ee04be25d172f021","4fea5eb3585bdc150980934b289016bc"],"accessibility": [+ "6c927b9b70950e9a38fc5944d15cad3b",+ "ce7377d0ac57cbf0526074cfb95e3803","b07cfe1e367411036ef1d4cc4b6e9d2e"],"dependency-updates": [+ "020d66b93698341c556eca1eee851bee","640a7c4214e6bdba2bbd5b9061d9d425","3f461b1c111ba45b7fa5016883cfa54d","7ed05444e2602f4895bdd1e5e0edcaa8"],"documentation": [+ "b6540f4ba13832226fd0c85cf1955f99","074ea22140f8f6a02c7e40a6bc7b0614","658395fa391df5a0fefaaebdf8dbedb7","751186658f5d9a9dbccdd6830946f3d8",@@ -214,9 +223,11 @@"b375f95ae2274f03d06ba5ceff5705d8"],"ui-bugs": [+ "ac85ee1bd35c1475f78b75b198dd6c97","01d2a7e034713195f33071f2c71a3c99"],"mobile-responsive": [+ "699b2fe64ee663d5d9e2e70919592dd4","636bdc17fa39ed2f2e27623284c8e04c"],"release-check": [@@ -254,6 +265,16 @@],"stash-cleanup": ["f9de8b10937919ceb6656fbdb70179c4"+ ],+ "console-errors": [+ "ed7a4fe732c5227d3951df4ed63d1b0c",+ "3e3f690729ead5e312927ae4bce330c0"+ ],+ "error-handling": [+ "26225ac04f2f35feb61151b2e6474465"+ ],+ "typing": [+ "d8fd1423cf2a523b528ed7d2d7a2bb55"]}}diff --git a/server/services/taskPromptDefaults/integrityHash.js b/server/services/taskPromptDefaults/integrityHash.jsindex ba93d888b5..d319f5d528 100644--- a/server/services/taskPromptDefaults/integrityHash.js+++ b/server/services/taskPromptDefaults/integrityHash.js@@ -30,16 +30,25 @@ const API_URL_PLACEHOLDER = '{{PORTOS_API_URL}}';// integrity test failed while nothing had actually drifted (issue #3359).const LEGACY_API_ORIGIN = 'http://localhost:5555';-// Longest first: the two origins can overlap — `PORTOS_API_URL=http://localhost`-// (port 80) is a prefix of the legacy literal, and replacing it first would turn+// The pre-unification self-improvement defaults drove the UI with Playwright and+// so hardcode the *UI* origin instead. Same reasoning as (2) above: frozen bytes,+// pinned rather than derived, and given their own placeholder so a body carrying+// the UI origin never hashes the same as one carrying the API origin.+const LEGACY_UI_ORIGIN = 'http://localhost:5554';+const UI_URL_PLACEHOLDER = '{{PORTOS_UI_URL}}';++// Longest first: the origins can overlap — `PORTOS_API_URL=http://localhost`+// (port 80) is a prefix of the legacy literals, and replacing it first would turn// `http://localhost:5555` into `{{PORTOS_API_URL}}:5555`, which the legacy pass// can then no longer match. Replacing the longer candidate first leaves only-// standalone occurrences of the shorter one.+// standalone occurrences of the shorter one. The sort is stable, so on a length+// tie (an install whose API origin IS one of the legacy literals) the configured+// apiUrl still wins and current defaults keep hashing as {{PORTOS_API_URL}}.export const normalizePromptForHash = (body, apiUrl = PORTOS_API_URL) => (- [apiUrl, LEGACY_API_ORIGIN]- .filter(Boolean)- .sort((a, b) => b.length - a.length)- .reduce((out, origin) => out.split(origin).join(API_URL_PLACEHOLDER), String(body))+ [[apiUrl, API_URL_PLACEHOLDER], [LEGACY_API_ORIGIN, API_URL_PLACEHOLDER], [LEGACY_UI_ORIGIN, UI_URL_PLACEHOLDER]]+ .filter(([origin]) => origin)+ .sort((a, b) => b[0].length - a[0].length)+ .reduce((out, [origin, placeholder]) => out.split(origin).join(placeholder), String(body)));export const hashPromptBody = (body, apiUrl = PORTOS_API_URL) => createHash('md5')diff --git a/server/services/taskPromptDefaults/previousDefaults.js b/server/services/taskPromptDefaults/previousDefaults.jsindex e9909d6602..64fdc15f9c 100644--- a/server/services/taskPromptDefaults/previousDefaults.js+++ b/server/services/taskPromptDefaults/previousDefaults.js@@ -9273,6 +9273,22 @@ Repository: {repoPath}Fix any vulnerabilities found and commit with security advisory notes.`,],'code-quality': [+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] Code Quality Review++Analyze {appName} for maintainability improvements:++Repository: {repoPath}++1. Find DRY violations - similar code in multiple places+2. Identify functions >50 lines that should be split+3. Look for missing error handling+4. Find dead code and unused imports+5. Check for console.log that should be removed+6. Look for TODO/FIXME that need addressing+7. Identify magic numbers that should be constants++Focus on the main source directories. Refactor issues found and commit improvements.`,// prior default (pre-genericization / intermediate)`[Self-Improvement] Code Quality Review@@ -9293,6 +9309,28 @@ Focus on:Refactor issues found and commit improvements.`,],'test-coverage': [+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] Improve Test Coverage++Analyze and improve test coverage for {appName}:++Repository: {repoPath}++1. Check existing tests and identify untested critical paths+2. Look for:+ - API routes without tests+ - Services with complex logic+ - Error handling paths+ - Edge cases++3. Add tests following existing patterns in the project+4. Ensure tests:+ - Use appropriate mocks+ - Test edge cases+ - Follow naming conventions++5. Run tests to verify all pass+6. Commit test additions with clear message describing coverage`,// prior default (pre-genericization / intermediate)`[Self-Improvement] Improve Test Coverage@@ -9319,6 +9357,33 @@ Analyze and improve test coverage for PortOS:6. Commit test additions with clear message describing what's covered`,],'performance': [+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] Performance Analysis++Analyze {appName} for performance issues:++Repository: {repoPath}++1. Review components/views for:+ - Unnecessary re-renders+ - Missing memoization+ - Large files that should be split++2. Review backend for:+ - N+1 query patterns+ - Missing caching opportunities+ - Inefficient file operations+ - Slow API endpoints++3. Review build/bundle for:+ - Missing code splitting+ - Large dependencies that could be optimized++4. Check for:+ - Memory leaks+ - Unnecessary broadcasts/events++Optimize and commit improvements.`,// prior default (pre-genericization / intermediate)`[Self-Improvement] Performance Analysis@@ -9345,6 +9410,43 @@ Analyze PortOS for performance issues:Optimize and commit improvements.`,],'accessibility': [+ // Outgoing pre-unification default, self-improvement schedule.+ `[Self-Improvement] Accessibility Audit++Use Playwright MCP to audit PortOS accessibility:++1. Navigate to http://localhost:5554/+2. Use browser_snapshot to get accessibility tree+3. Check each main route for:+ - Missing ARIA labels+ - Missing alt text on images+ - Insufficient color contrast+ - Keyboard navigation issues+ - Focus indicators++4. Fix accessibility issues in React components+5. Add appropriate aria-* attributes+6. Test and commit changes`,+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] Accessibility Audit++Audit {appName} for accessibility issues:++Repository: {repoPath}++If the app has a web UI:+1. Navigate to the app's UI+2. Check for:+ - Missing ARIA labels+ - Missing alt text on images+ - Insufficient color contrast+ - Keyboard navigation issues+ - Focus indicators+ - Semantic HTML usage++3. Fix accessibility issues in components+4. Add appropriate aria-* attributes+5. Test and commit changes`,// prior default (pre-genericization / intermediate)`[Self-Improvement] Accessibility Audit@@ -9364,6 +9466,33 @@ Use Playwright MCP to audit PortOS accessibility:6. Test and commit changes`,],'dependency-updates': [+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] Dependency Updates++Check {appName} dependencies for updates and security vulnerabilities:++Repository: {repoPath}++1. Run npm audit (or equivalent package manager)+2. Check for outdated packages+3. Review CRITICAL and HIGH severity vulnerabilities+4. For each vulnerability:+ - Assess actual risk+ - Check if update available+ - Test updates don't break functionality++5. Update dependencies carefully:+ - Patch versions first (safest)+ - Then minor versions+ - Major versions need careful review++6. After updating:+ - Run tests+ - Verify the app starts correctly++7. Commit with clear changelog++IMPORTANT: Only update one major version bump at a time.`,// prior default (pre-genericization / intermediate)`[Self-Improvement] Dependency Updates and Security Audit@@ -9536,6 +9665,33 @@ repo (a globally-configured \`gh\` will silently target an unrelated GitHub repoIMPORTANT: Only update one major version bump at a time.`,],'documentation': [+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] Update Documentation++Review and improve {appName} documentation:++Repository: {repoPath}++1. Check README.md:+ - Installation instructions current?+ - Quick start guide clear?+ - Feature overview complete?++2. Review inline documentation:+ - Add JSDoc to exported functions+ - Document complex algorithms+ - Explain non-obvious code++3. Check for docs/ folder:+ - Are all features documented?+ - Is information current?+ - Add missing guides if needed++4. Update PLAN.md or similar if present:+ - Mark completed milestones+ - Document architectural decisions++Commit documentation improvements.`,// prior default (pre-genericization / intermediate)`[Improvement: {appName}] Update Documentation@@ -9680,6 +9836,19 @@ Repository: {repoPath}Commit documentation improvements.`,],'ui-bugs': [+ // Outgoing pre-unification default, self-improvement schedule.+ `[Self-Improvement] UI Bug Analysis++Use Playwright MCP (browser_navigate, browser_snapshot, browser_console_messages) to analyze PortOS UI:++1. Navigate to http://localhost:5554/+2. Check each main route: /, /apps, /cos, /cos/tasks, /cos/agents, /devtools, /devtools/history, /providers, /usage+3. For each route:+ - Take a browser_snapshot to see the page structure+ - Check browser_console_messages for JavaScript errors+ - Look for broken UI elements, missing data, failed requests+4. Fix any bugs found in the React components or API routes+5. Run tests and commit changes`,// prior default (pre-genericization / intermediate)`[Self-Improvement] UI Bug Analysis@@ -9695,6 +9864,23 @@ Use Playwright MCP (browser_navigate, browser_snapshot, browser_console_messages5. Run tests and commit changes`,],'mobile-responsive': [+ // Outgoing pre-unification default, self-improvement schedule.+ `[Self-Improvement] Mobile Responsiveness Analysis++Use Playwright MCP to test PortOS at different viewport sizes:++1. browser_resize to mobile (375x812), then navigate to http://localhost:5554/+2. Take browser_snapshot and analyze for:+ - Text overflow or truncation+ - Buttons too small to tap (< 44px)+ - Horizontal scrolling issues+ - Elements overlapping+ - Navigation usability+3. Repeat at tablet (768x1024) and desktop (1440x900)+4. Fix Tailwind CSS responsive classes (sm:, md:, lg:) as needed+5. Test fixes and commit changes++Focus on these routes: /cos, /cos/tasks, /devtools, /providers`,// prior default (pre-genericization / intermediate)`[Self-Improvement] Mobile Responsiveness Analysis@@ -11486,6 +11672,96 @@ Run \`git stash list\`. For each \`stash@{N}\`:Summarize: how many stashes were reviewed, how many were dropped (grouped by reason: superseded vs. stale/abandoned), and — for anything classified REAL UNLANDED WORK — what it is, which files it touches, and a recommendation (recover as a branch, cherry-pick specific hunks, or leave it for the user to decide). When in doubt about whether a stash is safe to drop, leave it in the stash and say so in the report rather than dropping it.`,],+ 'console-errors': [+ // Outgoing pre-unification default, self-improvement schedule.+ `[Self-Improvement] Console Error Investigation++Use Playwright MCP to find and fix console errors:++1. Navigate to http://localhost:5554/+2. Call browser_console_messages with level: "error"+3. Visit each route and capture errors:+ - /, /apps, /cos, /cos/tasks, /cos/agents+ - /devtools, /devtools/history, /devtools/runner+ - /providers, /usage, /prompts++4. For each error:+ - Identify the source file and line+ - Understand the root cause+ - Implement a fix++5. Test fixes and commit changes`,+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] Console Error Investigation++Find and fix console errors in {appName}:++Repository: {repoPath}++1. If the app has a UI, check browser console for errors+2. Check server logs for errors+3. For each error:+ - Identify the source file and line+ - Understand the root cause+ - Implement a fix++4. Test fixes and commit changes`,+ ],+ 'error-handling': [+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] Improve Error Handling++Enhance error handling in {appName}:++Repository: {repoPath}++1. Review code for:+ - Missing try-catch blocks where needed+ - Silent failures (empty catch blocks)+ - Errors that should be logged+ - User-facing error messages++2. Add error handling for:+ - Network requests+ - File operations+ - Database queries+ - External API calls++3. Ensure errors are:+ - Logged appropriately+ - Have clear messages+ - Include relevant context+ - Don't expose sensitive data++4. Test error paths and commit improvements`,+ ],+ 'typing': [+ // Outgoing pre-unification default, app-improvement schedule.+ `[App Improvement: {appName}] TypeScript Type Improvements++Improve TypeScript types in {appName}:++Repository: {repoPath}++1. Review TypeScript files for:+ - 'any' types that should be specific+ - Missing type annotations+ - Type assertions that could be avoided+ - Missing interfaces/types for objects++2. Add types for:+ - Function parameters and returns+ - Component props+ - API responses+ - Configuration objects++3. Ensure:+ - Types are properly exported+ - No implicit any+ - Types are reusable++4. Run type checking and commit improvements`,+ ],};// v17 only changed the repo-conventions filename in the final v16 plan-taskdiff --git a/server/services/taskPromptDefaults/shippedPrompts.js b/server/services/taskPromptDefaults/shippedPrompts.jsindex 6566ef5833..dd2dbb7711 100644--- a/server/services/taskPromptDefaults/shippedPrompts.js+++ b/server/services/taskPromptDefaults/shippedPrompts.js@@ -2,47 +2,25 @@* Recognizing a stored prompt as a shipped default.** Shared by taskScheduleStore.js (legacy-version inference + the- * promptCustomized self-heal) and taskPromptService.js (claim-flow default- * resolution), which previously carried byte-identical copies of this check.- * A genuine user edit never matches a shipped default, so a match means the- * stored prompt is safe to auto-upgrade.+ * promptCustomized self-heal), taskPromptService.js (claim-flow default+ * resolution) and autonomousJobs/portosCatalogRefresh.js (migration prompt+ * carry-over), which each carried a byte-identical copy of this check.+ *+ * The match is byte-exact on purpose: a genuine user edit never reproduces a+ * shipped body, so a match means the stored prompt is safe to auto-upgrade.+ * Recovering a retired body is done by registering it in+ * PREVIOUS_DEFAULT_PROMPTS — never by teaching this predicate to forgive a+ * difference, which would widen "is a shipped default" for every consumer.** See ../taskPromptDefaults.js and AGENTS.md "Distribution model".*/import { DEFAULT_TASK_PROMPTS } from './prompts.js';import { PREVIOUS_DEFAULT_PROMPTS } from './previousDefaults.js';-// The basic improvement prompts shipped under an `[App Improvement: {appName}]`-// header until the self-improvement / app-improvement schedules were unified,-// which renamed it to `[Improvement: {appName}]` without preserving the-// outgoing bodies in PREVIOUS_DEFAULT_PROMPTS. Installs carrying that-// generation therefore stopped matching any shipped default, were flagged-// `promptCustomized` by the legacy migration, and have been frozen out of every-// prompt upgrade since. For most task types the rename changed the header line-// and nothing else, so normalize it on both sides instead of re-registering a-// near-duplicate body per task type. (Bodies that changed further in the same-// era — `security`, `feature-ideas` — still carry their own entry.)-const LEGACY_HEADER = '[App Improvement: ';-const CURRENT_HEADER = '[Improvement: ';--export const normalizeLegacyPromptHeader = (prompt) => (- typeof prompt === 'string' && prompt.startsWith(LEGACY_HEADER)- ? CURRENT_HEADER + prompt.slice(LEGACY_HEADER.length)- : prompt-);--/**- * True when a stored prompt matches a shipped default for this task — the- * current default or any prior one in PREVIOUS_DEFAULT_PROMPTS — ignoring the- * retired `[App Improvement: …]` header spelling.- */export function promptMatchesShippedDefault(prompt, taskType) {if (!prompt || !DEFAULT_TASK_PROMPTS[taskType]) return false;- const normalized = normalizeLegacyPromptHeader(prompt);return (- normalized === DEFAULT_TASK_PROMPTS[taskType] ||- (PREVIOUS_DEFAULT_PROMPTS[taskType] || []).some(- (body) => normalizeLegacyPromptHeader(body) === normalized- )+ prompt === DEFAULT_TASK_PROMPTS[taskType] ||+ (PREVIOUS_DEFAULT_PROMPTS[taskType] || []).includes(prompt));}diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.jsindex a1fc676bef..b338d673e0 100644--- a/server/services/taskPromptDefaults/versions.js+++ b/server/services/taskPromptDefaults/versions.js@@ -35,14 +35,21 @@ export const PROMPT_VERSIONS = {'test-coverage': 2, // v2: generic {appName} body (older default hardcoded "PortOS")'performance': 2, // v2: generic {appName} body (older default hardcoded "PortOS")'accessibility': 2, // v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)- // These three shipped a body change but never carried a PROMPT_VERSIONS entry,- // so `if (PROMPT_VERSIONS[taskType] && …)` skipped them and their stored- // prompts could never auto-upgrade — even once the promptCustomized self-heal- // clears the flag. Versioned now so the `[App Improvement: …]`-header- // generation converges on the current body.- 'console-errors': 2, // v2: `[Improvement: {appName}]` header (older default used `[App Improvement: {appName}]`)- 'error-handling': 2, // v2: `[Improvement: {appName}]` header (older default used `[App Improvement: {appName}]`)- 'typing': 2, // v2: `[Improvement: {appName}]` header (older default used `[App Improvement: {appName}]`)+ 'console-errors': 2, // v2: unified `[Improvement: {appName}]` body (pre-unification defaults shipped separate self- and app-improvement bodies)+ 'error-handling': 2, // v2: unified `[Improvement: {appName}]` body (older default used the `[App Improvement: {appName}]` header)+ 'typing': 2, // v2: unified `[Improvement: {appName}]` body (older default used the `[App Improvement: {appName}]` header)++ // A SCHEDULE task type absent from this map is silently exempt from+ // auto-upgrade forever: taskScheduleStore's upgrade block is gated on+ // `PROMPT_VERSIONS[taskType] && …`, so a body change ships and no install+ // ever receives it. The three types above were frozen that way for months.+ // Every schedule key therefore carries an entry, v1 meaning "shipped once,+ // never revised" — taskPromptDefaults.test.js enforces the parity so the next+ // new scheduled prompt cannot repeat it. (Pipeline STAGE bodies stay+ // unversioned on purpose: they are read live from the catalog and never+ // persisted, so an edit reaches every install on the next dispatch.)+ 'jira-sprint-manager': 1,+ 'jira-status-report': 1,'dependency-updates': 4, // v4: the Phase 1 GitLab MR listing gains `--output json` — without it glab answers with the human table, which carries the head branch but NOT the author, while the classification right below it reads both. The same bump drops `--state` from the MR-list recipes — that flag does not exist (MR state is selected by presence flags `--merged`/`--closed`/`--all`, and OPEN is the default), so `--state opened` exited 1 with `Unknown flag: --state` and Phase 1 skipped its bot-PR triage entirely on GitLab repos. v3: Phase 1 triages open Dependabot/Renovate PRs first (evidence → MERGE / FIX-THEN-MERGE / CLOSE / LEAVE, including conflict + CI-failure repair on the bot branch) before Phase 2 updates anything the bots didn't cover — an agent that bumped packages itself was duplicating and conflicting with open bot PRs. v2: generic {appName} body (older default hardcoded "PortOS")'documentation': 6, // v6: the changelog step names `AGENTS.md` (or `CLAUDE.md`) as the file carrying the repo's documented convention — #4852 made AGENTS.md the canonical cross-vendor agent-instructions filename, and a managed app that adopted it would otherwise be told to read a file it no longer has. v5: the changelog step defers to the convention the repo documents (some repos collect per-branch fragments in a directory so parallel agents don't conflict) instead of prescribing an append to `.changelog/NEXT.md`. v4: generic {appName} body (v1 hardcoded "PortOS"; v2/v3 retired DONE.md wording)'ui-bugs': 2, // v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.jsindex 4eb8e3bd12..60aa981664 100644--- a/server/services/taskSchedule.test.js+++ b/server/services/taskSchedule.test.js@@ -427,30 +427,16 @@ describe('taskSchedule', () => {})})- describe('[App Improvement: …] header generation', () => {- // The unification of the self-improvement and app-improvement schedules- // renamed every basic prompt header from `[App Improvement: {appName}]` to- // `[Improvement: {appName}]` without preserving the outgoing bodies. Every- // install carrying that generation stopped matching a shipped default, got- // stamped promptCustomized by the legacy migration, and has been frozen out- // of every prompt upgrade since — nine task types on a real install. These- // fixtures are the bodies those installs actually stored.- const legacyConsoleErrors = `[App Improvement: {appName}] Console Error Investigation--Find and fix console errors in {appName}:--Repository: {repoPath}--1. If the app has a UI, check browser console for errors-2. Check server logs for errors-3. For each error:- - Identify the source file and line- - Understand the root cause- - Implement a fix--4. Test fixes and commit changes`- const legacySecurity = PREVIOUS_DEFAULT_PROMPTS['security'].find((p) => p.startsWith('[App Improvement: '))- const legacyFeatureIdeas = PREVIOUS_DEFAULT_PROMPTS['feature-ideas'].find((p) => p.startsWith('[Self-Improvement] '))+ describe('pre-unification prompt generations (self- + app-improvement split)', () => {+ // Before the two improvement schedules were unified, every basic task+ // shipped up to two bodies with different headers — `[Self-Improvement] …`+ // and `[App Improvement: {appName}] …`. Unification replaced both with a+ // single `[Improvement: {appName}] …` body but preserved neither, so an+ // install carrying either generation stopped matching any shipped default,+ // was stamped promptCustomized by the legacy migration, and has been frozen+ // out of every prompt upgrade since — nine task types on a real install.+ const fromEra = (taskType, header) =>+ PREVIOUS_DEFAULT_PROMPTS[taskType].find((p) => p.startsWith(header))const loadOne = async (taskType, prompt, promptVersion) => {mockSchedule({@@ -459,50 +445,37 @@ Repository: {repoPath}return (await loadSchedule()).tasks[taskType]}+ // One case per shape the freeze took: header-only drift, a body that also+ // changed, a type whose ONLY revision was the split (so it had no+ // PROMPT_VERSIONS entry at all), and the older self-improvement generation.it.each([- ['console-errors', legacyConsoleErrors, 1],- ['security', legacySecurity, 1],- ['feature-ideas', legacyFeatureIdeas, 2],- ])('self-heals and upgrades a stored %s prompt from that generation', async (taskType, prompt, storedVersion) => {- const task = await loadOne(taskType, prompt, storedVersion)+ ['console-errors', '[App Improvement: '],+ ['security', '[App Improvement: '],+ ['typing', '[App Improvement: '],+ ['console-errors', '[Self-Improvement] '],+ ['feature-ideas', '[Self-Improvement] '],+ ])('self-heals and upgrades a stored %s prompt from the %s generation', async (taskType, header) => {+ const prompt = fromEra(taskType, header)+ expect(prompt, `no ${header} body registered for ${taskType}`).toBeDefined()+ const task = await loadOne(taskType, prompt, 1)expect(task.promptCustomized).toBe(false)expect(task.prompt).toBe(DEFAULT_TASK_PROMPTS[taskType])expect(task.promptVersion).toBe(PROMPT_VERSIONS[taskType])})- // Without a PROMPT_VERSIONS entry the auto-upgrade block is skipped- // entirely, so clearing promptCustomized alone would leave these three- // pinned to the legacy body forever.- it('versions the task types whose only shipped revision was the header rename', () => {- for (const t of ['console-errors', 'error-handling', 'typing']) {- expect(PROMPT_VERSIONS[t], `PROMPT_VERSIONS['${t}']`).toBeGreaterThanOrEqual(2)- }- })-- it('preserves a genuine user customization that merely uses the legacy header', async () => {+ it('preserves a genuine user customization that merely mimics a retired header', async () => {const custom = '[App Improvement: {appName}] My own audit that matches no shipped default.'const task = await loadOne('console-errors', custom, 1)expect(task.prompt).toBe(custom)expect(task.promptCustomized).toBe(true)})- // The frozen feature-ideas body sent every run to `data/COS-GOALS.md`, a- // file the same unification folded into the root GOALS.md.- it('retires the COS-GOALS.md reference once feature-ideas upgrades', async () => {- const task = await loadOne('feature-ideas', legacyFeatureIdeas, 2)- expect(legacyFeatureIdeas).toContain('data/COS-GOALS.md')- expect(task.prompt).not.toContain('COS-GOALS.md')- })- })-- describe('feature-ideas product-source precedence', () => {- it('reads PRD.md first and falls back to GOALS.md when brainstorming', () => {- const prompt = DEFAULT_TASK_PROMPTS['feature-ideas']- expect(prompt).toContain('`PRD.md`')- expect(prompt).toContain('`GOALS.md`')- // Precedence, not just presence: the PRD instruction must come first.- expect(prompt.indexOf('`PRD.md`')).toBeLessThan(prompt.indexOf('`GOALS.md`'))- expect(prompt).toContain('follow the PRD\'s concrete requirements')+ // Pins the provenance of the frozen feature-ideas body: it is the one that+ // sent every run to `data/COS-GOALS.md`, a file the same unification folded+ // into the root GOALS.md. The upgrade itself is covered above.+ it('pins the frozen feature-ideas body as the COS-GOALS.md-era default', () => {+ expect(fromEra('feature-ideas', '[Self-Improvement] ')).toContain('data/COS-GOALS.md')+ expect(DEFAULT_TASK_PROMPTS['feature-ideas']).not.toContain('COS-GOALS.md')})})diff --git a/server/services/taskScheduleStore.js b/server/services/taskScheduleStore.jsindex 549ae7a0c2..d0c47a9082 100644--- a/server/services/taskScheduleStore.js+++ b/server/services/taskScheduleStore.js@@ -15,9 +15,6 @@ import {import {DEFAULT_TASK_PROMPTS,PROMPT_VERSIONS,- // True when a stored prompt matches a shipped default (current or prior).- // A genuine user edit never does, so loadSchedule treats a match as- // "not really customized" — see taskPromptDefaults/shippedPrompts.js.promptMatchesShippedDefault} from './taskPromptDefaults.js';@@ -215,7 +212,8 @@ async function readSchedule() {config.promptVersion = PROMPT_VERSIONS[taskType] || 1;needsSave = true;} else if (promptMatchesShippedDefault(config.prompt, taskType)) {- // Matches a known previous default — assign version 1 so auto-upgrade triggers+ // Matches a shipped default — a prior one, or the current one under+ // the retired header. Assign version 1 so auto-upgrade triggers.config.promptVersion = 1;needsSave = true;} else {