Skip to guide
IndigoIndigo · HQ Field Guide
Chapter 08 / 15Contents
Chapter 08shared · 10 min

Use secrets safely

Use /hq-secrets and schema-driven injection so credentials run your work without ever being pasted into chat or committed.

01Run work with schema-driven secret injection instead of pasted keys.
02Hand human-supplied credentials to a link instead of typing them into chat.
$ /hq-secrets
Fig 08.0 · Sealed by reference
The concept

Referenced secret

Secrets are declared and referenced, never typed into chat or stored in a repo.

SECRETS BY REFERENCE.ENV.SCHEMAYAMLAPI_KEYDB_URLJWT_SECRETSMTP_PASSSCHEMASEALEDREFRUNTIME$HQ RUN --ENV$API_KEYRUNTIME INJECTIONNEVER IN CHAT
Fig 08.1 · Declare the keys
Step 01Schema

Declare the keys

A repo lists the secret names it requires in a `.env.schema` file, so HQ knows what to fetch without seeing the values in code.

Add the needed key names to `.env.schema` and keep real values out of the repo entirely.

The schema lists every key the command will need.
/hq-secrets
Step 02Injection

Run with injection

`hq run` reads the schema, batch-fetches the secrets, and injects them as environment values that are never printed; `hq secrets exec` does the same for a one-off command.

Run repo work through `hq run`, or use `hq secrets exec` for a single command that needs one key.

The work runs without any secret value appearing in output.
/hq-secrets
Fig 08.2 · Run with injection
Fig 08.3 · Collect by link
Step 03Link entry

Collect human secrets by link

For a human-supplied credential, the /hq-secrets skill generates a link so the person enters the secret themselves.

Generate a link with /hq-secrets and send it, rather than asking the person to paste the value into the conversation.

The credential is stored without ever appearing in chat or a commit.
/hq-secrets
Commands

Keep the chapter executable.

Secrets skill
$ /hq-secrets

Runs schema-driven secrets via `hq run`, one-offs via `hq secrets exec`, and generates links for human-supplied credentials.

One-off injection
$ hq secrets exec --only KEY -- <cmd>

Injects a single named secret for one command without printing it.

Common mistakes

What goes wrong, and the fix.

Mistake

Pasting an API key directly into the chat to get work done.

Fix

Never paste a key; generate a /hq-secrets link or reference it through the schema.

Mistake

Committing a real .env file with live values.

Fix

Use .env.schema plus the vault and keep real values out of the repo.

Mistake

Reaching for another company's credentials when the active ones fail.

Fix

Respect cross-company isolation and use only the active company's secrets.

References

What to keep in mind.

Never inline

A secret never goes in chat, a prompt, or a commit; it is referenced through the schema or a /hq-secrets link.

Schema-driven

Declare keys in .env.schema and let `hq run` batch-fetch and inject them so real values stay in the vault.

Next
Next move

With sharing and secrets handled safely, build the daily session habit that starts every piece of work.

Continue to startwork
Part 08 · Use secrets safelyIndigo · HQ Field Guide