This document is the authoritative build spec for Phase 4. Read it fully before writing any code. It continues directly from Phase 3 (
context.md§14). All architecture rules fromKEYFORGE_PLAN.mdand prior phases remain in force unless explicitly superseded below. Version target:0.4.0.
- What Phase 4 Is
- Why Tauri, Not Electron
- The Core Design Problem: Unlock-Once vs Stateless CLI
- Architecture Overview
- The
kf daemonCommand - Tauri ↔ Daemon Protocol
- Project Structure
- Pages
- Security Model
- Build Order
- Success Criteria
- Rules for Claude Code
Phases 1–3 built a complete, tested CLI: clone-and-setup, an encrypted vault,
kf run for existing projects, dry-run previews, and a full --json contract
on every command. Phase 4 puts a face on it.
The GUI is for:
- Developers who want a visual workflow instead of a terminal
- The clipboard-detection flow ("I copied a repo URL, now what") that doesn't make sense as a CLI interaction
- A browsable, visual vault — masked values, validity badges, usage at a glance
- Anyone on the team who isn't comfortable in a terminal but still needs to clone and set up a project correctly
The GUI does not reimplement anything. Every byte of business logic — detection, installation, classification, encryption, validation — already exists in the Core Engine and the Vault module from Phases 1–3. Phase 4's only job is to present that logic visually and talk to it correctly.
This is a deviation from KEYFORGE_PLAN.md §5 and §10, which specified
Electron. The decision is revisited here because the constraints are clearer
now than they were when the original plan was written.
Electron ships a full Chromium + Node runtime inside every install (~150–200MB), and the entire app — including all Core Engine logic — would run inside that Node runtime. This was the obvious choice when KeyForge was still conceptual.
Tauri uses the OS's native webview (WebView2 on Windows, WebKit on macOS, WebKitGTK on Linux) for the UI layer and a small Rust shell for the application binary. Bundle size is roughly 10–20MB. The frontend is still React + TypeScript — nothing changes about how the UI is built.
Why this matters for KeyForge specifically: the entire Core Engine and
Vault already exist as a working, tested Node/TypeScript CLI (kf). Neither
framework requires rewriting that logic. The choice is purely about the shell:
| Electron | Tauri | |
|---|---|---|
| Install size | ~150-200MB | ~10-20MB |
| Memory footprint | Higher (full Chromium per app) | Lower (shared OS webview) |
Calls into kf CLI |
Node child_process (native) |
Rust Command (native) |
| Frontend stack | React/TS (unchanged) | React/TS (unchanged) |
| Maturity | Very mature, huge ecosystem | Mature, smaller but solid ecosystem |
Given that KeyForge is a lightweight, offline-first, "gets out of your way" tool — the same philosophy that ruled out Docker/Nix in Phase 1 — a 150MB Electron shell to wrap a tool whose entire value proposition is being light and fast is a mismatch. Tauri is consistent with the product's own values.
The CLI is still the single source of truth. This decision does not change how the GUI talks to KeyForge's logic — see §3 and §4.
This is the most important design decision in Phase 4. Get this wrong and either the vault becomes insecure or the "unlock once per session" requirement becomes impossible to satisfy.
The conflict:
- The product requirement is: prompt for the master password once when the GUI launches, and don't ask again until the app is closed.
- But every
kf <command> --jsoninvocation from Phase 1–3 is a fresh, stateless subprocess. It starts, does its work, prints JSON, and exits. It has no memory of a previous unlock. There is no warm state to reuse. - Re-deriving the vault encryption key from the password is cheap, but passing the master password to every subprocess call (as an argument, env var, or stdin write per call) means the password lives in the GUI's memory for the whole session and gets transmitted on every single action. This works, but it's worse than necessary — it multiplies the number of times the secret crosses a process boundary, multiplies the surface area for it to leak into a log or crash dump, and contradicts the "minimal exposure" spirit of the Phase 2 security rules.
The solution: kf daemon.
A new CLI command, kf daemon, starts a long-lived background process that:
- Is started once, when the GUI launches.
- Receives the master password exactly once, over its stdin, immediately after starting (never as a command-line argument, never logged).
- Derives the vault encryption key and holds the derived key (not the password) in memory for its lifetime.
- Listens on a local IPC channel (a Unix domain socket on macOS/Linux, a named pipe on Windows) for newline-delimited JSON requests.
- For each request, performs the same operation the equivalent
kf <command> --jsonwould perform — using its already-derived key, so it never touches disk-stored secrets or re-prompts. - Exits when told to (
{"op":"shutdown"}) or when its parent process (the Tauri app) exits.
This means:
- The master password is read from stdin exactly once per app launch, never passed as an argument, never written to any log.
- The vault stays locked (key not derived) until the GUI explicitly unlocks it.
- All non-vault operations (clone detection, install, stack detection) can
still use the plain stateless
kf <command> --jsonsubprocess pattern from Phase 3 — they don't need the daemon at all. Only vault-touching operations route through the daemon. - The daemon is additive. It does not replace or modify any Phase 1–3 CLI
command.
kf vault --json,kf keys list --json, etc. still work exactly as before for terminal users who don't want a daemon running. The GUI is simply a client that prefers the daemon for vault operations because it needs persistent unlock state; the CLI commands themselves are unchanged.
What this is not: This is not a network service. The socket/pipe is local only, created with restrictive permissions, and never bound to a network interface. It is conceptually a more efficient stand-in for "run the CLI again," not a remote API.
┌─────────────────────────────────────────────────────────────┐
│ Tauri App │
│ │
│ ┌──────────────────┐ ┌───────────────────────────┐ │
│ │ Frontend │ │ Rust Shell (main process) │ │
│ │ (React + TS) │ IPC │ │ │
│ │ - Dashboard │◄──────►│ - Tauri commands │ │
│ │ - Clone Wizard │ │ - Spawns kf subprocesses │ │
│ │ - Vault Manager │ │ - Spawns/talks to daemon │ │
│ │ - Settings │ │ - Clipboard watcher │ │
│ │ - Profiles (stub) │ │ │ │
│ └──────────────────┘ └─────────────┬───────────────┘ │
└──────────────────────────────────────────────┼──────────────────┘
│
┌──────────────────────────────┼───────────────────────┐
│ │ │
▼ subprocess, one-shot ▼ socket/pipe, persistent
┌───────────────────────┐ ┌───────────────────────────┐
│ kf <cmd> --json │ │ kf daemon │
│ (clone, run detection, │ │ (vault operations only: │
│ install, dry-run) │ │ add, list, show, check, │
│ exits after each call │ │ match, fetch-classify) │
└───────────────────────┘ │ long-lived, holds derived │
│ key in memory │
└───────────────────────────┘
│
▼
~/.config/keyforge/vault.enc
Routing rule, stated plainly:
- Any operation that needs the vault (add a key, list entries, show a value, match during clone, validate a key, fetch-classify) → goes through the daemon, via the persistent socket.
- Any operation that doesn't touch the vault (clone a repo, detect stacks, run
installs, dry-run preview without vault matching) → goes through a one-shot
kf <command> --jsonsubprocess, exactly as Phase 3 built it. kf cloneandkf runactually need both: they call the daemon mid-pipeline to resolve.env.examplevars against the vault, then continue. See §6 for how this is handled without forcing the whole pipeline through the daemon.
New file: src/cli/commands/daemon.ts. New Core Engine support file:
src/vault/daemonServer.ts (the actual socket server and request handler —
kept in src/vault/ since it's vault logic, not CLI presentation).
kf daemon [options]
Starts a long-lived background process that holds the vault unlocked
in memory and serves vault operations over a local socket.
Options:
--socket <path> Override the default socket/pipe path
(default: ~/.config/keyforge/daemon.sock on
macOS/Linux, \\.\pipe\keyforge-daemon on Windows)
On start, the daemon reads ONE line from stdin: the master password.
If the vault doesn't exist yet, this becomes the password used to create it.
If the vault exists, this is used to derive the key and unlock it.
If the password is wrong, the daemon writes one JSON line to stdout
({"ok":false,"error":{"code":"VAULT_LOCK","message":"..."}}) and exits 1
WITHOUT starting the socket server.
On successful unlock, the daemon writes one JSON line to stdout:
{"ok":true,"socket":"<resolved socket path>","pid":<number>}
The daemon then listens on the socket until it receives a {"op":"shutdown"}
request or its stdin closes (parent process exited).
Request/response protocol over the socket — newline-delimited JSON, one request per line, one response per line, in order (no pipelining needed for v1 — Tauri sends one request, awaits the response, then sends the next).
// Request shape (all requests)
interface DaemonRequest {
id: string // client-generated, echoed back in response
op: DaemonOp
payload: unknown // shape depends on op, see table below
}
// Response shape (all responses)
interface DaemonResponse {
id: string // matches the request id
ok: boolean
result?: unknown // present if ok === true
error?: { code: string; message: string } // present if ok === false
}
type DaemonOp =
| 'vault.list' // payload: { category?: VaultCategory }
| 'vault.get' // payload: { id: string }
| 'vault.show' // payload: { id: string } — returns decrypted value
| 'vault.add' // payload: Omit<VaultEntry, 'id'|'addedAt'>
| 'vault.update' // payload: { id: string; patch: Partial<VaultEntry> }
| 'vault.delete' // payload: { id: string }
| 'vault.setDefault' // payload: { type: string; id: string }
| 'vault.matchEnvVars' // payload: { envVarNames: string[] }
| 'vault.validateKey' // payload: { id: string }
| 'vault.classify' // payload: { name: string; value: string } (no vault write — for fetch preview)
| 'shutdown' // payload: {}Implementation rule: daemonServer.ts does not duplicate vault logic. It
imports the exact same functions from src/vault/store.ts, src/vault/ match.ts, src/vault/classify.ts, and src/vault/validate.ts that the
Phase 2/3 CLI commands already call. The daemon is a thin protocol wrapper —
it receives a request, calls the existing function, sends back the result.
The only thing the daemon adds that the stateless CLI commands don't have is
holding the derived key across multiple calls instead of re-deriving it
(and re-prompting for the password) every time.
This requires one small, additive change to src/vault/store.ts: an optional
way to supply an already-derived key instead of triggering the interactive
unlock flow. This must be additive — existing call sites (the stateless CLI
commands) continue working exactly as before, unaffected.
The Rust shell does not talk to the vault socket directly with custom logic scattered across the codebase. It exposes a small set of Tauri commands (the standard Tauri IPC mechanism for frontend → Rust calls) that the React frontend calls. Each Tauri command does one of two things:
A. One-shot CLI subprocess (non-vault operations)
// Tauri command, callable from frontend as invoke('clone_repo', {...})
// Spawns: kf clone <url> --json --dest <path> --open <target>
// Captures stdout, parses as JSON, returns to frontend.
// Used for: clone_repo, run_setup, dry_run_preview, detect_stacksB. Daemon socket call (vault operations)
// Tauri command, e.g. invoke('vault_list', { category: 'api-keys' })
// Writes a DaemonRequest to the persistent socket connection,
// awaits the matching DaemonResponse (by id), returns result to frontend.
// Used for: vault_list, vault_show, vault_add, vault_update, vault_delete,
// vault_set_default, vault_validate, vault_match_env_varsDaemon lifecycle from the Tauri side:
App launch
→ show unlock screen (password input)
→ on submit: spawn `kf daemon`, write password to its stdin, read first stdout line
→ if {"ok":true,...} → store socket path, connect, proceed to Dashboard
→ if {"ok":false,...} → show error, let user retry (wrong password) or
offer "this is a new vault" path on first run
→ keep the daemon process and socket connection alive for the app's lifetime
App close / quit
→ send {"op":"shutdown"} to the daemon over the socket
→ if no response within 2s, kill the process directly
The kf clone / kf run mid-pipeline daemon call:
kf clone and kf run, when invoked from the CLI directly by a terminal
user, use their own interactive vault unlock (Phase 2/3 behaviour,
unchanged). When invoked from the GUI, the flow is different because the
vault is already unlocked via the daemon:
- Frontend calls
clone_repoTauri command (one-shot subprocess, per §6A) with a flag tellingkf cloneto skip its own env-matching step:kf clone <url> --json --no-vault-match --dest <path>(--no-vault-matchis a new flag — see below.) kf cloneruns clone + detect + install, and instead of matching.env.exampleagainst the vault itself, it returns the list of required env var names in its JSON output without attempting to resolve them.- The frontend takes that list and calls
vault_match_env_vars(daemon socket call) to get the matches. - The frontend shows the user the match/prompt UI (same content as the CLI's prompt, just rendered as a form) for any unmatched vars.
- The frontend calls a new one-shot command,
kf write-env --json, passing the resolved name→value map directly as a JSON payload over stdin (not as CLI arguments — same value-never-in-argv rule from Phase 2 applies). This writes.envand updates.gitignoreusing the existingenvWriter.ts.
This keeps the daemon's responsibility narrow (vault reads/writes only) and
keeps kf clone/kf run's Core Engine pipeline (setup.ts) unchanged — it
just gains one new optional flag and the orchestration moves up a level when
the GUI is the caller.
New flag required on kf clone / kf run: --no-vault-match — skips the
vault-matching step inside runSetup, returns required env var names as
unresolved in the JSON result instead. This is a small, additive change to
the existing Phase 3 pipeline, not a redesign of it.
New command required: kf write-env --json — reads a JSON payload
({ projectDir: string, vars: { name: string; value: string }[] }) from
stdin (never argv), calls envWriter.writeEnv, returns the
WriteEnvResult as JSON. This is a thin new CLI command wrapping the existing
core/envWriter.ts — no new Core Engine logic.
keyforge/ (existing repo root)
├── src/ (existing CLI/Core Engine — Phases 1-3)
│ ├── cli/
│ │ └── commands/
│ │ ├── daemon.ts NEW
│ │ └── writeEnv.ts NEW
│ ├── core/ MOD — setup.ts gains --no-vault-match support
│ └── vault/
│ ├── daemonServer.ts NEW — socket server, dispatches to store/match/classify/validate
│ └── store.ts MOD — additive: accept pre-derived key
│
└── gui/ NEW — the Tauri application, separate package
├── src-tauri/ Rust shell
│ ├── Cargo.toml
│ ├── tauri.conf.json
│ └── src/
│ ├── main.rs
│ ├── cli_bridge.rs one-shot kf subprocess calls (§6A)
│ ├── daemon_client.rs socket connection + request/response matching (§6B)
│ ├── daemon_lifecycle.rs spawn/unlock/shutdown the kf daemon process
│ └── clipboard.rs clipboard polling for repo-URL detection
│
└── src/ React frontend
├── main.tsx
├── App.tsx
├── api/
│ ├── cli.ts typed wrappers around invoke() for §6A commands
│ └── vault.ts typed wrappers around invoke() for §6B commands
├── pages/
│ ├── Dashboard.tsx
│ ├── CloneWizard.tsx
│ ├── VaultManager.tsx
│ ├── Settings.tsx
│ └── Profiles.tsx stub/placeholder page
├── components/
│ ├── UnlockScreen.tsx
│ ├── MaskedValue.tsx
│ ├── ValidityBadge.tsx
│ ├── ClipboardBanner.tsx
│ └── ... (shared UI components)
└── types/
└── index.ts mirrors src/shared/types.ts contracts
Why gui/ is a separate package, not merged into src/: The Core Engine
and CLI (src/) must remain installable and usable standalone (npm install -g keyforge, no Tauri/Rust toolchain required). The GUI depends on the CLI
being built (dist/cli/index.js), but the CLI must never depend on anything
under gui/. This is the Phase 1 architecture rule ("Core Engine has zero
GUI dependencies") extended to the package level.
- Password input (masked)
- On first run (no vault file exists yet): label changes to "Create a master password" with a confirmation field
- Submit → spawns daemon, attempts unlock, shows inline error on failure ("Wrong password" / daemon failed to start)
- A "Skip — use machine-key only" link, mirroring the Phase 2 CLI behavior where a user can decline setting a password. If chosen, the daemon is still used (for the persistent-connection benefit), just unlocked with the machine-derived key instead of a password-derived one.
- Vault health summary: total entries, breakdown by category, count needing
re-validation (
isValid === nullor stalelastValidated) - Recent clones: a small local history (new — see note below) of the last N
kf clone/kf runinvocations made through the GUI, with outcome - Clipboard banner: if a GitHub/GitLab/Bitbucket URL is detected in the system clipboard, show a dismissible banner: "Repo URL detected — Clone with KeyForge?" → clicking it pre-fills the Clone Wizard
- "Clone a repo" primary button → Clone Wizard
Note on "recent clones" history: this is new state, not something Phases 1–3 tracked. Store it as a simple local JSON file at
~/.config/keyforge/gui-history.json, written by the Rust shell after each successful clone/run. This file contains no secrets — only repo URL, destination path, timestamp, and outcome. Keep it out of the vault entirely.
Step-based flow:
- Repo URL — text input, pre-filled if launched from the clipboard banner
- Destination — native folder picker (Tauri's dialog API)
- Review — calls
kf clone --json --dry-run --no-vault-matchto get the stack/install preview, then callsvault_match_env_vars(daemon) for the env preview, and renders both together: detected stacks, install commands, which env vars will auto-inject vs need input - Fill unmatched vars — a form, one field per unmatched var, each with a "save to vault after" checkbox, matching the CLI's per-var save offer
- Open after setup — vscode / terminal / none, same as CLI
- Execute — calls the real
kf clone --json --no-vault-match, thenkf write-env --jsonwith the resolved values, shows live progress (stream stdout from the subprocess line-by-line if--jsonmode is changed to support progress events — see note below) and a final summary
Streaming progress note: Phase 3's
--jsonmode prints exactly one JSON object at the end, not progress events. For the GUI, this means the Clone Wizard's execute step has no granular progress to show during install — only a spinner until the final JSON arrives. This is acceptable for Phase 4 v1. Do not modify the--jsonoutput contract to add progress streaming; that is a larger change (NDJSON progress events) that should be its own follow-up if needed, not bundled into this phase.
- Category tabs: api-keys, urls, ids, config, paths
- Table per category: type, name, env var name, validity badge, last validated, default marker
- Click a row → detail panel: masked value with a "Show" button (re-uses the already-unlocked daemon session — no re-prompt, since the GUI already holds an unlocked session for its lifetime, consistent with the "unlock once per launch" decision), edit name/env-var-name/tags, set default, delete (confirm), validate (single)
- "Validate all" button at the top — calls
vault_validatefor every api-keys entry in sequence, updates badges as results come in - "Add entry" button → opens the same classify-then-confirm flow as
kf add, rendered as a form: paste/type a value → live classification result shown → confirm or override category/type → name (optional) → save
- Default open-in preference (vscode / terminal / none)
- Clipboard monitoring toggle (on/off)
- Theme (light / dark / system)
- "Re-lock vault" button — sends
{"op":"shutdown"}to the daemon and returns to the Unlock Screen without closing the app - Daemon status indicator (running / not running, socket path, pid) — useful for debugging, low priority on visual polish
- Single page, no functional CRUD
- Shows: "Profiles are coming in a future release. Right now KeyForge uses one shared vault."
- No nav-bar badge, no fake data, no partially-working controls — a clean, honest placeholder. This avoids building UI for a CLI feature that doesn't exist yet (per the scope decision) while keeping the nav structure ready for when profiles ship.
All Phase 2 vault security rules remain in force. Phase 4 adds the following, specific to the daemon and the GUI process boundary.
-
The master password is read by the daemon from stdin exactly once, at daemon startup. It is never passed as a command-line argument to
kf daemon(visible inps), never written to the GUI's local history file, never logged by the Rust shell. -
The Rust shell holds the password only transiently — for the duration of spawning the daemon process and writing it to stdin. It must not retain the password string in any long-lived Rust struct after that write completes. Use a scoped/dropped value, not a field on a long-lived state object.
-
The socket/pipe is local-only and access-restricted. Unix domain socket file permissions
0600. Windows named pipe created with a security descriptor restricting access to the current user. Never bind to a TCP port, never bind to0.0.0.0or any network-reachable interface. -
vault.showresponses (decrypted values) are not logged by the Rust shell or cached in any Tauri-side state beyond the single React component that's actively displaying them. Closing the detail panel should drop the value from frontend memory (don't keep it in a global store). -
The
gui-history.jsonfile (§8.2) contains zero secret material. Only repo URL, destination path, timestamp, outcome status. This must be enforced in code, not just by convention — the function that writes this file should accept a narrow, explicit type that has novaluefield physically present, so it's impossible to accidentally serialize a secret into it. -
kf write-envreceives values over stdin, never argv. Same rule askf addfrom Phase 2 — this is a direct extension of that existing rule to the new command. -
The daemon shuts down on GUI exit. The Rust shell must send
{"op": "shutdown"}on app close (including window-close, not just explicit quit) and fall back to killing the process if the daemon doesn't acknowledge within 2 seconds. A vault should not stay unlocked in memory after the GUI that unlocked it has closed. -
No new network calls beyond what Phases 1–3 already do (provider validation pings). The GUI itself makes no telemetry calls, no update checks, no analytics. Consistent with the "no cloud, no telemetry" rule from the original plan.
Build src/vault/daemonServer.ts and src/cli/commands/daemon.ts.
Make the additive change to src/vault/store.ts to accept a pre-derived key.
Write unit tests for daemonServer.ts covering each DaemonOp — these can
run against the socket directly (spawn the server in-process in the test, not
via the CLI) to verify request/response correctness without needing Tauri at
all.
Manually test: kf daemon from a terminal, echo a password to its stdin,
confirm it prints the {"ok":true,...} line, then use a simple nc/socket
client (or a small test script) to send a vault.list request and confirm a
correct response. Send {"op":"shutdown"} and confirm clean exit.
Done when: The daemon can be started, unlocked, queried for all ops, and shut down — entirely from the terminal, with no GUI involved yet.
Modify src/core/setup.ts to support skipping vault matching, returning
unresolved var names instead.
Build src/cli/commands/writeEnv.ts — reads JSON from stdin, calls
envWriter.writeEnv, prints JSON result.
Confirm existing kf clone and kf run behaviour (without the new flag) is
completely unchanged — run the full Phase 1–3 test suite.
Done when: kf clone <url> --json --no-vault-match returns unresolved var
names instead of matching them. kf write-env --json < payload.json writes
.env correctly. All existing tests still pass.
Initialize the Tauri project under gui/. Get a minimal window rendering a
placeholder React page. Confirm the build pipeline works (tauri dev, tauri build) before writing any real feature code.
Build cli_bridge.rs — a generic "spawn kf with these args, capture stdout,
return it" function. Wire one Tauri command (detect_stacks is a good first
test) end-to-end: React button → Rust → kf subprocess → JSON → back to React.
Done when: A button in the placeholder UI successfully calls a real kf
subprocess and displays its JSON output in the page.
Build daemon_lifecycle.rs and daemon_client.rs.
Build the UnlockScreen.tsx component and wire it to actually spawn the
daemon, send the password, and handle both success and failure paths
(including the first-run "create a password" framing and the "skip" link).
Done when: Launching the Tauri app shows the unlock screen, entering the
correct password connects to a running daemon, entering the wrong password
shows an error, and the daemon process can be confirmed running (e.g. via
ps) only while the app is open.
Build all vault_* Tauri commands in daemon_client.rs (list, get, show,
add, update, delete, setDefault, validate).
Build VaultManager.tsx with category tabs, the entry table, detail panel,
masked value display + show button, add-entry flow, validate-all.
Done when: Every vault CRUD action works end-to-end through the real daemon against a real vault file. Masked values display correctly. Validate calls hit real provider APIs and update badges.
Build the Dashboard page (vault health summary, recent clones list reading
from gui-history.json, clipboard banner).
Build clipboard.rs — polls the system clipboard at a reasonable interval
(e.g. every 1–2 seconds while the app is focused), checks against a simple
GitHub/GitLab/Bitbucket URL pattern, emits an event to the frontend when a new
match is detected (debounced so the same clipboard content doesn't re-trigger
the banner repeatedly).
Done when: Copying a GitHub URL while the app is open and focused shows the banner within ~2 seconds. Dismissing it doesn't reappear for the same clipboard content. Recent clones list updates after a successful clone.
Build the full step flow per §8.3: URL → destination (native folder picker) → review (dry-run + vault match preview) → fill unmatched vars → open-in choice → execute → summary.
Wire the --no-vault-match + vault_match_env_vars + kf write-env sequence
described in §6.
Done when: A full clone — including some vault-matched vars and some
manually entered ones, with at least one saved back to the vault — works
end-to-end through the wizard and produces the same .env / .gitignore
result as the equivalent CLI flow would.
Build Settings.tsx (open-in preference, clipboard toggle, theme, re-lock,
daemon status indicator).
Build the Profiles.tsx stub page exactly as described in §8.6 — no
functionality, honest placeholder copy.
Pass over all pages for consistent styling, loading states, and error states.
Done when: All settings persist (store them in a local config file, not the vault — they're not secrets). Re-lock returns to the Unlock Screen without closing the app. Profiles page shows the placeholder correctly.
tauri buildproduces installable artifacts for at least the platform you're developing on (Windows, percontext.md§3)- Bump
src/package.jsonversion to0.4.0; add agui/package.json/Cargo.tomlversion matching it - Update
context.mdwith Phase 4 completion notes (same format as prior phases) - Confirm the CLI (
src/) still builds, tests, and runs standalone with zero Tauri/Rust toolchain present — this is the architecture rule from §7 being verified, not just asserted
Done when: A built Tauri installer runs the full app standalone. npm test
in src/ still passes with no Rust toolchain involved.
Daemon:
-
kf daemonstarts, reads password from stdin, unlocks or rejects correctly - All
DaemonOptypes work correctly over the socket -
{"op":"shutdown"}cleanly stops the daemon - Password never appears in
ps, logs, or the GUI's history file - Socket/pipe has restrictive permissions; never network-bound
CLI additions:
-
--no-vault-matchreturns unresolved var names instead of matching -
kf write-env --jsonreads stdin, writes.envcorrectly, never accepts argv values - All Phase 1–3 tests still pass unmodified
GUI — core flows:
- Unlock Screen handles first-run (create password), normal unlock, wrong password, and skip-to-machine-key
- Dashboard shows accurate vault health counts and recent clone history
- Clipboard banner appears within ~2s of copying a recognizable repo URL
- Clone Wizard completes a full clone with mixed vault-matched and
manually-entered vars, producing correct
.env+.gitignore - Vault Manager: add, show (masked → revealed), edit, delete, set default, validate all work against the real daemon
- Settings persist across app restarts; re-lock returns to Unlock Screen without quitting
- Profiles page shows an honest placeholder, no fake functionality
Architecture:
-
src/(CLI/Core Engine) has zero dependency on anything ingui/ -
gui/Rust shell never implements vault crypto or classification logic directly — it only callskfsubprocesses or the daemon socket -
daemonServer.tsimports existing vault functions; does not duplicate logic
Packaging:
-
tauri buildproduces a working installer/binary - CLI continues to build/test/run standalone without the Rust toolchain
These extend all rules from KEYFORGE_PLAN.md and Phase 2/3 documents.
Architecture:
-
The Rust shell (
gui/src-tauri/) never implements business logic. It is a bridge: spawnkfsubprocesses, or speak the daemon socket protocol. Detection, classification, encryption, and validation logic live only insrc/core/andsrc/vault/, exactly as in prior phases. -
daemonServer.tsmust import and reuse the existing functions insrc/vault/store.ts,match.ts,classify.ts, andvalidate.ts. Writing new vault logic insidedaemonServer.tsinstead of calling the existing modules is a rule violation. -
The CLI package (
src/) must remain fully functional and independently installable with zero awareness ofgui/. Nothing undersrc/may import fromgui/. The dependency direction is one-way:gui/depends on the built CLI; the CLI does not knowgui/exists. -
Existing Phase 1–3 CLI behaviour (when run from a terminal, without the new
--no-vault-matchflag) must not change.--no-vault-matchis opt-in and additive.
Security:
-
The master password is read by the daemon from stdin only — never as a
kf daemonargument, never logged, never written togui-history.jsonor any settings file. -
kf write-envaccepts its payload via stdin only — passing values via argv must be rejected the same way Phase 2'skf addrejects argv values. -
gui-history.jsonmust be written through a narrowly-typed function that has novalue/secret field in its input type — making it structurally impossible to leak a secret into this file, not just a documented convention. -
The daemon socket/pipe must never be created with permissions wider than the current user, and must never bind to a network-reachable address.
Scope:
-
Do not implement Profiles functionality. The Profiles page is a static placeholder only (§8.6).
-
Do not modify the
--jsonoutput contract from Phase 3 to add progress streaming. The Clone Wizard's execute step uses a spinner + final result, not live progress, for this phase. -
Do not add telemetry, analytics, or update-checking network calls.
-
Do not begin Phase 5 (AI agent layer) work.
Process:
-
Build and verify the daemon entirely from the terminal (Step 1) before writing any Tauri/Rust code. The daemon must be provably correct on its own before a GUI is layered on top of it.
-
After Step 2, run the full existing Phase 1–3 test suite and confirm zero regressions before proceeding to Step 3. The CLI changes in Phase 4 are small and additive; treat any test failure here as a stop-and-fix signal, not something to patch around in the GUI layer.
Document version: 4.0
Product: KeyForge
Author: Ashish Tembhekar
Phase: 4 — Desktop GUI (Tauri)
Status: Ready for build
Prerequisites: Phase 1 + 2 + 3 complete (context.md)
Key deviation from KEYFORGE_PLAN.md: Tauri replaces Electron as the GUI shell (§2)