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
fix: align scheduled tracker prompts with slashdo
[._.]/ Adam Eivy45b278415f69
diff --git a/docs/features/self-improvement-audits.md b/docs/features/self-improvement-audits.mdindex 3056452ab4..fe812188a1 100644--- a/docs/features/self-improvement-audits.md+++ b/docs/features/self-improvement-audits.md@@ -9,11 +9,11 @@ Configure them in **CoS → Schedule**. Every lane is on-demand and enabled bydefault, so a fresh install spends nothing until you press Run or pick a cadence(the AI Provider Usage Policy in `AGENTS.md`).-Filed forge issues keep a `[<metric>-…]` slug in the title **and** apply that-same metric as a label (`cognitive-load`, `structural-drift`, `runtime-safety`,-…) alongside the category (`code-quality`, `bug`, `tests`, …) so the backlog-can be filtered without parsing titles. When the slug stem is already the-category (`ux`, `security`) the extra label is omitted.+Filed forge issues use short, human-readable titles; the issue number or key is+the ID. Category labels (`code-quality`, `bug`, `tests`, …) and distinct metric+labels (`cognitive-load`, `structural-drift`, `runtime-safety`, …) make the+backlog filterable without encoding metadata in titles. PLAN.md keeps its+existing slugged checklist IDs.Registry: `server/lib/auditCatalog.js` (what each lane is and how it files),`server/services/taskScheduleRegistry.js` (cadence and posture),@@ -76,20 +76,21 @@ problem:- **Tests are split two ways.** `test-coverage` owns the gaps;`better-test-quality` owns the tests that already exist.-## The `better-` prefix and slashdo parity+## The `better-` prefix and slashdo scope alignment-The `better-` lanes mirror an audit lens from the bundled slashdo `/do:better`-command (`lib/slashdo/lib/better-audit.md`). That command fans every lens out to-sub-agents inside a single run; these task types expose the same lenses-individually, so each can be scheduled, pinned to its own provider and model, and-toggled between filing and fixing on its own.+The bundled slashdo `/do:better` command now declares a generic scope and+ownership table in `lib/slashdo/lib/better-audit.md`; it no longer has a+`For <lens>:` checklist for PortOS to mirror. PortOS keeps its focused+`better-*` scheduled missions as narrower, PortOS-owned additions that can be+scheduled and pinned independently. Their prompt bodies own the specialist+checks. Shared audit discovery, issue filing, and delivery contracts stay in+their common runtime seams instead of being copied into each mission.-The prefix marks a **parity obligation**: when one of these missions improves,-the improvement is a candidate to push upstream to slashdo rather than to let the-two definitions drift. `DO_BETTER_LENS_COVERAGE` in `server/lib/auditCatalog.js`-records which lane owns each lens, and `auditCatalog.test.js` reads the bundled-submodule and fails when a lens declared upstream has no lane here — so a-category added to slashdo cannot silently become unschedulable in PortOS.+`DO_BETTER_SCOPE_COVERAGE` in `server/lib/auditCatalog.js` maps current slashdo+scope names to scheduled task types and drives schedule labels. The test reads+the bundled scope table in both directions: a new upstream scope needs an owner,+and an obsolete scope label cannot remain after upstream changes. The former+`DO_BETTER_LENS_COVERAGE` export remains an alias for compatibility.The prefix is spelled with a hyphen rather than `better:` because a task type isinterpolated into the CoS task id, which becomes a git branch name@@ -106,5 +107,7 @@ produces no diff is not scored as a failure.Findings go to whichever tracker the app resolves to — a `PLAN.md` checklistitem, a GitHub or GitLab issue, or a JIRA ticket — via `{trackerInstructions}`.-Each lane carries a slug prefix so repeat runs deduplicate against their own-history instead of re-filing.+PLAN.md keeps its existing checklist IDs. New forge and JIRA issues use plain+human-readable titles, with the issue number/key as the ID and category/metric+labels for filtering. Earlier bracketed title prefixes are read only when+checking for duplicates; new issue titles do not add them.diff --git a/server/lib/README.md b/server/lib/README.mdindex 31a6534f45..cb1d6182bd 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -90,7 +90,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `quotaBurnLegacyConversion.js` | The ONE rule turning a LEGACY quota-burn step (copied prompt + quota-only `jobType`) into a scheduled-task reference, shared by migration 359 and the live compat path so the two cannot drift. `planQuotaBurnStepConversion` decides between three outcomes — a recognized unmodified shipped preset onto its scheduled audit counterpart with issues-only pinned explicitly (`AUDIT_TASK_TYPE_BY_PRESET_ID`, inverted from `auditCatalog.js`), the two programmatic types onto their scheduled handlers, and anything customized or targetless onto a `buildQuotaBurnCustomJob` on-demand custom task addressed by the deterministic `quotaBurnCustomJobId` (which is what makes a repeated or resumed conversion create no duplicate). `legacyAgentTaskMetadata` reproduces the retired executor's dispatch posture; `applyQuotaBurnStepConversion` rewrites the step, preserving id, label, enabled and run-once state. Recognition is `matchStoredAuditPreset`, never a label or a partial match. || `quotaBurnOrigin.js` | Quota-burn PROVENANCE on an on-demand scheduled-task request and on the task it produces. `normalizeQuotaBurnProvenance` reads the request block (burn-step id always required, plus an attribution — the family whose window is spent, OR the manual `maintenanceRunId` alone when the run is pinned outside every subscription family — the limiting-window reset and the provider/model/effort overrides); `QUOTA_BURN_PROVENANCE_FIELDS` is the ONE block definition every persistence and projection hop derives from, spread by `quotaBurnTaskMetadata` (flat task-metadata keys), `quotaBurnAgentMetadata` (the agent projection) and read back by `quotaBurnProvenance` / `hasQuotaBurnProvenance`, which accept both the flat keys and a nested `quotaBurn` block; `burnPlanOwnsTask` / `burnPlanOwnsAgent` are the ONE rule for whether the family plan (not a manual maintenance run) owns a burn-provenanced task. `isManualOnDemandRequest` distinguishes explicit runs from automated cadence gates. `onDemandRequestMetadata` is the single spread both on-demand engines apply. Import-light on purpose — `taskScheduleConstants.js` declares the origin string and must not drag the quota-burn config graph. || `quotaBurnPresets.js` | FROZEN compatibility-and-migration input (#6381). `QUOTA_BURN_PROMPT_PRESETS` — ready-made single-focus audit prompts for `agent-prompt` burn jobs (UX, a11y, mobile, failure paths, perf, test gaps, dead code, data safety, docs, security), each filing GitHub issues and changing no code. Templates: picking one COPIES its prompt into the job, so editing them never rewrites a configured job. `findQuotaBurnPreset(id)`; `matchStoredAuditPreset` is migration 305's recognition rule (match the MISSION half, gated on the shipped contract anchors + headings) and `upgradeStoredAuditPrompt` is the refresh built on it. |-| `auditCatalog.js` | `getAuditScheduleMetadata` derives upgrade-safe display names and cluster labels; `AUDIT_RUN_GUIDANCE` supplies advisory sequencing. Shared catalog of scheduled AUDIT task types (`AUDIT_DEFINITIONS` / `AUDIT_TASK_TYPES`) that can either implement a fix or file tracker issues. Filing presets carry `issueLabel` (category) plus `metricLabel`/`extraLabels` from the slug stem (`cognitive-load`, `structural-drift`, `runtime-safety`, …) so forge issues can be filtered by metric as well as titled with it. `metricLabelFromSlugPrefix`, `isFileIssuesMode`, `isExplicitFileIssuesRequest`, `FILE_ISSUES_DELIVERY_SETTINGS` (the one delivery posture every file-issues lane stamps), `auditDoWorkRequiresWorktree`, `getAuditFilingPreset`, `modeContractFor`, `applyAuditModeWrapper`. Each quota-burn audit preset maps to a scheduled type here (guarded by `auditCatalog.test.js`). Pure — no I/O. |+| `auditCatalog.js` | `getAuditScheduleMetadata` derives upgrade-safe display names and cluster labels; `AUDIT_RUN_GUIDANCE` supplies advisory sequencing. Shared catalog of scheduled AUDIT task types (`AUDIT_DEFINITIONS` / `AUDIT_TASK_TYPES`) that can either implement a fix or file tracker issues. Filing presets carry `issueLabel` (category) plus `metricLabel`/`extraLabels` so forge issues can be filtered by focus without putting ids in titles. `DO_BETTER_SCOPE_COVERAGE` maps scheduled task types to the bundled slashdo scope table; `DO_BETTER_LENS_COVERAGE` remains a compatibility alias. `metricLabelFromSlugPrefix`, `isFileIssuesMode`, `isExplicitFileIssuesRequest`, `FILE_ISSUES_DELIVERY_SETTINGS` (the one delivery posture every file-issues lane stamps), `auditDoWorkRequiresWorktree`, `getAuditFilingPreset`, `modeContractFor`, `applyAuditModeWrapper`. Each quota-burn audit preset maps to a scheduled type here (guarded by `auditCatalog.test.js`). Pure — no I/O. || `quotaBurnTaskRef.js` | The quota-burn STEP model: a discriminated scheduled-task reference (`builtin` task type + validated target app, or `custom` app-job id whose own scope is authoritative) plus the per-invocation `overrides` bag (provider/model/effort/params — unset inherits the task's saved settings, and nothing written here edits the schedule). `normalizeQuotaBurnTaskRef` / `normalizeQuotaBurnOverrides` / `normalizeQuotaBurnParams`, the `QUOTA_BURN_UNAVAILABLE` reason codes, `resolveQuotaBurnStepAvailability` (catalog passed IN, so this stays pure) / `applyQuotaBurnAvailability`, `quotaBurnStepIsDispatchable`, and `evaluateOnDemandEligibility` — the ONE on-demand gate ladder (`enabled` / instance feature / invocation eligibility / target scope / per-app switch / master Improve) shared with `taskSchedule.triggerOnDemandTask`, with `enabledAppIdsByTaskType` deriving its per-app input. || `quotaBurnValidation.js` | Zod schemas for the Quota Burn routes (partial config PUT, manual-run body, `run once` re-arm body). || `quotaReset.js` | `parseHumanReset` turns a provider CLI's human reset string into ISO 8601 (call it from the adapter); `normalizeResetAt`/`hoursUntilReset` compute time remaining without treating unknown values as imminent resets; `parseObservedReset` pulls the reset a provider stated in its own refusal text, and `isObservedBlockActive` is the shared "is that refusal still holding?" predicate every observed-refusal ledger uses. |@@ -682,7 +682,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `userActionTypes.js` | Closed vocabulary for the operator-action ledger (`user_action_events`, #5594 / #5596): `USER_ACTION_TYPES` (CoS task/feedback/schedule + settings + instance-feature toggles + event-only creative/Brain pointers), `USER_ACTION_ACTORS` (`user` / `mind` / `schedule` / `system`), and the `isUserActionType` / `isUserActionActor` predicates. `recordUserAction` (`services/userActions.js`) throws on a type absent from the list, so a typo fails a test instead of writing a row nothing can filter on. || `uuid.js` | `v4()` thin wrapper over the global `crypto.randomUUID()`. Import-free, so a leaf the browser imports may reach it without a Node built-in — importable, not browser-callable: `randomUUID` needs a secure context there, so client code mints through `client/src/lib/uuid.js`. || `versionUtils.js` | `compareSemver(a, b)` — semver ordering (-1/0/1) with pre-release precedence and build-metadata stripping. Shared by the self-update checker (`updateChecker.js`) and the local-LLM Ollama update detector (`localLlm.js`). Inputs must be `v`-stripped. |-| `workTracker.js` | `WORK_TRACKERS`/`CONCRETE_WORK_TRACKERS`/`DEFAULT_WORK_TRACKER`, `workTrackerLabel`, `hostToWorkTracker`, `isGithubHost` (GitHub-family host test — github.com + enterprise github.*; enterprise-aware replacement for the github.com-only `isGithub` gate), `githubRepoSpec(origin)` (host-qualified `HOST/OWNER/REPO` selector for `gh --repo`, or null for a non-GitHub origin — pairs the isGithubHost gate with the selector so prWatcher/branchReconcile/issueReconcile share one "resolvable GitHub repo" definition), `forgeCliForTracker`, `isFileTracker` (true when the tracker records work as repo files — PLAN.md — so an agent's proposal necessarily dirties the worktree; false for github/gitlab/jira), `trackerToClaimTaskType`, `hostFromOriginUrl` (subgroup-tolerant, ssh-alias-aware host parse), pure `resolveWorkTracker({configured,host})`, async `resolveAppWorkTracker(app)` — resolves a managed app's autonomous work source (PLAN.md / GitHub / GitLab / JIRA), defaulting `'auto'` to the git origin host and checking the `gh` and `glab` host configs for otherwise-unmatched hosts. Async `resolveRepoForgeTarget(repoPath)` — the ONE definition of "which forge can we query for this checkout", returning `{ forge, fullName, repoSpec, apiHost }` (enterprise-aware `gh --repo` selector for GitHub; `repoSpec: null` for GitLab, which `glab` resolves from its cwd) or null for a non-forge origin; shared by `issueReconcile.js` and `appIssues.js`. Async `resolveAppForgeTarget(app, {repoPath})` — the composed `resolveAppWorkTracker` + `resolveRepoForgeTarget` for callers holding the managed-app record, returning `{ tracker, target }` with the app's github/gitlab pin threaded in as `preferredForge` (so a self-hosted forge on a hostname matching neither pattern still resolves); use this instead of re-threading the pin by hand. Also owns the `{trackerInstructions}` prompt block shared by the TRACKER-FILING task types (types that read the app read-only and deliver findings as tracker items, not a commit): `TRACKER_FILING_PRESETS` (per-task-type slug prefix / label / body requirements — `reference-watch`, `ux`, `repo-study`), `TRACKER_FILING_TASK_TYPES` (derived from the presets, so a gated type always has wording), `extraIssueLabels` / `formatForgeCategoryLabelFlags` (category + metric-slug labels + `plan` as repeated `--label` flags), and `formatTrackerInstructions(tracker, options)` which renders the plan/github/gitlab/jira block (reference-watch is the default option set, so a bare call stays byte-identical for it). Consumed by the `claim-work` router in `cosTaskGenerator.js`, `referenceRepos.js`, and `routes/apps.js`. Also `repoIssueUrlBase(target)` — the browsable issue-tracker base URL for a resolved forge target (`/-/issues` on GitLab, `/issues` elsewhere), so a caller stamps a finished base onto its record and nothing downstream has to classify a host. |+| `workTracker.js` | `WORK_TRACKERS`/`CONCRETE_WORK_TRACKERS`/`DEFAULT_WORK_TRACKER`, `workTrackerLabel`, `hostToWorkTracker`, `isGithubHost` (GitHub-family host test — github.com + enterprise github.*; enterprise-aware replacement for the github.com-only `isGithub` gate), `githubRepoSpec(origin)` (host-qualified `HOST/OWNER/REPO` selector for `gh --repo`, or null for a non-GitHub origin — pairs the isGithubHost gate with the selector so prWatcher/branchReconcile/issueReconcile share one "resolvable GitHub repo" definition), `forgeCliForTracker`, `isFileTracker` (true when the tracker records work as repo files — PLAN.md — so an agent's proposal necessarily dirties the worktree; false for github/gitlab/jira), `trackerToClaimTaskType`, `hostFromOriginUrl` (subgroup-tolerant, ssh-alias-aware host parse), pure `resolveWorkTracker({configured,host})`, async `resolveAppWorkTracker(app)` — resolves a managed app's autonomous work source (PLAN.md / GitHub / GitLab / JIRA), defaulting `'auto'` to the git origin host and checking the `gh` and `glab` host configs for otherwise-unmatched hosts. Async `resolveRepoForgeTarget(repoPath)` — the ONE definition of "which forge can we query for this checkout", returning `{ forge, fullName, repoSpec, apiHost }` (enterprise-aware `gh --repo` selector for GitHub; `repoSpec: null` for GitLab, which `glab` resolves from its cwd) or null for a non-forge origin; shared by `issueReconcile.js` and `appIssues.js`. Async `resolveAppForgeTarget(app, {repoPath})` — the composed `resolveAppWorkTracker` + `resolveRepoForgeTarget` for callers holding the managed-app record, returning `{ tracker, target }` with the app's github/gitlab pin threaded in as `preferredForge` (so a self-hosted forge on a hostname matching neither pattern still resolves); use this instead of re-threading the pin by hand. Also owns the `{trackerInstructions}` prompt block shared by TRACKER-FILING task types (types that read the app read-only and deliver findings as tracker items, not a commit): `TRACKER_FILING_PRESETS` (per-task-type PLAN.md id prefix / legacy forge-title marker / labels / body requirements — PLAN.md ids remain; old forge markers are read only for de-duplication), `TRACKER_FILING_TASK_TYPES` (derived from the presets, so a gated type always has wording), `extraIssueLabels` / `formatForgeCategoryLabelFlags` (category + metric labels + `plan` as repeated `--label` flags), and `formatTrackerInstructions(tracker, options)` which renders plan/github/gitlab/jira blocks (forge titles use plain human-readable text, issue numbers are IDs, and multiline bodies use file-based/quoted transport). Consumed by the `claim-work` router in `cosTaskGenerator.js`, `referenceRepos.js`, and `routes/apps.js`. Also `repoIssueUrlBase(target)` — the browsable issue-tracker base URL for a resolved forge target (`/-/issues` on GitLab, `/issues` elsewhere), so a caller stamps a finished base onto its record and nothing downstream has to classify a host. || `eidoverseProxyRoutes.js` | Allowlist + path helpers for the same-origin Eidoverse reverse-proxy on `:5555` (`/eidoverse-host` prefix strip and root routes like `/ws` / `/version` while the host is active). Shared by `services/eidoverseProxy.js` so the main server and the optional `:5563` bridge stay in sync with eidoverse-worlds `server/routes.ts`. || `workspaceRoots.js` | Shared allow-list for routes that take a caller-supplied filesystem path. `isWithinAllowedRoots(realPath)` is the single complete test — on Windows it also allows any lettered non-system drive (`D:\code`), which appears in no root, so never render `ALLOWED_WORKSPACE_ROOTS` as "the directories you may use". `outsideAllowedRootsMessage(realPath, { field })` formats a redacted server-only diagnostic with the rejected realpath and every checked root. Also `ALLOWED_WORKSPACE_ROOTS` (defaults + `PORTOS_WORKSPACE_ROOTS`, split on the platform path delimiter — `;` on Windows — and symlink-resolved), `isWithinRoot(resolvedPath, root)` (separator-safe containment), and `WORKSPACE_ROOTS_CONFIGURED` (true when the operator set the env var — lets a permissive-by-default route like `routes/detect.js` opt into confinement). Defaults cover home plus wherever the platform mounts secondary volumes: `/tmp` + `/Users` + `/Volumes` + `/mnt` + `/media` + `/opt` on POSIX; home + the temp dir plus the non-system-drive rule on Windows, where those POSIX literals would resolve to whatever drive the process happens to be on. Used by `routes/commands.js`, `routes/scaffold.js`, and `routes/git.js` (always scoped) and `routes/detect.js` (scoped only when configured). || `zodCompat.js` | Zod 4 compatibility helpers. `partialWithoutDefaults(objectSchema)` — like `.partial()` but strips inner field defaults first, so a PATCH/update schema doesn't inject (and clobber) the stored values of fields the caller didn't send. Use for any update schema derived from a defaulted base. Also home to the provider-reference zod forms (#7564) — `providerRefSchema` / `providerRefFieldSchema` (a preset id OR a composite `harness.method@service[+bootstrap]`, per `providerRef.js`) and `presetProviderIdSchema` (preset-only) — because `cosValidation.js` needs them and must not import validation.js. |diff --git a/server/lib/auditCatalog.js b/server/lib/auditCatalog.jsindex db48ecbcea..7c33185c30 100644--- a/server/lib/auditCatalog.js+++ b/server/lib/auditCatalog.js@@ -382,18 +382,13 @@ export const AUDIT_DEFINITIONS = Object.freeze({noun: 'copy finding(s)',}),},- // The six types below give every `do:better` audit lens a scheduled- // counterpart (DO_BETTER_LENS_COVERAGE, at the bottom of this file). They- // are refactor- or defect-hunting lanes carved out of the broader- // code-quality / module-hygiene / test-coverage bodies so each can be- // scheduled, pinned to a provider, and toggled between filing and fixing on- // its own. Each still files under an existing category (`code-quality`,- // `bug`, `tests`, `dependencies`) and ALSO under the metric slug- // (`cognitive-load`, `structural-drift`, `runtime-safety`, …) so the- // backlog can be filtered by lens without parsing titles. The refactor- // lanes require a managed worktree in do-work mode: a mechanical- // restructuring of a hot function or a dependency swap is exactly the edit- // that must never land in the user's live checkout.+ // These six PortOS-owned focused missions map onto the current generic+ // `/do:better` scopes through DO_BETTER_SCOPE_COVERAGE below. Their+ // scheduleable mission bodies add narrow checks; they do not copy slashdo's+ // audit orchestration or tracker-filing procedure. Each keeps its existing+ // category label and an additional metric label where needed. Refactor lanes+ // require a managed worktree in do-work mode so edits never land in a live+ // checkout.'better-complexity': {quotaBurnId: null,label: 'Cyclomatic complexity',@@ -651,25 +646,18 @@ export function applyAuditModeWrapper(promptTemplate, modeInstructions) {}/**- * Which scheduled audit types cover each `do:better` audit lens- * (lib/slashdo/lib/better-audit.md, the `For \`<lens>\`:` list). The slashdo- * command fans the same lenses out to sub-agents in one run; PortOS exposes- * each as its own schedulable, provider-pinnable task so a managed app can run- * every category of self-improvement on its own cadence. Keys are the lens- * slugs slashdo uses; values are the AUDIT_DEFINITIONS types that own that- * lens's findings, in no significant order — the relation is many-to-many both- * ways (`security` answers three lenses; `bugs-perf` has four owners), which- * is why this is a lens-keyed map rather than a field on each definition. A- * per-definition field could not answer the question the map exists for: did- * upstream add a lens that NOTHING here owns?+ * Scheduled audit types mapped onto the scope table in slashdo's+ * `lib/better-audit.md`. The exported `DO_BETTER_LENS_COVERAGE` name remains+ * as a compatibility alias for callers that used the old per-lens roster;+ * the source of truth is now slashdo's generic scope table. Values are+ * AUDIT_DEFINITIONS types that cover a scope; the relation is many-to-many.*- * It drives schedule discovery labels, never dispatch or execution ordering.- * auditCatalog.test.js checks it two ways: every- * listed type is a real audit type, and (when the submodule is checked out)- * every lens slashdo declares has an entry here, so a lens added upstream- * cannot silently go unschedulable.+ * This map drives schedule discovery labels, never dispatch or execution+ * ordering. The test parses the bundled table and checks both directions, so+ * adding a slashdo scope without a scheduled owner or leaving stale scope+ * labels fails at the source boundary.*/-export const DO_BETTER_LENS_COVERAGE = Object.freeze({+export const DO_BETTER_SCOPE_COVERAGE = Object.freeze({security: ['security'],'code-quality': ['code-quality', 'observability'],dry: ['simplify'],@@ -683,15 +671,18 @@ export const DO_BETTER_LENS_COVERAGE = Object.freeze({'cognitive-load': ['better-cognitive-load', 'better-complexity'],});+/** @deprecated Use DO_BETTER_SCOPE_COVERAGE; kept for API compatibility. */+export const DO_BETTER_LENS_COVERAGE = DO_BETTER_SCOPE_COVERAGE;+/** Display metadata is derived, so upgrades never rewrite durable task IDs. */export function getAuditScheduleMetadata(taskType) {const canonicalType = normalizeAuditTaskType(taskType);if (!isAuditTaskType(canonicalType)) return { displayName: taskType, defaultLabels: [] };- const lenses = Object.entries(DO_BETTER_LENS_COVERAGE)- .filter(([, types]) => types.includes(canonicalType)).map(([lens]) => lens);+ const scopes = Object.entries(DO_BETTER_SCOPE_COVERAGE)+ .filter(([, types]) => types.includes(canonicalType)).map(([scope]) => scope);return {displayName: canonicalType.startsWith('better-') ? canonicalType : `better-${canonicalType}`,- defaultLabels: ['codebase-improvement', 'slashdo', ...lenses],+ defaultLabels: ['codebase-improvement', 'slashdo', ...scopes],};}diff --git a/server/lib/auditCatalog.test.js b/server/lib/auditCatalog.test.jsindex c8c4cc7502..d807dbc892 100644--- a/server/lib/auditCatalog.test.js+++ b/server/lib/auditCatalog.test.js@@ -18,10 +18,10 @@ import {isFileIssuesMode,isExplicitFileIssuesRequest,FILE_ISSUES_DELIVERY_SETTINGS,- getAuditFilingPreset,metricLabelFromSlugPrefix,modeContractFor,applyAuditModeWrapper,+ DO_BETTER_SCOPE_COVERAGE,DO_BETTER_LENS_COVERAGE,AUDIT_RUN_GUIDANCE,AUDIT_SUGGESTED_AFTER,@@ -266,22 +266,25 @@ describe('getAuditFilingPreset', () => {});});-// The `better-*` audit types exist to give each slashdo `do:better` audit lens-// a schedulable counterpart. The coverage map is the contract between the two,-// and it only means anything if both halves are checked: that every type it-// names is real, and that every lens upstream declares is actually named.-describe('DO_BETTER_LENS_COVERAGE', () => {+// PortOS's focused `better-*` tasks map onto current generic slashdo scopes.+// Keep both directions checked so upstream scope changes cannot leave schedule+// labels stale or scopes without owners.+describe('DO_BETTER_SCOPE_COVERAGE', () => {it('names only registered audit types, without duplicates', () => {- for (const [lens, owners] of Object.entries(DO_BETTER_LENS_COVERAGE)) {- expect(Array.isArray(owners), lens).toBe(true);- expect(owners.length, lens).toBeGreaterThan(0);+ for (const [scope, owners] of Object.entries(DO_BETTER_SCOPE_COVERAGE)) {+ expect(Array.isArray(owners), scope).toBe(true);+ expect(owners.length, scope).toBeGreaterThan(0);for (const owner of owners) {- expect(AUDIT_TASK_TYPES.has(owner), `${lens} -> ${owner}`).toBe(true);+ expect(AUDIT_TASK_TYPES.has(owner), `${scope} -> ${owner}`).toBe(true);}- expect(new Set(owners).size, `${lens} lists a duplicate owner`).toBe(owners.length);+ expect(new Set(owners).size, `${scope} lists a duplicate owner`).toBe(owners.length);}});+ it('keeps the former exported name as the same coverage map', () => {+ expect(DO_BETTER_LENS_COVERAGE).toBe(DO_BETTER_SCOPE_COVERAGE);+ });+// The seeded schedule row ALWAYS sets taskMetadata.fileIssues, so for a// scheduled dispatch the catalog default is never actually consulted — which// means the two can disagree and nothing would notice until someone read the@@ -295,17 +298,16 @@ describe('DO_BETTER_LENS_COVERAGE', () => {}});- it('gives every better-prefixed audit type a lens to be in parity with', () => {- const covered = new Set(Object.values(DO_BETTER_LENS_COVERAGE).flat());+ it('maps every better-prefixed audit type to a current slashdo scope', () => {+ const covered = new Set(Object.values(DO_BETTER_SCOPE_COVERAGE).flat());const orphaned = [...AUDIT_TASK_TYPES].filter((type) => type.startsWith('better-') && !covered.has(type));expect(orphaned).toEqual([]);});- // Reads the bundled submodule when it is initialized. A lens added upstream- // with no entry here is a category of app quality that silently became- // unschedulable — exactly the gap these task types were added to close.- it('covers every lens the bundled do:better command declares', async () => {+ // Reads the bundled submodule when it is initialized. This parses the current+ // scope table rather than the retired `For <lens>:` checklist format.+ it('covers every scope the bundled do:better command declares', async () => {const { existsSync, readFileSync } = await import('fs');const { join } = await import('path');const { PATHS } = await import('./paths.js');@@ -318,11 +320,13 @@ describe('DO_BETTER_LENS_COVERAGE', () => {return;}const body = readFileSync(auditRef, 'utf8');- // Each lens is introduced as: For `<slug>`:- const declared = [...body.matchAll(/^For `([a-z-]+)`:/gm)].map(([, slug]) => slug);+ // Scope names are the first code span in each row of the current table.+ const declared = [...body.matchAll(/^\|\s*`([a-z-]+)`/gm)].map(([, scope]) => scope);expect(declared.length).toBeGreaterThan(5);- const missing = declared.filter((lens) => !DO_BETTER_LENS_COVERAGE[lens]);+ const missing = declared.filter((scope) => !DO_BETTER_SCOPE_COVERAGE[scope]);expect(missing).toEqual([]);+ const stale = Object.keys(DO_BETTER_SCOPE_COVERAGE).filter((scope) => !declared.includes(scope));+ expect(stale).toEqual([]);});});diff --git a/server/lib/scheduledTaskTypes.js b/server/lib/scheduledTaskTypes.jsindex 83601e724d..ad3ad56ad3 100644--- a/server/lib/scheduledTaskTypes.js+++ b/server/lib/scheduledTaskTypes.js@@ -20,9 +20,10 @@ export const SELF_IMPROVEMENT_TASK_TYPES = [// review submission, rebase/CI policy enforcement, and merging are hooks.'issue-watcher',// Watches `referenceRepos` configured on the app — fetches each upstream- // repo, finds commits since lastReviewedSha, and appends slug-tagged- // `[ref-watch-…]` checklist items to the app's PLAN.md for `/claim` /- // `plan-task` to pick up. No source-code edits, no separate review file.+ // repo, finds commits since lastReviewedSha, and files proposals in the+ // app's configured tracker (PLAN.md checklist IDs or forge issue numbers)+ // for `/claim` / `plan-task` / `claim-issue*` to pick up. No source-code+ // edits, no separate review file.'reference-watch',// Walks the running app UI with a UX reviewer's eye (Playwright MCP) against a// named checklist — buried primary actions, dead-end empty/error states,@@ -59,10 +60,10 @@ export const SELF_IMPROVEMENT_TASK_TYPES = [// and the `copy` metric label; narrower than the `ux` audit, which walks the// running UI. File-issues.'copy',- // The six lanes below complete the scheduled counterparts of the slashdo- // `do:better` audit lenses (DO_BETTER_LENS_COVERAGE in lib/auditCatalog.js),- // so every category of app quality can be scheduled on its own cadence- // instead of fanning eight sub-agents out of one command run.+ // The six PortOS-owned specialist missions below map onto current slashdo+ // `do:better` scopes through DO_BETTER_SCOPE_COVERAGE in lib/auditCatalog.js.+ // They can be scheduled independently while shared runtime contracts own+ // audit orchestration and tracker filing.// Measured branching per function — ranks the hottest high-complexity// functions by churn and reduces them with a named transformation. The// structural cousin of `module-hygiene` (which owns responsibility anddiff --git a/server/lib/validation.js b/server/lib/validation.jsindex c626b79528..61bede06de 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -334,13 +334,14 @@ export const appSchema = z.object({// in this file.// Reference-repo entry. Each app can list upstream repos it watches for// clean-room reimplementation; the `reference-watch` scheduled task fetches-// each one, finds commits since `lastReviewedSha`, and appends slug-tagged-// `[ref-watch-…]` checklist items to the app's PLAN.md for `/claim` /-// `plan-task` to pick up. `notes` is the free-text "what we use from this-// repo" field — fed into the review prompt so the agent knows which features-// in our app are load-bearing for the watch. `repoUrl` is either a clonable-// URL (https://github.com/owner/repo or scp-style user@host:owner/repo.git)-// or a local filesystem path; the service detects remote URLs by matching+// each one, finds commits since `lastReviewedSha`, and files proposals in the+// app's configured tracker (PLAN.md checklist IDs or forge issue numbers) for+// `/claim` / `plan-task` / `claim-issue*` to pick up. `notes` is the free-text+// "what we use from this repo" field, fed into the review prompt so the agent+// knows which features in our app are load-bearing for the watch. `repoUrl` is+// either a clonable URL (https://github.com/owner/repo or scp-style+// user@host:owner/repo.git) or a local filesystem path; the service detects+// remote URLs by matching// `scheme://` or scp-style `user@host:path` (see isLocalPath in// services/referenceRepos.js) and treats anything else as a local path.// The persisted record's server-owned fields (id, status, lastError,diff --git a/server/lib/workTracker.js b/server/lib/workTracker.jsindex 91974970f8..42414cd421 100644--- a/server/lib/workTracker.js+++ b/server/lib/workTracker.js@@ -28,7 +28,7 @@ import {} from './dispatchLabels.js';import { getOriginInfo, readOriginRemoteUrl } from './gitRemote.js';import { resolveSshHostAlias } from './sshHostAlias.js';-import { getAuditFilingPreset, isAuditTaskType, metricLabelFromSlugPrefix } from './auditCatalog.js';+import { getAuditFilingPreset, isAuditTaskType } from './auditCatalog.js';// Every selectable value (UI + Zod enum). `'auto'` is the default; the rest are// concrete sources.@@ -158,9 +158,9 @@ export function isFileTracker(tracker) {// as ITEMS IN THE APP'S TRACKER (PLAN.md checklist items / GitHub / GitLab// issues / JIRA tickets) rather than as a commit. `reference-watch` was the// first; `ux` is the second. The mechanics of "inventory existing items, record-// one per finding, finalize" are identical across them — only the slug prefix,-// the label, and the per-item body requirements differ — so the blocks live-// here (next to the tracker resolution they key off) and are parameterized+// one per finding, finalize" are identical across them — only the PLAN.md id+// prefix, legacy forge-title marker, labels, and body requirements differ — so+// the blocks live here (next to tracker resolution) and are parameterized// rather than copied per task type.//// The blocks carry {appName}/{repoPath} placeholders that each dispatch path's@@ -180,8 +180,9 @@ export function isFileTracker(tracker) {*/export const TRACKER_FILING_PRESETS = {'reference-watch': {- // Every recorded item's title carries `[<slugPrefix>…]` so the inventory- // step can grep prior items in bulk and skip duplicates.+ // PLAN.md keeps its historical item ids. Forge issues use plain titles;+ // this prefix is recognized only when de-duplicating issues filed by older+ // versions of the prompt.slugPrefix: 'ref-watch-',// How the prose names this task's items ("list existing <label> issues").label: 'reference-watch',@@ -315,9 +316,9 @@ export function formatTrackerInstructions(tracker, options = {}) {? `\n 3. ${issueLabelContract.instructions.split('\n').join('\n ')}`: '';const forgeFileStep = issueLabelContract ? '4.' : '3.';- // `ref-watch-` → `ref-watch`: the forge title search wants the stem, not the- // trailing separator (`--search "ref-watch in:title"`).- const slugStem = metricLabelFromSlugPrefix(slugPrefix);+ // Existing issues may still carry the old bracketed title tag. It is a+ // read-only compatibility hint for de-duplication, never a new issue id.+ const legacyTitleTag = `[${slugPrefix}…]`;const metricExtras = extraIssueLabels(issueLabel, extraLabels);const forgeCategoryFlags = formatForgeCategoryLabelFlags(issueLabel, extraLabels);const extraCreateClause = (render) => {@@ -325,7 +326,7 @@ export function formatTrackerInstructions(tracker, options = {}) {return `, then the ${metricLabelNoun(metricExtras.length)} (${metricExtras.map(render).join(', then ')})`;};const extraCreateClauseGh = extraCreateClause(- (name) => `\`gh label create ${name} --description "${labelDescription}" --force\``+ (name) => `\`gh label create ${name} --color 0366D6 --description "${labelDescription}" 2>/dev/null || true\``);const extraCreateClauseGlab = extraCreateClause((name) => `\`glab label create --name ${name} --color "#0366D6" --description "${labelDescription}" 2>/dev/null || true\``@@ -347,36 +348,52 @@ export function formatTrackerInstructions(tracker, options = {}) {github: `This app tracks autonomous work in **GitHub Issues** (via the \`gh\` CLI), NOT PLAN.md — do NOT edit PLAN.md.-- **Inventory:** From {repoPath}, resolve the repo (\`gh repo view --json nameWithOwner -q .nameWithOwner\`) and list existing ${label} issues so you don't duplicate: \`gh issue list --state all --search "${slugStem} in:title" --limit 100 --json number,title\`. Each carries a \`[${slugPrefix}…]\` slug in its title — collect them. If \`gh\` is not authenticated or the remote is not GitHub, exit cleanly.-- **Record** each NEW proposal as a GitHub issue. Do not relabel or edit an existing issue you skipped as a duplicate. Keep the \`[<slug>]\` inventory tag in the title so later runs can de-duplicate; do NOT add \`[category]\` / \`[SEVERITY]\` / \`[model:…]\` / \`[effort:…]\` prefixes (those belong in labels).- 1. Ensure each label you will apply exists. Create the category label first (\`gh label create ${issueLabel} --description "${labelDescription}" --force\`)${extraCreateClauseGh} and \`gh label create plan --description "Tracked by /do:replan" --force\`. ${dispatchLabelCreateWording}+- **Inventory:** From {repoPath}, resolve the repo (\`gh repo view --json nameWithOwner -q .nameWithOwner\`) and read the open-issue inventory: \`gh issue list --state open --limit 500 --json number,title,body,labels --jq '.'\`. De-duplicate by matching file path/symbol or an equivalent title across the inventory, regardless of labels. Recognize a prior \`${legacyTitleTag}\` title tag as a legacy marker only. If \`gh\` is not authenticated or the remote is not GitHub, exit cleanly.+- **Record** each NEW proposal as a GitHub issue with a short, human-readable title. The issue number is its ID: do not add an id, slug, category, or severity prefix to the title. Do not relabel or edit an existing issue you skipped as a duplicate.+ 1. Immediately before the first issue that uses each missing label, create it idempotently and preserve any existing label: \`gh label create ${issueLabel} --color 0366D6 --description "${labelDescription}" 2>/dev/null || true\`${extraCreateClauseGh}; create \`plan\` the same way with color \`428BCA\` and description \`Tracked by /do:replan\`. Do not use \`--force\`.2. ${dispatchGuidance.split('\n').join('\n ')}${forgeLabelContract}- ${forgeFileStep} File with repeated \`--label\` flags so the category/scope labels stay intact:+ ${forgeFileStep} File with repeated \`--label\` flags so the category/scope labels stay intact. Put a multiline or shell-special body in a temporary file, capture the URL printed by \`gh issue create\`, and derive the number from that URL — do not request JSON output from issue creation:\`\`\`bash- gh issue create --title "[<slug>] <Short title>" ${forgeCategoryFlags} ${forgeLabelFlags} --body "<body>"+ TITLE="<short human-readable title>"+ BODY_FILE="$(mktemp)"+ trap 'rm -f "$BODY_FILE"' EXIT+ cat >"$BODY_FILE" <<'EOF'+ <problem, impact, decided fix, and acceptance criteria>+ EOF+ URL="$(gh issue create --title "$TITLE" ${forgeCategoryFlags} ${forgeLabelFlags} --body-file "$BODY_FILE")"+ NUM="\${URL##*/}"+ printf '%s -> #%s\\n' "$TITLE" "$NUM"\`\`\`The body must contain ${bodyRequirements}. For **Maybe — needs human call** items, also add \`--label needs-decision\` (create it the same way if absent) and end the body with \`**Decision needed:** <one sentence>.\`.-- **Finalize:** No source-code edits, no PLAN.md, no branches, no PRs — the issues ARE the deliverable. \`/claim --issues\` (the \`claim-issue\` flow) picks them up later.`,+- **Finalize:** No source-code edits, no PLAN.md, no branches, no PRs — the issues ARE the deliverable. Report created and reused issue numbers. \`/claim --issues\` (the \`claim-issue\` flow) picks them up later.`,gitlab: `This app tracks autonomous work in **GitLab Issues** (via the \`glab\` CLI), NOT PLAN.md — do NOT edit PLAN.md.-- **Inventory:** From {repoPath}, confirm the forge (\`glab repo view\`) and list existing ${label} issues so you don't duplicate: \`glab issue list --label ${issueLabel} --per-page 100 --output json\` (also scan titles for the \`[${slugPrefix}…]\` slug). Collect the existing slugs. If \`glab\` is not authenticated or the remote is not GitLab, exit cleanly.-- **Record** each NEW proposal as a GitLab issue. Do not relabel or edit an existing issue you skipped as a duplicate. Keep the \`[<slug>]\` inventory tag in the title so later runs can de-duplicate; do NOT add \`[category]\` / \`[SEVERITY]\` / \`[model:…]\` / \`[effort:…]\` prefixes (those belong in labels).- 1. Ensure each label you will apply exists. Create the category label first (\`glab label create --name ${issueLabel} --color "#0366D6" --description "${labelDescription}" 2>/dev/null || true\`)${extraCreateClauseGlab} and the same for \`plan\`. ${dispatchLabelCreateWording} (glab needs \`--name\` and \`#<hex>\`).+- **Inventory:** From {repoPath}, confirm the forge (\`glab repo view\`) and read the open-issue inventory: \`glab issue list --state opened --per-page 100 -F json\`. De-duplicate by matching file path/symbol or an equivalent title across the inventory, regardless of labels. Recognize a prior \`${legacyTitleTag}\` title tag as a legacy marker only. If \`glab\` is not authenticated or the remote is not GitLab, exit cleanly.+- **Record** each NEW proposal as a GitLab issue with a short, human-readable title. The issue number is its ID: do not add an id, slug, category, or severity prefix to the title. Do not relabel or edit an existing issue you skipped as a duplicate.+ 1. Immediately before the first issue that uses each missing label, create it idempotently and preserve any existing label: \`glab label create --name ${issueLabel} --color "#0366D6" --description "${labelDescription}" 2>/dev/null || true\`${extraCreateClauseGlab}; create \`plan\` the same way with color \`#428BCA\`. ${dispatchLabelCreateWording} (glab needs \`--name\` and \`#<hex>\`).2. ${dispatchGuidance.split('\n').join('\n ')}${forgeLabelContract}- ${forgeFileStep} File with repeated \`--label\` flags so the category/scope labels stay intact:+ ${forgeFileStep} File with repeated \`--label\` flags so the category/scope labels stay intact. For a multiline description, write the body to a temporary file and pass its contents as one quoted argument:\`\`\`bash- glab issue create --title "[<slug>] <Short title>" ${forgeCategoryFlags} ${forgeLabelFlagsGlab} --description "<body>"+ TITLE="<short human-readable title>"+ BODY_FILE="$(mktemp)"+ trap 'rm -f "$BODY_FILE"' EXIT+ cat >"$BODY_FILE" <<'EOF'+ <problem, impact, decided fix, and acceptance criteria>+ EOF+ URL="$(glab issue create --title "$TITLE" ${forgeCategoryFlags} ${forgeLabelFlagsGlab} --description "$(cat "$BODY_FILE")")"+ NUM="\${URL##*/}"+ printf '%s -> #%s\\n' "$TITLE" "$NUM"\`\`\`(Run \`glab issue create --help\` if a flag is rejected — glab's flags evolve.) The body must contain ${bodyRequirements}. For **Maybe — needs human call** items, also add \`--label needs-decision\` and end the body with \`**Decision needed:** <one sentence>.\`.-- **Finalize:** No source-code edits, no PLAN.md, no branches, no MRs — the issues ARE the deliverable. \`/claim --issues\` (the \`claim-issue-gitlab\` flow) picks them up later.`,+- **Finalize:** No source-code edits, no PLAN.md, no branches, no MRs — the issues ARE the deliverable. Report created and reused issue numbers. \`/claim --issues\` (the \`claim-issue-gitlab\` flow) picks them up later.`,jira: `This app tracks autonomous work in **JIRA**. Create one JIRA issue per proposal in the app's configured project using whatever JIRA CLI/REST this environment provides. **If no JIRA credentials are available, fall back to recording proposals in PLAN.md at {repoPath} (slug-tagged \`- [ ] [<slug>] …\` checklist items under \`## Next Up\`, committed) and say so in your final summary.**-- **Inventory:** Search existing JIRA issues (and PLAN.md, if you fall back) for the \`[${slugPrefix}…]\` slug so you don't duplicate; collect the existing slugs.-- **Record** each NEW proposal as a JIRA issue whose summary starts with the \`[<slug>]\` tag. Do not relabel a ticket you skipped as a duplicate. The description must contain ${bodyRequirements}. Apply the category label \`${issueLabel}\`${extraJiraLabels} ${jiraDispatchLabelWording}+- **Inventory:** Search open JIRA issues in the configured project by file path/symbol or equivalent title, regardless of labels. Recognize a prior \`${legacyTitleTag}\` summary tag as a legacy marker only; collect the issue keys/numbers, not invented slugs.+- **Record** each NEW proposal as a JIRA issue with a short, human-readable summary. The JIRA key is its ID: do not add an id, slug, category, or severity prefix. Do not relabel a ticket you skipped as a duplicate. The description must contain ${bodyRequirements}. Apply the category label \`${issueLabel}\`${extraJiraLabels} ${jiraDispatchLabelWording}${jiraDispatchGuidance.split('\n').join('\n ')}${jiraLabelContract}For **Maybe — needs human call** items, end the description with \`**Decision needed:** <one sentence>.\`.diff --git a/server/lib/workTracker.trackerInstructions.test.js b/server/lib/workTracker.trackerInstructions.test.jsindex 65e8dfe5ab..a6c5d38115 100644--- a/server/lib/workTracker.trackerInstructions.test.js+++ b/server/lib/workTracker.trackerInstructions.test.js@@ -84,11 +84,18 @@ describe('formatTrackerInstructions — forge dispatch hints (#4351)', () => {it('teaches GitHub to create labels lazily and apply independent model/effort hints', () => {const github = formatTrackerInstructions('github', REF_WATCH);expectForgeDispatchContract(github, { cli: 'gh', issueLabel: 'reference-watch' });- expect(github).toContain('--search "ref-watch in:title"');+ expect(github).toContain('gh issue list --state open --limit 500 --json number,title,body,labels');+ expect(github).toContain('legacy marker only');+ expect(github).toContain('The issue number is its ID');+ expect(github).toContain('gh issue create --title "$TITLE"');+ expect(github).toContain('--body-file "$BODY_FILE"');+ expect(github).toContain('URL="$(gh issue create');+ expect(github).not.toContain('--search');+ expect(github).not.toContain('[<slug>]');expect(github).toContain('Reference-watch complete-label contract (mandatory)');expect(github).not.toContain('[--label model:<tier>]');expect(github).not.toContain('[--label effort:<level>]');- expect(github).toContain('create each required dispatch-hint label');+ expect(github).toContain('Create each label immediately before applying it');expect(formatTrackerInstructions('github')).toBe(github);expect(formatTrackerInstructions('github', TRACKER_FILING_PRESETS['reference-watch'])).toBe(github);});@@ -96,7 +103,13 @@ describe('formatTrackerInstructions — forge dispatch hints (#4351)', () => {it('teaches GitLab the same contract with glab flags', () => {const gitlab = formatTrackerInstructions('gitlab', REF_WATCH);expectForgeDispatchContract(gitlab, { cli: 'glab', issueLabel: 'reference-watch' });- expect(gitlab).toContain('glab issue list --label reference-watch');+ expect(gitlab).toContain('glab issue list --state opened --per-page 100 -F json');+ expect(gitlab).toContain('glab issue create --title "$TITLE"');+ expect(gitlab).toContain('--description "$(cat "$BODY_FILE")"');+ expect(gitlab).toContain('URL="$(glab issue create');+ expect(gitlab).toContain('NUM="${URL##*/}"');+ expect(gitlab).not.toContain('--force');+ expect(gitlab).not.toContain('[<slug>]');expect(gitlab).toContain('Reference-watch complete-label contract (mandatory)');expect(formatTrackerInstructions('gitlab')).toBe(gitlab);});@@ -111,11 +124,13 @@ describe('formatTrackerInstructions — forge dispatch hints (#4351)', () => {expect(jira).toContain('Do not relabel a ticket you skipped as a duplicate');expect(jira).toContain('Issue-quality gate');expect(jira).toContain('fall back to recording proposals in PLAN.md');+ expect(jira).toContain('short, human-readable summary');+ expect(jira).toContain('legacy marker only');expect(formatTrackerInstructions('jira')).toBe(jira);});});-describe('formatTrackerInstructions — metric labels beside the slug', () => {+describe('formatTrackerInstructions — metric labels beside the category', () => {it('formats category + metric + plan as repeated --label flags', () => {expect(formatForgeCategoryLabelFlags('code-quality', ['cognitive-load'])).toBe('--label code-quality --label cognitive-load --label plan');@@ -123,11 +138,13 @@ describe('formatTrackerInstructions — metric labels beside the slug', () => {expect(formatForgeCategoryLabelFlags('ux', ['ux'])).toBe('--label ux --label plan');});- it('applies the slug-stem metric as a second forge label when it differs from the category', () => {+ it('applies the metric label as a second forge label when it differs from the category', () => {const preset = getAuditFilingPreset('better-cognitive-load');const github = formatTrackerInstructions('github', preset);expect(github).toContain('--label code-quality --label cognitive-load --label plan');- expect(github).toContain('gh label create cognitive-load --description "Proposed from a cognitive-load/readability audit" --force');+ expect(github).toContain('gh label create cognitive-load --color 0366D6 --description "Proposed from a cognitive-load/readability audit" 2>/dev/null || true');+ expect(github).not.toMatch(/gh label create [^`\n]*--force/);+ expect(github).not.toContain('[<slug>]');expect(formatTrackerInstructions('gitlab', preset)).toContain('--label code-quality --label cognitive-load --label plan');expect(formatTrackerInstructions('jira', preset)).toContain('and the metric label `cognitive-load`');});@@ -143,21 +160,25 @@ describe('formatTrackerInstructions — metric labels beside the slug', () => {describe('formatTrackerInstructions — ux preset (#3273)', () => {const ux = TRACKER_FILING_PRESETS.ux;- it('carries the ux slug prefix + label into every tracker block', () => {- for (const tracker of ['plan', 'github', 'gitlab', 'jira']) {+ it('keeps the plan id and reads old forge title tags without minting new ones', () => {+ expect(formatTrackerInstructions('plan', ux)).toContain('[ux-…]');+ for (const tracker of ['github', 'gitlab']) {const block = formatTrackerInstructions(tracker, ux);- expect(block).toContain('[ux-…]');- expect(block).not.toContain('ref-watch');- expect(block).not.toContain('reference-watch');+ expect(block).toContain('legacy marker only');+ expect(block).not.toMatch(/--title "\[[^\"]+\]/);}+ const jira = formatTrackerInstructions('jira', ux);+ expect(jira).toContain('short, human-readable summary');+ expect(jira).toContain('The JIRA key is its ID');});- it('labels filed forge issues `ux` (and `plan`) and searches titles by the slug stem', () => {+ it('labels filed forge issues `ux` (and `plan`) while issue numbers remain their ids', () => {const github = formatTrackerInstructions('github', ux);- expect(github).toContain('gh label create ux --description "Proposed from a UX/design audit" --force');+ expect(github).toContain('gh label create ux --color 0366D6 --description "Proposed from a UX/design audit" 2>/dev/null || true');expect(github).toContain(`--label ux --label plan ${formatOptionalIssueLabelFlags('--label model:<tier> --label effort:<level>')}`);- expect(github).toContain('--search "ux in:title"');- expect(formatTrackerInstructions('gitlab', ux)).toContain('glab issue list --label ux');+ expect(github).toContain('The issue number is its ID');+ expect(github).not.toContain('--search');+ expect(formatTrackerInstructions('gitlab', ux)).toContain('glab issue list --state opened');expect(formatTrackerInstructions('gitlab', ux)).toContain('--label ux --label plan');});@@ -214,6 +235,13 @@ describe('formatTrackerInstructions — ux preset (#3273)', () => {expect(rendered, taskType).toContain('exactly one `model:` and exactly one `effort:`');expect(rendered, taskType).toContain('--label model:<tier> --label effort:<level>');expect(rendered, taskType).not.toContain('[--label model:<tier>]');+ if (taskType.startsWith('better-')) {+ expect(rendered, taskType).toContain('read the open-issue inventory');+ expect(rendered, taskType).toContain('gh issue create --title "$TITLE"');+ expect(rendered, taskType).toContain('--body-file "$BODY_FILE"');+ expect(rendered, taskType).not.toContain('[<slug>]');+ expect(rendered, taskType).not.toContain('--search');+ }}expect(rendered.match(/\{[a-zA-Z][a-zA-Z0-9_]*\}/g),@@ -260,22 +288,26 @@ describe('resolveTrackerFilingBlock — fileIssues audit types', () => {describe('formatTrackerInstructions — plan-feature preset', () => {const planFeature = TRACKER_FILING_PRESETS['plan-feature'];- it('carries the plan-feature slug prefix + label into every tracker block', () => {- for (const tracker of ['plan', 'github', 'gitlab', 'jira']) {+ it('keeps plan ids and limits prior issue tags to de-duplication', () => {+ expect(formatTrackerInstructions('plan', planFeature)).toContain('[plan-feature-…]');+ for (const tracker of ['github', 'gitlab']) {const block = formatTrackerInstructions(tracker, planFeature);- expect(block).toContain('[plan-feature-…]');- expect(block).not.toContain('ref-watch');- expect(block).not.toContain('[ux-…]');+ expect(block).toContain('legacy marker only');+ expect(block).not.toMatch(/--title "\[[^\"]+\]/);}+ const jira = formatTrackerInstructions('jira', planFeature);+ expect(jira).toContain('short, human-readable summary');+ expect(jira).toContain('The JIRA key is its ID');});- it('labels filed forge issues `plan-feature` (+ `plan`) and dedupes by the slug stem', () => {+ it('labels filed forge issues `plan-feature` (+ `plan`) and preserves existing labels', () => {const github = formatTrackerInstructions('github', planFeature);- expect(github).toContain('gh label create plan-feature --description "Feature plan filed by the plan-feature brainstorm" --force');+ expect(github).toContain('gh label create plan-feature --color 0366D6 --description "Feature plan filed by the plan-feature brainstorm" 2>/dev/null || true');expect(github).toContain('--label plan-feature --label plan');- expect(github).toContain('--search "plan-feature in:title"');+ expect(github).not.toMatch(/gh label create [^`\n]*--force/);+ expect(github).not.toContain('--search');const gitlab = formatTrackerInstructions('gitlab', planFeature);- expect(gitlab).toContain('glab issue list --label plan-feature');+ expect(gitlab).toContain('glab issue list --state opened');expect(gitlab).toContain('--label plan-feature --label plan');});diff --git a/server/routes/referenceRepos.js b/server/routes/referenceRepos.jsindex 1a9244b646..43d1841eb7 100644--- a/server/routes/referenceRepos.js+++ b/server/routes/referenceRepos.js@@ -4,9 +4,10 @@* Per-app management of upstream repos we borrow code from. The* `reference-watch` scheduled task uses `checkReferenceRepo` to find* commits since each ref's `lastReviewedSha`, then dispatches a CoS- * sub-agent that records slug-tagged `[ref-watch-…]` proposals in the- * app's CONFIGURED work tracker (PLAN.md / GitHub / GitLab / JIRA) for- * `/claim` / `plan-task` / `claim-issue*` to pick up.+ * sub-agent that records proposals in the app's CONFIGURED work tracker+ * (PLAN.md / GitHub / GitLab / JIRA) for `/claim` / `plan-task` /+ * `claim-issue*` to pick up. PLAN.md keeps checklist IDs; forge issues use+ * human-readable titles and their issue number/key as the ID.** Mounted at /api/apps/:appId/reference-repos so it sits next to the* existing apps API surface.diff --git a/server/services/cosTaskGenerator.referenceWatch.test.js b/server/services/cosTaskGenerator.referenceWatch.test.jsindex a3e4c54ffe..405b4b873c 100644--- a/server/services/cosTaskGenerator.referenceWatch.test.js+++ b/server/services/cosTaskGenerator.referenceWatch.test.js@@ -204,8 +204,12 @@ describe('scheduled ux prompt assembly (#3273)', () => {const task = await generateUx(app);expect(task).not.toBeNull();expect(task.description).not.toContain('{trackerInstructions}');- // ux wording, not reference-watch's.- expect(task.description).toContain('[ux-…]');+ // The old UX marker is compatibility-only; new forge titles use the shared+ // human-readable issue-ID contract.+ expect(task.description).toContain('legacy marker only');+ expect(task.description).toContain('short, human-readable title');+ expect(task.description).not.toContain('[<slug>]');+ expect(task.description).not.toContain('--search');expect(task.description).toContain('gh label create ux');expect(task.description).not.toContain('ref-watch');// Ordering guard: {trackerInstructions} expands BEFORE {appName}/{repoPath}.@@ -262,8 +266,12 @@ describe('scheduled plan-feature prompt assembly', () => {const task = await generatePlanFeature(app);expect(task).not.toBeNull();expect(task.description).not.toContain('{trackerInstructions}');- // plan-feature wording, not reference-watch's.- expect(task.description).toContain('[plan-feature-…]');+ // The old plan-feature marker is compatibility-only; new forge titles use+ // the shared human-readable issue-ID contract.+ expect(task.description).toContain('legacy marker only');+ expect(task.description).toContain('short, human-readable title');+ expect(task.description).not.toContain('[<slug>]');+ expect(task.description).not.toContain('--search');expect(task.description).toContain('gh label create plan-feature');expect(task.description).not.toContain('ref-watch');// Ordering guard: {trackerInstructions} expands BEFORE {appName}/{repoPath}.diff --git a/server/services/referenceRepos.js b/server/services/referenceRepos.jsindex 205f66a075..c58e31bed3 100644--- a/server/services/referenceRepos.js+++ b/server/services/referenceRepos.js@@ -8,10 +8,11 @@* (e.g., PortOS itself watches `phosphene` for video-gen ideas). The* `reference-watch` scheduled task asks this service to fetch each ref* and find commits since `lastReviewedSha`. The CoS sub-agent then records- * slug-tagged `[ref-watch-…]` proposals in the target app's CONFIGURED work- * tracker — PLAN.md, GitHub Issues, GitLab Issues, or JIRA (resolved via- * `resolveAppWorkTracker`) — which `/claim` / `plan-task` / `claim-issue*`- * picks up later. The destination-specific guidance is injected into the+ * proposals in the target app's CONFIGURED work tracker — PLAN.md, GitHub+ * Issues, GitLab Issues, or JIRA (resolved via `resolveAppWorkTracker`). PLAN.md+ * keeps its checklist IDs; forge titles are human-readable and use the issue+ * number/key as the ID. `/claim` / `plan-task` / `claim-issue*` picks up later.+ * The destination-specific guidance is injected into the* prompt's `{trackerInstructions}` block by BOTH dispatch paths —* `triggerReferenceAnalysis` here (the on-commit trigger) and* `resolveReferenceWatchBlock` in cosTaskPreStepBlocks.js (the WEEKLY scheduled@@ -707,10 +708,10 @@ export async function triggerReferenceAnalysis(app, ref, snapshot) {// Resolved work tracker the prompt told the agent to file proposals into// (PLAN.md / GitHub / GitLab / JIRA) — recorded for traceability.workTracker: workTracker.resolved,- // The reference-watch prompt v3 instructs the agent to record proposals in- // the resolved tracker: the PLAN.md path APPENDS slug-tagged checklist- // items (and commits); the GitHub/GitLab paths shell out to `gh`/`glab- // issue create`. readOnly:true would inject the "do not modify or commit+ // The reference-watch prompt v4 instructs the agent to record proposals in+ // the resolved tracker: PLAN.md commits checklist items; GitHub/GitLab+ // use plain issue titles and the shared `gh`/`glab` filing instructions.+ // readOnly:true would inject the "do not modify or commit// files" guard into the system prompt and the agent would refuse to// write/commit/shell — defeating the whole flow. Mark writable.readOnly: false,diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.jsindex 0e9850f47f..f4ec9d3ca7 100644--- a/server/services/taskPromptDefaults.test.js+++ b/server/services/taskPromptDefaults.test.js@@ -59,6 +59,29 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(SNAPSHOT.PREVIOUS_DEFAULT_PROMPTS).not.toHaveProperty('react-lifecycle');});+ it('reference-watch leaves tracker IDs and filing mechanics to the shared tracker block', () => {+ const current = DEFAULT_TASK_PROMPTS['reference-watch'];++ expect(PROMPT_VERSIONS['reference-watch']).toBe(4);+ expect(current).toContain('{trackerInstructions}');+ expect(current).toContain('compare the upstream repository and commit SHA(s)');+ expect(current).toContain('The issue number or key is its');+ expect(current).toContain('PLAN.md keeps the');+ expect(current).not.toContain('[ref-watch-…]');+ expect(current).not.toContain('A slug-tagged title');+ expect(current).not.toContain('gh issue create');+ });++ it('ux filings use tracker IDs instead of title slugs', () => {+ const current = DEFAULT_TASK_PROMPTS.ux;++ expect(PROMPT_VERSIONS.ux).toBe(4);+ expect(current).toContain('{trackerInstructions}');+ expect(current).toContain('short, human-readable title');+ expect(current).not.toContain('[ux-…]');+ expect(current).not.toContain('slug-tagged title');+ });+it('module-hygiene v1 is generic, evidence-led, and bounded', () => {const current = DEFAULT_TASK_PROMPTS['module-hygiene'];@@ -116,10 +139,10 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(current).toContain('line number, column, byte offset');});- // Each `better-*` lane mirrors one slashdo do:better audit lens. The bodies- // are what make them worth scheduling separately, so each is pinned to the- // discipline that distinguishes it from its neighbors — a counted metric, a- // proof obligation, or an explicit hand-off — rather than to prose.+ // Each PortOS-owned `better-*` mission has a focused discipline that justifies+ // scheduling it separately. Pin its distinction from neighboring missions —+ // a counted metric, a proof obligation, or an explicit hand-off — rather than+ // duplicating slashdo's orchestration and tracker-filing workflow.it.each([['better-complexity', ['1 + the number of independent decision points', 'Length is not complexity', 'Name the transformation', 'Behavior preservation is the contract']],['better-cognitive-load', ['reader cost', 'Flag arguments', 'Action at a distance', 'are not your findings']],@@ -264,10 +287,11 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(PROMPT_VERSIONS['feature-ideas']).toBe(11);});- // plan-feature v5: omitted optional preloads fall back to direct inventory.- it('plan-feature v5 handles omitted preloads', () => {+ // plan-feature v6 uses tracker-defined IDs, and v5's omitted optional preloads+ // still fall back to direct inventory.+ it('plan-feature v6 handles omitted preloads and plain forge titles', () => {const current = DEFAULT_TASK_PROMPTS['plan-feature'];- expect(PROMPT_VERSIONS['plan-feature']).toBe(5);+ expect(PROMPT_VERSIONS['plan-feature']).toBe(6);expect(current).toContain('Preloaded task data');expect(current).toContain('do NOT list it again');expect(current).toContain('corresponding section that is absent');@@ -280,6 +304,9 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(current).toContain('AGENTS.md');expect(current).not.toContain('REJECTED.md');expect(current).not.toContain('ALSO read PLAN.md');+ expect(current).toContain('short, human-readable title');+ expect(current).not.toContain('[plan-feature-…]');+ expect(current).not.toContain('slug-tagged title');});it('do-replan v2 rejects future-only proposals', () => {diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex 916db18c4c..c98d6c0c15 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -32,7 +32,7 @@"module-hygiene": "3b7671cd44f719d4b2116b96a279e6d0","observability": "fdb4d77df5891cfb653a5da2553ecf8a","performance": "b69bf4cbd2b3c272b5650608c62cede3",- "plan-feature": "87f71a894757f89354da4e2119e07118",+ "plan-feature": "7f859397ff16889ffc0cf5a8ba6bddab","plan-task": "8a53a518714cc4029d751fdad92f9b05","plan-task-claim": "ff9ef899c1b0d13ae2f6d7e31c13a10f","pr-reviewer": "de9c295018df7c403a722a9ac2e780af",@@ -40,7 +40,7 @@"pr-reviewer-review": "a4b35a1dc44e03b3d0ecf1a4e1bae6df","pr-reviewer-security": "d1e99626b12939ee39ab38eaa7d23f59","pr-watcher": "5246968aa90bb2bbf7957dcd9ae13a51",- "reference-watch": "e0e20754700fb08d5159b8437d9c260b",+ "reference-watch": "57221102b6245d40852ac258fbf9ebbf","refresh-local-llm-catalog": "9741ca6a8419fcdea2743e3b64781a8b","release-check": "cd936b9a4fb76273b36ec54c3ed6d5ba","repo-sync": "0a648d35d43b023b758226b9c709c8ea",@@ -52,7 +52,7 @@"ui-bugs": "073bea13a94b0266c53b5f55bb2344b9","ui-lifecycle": "d2eaa653e57897d3fb8b6c52c2c18e38","user-action-review": "1a083430e43f60cdd586cfffbdebc583",- "ux": "b8c0bde4075685625443a405b2c70b50"+ "ux": "f90b5f38a7c6264e0d40919a2933ba4c"},"PROMPT_VERSIONS": {"accessibility": 5,@@ -86,11 +86,11 @@"module-hygiene": 1,"observability": 1,"performance": 4,- "plan-feature": 5,+ "plan-feature": 6,"plan-task": 19,"pr-reviewer": 5,"pr-watcher": 2,- "reference-watch": 3,+ "reference-watch": 4,"refresh-local-llm-catalog": 4,"release-check": 14,"repo-sync": 1,@@ -102,9 +102,9 @@"ui-bugs": 3,"ui-lifecycle": 2,"user-action-review": 2,- "ux": 3+ "ux": 4},- "REFERENCE_WATCH_AUDITED_VERSION": 3,+ "REFERENCE_WATCH_AUDITED_VERSION": 4,"PREVIOUS_DEFAULT_PROMPTS": {"accessibility": ["ce7377d0ac57cbf0526074cfb95e3803",@@ -288,7 +288,8 @@"9fbc2a2ded8f4533d1f0f6b9cb780b34","a707866783fd0d8c1037489f23ff66de","b20980c8eda2256060d09d4bca397244",- "3df6f0a46f2a524af1dc4f83dfdf0647"+ "3df6f0a46f2a524af1dc4f83dfdf0647",+ "87f71a894757f89354da4e2119e07118"],"plan-task": ["4df36bed4974ff41f369c86828e7f94f",@@ -319,7 +320,8 @@],"reference-watch": ["f9322140bff7d3f603799c09ce468da9",- "722ca590fb4b6323c98850a176b9b309"+ "722ca590fb4b6323c98850a176b9b309",+ "e0e20754700fb08d5159b8437d9c260b"],"refresh-local-llm-catalog": ["525bd0077672bf2f8beec9c0124740c8",@@ -370,7 +372,8 @@],"ux": ["e03d03fc7c16faa5b5db93be2896b9ad",- "ac11f692eae40ffe8ddeaeaccbcf75e9"+ "ac11f692eae40ffe8ddeaeaccbcf75e9",+ "b8c0bde4075685625443a405b2c70b50"]}}diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex 40b521cc77..9988e3bd49 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -787,8 +787,9 @@ keyboard-inaccessible icon") — and file it as the UX finding, not as the a11y1. **Inventory existing findings so you don't duplicate.** Follow the"Inventory" step under "Where to record findings" above for this app's- tracker. Every prior UX finding carries a \`[ux-…]\` slug — collect the- existing slugs and skip any screen/problem pair already filed.+ tracker. De-duplicate by the route/screen and problem described in existing+ items; the tracker block defines their IDs. Older forge issues may have a+ legacy title tag, but new issue titles do not need one.2. **Discover the running app's UI URL** the same way the \`ui-bugs\` and\`mobile-responsive\` audits do — from the app's own config/README/dev-server@@ -832,10 +833,9 @@ keyboard-inaccessible icon") — and file it as the UX finding, not as the a11y5. **File ONE item per finding** using the "Record" mechanics under "Where torecord findings" above. Each finding must carry:- - **A slug-tagged title.** Lowercase kebab-case starting with \`ux-\`,- naming the screen and the problem (e.g.- \`ux-settings-save-below-fold-on-mobile\`); ≤80 chars total; unique against- every existing \`[ux-…]\` slug (re-check before each record).+ - **A short, human-readable title** naming the screen and the problem. Do+ not invent an issue ID or add a slug/category/severity tag to a forge+ title; follow the selected tracker's ID convention from its instructions.- **The screen/route** you audited and which checklist item (1–8) it failed.- **What the user is trying to do** on that screen.- **Why the current design impedes it** — 1–2 sentences, concrete and@@ -859,8 +859,8 @@ keyboard-inaccessible icon") — and file it as the UX finding, not as the a11ytracker items or in a change.7. Your final assistant message must be a 2–3 sentence summary of: how many- routes you audited, how many findings you filed (and their slugs), and which- checklist items came up most often.`,+ routes you audited, how many findings you filed (and their issue numbers or+ tracker IDs), and which checklist items came up most often.`,'data-safety': `[Improvement: {appName}] Data and upgrade-safety audit@@ -1683,8 +1683,9 @@ Repository: {repoPath}present, that section is a current snapshot collected immediately beforedispatch, so do NOT list it again. Follow the "Inventory" step under "Whereto record the plan" for any corresponding section that is absent, says it- could not be collected, or when you need a full issue body. Collect every- existing \`[plan-feature-…]\` slug, then skim+ could not be collected, or when you need a full issue body. De-duplicate+ against existing items by the feature need and approach; the tracker block+ defines how to identify and record each item. Then skimthe last 50 \`git log\` entries plus recent \`.changelog/\` files: an ideathat is already an open tracker item, in an open PR, or recently shipped workis NOT a candidate.@@ -1739,10 +1740,9 @@ Repository: {repoPath}4. **Write the decision-complete plan.** Every design choice is DECIDED, notraised as a question — make the call and state it. The filed item must carry:- - **A slug-tagged title.** Lowercase kebab-case starting with- \`plan-feature-\`, naming the feature (e.g.- \`plan-feature-export-universe-to-markdown\`); ≤80 chars total; unique- against every existing \`[plan-feature-…]\` slug (re-check before recording).+ - **A short, human-readable title** naming the feature. Do not invent an+ issue ID or add a slug/category/severity tag to a forge title; follow the+ selected tracker's ID convention from its instructions.- **Motivation** — which documented requirement, success criterion, goal, orevidenced user need this serves, 1–2 sentences.- **Approach** — the design you have decided on: the behavior to build, the@@ -1768,7 +1768,7 @@ Repository: {repoPath}No source edits, no branches, no PRs.8. Your final assistant message must be a 2–3 sentence summary of: the feature- you planned, where you filed it (item slug / issue number), and the one+ you planned, where you filed it (issue number/key or tracker ID), and the onedesign call you made that a reviewer is most likely to question.`,'plan-task': `[Plan Task: {appName}] Claim and ship next PLAN.md item@@ -3491,9 +3491,12 @@ Repository: {repoPath}## What to do1. **Inventory existing proposals so you don't duplicate.** Follow the- "Inventory" step under "Where to record proposals" above for this app's- tracker. Every prior reference-watch proposal carries a \`[ref-watch-…]\`- slug — collect the existing slugs and skip any commit already proposed.+ "Inventory" step under "Where to record proposals" above; it defines this+ tracker's IDs and duplicate matching. For reference-specific duplicates,+ compare the upstream repository and commit SHA(s) in prior titles/bodies and+ skip any commit already proposed. Older forge issues may have a bracketed+ legacy title tag; new issue titles do not need one. PLAN.md keeps the+ checklist IDs defined by the tracker instructions.2. For each reference above, for every commit in the "Commits to review"list, read its diff via \`git -C <source clone path> show <sha>\` (the@@ -3548,21 +3551,14 @@ Repository: {repoPath}proposal in the task tracker** using the "Record" mechanics under "Whereto record proposals" above. Each proposal must carry:- - **A slug-tagged title.** Lowercase kebab-case starting with- \`ref-watch-\` so the user can grep them in bulk; include a short- reference of the upstream repo so multiple watched refs don't collide- (e.g. \`ref-watch-phosphene-lazy-eval-env-bootstrap\`); ≤80 chars total;- unique against every existing \`[ref-watch-…]\` slug (re-check before- each record).- - **A short title sentence.**- - **Provenance:** From \`reference-watch\` review of <ref name>- (commit(s) \`<sha>\` [+ \`<sha>\` …], <today's date>).- - **1–2 sentences** on what bug/capability the commit addresses and why it- matters for {appName} tied to our notes.- - **A \`Fix:\` line** naming the specific files + functions in {appName}- to change (e.g. \`server/services/foo.js#buildArgs()\`) — describe the- BEHAVIOR to add, not upstream's exact code (clean-room reimplementation).- - **Estimated scope:** small / medium / large.+ - **A short, human-readable title.** Do not invent an issue ID or add a+ slug/category/severity tag to a forge title. The issue number or key is its+ ID; use the existing bracketed checklist-ID format only when the selected+ tracker is PLAN.md.+ - The selected tracker's **Record** requirements above, including+ provenance, rationale, the clean-room behavior to implement in {appName},+ files/functions, and estimated scope. Describe the behavior, never copy+ upstream code verbatim.For **Maybe — needs human call** items (real value but unclear fit, orgated on a decision/precondition), record the same proposal but end thediff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.jsindex 30c4200d57..04f25a91da 100644--- a/server/services/taskPromptDefaults/versions.js+++ b/server/services/taskPromptDefaults/versions.js@@ -19,14 +19,14 @@ export const PROMPT_VERSIONS = {'pr-reviewer': 5, // v4: model-abuse screen → tool-free eligibility gate → optional sandboxed review/actions'code-reviewer-a': 1, // v1: 2-stage pipeline (codebase review → triage & implement)'code-reviewer-b': 1, // v1: 2-stage pipeline (codebase review → triage & implement)- 'reference-watch': 3, // v3: record proposals in the app's RESOLVED work tracker (PLAN.md / GitHub / GitLab / JIRA) via the {trackerInstructions} block — no longer hardcodes PLAN.md, so an app configured for GitHub issues gets `gh issue create` proposals. v2: append slug-tagged checklist items to PLAN.md (Adopt + Maybe) instead of writing REFERENCE_REVIEW.md; security-flagged commits get no PLAN entry (mentioned only in final summary)+ 'reference-watch': 4, // v4: forge proposals use plain human-readable titles and tracker-defined IDs/filing scripts; PLAN.md keeps its existing checklist IDs. The prompt delegates inventory, duplicate matching, labels, and command syntax to {trackerInstructions}. v3: record proposals in the app's RESOLVED work tracker (PLAN.md / GitHub / GitLab / JIRA) via the {trackerInstructions} block — no longer hardcodes PLAN.md, so an app configured for GitHub issues gets `gh issue create` proposals. v2: append slug-tagged checklist items to PLAN.md (Adopt + Maybe) instead of writing REFERENCE_REVIEW.md; security-flagged commits get no PLAN entry (mentioned only in final summary)'pr-watcher': 2, // v1: review-and-comment default for newly-opened PRs on the app's default branch'branch-reconcile': 7, // v7: align SUPERSEDED summary instruction with deterministic cleanup pass; superseded branches with worktrees are reaped rather than held by the claim idle window. v6: prefixed labels are spelled with the forge separator — GitLab gets its scoped `::` (`model::heavy`), GitHub keeps `:` — matching slashdo v3.39.0. v5: explicit Ultra capability dispatch alongside the existing three tiers.// v4: the prompt now interpolates DISPATCH_HINT_FANOUT_GUIDANCE next to the "spawn one sub-agent per branch" instruction and tells the coordinator to dispatch each sub-agent at ITS OWN branch's recommended model/effort — the same per-issue routing the claim swarm's Phase B already does, applied here because branch-reconcile fans out over issue-derived branches too (#6373). v3: SUPERSEDED is a first-class outcome — a branch whose problem the default branch already solved a different way is reported and left untouched, never merged (merging it undoes shipped work). A resolvable conflict is explicitly NOT evidence the work is still wanted, and every branch is rebased + test-verified before it reaches a PR. v2: a branch whose "Do:" line ends in a merge isn't finished until it IS merged — the sub-agent waits CI out in-session instead of handing back a green-but-open PR, and the old blanket "never merge unreviewed work" rule (which vetoed the per-branch merge instruction) is replaced by the explicit CI-green + MERGEABLE + review gate. v1: per-app coordinator that finishes in-flight LOCAL branches (open PR / resolve conflicts / drive review / auto-merge) after the deterministic merged-branch cleanup pass. Peer-safe (local refs only). Replaced the PortOS-only branchReconcileScheduler.'issue-reconcile': 7, // v7: prefixed labels are spelled with the forge separator — GitLab gets its scoped `::` (`model::heavy`), GitHub keeps `:` — matching slashdo v3.39.0. Shared mandatory issue-label contract and restricted contributor invitations. v4: follow-up recipes apply independent slashdo dispatch hints and contributor labels (`good first issue`/`help wanted`, Jira hyphenated equivalents) instead of only `plan`. v3: adds a JIRA arm — status-based zombies (a ticket left In Review with remaining scope + no live claim; JIRA has no `in-progress` label) detected via the PortOS JIRA API and healed through ticket transitions + `POST tickets`, routed in via the app's resolved workTracker ('jira') rather than the git host. v2: forge-aware — the scan + coordinator now cover GitLab (`glab` issues + MRs) as well as GitHub, resolved from the app's origin host; every heal command is shown as gh/glab and the injected header names the forge. v1: per-app coordinator that heals ZOMBIE issues (open + in-progress but their PR merged with no live claim) after the deterministic gh/git scan. Applies the partial-ship hybrid — close + file a scoped follow-up when the remainder is separable, else comment "done/remaining" + release the claim so the queue re-picks it.'refresh-local-llm-catalog': 4, // v4: follows the current no-per-branch-changelog contract and relies on a release-note-quality commit subject. v3: catalog maintenance now preserves the primary-lane + cross-lane recommendation taxonomy and reserves featured treatment for a deliberate first choice. v2: PortOS-only task, so it names the retired fragment command directly. v1: research current local models, refresh LOCAL_LLM_CATALOG + EDITORIAL_FAMILY_RANK, PR (PortOS repo only)'user-action-review': 2, // v2: leftover-branch idle detector interpolates via {userActionDetectors}; empty-ledger skip is waived when detector findings exist; leftover findings are propose-only (never reconcile / Run Now). v1: install-wide review of the operator-action ledger (#5595) — query the last 7 days, group repetition by type + target, propose 1–5 automations delivered per {userActionDelivery} (tracker issues by default, queued CoS tasks when the operator flips fileIssues off); never mutates settings or schedule types, summarizes CoS prompts instead of pasting them, exits immediately on an empty log.- 'plan-feature': 5, // v5: absent optional preload sections explicitly fall back to normal inventory/source reads. v4: truncated/unreadable preloads explicitly allow a direct source read. v3: consumes programmatically preloaded PRD/GOALS/open-issue/open-PR/closed-unmerged-PR snapshots and explicitly avoids re-fetching them. v2: PRD.md is the primary product/evaluation source, GOALS.md supplements or falls back, and repository documentation is the best-effort fallback when neither exists. v1: net-new planning-only sibling of feature-ideas.+ 'plan-feature': 6, // v6: forge issues use plain human-readable titles and tracker-defined IDs; filing syntax/identity comes from {trackerInstructions}. v5: absent optional preload sections explicitly fall back to normal inventory/source reads. v4: truncated/unreadable preloads explicitly allow a direct source read. v3: consumes programmatically preloaded PRD/GOALS/open-issue/open-PR/closed-unmerged-PR snapshots and explicitly avoids re-fetching them. v2: PRD.md is the primary product/evaluation source, GOALS.md supplements or falls back, and repository documentation is the best-effort fallback when neither exists. v1: net-new planning-only sibling of feature-ideas.// Basic self-improvement tasks — versioned so installs created before the// Jan→Feb 2026 genericization (which still have the app-name-hardcoded "PortOS"@@ -34,7 +34,7 @@ export const PROMPT_VERSIONS = {// current {appName} body. See the retired-hash history in// integrity.snapshot.json + the self-heal in taskScheduleStore.js readSchedule().'security': 3, // v3: carries {modeInstructions} (the pre-v3 body had no placeholder, so its own "fix and commit" steps fought a file-issues dispatch) and defers to the project's documented threat model, requiring an attacker-or-accident story per finding instead of a generic OWASP checklist walk. Previously v2: generic {appName} body (older default hardcoded "PortOS"/"server/routes" paths)- 'code-quality': 4, // v4: hands generated-artifact/hand-synced-registry/layout-coupling drift to the better-structural-drift lane and counted branching + reader cost to better-complexity / better-cognitive-load, keeping conventional maintainability defects — the split the sibling do:better lenses made possible. Previously v3: inventory structural drift, duplicate sources of truth, volatile generated artifacts, and incidental-layout coupling before conventional maintainability checks. v2: generic {appName} body (older default hardcoded "PortOS")+ 'code-quality': 4, // v4: hands generated-artifact/hand-synced-registry/layout-coupling drift to the better-structural-drift lane and counted branching + reader cost to better-complexity / better-cognitive-load, keeping conventional maintainability defects — the split across PortOS's specialist tasks. Previously v3: inventory structural drift, duplicate sources of truth, volatile generated artifacts, and incidental-layout coupling before conventional maintainability checks. v2: generic {appName} body (older default hardcoded "PortOS")'test-coverage': 3, // v3: carries {modeInstructions}, ranks gaps by consequence rather than percentage, tests at the highest practical public boundary, requires naming the regression a new test uniquely catches, and hands existing-test quality to better-test-quality. Previously v2: generic {appName} body (older default hardcoded "PortOS")'performance': 4, // v4: requires UI route-load, idle-network and large-collection evidence; missing measurements are explicitly unverified.'accessibility': 5, // v5: the "skip what static analysis already covers" list now also names keyboard-trap/unreachable-control and faked-semantics findings, matching Biome's `useKeyWithClickEvents`, `noNoninteractiveElementToInteractiveRole`, `useFocusableInteractive`, and `noAriaHiddenOnFocusable` a11y rules (enabled in `client/biome.jsonc` alongside the four from v4) — the live-agent budget shifts further to focus-order/live-region/contrast/zoom issues static analysis still can't establish. Previously v4: checks for an existing JSX a11y linter (Biome's a11y group, jsx-a11y) first and skips findings it already catches deterministically (missing alt/labels, invalid/unsupported ARIA), so the live-agent budget goes to keyboard/focus/live-region/contrast/zoom issues static analysis can't establish. Previously v3: carries {modeInstructions}, names who is blocked and how far they get, and prefers a native element over a custom control with patched attributes. Previously v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)@@ -45,7 +45,7 @@ export const PROMPT_VERSIONS = {'documentation': 7, // v7: carries {modeInstructions} and ranks wrong documentation above missing documentation, verifying instructions against the code rather than trusting the prose. Previously 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': 3, // v3: carries {modeInstructions}, exits cleanly when the interface is unreachable instead of filing from imagination, and cedes layout/a11y/UX/copy to their owners. Previously v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)'mobile-responsive': 3, // v3: carries {modeInstructions} and requires the viewport width plus what a user cannot do there, rather than flagging any layout that merely looks different. Previously v2: generic {appName} app-UI body (older default hardcoded "PortOS" + http://localhost:5555)- 'ux': 3, // v3: audits narrow monitors and widget containers, including clipped overflow and sidebar/zoom states.+ 'ux': 4, // v4: forge issues use plain human-readable titles and tracker-defined IDs; filing syntax/identity comes from {trackerInstructions}. v3: audits narrow monitors and widget containers, including clipped overflow and sidebar/zoom states.// v2: replaces the hardcoded "Read-only on source / no branches, no PRs" paragraph with {modeInstructions} — the audit is registered as file-issues-capable, so a do-work dispatch previously got a mode banner that its own body contradicted in two places. Previously v1: walk the running UI with Playwright MCP against a 7-item named UX checklist and file ONE tracker item per finding via {trackerInstructions} — read-only on source, no branches/PRs. Mode (file-issues vs implement) is injected at dispatch via {modeInstructions} / applyAuditModeWrapper — no prompt bump required.'data-safety': 1, // v1: data/upgrade-safety audit (migrations, schema parity, version gates). Mode injected at dispatch.'simplify': 1, // v1: dead-code/duplication audit. Mode injected at dispatch.@@ -55,14 +55,12 @@ export const PROMPT_VERSIONS = {'observability': 1, // v1: logging/observability audit (silent catches, log noise, missing error context, uninstrumented pipelines). Net-new type. Mode injected at dispatch.'copy': 1, // v1: copy/text-clarity audit (jargon, ambiguous action verbs, dead-end errors, pluralization). Net-new type. Mode injected at dispatch.- // The `better-*` lanes: one scheduled task per slashdo `do:better` audit- // lens, so every category of app quality can be scheduled, provider-pinned,- // and toggled between filing and fixing on its own instead of being reachable- // only by fanning eight sub-agents out of one command run. The prefix marks- // the parity obligation — these bodies mirror an upstream lens- // (DO_BETTER_LENS_COVERAGE in lib/auditCatalog.js), so an improvement here is- // a candidate to push upstream rather than to diverge silently. Net-new types- // (no retired-hash history needed). Mode injected at dispatch.+ // The `better-*` lanes are PortOS-owned specialist missions associated with+ // generic slashdo `do:better` scopes through DO_BETTER_SCOPE_COVERAGE in+ // lib/auditCatalog.js. Their mission-specific checks stay here; orchestration,+ // mode handling, and tracker filing come from shared runtime contracts rather+ // than copied command mechanics. Net-new types (no retired-hash history+ // needed). Mode injected at dispatch.'better-complexity': 2, // v2: compare repository-wide worst offenders; low churn is not an exclusion. v1: counted branching per function, ranked by churn/fan-in, with a named transformation and a behavior-preservation contract.'better-cognitive-load': 1, // v1: reader cost (mixed abstraction, flag arguments, lying names, action at a distance) — explicitly NOT the size/nesting thresholds its siblings own.'better-structural-drift': 1, // v1: derived artifacts as a second source of truth, position-keyed records, hand-synced registries, incidental-layout coupling — carved out of code-quality v3.@@ -99,7 +97,7 @@ PROMPT_VERSIONS['claim-issue-jira'] = 20;// Audit anchor for reference-watch's read/write coupling.// The reference-watch schedule default (`taskMetadata.readOnly` in DEFAULT_TASK_INTERVALS)-// is derived from what the active prompt VERSION does: v3's prompt records proposals in the+// is derived from what the active prompt VERSION does: v4's prompt records proposals in the// app's resolved work tracker — the PLAN.md path appends + commits `[ref-watch-…]` items, and// the forge paths (GitHub/GitLab) shell out to `gh`/`glab issue create`. Both need a writable// agent (a read-only agent gets the "do not modify or commit files" guard and refuses), so the@@ -109,4 +107,4 @@ PROMPT_VERSIONS['claim-issue-jira'] = 20;// against. A guard test in taskSchedule.test.js fails when PROMPT_VERSIONS['reference-watch']// moves past this anchor — forcing whoever bumps the prompt to re-confirm the default still// matches the prompt's behavior and then advance this anchor in the same change. See issue #734.-export const REFERENCE_WATCH_AUDITED_VERSION = 3;+export const REFERENCE_WATCH_AUDITED_VERSION = 4;diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.jsindex 0d6cb9e524..b11c20dadc 100644--- a/server/services/taskSchedule.test.js+++ b/server/services/taskSchedule.test.js@@ -853,11 +853,11 @@ describe('taskSchedule', () => {expect(interval.enabled).toBe(false)})- it('reference-watch default is writable so the v3 prompt can record proposals (PLAN.md commit or gh/glab issue create)', async () => {- // The v3 reference-watch prompt records proposals in the app's resolved- // work tracker: the PLAN.md path appends slug-tagged checklist items and- // commits them; the GitHub/GitLab paths shell out to `gh`/`glab issue- // create`. Both need a writable agent — if `readOnly` flips back to true,+ it('reference-watch default is writable so the v4 prompt can record proposals (PLAN.md commit or gh/glab issue create)', async () => {+ // The v4 reference-watch prompt records proposals in the app's resolved+ // work tracker: PLAN.md commits its checklist items; GitHub/GitLab use+ // the shared `gh`/`glab` issue instructions. Both need a writable agent —+ // if `readOnly` flips back to true,// agentPromptBuilder injects the "## Read-Only Task" guard and the agent// refuses to write/commit/shell, silently breaking the flow. Pin the// contract so a future "default to read-only" refactor surfaces here.@@ -874,13 +874,13 @@ describe('taskSchedule', () => {expect(PROMPT_VERSIONS['reference-watch']).toBe(REFERENCE_WATCH_AUDITED_VERSION)})- it('reference-watch v3 prompt requires a writable default so it can record proposals (PLAN.md commit or gh/glab issue create) (issue #734)', () => {- // The coupling the audit anchor protects: at the audited version (v3), the prompt+ it('reference-watch v4 prompt requires a writable default so it can record proposals (PLAN.md commit or gh/glab issue create) (issue #734)', () => {+ // The coupling the audit anchor protects: at the audited version (v4), the prompt// writes to the resolved tracker (PLAN.md commit, or `gh`/`glab issue create`), so the// raw default must be writable. If a future re-audit flips// REFERENCE_WATCH_AUDITED_VERSION to a propose-only version, update this expectation// alongside the default and the anchor.- if (REFERENCE_WATCH_AUDITED_VERSION === 3) {+ if (REFERENCE_WATCH_AUDITED_VERSION === 4) {expect(DEFAULT_TASK_INTERVALS['reference-watch'].taskMetadata.readOnly).toBe(false)}})@@ -1766,7 +1766,8 @@ describe('taskSchedule', () => {const prompt = await getTaskPrompt('ux')// The tracker block is injected at dispatch, so the token must survive here.expect(prompt).toContain('{trackerInstructions}')- expect(prompt).toContain('[ux-…]')+ expect(prompt).toContain('short, human-readable title')+ expect(prompt).not.toContain('[ux-…]')// Read-only-on-source is carried by the injected mode banner, not restated// in the body. ux is a file-issues-CAPABLE audit that merely DEFAULTS to// filing, so a body that hardcoded "no branches, no PRs" contradicted thediff --git a/server/services/taskScheduleRegistry.js b/server/services/taskScheduleRegistry.jsindex 9d8c40d7a8..036813842b 100644--- a/server/services/taskScheduleRegistry.js+++ b/server/services/taskScheduleRegistry.js@@ -311,15 +311,13 @@ export const DEFAULT_TASK_INTERVALS = {// do-replan audits PLAN.md after open PRs and stale branches have been cleaned up,// so the plan reflects what actually merged.'do-replan': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, runAfter: ['pr-reviewer', 'branch-reconcile'], taskMetadata: { useWorktree: true, openPR: true } },- // Writable — the v2 reference-watch prompt (PROMPT_VERSIONS['reference-watch'] = 2)- // instructs the agent to APPEND slug-tagged `[ref-watch-…]` checklist items to- // PLAN.md and commit them. `readOnly: true` would inject the "do not modify or- // commit files" guard into the system prompt and the agent would refuse to write- // the PLAN entries — defeating the whole flow. Worktree off because the task body- // itself reads from data/cos/reference-repos (managed clones the user can't- // accidentally clobber) and the PLAN.md write is small enough that the in-place- // commit on the source repo is simpler than a worktree round-trip. Mirrors the- // on-commit trigger path in referenceRepos.js#triggerReferenceAnalysis.+ // Writable — the v4 reference-watch prompt records proposals through the+ // resolved tracker instructions: PLAN.md commits checklist items, while forge+ // trackers create issues. `readOnly: true` would inject the "do not modify or+ // commit files" guard and prevent both paths. Worktree off because the task+ // reads managed clones under data/cos/reference-repos and its PLAN.md write is+ // small enough to commit in place. Mirrors the on-commit trigger path in+ // referenceRepos.js#triggerReferenceAnalysis.// `readOnly` is coupled to PROMPT_VERSIONS['reference-watch'] — see// REFERENCE_WATCH_AUDITED_VERSION above; bumping the prompt version requires// re-auditing this default (a guard test in taskSchedule.test.js enforces it).