Skip to content

feat(vault): initialize the vault on first vault command - #314

Merged
geekgonecrazy merged 2 commits into
devfrom
feat/vault-auto-init
Nov 3, 2026
Merged

geekgonecrazy merged 2 commits into
devfrom
feat/vault-auto-init

Conversation

@graywolf336

Copy link
Copy Markdown
Contributor

Summary

Vault-facing commands (atomic vault, atomic intent, atomic memory) now initialize the vault on first use when it is absent, so atomic init --no-vault repositories and clones without redb vault tables work immediately instead of failing with "Vault not initialized. Run atomic vault init first."

  • Repository::ensure_vault(): idempotent first-use init; an existing vault is never re-initialized.
  • CLI vault-ready openers cover the local command bodies.
  • All VaultService repo opens ensure the vault before the domain call (the default in-process Local routing path).
  • atomic query / atomic session stay read-only: they return empty results rather than erroring, so they do not create a vault as a side effect.

Verification

  • cargo test -p atomic-repository --lib repository::vault:: — 39 passed
  • cargo test -p atomic-cli --test it vault_ — 12 passed (3 new auto-init tests)
  • memory_compatibility, concurrent_intent, kg_service — 1 / 4 / 3 passed
  • Smoke on atomic init --no-vault: vault show, vault list, intent new, vault goal start, vault materialize, memory new succeed; vault init afterwards reports "already initialized"

Vault-facing commands now create the vault when it is absent, so a
repository from `atomic init --no-vault` (or one that never ran
`atomic vault init`) serves `atomic vault`, `atomic intent`, and
`atomic memory` on first use instead of failing with "Vault not
initialized".

- Repository::ensure_vault: idempotent first-use initialization
- CLI vault-ready openers for the local command bodies
- VaultService handlers ensure before the domain call
- Regression tests for the repository, CLI, and daemon path
Read commands (vault show/list/context/summaries, goal list/show,
intent show/list/validate/verify, memory show/list/validate/verify)
open read-only and never initialize the vault. A read-only checkout
now keeps working, and a read never creates `.vault/`.

Vault writes still initialize on first use: vault goal start/stop/
resume, materialize, sync, intent new/update/delete/link/attest, and
memory new/write/attest. The daemon's VaultService applies the same
split: write handlers ensure the vault; read handlers do not.

Tests: reads leave `.vault/` absent, and a read-only database still
serves `vault list`.
@geekgonecrazy
geekgonecrazy merged commit e5853cf into dev Nov 3, 2026
9 checks passed
@geekgonecrazy
geekgonecrazy deleted the feat/vault-auto-init branch November 3, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants