cortex-agents 4.0.4 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/agents/architect.md +22 -13
- package/.opencode/agents/coder.md +1 -1
- package/.opencode/agents/fix.md +1 -1
- package/.opencode/agents/implement.md +16 -13
- package/.opencode/skills/ui-design/SKILL.md +176 -0
- package/README.md +13 -1
- package/package.json +1 -1
|
@@ -126,24 +126,33 @@ Use `plan_save` with:
|
|
|
126
126
|
|
|
127
127
|
**If plan_commit fails** (e.g., nothing to stage), inform the user.
|
|
128
128
|
|
|
129
|
-
### Step 5: Handoff to Implementation
|
|
130
|
-
|
|
129
|
+
### Step 5: Handoff to Implementation (MUST ASK — NEVER skip)
|
|
130
|
+
|
|
131
|
+
**CRITICAL: You MUST use the question tool to ask the user before creating any branch or worktree. NEVER call `branch_create` or `worktree_create` without explicit user selection. Do NOT assume a choice — always present the options and WAIT for the user's response.**
|
|
132
|
+
|
|
133
|
+
After committing the plan, use the **question tool** with these exact options:
|
|
131
134
|
|
|
132
135
|
"Plan committed. Suggested branch: `{suggestedBranch}`. How would you like to proceed?"
|
|
133
136
|
|
|
134
|
-
1. **Create a worktree (Recommended)** —
|
|
135
|
-
2. **
|
|
137
|
+
1. **Create a worktree (Recommended)** — Isolated copy in `.worktrees/` for parallel development. This is the safest option.
|
|
138
|
+
2. **Create a branch** — Create and switch to `{suggestedBranch}` in this repo
|
|
136
139
|
3. **Stay in Architect mode** — Continue planning or refine the plan
|
|
137
140
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
141
|
+
**Only after the user selects an option**, execute the corresponding action:
|
|
142
|
+
|
|
143
|
+
- **User chose "Create a worktree"**:
|
|
144
|
+
- Use `worktree_create` with `name` derived from the suggested branch slug and `type` from the plan type
|
|
145
|
+
- Report the worktree path so the user can navigate to it
|
|
146
|
+
- Suggest: "Navigate to the worktree and run OpenCode with the Implement agent to begin implementation"
|
|
147
|
+
|
|
148
|
+
- **User chose "Create a branch"**:
|
|
149
|
+
- Use `branch_create` with the suggested branch name (type and name from the plan)
|
|
150
|
+
- This creates and switches to the new branch
|
|
151
|
+
- Then switch to the Implement agent
|
|
142
152
|
|
|
143
|
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
- Then switch to the Implement agent
|
|
153
|
+
- **User chose "Stay in Architect mode"**:
|
|
154
|
+
- Do NOT create any branch or worktree
|
|
155
|
+
- Continue in the current session for further planning
|
|
147
156
|
|
|
148
157
|
### Step 6: Provide Handoff Context
|
|
149
158
|
If user chooses to switch agents, provide:
|
|
@@ -178,7 +187,7 @@ Before creating a plan, load relevant skills to inform your analysis. Use the `s
|
|
|
178
187
|
| Security requirements, threat models | `security-hardening` |
|
|
179
188
|
| CI/CD pipeline design, deployment strategy | `deployment-automation` |
|
|
180
189
|
| Frontend architecture, component design | `frontend-development` |
|
|
181
|
-
| UI design, visual design, page layouts | `ui-design` |
|
|
190
|
+
| UI design, visual design, page layouts | `ui-design` (**must check `.cortex/design-spec.md` first** — create if missing) |
|
|
182
191
|
| Backend service design, middleware, auth | `backend-development` |
|
|
183
192
|
| Mobile app architecture | `mobile-development` |
|
|
184
193
|
| Desktop app architecture | `desktop-development` |
|
|
@@ -22,7 +22,7 @@ You are a fullstack developer. You implement complete features spanning frontend
|
|
|
22
22
|
| Layer | Skill to Load |
|
|
23
23
|
|-------|--------------|
|
|
24
24
|
| Frontend (React, Vue, Svelte, Angular, etc.) | `frontend-development` |
|
|
25
|
-
| UI/visual design (new pages, layouts, polish) | `ui-design` |
|
|
25
|
+
| UI/visual design (new pages, layouts, polish) | `ui-design` (**must check `.cortex/design-spec.md` first** — create if missing) |
|
|
26
26
|
| Backend (Express, Fastify, Django, Go, etc.) | `backend-development` |
|
|
27
27
|
| API contracts (REST, GraphQL, gRPC) | `api-design` |
|
|
28
28
|
| Database (schema, migrations, queries) | `database-design` |
|
package/.opencode/agents/fix.md
CHANGED
|
@@ -150,7 +150,7 @@ Before fixing, load relevant skills. Use the `skill` tool.
|
|
|
150
150
|
| API errors | `api-design` + `backend-development` |
|
|
151
151
|
| Database issues | `database-design` |
|
|
152
152
|
| Frontend rendering issues | `frontend-development` |
|
|
153
|
-
| UI visual bugs, layout issues, design inconsistencies | `ui-design` |
|
|
153
|
+
| UI visual bugs, layout issues, design inconsistencies | `ui-design` (**must check `.cortex/design-spec.md` first** — create if missing) |
|
|
154
154
|
| Deployment or CI/CD failures | `deployment-automation` |
|
|
155
155
|
|
|
156
156
|
## Debugging Quick Reference
|
|
@@ -88,37 +88,40 @@ If a plan exists, load it with `plan_load`.
|
|
|
88
88
|
|
|
89
89
|
**Suggested branch detection:** If the loaded plan has a `branch` field in its frontmatter (set by `plan_commit`), this is the **suggested branch name** for implementation. The branch may or may not exist yet — `plan_commit` only writes the suggestion, it does not create the branch.
|
|
90
90
|
|
|
91
|
-
### Step 4: Ask User About Branch Strategy
|
|
91
|
+
### Step 4: Ask User About Branch Strategy (MUST ASK — NEVER skip)
|
|
92
|
+
|
|
93
|
+
**CRITICAL: You MUST use the question tool to ask the user before creating any branch or worktree. NEVER call `branch_create` or `worktree_create` without explicit user selection. Do NOT assume a choice — always present the options and WAIT for the user's response.**
|
|
92
94
|
|
|
93
95
|
**If you are already on the suggested branch (it was created during architect handoff):**
|
|
94
96
|
Skip the branch creation prompt entirely — you're already set up. Inform the user:
|
|
95
97
|
"You're on the plan branch `{branch}`. Ready to implement."
|
|
96
98
|
|
|
97
99
|
**If the plan has a `branch` field BUT the branch doesn't exist yet or you're on a different branch:**
|
|
98
|
-
|
|
100
|
+
Use the **question tool** with these options:
|
|
99
101
|
|
|
100
102
|
"The plan suggests branch `{branch}`. How would you like to proceed?"
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
1. **Create a worktree (Recommended)** — Isolated copy with the suggested branch name
|
|
104
|
+
1. **Create a worktree (Recommended)** — Isolated copy with the suggested branch name. This is the safest option.
|
|
104
105
|
2. **Create the branch here** — Create and switch to `{branch}` in this repo
|
|
105
106
|
3. **Create a different branch** — Use a custom branch name
|
|
106
107
|
4. **Continue here** — Only if you're certain (not recommended on protected branches)
|
|
107
108
|
|
|
108
109
|
**If no plan exists AND on a protected branch:**
|
|
109
|
-
Use the
|
|
110
|
+
Use the **question tool** with these options:
|
|
110
111
|
|
|
111
112
|
"I'm ready to implement changes. How would you like to proceed?"
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
3. **Continue here** - Only if you're certain (not recommended on protected branches)
|
|
114
|
+
1. **Create a worktree (Recommended)** — Isolated copy in `.worktrees/` for parallel development. This is the safest option.
|
|
115
|
+
2. **Create a new branch** — Stay in this repo, create feature/bugfix branch
|
|
116
|
+
3. **Continue here** — Only if you're certain (not recommended on protected branches)
|
|
117
117
|
|
|
118
118
|
### Step 5: Execute Based on Response
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
|
|
120
|
+
**Only after the user selects an option**, execute the corresponding action:
|
|
121
|
+
|
|
122
|
+
- **User chose "Worktree"**: Use `worktree_create` with appropriate type and name. Report the worktree path. Continue working in the current session.
|
|
123
|
+
- **User chose "Create branch"**: Use `branch_create` with the suggested branch name (or custom name)
|
|
124
|
+
- **User chose "Continue"**: Proceed with caution, warn user about risks
|
|
122
125
|
|
|
123
126
|
### Step 6: REPL Implementation Loop
|
|
124
127
|
|
|
@@ -344,7 +347,7 @@ Detect the project's technology stack and load relevant skills BEFORE writing co
|
|
|
344
347
|
| Signal | Skill to Load |
|
|
345
348
|
|--------|--------------|
|
|
346
349
|
| `package.json` has react/next/vue/nuxt/svelte/angular | `frontend-development` |
|
|
347
|
-
| UI work: new pages, components, visual design, layout | `ui-design` |
|
|
350
|
+
| UI work: new pages, components, visual design, layout | `ui-design` (**must check `.cortex/design-spec.md` first** — create if missing) |
|
|
348
351
|
| `package.json` has express/fastify/hono/nest OR Python with flask/django/fastapi | `backend-development` |
|
|
349
352
|
| Database files: `migrations/`, `schema.prisma`, `models.py`, `*.sql` | `database-design` |
|
|
350
353
|
| API routes, OpenAPI spec, GraphQL schema | `api-design` |
|
|
@@ -21,6 +21,182 @@ Use this skill when:
|
|
|
21
21
|
> For accessibility (WCAG, ARIA, keyboard navigation), see `frontend-development`.
|
|
22
22
|
> For component implementation patterns (React, Vue, Svelte), see `frontend-development`.
|
|
23
23
|
|
|
24
|
+
## Design Spec (MANDATORY — before ANY UI work)
|
|
25
|
+
|
|
26
|
+
**Every project with a UI MUST have a design spec.** Before making any visual or layout changes, you must check for and use the project's design spec. All UI work must be consistent with this spec.
|
|
27
|
+
|
|
28
|
+
### Step 1: Check for Existing Spec
|
|
29
|
+
|
|
30
|
+
Look for `.cortex/design-spec.md` in the project root. If it exists, **read it and follow it** — every color, font, spacing value, and component pattern you use must align with the spec.
|
|
31
|
+
|
|
32
|
+
### Step 2: Create Spec if Missing
|
|
33
|
+
|
|
34
|
+
If `.cortex/design-spec.md` does NOT exist, you **MUST create one before writing any UI code**:
|
|
35
|
+
|
|
36
|
+
1. **Analyze the existing app** — scan all frontend files (components, pages, layouts, stylesheets, Tailwind config, theme files, CSS variables) to extract the current visual identity
|
|
37
|
+
2. **Identify existing patterns** — colors in use, font families, spacing conventions, border radii, shadow usage, component styles
|
|
38
|
+
3. **Synthesize into a spec** — consolidate findings into a coherent design spec, resolving any inconsistencies by choosing the dominant or best pattern
|
|
39
|
+
4. **Save to `.cortex/design-spec.md`** using the template below
|
|
40
|
+
|
|
41
|
+
If the project has no existing UI (greenfield), generate a design spec based on the project type (SaaS, marketing, developer tool, etc.) and ask the user to confirm key branding choices (primary color, font family, overall feel) before proceeding.
|
|
42
|
+
|
|
43
|
+
### Step 3: Reference the Spec During Implementation
|
|
44
|
+
|
|
45
|
+
For every UI change:
|
|
46
|
+
- Use **only** the colors defined in the spec
|
|
47
|
+
- Use **only** the typography scale from the spec
|
|
48
|
+
- Follow the spacing system in the spec
|
|
49
|
+
- Match the component patterns (border radius, shadows, button styles) from the spec
|
|
50
|
+
- Maintain the overall look & feel described in the spec
|
|
51
|
+
|
|
52
|
+
If a task requires something not covered by the spec (e.g., a new component type, a new color for a new feature), **extend the spec first**, then implement.
|
|
53
|
+
|
|
54
|
+
### Design Spec Template
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
# Design Spec — [Project Name]
|
|
58
|
+
|
|
59
|
+
> Auto-generated from codebase analysis. Keep this file updated as the design evolves.
|
|
60
|
+
> Location: `.cortex/design-spec.md`
|
|
61
|
+
|
|
62
|
+
## Brand Identity
|
|
63
|
+
|
|
64
|
+
### Brand Personality
|
|
65
|
+
- **Tone**: [e.g., Professional & approachable / Bold & playful / Minimal & technical]
|
|
66
|
+
- **Feel**: [e.g., Modern SaaS / Enterprise / Developer tool / Consumer app]
|
|
67
|
+
- **Keywords**: [3-5 adjectives, e.g., clean, trustworthy, fast, friendly]
|
|
68
|
+
|
|
69
|
+
### Logo & Assets
|
|
70
|
+
- Logo location: [path or "not yet defined"]
|
|
71
|
+
- Favicon: [path or "not yet defined"]
|
|
72
|
+
- Brand mark usage notes: [any constraints]
|
|
73
|
+
|
|
74
|
+
## Color Palette
|
|
75
|
+
|
|
76
|
+
### Primary
|
|
77
|
+
- **Primary**: [hex] — [Tailwind class, e.g., `blue-600`]
|
|
78
|
+
- **Primary hover**: [hex] — [Tailwind class]
|
|
79
|
+
- **Primary light** (backgrounds): [hex] — [Tailwind class]
|
|
80
|
+
- **Primary dark** (text on light): [hex] — [Tailwind class]
|
|
81
|
+
|
|
82
|
+
### Accent (if applicable)
|
|
83
|
+
- **Accent**: [hex] — [Tailwind class]
|
|
84
|
+
|
|
85
|
+
### Neutrals
|
|
86
|
+
- **Background**: [hex] — [Tailwind class]
|
|
87
|
+
- **Surface** (cards, panels): [hex] — [Tailwind class]
|
|
88
|
+
- **Border**: [hex] — [Tailwind class]
|
|
89
|
+
- **Text primary**: [hex] — [Tailwind class]
|
|
90
|
+
- **Text secondary**: [hex] — [Tailwind class]
|
|
91
|
+
- **Text muted**: [hex] — [Tailwind class]
|
|
92
|
+
|
|
93
|
+
### Semantic Colors
|
|
94
|
+
- **Success**: [hex] — [Tailwind class]
|
|
95
|
+
- **Warning**: [hex] — [Tailwind class]
|
|
96
|
+
- **Error**: [hex] — [Tailwind class]
|
|
97
|
+
- **Info**: [hex] — [Tailwind class]
|
|
98
|
+
|
|
99
|
+
### Dark Mode (if applicable)
|
|
100
|
+
[Repeat the above structure for dark mode overrides, or note "N/A"]
|
|
101
|
+
|
|
102
|
+
## Typography
|
|
103
|
+
|
|
104
|
+
### Font Families
|
|
105
|
+
- **Headings**: [font name] — [source, e.g., Google Fonts / system / @fontsource]
|
|
106
|
+
- **Body**: [font name] — [source]
|
|
107
|
+
- **Monospace** (code): [font name] — [source]
|
|
108
|
+
|
|
109
|
+
### Type Scale
|
|
110
|
+
| Level | Size | Weight | Line Height | Tailwind |
|
|
111
|
+
|-------|------|--------|-------------|----------|
|
|
112
|
+
| Display | [px] | [weight] | [lh] | [classes] |
|
|
113
|
+
| H1 | [px] | [weight] | [lh] | [classes] |
|
|
114
|
+
| H2 | [px] | [weight] | [lh] | [classes] |
|
|
115
|
+
| H3 | [px] | [weight] | [lh] | [classes] |
|
|
116
|
+
| H4 | [px] | [weight] | [lh] | [classes] |
|
|
117
|
+
| Body | [px] | [weight] | [lh] | [classes] |
|
|
118
|
+
| Small | [px] | [weight] | [lh] | [classes] |
|
|
119
|
+
| Caption | [px] | [weight] | [lh] | [classes] |
|
|
120
|
+
|
|
121
|
+
## Spacing & Layout
|
|
122
|
+
|
|
123
|
+
### Base Unit
|
|
124
|
+
- **Base**: [e.g., 8px / 4px]
|
|
125
|
+
- **Scale**: [list the spacing scale used, e.g., 4, 8, 12, 16, 24, 32, 48, 64]
|
|
126
|
+
|
|
127
|
+
### Container
|
|
128
|
+
- **Max width**: [e.g., max-w-7xl / 1280px]
|
|
129
|
+
- **Page padding**: [e.g., px-4 sm:px-6 lg:px-8]
|
|
130
|
+
|
|
131
|
+
### Content Density
|
|
132
|
+
- **Target**: [Spacious / Balanced / Dense]
|
|
133
|
+
|
|
134
|
+
## Component Patterns
|
|
135
|
+
|
|
136
|
+
### Border Radius
|
|
137
|
+
- **Cards / Modals**: [e.g., rounded-xl / 12px]
|
|
138
|
+
- **Buttons / Inputs**: [e.g., rounded-lg / 8px]
|
|
139
|
+
- **Badges / Pills**: [e.g., rounded-full]
|
|
140
|
+
|
|
141
|
+
### Shadows
|
|
142
|
+
- **Cards**: [e.g., shadow-sm]
|
|
143
|
+
- **Dropdowns**: [e.g., shadow-md]
|
|
144
|
+
- **Modals**: [e.g., shadow-lg]
|
|
145
|
+
|
|
146
|
+
### Buttons
|
|
147
|
+
| Variant | Classes |
|
|
148
|
+
|---------|---------|
|
|
149
|
+
| Primary | [full Tailwind classes] |
|
|
150
|
+
| Secondary | [full Tailwind classes] |
|
|
151
|
+
| Ghost | [full Tailwind classes] |
|
|
152
|
+
| Destructive | [full Tailwind classes] |
|
|
153
|
+
|
|
154
|
+
### Inputs
|
|
155
|
+
- **Height**: [e.g., h-10 / 40px]
|
|
156
|
+
- **Border**: [e.g., border border-gray-300]
|
|
157
|
+
- **Focus**: [e.g., ring-2 ring-primary-500]
|
|
158
|
+
- **Error**: [e.g., border-red-500 + text-sm text-red-600 message below]
|
|
159
|
+
|
|
160
|
+
### Navigation Pattern
|
|
161
|
+
- **Type**: [Top navbar / Sidebar / Bottom tabs]
|
|
162
|
+
- **Active state**: [classes for active nav item]
|
|
163
|
+
|
|
164
|
+
## Look & Feel
|
|
165
|
+
|
|
166
|
+
### Overall Aesthetic
|
|
167
|
+
[1-2 sentences describing the visual identity, e.g., "Clean, minimal interface with generous whitespace, subtle shadows, and a blue-primary palette that conveys trust and professionalism."]
|
|
168
|
+
|
|
169
|
+
### Motion
|
|
170
|
+
- **Hover transitions**: [e.g., transition-colors duration-150]
|
|
171
|
+
- **Panel animations**: [e.g., transition-all duration-200 ease-in-out]
|
|
172
|
+
- **Respect reduced motion**: [yes/no]
|
|
173
|
+
|
|
174
|
+
### Iconography
|
|
175
|
+
- **Icon library**: [e.g., Lucide / Heroicons / Phosphor]
|
|
176
|
+
- **Default size**: [e.g., w-5 h-5 / 20px]
|
|
177
|
+
- **Style**: [e.g., outline / solid / duotone]
|
|
178
|
+
|
|
179
|
+
### Imagery
|
|
180
|
+
- **Style**: [e.g., illustrations / photos / abstract]
|
|
181
|
+
- **Source**: [e.g., in-house / Unsplash / none yet]
|
|
182
|
+
|
|
183
|
+
## Do's and Don'ts
|
|
184
|
+
|
|
185
|
+
### Do
|
|
186
|
+
- [e.g., Use the primary color for all main CTAs]
|
|
187
|
+
- [e.g., Maintain consistent padding inside cards (p-6)]
|
|
188
|
+
- [e.g., Use skeleton loaders for async content]
|
|
189
|
+
|
|
190
|
+
### Don't
|
|
191
|
+
- [e.g., Don't use arbitrary hex colors outside the palette]
|
|
192
|
+
- [e.g., Don't mix border radius values within the same context]
|
|
193
|
+
- [e.g., Don't skip hover/focus states on interactive elements]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Updating the Spec
|
|
197
|
+
|
|
198
|
+
When you make intentional design changes (new component patterns, color additions, etc.), **update `.cortex/design-spec.md`** to reflect them. The spec is a living document that must stay in sync with the codebase.
|
|
199
|
+
|
|
24
200
|
## Visual Hierarchy & Layout
|
|
25
201
|
|
|
26
202
|
### Scanning Patterns
|
package/README.md
CHANGED
|
@@ -154,6 +154,17 @@ Implement Agent detects: package.json has React + Express + Prisma
|
|
|
154
154
|
-> implements with deep framework-specific knowledge
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
+
### Design Spec Enforcement
|
|
158
|
+
|
|
159
|
+
All UI work is governed by a **mandatory design spec** (`.cortex/design-spec.md`). When any agent loads the `ui-design` skill:
|
|
160
|
+
|
|
161
|
+
1. **Check** — looks for `.cortex/design-spec.md`
|
|
162
|
+
2. **Create if missing** — analyzes the entire app (components, styles, Tailwind config, theme files, CSS variables) and synthesizes a spec covering brand identity, color palette, typography, spacing, component patterns, and look & feel
|
|
163
|
+
3. **Follow it** — every color, font, spacing value, and component pattern must align with the spec
|
|
164
|
+
4. **Extend it** — if a task needs something not in the spec, the spec is updated first
|
|
165
|
+
|
|
166
|
+
This ensures visual consistency across all agents and sessions — no more one-off colors, mismatched radii, or inconsistent button styles.
|
|
167
|
+
|
|
157
168
|
---
|
|
158
169
|
|
|
159
170
|
## Tools
|
|
@@ -230,7 +241,7 @@ State persists to `.cortex/repl-state.json` — survives context compaction, ses
|
|
|
230
241
|
| Skill | Covers |
|
|
231
242
|
|-------|--------|
|
|
232
243
|
| `frontend-development` | React, Vue, Svelte, CSS architecture, accessibility |
|
|
233
|
-
| `ui-design` | Visual hierarchy, typography, color systems, spacing, motion, professional polish |
|
|
244
|
+
| `ui-design` | Visual hierarchy, typography, color systems, spacing, motion, professional polish. **Enforces a mandatory design spec** (`.cortex/design-spec.md`) — auto-creates from codebase analysis if missing, ensuring brand consistency across all UI work. |
|
|
234
245
|
| `backend-development` | API design, middleware, auth, caching, queue systems |
|
|
235
246
|
| `mobile-development` | React Native, Flutter, native iOS/Android patterns |
|
|
236
247
|
| `desktop-development` | Electron, Tauri, native desktop application patterns |
|
|
@@ -365,6 +376,7 @@ quality_gate_summary receives reports from 6 agents:
|
|
|
365
376
|
your-project/
|
|
366
377
|
.cortex/ Project context (auto-initialized)
|
|
367
378
|
config.json Configuration
|
|
379
|
+
design-spec.md UI design spec — branding, colors, typography, patterns
|
|
368
380
|
plans/ Implementation plans
|
|
369
381
|
sessions/ Session summaries
|
|
370
382
|
repl-state.json REPL loop progress (auto-managed)
|
package/package.json
CHANGED