$npx -y skills add iurykrieger/claude-bedrock --skill preserveSingle write point for the vault. Centralizes entity detection, textual matching, entity creation/update, and bidirectional linking. Accepts structured input (list of entities), free-form input (text, meeting notes, session context), or graphify output (graph.json + obsidian mark
| 1 | # /bedrock:preserve — Single Write Point for the Vault |
| 2 | |
| 3 | ## Plugin Paths |
| 4 | |
| 5 | Entity definitions and templates are in the plugin directory, not in the vault root. |
| 6 | Use the "Base directory for this skill" provided at invocation to resolve paths: |
| 7 | |
| 8 | - Entity definitions: `<base_dir>/../../entities/` |
| 9 | - Templates: `<base_dir>/../../templates/{type}/_template.md` |
| 10 | - Plugin CLAUDE.md: `<base_dir>/../../CLAUDE.md` (already injected automatically into context) |
| 11 | |
| 12 | Where `<base_dir>` is the path provided in "Base directory for this skill". |
| 13 | |
| 14 | --- |
| 15 | |
| 16 | ## Vault Resolution |
| 17 | |
| 18 | Resolve which vault to operate on. This skill can be invoked from any directory. |
| 19 | |
| 20 | **Step 1 — Parse `--vault` flag:** |
| 21 | Check if the input arguments include `--vault <name>`. If found, extract the vault name and remove it from the arguments before further parsing. |
| 22 | |
| 23 | **Step 2 — Resolve vault path:** |
| 24 | |
| 25 | 1. **If `--vault <name>` was provided:** |
| 26 | Read the vault registry at `<base_dir>/../../vaults.json`. Find the entry matching the name. |
| 27 | If not found: error — "Vault `<name>` is not registered. Run `/bedrock:vaults` to see available vaults." |
| 28 | If found: set `VAULT_PATH` to the entry's `path` value. |
| 29 | |
| 30 | 2. **If no `--vault` flag — CWD detection:** |
| 31 | Read `<base_dir>/../../vaults.json`. Check if the current working directory is inside any registered vault path |
| 32 | (CWD starts with a registered vault's absolute path). If multiple match, use the longest path (most specific). |
| 33 | If found: set `VAULT_PATH` to the matching vault's `path`. |
| 34 | |
| 35 | 3. **If CWD detection fails — default vault:** |
| 36 | From the registry, find the vault with `"default": true`. |
| 37 | If found: set `VAULT_PATH` to the default vault's `path`. |
| 38 | |
| 39 | 4. **If no resolution:** |
| 40 | Error — "No vault resolved. Available vaults:" followed by the registry listing. |
| 41 | "Use `--vault <name>` to specify, or run `/bedrock:setup` to register a vault." |
| 42 | |
| 43 | **Step 3 — Validate vault path:** |
| 44 | ```bash |
| 45 | test -d "<VAULT_PATH>" && echo "exists" || echo "missing" |
| 46 | ``` |
| 47 | If missing: error — "Vault path `<VAULT_PATH>` does not exist on disk. Run `/bedrock:setup` to re-register." |
| 48 | |
| 49 | **Step 4 — Read vault config:** |
| 50 | ```bash |
| 51 | cat <VAULT_PATH>/.bedrock/config.json 2>/dev/null |
| 52 | ``` |
| 53 | Extract `language`, `git.strategy`, and other relevant fields for use in later phases. |
| 54 | |
| 55 | **From this point forward, ALL vault file operations use `<VAULT_PATH>` as the root.** |
| 56 | - Entity directories: `<VAULT_PATH>/actors/`, `<VAULT_PATH>/people/`, etc. |
| 57 | - Vault config: `<VAULT_PATH>/.bedrock/config.json` |
| 58 | - Git operations: `git -C <VAULT_PATH> <command>` |
| 59 | |
| 60 | --- |
| 61 | |
| 62 | ## Overview |
| 63 | |
| 64 | This skill centralizes ALL write logic for the vault. It receives input (structured, free-form, |
| 65 | or graphify output), identifies entities, correlates with the existing vault, proposes changes |
| 66 | to the user, and executes after confirmation. It is the only path to create or update entities in the vault (except `/sync-people` |
| 67 | which handles people/teams via GitHub API). |
| 68 | |
| 69 | **You are an execution agent.** Follow the phases below in order, without skipping steps. |
| 70 | |
| 71 | --- |
| 72 | |
| 73 | ## Phase 0 — Pre-Write Setup |
| 74 | |
| 75 | Two pre-flight steps run before any input parsing: synchronize the vault with its remote, then (when applicable) merge an incoming graphify output directory into the vault's cumulative `graphify-out/`. |
| 76 | |
| 77 | ### 0.1 Vault Sync |
| 78 | |
| 79 | Execute: |
| 80 | ```bash |
| 81 | git -C <VAULT_PATH> pull --rebase origin main |
| 82 | ``` |
| 83 | |
| 84 | If the pull fails: |
| 85 | - No remote configured: warn "No remote configured. Working locally." and proceed. |
| 86 | - Pull conflict: `git -C <VAULT_PATH> rebase --abort` and warn the user. DO NOT proceed without resolving. |
| 87 | - Otherwise: proceed. |
| 88 | |
| 89 | ### 0.2 Merge Incoming Graphify Output |
| 90 | |
| 91 | **When this runs:** Only when the skill was invoked with a `graphify_output_path` argument pointing at a graphify output directory (e.g., `/bedrock:learn` passes `$TEACH_TMP/graphify-out-new/`). Free-form text input and structured entity-list input skip this sub-phase entirely. |
| 92 | |
| 93 | **Skip condition (backward compat):** If the input's `graphify_output_path` resolves to the same absolute path as `<VAULT_PATH>/graphify-out/`, skip this sub-phase. Legacy callers (and `/bedrock:sync` in its current form) point at the vault's own output directory — there is nothing to merge. Use `realpath` (or equivalent) to compare: |
| 94 | |
| 95 | ```bash |
| 96 | incoming_real=$(cd "<graphify_output_path>" 2>/dev/null && pwd -P) |
| 97 | vault_real=$(cd "<VA |