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 scheduled "refresh-local-llm-catalog" CoS task

[._.]/ Adam Eivy800b32c91c2e
diff --git a/server/services/taskPromptService.js b/server/services/taskPromptService.js
index 09d2b74276..0036a5ca73 100644
--- a/server/services/taskPromptService.js
+++ b/server/services/taskPromptService.js
@@ -1266,7 +1266,75 @@ this prompt explicitly say to. This default behavior is review-and-comment only;
the operator customizes this prompt to change what happens on each opened PR.
Finish with a 2–3 sentence assistant summary: how many PRs you handled and what
-you did for each (one line per PR with its number).`
+you did for each (one line per PR with its number).`,
+
+ 'refresh-local-llm-catalog': `[Improvement: {appName}] Refresh the bundled local-LLM suggested-models catalog
+
+You maintain PortOS's curated catalog of suggested local models so the in-app
+install picker and the editorial-model recommendation keep pace with what's
+actually current. Models move fast (new Qwen / Llama / Gemma / Mistral releases,
+deprecations), and this catalog is shipped in the app — so it goes stale unless
+refreshed.
+
+Repository: {repoPath}
+Default branch: {defaultBranch}
+
+## Guard — PortOS only
+
+1. Check that \`{repoPath}/server/lib/localLlmCatalog.js\` exists. If it does NOT,
+ this repository is not PortOS — make NO changes, open NO PR, and finish with a
+ one-line summary saying the catalog file was not found so there was nothing to do.
+
+## What to do (only when the catalog file exists)
+
+2. Read the current catalog at \`server/lib/localLlmCatalog.js\` (the
+ \`LOCAL_LLM_CATALOG\` array; each entry is
+ \`{ key, name, category, params, size, family, description, capabilities, ollama?, lmstudio? }\`)
+ and the editorial ranking \`EDITORIAL_FAMILY_RANK\` in
+ \`server/lib/localModelHeuristics.js\`.
+
+3. Research the current best-in-class local models for EACH category in
+ \`LOCAL_LLM_CATEGORIES\` (chat, reasoning, coding, vision/image-analysis,
+ embedding, lightweight/small-&-fast, multilingual). Prefer models that are:
+ - Pullable on Ollama (use the canonical \`ollama pull\` id) and/or available
+ as a well-known GGUF build on LM Studio / Hugging Face (use the canonical
+ repo id, e.g. \`lmstudio-community/<Model>-GGUF\`).
+ - Genuinely current and widely used — not every brand-new release. Verify the
+ pull id actually exists before adding it (cite your source in the PR body).
+ Use web search / fetch if the tools are available; otherwise rely on your
+ most current knowledge and clearly mark any entry you could not verify.
+
+4. Update \`LOCAL_LLM_CATALOG\`:
+ - Add newly-prominent models, refresh \`params\`/\`size\`/\`description\` on
+ existing entries, and remove models that are clearly deprecated/superseded.
+ - Keep the module's shape EXACTLY: do not change the exports
+ (\`BACKENDS\`, \`isBackend\`, \`LOCAL_LLM_CATEGORIES\`, \`LOCAL_LLM_CATALOG\`),
+ the entry field names, or \`category\` values (they must stay within
+ \`LOCAL_LLM_CATEGORIES\` ids). A missing \`ollama\`/\`lmstudio\` id is fine
+ when no well-known build exists for that backend.
+
+5. Review \`EDITORIAL_FAMILY_RANK\` in \`server/lib/localModelHeuristics.js\` (used
+ to recommend a model for editorial review/editing — it favors tight
+ instruction-following over chatty/RAG-tuned families). Only adjust it if a new
+ family clearly belongs or an existing one should move; keep the
+ longest-match-first ordering (\`command-r-plus\` before \`command-r\` before
+ \`command\`). Do not change the function signatures or other exports.
+
+6. Run the affected tests and make sure they pass:
+ \`cd {repoPath}/server && npx vitest run lib/localLlmCatalog lib/localModelHeuristics lib/index.test.js\`.
+ If you changed the catalog's exported shape you broke the contract — revert
+ that part. Fix any test you legitimately invalidated (e.g. an entry count).
+
+7. Add a one-line entry to \`{repoPath}/.changelog/NEXT.md\` under \`## Changed\`
+ summarizing the catalog refresh.
+
+## Output
+
+- If the catalog is already current and accurate, make NO changes — do not open
+ an empty PR. Finish with a summary saying it was already up to date.
+- Otherwise commit your changes with a clear message (a PR will be opened for
+ the branch). Finish with a 2–4 sentence summary listing exactly which models
+ were added, updated, or removed and the sources you verified them against.`
};
// Prompt versions — bump when a default prompt changes so existing instances auto-upgrade.
@@ -1279,7 +1347,8 @@ export const PROMPT_VERSIONS = {
'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': 2, // 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': 1 // v1: review-and-comment default for newly-opened PRs on the app's default branch
+ 'pr-watcher': 1, // v1: review-and-comment default for newly-opened PRs on the app's default branch
+ 'refresh-local-llm-catalog': 1 // v1: research current local models, refresh LOCAL_LLM_CATALOG + EDITORIAL_FAMILY_RANK, PR (PortOS repo only)
};
// Audit anchor for reference-watch's read/write coupling.
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index 81ed465b5f..c8ebf7c88f 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -148,7 +148,13 @@ export const SELF_IMPROVEMENT_TASK_TYPES = [
// 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.
- 'reference-watch'
+ 'reference-watch',
+ // 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
+ // PR. No-ops on any repo lacking that catalog file, so enabling it on a
+ // non-PortOS app does nothing. See DEFAULT_TASK_PROMPTS['refresh-local-llm-catalog'].
+ 'refresh-local-llm-catalog'
];
// Shared config for code-reviewer-a and code-reviewer-b (two instances for independent provider/model configuration)
@@ -221,7 +227,13 @@ export const DEFAULT_TASK_INTERVALS = {
// it to 'self' or 'others' in the schedule UI. `readOnly: false` so a
// customized prompt can make changes if the operator wants — the shipped
// default prompt only reviews + comments.
- 'pr-watcher': { type: INTERVAL_TYPES.CUSTOM, intervalMs: 1800000, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { prAuthorFilter: 'any', readOnly: false } }
+ 'pr-watcher': { type: INTERVAL_TYPES.CUSTOM, intervalMs: 1800000, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { prAuthorFilter: 'any', readOnly: false } },
+ // refresh-local-llm-catalog maintains PortOS's own bundled suggested-models
+ // catalog. CoS manages the worktree + PR (like feature-ideas/do-replan) — the
+ // agent only edits the catalog file. Weekly is generous; the prompt only opens
+ // a PR when the catalog is actually stale, so most runs are no-ops. Off by
+ // default; the user enables it on the PortOS app.
+ 'refresh-local-llm-catalog': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: true, openPR: true, simplify: true } }
};
// Agent-options that a task manages internally — UI locks the toggle, and
@@ -1209,7 +1221,9 @@ function getTaskTypeDescription(taskType) {
'pr-reviewer': 'Review open PRs from contributors',
'pr-watcher': 'Run a custom prompt on PRs newly opened against the default branch',
'jira-sprint-manager': 'Triage and implement JIRA sprint tickets',
- 'jira-status-report': 'Generate JIRA weekly status report'
+ 'jira-status-report': 'Generate JIRA weekly status report',
+ 'reference-watch': 'Watch reference repos and append PLAN.md items for new upstream work',
+ 'refresh-local-llm-catalog': "Refresh PortOS's bundled suggested local-model catalog + editorial ranking (PortOS repo only)"
};
return descriptions[taskType] || taskType.replace(/-/g, ' ');
}
diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.js
index b7f3f52caf..9a7e69d1ac 100644
--- a/server/services/taskSchedule.test.js
+++ b/server/services/taskSchedule.test.js
@@ -870,6 +870,33 @@ describe('taskSchedule', () => {
})
})
+ describe('refresh-local-llm-catalog defaults', () => {
+ it('is registered as a self-improvement task type', () => {
+ expect(SELF_IMPROVEMENT_TASK_TYPES).toContain('refresh-local-llm-catalog')
+ })
+
+ it('defaults to weekly, disabled, with CoS-managed worktree + PR', () => {
+ const cfg = DEFAULT_TASK_INTERVALS['refresh-local-llm-catalog']
+ expect(cfg.type).toBe(INTERVAL_TYPES.WEEKLY)
+ expect(cfg.enabled).toBe(false)
+ // CoS manages the worktree + PR (like feature-ideas), so these are NOT
+ // in MANAGED_AGENT_OPTIONS (the user could turn them off if they wanted).
+ expect(cfg.taskMetadata.useWorktree).toBe(true)
+ expect(cfg.taskMetadata.openPR).toBe(true)
+ expect(MANAGED_AGENT_OPTIONS['refresh-local-llm-catalog']).toBeUndefined()
+ })
+
+ it('prompt guards on the PortOS catalog file and targets the catalog + ranking', async () => {
+ const prompt = await getTaskPrompt('refresh-local-llm-catalog')
+ // No-ops on any repo lacking the catalog file (so enabling on a non-PortOS app is safe).
+ expect(prompt).toContain('server/lib/localLlmCatalog.js')
+ expect(prompt).toContain('LOCAL_LLM_CATALOG')
+ expect(prompt).toContain('EDITORIAL_FAMILY_RANK')
+ // Must not open an empty PR when nothing changed (phrase may be line-wrapped).
+ expect(prompt).toContain('empty PR')
+ })
+ })
+
describe('resetExecutionHistory', () => {
it('should reset global execution history', async () => {
mockSchedule({
diff --git a/server/services/workflow.js b/server/services/workflow.js
index aba51a91f0..eb0d492f82 100644
--- a/server/services/workflow.js
+++ b/server/services/workflow.js
@@ -68,7 +68,8 @@ export const WORKFLOW_STAGES = [
'error-handling',
'typing',
'ui-bugs',
- 'mobile-responsive'
+ 'mobile-responsive',
+ 'refresh-local-llm-catalog'
],
jobIds: ['job-wiki-maintenance']
},