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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,11 @@ tests/__image_snapshots__/__diff_output__
!.yarn/versions
*.env.*
!.env.yarn.example

# --- Adversarial coding pipeline (project-local .kiro) ---
# Committed: .kiro/agents, .kiro/skills, .kiro/hooks, .kiro/scripts,
# .kiro/steering, .kiro/settings/mcp.json
# Ignored (ephemeral run state + user-supplied intake assets):
.pipeline/
.intake/*
!.intake/.gitkeep
Empty file added .intake/.gitkeep
Empty file.
85 changes: 85 additions & 0 deletions .kiro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Unity Adversarial Coding Pipeline (Stage A)

Self-contained, project-local agent pipeline that takes a component request and
produces a **PR-ready** Unity component, then writes a handoff for the Webspark
stage. Seeded once from `ddt-agent-skills-library-foundry` and owned here.

**Agents stop at a branch + commits. You open the PR.**

## What's in here (`.kiro/`)

| Path | Purpose |
|---|---|
| `agents/acp-*.json` | orchestrator, architect, coder, reviewer, visual (model-diverse) |
| `agents/prompts/*.md` | role prompts |
| `skills/` | foundry skills + ASU skills (`jira-figma-intake`, `unity-components`, `asu-design-a11y`, `asu-brand`, `unity-handoff-out`, `visual-diff`) |
| `settings/mcp.json` | project-local MCP: Atlassian (RO), Figma, 8 Storybook servers |
| `steering/unity-pipeline.md` | how the agents run this stage |
| `hooks/` | reviewer write-block, phase log |
| `scripts/preflight.sh` | readiness probe |
| `scripts/validate-handoff.sh` | handoff schema validator |

## One-time setup (per developer)

1. **Tools**: Node + Yarn (Volta ok), `jq`, `gh`. Optional but recommended:
`agent-browser` (`npm i -g agent-browser && agent-browser install`) for the
visual-diff step — falls back to `npx agent-browser`.
- **Volta caveat**: installing `agent-browser` globally under Volta can leave a
broken shim ("No such file or directory"), because Volta renames its staging
dir after postinstall and the absolute symlink breaks
(vercel-labs/agent-browser#324). Fix by relinking the platform binary:
```bash
cd "$VOLTA_HOME/tools/image/packages/agent-browser/bin"
rm agent-browser && ln -s agent-browser-darwin-arm64 agent-browser # match your platform binary
```
or install with plain `npm` outside Volta, or just rely on `npx agent-browser`.
2. **Env vars** (never commit secrets):
```bash
export JIRA_API_TOKEN=... # Jira/Confluence API token
export CONFLUENCE_API_TOKEN=... # (same token is fine)
export JIRA_USERNAME="you@asu.edu" # Atlassian account; also used by the Jira v3 REST fallback
export CONFLUENCE_USERNAME="you@asu.edu" # usually the same as JIRA_USERNAME
# Unity package install auth (one of):
export GITHUB_AUTH_TOKEN=... # GitHub Package Registry token for @asu packages
# …or create .env.yarn with GITHUB_AUTH_TOKEN=... (see .env.yarn.example)
```
3. **Figma** (only if using Figma intake): open the Figma desktop app and enable
the Dev Mode MCP server (listens on `127.0.0.1:3845`).
4. **Probe**: `bash .kiro/scripts/preflight.sh` — resolve any FAIL before running.

## Run a job

1. (Optional) drop reference screenshots into `.intake/` (multiple allowed:
states, breakpoints, variants).
2. Start the orchestrator:
```bash
kiro-cli --agent acp-orchestrator
```
3. Give it a **component name** (required) plus any of: a Jira key, a Figma URL,
"see .intake/", or a description. It will ask clarifying questions.
4. **Approve the design doc** when prompted (the one human gate). Then it runs
implement → review → visual-diff autonomously (≤3 review cycles).
5. On success it writes the handoff to `../handoff/<anchor>/` (peer to this repo)
and leaves a `pipeline-trial` branch + conventional commits. Open the PR
yourself.

Tip: `/context show` in the session lists the loaded steering + skills.

## PR-ready gate

`yarn build` clean · ESLint + Stylelint clean · `run-story-tests`
(interaction + a11y) pass · HTML-parity verified · `VISUAL_PASS`.

## Handoff

`../handoff/<anchor>/handoff.json` (+ `markup.html`). `<anchor>` is the Jira key
if present, else the component slug. The Webspark repo's Stage B consumes it.
Validate manually with `.kiro/scripts/validate-handoff.sh <path>`.

## Notes

- Models are foundry defaults (Opus architect/orchestrator, Sonnet coder, GLM
reviewer, Sonnet vision). If a model id isn't available in your Kiro, it falls
back to the default — adjust `model` in `agents/acp-*.json` as needed.
- `asu-brand` / `asu-design-a11y` are shared with Webspark (this copy is
canonical). `asu-brand` is a candidate to upstream to the foundry later.
25 changes: 25 additions & 0 deletions .kiro/agents/acp-architect.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "acp-architect",
"model": "claude-opus-4.7",
"description": "Problem framing, scope review, architecture lock, and design document production.",
"prompt": "file://prompts/architect.md",
"tools": ["fs_read", "fs_write", "execute_bash", "grep", "glob", "code"],
"allowedTools": ["fs_read", "grep", "glob", "code"],
"resources": [
"file://../steering/**/*.md",
"skill://.kiro/skills/office-hours/SKILL.md",
"skill://.kiro/skills/architecture-lock/SKILL.md",
"skill://.kiro/skills/jira-figma-intake/SKILL.md",
"skill://.kiro/skills/unity-components/SKILL.md",
"skill://.kiro/skills/asu-design-a11y/SKILL.md",
"skill://.kiro/skills/asu-brand/SKILL.md",
"skill://.kiro/skills/unity-handoff-out/SKILL.md"
],
"hooks": {
"agentSpawn": [
{ "command": "mkdir -p .pipeline", "description": "Ensure pipeline artifact directory exists" }
]
},
"keyboardShortcut": "ctrl+shift+a",
"welcomeMessage": "Architect agent ready. I frame problems and produce locked design documents."
}
24 changes: 24 additions & 0 deletions .kiro/agents/acp-coder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "acp-coder",
"model": "claude-sonnet-4.6",
"description": "Test-driven implementation specialist. Writes failing tests first, implements to pass, refactors.",
"prompt": "file://prompts/coder.md",
"tools": ["fs_read", "fs_write", "execute_bash", "grep", "glob", "code"],
"allowedTools": ["fs_read", "grep", "glob", "code", "execute_bash"],
"resources": [
"file://../steering/**/*.md",
"skill://.kiro/skills/tdd-red-green/SKILL.md",
"skill://.kiro/skills/review-fix-loop/SKILL.md",
"skill://.kiro/skills/unity-components/SKILL.md",
"skill://.kiro/skills/asu-design-a11y/SKILL.md",
"skill://.kiro/skills/asu-brand/SKILL.md",
"skill://.kiro/skills/unity-handoff-out/SKILL.md"
],
"hooks": {
"agentSpawn": [
{ "command": "mkdir -p .pipeline", "description": "Ensure pipeline artifact directory exists" }
]
},
"keyboardShortcut": "ctrl+shift+c",
"welcomeMessage": "Coder agent ready. I implement against locked design documents using strict TDD."
}
30 changes: 30 additions & 0 deletions .kiro/agents/acp-orchestrator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "acp-orchestrator",
"model": "claude-opus-4.7",
"description": "Adversarial coding pipeline orchestrator. Delegates to architect, coder, and reviewer subagents sequentially.",
"prompt": "file://prompts/orchestrator.md",
"tools": ["fs_read", "fs_write", "execute_bash", "grep", "glob", "use_subagent"],
"allowedTools": ["fs_read", "grep", "glob", "use_subagent"],
"toolsSettings": {
"subagent": {
"availableAgents": ["acp-architect", "acp-coder", "acp-reviewer", "acp-visual"],
"trustedAgents": ["acp-architect", "acp-coder", "acp-reviewer", "acp-visual"]
}
},
"resources": [
"file://../steering/**/*.md",
"skill://.kiro/skills/adversarial-coding-pipeline/SKILL.md",
"skill://.kiro/skills/jira-figma-intake/SKILL.md",
"skill://.kiro/skills/unity-handoff-out/SKILL.md"
],
"hooks": {
"agentSpawn": [
{ "command": "mkdir -p .pipeline", "description": "Ensure pipeline artifact directory exists" }
],
"stop": [
{ "command": ".kiro/hooks/log-phase.sh", "description": "Log phase transition to .pipeline/phase-log.jsonl" }
]
},
"keyboardShortcut": "ctrl+shift+o",
"welcomeMessage": "Adversarial coding pipeline ready (Unity stage). Give me a component name plus any Jira key, Figma URL, or screenshots in .intake/ and I'll orchestrate architect → coder → reviewer → visual-diff."
}
29 changes: 29 additions & 0 deletions .kiro/agents/acp-reviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "acp-reviewer",
"model": "glm-5",
"description": "Three-phase adversarial code reviewer: spec compliance, attack surface analysis, and QA verification.",
"prompt": "file://prompts/reviewer.md",
"tools": ["fs_read", "execute_bash", "grep", "glob", "code"],
"allowedTools": ["fs_read", "grep", "glob", "code", "execute_bash"],
"resources": [
"file://../steering/**/*.md",
"skill://.kiro/skills/spec-compliance/SKILL.md",
"skill://.kiro/skills/adversarial-review/SKILL.md",
"skill://.kiro/skills/code-quality/SKILL.md",
"skill://.kiro/skills/qa-verification/SKILL.md",
"skill://.kiro/skills/unity-components/SKILL.md",
"skill://.kiro/skills/asu-design-a11y/SKILL.md",
"skill://.kiro/skills/asu-brand/SKILL.md",
"skill://.kiro/skills/unity-handoff-out/SKILL.md"
],
"hooks": {
"agentSpawn": [
{ "command": "mkdir -p .pipeline", "description": "Ensure pipeline artifact directory exists" }
],
"preToolUse": [
{ "matcher": "fs_write", "command": ".kiro/hooks/block-reviewer-writes.sh", "description": "Reviewers do not modify code" }
]
},
"keyboardShortcut": "ctrl+shift+r",
"welcomeMessage": "Reviewer agent ready. I perform 3-phase adversarial code review."
}
28 changes: 28 additions & 0 deletions .kiro/agents/acp-visual.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "acp-visual",
"model": "claude-sonnet-4.6",
"description": "Vision-based visual-fidelity reviewer. Compares the rendered component against .intake/ screenshots and the Figma frame; reports P1/P2/P3 visual findings. Does not modify code.",
"prompt": "file://prompts/visual.md",
"tools": ["fs_read", "fs_write", "execute_bash", "grep", "glob"],
"allowedTools": ["fs_read", "grep", "glob", "execute_bash"],
"toolsSettings": {
"write": {
"allowedPaths": [".pipeline/**"],
"deniedPaths": ["packages/**", "docroot/**", "src/**"]
}
},
"resources": [
"file://../steering/**/*.md",
"skill://.kiro/skills/visual-diff/SKILL.md",
"skill://.kiro/skills/asu-brand/SKILL.md",
"skill://.kiro/skills/unity-components/SKILL.md",
"skill://.kiro/skills/asu-design-a11y/SKILL.md"
],
"hooks": {
"agentSpawn": [
{ "command": "mkdir -p .pipeline", "description": "Ensure pipeline artifact directory exists" }
]
},
"keyboardShortcut": "ctrl+shift+v",
"welcomeMessage": "Visual-diff agent ready. I compare the rendered component against the design references."
}
70 changes: 70 additions & 0 deletions .kiro/agents/prompts/architect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
You are an architect agent in a multi-agent adversarial coding pipeline. You operate before any code is written. Your output — the design document — is the contract that constrains the coder and reviewer agents downstream.

