Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions src/data/agent-contracts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# WDS Agent Contracts

Defines what each agent owns, what they explicitly do not own, and how they hand off to each other.
All agents load this file at activation. These rules are non-negotiable.

---

## Domain Boundaries

| Agent | Owns | Does NOT own |
|-------|------|--------------|
| **Saga** | Phases 0–2: Alignment, Product Brief, Trigger Mapping | Any design work. Any code. Scenarios (Phase 3+). |
| **Freya** | Phases 3–4: UX Scenarios, UX Design. Phases 6–7: Asset Generation, Design System. | Discovery (Phases 1–2). Any code. PRDs. |
| **Mimir** | Phase 5: Tech Audit, PRD, Build. Phase 8: Product Evolution. | Discovery. Design. Writing specs without a Work Order. |

**If a user asks an agent to do work outside its domain:** name the right agent and offer to hand off. Never attempt the work yourself.

---

## Prerequisites

Each agent requires the following before starting core work:

| Agent | Required | Blocks |
|-------|----------|--------|
| Saga | Nothing | — |
| Freya | `A-Product-Brief/product-brief.md` + `B-Trigger-Map/00-trigger-map.md` | Cannot design without strategic foundation |
| Mimir | At least one Work Order from Freya | Cannot build without a WO. Cannot PRD without a WO. |
| Mimir (existing codebase) | `E-Development/000-tech-audit.md` | Cannot PRD without knowing the codebase |

---

## Handoff Rules

**Saga → Freya**
Trigger: Product Brief and Trigger Map are complete and aligned.
Action: Saga runs `/wrap freya`. Freya picks up with `/freya progress/freya.md`.
Never: Saga does not write scenarios or design anything before handing off.

**Freya → Mimir**
Trigger: Work Order written, page spec complete, ready for implementation.
Action: Freya runs `/wrap mimir` or `/handoff mimir`. Mimir picks up the Work Order.
Never: Freya does not write code. Freya does not write PRDs.

**Mimir → Freya**
Trigger: Implementation complete, browser-verified. Or: blocked on design decision.
Action: Mimir runs `/handoff freya` with the specific question or completion note.
Never: Mimir does not modify specs or Work Orders. He implements what they say.

---

## Quality Rules (all agents)

- **One task at a time.** Complete and verify before moving on.
- **No plausible-looking wrong output.** If you cannot follow the template exactly, stop and say so. Wrong-but-plausible output breaks every downstream phase.
- **Read the template before writing.** Every artifact has a template. Load it, follow it.
- **Decisions are documented.** Any deviation from a template or unexpected choice goes in the design log.

---

## Out-of-Scope (explicit)

Things no WDS agent does, ever:

- Produce output in a custom format when a WDS template exists
- Write to `progress/` without going through the memory tool
- Commit without a meaningful message (conventional commits required)
- Force push, skip hooks, or bypass git safety
- Start a new phase without the prerequisite documents
- Write code without a PRD (Mimir only)
- Mark a requirement done without browser verification (Mimir only)
- Design without a Trigger Map (Freya only)
39 changes: 39 additions & 0 deletions src/data/shared-activation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# WDS Shared Activation Steps

Common startup sequence for all WDS agents (Saga, Freya, Mimir).
Each agent's SKILL.md references this file instead of repeating these steps.

---

## Step: state

Check for session state via the memory tool.
Read `~/.claude/wds/src/tools/memory/SKILL.md` and follow the `load` operation for the current agent_id.

@augmentcode augmentcode Bot May 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In src/data/shared-activation.md line 11, the docs hardcode an absolute ~/.claude/... path to the memory SKILL, which is likely to break on Windows or any install that places the module elsewhere. Can we confirm this path is guaranteed in all supported setups (including NPX/manual installs)?

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

If state found: show resume prompt. Wait for user response before continuing.

---

## Step: scan

Scan workspace for WDS projects:
- Find repos with `_progress/wds-project-outline.yaml` or `_progress/00-design-log.md`
- Skip system repos (bmad-method-wds-expansion, whiteport-design-studio)
- For each project: read design log, note phase status and in-progress work
- Also check current directory for design process folders (A-Product-Brief/ through E-Development/) and any context documents at repo root

---

## Step: select

IF multiple projects found with open work:
List them, ask which to work on.
IF single project:
Continue to agent-specific activation.

---

## Step: brownfield-detect

Check if the project has a codebase (src/, backend/, storefront/, app/, or similar code folders at repo root).
IF codebase found → go to agent-specific brownfield handling.
IF no codebase → continue to agent-specific greenfield flow.
98 changes: 98 additions & 0 deletions src/data/wds-glossary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# WDS Glossary

Locked terminology for all WDS agents. One definition per term — no synonyms, no aliases.
Agents load this file once at activation. Do not redefine these terms locally.

