用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/speakeasy-api/gram --skill gram-functions命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Conventions for authoring or editing analyzers in the `glint/` Go static-analysis package — Gram's custom golangci-lint plugin built on `go/analysis`. Activate this skill whenever the task involves adding, modifying, or testing a `glint` analyzer (new rule key, new diagnostic, settings struct, fixture under `glint/testdata/`, wiring in `BuildAnalyzers`), even if the user does not say "glint" explicitly — phrases like "add a lint rule", "write a custom analyzer", "go/analysis", or "enforce X via golangci-lint" should trigger it.
Use when adding, editing, reviewing, testing, or locating a reviewed skill distributed with the Platform MCP plugin; triggers include "Platform MCP skill", "platform_mcp_skills", "add a catalog workflow", "bundle a skill with Platform MCP", and "where should this Platform skill live?".
Use when adding a new feature or changing an existing one that surfaces data in the dashboard — the demo org (app.getgram.ai/explore-demo) must show it — and when editing or extending the demo org seed or the local dev seed — server/internal/demoseed/{postgres,clickhouse}.sql, demoseed.Spec, RunLocalFixtures, demo.ensure_demo_org(), gram demo-seed, mise run seed, mise run seed:demo, seed/demo/ docs, TestDemoSeedSafety, the demo-seed-safety CI job, org_gram_demo_workspace, dec0de00 uuids — or when that CI check fails with "touched another tenant's rows", "reseed is not cleaning up or not idempotent", "still contains the demo identifier", or a demo seed pre/postflight exception.
基于 SOC 职业分类
正在显示 SKILL.md
| name | gram-functions |
| description | A walkthrough of the Gram Functions feature in this codebase |
| metadata | {"relevant_files":["server/internal/functions/**/*.go","server/internal/background/activities/deploy_function_runners.go","server/internal/background/activities/reap_functions.go","functions/**/*"]} |
Gram Functions is a serverless code execution feature that allows users to deploy custom JavaScript/TypeScript or Python code as callable tools within Gram deployments. Functions can be invoked by AI agents during conversations.
| Package | Purpose |
|---|---|
server/internal/functions/ | Core functions service - deployment, execution, auth |
server/internal/background/activities/ | Temporal activities for deploying/reaping function runners |
server/design/functions/ | Goa API design for functions endpoints |
server/internal/functions/)impl.go - API service, handles signed asset URL requests from runnersdeploy.go - Core interfaces: Deployer, ToolCaller, Orchestratordeploy_fly.go - Fly.io integration via Machines APImanifest.go - Manifest format (ManifestV0) describing exported tools/resourcesruntimes.go - Supported runtime definitions (JS, TS, Python)auth.go - JWT authentication for function runnersqueries.sql - SQL queries for fly_apps table managementserver/internal/background/)activities/deploy_function_runners.go - Deploys runners during deployment processingactivities/reap_functions.go - Cleans up old Fly.io appsactivities/provision_functions_access.go - Creates access credentials for runnersfunctions_reaper.go - Temporal workflow for cleanup (triggered per-project after deployments)functions/)The functions/ directory contains the source code and build configuration for the OCI images that run user functions on Fly.io. These images are built using melange and apko for reproducible, minimal container images.
| File | Purpose |
|---|---|
melange.yaml | Builds the gram-runner Go binary as an APK package |
images/nodejs22-alpine3.22.yaml | apko config for Node.js 22 runtime image |
images/python3.12-alpine3.22.yaml | apko config for Python 3.12 runtime image |
Each runtime image contains:
ca-certificates-bundle, su-exec)nodejs or python3)gram-runner binary (built from cmd/runner/main.go)Entrypoint behavior:
gram-runner -init -language <lang> - Initializes filesystem, unzips user codesu-exec gram - Drops privileges to non-root gram user (UID 10000)gram-runner -language <lang> - Starts HTTP server on port 8888cmd/runner/main.go)The gram-runner binary is an HTTP server that:
:8888 for tool call and resource requestsfunctions/internal/)| Package | Purpose |
|---|---|
auth/ | JWT authentication and request authorization middleware |
bootstrap/ | Machine initialization: unzip code, prepare entrypoints, lazy asset loading |
encryption/ | AES-GCM encryption for secure communication |
guardian/ | Process execution with resource limits |
ipc/ | Named pipe (FIFO) creation for subprocess communication |
javascript/ | JavaScript/TypeScript entrypoint script (gram-start.js) |
python/ | Python entrypoint script (gram_start.py) |
runner/ | HTTP handlers for /tool-call and /resource-request endpoints |
svc/ | Service utilities (idle tracking, secrets, errors) |
o11y/ | Observability setup (OpenTelemetry, logging) |
middleware/ | HTTP middleware (recovery, version header) |
attr/ | Structured logging attribute helpers |
POST /tool-call with JSON payload:
{"name": "tool_name", "input": {...}, "environment": {...}}
node --experimental-strip-types gram-start.js or python gram_start.pyFor large function bundles (>700KiB), the code isn't embedded in the Fly machine config. Instead:
.lazy file is written containing the asset IDbootstrap.resolveLazyFile() detects the .lazy file| Table | Purpose |
|---|---|
deployments_functions | Links functions to deployments, stores runtime/slug |
functions_access | Encryption keys and bearer token formats for auth |
fly_apps | Tracks deployed Fly.io apps (status, region, URL, reap state) |
function_tool_definitions | Tool metadata (name, description, input schema, variables) |
function_resource_definitions | Resource metadata (URI, mime type) |
manifest.jsonDeployFunctionRunners activityFlyRunner.ToolCall() sends authenticated HTTP request/tool-call endpointnode/python) with user codeserver/internal/deployments/impl.go)reaped_at in databaseFunctionsReaperScopeGlobal scope exists in the code but is not currently used/scheduled