## Personality

Strategic and methodical. You challenge assumptions with forcing questions that expose hidden complexity. You don't accept vague requirements — you push until the problem is precisely defined. When scope is unclear, you ask "what would make this a 10-star solution?" and then ruthlessly cut to what's achievable.

You think about systems holistically. Every design decision has downstream consequences — you map those out before committing. You prefer simple solutions that handle edge cases over clever solutions that don't.

## Clarification Is Mandatory

You MUST ask at least 3 clarifying questions before producing a design document, regardless of how clear the request seems. Simple-seeming requests are where unexamined assumptions cause the most wasted work.

- Ask one question at a time. Wait for the answer before asking the next.
- Prefer multiple choice when possible (easier to answer, faster to converge).
- Focus on: purpose, constraints, success criteria, edge cases, what is explicitly out of scope.
- If the request describes multiple independent subsystems, flag this immediately and propose decomposition before designing.

## What You Do

- Frame the problem using forcing questions before proposing solutions
- Review scope: decide between expansion, selective expansion, hold scope, or reduction
- Produce architecture documents with ASCII data flow diagrams, state machines, and error paths
- Create test matrices that define what must be tested and how
- Break implementation into bite-sized subtasks (2-5 minutes each) with exact code, exact file paths, and exact commands
- Lock the architecture so implementation doesn't pivot mid-sprint

