I open-sourced a GEO (AI search visibility monitoring) system called ZZ Geo before. After shipping v0.1.0 and using it myself for a while, the more I looked at it, the more it felt like a traditional heavyweight SaaS backend: multi-tenancy, an RBAC permission tree, a pile of member-management tables—and before you could even start sampling, you had to configure five web search API keys plus a cloud LLM key. Annoying, and it burned extra Tokens.
Most of my coding and workflow runs happen locally in Claude Code, Cursor, Codex, or Antigravity anyway; the browser is only for viewing data and clicking confirm. So these past few days I tore down the whole architecture and rebuilt it as v0.2.0, pushed a Release, and figured I'd write down the baggage I removed and a few key engineering implementations. The full version with multiple high-res UI screenshots and a breakdown of 24 answers is in my technical blog retrospective notes.
- Dropping heavyweight permissions, inverting the architecture to Local MCP + read-only Dashboard
Migrations 0037 and 0038 flat-out deleted multi-tenant management, org caps, /api/rbac/*, and /api/users* as whole blocks. I kept only a single-workspace admin (localhost 127.0.0.1 is login-free by default; remote access uses a single password or a >=16-char GEO_API_TOKEN) and hard isolation based on project_id. The underlying authorization/resources.ts and the sealed read-only trigger geo_guard_project_row were left untouched.
All write operations are collected into the standalone package apps/mcp-server (pure TypeScript + zod, zero new external runtime dependencies), exposing 46 tools over standard stdio JSON-RPC 2.0. After running corepack pnpm geo start, execute corepack pnpm geo mcp-config and it spits out JSON with absolute local paths; paste it into Claude Code / Cursor / Codex and it can take over project setup, official-site audits, batch creation, data collection, semantic scoring, diagnosis/remediation, Vault knowledge base, and report freezing.
The web frontend and Tauri desktop app (native macOS build) have been reduced to a pure read-only dashboard with 2 spaces and 10 views. The only thing intentionally left to humans is approval authority: none of the 46 MCP tools expose any approve endpoint. Anything that marks a Vault note as publicly visible, or submits a diagnosis / remediation / report_narrative / comment draft, always lands as awaiting_approval in the approval center, preventing agents from self-approving beyond their authority.
- Contract design and scope isolation with zero extra Token burn
The old version burned money in two places: cloud web search APIs + a cloud LLM doing semantic parsing item by item.
v0.2.0 adds migration 0039, splitting the capture contract in packages/evidence into two strictly mutually exclusive lanes: the existing llm_search_api (demoted to an optional advanced setting) and the new agent_browser (adapter version agent-browser.v1, supporting 9 web apps: chatgpt_web, yuanbao_web, deepseek_web, kimi_web, doubao_web, qwen_web, perplexity_web, claude_web, gemini_web).
In measurementContractSchema, superRefine enforces surfaces.api.enabled !== surfaces.consumerApp.enabled, and captureMode plus browserCapture.accountCategory (anonymous / logged_in) are included in the batch's config_hash. That way web-app samples, cloud API samples, and different login states never get mixed into the same trend line.
For semantic scoring, semantic.modelProvider was extended with "mcp_agent": the local Agent you're already running reads the source text and calls geo_submit_semantic_judgments to send back judgments; the backend runs the deterministic V2 algorithm to generate a MetricSnapshot. When no cloud model is configured, report-snapshots switches to awaiting_mcp_narrative / awaiting_mcp_quality; after approval it freezes and renders HTML / Chinese-language PDF / Word locally. Across the whole loop, the ZZ Geo server itself never calls any external billing API—0 extra API Token burn.
- Concurrency locks and cross-contamination prevention when running browser agents for multiple clients in parallel
Running browser sub-agents for multiple clients at once tends to cause two problems: hammering a single AI platform into risk controls, or reusing the same browser session and leaking the previous client's context into the next task.
0039 adds a browser_platform_policies table storing each platform's max_concurrency (default 1), min_interval_seconds (default 10s), and daily_cap (default 200). Sub-agents claim jobs via geo_claim_browser_capture; the backend transaction runs:
SELECT * FROM browser_platform_policies WHERE platform=$1 FOR UPDATE
Inside the row lock it checks three things in order: the number of active jobs in the jobs table with type='browser_capture' AND status='leased' AND lease_expires_at > now(), the cooldown since last_dispatched_at, and the day's query_captures count. If any limit is exceeded, it returns platform_busy / platform_cooldown / daily_cap_reached plus retryAfterSeconds so the sub-agent backs off.
On a successful claim it force-issues isolationPolicy: { mode: "fresh_isolated_context" }, requiring a blank fresh session per question; if it hits a login wall or CAPTCHA, the sub-agent must truthfully report login_required / challenge_required and stop—never bypass verification or fill in fake data.
- Hard UTF-16 source-text validation to prevent LLM semantic-scoring hallucinations
Every SemanticObservation submitted by the local Agent is not trusted directly: the backend's resolveVerbatimSpans automatically fills in offsets, then sends it to validateSemanticObservation for four hard checks:
answer.slice(span.start, span.end) === span.text—exact character match against the source UTF-16 offsets;- The mentioned brand must be in the frozen alias allowlist, and that alias must actually appear in the source span;
- When claiming a recommendation rank,
hasExplicitRecommendationListmust betrue, and the start of the source span must regex-match the corresponding numeric/Chinese list marker; warning/negativesentiment cannot also be labeled as a positive recommendation.
If any check fails, it's marked failed or needs_review; only fully valid observations get written to semantic_selections, and then packages/metrics runs the fixed-seed clustering bootstrap V2 algorithm to compute metrics—no trusting percentages the model worked out in its head.
- Real bugs found in a test run on my own site hrouter.net
Before release, with 0 third-party keys, I ran 12 real developer questions against my own site (9 brand-agnostic selection questions + 3 brand-named comparisons). Test environment recorded as-is: under anonymous access, Perplexity, Kimi, and DeepSeek hit login walls; Doubao returned anonymous rate-limit 710022002; all were listed separately as blocked and excluded from the denominator. ChatGPT web and Tencent Yuanbao web got a full 24/24 valid answers, yielding 206 clickable citation links, and 24/24 semantic judgments passed validation on the first try.
Also dropping a few very concrete engineering pitfalls found in testing—indie site builders will probably run into them too:
- Brand-named vs brand-agnostic makes a huge difference: the 3 named questions got 100% mention across both platforms and 83.3% official-site citations; the 9 brand-agnostic selection questions (18 answers) got only 1 mention (5.6%), ChatGPT was 0/9, and Yuanbao's single mention even misclassified the service as a self-built Tauri desktop app;
- Browser-based official-site audit (85/100) caught that
/llms.txtreturned 200 but the response headers were missingcharset=utf-8, so it got decoded as Latin-1 and turned into mojibake; the second half of the homepage H1 was wrapped inaria-hidden="true", so accessibility and the semantic tree couldn't read the full main heading; - When ChatGPT's web fetch hit
/models/, it picked up the pricing table but explicitly said in the source that it couldn't get the 24-hour real-time availability numbers, because the status data is pulled asynchronously via pure client-side CSR and isn't visible to AI crawlers; need to add SSR or a scheduled static HTML summary.
- License and reproduction
The project's own code is AGPL-3.0-only; frontend/backend, the 46-tool MCP, Local Runner (supports Obsidian 0444 read-only mirror and a three-layer Vault), Tauri desktop app, and all 39 migrations are fully public, with no closed-source modules. Under the license you can self-host, modify, and use commercially (if you offer a modified version as a network service, just publish the corresponding source under AGPL Section 13).
The stack is Node.js 24 + pnpm 11; local runs use PGlite with zero external database dependencies. There's a Docker quickstart one-command script:
git clone https://github.com/honestTai/geo-console.git
cd geo-console
corepack pnpm install --frozen-lockfile
corepack pnpm --filter @geo/worker exec playwright install chromium
corepack pnpm geo setup
corepack pnpm geo start
corepack pnpm geo mcp-config
- Full test write-up, 4 dashboard screenshots, and follow-up remediation notes: full HRouter blog retrospective
- GitHub source repo: honestTai/geo-console
- v0.2.0 Release (includes SHA-256 checksum archive): v0.2.0 Release
If you're hacking on local MCP, browser agent scheduling, or GEO auditing for your own site, happy to compare notes—if you spot issues in the code, just open an Issue.
之前开源过一个 GEO(AI 搜索可见度监测)系统 ZZ Geo,v0.1.0 发完以后自己用了一阵,越看越像个传统重型 SaaS 后台:多租户、RBAC 权限树、成员管理一大堆表,而且还没开始采样就得先配齐五家联网搜索 API Key 加一个云端大模型 Key,既麻烦又额外烧 Token。
平时写代码和跑流程其实都在本地 Claude Code、Cursor、Codex 或 Antigravity 里,浏览器只用来看数据和点确认。这几天直接把整套架构推倒重构成了 v0.2.0,推了 Release,把这次拆掉的包袱和几个关键的工程实现摊出来记录一下。完整带多张高清界面截图和 24 份回答拆解的版本整理在 我的技术博客复盘笔记 里。
- 砍掉重型权限,架构反转成 Local MCP + 只读 Dashboard
迁移 0037 和 0038 直接把多租户管理、机构上限、/api/rbac/* 和 /api/users* 整块删掉了,只保留单工作区管理员(本机 127.0.0.1 默认免登,远端走单口令或 >=16 位的 GEO_API_TOKEN)和基于 project_id 的硬隔离,底层的 authorization/resources.ts 与封档只读触发器 geo_guard_project_row 没动。
所有写操作收进独立包 apps/mcp-server(纯 TypeScript + zod,零新增外部运行时依赖),走标准 stdio JSON-RPC 2.0 暴露 46 个工具。跑完 corepack pnpm geo start 后执行 corepack pnpm geo mcp-config 会直接吐出带本机绝对路径的 JSON,粘进 Claude Code / Cursor / Codex 就能接管建档、官网体检、建批次、采数、语义打分、诊断整改、Vault 知识库和报告冻结。
前端 Web 和 Tauri 桌面端(macOS 原生包)收敛成 2 空间 10 视图的纯只读看板。唯一故意留给人工的是审批权:46 个 MCP 工具里没有任何 approve 接口,凡是把 Vault 笔记标为对外公开,或者提交 diagnosis / remediation / report_narrative / 评论草稿,服务端一律落 awaiting_approval 进审批中心,防止 Agent 越权自批。
- 零额外 Token 消耗的契约设计与口径隔离
老版本费钱主要在两头:云端联网搜索 API + 云端大模型逐条做语义解析。
v0.2.0 加了迁移 0039,在 packages/evidence 里把采集契约拆成严格互斥的两条线:原有的 llm_search_api(降级成可选高级设置)和新的 agent_browser(适配器版本 agent-browser.v1,支持 chatgpt_web、yuanbao_web、deepseek_web、kimi_web、doubao_web、qwen_web、perplexity_web、claude_web、gemini_web 共 9 个网页端)。
measurementContractSchema 里用 superRefine 强校验 surfaces.api.enabled !== surfaces.consumerApp.enabled,并且把 captureMode 和 browserCapture.accountCategory(anonymous / logged_in)算进批次的 config_hash。这样网页端样本、云端 API 样本和不同登录态永远不会混进同一条趋势线。
语义打分这块把 semantic.modelProvider 扩展出了 "mcp_agent",由你手头正在跑的本地 Agent 读完原文后调 geo_submit_semantic_judgments 回传判定,后端跑确定性 V2 算法生成 MetricSnapshot;report-snapshots 在没配云端模型时会切到 awaiting_mcp_narrative / awaiting_mcp_quality 状态,审批完直接在本地冻结渲染 HTML / 中文 PDF / Word。整个闭环里 ZZ Geo 服务端自己不调任何外部计费接口,0 额外 API Token 消耗。
- 多客户并行跑浏览器的并发锁与防串味
多客户同时跑浏览器子智能体最容易出两个毛病:把单一 AI 平台打触发风控,或者复用同一个浏览器会话导致前一个客户上下文串进下一题。
0039 新增了 browser_platform_policies 表存每个平台的 max_concurrency(默认 1)、min_interval_seconds(默认 10s)和 daily_cap(默认 200)。子智能体通过 geo_claim_browser_capture 领单,后端事务里执行:
SELECT * FROM browser_platform_policies WHERE platform=$1 FOR UPDATE
行锁里依次检查三项:当前 jobs 表里 type='browser_capture' 且 status='leased' AND lease_expires_at > now() 的活跃数、距 last_dispatched_at 的冷却时间、以及当日 query_captures 计数。任意超限直接返回 platform_busy / platform_cooldown / daily_cap_reached 和 retryAfterSeconds 让子智能体退避。
领单成功强制下发 isolationPolicy: { mode: "fresh_isolated_context" },要求单题空白新会话;遇到登录墙或验证码要求子智能体如实回传 login_required / challenge_required 停机,绝不绕过验证也不补假数据。
- 防 LLM 语义打分幻觉的 UTF-16 原文硬校验
本地 Agent 提交的每条 SemanticObservation 不会直接信任,后端 resolveVerbatimSpans 自动回填偏移后送进 validateSemanticObservation 做四道硬检查:
- answer.slice(span.start, span.end) === span.text,逐字匹配原文 UTF-16 偏移;
- 提及品牌必须在冻结的别名白名单里,且原文片段里真出现该别名;
- 声称有推荐排名 rank 时,hasExplicitRecommendationList 必须为 true,且原文片段行首必须正则命中对应的数字/中文列表标号;
- warning / negative 态度不能同时标成正向推荐。
任何一条不满足直接判 failed 或 needs_review,只有全 valid 的观察才写入 semantic_selections,再由 packages/metrics 跑固定种子的聚类 bootstrap V2 算法算指标,不信任模型口算的百分比。
- 拿自己站点 hrouter.net 实测一轮抓出来的真实 Bug
发版前用 0 第三方 Key 拿自己维护的站点跑了 12 道真实开发者问题(9 道不点名选型 + 3 道点名对比)。实测环境如实记录:匿名访问时 Perplexity、Kimi、DeepSeek 弹登录墙,豆包返回匿名频控 710022002,全按受阻单列没进分母;ChatGPT 网页端和腾讯元宝网页端跑满 24/24 有效回答,拿到 206 条可点击引用链接,24/24 语义判定一次过校验。
顺带把实测揪出来的几个很具体的工程坑贴出来,做独立站的老哥大概率也会中招:
- 点名 vs 不点名差距极大:3 个点名题双平台 100% 提及、官网引用 83.3%;9 个不点名选型题(18 答)仅提及 1 次(5.6%),ChatGPT 是 0/9,元宝那 1 次还把服务误分类成了自建型 Tauri 桌面端;
- 浏览器官网审计(85/100)抓到 /llms.txt 虽然返回 200,但响应头少了 charset=utf-8,直接被按 Latin-1 解码成乱码;首页 H1 后半段文字包在 aria-hidden="true" 里,无障碍和语义树读不到完整主标题;
- ChatGPT 联网抓取 /models/ 时读出了价格表,但在原文里明说拿不到 24 小时实时可用率数值,因为状态数据是纯前端 CSR 异步拉取的,对 AI 爬虫不可见,得补 SSR 或定时静态 HTML 摘要。
- 协议与复现
项目自有代码是 AGPL-3.0-only,前后端、46 工具 MCP、Local Runner(支持 Obsidian 0444 只读镜像和三层 Vault)、Tauri 桌面端和 39 个迁移全量公开,无闭源模块。按协议可自部署、二开、商用(修改版对外提供网络服务按 AGPL 第 13 条公开对应源码即可)。
技术栈是 Node.js 24 + pnpm 11,本机用 PGlite 零外部库依赖,服务器提供了 Docker quickstart 一键脚本:
git clone https://github.com/honestTai/geo-console.git
cd geo-console
corepack pnpm install --frozen-lockfile
corepack pnpm --filter @geo/worker exec playwright install chromium
corepack pnpm geo setup
corepack pnpm geo start
corepack pnpm geo mcp-config
- 完整实测原文、4 张看板截图与后续整改记录:HRouter 博客完整复盘
- GitHub 源码仓库:honestTai/geo-console
- v0.2.0 Release(含 SHA-256 校验归档):v0.2.0 Release
有在折腾本地 MCP、浏览器 Agent 调度或者自己站点 GEO 排查的欢迎交流,代码里发现问题直接提 Issue 就行。
Translated by AI from 简体中文Original (简体中文)
可以共享、可以push的免费邮箱,更可使用自定义域名,完美契合您的各项需求。
5 replies
Sort order