# Credential Auto-Heal

How the agent recovers from a missing or expired credential through `store_secret`.

`store_secret` is a `SystemUse` tool, hidden from the ordinary `find_tools(mode=list)` listing; since v1.2.0 its schema is fetched through `find_tools` like every other tool outside the fixed set (`find_tools`, `run_tool`, `reasoning_guide`, `write_todo`, `chat_history`, `ask_user`, `write_result`). The former `§10 Credential auto-heal` section of the system prompt was removed; since v1.2.0 the system prompt keeps one short line — credentials live in the OS keychain (service `agenvoy`) and `store_secret` describes the lookup. The tool's own description holds the lookup order (keychain, account = key name, then `~/.config/agenvoy/.secrets` on Linux, then the environment variable of that name), notes that an empty `printenv` proves nothing because nothing is exported into the process environment, and holds the procedure. On an auth failure — missing key, `401`, `403`, expired token — the agent takes the key name from the error, calls `store_secret` (which captures the new value through masked input — the value never reaches the LLM), then re-invokes the tool that failed. Capped at two `store_secret` rounds per tool per turn.
