cortex-agents 4.0.3 → 4.0.5
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 +27 -20
- package/.opencode/agents/coder.md +1 -1
- package/.opencode/agents/fix.md +1 -1
- package/.opencode/agents/implement.md +12 -14
- package/.opencode/skills/ui-design/SKILL.md +176 -0
- package/README.md +17 -6
- package/dist/tools/plan.d.ts +4 -6
- package/dist/tools/plan.d.ts.map +1 -1
- package/dist/tools/plan.js +31 -79
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@ tools:
|
|
|
22
22
|
session_save: true
|
|
23
23
|
session_list: true
|
|
24
24
|
branch_status: true
|
|
25
|
+
branch_create: true
|
|
25
26
|
docs_list: true
|
|
26
27
|
github_status: true
|
|
27
28
|
github_issues: true
|
|
@@ -110,39 +111,44 @@ Use `plan_save` with:
|
|
|
110
111
|
- Full plan content including mermaid diagrams
|
|
111
112
|
- Task list
|
|
112
113
|
|
|
113
|
-
### Step 4.5: Commit Plan
|
|
114
|
+
### Step 4.5: Commit Plan (MANDATORY)
|
|
114
115
|
|
|
115
|
-
**After saving the plan**, commit
|
|
116
|
+
**After saving the plan**, commit the `.cortex/` artifacts on the current branch:
|
|
116
117
|
|
|
117
118
|
1. Call `plan_commit` with the plan filename from Step 4
|
|
118
119
|
2. This automatically:
|
|
119
|
-
-
|
|
120
|
-
-
|
|
120
|
+
- Computes a suggested branch name (`feature/`, `bugfix/`, `refactor/`, or `docs/` prefix based on plan type)
|
|
121
|
+
- Writes the suggested branch into the plan frontmatter as `branch: feature/xyz`
|
|
121
122
|
- Stages all `.cortex/` artifacts
|
|
122
123
|
- Commits with `chore(plan): {title}`
|
|
123
|
-
3.
|
|
124
|
-
4. Report the branch name to the user
|
|
124
|
+
3. **No branch is created** — the plan is committed on the current branch. Branch creation happens during handoff.
|
|
125
|
+
4. Report the suggested branch name to the user
|
|
125
126
|
|
|
126
|
-
**If plan_commit fails** (e.g.,
|
|
127
|
+
**If plan_commit fails** (e.g., nothing to stage), inform the user.
|
|
127
128
|
|
|
128
129
|
### Step 5: Handoff to Implementation
|
|
129
|
-
**After committing the plan**, offer the user options to proceed
|
|
130
|
+
**After committing the plan**, offer the user options to proceed. Note the **suggested branch** from plan_commit output.
|
|
130
131
|
|
|
131
|
-
"Plan committed
|
|
132
|
+
"Plan committed. Suggested branch: `{suggestedBranch}`. How would you like to proceed?"
|
|
132
133
|
|
|
133
|
-
1. **Create a worktree (Recommended)** — Create an isolated worktree
|
|
134
|
-
2. **
|
|
134
|
+
1. **Create a worktree (Recommended)** — Create an isolated worktree with the suggested branch, then switch to Implement
|
|
135
|
+
2. **Continue in this session** — Create the branch here, then switch to Implement agent
|
|
135
136
|
3. **Stay in Architect mode** — Continue planning or refine the plan
|
|
136
137
|
|
|
137
|
-
If the user chooses "Create a worktree"
|
|
138
|
-
- Use `worktree_create` with `
|
|
138
|
+
If the user chooses **"Create a worktree"**:
|
|
139
|
+
- Use `worktree_create` with `name` derived from the suggested branch slug and `type` from the plan type
|
|
139
140
|
- Report the worktree path so the user can navigate to it
|
|
140
141
|
- Suggest: "Navigate to the worktree and run OpenCode with the Implement agent to begin implementation"
|
|
141
142
|
|
|
143
|
+
If the user chooses **"Continue in this session"**:
|
|
144
|
+
- Use `branch_create` with the suggested branch name (type and name from the plan)
|
|
145
|
+
- This creates and switches to the new branch
|
|
146
|
+
- Then switch to the Implement agent
|
|
147
|
+
|
|
142
148
|
### Step 6: Provide Handoff Context
|
|
143
149
|
If user chooses to switch agents, provide:
|
|
144
150
|
- Plan file location
|
|
145
|
-
- **
|
|
151
|
+
- **Branch name** (the one just created during handoff)
|
|
146
152
|
- Key tasks to implement first
|
|
147
153
|
- Critical decisions to follow
|
|
148
154
|
|
|
@@ -156,7 +162,7 @@ If user chooses to switch agents, provide:
|
|
|
156
162
|
- Think about scalability, maintainability, and performance
|
|
157
163
|
- Never write or modify code files — only analyze and advise
|
|
158
164
|
- Always save plans for future reference
|
|
159
|
-
- Always commit plans
|
|
165
|
+
- Always commit plans via plan_commit for persistence
|
|
160
166
|
|
|
161
167
|
## Skill Loading (load based on plan topic)
|
|
162
168
|
|
|
@@ -172,7 +178,7 @@ Before creating a plan, load relevant skills to inform your analysis. Use the `s
|
|
|
172
178
|
| Security requirements, threat models | `security-hardening` |
|
|
173
179
|
| CI/CD pipeline design, deployment strategy | `deployment-automation` |
|
|
174
180
|
| Frontend architecture, component design | `frontend-development` |
|
|
175
|
-
| UI design, visual design, page layouts | `ui-design` |
|
|
181
|
+
| UI design, visual design, page layouts | `ui-design` (**must check `.cortex/design-spec.md` first** — create if missing) |
|
|
176
182
|
| Backend service design, middleware, auth | `backend-development` |
|
|
177
183
|
| Mobile app architecture | `mobile-development` |
|
|
178
184
|
| Desktop app architecture | `desktop-development` |
|
|
@@ -264,8 +270,8 @@ sequenceDiagram
|
|
|
264
270
|
## Suggested Branch Name
|
|
265
271
|
`feature/[descriptive-name]` or `refactor/[descriptive-name]`
|
|
266
272
|
|
|
267
|
-
> **Note**:
|
|
268
|
-
> The branch
|
|
273
|
+
> **Note**: `plan_commit` writes a suggested branch name into the plan frontmatter as `branch: feature/xyz`.
|
|
274
|
+
> The actual branch is created during the handoff step (Step 5), not during plan_commit.
|
|
269
275
|
```
|
|
270
276
|
|
|
271
277
|
---
|
|
@@ -300,7 +306,7 @@ sequenceDiagram
|
|
|
300
306
|
- You CANNOT launch implementation sub-agents (@testing, @audit, @devops, @refactor, @docs-writer)
|
|
301
307
|
- You can only read, search, and analyze
|
|
302
308
|
- You CAN save plans to .cortex/plans/
|
|
303
|
-
- You CAN commit plans
|
|
309
|
+
- You CAN commit plans via `plan_commit` (stages + commits .cortex/ on the current branch, no branch creation)
|
|
304
310
|
- Always ask clarifying questions when requirements are unclear
|
|
305
311
|
|
|
306
312
|
## Tool Usage
|
|
@@ -310,9 +316,10 @@ sequenceDiagram
|
|
|
310
316
|
- `plan_save` - Save implementation plan
|
|
311
317
|
- `plan_list` - List existing plans
|
|
312
318
|
- `plan_load` - Load a saved plan
|
|
313
|
-
- `plan_commit` -
|
|
319
|
+
- `plan_commit` - Commit .cortex/ artifacts on current branch, write suggested branch to frontmatter
|
|
314
320
|
- `session_save` - Save session summary
|
|
315
321
|
- `branch_status` - Check current git state
|
|
322
|
+
- `branch_create` - Create a new branch (used during handoff to implementation)
|
|
316
323
|
- `github_status` - Check GitHub CLI availability, auth, and detect projects
|
|
317
324
|
- `github_issues` - List/filter GitHub issues for work item selection
|
|
318
325
|
- `github_projects` - List GitHub Project boards and their work items
|
|
@@ -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
|
|
@@ -86,26 +86,26 @@ If `./opencode.json` does not have agent model configuration, offer to configure
|
|
|
86
86
|
Run `plan_list` to see if there's a relevant plan for this work.
|
|
87
87
|
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
91
|
### Step 4: Ask User About Branch Strategy
|
|
92
92
|
|
|
93
|
-
**If
|
|
93
|
+
**If you are already on the suggested branch (it was created during architect handoff):**
|
|
94
94
|
Skip the branch creation prompt entirely — you're already set up. Inform the user:
|
|
95
95
|
"You're on the plan branch `{branch}`. Ready to implement."
|
|
96
96
|
|
|
97
|
-
**If the plan has a `branch` field BUT you
|
|
98
|
-
Offer to
|
|
97
|
+
**If the plan has a `branch` field BUT the branch doesn't exist yet or you're on a different branch:**
|
|
98
|
+
Offer to create it:
|
|
99
99
|
|
|
100
|
-
"The plan
|
|
100
|
+
"The plan suggests branch `{branch}`. How would you like to proceed?"
|
|
101
101
|
|
|
102
102
|
Options:
|
|
103
|
-
1. **Create a worktree
|
|
104
|
-
2. **
|
|
105
|
-
3. **Create a
|
|
103
|
+
1. **Create a worktree (Recommended)** — Isolated copy with the suggested branch name
|
|
104
|
+
2. **Create the branch here** — Create and switch to `{branch}` in this repo
|
|
105
|
+
3. **Create a different branch** — Use a custom branch name
|
|
106
106
|
4. **Continue here** — Only if you're certain (not recommended on protected branches)
|
|
107
107
|
|
|
108
|
-
**If no plan
|
|
108
|
+
**If no plan exists AND on a protected branch:**
|
|
109
109
|
Use the original prompt:
|
|
110
110
|
|
|
111
111
|
"I'm ready to implement changes. How would you like to proceed?"
|
|
@@ -116,10 +116,8 @@ Options:
|
|
|
116
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
|
-
- **Worktree
|
|
120
|
-
- **
|
|
121
|
-
- **Switch to plan branch**: Use `branch_switch` with the plan branch name
|
|
122
|
-
- **Branch**: Use `branch_create` with appropriate type (feature/bugfix/refactor)
|
|
119
|
+
- **Worktree**: Use `worktree_create` with appropriate type and name. Report the worktree path. Continue working in the current session.
|
|
120
|
+
- **Create branch**: Use `branch_create` with the suggested branch name (or custom name)
|
|
123
121
|
- **Continue**: Proceed with caution, warn user about risks
|
|
124
122
|
|
|
125
123
|
### Step 6: REPL Implementation Loop
|
|
@@ -346,7 +344,7 @@ Detect the project's technology stack and load relevant skills BEFORE writing co
|
|
|
346
344
|
| Signal | Skill to Load |
|
|
347
345
|
|--------|--------------|
|
|
348
346
|
| `package.json` has react/next/vue/nuxt/svelte/angular | `frontend-development` |
|
|
349
|
-
| UI work: new pages, components, visual design, layout | `ui-design` |
|
|
347
|
+
| UI work: new pages, components, visual design, layout | `ui-design` (**must check `.cortex/design-spec.md` first** — create if missing) |
|
|
350
348
|
| `package.json` has express/fastify/hono/nest OR Python with flask/django/fastapi | `backend-development` |
|
|
351
349
|
| Database files: `migrations/`, `schema.prisma`, `models.py`, `*.sql` | `database-design` |
|
|
352
350
|
| 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
|
@@ -91,9 +91,8 @@ User Request
|
|
|
91
91
|
You: "Add user authentication"
|
|
92
92
|
|
|
93
93
|
Architect Agent reads codebase, creates plan with mermaid diagrams
|
|
94
|
-
saves to .cortex/plans/ commits plan
|
|
95
|
-
"Plan committed.
|
|
96
|
-
Implement?"
|
|
94
|
+
saves to .cortex/plans/ commits plan on current branch
|
|
95
|
+
"Plan committed. Proceed?" offers worktree, branch, or stay
|
|
97
96
|
|
|
98
97
|
Implement Agent loads plan, checks git status
|
|
99
98
|
repl_init → parses tasks + ACs iterates task-by-task with build+test
|
|
@@ -123,7 +122,7 @@ Handle complex, multi-step work. Use your best model.
|
|
|
123
122
|
|
|
124
123
|
| Agent | Role | Key Capabilities |
|
|
125
124
|
|-------|------|-----------------|
|
|
126
|
-
| **architect** | Read-only analysis & planning | Plans with mermaid diagrams, acceptance criteria, NFR analysis. Commits plans to
|
|
125
|
+
| **architect** | Read-only analysis & planning | Plans with mermaid diagrams, acceptance criteria, NFR analysis. Commits plans and defers branch creation to handoff. Delegates read-only analysis to `@security`, `@coder`, `@perf`. |
|
|
127
126
|
| **implement** | Full-access development | Skill-aware implementation, REPL loop with ACs, two-phase quality gate, parallel sub-agent orchestration, task finalizer. |
|
|
128
127
|
| **fix** | Quick turnaround bug fixes | Rapid diagnosis, scope-based quality gate, optional REPL loop. Delegates deep debugging to `@debug`. |
|
|
129
128
|
|
|
@@ -155,6 +154,17 @@ Implement Agent detects: package.json has React + Express + Prisma
|
|
|
155
154
|
-> implements with deep framework-specific knowledge
|
|
156
155
|
```
|
|
157
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
|
+
|
|
158
168
|
---
|
|
159
169
|
|
|
160
170
|
## Tools
|
|
@@ -175,7 +185,7 @@ Implement Agent detects: package.json has React + Express + Prisma
|
|
|
175
185
|
|
|
176
186
|
**Planning & Sessions**
|
|
177
187
|
- `plan_save` / `plan_load` / `plan_list` / `plan_delete`
|
|
178
|
-
- `plan_commit` — Commit plan
|
|
188
|
+
- `plan_commit` — Commit plan artifacts on current branch (branch creation deferred to handoff)
|
|
179
189
|
- `session_save` / `session_list` / `session_load`
|
|
180
190
|
- `cortex_init` / `cortex_status` / `cortex_configure`
|
|
181
191
|
|
|
@@ -231,7 +241,7 @@ State persists to `.cortex/repl-state.json` — survives context compaction, ses
|
|
|
231
241
|
| Skill | Covers |
|
|
232
242
|
|-------|--------|
|
|
233
243
|
| `frontend-development` | React, Vue, Svelte, CSS architecture, accessibility |
|
|
234
|
-
| `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. |
|
|
235
245
|
| `backend-development` | API design, middleware, auth, caching, queue systems |
|
|
236
246
|
| `mobile-development` | React Native, Flutter, native iOS/Android patterns |
|
|
237
247
|
| `desktop-development` | Electron, Tauri, native desktop application patterns |
|
|
@@ -366,6 +376,7 @@ quality_gate_summary receives reports from 6 agents:
|
|
|
366
376
|
your-project/
|
|
367
377
|
.cortex/ Project context (auto-initialized)
|
|
368
378
|
config.json Configuration
|
|
379
|
+
design-spec.md UI design spec — branding, colors, typography, patterns
|
|
369
380
|
plans/ Implementation plans
|
|
370
381
|
sessions/ Session summaries
|
|
371
382
|
repl-state.json REPL loop progress (auto-managed)
|
package/dist/tools/plan.d.ts
CHANGED
|
@@ -63,20 +63,18 @@ export declare const delete_: {
|
|
|
63
63
|
* Factory function that creates the plan_commit tool with access
|
|
64
64
|
* to the OpenCode client for toast notifications.
|
|
65
65
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
66
|
+
* Stages .cortex/ artifacts and commits them on the current branch.
|
|
67
|
+
* Writes a suggested branch name into the plan frontmatter for handoff.
|
|
68
|
+
* Branch creation is deferred to the handoff step (worktree_create,
|
|
69
|
+
* branch_create, or "continue in this session").
|
|
68
70
|
*/
|
|
69
71
|
export declare function createCommit(client: Client): {
|
|
70
72
|
description: string;
|
|
71
73
|
args: {
|
|
72
74
|
planFilename: import("zod").ZodString;
|
|
73
|
-
branchType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
74
|
-
branchName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
75
75
|
};
|
|
76
76
|
execute(args: {
|
|
77
77
|
planFilename: string;
|
|
78
|
-
branchType?: string | undefined;
|
|
79
|
-
branchName?: string | undefined;
|
|
80
78
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
81
79
|
};
|
|
82
80
|
export { delete_ as delete };
|
package/dist/tools/plan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAgBvD,KAAK,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AA2BpC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;CAgEf,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;CAkEf,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;CA6Bf,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;CAwBlB,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAgBvD,KAAK,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AA2BpC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;CAgEf,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;CAkEf,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;CA6Bf,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;CAwBlB,CAAC;AAEH;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM;;;;;;;;EAoK1C;AAGD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC"}
|
package/dist/tools/plan.js
CHANGED
|
@@ -195,28 +195,23 @@ export const delete_ = tool({
|
|
|
195
195
|
* Factory function that creates the plan_commit tool with access
|
|
196
196
|
* to the OpenCode client for toast notifications.
|
|
197
197
|
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
198
|
+
* Stages .cortex/ artifacts and commits them on the current branch.
|
|
199
|
+
* Writes a suggested branch name into the plan frontmatter for handoff.
|
|
200
|
+
* Branch creation is deferred to the handoff step (worktree_create,
|
|
201
|
+
* branch_create, or "continue in this session").
|
|
200
202
|
*/
|
|
201
203
|
export function createCommit(client) {
|
|
202
204
|
return tool({
|
|
203
|
-
description: "
|
|
204
|
-
"
|
|
205
|
+
description: "Stage and commit .cortex/ plan artifacts on the current branch. " +
|
|
206
|
+
"Writes a suggested branch name into frontmatter for handoff. " +
|
|
207
|
+
"Does NOT create or switch branches.",
|
|
205
208
|
args: {
|
|
206
209
|
planFilename: tool.schema
|
|
207
210
|
.string()
|
|
208
211
|
.describe("Plan filename from .cortex/plans/ (e.g., '2026-02-26-feature-auth.md')"),
|
|
209
|
-
branchType: tool.schema
|
|
210
|
-
.string()
|
|
211
|
-
.optional()
|
|
212
|
-
.describe("Override branch prefix (default: derived from plan type)"),
|
|
213
|
-
branchName: tool.schema
|
|
214
|
-
.string()
|
|
215
|
-
.optional()
|
|
216
|
-
.describe("Override branch slug (default: derived from plan title)"),
|
|
217
212
|
},
|
|
218
213
|
async execute(args, context) {
|
|
219
|
-
const { planFilename
|
|
214
|
+
const { planFilename } = args;
|
|
220
215
|
const cwd = context.worktree;
|
|
221
216
|
// ── 1. Validate: git repo ─────────────────────────────────
|
|
222
217
|
try {
|
|
@@ -247,71 +242,32 @@ Expected YAML frontmatter with title and type fields.`;
|
|
|
247
242
|
}
|
|
248
243
|
const planTitle = fm.title || "untitled";
|
|
249
244
|
const planType = fm.type || "feature";
|
|
250
|
-
// ── 3.
|
|
245
|
+
// ── 3. Compute suggested branch name (stored for handoff) ──
|
|
251
246
|
const VALID_PREFIXES = Object.values(TYPE_TO_PREFIX);
|
|
252
|
-
const rawPrefix =
|
|
247
|
+
const rawPrefix = TYPE_TO_PREFIX[planType] || "feature";
|
|
253
248
|
const prefix = VALID_PREFIXES.includes(rawPrefix) ? rawPrefix : "feature";
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
const slug = slugify(planTitle);
|
|
250
|
+
const suggestedBranch = `${prefix}/${slug}`;
|
|
251
|
+
// Write suggested branch into frontmatter so handoff knows what to create
|
|
252
|
+
planContent = upsertFrontmatterField(planContent, "branch", suggestedBranch);
|
|
253
|
+
fs.writeFileSync(filepath, planContent);
|
|
254
|
+
// ── 4. Get current branch for reporting ────────────────────
|
|
258
255
|
let currentBranch = "";
|
|
259
256
|
try {
|
|
260
257
|
const { stdout } = await git(cwd, "branch", "--show-current");
|
|
261
258
|
currentBranch = stdout.trim();
|
|
262
259
|
}
|
|
263
260
|
catch {
|
|
264
|
-
currentBranch = "";
|
|
265
|
-
}
|
|
266
|
-
const isOnProtected = PROTECTED_BRANCHES.includes(currentBranch);
|
|
267
|
-
let branchCreated = false;
|
|
268
|
-
// ── 5. Create or switch to branch ─────────────────────────
|
|
269
|
-
if (isOnProtected || !currentBranch) {
|
|
270
|
-
// Try to create the branch
|
|
271
|
-
try {
|
|
272
|
-
await git(cwd, "checkout", "-b", fullBranchName);
|
|
273
|
-
branchCreated = true;
|
|
274
|
-
}
|
|
275
|
-
catch {
|
|
276
|
-
// Branch may already exist — try switching to it
|
|
277
|
-
try {
|
|
278
|
-
await git(cwd, "checkout", fullBranchName);
|
|
279
|
-
}
|
|
280
|
-
catch (switchErr) {
|
|
281
|
-
try {
|
|
282
|
-
await client.tui.showToast({
|
|
283
|
-
body: {
|
|
284
|
-
title: `Plan Commit: ${planFilename}`,
|
|
285
|
-
message: `Failed to create/switch branch: ${switchErr.message || switchErr}`,
|
|
286
|
-
variant: "error",
|
|
287
|
-
duration: 8000,
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
catch {
|
|
292
|
-
// Toast failure is non-fatal
|
|
293
|
-
}
|
|
294
|
-
return `✗ Error creating branch '${fullBranchName}': ${switchErr.message || switchErr}
|
|
295
|
-
|
|
296
|
-
You may have uncommitted changes. Commit or stash them first.`;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
261
|
+
currentBranch = "(detached)";
|
|
299
262
|
}
|
|
300
|
-
//
|
|
301
|
-
// ── 6. Update plan frontmatter with branch ────────────────
|
|
302
|
-
// If we created/switched to a new branch → use that name
|
|
303
|
-
// If already on a non-protected branch → use whatever we're on
|
|
304
|
-
const targetBranch = (isOnProtected || branchCreated) ? fullBranchName : currentBranch;
|
|
305
|
-
planContent = upsertFrontmatterField(planContent, "branch", targetBranch);
|
|
306
|
-
fs.writeFileSync(filepath, planContent);
|
|
307
|
-
// ── 7. Stage .cortex/ directory ───────────────────────────
|
|
263
|
+
// ── 5. Stage .cortex/ directory ───────────────────────────
|
|
308
264
|
try {
|
|
309
265
|
await git(cwd, "add", path.join(cwd, CORTEX_DIR));
|
|
310
266
|
}
|
|
311
267
|
catch (stageErr) {
|
|
312
268
|
return `✗ Error staging .cortex/ directory: ${stageErr.message || stageErr}`;
|
|
313
269
|
}
|
|
314
|
-
// ──
|
|
270
|
+
// ── 6. Commit ─────────────────────────────────────────────
|
|
315
271
|
const commitMsg = `chore(plan): ${planTitle}`;
|
|
316
272
|
let commitHash = "";
|
|
317
273
|
try {
|
|
@@ -333,7 +289,7 @@ You may have uncommitted changes. Commit or stash them first.`;
|
|
|
333
289
|
try {
|
|
334
290
|
await client.tui.showToast({
|
|
335
291
|
body: {
|
|
336
|
-
title: `Plan: ${
|
|
292
|
+
title: `Plan: ${planFilename}`,
|
|
337
293
|
message: "Already committed — no new changes",
|
|
338
294
|
variant: "info",
|
|
339
295
|
duration: 4000,
|
|
@@ -343,14 +299,14 @@ You may have uncommitted changes. Commit or stash them first.`;
|
|
|
343
299
|
catch {
|
|
344
300
|
// Toast failure is non-fatal
|
|
345
301
|
}
|
|
346
|
-
return `✓ Plan already committed
|
|
302
|
+
return `✓ Plan already committed
|
|
347
303
|
|
|
348
|
-
|
|
349
|
-
Commit: ${commitHash}
|
|
304
|
+
On: ${currentBranch} (no new changes)
|
|
305
|
+
Commit: ${commitHash}
|
|
350
306
|
Plan: ${planFilename}
|
|
307
|
+
Suggested branch: ${suggestedBranch}
|
|
351
308
|
|
|
352
|
-
|
|
353
|
-
Use worktree_create or switch to the Implement agent.`;
|
|
309
|
+
Ready for handoff — branch will be created when you proceed to implementation.`;
|
|
354
310
|
}
|
|
355
311
|
await git(cwd, "commit", "-m", commitMsg);
|
|
356
312
|
const { stdout: hashOut } = await git(cwd, "rev-parse", "--short", "HEAD");
|
|
@@ -372,12 +328,12 @@ Use worktree_create or switch to the Implement agent.`;
|
|
|
372
328
|
}
|
|
373
329
|
return `✗ Error committing: ${commitErr.message || commitErr}`;
|
|
374
330
|
}
|
|
375
|
-
// ──
|
|
331
|
+
// ── 7. Success notification ───────────────────────────────
|
|
376
332
|
try {
|
|
377
333
|
await client.tui.showToast({
|
|
378
334
|
body: {
|
|
379
335
|
title: `Plan Committed`,
|
|
380
|
-
message: `${
|
|
336
|
+
message: `${currentBranch} — ${commitHash}`,
|
|
381
337
|
variant: "success",
|
|
382
338
|
duration: 5000,
|
|
383
339
|
},
|
|
@@ -386,18 +342,14 @@ Use worktree_create or switch to the Implement agent.`;
|
|
|
386
342
|
catch {
|
|
387
343
|
// Toast failure is non-fatal
|
|
388
344
|
}
|
|
389
|
-
return `✓ Plan committed
|
|
345
|
+
return `✓ Plan committed
|
|
390
346
|
|
|
391
|
-
|
|
347
|
+
On: ${currentBranch}
|
|
392
348
|
Commit: ${commitHash} — ${commitMsg}
|
|
393
349
|
Plan: ${planFilename}
|
|
350
|
+
Suggested branch: ${suggestedBranch}
|
|
394
351
|
|
|
395
|
-
The
|
|
396
|
-
Main branch is clean.
|
|
397
|
-
|
|
398
|
-
Next steps:
|
|
399
|
-
• Switch to Implement agent to begin coding
|
|
400
|
-
• Or use worktree_create to work in an isolated copy`;
|
|
352
|
+
The .cortex/ artifacts are committed. Branch creation happens during handoff.`;
|
|
401
353
|
},
|
|
402
354
|
});
|
|
403
355
|
}
|
package/package.json
CHANGED