Background
The original automated migration system (clawvault openclaw migrate --apply) was deprecated and disabled because OpenClaw did not support ${ENV_VAR} placeholders in auth-profiles.json. Running --apply would replace plaintext keys with placeholder strings that OpenClaw treated as literal credential values, causing complete authentication failure.
This issue tracks investigating whether OpenClaw's native secrets management system (added since v0.2.0) now enables a safe, working auto-migration path — potentially via the exec source type that ClawVault already implements.
What Was Previously Attempted
v0.0.x / v0.1.0 migration approach (deprecated)
The clawvault openclaw migrate --apply command:
- Scanned all
~/.openclaw/agents/<agentId>/agent/auth-profiles.json files
- Extracted plaintext API keys and OAuth tokens
- Stored them in the ClawVault keyring
- Rewrote
auth-profiles.json with ${ENV_VAR} placeholder strings:
{
"profiles": {
"openai:default": {
"type": "api_key",
"key": "\${OPENCLAW_OPENAI_OPENAI_DEFAULT_KEY}"
}
}
}
- Expected OpenClaw to expand those placeholders at runtime
Why it failed
- OpenClaw did not expand
${ENV_VAR} in auth-profiles.json — it treated the placeholder string as the literal credential value
- Authentication failed silently because OpenClaw sent the placeholder string instead of the actual key
- OAuth tokens were especially brittle — they could be partially validated/parsed before env expansion occurred, causing unpredictable failures
- Multi-agent setups had multiple
auth-profiles.json files — a failed migration could break all of them at once
What's Changed: OpenClaw Native Secrets System
OpenClaw now has a built-in secrets management system that is directly relevant to this investigation:
openclaw secrets configure (interactive)
openclaw secrets configure --agent main
Interactive wizard that scans plaintext secrets, maps them to SecretRefs, and optionally applies with preflight validation.
openclaw secrets apply (plan executor)
openclaw secrets apply --from /tmp/plan.json --dry-run
openclaw secrets apply --from /tmp/plan.json
- Validates all target paths before writing
- One-way scrub: replaces plaintext with refs
- Requires
agentId for all auth-profiles.json targets
- Supports
auth-profiles.api_key.key target type
SecretRef source: "exec" (critical for ClawVault)
{
"source": "exec",
"provider": "vault",
"id": "providers/openai/apiKey"
}
keyRef/tokenRef in auth-profiles.json
From secrets-plan-contract.md:
Ref-only auth-profiles.json entries (keyRef/tokenRef) are included in runtime resolution and audit coverage.
secrets.providers exec config in openclaw.json
{
"secrets": {
"providers": {
"clawvault": {
"source": "exec",
"command": ["/absolute/path/to/clawvault", "resolve"],
"jsonOnly": true,
"passEnv": ["PATH"]
}
}
}
}
This is exactly the integration path ClawVault v0.2.0's exec-provider was built for.
Investigation Tasks
Proposed Re-implementation Plan (conditional on investigation)
Phase 1: Generate OpenClaw-compatible plan files
Replace ${ENV_VAR} rewriting with plan file generation:
- Run
clawvault openclaw migrate --verbose as dry-run (existing)
- Generate a plan.json compatible with
openclaw secrets apply
- Guide user to run
openclaw secrets apply
- ClawVault acts as the exec backend; OpenClaw handles the auth-profiles.json writes
Phase 2: clawvault openclaw setup command
Auto-configure secrets.providers.clawvault in openclaw.json so users don't have to edit it manually.
Phase 3: Deprecate old --apply path
Once Phase 1 is validated, mark clawvault openclaw migrate --apply as superseded by openclaw secrets configure + ClawVault exec provider workflow.
Priority
Medium — existing workaround works but is not migration-friendly for new users with existing plaintext auth-profiles.json setups.
Background
The original automated migration system (
clawvault openclaw migrate --apply) was deprecated and disabled because OpenClaw did not support${ENV_VAR}placeholders inauth-profiles.json. Running--applywould replace plaintext keys with placeholder strings that OpenClaw treated as literal credential values, causing complete authentication failure.This issue tracks investigating whether OpenClaw's native secrets management system (added since v0.2.0) now enables a safe, working auto-migration path — potentially via the
execsource type that ClawVault already implements.What Was Previously Attempted
v0.0.x / v0.1.0 migration approach (deprecated)
The
clawvault openclaw migrate --applycommand:~/.openclaw/agents/<agentId>/agent/auth-profiles.jsonfilesauth-profiles.jsonwith${ENV_VAR}placeholder strings:{ "profiles": { "openai:default": { "type": "api_key", "key": "\${OPENCLAW_OPENAI_OPENAI_DEFAULT_KEY}" } } }Why it failed
${ENV_VAR}inauth-profiles.json— it treated the placeholder string as the literal credential valueauth-profiles.jsonfiles — a failed migration could break all of them at onceWhat's Changed: OpenClaw Native Secrets System
OpenClaw now has a built-in secrets management system that is directly relevant to this investigation:
openclaw secrets configure(interactive)Interactive wizard that scans plaintext secrets, maps them to SecretRefs, and optionally applies with preflight validation.
openclaw secrets apply(plan executor)agentIdfor allauth-profiles.jsontargetsauth-profiles.api_key.keytarget typeSecretRef
source: "exec"(critical for ClawVault)keyRef/tokenRefin auth-profiles.jsonFrom
secrets-plan-contract.md:secrets.providersexec config in openclaw.json{ "secrets": { "providers": { "clawvault": { "source": "exec", "command": ["/absolute/path/to/clawvault", "resolve"], "jsonOnly": true, "passEnv": ["PATH"] } } } }This is exactly the integration path ClawVault v0.2.0's exec-provider was built for.
Investigation Tasks
auth-profiles.jsonsupportskeyRef/tokenReffields (exact schema)source: "exec"works forauth-profiles.jsonrefs (test with a known key)tokenRefworks end-to-endclawvault resolveproduces the exact JSON format requiredProposed Re-implementation Plan (conditional on investigation)
Phase 1: Generate OpenClaw-compatible plan files
Replace
${ENV_VAR}rewriting with plan file generation:clawvault openclaw migrate --verboseas dry-run (existing)openclaw secrets applyopenclaw secrets applyPhase 2:
clawvault openclaw setupcommandAuto-configure
secrets.providers.clawvaultinopenclaw.jsonso users don't have to edit it manually.Phase 3: Deprecate old
--applypathOnce Phase 1 is validated, mark
clawvault openclaw migrate --applyas superseded byopenclaw secrets configure+ ClawVault exec provider workflow.Priority
Medium — existing workaround works but is not migration-friendly for new users with existing plaintext auth-profiles.json setups.