feat(agents): add native GEO Audit Agent#3327
Conversation
Installs a per-org Virtual MCP that runs the open-source geo-seo-claude toolkit (https://github.com/zubair-trabzada/geo-seo-claude) inside Studio's warm sandbox. The agent's metadata.instructions orchestrates the audit via the built-in VM tools (bash/read/write/share_with_user) — no separately deployed MCP, no Python rewrite. The geo-seo-claude repo is cloned fresh on the first turn of every thread; pip install + playwright install are gated by marker files for warm-pool reuse. - apps/mesh/src/agents/geo-seo/prompt.md: ported SKILL.md, XML-structured to match studio-pack convention; sandbox bootstrap, per-audit-type dispatch, composite scoring formula, archive via share_with_user. - apps/mesh/src/agents/geo-seo/index.ts: installGeoAuditAgent() server function mirroring installStudioPack; idempotent canonical id. - apps/mesh/src/auth/org.ts: seedOrgDb hook installs the agent for new orgs. - apps/mesh/migrations/077-install-geo-seo-agent.ts: backfill for existing orgs, idempotent via onConflict.doNothing. GitHub issue creation is deferred — the sandbox does not yet expose GITHUB_TOKEN to gh; v1 archives only via share_with_user (presigned S3). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Release OptionsSuggested: Minor ( React with an emoji to override the release type:
Current version:
|
There was a problem hiding this comment.
2 issues found across 5 files
You’re at about 94% of the monthly review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mesh/migrations/077-install-geo-seo-agent.ts">
<violation number="1" location="apps/mesh/migrations/077-install-geo-seo-agent.ts:28">
P2: This migration reads prompt content from a live source file, so rerunning it later can produce different data (or fail if the file moves). Store an immutable prompt snapshot in the migration itself (or a migration-local snapshot file) instead.</violation>
</file>
<file name="apps/mesh/src/agents/geo-seo/prompt.md">
<violation number="1" location="apps/mesh/src/agents/geo-seo/prompt.md:87">
P2: Archive instructions assume every non-full audit has a markdown artifact, but `quick` has no file output and `llmstxt` outputs `llms.txt`, so the current rule can fail for valid audit modes.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| const AGENT_ICON = "icon://BarChart02?color=violet"; | ||
|
|
||
| export async function up(db: Kysely<unknown>): Promise<void> { | ||
| const instructions = readFileSync(PROMPT_PATH, "utf-8"); |
There was a problem hiding this comment.
P2: This migration reads prompt content from a live source file, so rerunning it later can produce different data (or fail if the file moves). Store an immutable prompt snapshot in the migration itself (or a migration-local snapshot file) instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/migrations/077-install-geo-seo-agent.ts, line 28:
<comment>This migration reads prompt content from a live source file, so rerunning it later can produce different data (or fail if the file moves). Store an immutable prompt snapshot in the migration itself (or a migration-local snapshot file) instead.</comment>
<file context>
@@ -0,0 +1,101 @@
+const AGENT_ICON = "icon://BarChart02?color=violet";
+
+export async function up(db: Kysely<unknown>): Promise<void> {
+ const instructions = readFileSync(PROMPT_PATH, "utf-8");
+ const metadata = JSON.stringify({ instructions });
+
</file context>
| - **Methodology appendix** — list which scripts ran and the geo-seo-claude commit hash from the bootstrap output. | ||
|
|
||
| 5. **Archive and reply.** | ||
| - Use `share_with_user` to upload `/workspace/out/GEO-AUDIT-REPORT.md` (or the type-specific markdown if not a full audit). Pass the returned URL back to the user as a clickable link. |
There was a problem hiding this comment.
P2: Archive instructions assume every non-full audit has a markdown artifact, but quick has no file output and llmstxt outputs llms.txt, so the current rule can fail for valid audit modes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/agents/geo-seo/prompt.md, line 87:
<comment>Archive instructions assume every non-full audit has a markdown artifact, but `quick` has no file output and `llmstxt` outputs `llms.txt`, so the current rule can fail for valid audit modes.</comment>
<file context>
@@ -0,0 +1,102 @@
+ - **Methodology appendix** — list which scripts ran and the geo-seo-claude commit hash from the bootstrap output.
+
+5. **Archive and reply.**
+ - Use `share_with_user` to upload `/workspace/out/GEO-AUDIT-REPORT.md` (or the type-specific markdown if not a full audit). Pass the returned URL back to the user as a clickable link.
+ - In chat, render a compact summary table (composite score + per-category scores + top 3 actions). Do NOT paste the full report into chat.
+ - If a GitHub repo is attached to this thread (a "Repo Environment" block appears at the top of these instructions when one is set), append a one-line note: "GitHub repo detected: `{owner}/{repo}` — automatic issue creation will be available once sandbox-side `gh` credentials are wired up." (Issue creation is a follow-up; v1 archives only via `share_with_user`.)
</file context>
Summary
Installs a per-org Virtual MCP — GEO Audit Agent — that runs the open-source geo-seo-claude toolkit inside Studio's warm sandbox to audit a website's visibility to AI search engines (ChatGPT, Claude, Perplexity, Google AI Overviews) and produce a composite GEO Score with a prioritized action plan.
The agent is fully native and declarative — no separately deployed MCP, no Python rewrite, no new external infrastructure. The agent's
metadata.instructionsorchestrates the audit using Studio's built-in VM tools (bash/read/write/share_with_user); the geo-seo-claude repo is cloned fresh on the first turn of every thread andpip install+playwright installare gated by marker files for warm-pool reuse.What's in the diff
apps/mesh/src/agents/geo-seo/prompt.md— portedSKILL.md, XML-structured to match the studio-pack convention. Sandbox bootstrap, per-audit-type dispatch table (full|quick|citability|crawlers|llmstxt|brands|schema|technical|content|platforms), composite scoring formula, archive viashare_with_user, quality gates.apps/mesh/src/agents/geo-seo/index.ts—installGeoAuditAgent()mirroringinstallStudioPack, with stablegeo-audit_<orgId>id and idempotentfindByIdskip.apps/mesh/src/auth/org.ts—seedOrgDbhook installs the agent for every new org alongside the studio pack.apps/mesh/migrations/077-install-geo-seo-agent.ts— backfill for existing orgs, idempotent viaonConflict.doNothing. Owner attribution follows the same pattern as048-merge-projects-agents.Out of scope (flagged for follow-up)
GITHUB_TOKENto theghCLI (apps/mesh/src/tools/vm/start.ts:306-313bakes the token into the clone URL only). v1 archives only viashare_with_user. Wiringghwould unlock the "open issues per finding when a repo is attached" branch already noted in the prompt.scripts/generate_pdf_report.py) — present in the cloned repo but not dispatched by the prompt.geo-prospect,geo-proposal,geo-compare) — would need ageo_prospectsstorage table; deferred.Test plan
bun run --cwd=apps/mesh migratesucceeds; existing org gets ageo-audit_<orgId>row withsubtype = 'agent'.bun run devboots cleanly; GEO Audit Agent appears in the agents list with the violetBarChart02avatar.https://example.com. Observe SSE: first-turnbashcalls clone the repo, install requirements, install Playwright; subsequent turns reuse the warm sandbox (the.deps_installed/.playwright_installedmarker files short-circuit the install steps)./workspace/out/GEO-AUDIT-REPORT.mdand the agent returns ashare_with_userpresigned URL in chat with a compact summary table (composite score + top 3 actions).quick https://example.com) returns an inline 60-second snapshot without writing files.down()removes onlygeo-audit_*VIRTUAL connections.🤖 Generated with Claude Code
Summary by cubic
Add a native, per‑org GEO Audit Agent that runs
geo-seo-claudeinside Studio’s warm sandbox to audit a site’s visibility in AI search and produce a composite GEO Score with a prioritized action plan. Fully virtual (no external infra) and idempotent per org.New Features
geo-audit_<orgId>and violetBarChart02icon.bash/read/write/share_with_user); clonesgeo-seo-claudeon first turn, caches installs with marker files.full,quick,citability,crawlers,llmstxt,brands,schema,technical,content,platforms, plus composite scoring and report archiving.Migration
077-install-geo-seo-agentbackfills the agent for existing orgs;onConflict.doNothingkeeps it safe to re-run.seedOrgDbinstalls the agent for new orgs.down()removes onlygeo-audit_*VIRTUAL connections.Written for commit 096b091. Summary will update on new commits.