golemcloud/golem/golem-add-secret-go
- community
Checking that the SKILL.md file is still in the repository.
Adding typed secrets to a Go Golem agent with golem.Secret[T]. Use when the user needs API keys, passwords, or tokens that must not be checked into source control in a Go Golem project.
Install
npx vskill@latest install golemcloud/golem/golem-add-secret-goSKILL.md
Adding Secrets to a Go Agent
Overview
Secrets are sensitive configuration values (API keys, passwords, tokens) read at runtime through golem.Secret[T]. A secret uses the same config mechanism as regular typed config — it is just a field whose type is golem.Secret[T] inside the agent's config struct (see golem-add-config-go). The config value carries an opaque secret handle; the plaintext is revealed only when your code calls .Get() or .MustGet().
Manage secrets per environment via the CLI. Use secretDefaults in golem.yaml only for development placeholders; never commit real credentials.
Steps
- Add a `golem.Secret[T]` field to the agent's config struct.
- Define / implement the agent as a configured agent (
DefineConfiguredAgent+ImplementConfigured). - Reveal the value at runtime with
.MustGet(), or.Get()to handle a read failure. - Provide values via
secretDefaults(local) or the CLI (per environment).
Declaring a Secret Field
A secret is any field of type golem.Secret[T], at any depth of the config struct:
Reading a Secret at Runtime
Read the config, then call .MustGet() on the config-backed secret field to reveal the current plaintext. Each config-backed read resolves a fresh handle, so live reads observe rotation; retry/replay uses the recorded revision. A received RPC handle instead stays pinned to its transferred revision. .Get() returns (T, error) instead, for a secret that may be unavailable:
A golem.Secret[T] cannot be constructed from a plaintext: it comes from the agent's config, or from another agent. Its String()/GoString() render as golem.Secret(redacted), so it stays out of logs formatted with %v/%s.
Passing a Secret to Another Agent
A golem.Secret[T] can be a field of a method's input or its result. It travels as a secret handle, never as plaintext, and the receiver reveals it with .Get() / .MustGet():
A config secret can be sent again; a secret you received moves when you send it on, and the copy that was sent is unusable afterwards (golem.ErrSecretMoved). External clients cannot carry secrets.
A transferred handle is pinned to one secret revision. Repeated .Get() calls on that received handle do not observe rotation. To give a recipient the rotated value, send a newly resolved handle from the config-backed secret; the recipient must use the new handle.
Secret Defaults in golem.yaml (development only recommended)
For local development, set placeholder defaults under secretDefaults.<environment>. Keys are camelCase and follow the same path flattening as config; nested structs are nested maps. The CLI selects defaults by environment name, with no production exclusion. Keep defaults development-only and never commit real credentials:
Managing Secrets via CLI (per environment)
Outside local defaults, secrets are environment-scoped — each deployment environment has its own values, set through the platform CLI (paths use the same camelCase as the config keys):
Key Constraints
- A secret is a config field of type
golem.Secret[T]— the agent must be a configured agent (DefineConfiguredAgent/ImplementConfigured); seegolem-add-config-go. - Only `.Get()` / `.MustGet()` reveal the plaintext. Config-backed live reads resolve fresh handles and observe rotation without restarting the agent; retry/replay uses the recorded revision. Received handles stay pinned to their transferred revision and require a new handle to observe rotation.
- Use the CLI for production secret values.
secretDefaultsapplies by environment name, even in production; restrict it to development placeholders and never commit real credentials. - Deployment can succeed with an unset secret; a missing required secret fails agent creation, not deployment. Read a secret from within an invocation only —
.Get()calls the host. It returns an error when the secret is unavailable, its version is gone, or it was moved;.MustGet()panics instead, which traps the component (fails the agent), as in Rust. - Over RPC, secret fields are always platform-provisioned; a definition's
WithConfigoverrides only local config, never secrets.
Related Skills
| Skill | When to Load | |
|---|---|---|
golem-add-config-go | The non-secret typed-config mechanism secrets build on | |
golem-add-agent-go | Define the base agent the config attaches to | |
golem-call-another-agent-go | Understand why secrets are not overridable over RPC |
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggolem-skills/skills/go/golem-add-secret-go/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/golemcloud/golem/golem-add-secret-go)