gg

GitHub

定义 Grida Gateway (GG) 开发规范,涵盖 token、gateway、provider 和 desktop 四大表面。提供 GRIDA-GG 代码标记指南及命名映射,用于统一 AI 网关相关代码的识别与管理。

.agents/skills/gg/SKILL.md gridaco/grida

Trigger Scenarios

添加或修改 GG 相关文件 使用 gg provider 类型 涉及 org credit 消耗逻辑 需要定位 AI 网关代码

Install

npx skills add gridaco/grida --skill gg -g -y
More Options

Non-standard path

npx skills add https://github.com/gridaco/grida/tree/main/.agents/skills/gg -g -y

Use without installing

npx skills use gridaco/grida@gg

指定 Agent (Claude Code)

npx skills add gridaco/grida --skill gg -a claude-code -g -y

安装 repo 全部 skill

npx skills add gridaco/grida --all -g -y

预览 repo 内 skill

npx skills add gridaco/grida --list

SKILL.md

Frontmatter
{
    "name": "gg",
    "description": "Working pattern for Grida Gateway (GG) — Grida's first-party, metered, no-BYOK AI surface: the scoped-token mint, the OpenAI-compatible + native gateway endpoints, the `gg` client provider, and the desktop wiring that spends org credit without a user key. Anchor for the `GRIDA-GG: <surface>` grep marker; its security half is `GRIDA-SEC-006`. Use when adding or touching any GG file, the `gg` provider kind, the `gg:ai` token audience, or deciding whether code belongs to the gateway surface. Companions: `security` (the GRIDA-SEC-006 half), `ee-billing` (the ledger it spends), `agent-system` and `desktop` (the two hosts)."
}

gg — Grida Gateway

Grida Gateway (GG) is Grida's first-party AI gateway: the path by which a signed-in client runs AI — text, image, video — without a user-supplied model key (no BYOK), billed to the organization's prepaid credit. It is one coherent, extractable surface, marked so a single grep finds all of it, and it is designed to spin out of this repo into a standalone service at grida.gg. Treat every touch as work on a product that will one day live on its own.

Canonical spec: Hosted AI (metered, no-BYOK). Security boundary: GRIDA-SEC-006 in SECURITY.md.

What counts as GG

The test: does this code exist to let a keyless client spend org credit on a Grida-hosted model? If yes, it is GG. Four surfaces:

  • token — the scoped-token mint + verify. A purpose-scoped, short-lived, org-bound JWT (audience gg:ai) is the only credential the gateway accepts. This surface is also GRIDA-SEC-006.
  • gateway — the server endpoints: the OpenAI-compatible text surface (chat completions, models) and the native image/video generation surfaces. They verify the gg:ai token and meter through the billing seam; they carry no billing logic of their own.
  • provider — the client-side gg provider kind (in the agent package) that resolves to the gateway, plus its in-memory session store, factories, and media adapters. It is the consumer of GG.
  • desktop — the renderer lifecycle that mints/re-mints the token and pushes it to the sidecar (memory-only custody), and the daemon gg capability/namespace that receives it.

Not GG: the billing ledger itself (that is ee-billing / grida_billing); the billing seam's providerOptions.grida namespace (Grida-billing's key, shared with GRIDA-SEC-003); BYOK providers (the carve-out GG sits beside).

The GRIDA-GG marker

Like GRIDA-EE, the surface is grep-able. Tag every file that exists only for GG, with the surface as the sub-label:

// GRIDA-GG: token — scoped-token mint/verify (also GRIDA-SEC-006)
// GRIDA-GG: gateway — OpenAI-compatible chat completions
// GRIDA-GG: provider — the `gg` client provider kind
// GRIDA-GG: desktop — renderer token lifecycle

Sub-labels are surface names (token / gateway / provider / desktop), not ids. The grep is the index:

grep -rn 'GRIDA-GG' editor packages desktop

Tag the file header when the whole file is GG; tag inline when only a branch is (e.g. the gg arm inside a shared provider resolver). The canonical name is Grida Gateway (GG); write it that way in prose.

