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

fix(mind): route delegated tasks to the repo that will hold the change

Adam Eivyb4a0ced1fc73
diff --git a/server/services/persistentMindTaskCapability.js b/server/services/persistentMindTaskCapability.js
index 0611b19483..82c996ba2f 100644
--- a/server/services/persistentMindTaskCapability.js
+++ b/server/services/persistentMindTaskCapability.js
@@ -19,6 +19,7 @@ import { antigravityBaseModels, effortLevelsForProvider, filterSelectableModels
import { PR_COMPLETIONS } from '../lib/prDisposition.js';
import { sha256Text } from '../lib/fileUtils.js';
import { MANAGED_ASSESSMENT_BACKENDS, localRuntimeKind } from '../lib/localProviderRuntime.js';
+import { PORTOS_APP_ID } from '../lib/appIdentity.js';
import { resolveAppWorkTracker } from '../lib/workTracker.js';
import { getActiveApps, getAppWorkTracker } from './apps.js';
import { loadState } from './cosState.js';
@@ -159,6 +160,9 @@ const appCatalogEntry = async (app) => {
id: app.id,
name: String(app.name || app.id).slice(0, 100),
planOnly: ISSUE_TRACKERS.has(tracker?.resolved),
+ // Only the baseline entry carries the flag, so the prompt catalog stays
+ // small and the mind has one unambiguous answer to "which repo is mine".
+ ...(app.id === PORTOS_APP_ID ? { self: true } : {}),
};
};
@@ -292,6 +296,15 @@ workspace checks before queueing. Supported checks are 'dependencies',
'engines', 'submodules', 'forge', and 'reviewers'. An omitted or empty list
keeps absent dependencies advisory, which is appropriate for docs-only work.
+Choosing the app: pick the repository that will hold the change, not the subject
+the work is about. PortOS owns every integration it ships — the connector,
+projection, routes, UI, and settings for another app all live in the PortOS repo,
+whose catalog entry, when you are granted it, is marked 'self: true'. Target
+another app's repo only when the change must land in that repo's own source. When
+PortOS work looks like it needs something another project does not expose yet,
+still target PortOS: the task can establish from PortOS's own integration what is
+genuinely missing there before anyone proposes a change to that project.
+
Configured choices (ids are authoritative; do not invent ids):
${JSON.stringify(promptCatalog)}
diff --git a/server/services/persistentMindTaskCapability.test.js b/server/services/persistentMindTaskCapability.test.js
index 0905d95534..353649c07d 100644
--- a/server/services/persistentMindTaskCapability.test.js
+++ b/server/services/persistentMindTaskCapability.test.js
@@ -45,6 +45,8 @@ vi.mock('./persistentMindWorkspacePreflight.js', () => ({
assessPersistentMindWorkspaceReadiness: (...args) => mocks.assessWorkspaceReadiness(...args),
}));
+const { PORTOS_APP_ID } = await import('../lib/appIdentity.js');
+
const {
buildPersistentMindTaskCapabilityPrompt,
executePersistentMindTaskRequests,
@@ -123,6 +125,21 @@ describe('persistent mind CoS-task capability', () => {
expect(prompt).not.toContain('command');
});
+ it('flags only the PortOS baseline app and tells the mind to route by owning repo', async () => {
+ mocks.apps = [
+ { id: PORTOS_APP_ID, name: 'PortOS', repoPath: '/example/portos' },
+ { id: 'managed-app', name: 'Managed App', repoPath: '/example/managed' },
+ ];
+ const catalog = await readPersistentMindTaskCatalog();
+ expect(catalog.apps).toEqual([
+ { id: PORTOS_APP_ID, name: 'PortOS', planOnly: false, self: true },
+ { id: 'managed-app', name: 'Managed App', planOnly: false },
+ ]);
+ const prompt = buildPersistentMindTaskCapabilityPrompt({ enabled: true, catalog });
+ expect(prompt).toContain('pick the repository that will hold the change');
+ expect(prompt).toContain("marked 'self: true'");
+ });
+
it('publishes only allowlisted task models and rejects a model outside the policy', async () => {
mocks.root.config.persistentMindCapabilities.taskModelAllowlist = [
{ providerId: 'codex', model: 'gpt-5-mini' },