> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monolex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCLIs Vault

> Store shared estate tokens behind a stable helper identity, AES-256-GCM envelope encryption, and the platform keyring.

`openclis-vault` is the narrow credential helper for OpenCLIs and the Monolex
estate. Other tools call this stable binary as a subprocess instead of each
requesting keyring access under a changing code identity. The keyring stores a
32-byte encryption key; the credentials file stores only AES-256-GCM nonce and
ciphertext. Its surface is intentionally small: **four operational commands**,
one embedded-docs family, and help/version identity aliases.

*Published contract: `openclis-vault 0.1.6`, OpenCLIs build
`2026-06-30-070903`. The executing binary, registry, and public CDN metadata
agree on this release.*

## Quick Start

```bash theme={null}
openclis install openclis-vault

openclis-vault --version
openclis-vault list
printf '%s' "$TOKEN" | openclis-vault store example-service
```

Use stdin for writes. Passing a token as an argument would expose it through
shell history and process inspection.

## Complete Command Reference

| Command                        | What it does                                                                                                      | Security effect                                                                                                                    |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `read <service>`               | Decrypts the service access token and writes it to stdout without a trailing newline.                             | Secret-bearing output; capture directly and never log it.                                                                          |
| `store <service>`              | Reads stdin, trims leading/trailing whitespace, rejects an empty result, and stamps a 30-day access-token expiry. | Whole credential blob is re-encrypted; confirmation goes to stderr.                                                                |
| `delete <service>`             | Requests removal of the service key and encrypted blob.                                                           | This is **best-effort**: backend-open and clear errors are ignored, yet the command prints removal and exits 0. Verify separately. |
| `list`                         | Reads known/discovered services and prints names whose unexpired token is readable.                               | Does not print values, but it can access keyring entries or trigger platform prompts.                                              |
| `docs [topic]`                 | Lists or renders embedded operational reference topics.                                                           | Read-only progressive-disclosure surface.                                                                                          |
| `--help` / `-h` / `help`       | Prints the public command contract.                                                                               | Read-only.                                                                                                                         |
| `--version` / `-V` / `version` | Prints the installed payload identity.                                                                            | Read-only.                                                                                                                         |

Service names accept ASCII letters, digits, hyphen, and underscore only.
Empty names, separators, `..`, NUL, and other characters are rejected to block
path traversal and keyring-name injection. The logical keyring name is
`com.openclis.vault.<service>`.

### Parser behavior

* `read --help`, `store --help`, and `delete --help` are safe command-specific
  usage branches. `list --help` instead executes `list` because list has no such
  branch.
* `read|store|delete -- <service>` bypasses help-token interpretation. The
  service still has to pass the normal name validator.
* An unknown root prints the full guide and exits 1.
* `read` and `list` treat an expired 30-day token as absent; the encrypted bytes
  are not automatically erased.

## Storage Architecture

```text theme={null}
stable openclis-vault process
          │
          ├── platform keyring: 32-byte AES key
          └── secure-storage file: nonce + AES-256-GCM ciphertext
```

On macOS, Keychain is the hard boundary. In production Linux or Windows,
lib-secure-storage uses the platform keyring when available and can fall back
to a local-user protected key file for headless, WSL, SSH, or scheduled-task
contexts where the keyring session is unavailable. Set
`MONOLEX_DISABLE_FILE_STORAGE_FALLBACK` when that fallback must be prohibited.

Losing the keyring/key file makes the old ciphertext undecryptable by design.
Copying only the ciphertext is therefore not a valid credential backup.

An unreadable ciphertext blob is treated as empty on the read path. A later
write quarantines a corrupt blob and starts a fresh encrypted record. This
preserves bytes for forensics, but it also means “not in vault” is not proof
that no stale or corrupt file exists.

## Stable cdhash Contract

<Warning>
  On macOS, the signed helper's code identity participates in Keychain approval.
  Replacing or re-signing this binary can require a platform-specific re-grant
  for `com.openclis.vault.*` entries. Vault releases require a deliberate,
  versioned rollout; routine updates to other tools must not casually replace the
  helper.
</Warning>

The stable-helper guarantee is different from package version agreement. Verify
the installed binary's version and signature before changing it, then prove
that expected service names remain readable without printing their values.

## Published Payload Matrix

| Platform            | Binaries             | Published in 0.1.6 |
| ------------------- | -------------------- | ------------------ |
| macOS Apple Silicon | `openclis-vault`     | `darwin-aarch64`   |
| Linux ARM64         | `openclis-vault`     | `linux-aarch64`    |
| Linux x86-64        | `openclis-vault`     | `linux-x86_64`     |
| Windows x86-64      | `openclis-vault.exe` | `windows-x86_64`   |

The build does **not** publish macOS Intel or Windows ARM64 artifacts. The
installed macOS payload is Developer ID signed; signature validity and payload
version are separate from credential readability.

## Safe Patterns

```bash theme={null}
# Store without argv exposure
security find-generic-password -w -s source-token \
  | openclis-vault store destination_service

# Read into one process without terminal output
API_TOKEN="$(openclis-vault read destination_service)" command-that-needs-it

# Inventory only
openclis-vault list
```

Avoid command tracing (`set -x`) around reads and stores. `list` proves only
that an unexpired token was readable at that moment; only the consuming tool's
authenticated status/doctor command proves remote validity.

## Relationships

| Tool                              | Ownership                                                                                                                                               |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [OpenCLIs](/ai-clis/openclis)     | Delegates its `vault` commands and package authentication to this helper                                                                                |
| [MonoSwitch](/ai-clis/monoswitch) | Stores all Claude account profile secrets in the single `monoswitch-claude` Vault document; Vault does not own switching policy or Claude's live stores |
| [Monosystem](/ai-clis/monosystem) | Auth owner for the shared estate JWT; writes through the vault contract                                                                                 |
| [MonoPass](/ai-clis/monopass)     | Stores structured passkeys and WebAuthn state; it is not the generic token CLI in the current release                                                   |
| [MonoSurf](/monosurf)             | Consumes auth-gate/profile secrets while the vault owns encrypted local storage                                                                         |
