---
name: omaralex24-klav-engineering-rules
description: "Evidence-backed engineering rules for OmarAlex24/klav, generated by Everdoc from static analysis and git history: boundaries, contracts, co-change, hotspots, docs hygiene. Use when editing, reviewing, or planning changes in this repository."
---

# OmarAlex24/klav engineering rules

Generated by Everdoc from OmarAlex24/klav @ [`fe8e2a0c8c24`](https://github.com/OmarAlex24/klav/tree/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92) (main) by static analysis and the last 149 commits; no LLM. Every rule cites the counts it rests on. Regenerate instead of editing by hand.

Follow these rules when changing this repository. Each states the constraint, then the observed ratio it rests on, then evidence.

## Boundaries

- **Point dependencies down the layer stack.** Apps and CLIs may depend on adapters, libraries, and contracts, never the reverse: 13 of 16 layered workspace edges (81.3%) comply; fix the 3 upward edges listed below. _(error, confidence 81.3%, 16 observations)_
  - klav-ffi (adapter) → klav-daemon (app)
  - klav-sdk (library) → klav-daemon (app)
  - klav-sdk (library) → klav-forward (cli)

## Contracts

- **Pair every new RPC with a handler.** 100% of RPCs (405/405) are paired with handlers — do not leave new RPCs unhandled. _(info, confidence 100%, 405 observations)_
- **Remove or wire RPCs nothing calls.** 93.6% of handled RPCs (379/405) have a caller in the repository; 26 RPCs have a handler but no caller — confirm an external client uses them or delete them. _(info, confidence 93.6%, 405 observations)_
  - DaemonEngine.grantChangeApply has 1 handler and no caller ([`crates/klav-ffi/src/daemon.rs:1771`](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-ffi/src/daemon.rs#L1771))
  - DaemonEngine.proxyTunnels has 1 handler and no caller ([`crates/klav-ffi/src/daemon.rs:1965`](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-ffi/src/daemon.rs#L1965))
  - DaemonEngine.sandboxList has 1 handler and no caller ([`crates/klav-ffi/src/daemon.rs:2069`](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-ffi/src/daemon.rs#L2069))
  - …and 7 more
- **Pair every new HTTP route with a handler.** 100% of HTTP routes (134/134) are paired with handlers — do not leave new HTTP routes unhandled. _(info, confidence 100%, 134 observations)_

## Co-change

- **Change `apps/ios/Mac/MacModel.swift` together with `apps/ios/Mac/SampleEngine.swift`.** When modifying `apps/ios/Mac/MacModel.swift`, also inspect/update `apps/ios/Mac/SampleEngine.swift` — co-changed in 20/26 commits (76.9%). _(warning, confidence 76.9%, 20 observations)_
  - feat(ios,mac): add a device with a QR code in the apps (ADR 0029 layer 4) (#145) ([#145](https://github.com/OmarAlex24/klav/pull/145), 2026-12-05)
  - feat(apple): add temporary credentials to the Mac and iOS apps (#146) ([#146](https://github.com/OmarAlex24/klav/pull/146), 2026-12-05)
  - feat(mac): move items across projects and revoke Sentinel credentials (#137) ([#137](https://github.com/OmarAlex24/klav/pull/137), 2026-12-04)
  - …and 2 more
- **Change `crates/klav-ffi/src/lib.rs` together with `crates/klav-client/src/proxy_admin.rs`.** When modifying `crates/klav-ffi/src/lib.rs`, also inspect/update `crates/klav-client/src/proxy_admin.rs` — co-changed in 11/16 commits (68.8%). _(warning, confidence 68.8%, 11 observations)_
  - feat(client): implement temporary item expiry (#143) ([#143](https://github.com/OmarAlex24/klav/pull/143), 2026-12-04)
  - feat(cli): implement database items in agent and proxy flows (#111) ([#111](https://github.com/OmarAlex24/klav/pull/111), 2026-12-03)
  - feat(client): fulfill database secret requests with environment links (#110) ([#110](https://github.com/OmarAlex24/klav/pull/110), 2026-12-03)
  - …and 2 more
- **Change `crates/klav-client/src/agents.rs` together with `crates/klav-client/src/audit.rs`.** When modifying `crates/klav-client/src/agents.rs`, also inspect/update `crates/klav-client/src/audit.rs` — co-changed in 9/12 commits (75%). _(warning, confidence 75%, 9 observations)_
  - fix(daemon): keep local reads responsive during network reads (#105) ([#105](https://github.com/OmarAlex24/klav/pull/105), 2026-12-02)
  - feat(client,daemon,ffi,apps): the SQL approval card from the sealed blob and Postgres Activity rows (ADR 0052 layer 16) (#66) ([#66](https://github.com/OmarAlex24/klav/pull/66), 2026-11-29)
  - feat(server): pg_guard switch and the generic sealed-blob route (ADR 0052 layer 14) (#63) ([#63](https://github.com/OmarAlex24/klav/pull/63), 2026-11-29)
  - …and 2 more
- **Change `crates/klav-daemon/src/presence.rs` together with `crates/klav-cli/src/cli.rs`.** When modifying `crates/klav-daemon/src/presence.rs`, also inspect/update `crates/klav-cli/src/cli.rs` — co-changed in 9/13 commits (69.2%). _(warning, confidence 69.2%, 9 observations)_
  - feat(client,daemon,cli,ffi): implement ADR 0029 device linking (#142) ([#142](https://github.com/OmarAlex24/klav/pull/142), 2026-12-04)
  - feat(client,daemon,ffi,cli): expose proxy_revoke in FFI and add item move across projects (#136) ([#136](https://github.com/OmarAlex24/klav/pull/136), 2026-12-04)
  - feat(client,daemon,ffi,cli): add restore/purge and expose Mac parity operations on DaemonEngine (#122) ([#122](https://github.com/OmarAlex24/klav/pull/122), 2026-12-03)
  - …and 2 more
- **Change `crates/klav-core/src/crypto/mod.rs` together with `crates/klav-core/src/crypto/vectors.rs`.** When modifying `crates/klav-core/src/crypto/mod.rs`, also inspect/update `crates/klav-core/src/crypto/vectors.rs` — co-changed in 7/7 commits (100%). _(warning, confidence 100%, 7 observations)_
  - feat(core): implement ADR 0029 QR device link formats, HPKE sealing, and vectors (#135) ([#135](https://github.com/OmarAlex24/klav/pull/135), 2026-12-04)
  - feat(core,proto): pg-scram SCRAM-SHA-256, pg profile, SQL classes and sealed statement (ADR 0052 layers 9-10) (#61) ([#61](https://github.com/OmarAlex24/klav/pull/61), 2026-11-29)
  - feat(core,proto): sandbox CA and grant v5 tunnels (ADR 0052 layers 2-3) (#56) ([#56](https://github.com/OmarAlex24/klav/pull/56), 2026-11-29)
  - …and 2 more
- **Change `klav-ffi` together with `klav-cli`.** When modifying `klav-ffi`, also inspect/update `klav-cli` — co-changed in 25/29 commits (86.2%). _(warning, confidence 86.2%, 25 observations)_
  - feat(client): implement temporary item expiry (#143) ([#143](https://github.com/OmarAlex24/klav/pull/143), 2026-12-04)
  - feat(client,daemon,cli,ffi): implement ADR 0029 device linking (#142) ([#142](https://github.com/OmarAlex24/klav/pull/142), 2026-12-04)
  - feat(client,daemon,ffi,cli): expose proxy_revoke in FFI and add item move across projects (#136) ([#136](https://github.com/OmarAlex24/klav/pull/136), 2026-12-04)
  - …and 2 more
- **Change `crates/klav-daemon/src/protocol.rs` together with `crates/klav-daemon/src/server.rs`.** When modifying `crates/klav-daemon/src/protocol.rs`, also inspect/update `crates/klav-daemon/src/server.rs` — co-changed in 14/14 commits (100%). _(info, confidence 100%, 14 observations)_
  - feat(client): implement temporary item expiry (#143) ([#143](https://github.com/OmarAlex24/klav/pull/143), 2026-12-04)
  - feat(client,daemon,cli,ffi): implement ADR 0029 device linking (#142) ([#142](https://github.com/OmarAlex24/klav/pull/142), 2026-12-04)
  - feat(client,daemon,ffi,cli): expose proxy_revoke in FFI and add item move across projects (#136) ([#136](https://github.com/OmarAlex24/klav/pull/136), 2026-12-04)
  - …and 2 more
- **Change `crates/klav-server/src/routes/agents.rs` together with `crates/klav-proto/src/agent.rs`.** When modifying `crates/klav-server/src/routes/agents.rs`, also inspect/update `crates/klav-proto/src/agent.rs` — co-changed in 8/8 commits (100%). _(info, confidence 100%, 8 observations)_
  - feat(server): sandbox secret requests switch, proxy path, caps and expiry (ADR 0053 layer 3) (#73) ([#73](https://github.com/OmarAlex24/klav/pull/73), 2026-11-29)
  - feat(core,proto): sandbox secret request fields, attach_sandbox and grant v6 (ADR 0053 layer 2) (#71) ([#71](https://github.com/OmarAlex24/klav/pull/71), 2026-11-29)
  - feat(server): pg_guard switch and the generic sealed-blob route (ADR 0052 layer 14) (#63) ([#63](https://github.com/OmarAlex24/klav/pull/63), 2026-11-29)
  - …and 2 more
- **Change `crates/klav-ffi/src/daemon.rs` together with `crates/klav-ffi/src/types.rs`.** When modifying `crates/klav-ffi/src/daemon.rs`, also inspect/update `crates/klav-ffi/src/types.rs` — co-changed in 8/12 commits (66.7%). _(info, confidence 66.7%, 8 observations)_
  - feat(client): implement temporary item expiry (#143) ([#143](https://github.com/OmarAlex24/klav/pull/143), 2026-12-04)
  - feat(client,daemon,ffi,cli): add restore/purge and expose Mac parity operations on DaemonEngine (#122) ([#122](https://github.com/OmarAlex24/klav/pull/122), 2026-12-03)
  - feat(client): fulfill database secret requests with environment links (#110) ([#110](https://github.com/OmarAlex24/klav/pull/110), 2026-12-03)
  - …and 2 more
- **Change `klav-ffi` together with `klav-client`.** When modifying `klav-ffi`, also inspect/update `klav-client` — co-changed in 27/29 commits (93.1%). _(info, confidence 93.1%, 27 observations)_
  - feat(client): implement temporary item expiry (#143) ([#143](https://github.com/OmarAlex24/klav/pull/143), 2026-12-04)
  - feat(client,daemon,cli,ffi): implement ADR 0029 device linking (#142) ([#142](https://github.com/OmarAlex24/klav/pull/142), 2026-12-04)
  - feat(client,daemon,ffi,cli): expose proxy_revoke in FFI and add item move across projects (#136) ([#136](https://github.com/OmarAlex24/klav/pull/136), 2026-12-04)
  - …and 2 more
- **Change `klav-cli` together with `klav-client`.** When modifying `klav-cli`, also inspect/update `klav-client` — co-changed in 27/35 commits (77.1%). _(info, confidence 77.1%, 27 observations)_
  - feat(client): implement temporary item expiry (#143) ([#143](https://github.com/OmarAlex24/klav/pull/143), 2026-12-04)
  - feat(client,daemon,cli,ffi): implement ADR 0029 device linking (#142) ([#142](https://github.com/OmarAlex24/klav/pull/142), 2026-12-04)
  - feat(client,daemon,ffi,cli): expose proxy_revoke in FFI and add item move across projects (#136) ([#136](https://github.com/OmarAlex24/klav/pull/136), 2026-12-04)
  - …and 2 more

## Hotspots

- **Test `apps/ios/Mac/MacModel.swift` before editing.** `apps/ios/Mac/MacModel.swift` absorbed 5 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 16.7%, 30 observations)_
  - fix(mac): show live one-time codes while the presence window is open (#133) ([#133](https://github.com/OmarAlex24/klav/pull/133), 2026-12-04)
  - fix(mac): avoid defaulting Link a repository to General (#128) ([#128](https://github.com/OmarAlex24/klav/pull/128), 2026-12-04)
  - fix(mac): show one-time codes on demand, page Activity, notify secret requests (#118) ([#118](https://github.com/OmarAlex24/klav/pull/118), 2026-12-03)
  - …and 2 more
- **Test `apps/ios/Mac/SampleEngine.swift` before editing.** `apps/ios/Mac/SampleEngine.swift` absorbed 5 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 16.7%, 30 observations)_
  - fix(mac): show live one-time codes while the presence window is open (#133) ([#133](https://github.com/OmarAlex24/klav/pull/133), 2026-12-04)
  - fix(mac): kickstart uninitialized klavd LaunchAgent and add Start now button (#126) ([#126](https://github.com/OmarAlex24/klav/pull/126), 2026-12-04)
  - fix(mac): make agent rows look clickable and let any agent become a sandbox issuer (#103) ([#103](https://github.com/OmarAlex24/klav/pull/103), 2026-12-01)
  - …and 2 more
- **Test `apps/ios/Mac/Vault.swift` before editing.** `apps/ios/Mac/Vault.swift` absorbed 4 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 25%, 16 observations)_
  - fix(mac): show live one-time codes while the presence window is open (#133) ([#133](https://github.com/OmarAlex24/klav/pull/133), 2026-12-04)
  - fix(mac): avoid defaulting Link a repository to General (#128) ([#128](https://github.com/OmarAlex24/klav/pull/128), 2026-12-04)
  - fix(mac): show one-time codes on demand, page Activity, notify secret requests (#118) ([#118](https://github.com/OmarAlex24/klav/pull/118), 2026-12-03)
  - …and 1 more
- **Test `apps/ios/Mac/MenuBar.swift` before editing.** `apps/ios/Mac/MenuBar.swift` absorbed 4 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 30.8%, 13 observations)_
  - fix(mac): kickstart uninitialized klavd LaunchAgent and add Start now button (#126) ([#126](https://github.com/OmarAlex24/klav/pull/126), 2026-12-04)
  - fix(mac): show one-time codes on demand, page Activity, notify secret requests (#118) ([#118](https://github.com/OmarAlex24/klav/pull/118), 2026-12-03)
  - fix(mac): focus master password field when opening locked menu bar panel (#96) ([#96](https://github.com/OmarAlex24/klav/pull/96), 2026-12-01)
  - …and 1 more
- **Test `crates/klav-client/src/proxy_admin.rs` before editing.** `crates/klav-client/src/proxy_admin.rs` absorbed 3 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 12%, 25 observations)_
  - fix(daemon): keep local reads responsive during network reads (#105) ([#105](https://github.com/OmarAlex24/klav/pull/105), 2026-12-02)
  - fix(proxy): verify-full TLS inside Northflank addon tunnels (#88) ([#88](https://github.com/OmarAlex24/klav/pull/88), 2026-11-30)
  - fix(client,klavd,mac): start new accounts with the MCP gateway on, warn only when something older may be on the account (#46) ([#46](https://github.com/OmarAlex24/klav/pull/46), 2026-11-27)

## Docs hygiene

- **Fix broken documentation links.** Fix 1 broken link in 1 guide and check links when moving files: 99.9% of 1,946 doc links resolve. _(warning, confidence 99.9%, 1,946 observations)_
  - docs/probar-mac.md: `extension.md#cargar-sin-empaquetar` does not resolve ([`docs/probar-mac.md:82`](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/docs/probar-mac.md#L82))
- **Update guides that mention changed code.** When changing an entity a guide mentions, update the guide in the same change: 78 guides mention code modified after the guide's last edit (11/90 are fresh). _(info, confidence 12.2%, 90 observations)_
  - CLAUDE.md: `health` is defined in crates/klav-cli/src/cli.rs, changed 2026-12-04 after this page (2026-11-29) ([`CLAUDE.md:20`](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/CLAUDE.md#L20))
  - CLAUDE.md: `klavd` is defined in crates/klav-daemon/src/main.rs, changed 2026-11-29 after this page (2026-11-29) ([`CLAUDE.md:22`](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/CLAUDE.md#L22))
  - CLAUDE.md: `inject` is defined in crates/klav-cli/src/cli.rs, changed 2026-12-04 after this page (2026-11-29) ([`CLAUDE.md:24`](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/CLAUDE.md#L24))
  - …and 7 more
