Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Vault multi-field secrets
Status: P1 contract. The owner approved the direction and the four decisions in section 2 on 2026-10-13.
Related: vaults-grant-delivery-refactor.md (current grant and delivery model),
avault-custody-core.md, vault-sandbox-protocol-v2.md, and
../avault/docs/DESIGN.md (authoritative envelope and AAD design).
1. Background
A user asked for one Vault entry to hold several secret values, like a 1Password item: a login has a username, a password, and a 2FA secret. Today a Vault secret holds exactly one value, so a login becomes three unrelated secrets.
2. Goal and decisions
One secret can hold several named fields. Agents reference a field as
NAME.field. Values still never enter the model context, and avault's
cryptography and wire formats do not change.
Approved decisions:
- A secret has one default field (its existing value) plus optional extra fields.
- Authorization stays per secret. Approving a protected secret releases the DEKs of all its fields, and grants still list secret names.
--tagand--skilldeliver every field of each selected secret.--envstill maps exactly one value to one variable.- P1 can replace the value of any field, including the default field.
Built-in 2FA code generation is P2 (section 13).
3. Names and records (shared contract)
| Term | Grammar |
|---|---|
| Secret name (unchanged) | ^[A-Za-z_][A-Za-z0-9_]*$ |
| Field name | ^[a-z][a-z0-9_]{0,63}$ |
| Record name | ^[A-Za-z_][A-Za-z0-9_]*(\.[a-z][a-z0-9_]{0,63})?$ |
- A record is one encrypted value. The default field's record name is the
bare secret name (
GITHUB_LOGIN), whatever the default field is called. An extra field's record name is<secret>.<field>(GITHUB_LOGIN.username).<secret>.<default field name>is never a record name. - A ref is what users and agents write:
NAMEorNAME.field. BothNAMEandNAME.<default field name>resolve to the default record. - Existing secrets have a default field named
valueand no extra fields. - Field names are unique within a secret, including the default field's name. A secret has at most 32 fields, counting the default field.
- Extra field names are immutable because their ciphertext binds the record name. To rename one, remove it and add it again. The default field's name is only a label and can be renamed. Which field is the default is fixed when the secret is created.
- Only
staticsecrets can have extra fields. Keypair secrets keep one implicitvaluefield: create/PATCH reject an explicitdefault_field, and refs such asKEY.fieldare rejected.
Every envelope binds its record name:
- Standard tier: avault seals and opens with AAD
record || "machine-aesgcm-v1" || 0x01. - Protected tier: the protected-record v2 AAD JSON carries
"name": "<record>"and"record": {"kind": "static"}. - Blind boxes: the
nameAAD field is the record name forsealandagent-deliver, and the agent-deliveroperation_hashcovers the record name.
avault already treats this name as an opaque string. A probe with avault 0.1.6
and a temporary file store delivered GH.username and GH to one child process,
and rejected a GH.username envelope presented as GH.password or GH. The
vault-sandbox crypto validator still accepts only secret names, so it must
accept record names before protected secrets can have extra fields.
4. Storage
New nullable TEXT column
vault_secrets.fields. It holds a JSON array of the extra fields in display order:[{"name": "username", "ciphertext": "...", "nonce": "...", "wrap_meta": "...", "created_at": "...", "updated_at": "..."}]NULL or
[]means no extra fields.The default field keeps the existing
ciphertext,nonce, andwrap_metacolumns unchanged.The default field's name is
public_meta.default_field. When it is absent or invalid, the name isvalue.All fields share the secret's
kind,protection, tags, policy, resource access policy, and audit history.Every envelope change bumps
vault_secrets.updated_at, so stale approval material is detected through the existing member versions. Field writes are atomic per secret: a concurrent change fails as a conflict, never as a lost update.The migration adds the column and its downgrade drops it. Released versions ignore the column and keep reading the default value. The
vibe data querydenylist already coversvault_secrets.
5. Value-free metadata
The secret metadata payload (_meta_payload, REST, and vibe vault list/find --json) adds two keys:
default_field: the default field's name.fields: every field name, default field first, then extra fields in stored order. An existing secret shows"default_field": "value", "fields": ["value"].A corrupt extra-field section adds
"fields_state": "corrupt"to this value-free metadata, whilefieldsexposes only the available default. Web rows/editors warn about the corruption, and tag/skill expansion refuses to deliver a partial field set.
6. Delivery
| Selector | Records | Environment variable |
|---|---|---|
--env NAME |
default record | NAME |
--env NAME.field |
that field's record | NAME_<FIELD> |
--env LOCAL=NAME[.field] |
the referenced record | LOCAL |
--tag T, --skill S |
every record of each selected static secret | default record as NAME; each extra field as NAME_<FIELD> |
<FIELD>is the field name in upper case:GITHUB_LOGIN.usernamebecomesGITHUB_LOGIN_USERNAME. The rule also applies when the ref names the default field:GITHUB_LOGIN.passwordbecomesGITHUB_LOGIN_PASSWORDand delivers the recordGITHUB_LOGIN.- Conflicts fail before delivery, as today but per record: one record selected under two variable names, or one variable name mapped to two records.
- An unknown field fails with a
field_not_founderror that lists the secret's fields. Keypair rejection (keypair_not_value_deliverable) is unchanged. vibe vault fetch --auth NAME[.field]attaches that record. The allowed hosts and auth scheme come from the secret's policy.vibe vault injectaccepts the same selectors asrun, including field refs. Avibe always sends an explicitkey, because avault's fallback key would be the record name, which is not a valid key.vibe vault exportstays deprecated and returnsexport_deprecated, with no delivery. Its parser and help are unchanged.- Commands that only authorize, such as
vibe vault access, acceptNAME.fieldand authorize the secret. - Every avault entry carries
name= record name, that record'senvelope, andtier= the secret's protection. - Completed delivery bookkeeping uses the secret/field identities captured in the pre-delivery plan, not a second record lookup. Removing or renaming a field while a child runs must not drop its audit or the rest of the batch.
- Use counts stay per secret. The delivery audit lists the delivered fields.
7. Authorization
- Grants, access requests,
always_ask, and one-shot handling stay keyed by secret names.member_snapshotkeeps listing secret names. - A protected DEK release covers every record of each protected member:
- Approval card
grant_options[].unlock_materialcarries one material per record, named by record name. - The agent-binding batch issues one signed release context per record, with
the operation hash over the record name. The signed
display.secretslists every record ({"name": "<record>", "kind": "static"}) because the sandbox requires the display block to cover each release item. - Grant creation requires the submitted DEK names to equal the record names of the protected members.
- Approval card
- Within a live grant, delivery may use any record of a covered secret.
- Any envelope change expires the secret's pending requests and active grants, and releases resident avault scopes, as rotate and delete do today.
- The approval card shows each member's field names.
8. API
POST /api/vault/secretsaccepts an optionaldefault_fieldand optionalfields:[{"name", "record", "blind_box"}]for standard secrets or[{"name", "record", "sealed"}]for protected secrets. The top-levelblind_boxorsealedis still the default field. For standard secrets Python seals each field withavault seal --name <record> --blind-box. Keypairs rejectfields.PUT /api/vault/secrets/{name}/fields/{field}takes{"record", "blind_box"}or{"record", "sealed"}. For the default field it replaces the default envelope. Otherwise it adds the field (appended) or replaces its value. It returns the masked metadata.DELETE /api/vault/secrets/{name}/fields/{field}removes an extra field. The browser sends{"expected_updated_at": "<displayed version>"}so deleting a field changed in another tab returns 409secret_conflict. The default field cannot be removed (409).PATCH /api/vault/secrets/{name}also acceptsdefault_fieldto rename the default field. The name must be valid and unused; this is pure metadata and leaves envelope versions, pending requests, and active grants unchanged.POST /api/vault/secrets/{name}/reveal-contextaccepts an optionalfieldand returns the context and envelope of that record.- Every extra create field and field PUT declares the
recordname used to seal it; the server rejects a mismatch with its current field resolution as 409record_mismatchwithout storing anything, and the UI re-reads metadata and re-seals once (the top-level create record is implicitlyNAME). - New error codes:
invalid_field_name,field_exists,field_not_found,too_many_fields,fields_not_supported,record_mismatch,fields_corrupt. Corrupt extra-field storage is warned about and unavailable as a whole; the default record remains usable, while field mutations preserve the original bytes and refuse until the stored section is repaired. - Plaintext rejection, resource-access checks, SSE updates, and audit apply to
every new path. Field changes audit as
updatedwith{"field": "<name>", "op": "add" | "replace" | "remove"}. - The browser derives the record name (
NAMEfor the default field,NAME.fieldotherwise) and seals with it: standard secrets usestandardCreateBlindBoxContext(record), protected secrets use the sandboxseal({name: record, kind: "static"}).
9. Provision requests
The request spec gains fields (field names in display order) and
default_field (one of fields; defaults to the first). They never carry
values.
vibe vault request GITHUB_LOGIN --reason "Log in to GitHub" \
--spec-json '{"protection":"protected","fields":["username","password","totp"],"default_field":"password"}'
The browser form starts with those rows. The user may remove rows, and every
submitted field needs a value. Field-aware provision replies (asynchronous
callbacks, synchronous --wait, and already-existing results) list current field
labels and the default alias from the created secret, not the requested spec,
and share the same field-ref delivery hint. A user-created multi-field shape
also receives this hint when the original request had no field spec.
10. UI
- Create: a static secret looks the same as today until the user adds a field.
Then the value becomes a list of field rows (name and value), with exactly one
default. The template menu offers Login (
username,password) and Login + 2FA (username,password,totp), both defaulting topassword, which receives any value already typed. File upload stays available only for a single-value standard secret. Each row reports its own naming error, and a preview lists theNAME.fieldreferences an agent can use. Visual reference:assets/vault-fields-redesign/. - A protected create seals every field in the same sandbox session and sends one create request. Vault establishment fields are sent once.
- Edit: replace any field's value, add or remove extra fields, and rename the default field. A row shows Save once it changes; on the default row Save renames first and then writes a typed value under the renamed record. Name, kind, and protection stay read-only. After mount the editor owns current server metadata and drafts: own-write responses or sequenced authoritative refetches update truth, while changed parent props and Vault events trigger refetches rather than directly replacing it. Only the latest refetch may apply. Draft reconciliation preserves retained labels, moves a renamed default draft, notices removed drafts, and preserves a dirty label input unless its own rename succeeds.
- List and detail show field names when a secret has more than one field.
- Protected reveal works per field.
- The approval card groups records by secret and shows field names.
- Strings go through
ui/src/i18n/{en,zh}.json; reuse the existing primitives.
11. Cross-repository work
| Repository | Change |
|---|---|
| avibe | Storage, service, API, CLI, UI, use-avibe-vault skill, tests |
| vault-sandbox | Accept record names in crypto-name validation, with tests |
| avault | DESIGN documents the record-name convention; vectors and tests pin field records; no code change |
| avibe-docs | Vault concept page in English and Chinese |
The sandbox change only widens accepted names, so it can deploy first. Standard secrets with fields work without it; protected secrets with fields need it.
12. Validation
- Existing secrets keep their delivery behavior; their metadata adds only
default_fieldandfields. - New paths accept no plaintext.
- Fields are sealed and delivered under their record names; avault tests show a field envelope does not open under another record name.
- Selectors cover refs, variable naming, tag and skill expansion with extra fields, conflicts, unknown fields, and keypair rejection.
- Protected approval releases every record, delivery of any field works under the grant, and a field change expires the grant.
- The migration upgrades and downgrades with existing rows.
- The skill's CLI examples parse.
13. Out of scope for P1
- 2FA codes (P2). A
totpfield type. avault computes the current code at delivery, so the child gets the code and never the seed, and sandbox reveal shows a live code. This needs avault (HMAC-SHA1/256/512, base32,otpauth://parsing) with a DESIGN update, the sandbox, and Python type metadata. Until then a 2FA secret can be stored as an ordinary field. - HTTP Basic auth in
fetchfrom a username and password field. - 1Password import that maps item fields to Vault fields.
14. Known by design
- Approving a protected secret unlocks all its fields for the grant's lifetime.
- Extra field names and the choice of default field cannot change after creation.
- Standard values stay hidden in the UI.
- The CLI cannot write fields; values enter only through the browser.
exportremains deprecated and never delivers values. Agent-initiated field deletion is out of scope; browser/REST removal of extra fields is supported.- There are no plaintext or non-secret fields; non-secret notes belong in the description.
- Web field errors are localized from the canonical stable-code tuple in
vibe/api.py, guarded against both catalogs; agent-facing CLI/service diagnostic text stays English. - VMK-copy discovery (
latest_protected_vmk_wrap_meta) selects the default envelope on the most recently updated secret. Updating an extra field can move a secret with older VMK copies to the front. This is latent while the sandbox writes the base VMK wrap only at setup; multi-passkey/VMK-copy changes must replace this selection before allowing those copies to diverge.