The naming map (canonical identifiers)

One brand, several forms — consistent with how the repo already names (GRIDA-EE marker + grida_billing schema + descriptive symbols):

concept identifier
grep marker GRIDA-GG: <surface>
token audience (wire) gg:ai
signing secret (env) GG_TOKEN_SECRET (+ GG_TOKEN_SECRET_PREVIOUS)
client provider kind (wire) gg
provider id / metadata (code) GG_PROVIDER_ID, GG_PROVIDER_METADATA, isGgProviderId
daemon capability / namespace gg (tag gg@1)
TS symbols GridaGateway* (e.g. GridaGatewaySessionStore)
files gg-*.ts
future public host grida.gg (endpoint paths stay /api/v1/ai/* for now)

Deliberate carve-outs (not renamed, on purpose): the public endpoint paths (/api/v1/ai/*) — a versioned REST contract whose brand is the host, not the path; and providerOptions.grida — the billing seam's key.

Working on GG

  1. Tag every file you create or touch with GRIDA-GG: <surface>.
  2. Place new code in a gg-named location; don't dilute a BYOK or OSS one.
  3. Direction of dependency: consumers → GG contract, not GG → consumers. The gateway must not import desktop/renderer code; the client provider depends on the wire contract, not the server internals. This is what makes the spin-out cheap.
  4. The gateway meters through the existing billing seam — it never grows its own billing logic. Pre-flight entitlement gate, post-flight usage ingest, sold at cost. See ee-billing.

When GG crosses security

The token surface (mint + verify + custody) is GRIDA-SEC-006. Any file on that surface carries both markers:

// GRIDA-SEC-006 — see /SECURITY.md
// GRIDA-GG: token — scoped-token mint/verify

Touching it runs the security review first (the boundary contract, fail-closed secret handling, audience pinning), then this skill (the surface-organization pass). The invariant to protect: the credential a native process holds for AI is worth at most 15 minutes of AI calls on one org's credit — and nothing more.

Precedence is stated here and cross-referenced from GRIDA-SEC-006 in SECURITY.md, so a reader entering from either side lands in the other.

See also: security (the GRIDA-SEC-006 half), ee-billing (the credit ledger GG spends), ee (the EE marker pattern this mirrors), agent-system and desktop (the two hosts), naming.

Version History

  • 29f3afa Current 2026-08-20 15:55

Same Skill Collection

.agents/skills/ai-models/SKILL.md
.agents/skills/code-react/SKILL.md
.agents/skills/code-ts/SKILL.md
.agents/skills/database/SKILL.md
.agents/skills/docs-canvas/SKILL.md
.agents/skills/docs/SKILL.md
.agents/skills/editor-perf/SKILL.md
.agents/skills/ee-billing/SKILL.md
.agents/skills/ee/SKILL.md
.agents/skills/etiology/SKILL.md
.agents/skills/fixtures/SKILL.md
.agents/skills/io-figma/SKILL.md
.agents/skills/io-grida/SKILL.md
.agents/skills/links/SKILL.md
.agents/skills/naming/SKILL.md
.agents/skills/opt-library/SKILL.md
.agents/skills/oss-standards/SKILL.md
skills/dotcanvas/SKILL.md
skills/slides/SKILL.md
skills/svg/SKILL.md
.agents/skills/agent-system/SKILL.md
.agents/skills/desktop/SKILL.md
.agents/skills/docs-svg-kit/SKILL.md
.agents/skills/docs-wg/SKILL.md
.agents/skills/grounding/SKILL.md
.agents/skills/pedantic/SKILL.md
.agents/skills/sdk-design/SKILL.md
.agents/skills/sdk-seam/SKILL.md
.agents/skills/security/SKILL.md
.agents/skills/seo/SKILL.md
.agents/skills/vision/SKILL.md

Metadata

Files
0
Version
8ef5e53
Hash
2693eda1
Indexed
2026-08-20 15:55

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-29 21:37
浙ICP备14020137号-1 $Carte des visiteurs$