Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
add grok as a selectable Review Loop code reviewer
[._.]/ Adam Eivya6c7b8a0258b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 89ceedd96f..f0a3a425a9 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -20,6 +20,8 @@- **Layered Intelligence now evaluates a managed app against its OWN goals and performance — not PortOS's agent telemetry.** Running the loop on a managed app previously fed it the PortOS install's global autonomous-agent run stats (`data/cos/learning.json`) as the "CoS metrics" source — which is on by default for every app — so a managed-app run reasoned over PortOS's tooling performance instead of the app's own product performance. Two changes fix this: (1) a new **App metrics (METRICS.md)** telemetry source, on by default for every app, reads a repo-root `METRICS.md` from the app (same as `GOALS.md`/`PLAN.md`) — the place an app documents how it measures success (user-success KPIs, production telemetry, where its data lives, and read-only queries an agent can run); and (2) the **CoS metrics** source now defaults **on only for the PortOS install** (where the agent stats genuinely are its own-performance metric) and **off for managed apps** (where they're a tooling/interaction signal, still opt-in). The reasoning prompt is reframed around "how is THIS app performing against its own goals and purpose," and when a managed app exposes no own-performance metrics the loop is nudged to propose adding a `METRICS.md` as an `app-data-gap`. New standard documented in [`docs/METRICS.md`](../docs/METRICS.md); apps can also wire a custom `cmd`/`http` source to feed live numbers into each run. Back-compat: these are default changes only — any explicitly-stored source toggle is preserved, so no migration is needed.+- **Grok is now selectable as a Review Loop code reviewer.** The reviewer picker (AI Providers → Code Review Defaults, plus the per-task task form and the per-task-type Schedule config) gains a **Grok** option alongside Claude, Codex, and Antigravity. Selecting it adds `grok` to slashdo's `--review-with` list, and the review-loop follow-up agent invokes the Grok Build CLI (`grok`) headless against the PR diff — the same CLI-reviewer path the other coding-agent reviewers use (it already routed any non-Copilot/non-local-LLM reviewer generically). New enum value `grok` in `REVIEWER_VALUES` (mirrored in the client `REVIEWER_OPTIONS`); no migration needed (absent from a stored list = not selected, and the default reviewer stays `copilot`).+- **Code Review Defaults can now gate merges on arbitrary GitHub reviewer usernames (e.g. `@CodeReviewbot`).** The Review Loop was limited to a fixed set of reviewer kinds (Copilot, the Claude/Antigravity/Codex CLIs, and the local LM Studio/Ollama backends); there was no way to require a specific GitHub bot or teammate as a PR reviewer. The reviewer picker (AI Providers → Code Review Defaults, plus per-task in the task form and per-task-type in the Schedule config) grows a **"GitHub reviewers (gate merge)"** row where you type any GitHub username or `org/team` slug. Those usernames are appended to slashdo's `--review-with` as `@user` tokens after the keyed reviewers, and the review-loop follow-up agent is instructed to request each as a PR reviewer (`gh pr edit … --add-reviewer`), wait for their review, and treat their approval as a merge gate — end to end through the original-agent completion prompt, the follow-up loop, and the `/do:next` claim flow. Usernames are stored without the `@`, validated against a shell-safe GitHub-username charset (1–39 chars, alphanumeric/hyphen, optional `/team`), case-insensitively deduped, and capped at 20, so a hand-edited `settings.json` can't smuggle in an unsafe or oversized token. They're a distinct class from the behavior reviewers — external PR reviewers that gate the merge, not CLIs that apply fixes — so `--reviewer-applies` never turns on for a username-only addition, and a username reviewer is forge-agnostic (kept even when Copilot is stripped on a non-GitHub forge, and able to drive the loop on its own). New config key: `settings.codeReview.usernames` (+ per-task `metadata.usernames`); no migration needed (absent = none).- **Image Gen now supports arbitrary (larger) output dimensions, not just the fixed preset list.** The resolution dropdown gained a **Custom…** entry that reveals Width and Height number inputs, so sizes the presets never covered — e.g. 704×1280 (9:16 portrait) for Z-Image — no longer require adding a new preset. Any edge in 64–3840px is accepted as long as the total stays ≤ 8,294,400px (the same `imageEdgeSchema` + pixel cap the server already enforced); a below-minimum edge snaps up to 64 (on blur, and again at submit so an Enter-key submit can't slip a sub-64 value through), and an over-cap total shows an inline warning before you submit. Custom mode also auto-engages whenever the current size matches no preset (a remix, an uploaded init image, or a stale off-backend size), so the exact dimensions stay visible and editable instead of collapsing to a read-only "(custom)" label. The inputs live in the shared `ImageGenControls`, so the Image Gen page, Universe Builder batch render, and the pipeline image-gen drawers all get custom dimensions at once.diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.jsindex 377457e132..be56645f8c 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -81,7 +81,7 @@ export const AGENT_OPTIONS = [];// Reviewer choices for the Review Loop. `copilot` requests a GitHub Copilot-// review via the native reviewer API; CLI reviewers (claude/antigravity/codex)+// review via the native reviewer API; CLI reviewers (claude/antigravity/codex/grok)// instruct the follow-up agent to invoke the named CLI; local-LLM reviewers// (lmstudio/ollama) route the diff through PortOS's `POST /api/code-review/local`// endpoint, which runs the model configured on the AI Providers → Code Review@@ -92,6 +92,7 @@ export const REVIEWER_OPTIONS = [{ value: 'claude', label: 'Claude', description: 'Claude CLI reviews the PR diff' },{ value: 'antigravity', label: 'Antigravity', description: 'Antigravity CLI (agy) reviews the PR diff' },{ value: 'codex', label: 'Codex', description: 'Codex CLI reviews the PR diff (optional model tier on AI Providers → Code Review Defaults)' },+ { value: 'grok', label: 'Grok', description: 'Grok Build CLI (grok) reviews the PR diff' },{ value: 'lmstudio', label: 'LM Studio', description: 'Local LM Studio model reviews the diff (set model on AI Providers)' },{ value: 'ollama', label: 'Ollama', description: 'Local Ollama model reviews the diff (set model on AI Providers)' }];diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex c1cc2495e6..ca8db460b9 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -16,12 +16,12 @@ import { emptyToUndefined, emptyToNull } from './zodCompat.js';// =============================================================================// Reviewer choices for the Review Loop. `copilot` requests a native GitHub-// Copilot review; `claude`/`antigravity`/`codex` instruct the review-loop follow-up-// agent to invoke the named CLI to critique the PR diff; `lmstudio`/`ollama`+// Copilot review; `claude`/`antigravity`/`codex`/`grok` instruct the review-loop+// follow-up agent to invoke the named CLI to critique the PR diff; `lmstudio`/`ollama`// route the diff through PortOS's local code-review endpoint// (`POST /api/code-review/local`) which runs the configured local LLM model.// Mirrored in client/src/components/cos/constants.js → REVIEWER_OPTIONS.-export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'lmstudio', 'ollama'];+export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'lmstudio', 'ollama'];export const REVIEWER_ALIASES = { gemini: 'antigravity' };export const DEFAULT_REVIEWER = 'copilot';export const DEFAULT_REVIEWERS = ['copilot'];diff --git a/server/lib/validation.test.js b/server/lib/validation.test.jsindex 67274828db..502ff7d0d0 100644--- a/server/lib/validation.test.js+++ b/server/lib/validation.test.js@@ -674,6 +674,7 @@ describe('validation.js', () => {expect(sanitizeTaskMetadata({ reviewer: 'antigravity' })).toEqual({ reviewer: 'antigravity' });expect(sanitizeTaskMetadata({ reviewer: 'gemini' })).toEqual({ reviewer: 'antigravity' });expect(sanitizeTaskMetadata({ reviewer: 'codex' })).toEqual({ reviewer: 'codex' });+ expect(sanitizeTaskMetadata({ reviewer: 'grok' })).toEqual({ reviewer: 'grok' });expect(sanitizeTaskMetadata({ reviewLoop: true, reviewer: 'claude' })).toEqual({ reviewLoop: true, reviewer: 'claude' });});diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.jsindex 948974c073..f4193656fd 100644--- a/server/services/agentPromptBuilder.js+++ b/server/services/agentPromptBuilder.js@@ -315,7 +315,7 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,hasCopilot ? `**copilot**: ${copilotIsFirst? 'wait for the initial Copilot review the system already pre-requested (Copilot leads the list)': 'request a Copilot review when you reach its turn'} (poll every 5–15s, max 5 min/round), then re-request on later rounds.` : null,- hasCli ? `**codex / antigravity / claude**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff <base-branch>...HEAD\`; on GitHub \`gh pr diff ${prNumber || ''}\` also works).${codexModelNote}` : null,+ hasCli ? `**codex / antigravity / claude / grok**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff <base-branch>...HEAD\`; on GitHub \`gh pr diff ${prNumber || ''}\` also works).${codexModelNote}` : null,hasLocalLlm ? `**lmstudio / ollama**: ${localLlmInvocation}` : null,hasGithubUser ? `**@github reviewers**: ${githubUsersInvocation}` : null,].filter(Boolean).join(' ');diff --git a/server/services/agentWorktreeCleanup.js b/server/services/agentWorktreeCleanup.jsindex 150be821b7..19375d44b3 100644--- a/server/services/agentWorktreeCleanup.js+++ b/server/services/agentWorktreeCleanup.js@@ -35,7 +35,7 @@ import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, normaliz* GitHub Copilot review is pre-requested here only when copilot LEADS the list (otherwise* the follow-up requests it at its turn so Copilot sees the post-fix diff). `reviewStopMode`* (`all`/`on-findings`/`on-clean`) and `reviewerApplies` are threaded into the follow-up's- * metadata. CLI reviewers (claude/antigravity/codex) are always driven by the follow-up agent,+ * metadata. CLI reviewers (claude/antigravity/codex/grok) are always driven by the follow-up agent,* which works on any forge; copilot is GitHub-only and dropped on non-GitHub remotes.* When skipMerge is true (review-loop follow-up agents), the cleanup never auto-merges* the worktree branch into the source workspace because `gh pr merge` already handled it.@@ -242,7 +242,7 @@ export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, pif (!prUrl || !prBranch) return null;const parsedPr = git.parsePullRequestUrl(prUrl);- // Copilot is GitHub-only; CLI-based reviewers (claude/antigravity/codex) work on any+ // Copilot is GitHub-only; CLI-based reviewers (claude/antigravity/codex/grok) work on any// forge because the agent invokes the CLI directly. On a non-GitHub forge, drop// copilot from the list — if nothing's left (and no username reviewers), there's// no review to run.diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.jsindex 634c5b58f7..dcfc1b4fbb 100644--- a/server/services/cosTaskGenerator.js+++ b/server/services/cosTaskGenerator.js@@ -2000,7 +2000,9 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, stconst codeReviewDefaults = await getCodeReviewDefaults().catch(() => null);// Drop local-LLM reviewers (lmstudio/ollama) from the prompt's {reviewers}// token: the claim/plan prompt templates only document how to drive copilot- // and the CLI reviewers (claude/codex/antigravity). Unlike the system+ // and the CLI reviewers (claude/codex/antigravity; grok flows through the same+ // generic CLI path but isn't yet named in the per-kind bullet — see #2453).+ // Unlike the system// review-loop follow-up prompt (agentPromptBuilder.js), they carry no// local-endpoint invocation instructions, so naming a local-LLM reviewer// here would stall the agent's review step. Fall through to the hardcoded