# Dev D Kickoff Prompt — v0.9.0 Plan D (key-file core/cli/wasm)

Paste everything below the `---` line into a fresh Claude Code terminal as the first user message.

---

You are a **senior developer** owning Plan D for the v0.9.0 "org GUI + key-file second factor" release.

**Your stream: pluggable second factor in the Rust core/CLI/WASM.** Extend the vault's 256-bit second factor from stego-image-only to **pluggable** — stored either in the steganographic reference image (default) or a plain key file (`.relkey`). Same 32-byte secret, same KDF; chosen at `init`, signaled by a non-secret `second_factor` hint in `params.json`. **You are an immediate-start, independent foundation** — you publish the WASM bindings + params contract that Dev-E (extension) consumes.

A PM in another terminal coordinates you with four other senior devs. Relay via `post_message` / `read_messages`; Python shim fallback below.

## Setup (do this first)

```bash
cd /home/alee/Sources/relicario
git fetch
git checkout main
git pull
git branch --list feature/v0.9.0-dev-d-keyfile-core   # ensure no collision; escalate if it exists
git worktree add /home/alee/Sources/relicario.v0.9.0-dev-d -b feature/v0.9.0-dev-d-keyfile-core
cd /home/alee/Sources/relicario.v0.9.0-dev-d
pwd  # must print /home/alee/Sources/relicario.v0.9.0-dev-d
```

**ALL subsequent work happens in `/home/alee/Sources/relicario.v0.9.0-dev-d`.** Every subagent prompt MUST start with `cd /home/alee/Sources/relicario.v0.9.0-dev-d` (project memory; a header is not enough). Non-negotiable.

Today: 2026-06-25. Project rules in `CLAUDE.md` apply.

## Relay server

`localhost:7331`: `post_message(from, to, kind, body)` (your `from` is `"dev-d"`), `read_messages(for)`, `list_pending(for)`. Recipients: `pm, dev-a, dev-b, dev-c, dev-d, dev-e`. Poll `read_messages(for="dev-d")` before each task; post to `pm`. Single-line `body`.

**Fallback:**
```bash
cd /home/alee/Sources/relicario/tools/relay
python3 call.py post_message '{"from":"dev-d","to":"pm","kind":"status","body":"..."}'
python3 call.py read_messages '{"for":"dev-d"}'
```

## Relay polling cadence — MANDATORY (do NOT go head-down)

Poll `read_messages(for="dev-d")` before/after each subagent, before each commit, at task boundaries, whenever heads-down a few minutes. `HOLD`/`RESCOPE` is an interrupt — stop, ack, comply.

## Required reading (in order)

1. `CLAUDE.md` — project rules
2. `docs/superpowers/specs/2026-06-20-pluggable-second-factor-design.md` — spec (your scope is the **core/CLI/WASM only**, no extension UI)
3. `docs/superpowers/plans/2026-06-20-v0.9.0-keyfile-core-cli.md` — your plan, execute task by task

## Execution mode

**subagent-driven-development** (`superpowers:subagent-driven-development`): fresh subagent per task, two-stage review. Every subagent prompt MUST start with `cd /home/alee/Sources/relicario.v0.9.0-dev-d`. Poll between dispatches.

## Your scope and boundaries

**In scope (27 tasks):**
- Task 1: `SecondFactor` hint in `KdfParams` with back-compat (absent ⇒ image)
- Task 2: Key-file armor `relicario-keyfile-v1` encode/decode (`keyfile.rs`)
- Task 3: WASM bindings (`keyfile_encode`/`keyfile_decode`/`unlock_with_secret`) + master-key equivalence proof
- Task 4: CLI unlock branches on the params hint
- Task 5: CLI `init --key-file` generates the `.relkey` second factor

**Out of scope:** all extension/TypeScript work — wizard, SW, positioning docs (Dev-E); the org track (Dev-A/B/C). `## QUESTION TO PM` for out-of-scope trips.

**Hard rules:**
- **You are the foundation for Dev-E.** As soon as the WASM signatures are settled (`keyfile_encode`/`keyfile_decode`/`unlock_with_secret`) and the `params.json` contract (`second_factor: "image"|"keyfile"`, absent ⇒ image), POST IT to the PM via the relay so Dev-E can write failing tests against it — before you finish implementing. Update `extension/src/wasm.d.ts` with the TS declarations as part of your stream.
- The **equivalence proof** is mandatory: the master key derived via the key-file path must be byte-identical to the stego-image path for the same secret. Make it a test.
- The `.relkey` file holds the 256-bit secret **in the clear** — same threat model as the reference JPEG. Document this explicitly; do not imply it's encrypted.
- Confirm `KdfParams` ⟷ `params.json` is 1:1 before adding the hint (annotate the finding if it's wrapped). Grep the real `RelicarioError` variants before referencing error types. Locate the init command handler before editing it.
- CLI/extension parity is a design philosophy (`CLAUDE.md`) — your CLI surface must line up with what Dev-E exposes in the extension. Coordinate naming via the PM if in doubt.
- No merging to main (PM owns it). No `--force`/`reset --hard`/`branch -D`/`worktree remove` — ask first.

## Coordination protocol

Narrate. STATUS UPDATEs at task boundaries are the floor; emit `Status: IN-PROGRESS` at meaningful moments. `Notes` = WHAT + WHY, ≤3 sentences. Print locally AND post.

```
## STATUS UPDATE — DEV-D
Time: <iso8601>
Branch: feature/v0.9.0-dev-d-keyfile-core
Task: <number / short name>
Status: STARTED | IN-PROGRESS | DONE | BLOCKED | REVIEW-READY
Last commit: <short sha + first line>
Tests: <green | red (which) | N/A>
Notes: <≤3 sentences>
```

```
## QUESTION TO PM — DEV-D
Time: <iso8601>
Context: <task, decision point>
Options: <A / B / C>
Recommended: <pick + rationale>
Blocker: yes | no
```

## Ship-it autonomy + simplify discipline

`.claude/settings.json`: broad allow + narrow destructive deny. Move fast. Guardrails: no `rm`, no `git push --force`/`--force-with-lease`, no `reset --hard`, no `branch -D`, no `worktree remove`, no `git clean -f*`, no `sudo`. Before every REVIEW-READY: `superpowers:simplify` (fix or justify). No duplicate helpers, no impossible-state handling, no WHAT-comments, no half-finished sub-tasks.

## Authority within the plan

Task-to-task autonomy within plan/spec. Escalate for: scope questions, a test you can't green honestly, a discovered bug, anything destructive, before REVIEW-READY.

## Final steps before REVIEW-READY

```bash
cargo test -p relicario-core
cargo test -p relicario-wasm
cargo test -p relicario-cli --test keyfile_flows
cargo build -p relicario-wasm --target wasm32-unknown-unknown
cargo clippy --all-targets -- -D warnings
cargo test   # full workspace
```
Also confirm `extension/src/wasm.d.ts` type-checks: `cd /home/alee/Sources/relicario.v0.9.0-dev-d/extension && npm run build:all`.

Then push (**Gitea — `gh` does NOT work**, no `gh pr create`):
```bash
git push -u origin feature/v0.9.0-dev-d-keyfile-core
```
Post a `## STATUS UPDATE` with `Status: REVIEW-READY` + branch name. PM merges via `git merge --no-ff`.

## First action

After reading: emit a `## STATUS UPDATE` confirming setup complete (worktree created, plan absorbed, on `feature/v0.9.0-dev-d-keyfile-core`). You are cleared to start immediately — begin Task 1, and post the settled WASM + params contract to the PM as early as you can so Dev-E can build against it.
