# Dev A Kickoff Prompt — v0.9.0 Plan A (org foundation)

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

---

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

**Your stream: org foundation (SW + WASM).** Equip the extension service worker with the data layer to switch into an org vault, unwrap the org master key into a Zeroizing WASM handle, and serve a grant-filtered org manifest to the UI. **No UI components** — you build the data layer + the SW message contract that Dev-B (read UI) and Dev-C (write) consume. You are an **immediate-start foundation**: publish your message contract early so B and C can write failing tests against it.

A PM in another terminal coordinates you with four other senior devs. With the relay running, you communicate via `post_message` / `read_messages` directly. If the relay MCP tools aren't registered, use the 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-a-org-foundation   # ensure no collision; escalate if it exists
git worktree add /home/alee/Sources/relicario.v0.9.0-dev-a -b feature/v0.9.0-dev-a-org-foundation
cd /home/alee/Sources/relicario.v0.9.0-dev-a
pwd  # must print /home/alee/Sources/relicario.v0.9.0-dev-a
```

**ALL subsequent work happens in `/home/alee/Sources/relicario.v0.9.0-dev-a`.** Per project memory, every subagent prompt you dispatch MUST start with `cd /home/alee/Sources/relicario.v0.9.0-dev-a` before any other instruction — a "working directory:" header is NOT enough; subagents will otherwise commit to main. Non-negotiable.

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

## Relay server

A message-bus MCP server is running on `localhost:7331`:

- `post_message(from, to, kind, body)` — your `from` is always `"dev-a"`
- `read_messages(for)` — drain your inbox; call with `for="dev-a"` before each task
- `list_pending(for)` — cheap inbox-count check

Recipients: `pm, dev-a, dev-b, dev-c, dev-d, dev-e`. Before starting each task: `read_messages(for="dev-a")`. After any status/question: `post_message(from="dev-a", to="pm", kind="status"|"question", body="...")`. Keep `body` single-line (periods between sentences, ` -- ` for breaks).

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

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

Call `read_messages(for="dev-a")` (optionally `list_pending` first) **before dispatching each subagent and the moment it returns; before each commit; at the start + end of every task; any time you've been heads-down more than a few minutes.** An inbound `Action: HOLD`/`RESCOPE` is an **interrupt** — stop, ack with a STATUS UPDATE, comply before resuming.

## Required reading (in order)

1. `CLAUDE.md` — project rules
2. `docs/superpowers/specs/2026-06-20-extension-org-gui-design.md` — spec (your scope is the **SW + WASM foundation only**, no UI)
3. `docs/superpowers/plans/2026-06-20-v0.9.0-org-a-foundation.md` — your plan, execute task by task

## Execution mode

Use **subagent-driven-development**. Invoke `superpowers:subagent-driven-development`: fresh subagent per task, two-stage review between tasks. Every subagent prompt MUST start with:
```
cd /home/alee/Sources/relicario.v0.9.0-dev-a
```
Between every subagent dispatch, poll the relay.

## Your scope and boundaries

**In scope (36 tasks):**
- Task 1: ECIES unwrap of the org key into a Zeroizing WASM session handle
- Task 2: `ManifestEntry.collection` field support (check if it already exists first)
- Task 3: Multi-context session management (personal + org contexts)
- Task 4: Org config storage + listing
- Task 5: Org vault read operations
- Task 6: `org_switch` context switch + reads

**Out of scope:** all UI components (Dev-B owns the popup/vault read UI); all write operations (Dev-C owns add/update/delete + signed commits); the keyfile track (Dev-D/E). If you trip over an out-of-scope issue, file a `## QUESTION TO PM` block and keep moving.

**Hard rules:**
- **You are the foundation.** As soon as the SW message contract is settled (message names + payload shapes for `org_list_configs`, `org_switch {context}`, `org_list_items`, `org_get_item {id}`, `org_list_collections`), POST IT to the PM via the relay so Dev-B and Dev-C can write failing tests against it — before you finish implementing.
- Org master key must **never** be written to `localStorage`, `IndexedDB`, or any persistent store — only the Zeroizing WASM session. Lock/timer must zero ALL contexts.
- Three-place message rule: every new SW message needs all three — `PopupMessage` union + `POPUP_ONLY_TYPES` + handler arm — or it's silently rejected.
- Task 3 (multi-context session) touches the SW's most security-sensitive module; preserve and test the lock/timer-zeroes-all invariant.
- Do not merge your branch to main. The PM owns merges. No `--force`, no `git reset --hard`, no `git worktree remove` — ask first.

## Coordination protocol

The user's only window into your work is this terminal + the relay. **Narrate.** STATUS UPDATEs at task boundaries are the floor; also emit `Status: IN-PROGRESS` when you dispatch a subagent, when one returns a decision worth flagging, when a sub-task completes, when you change direction. `Notes` says WHAT + WHY in ≤3 sentences. Print every STATUS UPDATE locally AND post it.

```
## STATUS UPDATE — DEV-A
Time: <iso8601>
Branch: feature/v0.9.0-dev-a-org-foundation
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-A
Time: <iso8601>
Context: <task, decision point>
Options: <A / B / C>
Recommended: <pick + one-sentence rationale>
Blocker: yes | no
```

## Ship-it autonomy + simplify discipline

`.claude/settings.json` grants broad allow + narrow destructive deny — write/run/commit/push without prompts; move fast. **Guardrails:** no `rm`/`rmdir`, no `git push --force`/`--force-with-lease`, no `git reset --hard`, no `git branch -D`, no `git worktree remove`, no `git clean -f*`, no `sudo`. Surface a `## QUESTION TO PM` if you need one.

Before every REVIEW-READY: invoke `superpowers:simplify` on the changed code (accept findings + fix in the same commit, or justify in one sentence). No duplicate helpers, no defensive handling for impossible states, no comments explaining WHAT well-named code says, no half-finished sub-tasks.

## Authority within the plan

Task-to-task autonomy, implementation decisions consistent with plan/spec, tests/refactors/bugfixes you introduce, pushes to your feature branch. **Escalate** for: scope questions outside the plan, a test you can't green after honest debugging, a discovered bug not in your plan, anything destructive, before REVIEW-READY.

## Final steps before REVIEW-READY

Run full validation:
```bash
cargo test -p relicario-wasm org_unwrap_key
cargo test -p relicario-core manifest
cargo build -p relicario-wasm --target wasm32-unknown-unknown
cargo clippy --all-targets -- -D warnings
cd /home/alee/Sources/relicario.v0.9.0-dev-a/extension && npx vitest run src/service-worker/ && npm run build:all
```

Then push (this repo is **Gitea — `gh` does NOT work**; do not run `gh pr create`):
```bash
git push -u origin feature/v0.9.0-dev-a-org-foundation
```
Post a `## STATUS UPDATE` with `Status: REVIEW-READY` and the branch name. The PM reviews `git diff main...origin/<branch>` and merges via `git merge --no-ff`. (If a PR is wanted for visibility, the PM opens it with `tea` from the main repo dir — not your concern.)

## First action

After reading: emit a `## STATUS UPDATE` confirming setup complete (worktree created, plan absorbed, on `feature/v0.9.0-dev-a-org-foundation`). You are cleared to start immediately — begin Task 1, and post the settled message contract to the PM as early as you can.
