AgentGem — System Architecture

One Zod contract → REST + MCP + OpenAPI · a framework-agnostic Gem core · archive, targets, registry, and deploy

Contract surface · one Zod definition → three boundaries (schemas.ts) Gem core — src/gem · pure, framework-agnostic redaction trust boundary Web UI (browser) src/public/index.html Local coding agent Claude / Codex / … REST · GemController /api/* — 35+ endpoints MCP · GemTools /mcp — 6 tools OpenAPI 3.1 /explorer (Swagger UI) introspect ~/.claude · plugins → ConfigInventory redact strip secrets → SecretRef[] buildGem select + checks → Gem archive manifest + lock fs · tar.gz neutral Gem · manifest + lock (the source every consumer reads) Targets (materialize) Eve · Flue OpenAI Sandbox · AgentCore → generated FileTree Registry GitHub-backed publish · resolve merge · install Deploy backends Anthropic Managed Agents AWS Bedrock AgentCore + deploy record Testbed & Run local .claude testbed eve / vercel cloudflare run Server state — ~/.agentgem workspaces/ · recents.json · .env (credentials) · deploy records HTTP MCP Client / UI Contract / compose Targets / deploy Archive / state Redaction External

One contract, three boundaries

  • • Each op defined once as a Zod contract
  • • Surfaced as REST (GemController) + MCP (GemTools)
  • • OpenAPI 3.1 + Swagger /explorer derived from it
  • • Web UI and local agent call the same operations

Redaction at capture

  • • Secrets stripped the moment config is read
  • • By value (entropy) and by key name (regex)
  • • Only redacted shapes cross any boundary
  • • buildGem re-redacts as defense in depth

Gem as neutral source

  • • manifest + lock archive (dir or .tar.gz)
  • • Targets, registry, deploy all read the same Gem
  • • Composable: merge → re-resolve a single lock
  • • State persisted under ~/.agentgem