---

## Phases

| Phase | Name | Owner |
|-------|------|-------|
| 0 | Alignment & Signoff | Saga |
| 1 | Product Brief | Saga |
| 2 | Trigger Mapping | Saga |
| 3 | UX Scenarios | Freya |
| 4 | UX Design | Freya |
| 5 | Agentic Development | Mimir |
| 6 | Asset Generation | Freya |
| 7 | Design System | Freya |
| 8 | Product Evolution | Mimir |

---

## Output Folder Structure

```
{output_folder}/
├── A-Product-Brief/ Phase 1 — strategic foundation
├── B-Trigger-Map/ Phase 2 — user research & personas
├── C-UX-Scenarios/ Phase 3 — journey flows
├── D-UX-Design/ Phase 4 — page specifications & design assets
└── E-Development/ Phase 5 — technical requirements, work orders, code
```

Progress files (machine-local, not committed):
```
progress/
├── [agent].md Session state per agent
└── project-index.md Living artifact index, updated on wrap
```

---

## Artifacts

### Strategy (Phase 1)
- **Product Brief** — `A-Product-Brief/product-brief.md`. Strategic foundation: vision, goals, constraints, target users. Required before any design work.
- **Content Language** — `A-Product-Brief/content-language.md`. Tone, vocabulary, brand voice.
- **Visual Direction** — `A-Product-Brief/visual-direction.md`. Aesthetic references, colour, typography intent.

### Research (Phase 2)
- **Trigger Map** — `B-Trigger-Map/00-trigger-map.md`. User psychology mapped to business goals. Required before UX Scenarios.
- **Business Goals** — `B-Trigger-Map/01-business-goals.md`. Measurable outcomes, KPIs.
- **Persona** — `B-Trigger-Map/NN-persona-[firstname]-the-[archetype].md`. Alliterative names required (e.g. Harriet the Hairdresser).
- **Feature Impact** — `B-Trigger-Map/feature-impact.md`. Feature × persona × trigger mapping.

### Design (Phases 3–4)
- **UX Scenarios** — `C-UX-Scenarios/00-ux-scenarios.md`. User journey flows derived from Trigger Map.
- **Page Spec** — `D-UX-Design/[page-name].md`. Per-page specification: layout, content, interactions, acceptance criteria.
- **Design Tokens** — Extracted progressively during Phase 4, not upfront.

### Development (Phase 5)
- **Tech Audit** — `E-Development/000-tech-audit.md`. Living architecture document. Required before any PRD on an existing codebase.
- **Master PRD** — `E-Development/000-PRD.md`. Platform requirements, written once, updated as project evolves.
- **Feature PRD** — `E-Development/NNN-[feature].xml`. One per Work Order.
- **Change Order** — `E-Development/NNN-NN-[slug].xml`. Feedback/change against a parent PRD.
- **Work Order** — `E-Development/WO-NNN-[slug].md`. Task written by Freya for Mimir. Contains: objective, scope, files, acceptance criteria.
- **Mimir Brief** — Narrative handoff document from Freya to Mimir when handing off design work.

### Progress (machine-local)
- **Design Log** — `_progress/00-design-log.md`. Project-wide progress, updated each session.
- **Project Outline** — `_progress/wds-project-outline.yaml`. Phase status, project metadata.
- **Session State** — `progress/[agent].md`. Agent-specific session state. Loaded by `/start`, written by `/wrap`.
- **Project Index** — `progress/project-index.md`. Living index of all artifacts, updated by `/wrap`.

---

## Patterns

- **Design Loop** — Freya's per-page cycle: discuss → spec → wireframe → approve → iterate → update spec → implement → browser review → extract tokens.
- **Dream Up Mode** — Three modes for artifact generation: Dialog (collaborative), Suggest (agent proposes), Dream (agent generates fully). Selected at session start.
- **Brownfield** — Project with an existing codebase. Triggers gap-map assessment before new work begins.
- **Greenfield** — Project with no existing codebase. Follows standard phase progression.
- **Gap Map** — Freya's cross-reference of what is designed vs what is built vs what has a Work Order.

---

## Model Selection

| Task type | Model |
|-----------|-------|
| Any code, build, deploy, implement | Opus |
| High-stakes / production / compliance | Opus |
| Long or complex multi-step tasks | Opus |
| Strategy, spec, dialog, UX, analysis | Sonnet |
| Simple, low-stakes, short | Haiku |

Default: lightest model that fits. Prefix Next actions with `MODEL:[Haiku|Sonnet|Opus]`.
63 changes: 27 additions & 36 deletions src/skills/handoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Pass a specific piece of work to another WDS agent. This is NOT a session wrap
**Usage:** `/handoff [target-agent]`
**Example:** `/handoff mimir`

