Repository navigation
feat: agents store and manage keys without seeing them (ADR-0012) - #110
Merged
Merged
Conversation
An agent running in the separate agent Mac account can now ask the app to store a key, list the keys it added, edit them and move them to Trash. The owner types every value into the app's own editor; the agent only ever gets back fixed replies and error codes. - crates/notes/src/agent.rs: the "added by an agent" mark and agent_edit_rule (which edits apply at once, which need the owner's Allow, which also need the Master Password). - src-tauri/src/core/agent.rs: the owner's grant (at most an hour, ended by lock, sleep or quit) and the five requests. - src-tauri/src/agent_route.rs: the Unix socket in /Users/Shared/encrypted-note-keys, accepting only the agent account's uid. - crates/agent-keys-mcp: enote-agent-keys, the agent's MCP tool. No Vault crate, no network crate. - src/AgentRequest.tsx and Settings: the request windows and the grant. - Entitlements: read-write access to the one shared folder, with the pinned hash updated. - scripts/agent-keys-setup.sh, docs/agent-keys.md and the docs, ADRs and Emergency Reader note for agent-added keys. - check-network-source.mjs: sockets and peer-uid checks stay in the route and the tool, the tool imports no Vault crate, and none of it uses companion/. Never signs (ADR-0011 stays deferred). Built and tested with fictional data only; not yet checked by hand or security reviewed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nniiovoo
enabled auto-merge
November 9, 2026 16:36
On Windows the route has no listener, and its stand-in AgentRoute was a unit struct, so AgentRoute::default() failed clippy's default_constructed_unit_structs lint. Give it a private field, like the Mac route. The route tests imported the agent_route module at the top but used it only in the Mac-only listener tests, an unused import on Windows; import it there instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds ADR-0012: an agent such as Claude Code, ChatGPT or Codex, running in the separate agent Mac account, can ask the app to store keys and manage the keys it added, without ever seeing a value.
What the agent can do
Limits
Where it lives
crates/notes/src/agent.rs: the "added by an agent" mark andagent_edit_rule.src-tauri/src/core/agent.rs: the grant and the five requests.src-tauri/src/agent_route.rs: the Unix socket in/Users/Shared/encrypted-note-keys, the app's only listener.crates/agent-keys-mcp:enote-agent-keys, the agent's MCP tool. It uses no Vault crate and no network crate.src/AgentRequest.tsxand Settings: the request windows and the grant.Entitlements.plist: read-write access to that one shared folder only, withscripts/pinned-hashes.txtupdated.scripts/check-network-source.mjs: keeps sockets and peer-uid checks inside the route and the tool, keeps Vault crates out of the tool, and keepscompanion/out of all of it.scripts/agent-keys-setup.shanddocs/agent-keys.md, plus updates to the guide, security model, FORMAT, ADR-0004/0007/0012 and the Emergency Reader, which shows " (added by an agent)" after the title.Dependencies
No new packages in
Cargo.lock.agent-keys-mcpusesserde_jsonandtempfilefrom the workspace, andlibc = "=0.2.189"(exact pin, already in the lockfile) forgetpeereid. That call sits in one reviewed module,peer.rs, the only place in the crate allowed to use unsafe code.Choices made where the ADR didn't say
src/strings.ts.enote-agent-keysisn't bundled inside the app yet. The docs say to install it in/usr/local/bin.Checks
./scripts/check.shsteps, run on 2026-11-09 with fictional data only:cargo fmt, clippy with-D warningsandcargo denyare clean.npm run typecheckand the production WebView build passed.Not done yet (owner only)
scripts/agent-keys-setup.shfor real./Users/Shared/encrypted-note-keys.🤖 Generated with Claude Code