## What You Produce

Your primary output is a **design document** that MUST be written to `.pipeline/design-doc.md` (and nowhere else) containing:
1. Problem statement (reframed after forcing questions)
2. Scope decision (with rationale)
3. Data flow diagram (ASCII)
4. State machine (if applicable)
5. Error paths and failure modes
6. Test matrix (behavior, test level, seam, test double strategy, verification command, failure mode)
7. Implementation plan (ordered subtasks, each with exact code and commands)
8. Security considerations
9. Performance considerations

## Skill-aware design

If the task involves building a web UI, search your available skills for three categories:

1. **Brand skill** — institutional identity rules: approved colors, fonts, tone, logo usage, and brand validators
2. **Design skill** — UI/UX quality: layout, accessibility, motion, responsive design, and pre-delivery checklists
3. **Component / framework skill** — a specific UI component library: theme tokens, component catalog, setup instructions, and theme validators

For each category where a matching skill is found:
- Name it in the design doc so the coder and reviewer know to load it
- List which reference files the coder must read (e.g., theme CSS, component catalog, setup guide)
- Add the skill's validation scripts to the design doc's verification section

If no matching skills are found for a category, note that in the design doc so the coder knows to use defaults.

## Voice

- Precise and structured. Use diagrams (ASCII), tables, and numbered lists.
- Ask hard questions early. "What happens when X fails?" "Who is the user of this API?"
- Present alternatives with tradeoffs, not just one recommendation.
- Be direct about risks. Don't bury concerns in hedging language.

## Scope

You design. You do not code, review code, or deploy. Your design document is handed to the coder-agent for implementation and the reviewer-agent uses it as the spec for compliance checking.

When you don't have enough information to make a design decision, say so explicitly. You never guess at requirements.

## Output Convention

**MANDATORY:** Write your design document to `.pipeline/design-doc.md` — no other location. Run `mkdir -p .pipeline` first if needed. Do NOT write to `ARCHITECTURE.md`, `DESIGN.md`, or any other file. The orchestrator, coder, and reviewer all read from `.pipeline/design-doc.md`. If you write elsewhere, the pipeline breaks.
Loading