> **Handoffs go through Agent Space — never as files on disk.**
> Agent Space is the single source of truth for cross-agent communication. If it's not available, fix connectivity — do not fall back to writing files.

---

<handoff-steps>
Expand All @@ -16,7 +13,7 @@ Pass a specific piece of work to another WDS agent. This is NOT a session wrap
- Derive everything from the conversation. Do NOT ask questions.
- Do NOT summarize this session. That is a wrap, not a handoff.
- Focus only on what the receiving agent needs to start the specific task immediately.
- The sub-agent handles Agent Space delivery. You only compile and show.
- Handoff is written to `progress/[target_agent].md` — the receiving agent picks it up via `/start`.
</constraints>

<step id="1-compile">
Expand Down Expand Up @@ -52,49 +49,43 @@ Pass a specific piece of work to another WDS agent. This is NOT a session wrap
Then proceed immediately to step 3.
</step>

<step id="3-subagent">
<step id="3-write">
Spawn a sub-agent with this exact prompt — substitute the bracketed values:

---
You are a delivery agent. Your only job is to post a handoff to Agent Space and return the token.

Send this request:

```bash
curl -s -X POST "https://uztngidbpduyodrabokm.supabase.co/functions/v1/agent-messages" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV6dG5naWRicGR1eW9kcmFib2ttIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzI1MTc3ODksImV4cCI6MjA4ODA5Mzc4OX0.FNnTd5p9Qj3WeD0DxQORmNf2jgaVSZ6FU1EGy0W7MRo" \
-H "Content-Type: application/json" \
-d '{
"action": "send",
"from_agent": "[from_agent]",
"to_agent": "[target_agent]",
"project": "[project]",
"message_type": "handoff",
"title": "[one-line task description]",
"content": "[full handoff content — escaped for JSON]"
}'
You are a handoff writer. Your only job is to save a handoff file via the memory tool.

**Step A — Save handoff via memory tool:**
Read `~/.claude/wds/src/tools/memory/SKILL.md` and follow the `save` operation:
- agent_id: [target_agent]
- data:
```
## Wrapped
[current date and time]

If the call succeeds: extract the `id` field. Return ONLY the first 6 characters. Nothing else.
If the call fails or returns an error: return ONLY: FAILED: [error message or HTTP status]
---
## Context
[task content from step 1]

Wait for the sub-agent response.
## Next
[next line from step 1]

**If sub-agent returns 6 characters:** print EXACTLY this — nothing before, nothing after:
```
/[target_agent] [6chars]
```
## Learned
None

**If sub-agent returns FAILED:** stop and warn the user:
## Spec Sync
None
```
⚠️ Agent Space unreachable — handoff not sent.
Check that Agent Space credentials are active (open Bitwarden → verify Agent Space API key).

Handoff content (copy if needed):
[full handoff content]
**Step B — Confirm:**
Return ONLY: `done`
---

Wait for the sub-agent to return. Then print EXACTLY this — nothing before, nothing after:
```
Do NOT write the handoff to a file on disk.
/[target_agent] progress/[target_agent].md
```

Session continues.
</step>

</handoff-steps>
12 changes: 1 addition & 11 deletions src/skills/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,9 @@ Loads project state and session context. Always reads the project index first
If found: parse Phase Status and Artifacts sections. Hold this as project context — it informs everything below.
If not found: proceed silently. The index will be built on first wrap.

**Additionally (Agent Space):** query Agent Space for recent project knowledge:
```bash
curl -s -X POST "https://uztngidbpduyodrabokm.supabase.co/functions/v1/agent-messages" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV6dG5naWRicGR1eW9kcmFib2ttIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzI1MTc3ODksImV4cCI6MjA4ODA5Mzc4OX0.FNnTd5p9Qj3WeD0DxQORmNf2jgaVSZ6FU1EGy0W7MRo" \
-H "Content-Type: application/json" \
-d '{"action": "list", "to_agent": "[agent_id]", "project": "[project]", "limit": 5}'
```
If Agent Space returns recent messages: use them to supplement the project index. If unavailable: proceed with the file index only — do not block on this.

### 2. Detect Session State

Read `_wds/tools/memory/SKILL.md` and follow the `load` operation for the current agent_id.
Read `~/.claude/wds/src/tools/memory/SKILL.md` and follow the `load` operation for the current agent_id.

**Fallback chain:** state found → show resume prompt → fresh start

Expand Down Expand Up @@ -104,6 +95,5 @@ Do not mention /start or the absence of a state file.
## Notes

- Always read `progress/project-index.md` — never skip it. It is the project's memory.
- Agent Space supplements the index but never replaces it. File is authoritative.
- The state file lives at `progress/[agent].md` relative to the project root.
- On resume, get back to work quickly. The user knows the context.
Loading
Loading