Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Add a file-issues vs implement toggle to scheduled CoS audits

[._.]/ Adam Eivyec2d1125c803
diff --git a/client/src/components/apps/tabs/AutomationTab.jsx b/client/src/components/apps/tabs/AutomationTab.jsx
index c390f74445..831a13ff67 100644
--- a/client/src/components/apps/tabs/AutomationTab.jsx
+++ b/client/src/components/apps/tabs/AutomationTab.jsx
@@ -313,10 +313,28 @@ export default function AutomationTab({ appId, appName }) {
</button>
) : null}
<div className="flex items-center gap-1 ml-auto">
+ {globalConfig.fileIssuesCapable && (() => {
+ const effective = override.taskMetadata?.fileIssues ?? globalConfig.taskMetadata?.fileIssues ?? globalConfig.defaultFileIssues === true;
+ const hasOverride = override.taskMetadata?.fileIssues !== undefined;
+ return (
+ <button
+ key="fileIssues"
+ onClick={() => handleMetaToggle(taskType, 'fileIssues', globalConfig.taskMetadata)}
+ aria-pressed={effective}
+ aria-label={`File issues only: ${effective ? 'on' : 'off'}${hasOverride ? ' (app override)' : ' (inherited)'}`}
+ className={`text-xs px-1.5 py-0.5 rounded transition-colors border ${agentOptionButtonClass(effective, hasOverride)}`}
+ title={`File issues only: ${effective ? 'on' : 'off'}${hasOverride ? ' (app override)' : ' (inherited)'}`}
+ >
+ Iss
+ </button>
+ );
+ })()}
{AGENT_OPTIONS.map(({ field, shortLabel, label }) => {
const effective = override.taskMetadata?.[field] ?? globalConfig.taskMetadata?.[field] ?? false;
const hasOverride = override.taskMetadata?.[field] !== undefined;
- const managed = globalConfig.managedAgentOptions?.includes(field);
+ const fileIssuesOn = (override.taskMetadata?.fileIssues ?? globalConfig.taskMetadata?.fileIssues ?? globalConfig.defaultFileIssues) === true;
+ const managed = globalConfig.managedAgentOptions?.includes(field)
+ || (globalConfig.fileIssuesCapable && fileIssuesOn && ['useWorktree', 'openPR', 'simplify'].includes(field));
const titleText = managed
? `${label}: managed internally by ${taskType}`
: `${label}: ${effective ? 'on' : 'off'}${hasOverride ? ' (app override)' : ' (inherited)'}`;
diff --git a/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx b/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx
index 935bf7dd3b..faf6921c3d 100644
--- a/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx
+++ b/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx
@@ -6,7 +6,7 @@ import { isCronExpression, describeCron } from '../../../../utils/cronHelpers';
import ToggleSwitch from '../../../ToggleSwitch';
import { INTERVAL_LABELS, setMetadataOverride } from './scheduleConstants';
-const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalIntervalType, globalTaskMetadata, managedAgentOptions, override, onUpdate }) {
+const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalIntervalType, globalTaskMetadata, managedAgentOptions, fileIssuesCapable, defaultFileIssues, override, onUpdate }) {
const [updating, setUpdating] = useState(false);
const [cronEditing, setCronEditing] = useState(false);
const isEnabled = override?.enabled === true;
@@ -43,7 +43,13 @@ const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalInter
const handleMetaToggle = async (field) => {
setUpdating(true);
- const taskMetadata = toggleAppMetadataOverride(override?.taskMetadata, globalTaskMetadata, field);
+ let taskMetadata = toggleAppMetadataOverride(override?.taskMetadata, globalTaskMetadata, field);
+ const nextFileIssues = field === 'fileIssues'
+ ? (taskMetadata?.fileIssues ?? globalTaskMetadata?.fileIssues ?? defaultFileIssues)
+ : null;
+ if (field === 'fileIssues' && nextFileIssues === true && taskMetadata) {
+ taskMetadata = { ...taskMetadata, useWorktree: false, openPR: false, simplify: false };
+ }
await onUpdate(app.id, taskType, { taskMetadata }).catch(() => {});
setUpdating(false);
};
@@ -114,10 +120,28 @@ const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalInter
</div>
<div className="flex items-center gap-1">
+ {fileIssuesCapable && (() => {
+ const effective = override?.taskMetadata?.fileIssues ?? globalTaskMetadata?.fileIssues ?? defaultFileIssues === true;
+ const hasOverride = override?.taskMetadata?.fileIssues !== undefined;
+ return (
+ <button
+ key="fileIssues"
+ onClick={() => handleMetaToggle('fileIssues')}
+ disabled={updating}
+ aria-pressed={effective}
+ aria-label={`File issues only: ${effective ? 'on' : 'off'}${hasOverride ? ' (app override)' : ' (inherited)'}`}
+ className={`text-xs px-2 py-1.5 rounded transition-colors shrink-0 min-h-[40px] min-w-[40px] border ${agentOptionButtonClass(effective, hasOverride)}`}
+ title={`File issues only: ${effective ? 'on' : 'off'}${hasOverride ? ' (app override)' : ' (inherited)'}`}
+ >
+ Iss
+ </button>
+ );
+ })()}
{AGENT_OPTIONS.map(({ field, label, shortLabel }) => {
const effective = override?.taskMetadata?.[field] ?? globalTaskMetadata?.[field] ?? false;
const hasOverride = override?.taskMetadata?.[field] !== undefined;
- const managed = managedAgentOptions?.includes(field);
+ const fileIssuesOn = (override?.taskMetadata?.fileIssues ?? globalTaskMetadata?.fileIssues ?? defaultFileIssues) === true;
+ const managed = managedAgentOptions?.includes(field) || (fileIssuesCapable && fileIssuesOn && ['useWorktree', 'openPR', 'simplify'].includes(field));
const titleText = managed
? `${label}: managed internally by ${taskType}`
: `${label}: ${effective ? 'on' : 'off'}${hasOverride ? ' (app override)' : ' (inherited)'}`;
diff --git a/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx b/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx
index 2f0cab909c..f65a5951c2 100644
--- a/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx
+++ b/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx
@@ -5,7 +5,14 @@ import AppOverrideRow from './AppOverrideRow';
const APP = { id: 'app-1', name: 'Acme' };
-function renderRow({ globalTaskMetadata = {}, override = null, onUpdate = vi.fn().mockResolvedValue(undefined), taskType = 'feature-ideas' } = {}) {
+function renderRow({
+ globalTaskMetadata = {},
+ override = null,
+ onUpdate = vi.fn().mockResolvedValue(undefined),
+ taskType = 'feature-ideas',
+ fileIssuesCapable,
+ defaultFileIssues,
+} = {}) {
render(
<AppOverrideRow
app={APP}
@@ -13,6 +20,8 @@ function renderRow({ globalTaskMetadata = {}, override = null, onUpdate = vi.fn(
globalIntervalType="daily"
globalTaskMetadata={globalTaskMetadata}
managedAgentOptions={[]}
+ fileIssuesCapable={fileIssuesCapable}
+ defaultFileIssues={defaultFileIssues}
override={override}
onUpdate={onUpdate}
/>
@@ -71,6 +80,28 @@ describe('AppOverrideRow — After opening PR override', () => {
});
});
+describe('AppOverrideRow — file issues only', () => {
+ it('shows the Iss toggle for audit-capable tasks and hides it otherwise', () => {
+ renderRow({ taskType: 'feature-ideas' });
+ expect(screen.queryByRole('button', { name: /File issues only/i })).not.toBeInTheDocument();
+ });
+
+ it('toggles fileIssues as a per-app override', async () => {
+ const onUpdate = renderRow({
+ taskType: 'security',
+ fileIssuesCapable: true,
+ defaultFileIssues: false,
+ globalTaskMetadata: { fileIssues: false },
+ });
+ await act(async () => {
+ fireEvent.click(screen.getByRole('button', { name: /File issues only/i }));
+ });
+ expect(onUpdate).toHaveBeenCalledWith('app-1', 'security', {
+ taskMetadata: { fileIssues: true, useWorktree: false, openPR: false, simplify: false },
+ });
+ });
+});
+
describe('AppOverrideRow — branch-reconcile batch size', () => {
it('allows an app to inherit or override the global branch batch', async () => {
const onUpdate = renderRow({
diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx
index d89510e49e..4d72b2f48a 100644
--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx
+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx
@@ -16,7 +16,7 @@ import { effectiveModelFor } from '../../../../utils/providers';
import EffortSelect from '../../EffortSelect';
import PromptEditor from './PromptEditor';
import RunTaskButton from './RunTaskButton';
-import { INTERVAL_DESCRIPTIONS, toggleMetadataField, pipelineStages, IMPROVEMENT_DISABLED_TITLE, SAVING_TITLE } from './scheduleConstants';
+import { INTERVAL_DESCRIPTIONS, toggleMetadataField, pipelineStages, IMPROVEMENT_DISABLED_TITLE, SAVING_TITLE, fileIssuesEffective, managedAgentOptionsFor, toggleFileIssuesMetadata } from './scheduleConstants';
// Shown for the unpinned ('' → inherit) choice: the task type is global, so the
// policy is whatever each target app configured, and PortOS's own self-improvement
@@ -468,12 +468,38 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTri
activeApps={activeApps}
/>
+ {config.fileIssuesCapable && (
+ <button
+ type="button"
+ disabled={updating}
+ aria-pressed={fileIssuesEffective(config)}
+ aria-label={fileIssuesEffective(config) ? 'File issues only (on)' : 'File issues only (off)'}
+ className={`w-full flex items-center justify-between gap-3 min-h-[44px] rounded px-2 -mx-2 text-left ${updating ? 'opacity-60 cursor-not-allowed' : 'cursor-pointer hover:bg-port-card/30 active:bg-port-card/50'}`}
+ onClick={async () => {
+ setUpdating(true);
+ await onUpdate(taskType, {
+ taskMetadata: toggleFileIssuesMetadata(config.taskMetadata, !fileIssuesEffective(config))
+ });
+ setUpdating(false);
+ }}
+ >
+ <div className="min-w-0 flex-1">
+ <span className="text-sm text-white">File issues only</span>
+ <p className="text-xs text-gray-500">
+ When on, the agent reads the code and files tracker issues — it does not change source.
+ When off, it implements the highest-value fix.
+ </p>
+ </div>
+ <ToggleSwitch enabled={fileIssuesEffective(config)} disabled={updating} decorative />
+ </button>
+ )}
+
<div>
<span className="text-sm text-gray-400 block mb-2">Agent Options</span>
<div className="space-y-2">
{AGENT_OPTIONS.map(({ field, label, description }) => {
const enabled = config.taskMetadata?.[field] ?? false;
- const managed = config.managedAgentOptions?.includes(field);
+ const managed = managedAgentOptionsFor(config).includes(field);
const lockedHint = `${label} is managed internally by this task — the agent's prompt handles it.`;
return (
<button
diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx
index 2d4d87b508..f84812f4c1 100644
--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx
+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx
@@ -32,11 +32,11 @@ const BASE_CONFIG = {
status: {},
};
-function renderControls({ taskMetadata, onUpdate = vi.fn(), taskType = 'feature-ideas' } = {}) {
+function renderControls({ taskMetadata, onUpdate = vi.fn(), taskType = 'feature-ideas', config: extraConfig = {} } = {}) {
render(
<GlobalConfigControls
taskType={taskType}
- config={{ ...BASE_CONFIG, taskMetadata }}
+ config={{ ...BASE_CONFIG, taskMetadata, ...extraConfig }}
onUpdate={onUpdate}
onTrigger={() => {}}
onReset={() => {}}
@@ -148,3 +148,22 @@ describe('GlobalConfigControls — branch-reconcile batch size', () => {
});
});
});
+
+describe('GlobalConfigControls — file issues only', () => {
+ it('is hidden for non-audit tasks', () => {
+ renderControls();
+ expect(screen.queryByRole('button', { name: /File issues only/i })).not.toBeInTheDocument();
+ });
+
+ it('toggles fileIssues and forces the no-code posture on', () => {
+ const onUpdate = renderControls({
+ taskType: 'security',
+ taskMetadata: { useWorktree: true, openPR: true, simplify: true, fileIssues: false },
+ config: { fileIssuesCapable: true, defaultFileIssues: false },
+ });
+ fireEvent.click(screen.getByRole('button', { name: /File issues only/i }));
+ expect(onUpdate).toHaveBeenCalledWith('security', {
+ taskMetadata: { useWorktree: false, openPR: false, simplify: false, fileIssues: true },
+ });
+ });
+});
diff --git a/client/src/components/cos/tabs/schedule/PerAppOverrideList.jsx b/client/src/components/cos/tabs/schedule/PerAppOverrideList.jsx
index 6658504ecc..99baffc2f2 100644
--- a/client/src/components/cos/tabs/schedule/PerAppOverrideList.jsx
+++ b/client/src/components/cos/tabs/schedule/PerAppOverrideList.jsx
@@ -47,6 +47,8 @@ export default function PerAppOverrideList({ taskType, config, apps, onUpdateOve
globalIntervalType={config.type}
globalTaskMetadata={config.taskMetadata}
managedAgentOptions={config.managedAgentOptions}
+ fileIssuesCapable={config.fileIssuesCapable}
+ defaultFileIssues={config.defaultFileIssues}
override={appOverrides[app.id]}
onUpdate={onUpdateOverride}
/>
diff --git a/client/src/components/cos/tabs/schedule/scheduleConstants.js b/client/src/components/cos/tabs/schedule/scheduleConstants.js
index e9cfb43cf7..d961e8b46a 100644
--- a/client/src/components/cos/tabs/schedule/scheduleConstants.js
+++ b/client/src/components/cos/tabs/schedule/scheduleConstants.js
@@ -177,6 +177,38 @@ export function setMetadataOverride(taskMetadata, field, value) {
// Toggle a global taskMetadata field, enforcing the openPR→useWorktree invariant.
// Persists both true and false values so explicit overrides survive the server-side
// merge with task-type defaults (e.g., feature-ideas defaults openPR to true).
+// Effective file-issues mode for an audit-capable task: an explicit stored
+// boolean wins, otherwise the catalog default the schedule status published.
+export function fileIssuesEffective(config, overrideMetadata) {
+ if (overrideMetadata?.fileIssues !== undefined) return overrideMetadata.fileIssues === true;
+ if (config?.taskMetadata?.fileIssues !== undefined) return config.taskMetadata.fileIssues === true;
+ return config?.defaultFileIssues === true;
+}
+
+// When file-issues is on, worktree/PR/simplify are meaningless — the UI treats
+// them as managed so the user cannot turn them on under that mode.
+export const FILE_ISSUES_MANAGED_FIELDS = ['useWorktree', 'openPR', 'simplify'];
+
+export function managedAgentOptionsFor(config, overrideMetadata) {
+ const managed = [...(config?.managedAgentOptions || [])];
+ if (config?.fileIssuesCapable && fileIssuesEffective(config, overrideMetadata)) {
+ for (const field of FILE_ISSUES_MANAGED_FIELDS) {
+ if (!managed.includes(field)) managed.push(field);
+ }
+ }
+ return managed;
+}
+
+export function toggleFileIssuesMetadata(metadata, next) {
+ const taskMetadata = { ...(metadata || {}), fileIssues: next };
+ if (next) {
+ taskMetadata.useWorktree = false;
+ taskMetadata.openPR = false;
+ taskMetadata.simplify = false;
+ }
+ return taskMetadata;
+}
+
export function toggleMetadataField(metadata, field) {
const current = metadata || {};
const newMeta = { ...current, [field]: !current[field] };
diff --git a/client/src/components/cos/tabs/schedule/scheduleConstants.test.js b/client/src/components/cos/tabs/schedule/scheduleConstants.test.js
index fd2c34f850..38c3edabf0 100644
--- a/client/src/components/cos/tabs/schedule/scheduleConstants.test.js
+++ b/client/src/components/cos/tabs/schedule/scheduleConstants.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { getTaskStatusGroup, taskSortKey, TASK_FILTERS, STATUS_GROUPS, describeNextRun, coverageTone, setMetadataOverride, toggleMetadataField } from './scheduleConstants';
+import { getTaskStatusGroup, taskSortKey, TASK_FILTERS, STATUS_GROUPS, describeNextRun, coverageTone, setMetadataOverride, toggleMetadataField, fileIssuesEffective, managedAgentOptionsFor, toggleFileIssuesMetadata } from './scheduleConstants';
describe('setMetadataOverride', () => {
it('sets a key without disturbing the app\'s other overrides', () => {
@@ -21,6 +21,38 @@ describe('setMetadataOverride', () => {
});
});
+describe('fileIssuesEffective', () => {
+ it('prefers an app override, then the stored global, then the catalog default', () => {
+ expect(fileIssuesEffective({ defaultFileIssues: true }, { fileIssues: false })).toBe(false);
+ expect(fileIssuesEffective({ taskMetadata: { fileIssues: true }, defaultFileIssues: false })).toBe(true);
+ expect(fileIssuesEffective({ defaultFileIssues: true })).toBe(true);
+ expect(fileIssuesEffective({ defaultFileIssues: false })).toBe(false);
+ });
+});
+
+describe('managedAgentOptionsFor', () => {
+ it('adds worktree/PR/simplify to the managed set when file-issues is on', () => {
+ expect(managedAgentOptionsFor({
+ fileIssuesCapable: true,
+ defaultFileIssues: true,
+ managedAgentOptions: ['claimFlow'],
+ })).toEqual(['claimFlow', 'useWorktree', 'openPR', 'simplify']);
+ });
+
+ it('leaves non-audit tasks alone', () => {
+ expect(managedAgentOptionsFor({ managedAgentOptions: ['useWorktree'] })).toEqual(['useWorktree']);
+ });
+});
+
+describe('toggleFileIssuesMetadata', () => {
+ it('forces the no-code posture on and leaves it when turning off', () => {
+ expect(toggleFileIssuesMetadata({ useWorktree: true, openPR: true, simplify: true }, true))
+ .toEqual({ useWorktree: false, openPR: false, simplify: false, fileIssues: true });
+ expect(toggleFileIssuesMetadata({ fileIssues: true, useWorktree: false }, false))
+ .toEqual({ fileIssues: false, useWorktree: false });
+ });
+});
+
describe('toggleMetadataField', () => {
it('turns openPR on with the worktree it implies', () => {
expect(toggleMetadataField({ useWorktree: false, openPR: false }, 'openPR'))
diff --git a/data.reference/prompts/skills/data-safety.md b/data.reference/prompts/skills/data-safety.md
new file mode 100644
index 0000000000..58171810d2
--- /dev/null
+++ b/data.reference/prompts/skills/data-safety.md
@@ -0,0 +1,40 @@
+# Data & Upgrade-Safety Audit Skill Template
+
+## Routing
+**Use when**: Task description contains keywords like "data-safety", "upgrade-safety", "migration", "schema parity", "schemaVersion", "compatibility", "seed file", "data.reference"
+**Don't use when**: Task is a generic code-quality pass, a UI audit, or a security review that is not about stored data across upgrades
+
+## Task-Specific Guidelines
+
+You are auditing (or fixing) upgrade and storage safety. Follow the project's storage and distribution rules first — they are binding.
+
+### 1. Honor the distribution model
+- Many independent installs upgrade on their own schedule. Compatibility code is not dead code.
+- Format changes need a migration. Seed files belong in `data.reference/`.
+- Prompt-default changes need a version bump and the prior default preserved.
+- Cross-machine payloads stay version-gated.
+
+### 2. Hunt for real upgrade failures
+- A stored shape the code now expects that an older install does not have
+- A new artifact with no shipped reference copy
+- A field added to a writer but not the validation schema (or the reverse)
+- A version marker that did not move when payload meaning changed
+- A delete/exclude/reset whose pattern is broader than intended
+
+### 3. Mode
+If the task is in **file issues** mode: cite file:line, write a decision-complete issue, change no code.
+If the task is in **implement** mode: ship the smallest migration or defensive read that closes the gap, with a test that would have caught it.
+
+### 4. Commit Message Format
+Use prefix: `fix(data):` or `feat(migration):`
+
+## Example: Successful audit
+
+**Task**: "Audit data and upgrade safety — file issues"
+
+**What the agent did**:
+1. Named the slice (`server/services/catalog*` + `scripts/migrations/`)
+2. Found a new required field on a sanitizer with no migration and no default on read
+3. Confirmed no existing open issue covered it
+4. Filed one issue with the upgrade scenario, the files to touch, and acceptance criteria
+5. Left `git status` clean
diff --git a/data.reference/prompts/skills/simplify.md b/data.reference/prompts/skills/simplify.md
new file mode 100644
index 0000000000..b86c8d4452
--- /dev/null
+++ b/data.reference/prompts/skills/simplify.md
@@ -0,0 +1,35 @@
+# Dead-Code & Duplication Audit Skill Template
+
+## Routing
+**Use when**: Task description contains keywords like "simplify", "dead code", "unused export", "duplication", "copy-paste", "DRY", "unreferenced"
+**Don't use when**: Task is adding a feature, fixing a user-facing bug, or the "cleanup" is really a rewrite
+
+## Task-Specific Guidelines
+
+You are finding code the repository would be better without — or removing it, depending on the task mode.
+
+### 1. Verify before you act
+- An unreferenced export may be reached dynamically or from a string-keyed map. Search the whole repo.
+- Cross-version and cross-install compatibility shims are NOT dead code, even when this install never hits them.
+
+### 2. Prefer reuse over a new helper
+- Grep the shared library catalogs (`server/lib/README.md`, `client/src/lib/README.md`, hooks, services) before introducing a local duplicate.
+- For copy-paste drift, say which copy is correct and why.
+
+### 3. Mode
+If the task is in **file issues** mode: file the removal as a ready-to-work issue. Change no code.
+If the task is in **implement** mode: delete or reuse the one highest-value case. Run tests. Do not bundle unrelated cleanup.
+
+### 4. Commit Message Format
+Use prefix: `refactor(scope):` or `chore(scope):`
+
+## Example: Successful audit
+
+**Task**: "Dead-code and duplication audit — file issues"
+
+**What the agent did**:
+1. Named the slice (`client/src/components/cos/tabs/schedule/`)
+2. Found a local date formatter that duplicates `formatDateShort` in `client/src/utils/formatters.js`
+3. Confirmed no open issue already proposed the reuse
+4. Filed one issue naming both sites and the replacement
+5. Left `git status` clean
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 6a605ebe37..1943767f05 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -333,4 +333,5 @@ PostgreSQL itself is not PM2-managed — it runs as the system service (`:5432`)
### Adding CoS Task Types
1. Add the task type to `SELF_IMPROVEMENT_TASK_TYPES` and `DEFAULT_TASK_INTERVALS` in `server/services/taskSchedule.js`
-2. Add its prompt template to `DEFAULT_TASK_PROMPTS` in `server/services/taskPromptService.js`
+2. Add its prompt template to `DEFAULT_TASK_PROMPTS` in `server/services/taskPromptDefaults/prompts.js` (bump `PROMPT_VERSIONS` + append the outgoing default to `PREVIOUS_DEFAULT_PROMPTS` if you are changing an existing default)
+3. If it is an audit that should be configurable to **file issues** or **do the work**, add it to `AUDIT_DEFINITIONS` in `server/lib/auditCatalog.js` (and map any matching quota-burn preset via `quotaBurnId`)
diff --git a/server/lib/README.md b/server/lib/README.md
index 7ee3fbe130..3d5ca82675 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -32,6 +32,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `agentValidation.js` | Social-bot agent schemas (personality, Moltbook/Moltworld accounts, automation schedules, agent tools + Moltworld payloads) and CoS Feature Agent definitions. |
| `quotaBurnConfig.js` | Quota-burn plan shape: the provider families, the burn-job type alphabet + catalog the config page renders its form from, `QUOTA_BURN_BOUNDS` (the one bounds table the normalizer clamps to, the Zod schemas reject against, and the catalog descriptors publish as min/max), and total normalization (`normalizeQuotaBurnConfig`). Owns the dispatch-cap sentinel too (`QUOTA_BURN_UNLIMITED_DISPATCHES` / `isUnlimitedDispatchCap`) — -1 means the window is not counted, and is the default. Also owns the queued burn task's description shape (`burnTaskDescription` / `quotaBurnFamilyOfDescription`), shared with migration 225, and the `run once` vocabulary (`quotaBurnJobKey` / `jobIsSpent`, plus the two family predicates `familyIsConfigured` and `familyHasRunnableJobs`). Pure — no storage, no provider I/O. |
| `quotaBurnPresets.js` | `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)`. |
+| `auditCatalog.js` | Shared catalog of scheduled AUDIT task types (`AUDIT_DEFINITIONS` / `AUDIT_TASK_TYPES`) that can either implement a fix or file tracker issues. `isFileIssuesMode`, `getAuditFilingPreset`, `modeContractFor`, `applyAuditModeWrapper`. Each quota-burn audit preset maps to a scheduled type here (guarded by `auditCatalog.test.js`). Pure — no I/O. |
| `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. |
| `quotaWindows.js` | Classifies a quota window by PERIOD (`windowPeriodHours`); `classifyWindows` splits one card's windows into the weekly allowance that expires unused and the 5-hour one that refuses first, in one pass. `windowLabelOf` names a window. Pure. |
diff --git a/server/lib/auditCatalog.js b/server/lib/auditCatalog.js
new file mode 100644
index 0000000000..7f43753458
--- /dev/null
+++ b/server/lib/auditCatalog.js
@@ -0,0 +1,296 @@
+/**
+ * Shared catalog of scheduled AUDIT task types — the ones that can either
+ * implement a fix or just file tracker issues, matching the quota-burn
+ * single-focus audit presets.
+ *
+ * Pure module: strings + lookups, no I/O. Quota-burn presets stay templates
+ * that get COPIED into a job; this catalog is the scheduled-task counterpart
+ * (toggleable at dispatch via `taskMetadata.fileIssues`).
+ */
+
+const filing = ({ slugPrefix, label, issueLabel, labelDescription, noun }) => Object.freeze({
+ slugPrefix,
+ label,
+ issueLabel,
+ labelDescription,
+ planItemBody: `From the \`${label}\` audit of <slice> (<today's date>). <What is wrong, 1–2 sentences.> Fix: <files + functions in {appName}>. Scope: <small/medium/large>.`,
+ bodyRequirements: `the slice audited and the date, what is wrong with file:line references, the user-visible impact, a concrete proposed fix naming the files in {appName}, and a \`Scope:\` of small/medium/large`,
+ planCommitMessage: `docs(${issueLabel}): propose <N> ${noun}`,
+});
+
+/**
+ * The half of every audit dispatch that is about HOW to run, not WHAT to
+ * look for. Injected at generation time so a customized stored prompt still
+ * honors the chosen mode — this banner overrides any later "fix and commit"
+ * or "file issues, change nothing" instruction in the mission body.
+ */
+export const FILE_ISSUES_MODE_CONTRACT = `## Mode: file issues, change nothing
+
+This banner OVERRIDES any later instruction to edit source, commit, open a PR, create a branch, or \`git checkout\`/\`switch\`. You are standing in the user's live checkout of this repository — an edit or a branch change is felt immediately by whoever is working in it.
+
+Your deliverable is tracker items, not code. The run must end with the same \`git status\` and the same branch it started on.
+
+## Where to record findings
+
+{trackerInstructions}
+
+## How to run this audit
+
+1. **Pick a bounded slice and say so first.** Do NOT attempt the whole repository. Choose one coherent area (a feature directory, a route group, a handful of related screens) — prefer one that recent audit issues have not already covered — and open your report by naming the slice in one line.
+2. **Read the actual code.** Every finding must cite \`path/to/file.js:LINE\` and describe a concrete, reproducible failure: what a user does, in what state, and what goes wrong. Delete any finding you cannot state that way.
+3. **De-duplicate before filing.** Follow the Inventory step under "Where to record findings" above. If it is already filed, skip it; comment on the existing item only when you have genuinely new evidence.
+4. **File each surviving finding as its own item.** One problem per item — never a bundle. Cap yourself at 5. Bodies must be decision-complete:
+ - **Problem** — what is wrong, with file:line references.
+ - **Impact** — the user-visible consequence, not the code smell.
+ - **Fix** — the approach you have DECIDED on, with the files it touches. If the only obstacle was a design choice, make the call and state it. Do not file a question.
+ - **Acceptance criteria** — checkboxes another agent can verify cold.
+5. **Redact before you publish.** An issue is world-readable the moment it is filed. Never paste a secret, credential, token, hostname, IP address, absolute path containing a username, or any personal record into a title or body.
+6. **Report at the end**: the slice you audited, each item you filed, and anything you deliberately did not file and why.
+
+Read this repository's \`CLAUDE.md\` (and any nested per-directory ones covering the slice) before you start, and honor its conventions and its explicitly declared non-issues.`;
+
+export const DO_WORK_MODE_CONTRACT = `## Mode: implement the highest-value fix
+
+This banner OVERRIDES any later instruction to file issues, leave source unchanged, or skip commits. Pick ONE coherent, high-value finding from the mission below and implement it this run. Do not boil the ocean.
+
+1. **Pick a bounded slice** and say so first.
+2. **Read the actual code** and the project's \`CLAUDE.md\` / conventions. Honor documented non-issues.
+3. **Implement the fix** — the smallest change that actually solves the user-visible problem. If the only obstacle was a design choice, make the call and state it.
+4. **Verify** with the project's tests (or a focused new test when the path is untested and a silent break would cost data, money, or quota).
+5. **Commit** following the repo's conventions. Do not bundle unrelated cleanup.
+
+If you find additional problems, mention them in the summary — do not expand scope. If nothing in the slice is worth changing, say so and stop without a drive-by refactor.`;
+
+/**
+ * Scheduled audit types that support the file-issues vs do-work toggle.
+ * `quotaBurnId` maps onto `QUOTA_BURN_PROMPT_PRESETS` so a new burn preset
+ * cannot land without a scheduled counterpart (guarded in auditCatalog.test.js).
+ */
+export const AUDIT_DEFINITIONS = Object.freeze({
+ security: {
+ quotaBurnId: 'security-audit',
+ label: 'Security',
+ description: 'Security audit — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'security-',
+ label: 'security-audit',
+ issueLabel: 'security',
+ labelDescription: 'Proposed from a security audit',
+ noun: 'security finding(s)',
+ }),
+ },
+ 'code-quality': {
+ quotaBurnId: null,
+ label: 'Code quality',
+ description: 'Code quality improvements — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'code-quality-',
+ label: 'code-quality-audit',
+ issueLabel: 'code-quality',
+ labelDescription: 'Proposed from a code-quality audit',
+ noun: 'code-quality finding(s)',
+ }),
+ },
+ 'test-coverage': {
+ quotaBurnId: 'test-gap-audit',
+ label: 'Test coverage',
+ description: 'Test-coverage audit — configurable: file issues or add tests',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'test-gap-',
+ label: 'test-gap-audit',
+ issueLabel: 'tests',
+ labelDescription: 'Proposed from a test-coverage audit',
+ noun: 'test-gap finding(s)',
+ }),
+ },
+ performance: {
+ quotaBurnId: 'perf-audit',
+ label: 'Performance',
+ description: 'Performance audit — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'perf-',
+ label: 'performance-audit',
+ issueLabel: 'performance',
+ labelDescription: 'Proposed from a performance audit',
+ noun: 'performance finding(s)',
+ }),
+ },
+ accessibility: {
+ quotaBurnId: 'a11y-audit',
+ label: 'Accessibility',
+ description: 'Accessibility audit — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'a11y-',
+ label: 'accessibility-audit',
+ issueLabel: 'accessibility',
+ labelDescription: 'Proposed from an accessibility audit',
+ noun: 'accessibility finding(s)',
+ }),
+ },
+ documentation: {
+ quotaBurnId: 'docs-audit',
+ label: 'Documentation',
+ description: 'Docs-drift audit — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'docs-',
+ label: 'docs-audit',
+ issueLabel: 'documentation',
+ labelDescription: 'Proposed from a documentation-drift audit',
+ noun: 'docs finding(s)',
+ }),
+ },
+ 'ui-bugs': {
+ quotaBurnId: null,
+ label: 'UI bugs',
+ description: 'Find UI bugs — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'ui-bug-',
+ label: 'ui-bug-audit',
+ issueLabel: 'bug',
+ labelDescription: 'Proposed from a UI-bug audit',
+ noun: 'UI bug(s)',
+ }),
+ },
+ 'mobile-responsive': {
+ quotaBurnId: 'mobile-audit',
+ label: 'Mobile & responsive',
+ description: 'Mobile/responsive audit — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'mobile-',
+ label: 'mobile-audit',
+ issueLabel: 'mobile',
+ labelDescription: 'Proposed from a mobile/responsive audit',
+ noun: 'mobile finding(s)',
+ }),
+ },
+ 'error-handling': {
+ quotaBurnId: 'resilience-audit',
+ label: 'Error handling',
+ description: 'Failure-path audit — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'resilience-',
+ label: 'resilience-audit',
+ issueLabel: 'resilience',
+ labelDescription: 'Proposed from a failure-path audit',
+ noun: 'resilience finding(s)',
+ }),
+ },
+ typing: {
+ quotaBurnId: null,
+ label: 'Typing',
+ description: 'TypeScript-types audit — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'typing-',
+ label: 'typing-audit',
+ issueLabel: 'code-quality',
+ labelDescription: 'Proposed from a TypeScript-types audit',
+ noun: 'typing finding(s)',
+ }),
+ },
+ 'console-errors': {
+ quotaBurnId: null,
+ label: 'Console errors',
+ description: 'Console-error audit — configurable: file issues or implement fixes',
+ defaultFileIssues: false,
+ filing: filing({
+ slugPrefix: 'console-',
+ label: 'console-error-audit',
+ issueLabel: 'bug',
+ labelDescription: 'Proposed from a console-error audit',
+ noun: 'console-error finding(s)',
+ }),
+ },
+ ux: {
+ quotaBurnId: 'ux-audit',
+ label: 'UX',
+ description: 'UX/design audit — configurable: file issues (default) or implement fixes',
+ defaultFileIssues: true,
+ filing: filing({
+ slugPrefix: 'ux-',
+ label: 'UX-audit',
+ issueLabel: 'ux',
+ labelDescription: 'Proposed from a UX/design audit',
+ noun: 'UX finding(s)',
+ }),
+ },
+ 'data-safety': {
+ quotaBurnId: 'data-safety-audit',
+ label: 'Data & upgrade safety',
+ description: 'Data/upgrade-safety audit — configurable: file issues (default) or implement fixes',
+ defaultFileIssues: true,
+ filing: filing({
+ slugPrefix: 'data-safety-',
+ label: 'data-safety-audit',
+ issueLabel: 'data-safety',
+ labelDescription: 'Proposed from a data/upgrade-safety audit',
+ noun: 'data-safety finding(s)',
+ }),
+ },
+ simplify: {
+ quotaBurnId: 'simplify-audit',
+ label: 'Dead code & duplication',
+ description: 'Dead-code/duplication audit — configurable: file issues (default) or implement removals',
+ defaultFileIssues: true,
+ filing: filing({
+ slugPrefix: 'simplify-',
+ label: 'simplify-audit',
+ issueLabel: 'code-quality',
+ labelDescription: 'Proposed from a dead-code/duplication audit',
+ noun: 'simplify finding(s)',
+ }),
+ },
+});
+
+export const AUDIT_TASK_TYPES = new Set(Object.keys(AUDIT_DEFINITIONS));
+
+export function isAuditTaskType(taskType) {
+ return AUDIT_TASK_TYPES.has(taskType);
+}
+
+export function defaultFileIssuesFor(taskType) {
+ return AUDIT_DEFINITIONS[taskType]?.defaultFileIssues === true;
+}
+
+/**
+ * Effective file-issues mode for a dispatch. An explicit `fileIssues` boolean
+ * on the merged task metadata wins; otherwise the catalog default applies.
+ * Accepts the `'true'`/`'false'` string forms for parity with other metadata
+ * gates that round-trip through TASKS.md as text.
+ */
+export function isFileIssuesMode(taskType, metadata) {
+ if (!isAuditTaskType(taskType)) return false;
+ const raw = metadata?.fileIssues;
+ if (raw === true || raw === 'true') return true;
+ if (raw === false || raw === 'false') return false;
+ return defaultFileIssuesFor(taskType);
+}
+
+export function getAuditFilingPreset(taskType) {
+ return AUDIT_DEFINITIONS[taskType]?.filing || null;
+}
+
+export function modeContractFor(fileIssues) {
+ return fileIssues ? FILE_ISSUES_MODE_CONTRACT : DO_WORK_MODE_CONTRACT;
+}
+
+/**
+ * Ensure a prompt carries the mode banner. If the template already has a
+ * `{modeInstructions}` placeholder the generator will substitute it; otherwise
+ * the banner is prepended so a customized stored prompt still honors the mode.
+ */
+export function applyAuditModeWrapper(promptTemplate, modeInstructions) {
+ const prompt = typeof promptTemplate === 'string' ? promptTemplate : '';
+ if (!modeInstructions) return prompt;
+ if (prompt.includes('{modeInstructions}')) return prompt;
+ return `${modeInstructions}\n\n---\n\n${prompt}`;
+}
diff --git a/server/lib/auditCatalog.test.js b/server/lib/auditCatalog.test.js
new file mode 100644
index 0000000000..4f6386bf75
--- /dev/null
+++ b/server/lib/auditCatalog.test.js
@@ -0,0 +1,106 @@
+import { describe, it, expect } from 'vitest';
+import { QUOTA_BURN_PROMPT_PRESETS } from './quotaBurnPresets.js';
+import {
+ AUDIT_DEFINITIONS,
+ AUDIT_TASK_TYPES,
+ FILE_ISSUES_MODE_CONTRACT,
+ DO_WORK_MODE_CONTRACT,
+ isAuditTaskType,
+ defaultFileIssuesFor,
+ isFileIssuesMode,
+ getAuditFilingPreset,
+ modeContractFor,
+ applyAuditModeWrapper,
+} from './auditCatalog.js';
+
+describe('AUDIT_DEFINITIONS', () => {
+ it('has a filing preset (slug + label) for every audit type', () => {
+ for (const [taskType, def] of Object.entries(AUDIT_DEFINITIONS)) {
+ expect(def.filing, taskType).toBeTruthy();
+ expect(def.filing.slugPrefix, taskType).toMatch(/-$/);
+ expect(def.filing.issueLabel, taskType).toBeTruthy();
+ expect(def.filing.planCommitMessage, taskType).toContain('propose');
+ }
+ });
+
+ it('maps every quota-burn audit preset to a scheduled audit type', () => {
+ const mapped = new Set(
+ Object.values(AUDIT_DEFINITIONS).map((def) => def.quotaBurnId).filter(Boolean)
+ );
+ for (const preset of QUOTA_BURN_PROMPT_PRESETS) {
+ expect(mapped.has(preset.id), `missing scheduled counterpart for ${preset.id}`).toBe(true);
+ }
+ });
+
+ it('defaults new audit types to file-issues and existing do-work types to implement', () => {
+ expect(defaultFileIssuesFor('ux')).toBe(true);
+ expect(defaultFileIssuesFor('data-safety')).toBe(true);
+ expect(defaultFileIssuesFor('simplify')).toBe(true);
+ expect(defaultFileIssuesFor('security')).toBe(false);
+ expect(defaultFileIssuesFor('accessibility')).toBe(false);
+ expect(defaultFileIssuesFor('unknown')).toBe(false);
+ });
+});
+
+describe('isFileIssuesMode', () => {
+ it('is false for non-audit types', () => {
+ expect(isFileIssuesMode('claim-issue', { fileIssues: true })).toBe(false);
+ expect(isAuditTaskType('claim-issue')).toBe(false);
+ });
+
+ it('honors an explicit boolean (and the TASKS.md string form)', () => {
+ expect(isFileIssuesMode('security', { fileIssues: true })).toBe(true);
+ expect(isFileIssuesMode('security', { fileIssues: 'true' })).toBe(true);
+ expect(isFileIssuesMode('ux', { fileIssues: false })).toBe(false);
+ expect(isFileIssuesMode('ux', { fileIssues: 'false' })).toBe(false);
+ });
+
+ it('falls back to the catalog default when the key is absent', () => {
+ expect(isFileIssuesMode('ux', {})).toBe(true);
+ expect(isFileIssuesMode('security', {})).toBe(false);
+ expect(isFileIssuesMode('data-safety', null)).toBe(true);
+ });
+});
+
+describe('mode contracts + wrapper', () => {
+ it('file-issues contract records findings via {trackerInstructions} and forbids edits', () => {
+ expect(FILE_ISSUES_MODE_CONTRACT).toContain('{trackerInstructions}');
+ expect(FILE_ISSUES_MODE_CONTRACT).toContain('OVERRIDES');
+ expect(FILE_ISSUES_MODE_CONTRACT).toContain('same `git status`');
+ expect(modeContractFor(true)).toBe(FILE_ISSUES_MODE_CONTRACT);
+ });
+
+ it('do-work contract tells the agent to implement one fix', () => {
+ expect(DO_WORK_MODE_CONTRACT).toContain('implement');
+ expect(DO_WORK_MODE_CONTRACT).not.toContain('{trackerInstructions}');
+ expect(modeContractFor(false)).toBe(DO_WORK_MODE_CONTRACT);
+ });
+
+ it('prepends the banner when the stored prompt has no placeholder', () => {
+ const wrapped = applyAuditModeWrapper('Fix the bug and commit.', FILE_ISSUES_MODE_CONTRACT);
+ expect(wrapped.startsWith(FILE_ISSUES_MODE_CONTRACT)).toBe(true);
+ expect(wrapped).toContain('Fix the bug and commit.');
+ });
+
+ it('leaves a prompt that already has {modeInstructions} untouched', () => {
+ const prompt = 'Mission\n\n{modeInstructions}';
+ expect(applyAuditModeWrapper(prompt, FILE_ISSUES_MODE_CONTRACT)).toBe(prompt);
+ });
+
+ it('is a no-op without a mode banner', () => {
+ expect(applyAuditModeWrapper('hello', '')).toBe('hello');
+ expect(applyAuditModeWrapper('hello', null)).toBe('hello');
+ });
+});
+
+describe('getAuditFilingPreset', () => {
+ it('returns the preset for an audit type and null otherwise', () => {
+ expect(getAuditFilingPreset('data-safety').slugPrefix).toBe('data-safety-');
+ expect(getAuditFilingPreset('simplify').issueLabel).toBe('code-quality');
+ expect(getAuditFilingPreset('claim-issue')).toBeNull();
+ });
+
+ it('AUDIT_TASK_TYPES is derived from the definitions table', () => {
+ expect(AUDIT_TASK_TYPES).toEqual(new Set(Object.keys(AUDIT_DEFINITIONS)));
+ });
+});
diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.js
index 355bec5d1c..f19e0e9b17 100644
--- a/server/lib/cosValidation.js
+++ b/server/lib/cosValidation.js
@@ -1412,7 +1412,10 @@ const ALLOWED_TASK_METADATA_KEYS = [
// type whose deliverable is outside the repo — e.g. a reference-watch run
// against a GitHub/GitLab/JIRA work tracker files its proposals as issues and,
// per the prompt, edits no application code, so a clean worktree is expected.
- 'worktreeChangesExpected'
+ 'worktreeChangesExpected',
+ // Audit-type toggle: file tracker issues (no code) vs implement the fix.
+ // Dispatch stamps `noCodeOutput` when this is true. See server/lib/auditCatalog.js.
+ 'fileIssues'
];
// pr-watcher author-gate values. 'self' = PRs opened by the gh-authenticated
diff --git a/server/lib/index.js b/server/lib/index.js
index d244f39850..93d7aa8c6a 100644
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@ -141,6 +141,7 @@ export * as providerVendors from './providerVendors.js';
export * from './providerTranscriptUsage.js';
export * from './quotaBurnConfig.js';
export * from './quotaBurnPresets.js';
+export * from './auditCatalog.js';
export * from './quotaBurnValidation.js';
export * from './quotaReset.js';
export * from './quotaWindows.js';
diff --git a/server/lib/validation.test.js b/server/lib/validation.test.js
index b93e1302f9..d2b8c1db92 100644
--- a/server/lib/validation.test.js
+++ b/server/lib/validation.test.js
@@ -840,6 +840,12 @@ describe('validation.js', () => {
expect(sanitizeTaskMetadata({ worktreeChangesExpected: 'false' })).toBeNull();
});
+ it('should accept fileIssues as an allowed boolean key', () => {
+ expect(sanitizeTaskMetadata({ fileIssues: true })).toEqual({ fileIssues: true });
+ expect(sanitizeTaskMetadata({ fileIssues: false })).toEqual({ fileIssues: false });
+ expect(sanitizeTaskMetadata({ fileIssues: 'true' })).toBeNull();
+ });
+
it('should accept only known PR completion metadata', () => {
expect(sanitizeTaskMetadata({ prCompletion: 'review-then-merge' }))
.toEqual({ prCompletion: 'review-then-merge' });
diff --git a/server/lib/workTracker.js b/server/lib/workTracker.js
index ecc8cb9a0a..b80267a4d2 100644
--- a/server/lib/workTracker.js
+++ b/server/lib/workTracker.js
@@ -21,6 +21,7 @@ import {
REPO_STUDY_LABEL_CONTRACT,
} from './dispatchLabels.js';
import { getOriginInfo, readOriginRemoteUrl } from './gitRemote.js';
+import { getAuditFilingPreset, isAuditTaskType } from './auditCatalog.js';
// Every selectable value (UI + Zod enum). `'auto'` is the default; the rest are
// concrete sources.
@@ -324,14 +325,22 @@ ${jiraLabelContract}
* (referenceRepos.js), and the one-off `repo-study` (repoIntake.js).
*/
export async function resolveTrackerFilingBlock(app, taskType, options = {}) {
- if (!TRACKER_FILING_TASK_TYPES.has(taskType)) return { trackerInstructions: '', workTracker: null };
+ const { fileIssues = false, ...wordingOverrides } = options;
+ // Always-filing types (reference-watch, repo-study) keep filing unless they
+ // are ALSO an audit type that opted into do-work (`fileIssues === false`).
+ // Audit types (security, ux, data-safety, …) file only when fileIssues is on.
+ const alwaysPreset = TRACKER_FILING_PRESETS[taskType];
+ const auditPreset = getAuditFilingPreset(taskType);
+ const shouldFile = isAuditTaskType(taskType) ? fileIssues === true : Boolean(alwaysPreset);
+ const preset = alwaysPreset || auditPreset;
+ if (!shouldFile || !preset) return { trackerInstructions: '', workTracker: null };
// Never throws — degrades to the PLAN.md block, which `isFileTracker` then
// agrees with, so the flag and the instructions stay consistent.
const workTracker = await resolveAppWorkTracker(app).catch(() => ({ resolved: 'plan' }));
return {
trackerInstructions: formatTrackerInstructions(workTracker.resolved, {
- ...TRACKER_FILING_PRESETS[taskType],
- ...options,
+ ...preset,
+ ...wordingOverrides,
}),
workTracker: workTracker.resolved,
worktreeChangesExpected: isFileTracker(workTracker.resolved),
diff --git a/server/lib/workTracker.trackerInstructions.test.js b/server/lib/workTracker.trackerInstructions.test.js
index 85376df46d..574a04fabf 100644
--- a/server/lib/workTracker.trackerInstructions.test.js
+++ b/server/lib/workTracker.trackerInstructions.test.js
@@ -143,6 +143,29 @@ describe('formatTrackerInstructions — ux preset (#3273)', () => {
});
});
+describe('resolveTrackerFilingBlock — fileIssues audit types', () => {
+ it('files for an audit type only when fileIssues is on', async () => {
+ const { resolveTrackerFilingBlock } = await import('./workTracker.js');
+ const app = { repoPath: '/tmp/example-repo', workTracker: 'plan' };
+ const off = await resolveTrackerFilingBlock(app, 'security', { fileIssues: false });
+ expect(off.trackerInstructions).toBe('');
+ expect(off.workTracker).toBeNull();
+
+ const on = await resolveTrackerFilingBlock(app, 'data-safety', { fileIssues: true });
+ expect(on.workTracker).toBe('plan');
+ expect(on.trackerInstructions).toContain('[data-safety-…]');
+ expect(on.trackerInstructions).toContain('data-safety-audit');
+ });
+
+ it('still files always-filing types (reference-watch) without fileIssues', async () => {
+ const { resolveTrackerFilingBlock } = await import('./workTracker.js');
+ const app = { repoPath: '/tmp/example-repo', workTracker: 'plan' };
+ const block = await resolveTrackerFilingBlock(app, 'reference-watch');
+ expect(block.workTracker).toBe('plan');
+ expect(block.trackerInstructions).toContain('[ref-watch-…]');
+ });
+});
+
describe('formatTrackerInstructions — repo-study complete labels', () => {
const repoStudy = TRACKER_FILING_PRESETS['repo-study'];
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index 0124cbf172..aded341fd2 100644
--- a/server/services/agentPromptBuilder.js
+++ b/server/services/agentPromptBuilder.js
@@ -109,6 +109,14 @@ PortOS launched you autonomously. Nobody is watching this session and nothing ca
* Order matters — first match wins, so more specific patterns come first.
*/
const SKILL_MATCHERS = [
+ {
+ skill: 'data-safety',
+ keywords: ['data-safety', 'upgrade-safety', 'schema parity', 'schemaversion', 'seed file', 'data.reference']
+ },
+ {
+ skill: 'simplify',
+ keywords: ['dead code', 'unused export', 'duplication', 'copy-paste', 'unreferenced']
+ },
{
skill: 'security-audit',
keywords: ['security', 'audit', 'vulnerability', 'xss', 'injection', 'owasp', 'cve', 'penetration', 'hardening', 'sanitize', 'authorization']
diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.js
index 0ec2e5cec8..e34a13acba 100644
--- a/server/services/agentPromptBuilder.test.js
+++ b/server/services/agentPromptBuilder.test.js
@@ -128,6 +128,15 @@ describe('composable skill template routing', () => {
}))).toEqual(['security-audit', 'threejs-visual']);
});
+ it('routes data-safety and dead-code audits to their own skill templates', () => {
+ expect(detectSkillTemplates(makeTask({
+ description: '[Improvement] Data and upgrade-safety audit',
+ }))).toEqual(['data-safety']);
+ expect(detectSkillTemplates(makeTask({
+ description: '[Improvement] Dead-code and duplication audit',
+ }))).toEqual(['simplify']);
+ });
+
it('joins templates in routing order and tolerates an unavailable domain guide', async () => {
const loadTemplate = vi.fn(async (name) => ({
'security-audit': 'Security lifecycle guidance',
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index 3d1c4c8e59..01f624a246 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -43,6 +43,12 @@ import { isHeldByOther, getClaimOwner } from './cosTaskClaim.js';
import { ensureInstanceId } from './instances.js';
import { PR_COMPLETION_VALUES } from '../lib/prDisposition.js';
import { resolveTrackerFilingBlock } from '../lib/workTracker.js';
+import {
+ isAuditTaskType,
+ isFileIssuesMode,
+ modeContractFor,
+ applyAuditModeWrapper,
+} from '../lib/auditCatalog.js';
import { TIMED_COOLDOWN_BLOCKED_CATEGORIES } from '../lib/taskBlockCategories.js';
import { PATHS } from '../lib/fileUtils.js';
import { shellQuote } from '../lib/shellQuote.js';
@@ -2783,9 +2789,11 @@ async function buildImprovementTaskDescription({ promptTemplate, app, promptTask
const swarmBlock = resolveSwarmBlock(promptTaskType, metadata.swarmCount);
return `${swarmBlock}${promptTemplate}`
- // {trackerInstructions} FIRST — the injected block itself carries
- // {appName}/{repoPath} placeholders that the replacers below expand. This
+ // {modeInstructions} before {trackerInstructions}: the file-issues mode
+ // contract itself carries {trackerInstructions}. Then tracker before
+ // {appName}/{repoPath} — the injected block carries those too. This
// ordering is load-bearing (mirrors triggerReferenceAnalysis).
+ .replace(/\{modeInstructions\}/g, () => blocks.modeInstructions || '')
.replace(/\{trackerInstructions\}/g, () => blocks.trackerInstructions)
.replace(/\{appName\}/g, app.name)
.replace(/\{repoPath\}/g, app.repoPath)
@@ -2938,9 +2946,10 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
if (referenceWatch.skip) return null;
const referenceDataBlock = referenceWatch.block;
- // Tracker-filing types (reference-watch / ux): the {trackerInstructions} block
- // for the app's resolved work tracker.
- const trackerFiling = await resolveTrackerFilingBlock(app, taskType);
+ // Tracker-filing types (reference-watch, or an audit type with fileIssues):
+ // the {trackerInstructions} block for the app's resolved work tracker.
+ const fileIssues = isFileIssuesMode(taskType, metadata);
+ const trackerFiling = await resolveTrackerFilingBlock(app, taskType, { fileIssues });
if (trackerFiling.workTracker) {
// Traceability + deliverable posture, derived from the SAME resolved tracker
// that selected the {trackerInstructions} block above so the flag can't drift
@@ -2973,11 +2982,14 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
}
const planConstraintBlock = buildPlanConstraintBlock(metadata.planId);
+ const modeInstructions = isAuditTaskType(taskType) ? modeContractFor(fileIssues) : '';
const description = await buildImprovementTaskDescription({
- promptTemplate, app, promptTaskType, metadata,
+ promptTemplate: applyAuditModeWrapper(promptTemplate, modeInstructions),
+ app, promptTaskType, metadata,
blocks: {
referenceData: referenceDataBlock,
trackerInstructions: trackerFiling.trackerInstructions,
+ modeInstructions,
prData: prDataBlock,
inFlightBranches: inFlightBranchesBlock,
zombieIssues: zombieIssuesBlock,
@@ -2988,6 +3000,15 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
});
applyAppWorktreeDefault(metadata, app);
+ // File-issues posture wins over app worktree/PR defaults — the deliverable
+ // is tracker items, so a managed worktree or an implied PR is the wrong shape.
+ if (fileIssues) {
+ metadata.fileIssues = true;
+ metadata.noCodeOutput = true;
+ metadata.useWorktree = false;
+ metadata.openPR = false;
+ metadata.simplify = false;
+ }
applyProviderModelPins(metadata, interval, hookOverride);
const approval = await resolveConfidenceApproval(state, `app-improve:${taskType}`, `Task app-improve:${taskType} for ${app.name}`, metadata);
diff --git a/server/services/cosTaskGenerator.referenceWatch.test.js b/server/services/cosTaskGenerator.referenceWatch.test.js
index f171b8591d..708a8a3607 100644
--- a/server/services/cosTaskGenerator.referenceWatch.test.js
+++ b/server/services/cosTaskGenerator.referenceWatch.test.js
@@ -232,4 +232,43 @@ describe('scheduled ux prompt assembly (#3273)', () => {
expect(task.metadata.workTracker).toBe('plan');
expect(checkReferenceRepoMock).not.toHaveBeenCalled();
});
+
+ it('defaults ux to file-issues posture (noCodeOutput, no worktree/PR)', async () => {
+ const task = await generateUx(makeApp());
+ expect(task.metadata.fileIssues).toBe(true);
+ expect(task.metadata.noCodeOutput).toBe(true);
+ expect(task.metadata.useWorktree).toBe(false);
+ expect(task.metadata.openPR).toBe(false);
+ expect(task.description).toContain('Mode: file issues, change nothing');
+ });
+});
+
+describe('audit fileIssues toggle', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it('stamps no-code posture and injects the file-issues banner when fileIssues is on', async () => {
+ const { getTaskInterval } = await import('./taskSchedule.js');
+ getTaskInterval.mockResolvedValue({ type: 'weekly', taskMetadata: { fileIssues: true } });
+ const task = await generate(makeApp(), 'security');
+ expect(task.metadata.fileIssues).toBe(true);
+ expect(task.metadata.noCodeOutput).toBe(true);
+ expect(task.metadata.useWorktree).toBe(false);
+ expect(task.metadata.openPR).toBe(false);
+ expect(task.description).toContain('Mode: file issues, change nothing');
+ expect(task.description).toContain('[security-…]');
+ expect(task.description).not.toContain('{modeInstructions}');
+ expect(task.description).not.toContain('{trackerInstructions}');
+ });
+
+ it('does not file and asks the agent to implement when fileIssues is off', async () => {
+ const { getTaskInterval } = await import('./taskSchedule.js');
+ getTaskInterval.mockResolvedValue({ type: 'weekly', taskMetadata: { fileIssues: false } });
+ const task = await generate(makeApp(), 'security');
+ expect(task.metadata.fileIssues).toBe(false);
+ expect(task.metadata.noCodeOutput).toBeUndefined();
+ expect(task.description).toContain('Mode: implement the highest-value fix');
+ expect(task.description).not.toContain('[security-…]');
+ });
});
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 8aeb65fc92..516465138c 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -11,6 +11,8 @@
"ui-bugs": "def9ad96bd74ab397233f234d79a1974",
"mobile-responsive": "16d8e7f63a673a2de48994c0ac08ef3d",
"ux": "e03d03fc7c16faa5b5db93be2896b9ad",
+ "data-safety": "86b07f51abdbcbe7016f840b5bb0cd9b",
+ "simplify": "2a048214d1dd3b75bee9ae1a38fa1589",
"feature-ideas": "d3282f16da29efe2d53595b3b34778bc",
"plan-task": "aa5d121b3cb25aa134e3a20e5f0186c6",
"claim-issue": "dc47a602c96b0618e7bca87e6b21c397",
@@ -59,6 +61,8 @@
"ui-bugs": 2,
"mobile-responsive": 2,
"ux": 1,
+ "data-safety": 1,
+ "simplify": 1,
"release-check": 8
},
"REFERENCE_WATCH_AUDITED_VERSION": 3,
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index d69bd8b434..4ee69fa887 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -430,6 +430,69 @@ keyboard-inaccessible icon") — and file it as the UX finding, not as the a11y
routes you audited, how many findings you filed (and their slugs), and which
checklist items came up most often.`,
+ 'data-safety': `[Improvement: {appName}] Data and upgrade-safety audit
+
+Audit {appName} for changes that could corrupt, lose, or strand user data
+across upgrades and machines.
+
+Repository: {repoPath}
+
+{modeInstructions}
+
+Hunt specifically for:
+
+- **Format changes without a migration** — a stored shape the code now expects
+ that an older install's files or rows do not have, with nothing to convert
+ them and no defensive read path.
+- **Missing seeds and defaults** — a new stored artifact with no shipped
+ reference copy, so a fresh install starts broken.
+- **Schema parity drift** — a field added to a sanitizer, writer, or payload but
+ never to the validation schema (or the reverse), so a valid record is rejected
+ or an invalid one is stored.
+- **Version gates** — cross-machine or cross-version payloads whose meaning
+ changed without the version marker moving, letting a newer peer feed something
+ an older one will mis-handle.
+- **Destructive defaults** — an exclude/cleanup/reset path whose pattern is
+ broader than intended, a delete that is not scoped, a write that clobbers a
+ field it never read.
+- **Read-modify-write races between two paths** that mutate the same record or
+ file and can drop one another's changes.
+
+State the upgrade scenario explicitly for each finding: which install, holding
+what, upgrading to what, and what breaks. Cross-version and cross-install
+compatibility code is NOT dead code — read the project's rules on migrations
+and version gates before proposing any such removal.`,
+
+ 'simplify': `[Improvement: {appName}] Dead-code and duplication audit
+
+Find code {appName} would be better without.
+
+Repository: {repoPath}
+
+{modeInstructions}
+
+Hunt specifically for:
+
+- **Unreferenced code** — exports with no importer, components rendered from
+ nowhere, feature flags with one branch permanently dead, config keys nothing
+ reads. Verify with a repo-wide search before acting; a dynamic or
+ string-keyed reference is easy to miss and a wrong removal is expensive.
+- **Re-implemented helpers** — a local function that duplicates something the
+ project's shared library catalogs already provide. Cite both, and propose the
+ reuse.
+- **Copy-paste drift** — near-identical blocks that have diverged, where one copy
+ has a fix the other never got. That divergence is a latent bug; say which copy
+ is correct.
+- **Modules that outgrew their file** — one file holding several unrelated
+ concerns, or a component whose body has swallowed logic that belongs in a
+ hook or a pure helper. Propose the split, with the new file names.
+- **Stale scaffolding** — commented-out blocks, TODOs whose work already
+ shipped, migration or compatibility shims whose trigger can no longer occur.
+
+Cross-version and cross-install compatibility code is NOT dead code, even when
+this install no longer hits it. Read the project's rules on migrations and
+version gates before proposing any such removal.`,
+
'feature-ideas': `[Improvement: {appName}] Implement Next Planned Feature
Your goal is to implement the next planned item from PLAN.md, or brainstorm a new feature if no plan exists.
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index 88f257bd94..2f59daaa42 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -38,7 +38,9 @@ export const PROMPT_VERSIONS = {
'documentation': 5, // v5: the changelog step defers to the convention the repo documents (some repos collect per-branch fragments in a directory so parallel agents don't conflict) instead of prescribing an append to `.changelog/NEXT.md`. v4: generic {appName} body (v1 hardcoded "PortOS"; v2/v3 retired DONE.md wording)
'ui-bugs': 2, // v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)
'mobile-responsive': 2, // v2: generic {appName} app-UI body (older default hardcoded "PortOS" + http://localhost:5555)
- 'ux': 1, // 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. Net-new type (no PREVIOUS_DEFAULT_PROMPTS entry needed).
+ 'ux': 1, // 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. Net-new type (no PREVIOUS_DEFAULT_PROMPTS entry needed). 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.
'release-check': 8, // v8: database-backed release tests are provisioned and run using the repo's documented isolated test database before the release PR gate; v7: Step 1 also reads the UNCOLLECTED changelog fragments (the fragment dir, plus whatever preview command that repo documents — release-check is a generic {appName} prompt, so it never names a PortOS script to run) and counts substantive entries across the assembled notes — reading only the staged `.changelog/NEXT.md` under-counts a release whose entries are still per-branch fragments, so a ready release reported as "not enough work". v6: generic {appName} body (older defaults hardcoded "PortOS")
};
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index 91af2eea56..a9a151da07 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -48,6 +48,7 @@ import {
REFERENCE_WATCH_AUDITED_VERSION,
PREVIOUS_DEFAULT_PROMPTS
} from './taskPromptDefaults.js';
+import { isAuditTaskType, defaultFileIssuesFor } from '../lib/auditCatalog.js';
// Re-export the prompt-version constants so existing importers of taskSchedule.js
// are unaffected. The prompt GETTERS (getDefaultPrompt / getTaskPrompt /
@@ -197,14 +198,18 @@ export const SELF_IMPROVEMENT_TASK_TYPES = [
'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,
- // affordances that drift between sibling screens — and files ONE tracker issue
- // per finding instead of committing a speculative redesign. Design judgment is
- // proposed, never auto-merged: `ux` is a TRACKER-FILING type (see
- // TRACKER_FILING_TASK_TYPES in cosTaskGenerator.js), read-only on source.
- // Deliberately narrower than its siblings: raw console errors belong to
- // `ui-bugs`, viewport breakage to `mobile-responsive`, ARIA/contrast/keyboard
- // to `accessibility`.
+ // affordances that drift between sibling screens. Defaults to filing tracker
+ // issues (`fileIssues: true`); the user can flip it to implement. Deliberately
+ // narrower than its siblings: raw console errors belong to `ui-bugs`, viewport
+ // breakage to `mobile-responsive`, ARIA/contrast/keyboard to `accessibility`.
'ux',
+ // Quota-burn `data-safety-audit` counterpart. Migrations, schema parity, and
+ // cross-version compatibility. Defaults to file-issues (safer for unattended).
+ 'data-safety',
+ // Quota-burn `simplify-audit` counterpart. Dead code, unused exports, and
+ // copy-paste drift — distinct from `code-quality` (which is the broader DRY /
+ // long-function / TODO pass). Defaults to file-issues.
+ 'simplify',
// PortOS-only: researches the current best local LLMs per category and
// refreshes the bundled suggested-models catalog (server/lib/localLlmCatalog.js)
// + the editorial family ranking (server/lib/localModelHeuristics.js), opening a
@@ -297,11 +302,11 @@ export const PERPETUAL_DRAIN_DISPATCH_CAP = 5;
export const DEFAULT_BRANCHES_PER_AGENT = 3;
export const DEFAULT_TASK_INTERVALS = {
- 'security': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null },
- 'code-quality': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null },
- 'test-coverage': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null },
- 'performance': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null },
- 'accessibility': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null },
+ 'security': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
+ 'code-quality': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
+ 'test-coverage': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
+ 'performance': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
+ 'accessibility': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
// branch-reconcile first removes fully-merged, clean orphaned worktrees and
// branches, then finishes THIS machine's remaining in-flight LOCAL branches
// per app (open a PR for pushed-but-unopened work, resolve merge conflicts,
@@ -339,11 +344,11 @@ export const DEFAULT_TASK_INTERVALS = {
// non-committing-coordinator posture above. Off by default — enabling it is the
// user's explicit consent to let it mutate issue state on a schedule.
'issue-reconcile': { type: INTERVAL_TYPES.PERPETUAL, enabled: false, providerId: null, model: null, prompt: null, recheckCron: '0 4 * * *', drainDispatchCap: PERPETUAL_DRAIN_DISPATCH_CAP, taskMetadata: { ...NON_COMMITTING_COORDINATOR_METADATA, autoClose: true } },
- 'console-errors': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null },
+ 'console-errors': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
'dependency-updates': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null },
- 'documentation': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null },
- 'ui-bugs': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null },
- 'mobile-responsive': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null },
+ 'documentation': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
+ 'ui-bugs': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
+ 'mobile-responsive': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
// feature-ideas waits for do-replan so new work is grounded in a fresh PLAN.md
// that already accounts for any in-flight or unmerged work.
'feature-ideas': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, runAfter: ['do-replan'], taskMetadata: { useWorktree: true, openPR: true, simplify: true } },
@@ -390,8 +395,8 @@ export const DEFAULT_TASK_INTERVALS = {
// `issueAuthorFilter` applies only when the resolved tracker is a forge
// (github/gitlab); it's inert for plan/jira.
'claim-work': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false, openPR: false, claimFlow: true, simplify: true, issueAuthorFilter: 'self' } },
- 'error-handling': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null },
- 'typing': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null },
+ 'error-handling': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
+ 'typing': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
// Release-check inspects and mutates release state (for example, the main →
// release PR) rather than producing source commits. It must run from the app's
// live main checkout so its branch/ref checks describe the real release flow;
@@ -423,15 +428,17 @@ export const DEFAULT_TASK_INTERVALS = {
// REFERENCE_WATCH_AUDITED_VERSION above; bumping the prompt version requires
// re-auditing this default (a guard test in taskSchedule.test.js enforces it).
'reference-watch': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { readOnly: false } },
- // ux audits the RUNNING app UI and delivers findings as tracker issues, so a
- // CoS-managed worktree/PR is the wrong shape for it entirely — both are LOCKED
- // off (MANAGED_AGENT_OPTIONS). `readOnly: false` for the same reason
- // reference-watch is writable: the prompt's PLAN.md path appends + commits
- // `[ux-…]` checklist items and the forge paths shell out to `gh`/`glab issue
- // create`; `readOnly: true` would inject the "do not modify or commit files"
- // guard and the agent would refuse. Off by default (AI Provider Usage Policy —
- // enabling it is the user's consent to a weekly browser-driving LLM run).
- 'ux': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false, openPR: false, readOnly: false } },
+ // ux audits the RUNNING app UI. Defaults to filing tracker issues
+ // (`fileIssues: true`); flip that off to implement. `readOnly: false` so the
+ // PLAN.md path can commit checklist items / forge paths can `gh issue create`.
+ // Off by default (AI Provider Usage Policy — enabling it is the user's consent
+ // to a weekly browser-driving LLM run).
+ 'ux': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: true, useWorktree: false, openPR: false, readOnly: false } },
+ // data-safety / simplify are the scheduled counterparts of the quota-burn
+ // `data-safety-audit` and `simplify-audit` presets. New types default to
+ // file-issues so an unattended enable doesn't land code. Off by default.
+ 'data-safety': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },
+ 'simplify': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },
// pr-watcher polls for newly-opened PRs, so it runs on a short custom
// interval rather than the loose rotation/daily cadence. 30 min keeps the
// gh polling cheap while still reacting to a PR within one cycle. Default
@@ -491,9 +498,6 @@ export const MANAGED_AGENT_OPTIONS = {
// claim-work delegates to one of the above prompt bodies, each of which
// creates its own worktree + PR — so the same lock applies to the router.
'claim-work': ['useWorktree', 'openPR', 'claimFlow'],
- // ux's deliverable is tracker issues, not code — it never edits source, so a
- // worktree/PR would only produce an empty branch. Lock both off.
- 'ux': ['useWorktree', 'openPR'],
'release-check': ['useWorktree', 'openPR', 'worktreeChangesExpected']
};
@@ -2029,6 +2033,11 @@ export async function getScheduleStatus() {
taskStatus.managedAgentOptions = MANAGED_AGENT_OPTIONS[taskType];
}
+ if (isAuditTaskType(taskType)) {
+ taskStatus.fileIssuesCapable = true;
+ taskStatus.defaultFileIssues = defaultFileIssuesFor(taskType);
+ }
+
// Perpetual tasks park PER-APP (parkPerpetual is called with the appId), so
// the global `status` above (shouldRunTask with no appId) always reads
// 'perpetual-drain' for app-scoped tasks like claim-issue/claim-work even
@@ -2211,25 +2220,25 @@ function formatRelativeTime(timestamp) {
// which reads as an orphaned/legacy task. A parity guard in taskSchedule.test.js
// fails the suite if the two ever drift apart.
export const TASK_TYPE_DESCRIPTIONS = {
- 'ui-bugs': 'Find and fix UI bugs',
- 'mobile-responsive': 'Check mobile responsiveness',
- 'security': 'Security vulnerability audit',
- 'code-quality': 'Code quality improvements',
- 'console-errors': 'Fix console errors',
- 'performance': 'Performance optimization',
- 'test-coverage': 'Improve test coverage',
- 'documentation': 'Update documentation',
+ 'ui-bugs': 'Find UI bugs — file issues or implement fixes',
+ 'mobile-responsive': 'Mobile/responsive audit — file issues or implement fixes',
+ 'security': 'Security audit — file issues or implement fixes',
+ 'code-quality': 'Code quality — file issues or implement fixes',
+ 'console-errors': 'Console errors — file issues or implement fixes',
+ 'performance': 'Performance audit — file issues or implement fixes',
+ 'test-coverage': 'Test coverage — file issues or add tests',
+ 'documentation': 'Docs drift — file issues or implement fixes',
'feature-ideas': 'Implement next planned feature or brainstorm new one',
'plan-task': 'Execute next PLAN.md item, remove it from PLAN.md, log to changelog (worktree+PR)',
'claim-issue': 'Claim and ship the next open GitHub issue (owner-filed or any author), PR closes it',
'claim-work': "Ship the next work item from the app's configured tracker (PLAN.md, GitHub/GitLab issues, or JIRA), routed automatically",
- 'accessibility': 'Accessibility audit',
+ 'accessibility': 'Accessibility audit — file issues or implement fixes',
'branch-reconcile': "Finish this machine's in-flight local branches: clean up merged ones, open PRs, resolve conflicts, drive review, auto-merge when green",
'issue-reconcile': "Heal zombie issues: open + in-progress but their PR already merged with no live claim — close + file a scoped follow-up when work remains, or release the claim so the queue re-picks it",
'dependency-updates': 'Land or resolve open Dependabot/Renovate PRs, then update the dependencies they missed',
'release-check': 'Check for release readiness',
- 'error-handling': 'Improve error handling',
- 'typing': 'Improve TypeScript types',
+ 'error-handling': 'Failure-path audit — file issues or implement fixes',
+ 'typing': 'TypeScript types — file issues or implement fixes',
'pr-reviewer': 'Review open PRs from contributors',
'pr-watcher': 'Run a custom prompt on PRs newly opened against the default branch',
'code-reviewer-a': 'Review the codebase and triage/implement findings (independent provider/model instance A)',
@@ -2238,7 +2247,9 @@ export const TASK_TYPE_DESCRIPTIONS = {
'jira-sprint-manager': 'Triage and implement JIRA sprint tickets',
'jira-status-report': 'Generate JIRA weekly status report',
'reference-watch': 'Watch reference repos and append PLAN.md items for new upstream work',
- 'ux': 'UX/design audit — files issues, no code changes',
+ 'ux': 'UX/design audit — file issues (default) or implement fixes',
+ 'data-safety': 'Data/upgrade-safety audit — file issues (default) or implement fixes',
+ 'simplify': 'Dead-code/duplication audit — file issues (default) or implement removals',
'refresh-local-llm-catalog': "Refresh PortOS's bundled suggested local-model catalog + editorial ranking (PortOS repo only)",
'layered-intelligence': "Read this app's goals + telemetry, ask a reasoning model for one improvement, and file one deduplicated tracker issue — no code, no agent"
};
diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.js
index 5b85594025..db4dc8202d 100644
--- a/server/services/taskSchedule.test.js
+++ b/server/services/taskSchedule.test.js
@@ -1312,20 +1312,20 @@ describe('taskSchedule', () => {
describe('ux defaults (#3273)', () => {
it('is registered as a self-improvement task type with a description', () => {
expect(SELF_IMPROVEMENT_TASK_TYPES).toContain('ux')
- expect(TASK_TYPE_DESCRIPTIONS['ux']).toBe('UX/design audit — files issues, no code changes')
+ expect(TASK_TYPE_DESCRIPTIONS['ux']).toBe('UX/design audit — file issues (default) or implement fixes')
})
- it('defaults to weekly + disabled with worktree/PR locked off', () => {
+ it('defaults to weekly + disabled with file-issues on (worktree/PR off)', () => {
const cfg = DEFAULT_TASK_INTERVALS['ux']
expect(cfg.type).toBe(INTERVAL_TYPES.WEEKLY)
// Off by default — enabling it is the user's consent to a weekly LLM run.
expect(cfg.enabled).toBe(false)
- // The deliverable is tracker issues, so a CoS-managed worktree/PR is wrong.
+ expect(cfg.taskMetadata.fileIssues).toBe(true)
expect(cfg.taskMetadata.useWorktree).toBe(false)
expect(cfg.taskMetadata.openPR).toBe(false)
- expect(MANAGED_AGENT_OPTIONS['ux']).toEqual(['useWorktree', 'openPR'])
- // Writable for the same reason reference-watch is: the agent commits
- // PLAN.md items / shells out to `gh issue create`.
+ // File-issues posture is enforced at dispatch, not via a static lock, so
+ // the user can flip fileIssues off and implement.
+ expect(MANAGED_AGENT_OPTIONS['ux']).toBeUndefined()
expect(cfg.taskMetadata.readOnly).toBe(false)
})
@@ -1347,6 +1347,33 @@ describe('taskSchedule', () => {
})
})
+ describe('audit file-issues types', () => {
+ it('registers data-safety and simplify as disabled weekly file-issues audits', () => {
+ for (const taskType of ['data-safety', 'simplify']) {
+ expect(SELF_IMPROVEMENT_TASK_TYPES).toContain(taskType)
+ expect(TASK_TYPE_DESCRIPTIONS[taskType]).toBeTruthy()
+ const cfg = DEFAULT_TASK_INTERVALS[taskType]
+ expect(cfg.type).toBe(INTERVAL_TYPES.WEEKLY)
+ expect(cfg.enabled).toBe(false)
+ expect(cfg.taskMetadata.fileIssues).toBe(true)
+ expect(cfg.taskMetadata.useWorktree).toBe(false)
+ expect(cfg.taskMetadata.openPR).toBe(false)
+ expect(MANAGED_AGENT_OPTIONS[taskType]).toBeUndefined()
+ }
+ })
+
+ it('surfaces fileIssuesCapable on audit types in getScheduleStatus', async () => {
+ mockSchedule()
+ const status = await getScheduleStatus()
+ expect(status.tasks['security'].fileIssuesCapable).toBe(true)
+ expect(status.tasks['security'].defaultFileIssues).toBe(false)
+ expect(status.tasks['ux'].fileIssuesCapable).toBe(true)
+ expect(status.tasks['ux'].defaultFileIssues).toBe(true)
+ expect(status.tasks['data-safety'].fileIssuesCapable).toBe(true)
+ expect(status.tasks['claim-issue'].fileIssuesCapable).toBeUndefined()
+ })
+ })
+
describe('resetExecutionHistory', () => {
it('should reset global execution history', async () => {
mockSchedule({
diff --git a/server/services/taskTypeHooks.js b/server/services/taskTypeHooks.js
index 026539799b..629aeff1cb 100644
--- a/server/services/taskTypeHooks.js
+++ b/server/services/taskTypeHooks.js
@@ -48,6 +48,7 @@
import { isFalsyMeta, isTruthyMeta } from './agentState.js';
import { TRACKER_FILING_TASK_TYPES, CONCRETE_WORK_TRACKERS } from '../lib/workTracker.js';
+import { isAuditTaskType } from '../lib/auditCatalog.js';
// taskType → () => import('./path/to/hookModule.js'). A module may export either
// or both hooks; a missing export means "no hook of that kind for this type".
@@ -246,6 +247,10 @@ export function declaresNoCommitCriterion(task) {
*/
function isTrackerFilingDispatch(task) {
const type = task?.metadata?.analysisType || task?.metadata?.taskAnalysisType || task?.taskType || null;
+ // Explicit fileIssues on an audit type wins — including turning ux (which
+ // still lives in TRACKER_FILING_TASK_TYPES for back-compat) into do-work.
+ if (isTruthyMeta(task?.metadata?.fileIssues)) return true;
+ if (isFalsyMeta(task?.metadata?.fileIssues) && isAuditTaskType(type)) return false;
if (TRACKER_FILING_TASK_TYPES.has(type)) return true;
return CONCRETE_WORK_TRACKERS.includes(task?.metadata?.workTracker);
}
diff --git a/server/services/taskTypeHooks.noCommit.test.js b/server/services/taskTypeHooks.noCommit.test.js
index 460d854ebe..baf7df18ee 100644
--- a/server/services/taskTypeHooks.noCommit.test.js
+++ b/server/services/taskTypeHooks.noCommit.test.js
@@ -76,6 +76,24 @@ describe('declaresNoCommitCriterion', () => {
// `worktreeChangesExpected` is a user-settable per-app taskMetadata override
// accepted for EVERY task type; setting it there is asking to skip the TUI
// clean-tree gate, not to disable success validation.
+ it('exempts an audit type that opted into file-issues', () => {
+ expect(declaresNoCommitCriterion(task({
+ analysisType: 'security',
+ fileIssues: true,
+ worktreeChangesExpected: false,
+ }))).toBe(true);
+ });
+
+ it('does not treat an audit type as tracker-filing when fileIssues is off', () => {
+ // ux is in TRACKER_FILING_TASK_TYPES for back-compat; an explicit
+ // fileIssues:false means this run is implementing, so the commit check stays.
+ expect(declaresNoCommitCriterion(task({
+ analysisType: 'ux',
+ fileIssues: false,
+ worktreeChangesExpected: false,
+ }))).toBe(false);
+ });
+
it('does not exempt the flag alone, with no tracker-filing marker', () => {
expect(declaresNoCommitCriterion(task({
analysisType: 'security',