cortex-agents 2.1.0 → 2.2.0

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/README.md CHANGED
@@ -1,486 +1,370 @@
1
- # cortex-agents
2
-
3
1
  <p align="center">
4
- <strong>Model-agnostic agents for OpenCode with agent handover notifications, mermaid documentation, worktree workflow, and plan persistence</strong>
2
+ <img src="https://img.shields.io/badge/cortex-agents-111?style=for-the-badge&labelColor=111&color=4d96ff" alt="cortex-agents" height="40">
5
3
  </p>
6
4
 
5
+ <h3 align="center">Supercharge OpenCode with structured workflows, intelligent agents, and automated development practices.</h3>
6
+
7
7
  <p align="center">
8
- <a href="https://www.npmjs.com/package/cortex-agents">
9
- <img src="https://img.shields.io/npm/v/cortex-agents.svg?style=flat-square" alt="npm version">
10
- </a>
11
- <a href="https://www.npmjs.com/package/cortex-agents">
12
- <img src="https://img.shields.io/npm/dm/cortex-agents.svg?style=flat-square" alt="npm downloads">
13
- </a>
14
- <a href="https://github.com/your-org/cortex-agents/blob/main/LICENSE">
15
- <img src="https://img.shields.io/npm/l/cortex-agents.svg?style=flat-square" alt="license">
16
- </a>
17
- <a href="https://opencode.ai">
18
- <img src="https://img.shields.io/badge/OpenCode-Plugin-blue?style=flat-square" alt="OpenCode Plugin">
19
- </a>
8
+ <a href="https://www.npmjs.com/package/cortex-agents"><img src="https://img.shields.io/npm/v/cortex-agents.svg?style=flat-square&color=4d96ff" alt="npm version"></a>
9
+ <a href="https://www.npmjs.com/package/cortex-agents"><img src="https://img.shields.io/npm/dm/cortex-agents.svg?style=flat-square&color=6bcb77" alt="npm downloads"></a>
10
+ <a href="https://github.com/ps-carvalho/cortex-agents/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/cortex-agents.svg?style=flat-square&color=ffd93d" alt="license"></a>
11
+ <a href="https://opencode.ai"><img src="https://img.shields.io/badge/OpenCode-Plugin-4d96ff?style=flat-square" alt="OpenCode Plugin"></a>
20
12
  </p>
21
13
 
22
14
  <p align="center">
23
- <a href="#quick-start">Quick Start</a> •
24
- <a href="#model-configuration">Model Configuration</a> •
25
- <a href="#features">Features</a> •
26
- <a href="#agents">Agents</a> •
27
- <a href="#tools">Tools</a> •
28
- <a href="#documentation-system">Documentation</a>
15
+ <a href="#-quick-start">Quick Start</a>&nbsp;&nbsp;|&nbsp;&nbsp;
16
+ <a href="#-what-it-does">What It Does</a>&nbsp;&nbsp;|&nbsp;&nbsp;
17
+ <a href="#-agents">Agents</a>&nbsp;&nbsp;|&nbsp;&nbsp;
18
+ <a href="#-tools">Tools</a>&nbsp;&nbsp;|&nbsp;&nbsp;
19
+ <a href="#-skills">Skills</a>&nbsp;&nbsp;|&nbsp;&nbsp;
20
+ <a href="#-contributing">Contributing</a>
29
21
  </p>
30
22
 
31
- ---
32
-
33
- ## Quick Start
34
-
35
- ```bash
36
- # 1. Install the plugin
37
- npx cortex-agents install
38
-
39
- # 2. Choose your models interactively
40
- npx cortex-agents configure
41
-
42
- # 3. Restart OpenCode — done!
43
- ```
23
+ <br>
44
24
 
45
25
  ---
46
26
 
47
- ## Model Configuration
27
+ <br>
48
28
 
49
- Cortex agents are **model-agnostic**. You choose which models to use by running the interactive configure command:
29
+ ## Why Cortex Agents?
50
30
 
51
- ```bash
52
- npx cortex-agents configure
53
- ```
31
+ AI coding assistants are powerful, but without structure they produce inconsistent results. **Cortex Agents** adds the missing layer: a complete development workflow that turns OpenCode into a disciplined engineering partner.
54
32
 
55
- You'll be prompted to select:
33
+ - **Before**: AI writes code wherever, no branching discipline, no documentation, no plan.
34
+ - **After**: AI checks git status, asks about branching strategy, loads implementation plans, creates docs with architecture diagrams, commits cleanly, and opens PRs.
56
35
 
57
- 1. **Primary model** — for `build`, `plan`, and `debug` agents (complex tasks)
58
- 2. **Subagent model** — for `fullstack`, `testing`, `security`, and `devops` agents (focused tasks)
36
+ <br>
59
37
 
60
- ### Example
38
+ ## Quick Start
61
39
 
40
+ ```bash
41
+ npx cortex-agents install # Add plugin + agents + skills
42
+ npx cortex-agents configure # Pick your models interactively
43
+ # Restart OpenCode - done.
62
44
  ```
63
- $ npx cortex-agents configure
64
45
 
65
- 🔧 Cortex Agents Model Configuration
46
+ That's it. Your OpenCode session now has 7 specialized agents, 22 tools, and 14 domain skills.
66
47
 
67
- Primary agents (build, plan, debug) handle complex tasks.
68
- Use your best available model.
48
+ <br>
69
49
 
70
- ? Select model for PRIMARY agents:
71
- ❯ Claude Sonnet 4 (anthropic) Best balance of intelligence and speed
72
- Claude Opus 4 (anthropic) Most capable, best for complex architecture
73
- GPT-4.1 (openai) Fast multimodal model
74
- o3 (openai) Advanced reasoning model
75
- Gemini 2.5 Pro (google) Large context window, strong reasoning
76
- Kimi K2P5 (kimi) Optimized for code generation
77
- Enter custom model ID
50
+ ## What It Does
78
51
 
79
- Primary model: anthropic/claude-sonnet-4-20250514
80
-
81
- ? Select model for SUBAGENTS:
82
- ❯ Claude 3.5 Haiku (anthropic) Fast and cost-effective for focused tasks
83
- o4 Mini (openai) Fast reasoning, cost-effective
84
- Gemini 2.5 Flash (google) Fast and efficient
85
- Same as primary
86
- Enter custom model ID
52
+ ### Plan, Build, Ship
87
53
 
88
- Subagent model: anthropic/claude-haiku-3.5
54
+ Cortex agents follow a structured workflow from planning through to PR:
89
55
 
90
- ✓ Configuration saved to ~/.config/opencode/opencode.json
91
56
  ```
57
+ You: "Add user authentication"
92
58
 
93
- ### Supported Providers
94
-
95
- | Provider | Premium | Standard | Fast |
96
- |----------|---------|----------|------|
97
- | **Anthropic** | Claude Opus 4 | Claude Sonnet 4 | Claude 3.5 Haiku |
98
- | **OpenAI** | o3 | GPT-4.1 | o4 Mini |
99
- | **Google** | Gemini 2.5 Pro | — | Gemini 2.5 Flash |
100
- | **xAI** | Grok 3 | — | Grok 3 Mini |
101
- | **DeepSeek** | DeepSeek R1 | — | DeepSeek Chat |
102
- | **Kimi** | — | Kimi K2P5 | — |
103
-
104
- > Don't see your provider? Select **"Enter custom model ID"** and enter any `provider/model` identifier.
105
-
106
- ### Reconfigure or Reset
107
-
108
- ```bash
109
- # Change models at any time
110
- npx cortex-agents configure
59
+ Plan Agent reads codebase, creates plan with mermaid diagrams
60
+ saves to .cortex/plans/ "Plan saved. Switch to Build?"
111
61
 
112
- # Reset to OpenCode defaults (removes model config)
113
- npx cortex-agents configure --reset
62
+ Build Agent loads plan, checks git status
63
+ "You're on main. Create a branch two-step prompt: strategy -> execution
64
+ or worktree?"
65
+ creates feature/user-auth implements following the plan
66
+ "Ready to finalize?" stages, commits, pushes, opens PR
114
67
  ```
115
68
 
116
- ---
117
-
118
- ## Features
69
+ ### Worktree Launcher
119
70
 
120
- - 🤖 **Model-Agnostic** Works with any provider: Anthropic, OpenAI, Google, xAI, DeepSeek, Kimi, and more
121
- - 🔧 **Interactive Configuration** — `npx cortex-agents configure` to select models with arrow-key menus
122
- - 🔔 **Agent Handover Notifications** — Toast notifications when agents switch, so you always know which mode you're in
123
- - 📄 **Mermaid Documentation System** — Auto-prompted docs with architecture diagrams for decisions, features, and flows
124
- - 🌳 **Worktree Workflow** — Create isolated development environments with git worktrees
125
- - 📋 **Plan Persistence** — Save implementation plans with mermaid diagrams to `.cortex/plans/`
126
- - 📝 **Session Management** — Record key decisions and context in `.cortex/sessions/`
127
- - 🔄 **Pre-Implementation Workflow** — Agents ask about branch/worktree strategy before making changes
128
- - 🎯 **Agent Handoff** — Seamless transition between Plan → Build → Debug agents
129
- - 📚 **Skills System** — Domain-specific knowledge for web dev, testing, security, and more
71
+ Create isolated development environments and launch them instantly:
130
72
 
131
- ---
73
+ | Mode | What Happens |
74
+ |------|-------------|
75
+ | **New Terminal** | Opens a new terminal tab with OpenCode pre-configured in the worktree |
76
+ | **In-App PTY** | Spawns an embedded terminal inside your current OpenCode session |
77
+ | **Background** | AI implements headlessly while you keep working - toast notifications on completion |
132
78
 
133
- ## Installation
79
+ Plans are automatically propagated into the worktree's `.cortex/plans/` so the new session has full context.
134
80
 
135
- ### Option 1: Add to OpenCode Config (Recommended)
81
+ ### Task Finalizer
136
82
 
137
- Add the plugin to your `opencode.json`:
83
+ One tool to close the loop:
138
84
 
139
- ```json
140
- {
141
- "$schema": "https://opencode.ai/config.json",
142
- "plugin": ["cortex-agents"]
143
- }
144
85
  ```
145
-
146
- Then configure your models:
147
-
148
- ```bash
149
- npx cortex-agents configure
86
+ task_finalize
87
+ git add -A
88
+ git commit -m "feat: add user auth"
89
+ git push -u origin feature/user-auth
90
+ gh pr create --base main auto-detected if in worktree
91
+ PR body auto-populated from .cortex/plans/
92
+ "PR created! Clean up worktree?"
150
93
  ```
151
94
 
152
- ### Option 2: Use the CLI Helper
95
+ ### Auto-Prompted Documentation
153
96
 
154
- ```bash
155
- # Install and configure
156
- npx cortex-agents install
157
- npx cortex-agents configure
158
- ```
97
+ After every task, agents prompt you to document what you built:
159
98
 
160
- ### Option 3: Global npm Install
99
+ | Type | What's Generated | Includes |
100
+ |------|-----------------|----------|
101
+ | **Decision** | Architecture Decision Record | Mermaid graph comparing options |
102
+ | **Feature** | Feature documentation | Mermaid component diagram |
103
+ | **Flow** | Process/data flow doc | Mermaid sequence diagram |
161
104
 
162
- ```bash
163
- npm install -g cortex-agents
164
- cortex-agents install
165
- cortex-agents configure
166
- ```
167
-
168
- ---
169
-
170
- ## CLI Commands
171
-
172
- ```bash
173
- npx cortex-agents install # Add plugin to opencode.json
174
- npx cortex-agents configure # Interactive model selection
175
- npx cortex-agents configure --reset # Reset to OpenCode default models
176
- npx cortex-agents uninstall # Remove plugin, agents, skills, and model config
177
- npx cortex-agents status # Show installation and model status
178
- npx cortex-agents help # Show help
179
- ```
105
+ All docs are saved to `docs/` with an auto-generated `INDEX.md`.
180
106
 
181
- ---
107
+ <br>
182
108
 
183
109
  ## Agents
184
110
 
185
111
  ### Primary Agents
186
112
 
187
- These agents handle complex tasks and use your **primary model**:
113
+ Handle complex, multi-step work. Use your best model.
188
114
 
189
- | Agent | Description | Best For |
190
- |-------|-------------|----------|
191
- | **build** | Full-access development with branch/worktree workflow | Implementing features, refactoring |
192
- | **plan** | Read-only analysis with plan persistence and handoff | Architecture decisions, complex planning |
193
- | **debug** | Deep troubleshooting with hotfix workflow | Bug fixes, production issues |
115
+ | Agent | Role | Superpower |
116
+ |-------|------|-----------|
117
+ | **build** | Full-access development | Two-step branching strategy, worktree launcher, task finalizer, docs prompting |
118
+ | **plan** | Read-only analysis | Creates implementation plans with mermaid diagrams, hands off to build |
119
+ | **debug** | Deep troubleshooting | Full bash/edit access with hotfix workflow |
194
120
 
195
- ### Subagents (@mention)
121
+ ### Subagents
196
122
 
197
- These agents handle focused tasks and use your **subagent model**:
123
+ Focused specialists. Invoked with `@mention`. Use a fast/cheap model.
198
124
 
199
- | Agent | Description |
200
- |-------|-------------|
201
- | **@fullstack** | End-to-end feature implementation across frontend and backend |
202
- | **@testing** | Test writing, coverage analysis, and test strategy |
203
- | **@security** | Security audit and vulnerability detection |
204
- | **@devops** | CI/CD pipelines and deployment automation |
125
+ | Agent | Role |
126
+ |-------|------|
127
+ | **@fullstack** | End-to-end feature implementation across frontend + backend |
128
+ | **@testing** | Test writing, coverage analysis, TDD workflow |
129
+ | **@security** | Vulnerability scanning, secure coding review |
130
+ | **@devops** | CI/CD pipelines, Docker, deployment automation |
205
131
 
206
- ---
132
+ <br>
207
133
 
208
134
  ## Tools
209
135
 
210
- All tools are bundled with the plugin and available automatically.
211
-
212
- ### Cortex Management
213
- - `cortex_init` - Initialize `.cortex` directory with config and templates
214
- - `cortex_status` - Check cortex status (exists, plan count, session count)
215
-
216
- ### Worktree Management
217
- - `worktree_create <name> <type>` - Create worktree in `../.worktrees/`
218
- - `worktree_list` - List all worktrees
219
- - `worktree_remove <name>` - Remove worktree (after merging)
220
- - `worktree_open <name>` - Get command to open terminal in worktree
221
-
222
- ### Branch Management
223
- - `branch_create <name> <type>` - Create feature/bugfix/hotfix/refactor/docs/test branch
224
- - `branch_status` - Get current branch, check for uncommitted changes, detect protected branches
225
- - `branch_switch <branch>` - Switch to existing branch
136
+ 22 tools bundled and auto-registered. No configuration needed.
226
137
 
227
- ### Plan Management
228
- - `plan_save <title> <type> <content>` - Save plan to `.cortex/plans/`
229
- - `plan_list [type]` - List saved plans (optionally filter by type)
230
- - `plan_load <filename>` - Load a plan
231
- - `plan_delete <filename>` - Delete a plan
138
+ <table>
139
+ <tr><td width="50%">
232
140
 
233
- ### Session Management
234
- - `session_save <summary> [decisions]` - Save session summary with key decisions
235
- - `session_list [limit]` - List recent sessions
236
- - `session_load <filename>` - Load a session summary
141
+ **Git Workflow**
142
+ - `branch_status` - Current branch + change detection
143
+ - `branch_create` - Convention-named branches
144
+ - `branch_switch` - Safe branch switching
145
+ - `worktree_create` - Isolated worktree in `.worktrees/`
146
+ - `worktree_launch` - Launch worktree (terminal/PTY/background)
147
+ - `worktree_list` / `worktree_remove` / `worktree_open`
237
148
 
238
- ### Documentation
239
- - `docs_init [path]` - Initialize `docs/` directory with decisions, features, and flows folders
240
- - `docs_save <title> <type> <content>` - Save a documentation file with mermaid diagrams
241
- - `docs_list [type]` - List documentation files (filter by decision, feature, flow, or all)
242
- - `docs_index` - Rebuild `docs/INDEX.md` with links to all docs (auto-called by `docs_save`)
149
+ </td><td width="50%">
243
150
 
244
- ---
245
-
246
- ## Agent Handover Notifications
151
+ **Planning & Sessions**
152
+ - `plan_save` / `plan_load` / `plan_list` / `plan_delete`
153
+ - `session_save` / `session_list` / `session_load`
154
+ - `cortex_init` / `cortex_status`
247
155
 
248
- When agents switch (Plan → Build, Build → Debug, etc.), a **toast notification** appears automatically in the OpenCode TUI:
249
-
250
- ```
251
- ┌──────────────────────────────────┐
252
- │ Agent: build │
253
- │ Development mode — ready to │
254
- │ implement │
255
- └──────────────────────────────────┘
256
- ```
156
+ </td></tr>
157
+ <tr><td width="50%">
257
158
 
258
- This is fully automatic — no configuration needed. The plugin listens for agent switch events and displays the new agent's name and role context. Notifications last 4 seconds and cover all 7 agents (build, plan, debug, fullstack, testing, security, devops).
159
+ **Documentation**
160
+ - `docs_init` - Set up `docs/` structure
161
+ - `docs_save` - Save doc with mermaid diagrams
162
+ - `docs_list` - Browse all docs
163
+ - `docs_index` - Rebuild `docs/INDEX.md`
259
164
 
260
- ---
165
+ </td><td width="50%">
261
166
 
262
- ## Documentation System
167
+ **Finalization**
168
+ - `task_finalize` - Stage, commit, push, create PR
169
+ - Auto-detects worktree (targets main)
170
+ - Auto-populates PR from `.cortex/plans/`
171
+ - Warns if docs are missing
263
172
 
264
- After completing any task, primary agents (build, debug) prompt:
173
+ </td></tr>
174
+ </table>
265
175
 
266
- > **"Would you like to update project documentation?"**
176
+ <br>
267
177
 
268
- You can create three types of documents, each with a **mandatory mermaid diagram**:
178
+ ## Skills
269
179
 
270
- | Type | Template | Diagram Style | Use Case |
271
- |------|----------|---------------|----------|
272
- | **Decision** | ADR format (Context → Decision → Rationale → Consequences) | Graph (options comparison) | Architecture/technology choices |
273
- | **Feature** | Overview → Architecture → Components → Usage | Component diagram | New feature documentation |
274
- | **Flow** | Overview Flow Diagram Steps | Sequence diagram | Process/data flow documentation |
180
+ 14 domain-specific skill packs loaded on demand via the `skill` tool:
181
+
182
+ | Skill | Covers |
183
+ |-------|--------|
184
+ | **web-development** | Full-stack patterns, REST/GraphQL, SSR, state management |
185
+ | **frontend-development** | React, Vue, Svelte, CSS architecture, accessibility |
186
+ | **backend-development** | API design, middleware, auth, caching, queue systems |
187
+ | **mobile-development** | React Native, Flutter, native iOS/Android patterns |
188
+ | **desktop-development** | Electron, Tauri, native desktop application patterns |
189
+ | **database-design** | Schema design, migrations, indexing, query optimization |
190
+ | **api-design** | REST, GraphQL, gRPC, versioning, documentation |
191
+ | **testing-strategies** | Unit, integration, E2E, TDD, coverage strategies |
192
+ | **security-hardening** | OWASP, auth/authz, input validation, secure coding |
193
+ | **deployment-automation** | CI/CD, Docker, Kubernetes, cloud deployment |
194
+ | **architecture-patterns** | Microservices, monorepo, event-driven, CQRS |
195
+ | **design-patterns** | GoF patterns, SOLID principles, DDD |
196
+ | **performance-optimization** | Profiling, caching, lazy loading, bundle optimization |
197
+ | **code-quality** | Refactoring, linting, code review, maintainability |
198
+ | **git-workflow** | Branching strategies, worktrees, rebase vs merge |
199
+
200
+ <br>
275
201
 
276
- ### Setup
202
+ ## Model Configuration
277
203
 
278
- Documentation is initialized automatically when you first save a doc. You can also set it up manually:
204
+ Cortex agents are **model-agnostic**. Pick any provider:
279
205
 
206
+ ```bash
207
+ npx cortex-agents configure
280
208
  ```
281
- docs_init
282
- ```
283
-
284
- This creates:
285
209
 
286
210
  ```
287
- docs/
288
- ├── INDEX.md # Auto-generated index (rebuilt on every save)
289
- ├── decisions/ # Architecture Decision Records
290
- ├── features/ # Feature docs with component diagrams
291
- └── flows/ # Process/data flow docs with sequence diagrams
292
- ```
293
-
294
- ### Example: Decision Document
295
-
296
- ```markdown
297
- ---
298
- title: "Use OAuth2 for Authentication"
299
- type: decision
300
- date: 2026-02-22T10:30:00.000Z
301
- status: accepted
302
- tags: ["auth", "security"]
303
- related_files: ["src/auth.ts", "src/middleware/jwt.ts"]
304
- ---
211
+ ? Select model for PRIMARY agents:
212
+ Claude Sonnet 4 (anthropic) Best balance of intelligence and speed
213
+ Claude Opus 4 (anthropic) Most capable, best for complex architecture
214
+ GPT-4.1 (openai) Fast multimodal model
215
+ Gemini 2.5 Pro (google) Large context window, strong reasoning
216
+ Kimi K2P5 (kimi) Optimized for code generation
217
+ Enter custom model ID
305
218
 
306
- # Decision: Use OAuth2 for Authentication
219
+ ? Select model for SUBAGENTS:
220
+ Claude 3.5 Haiku (anthropic) Fast and cost-effective
221
+ o4 Mini (openai) Fast reasoning, cost-effective
222
+ Gemini 2.5 Flash (google) Fast and efficient
223
+ Same as primary
224
+ ```
307
225
 
308
- ## Context
309
- The application needs user authentication with third-party provider support.
226
+ ### Supported Providers
310
227
 
311
- ## Decision
312
- Use OAuth2 with JWT tokens for stateless authentication.
228
+ | Provider | Premium | Standard | Fast |
229
+ |----------|---------|----------|------|
230
+ | **Anthropic** | Claude Opus 4 | Claude Sonnet 4 | Claude 3.5 Haiku |
231
+ | **OpenAI** | o3 | GPT-4.1 | o4 Mini |
232
+ | **Google** | Gemini 2.5 Pro | - | Gemini 2.5 Flash |
233
+ | **xAI** | Grok 3 | - | Grok 3 Mini |
234
+ | **DeepSeek** | DeepSeek R1 | - | DeepSeek Chat |
235
+ | **Kimi** | - | Kimi K2P5 | - |
313
236
 
314
- ## Rationale
237
+ > Don't see your provider? Select **"Enter custom model ID"** and type any `provider/model` string.
315
238
 
316
- ​```mermaid
317
- graph TD
318
- A[OAuth2 + JWT] -->|Stateless, scalable| B[Selected ✓]
319
- C[Session-based auth] -->|Server state required| D[Rejected]
320
- E[API keys only] -->|No user identity| F[Rejected]
321
- ​```
239
+ <br>
322
240
 
323
- OAuth2 provides industry-standard authorization with broad provider support.
241
+ ## Project Structure
324
242
 
325
- ## Consequences
326
- - All API endpoints require JWT validation middleware
327
- - Token refresh logic needed on the frontend
243
+ ```
244
+ your-project/
245
+ .cortex/ Project context (auto-initialized)
246
+ config.json Configuration
247
+ plans/ Implementation plans (git tracked)
248
+ sessions/ Session summaries (gitignored)
249
+ .worktrees/ Git worktrees (gitignored)
250
+ feature-auth/ Isolated development copy
251
+ bugfix-login/
252
+ docs/ Documentation (git tracked)
253
+ INDEX.md Auto-generated index
254
+ decisions/ Architecture Decision Records
255
+ features/ Feature docs with diagrams
256
+ flows/ Process/data flow docs
328
257
  ```
329
258
 
330
- ### Auto-Generated Index
331
-
332
- Every time you save a document, `docs/INDEX.md` is automatically rebuilt with a table of all docs grouped by type:
333
-
334
- ```markdown
335
- # Project Documentation
259
+ <br>
336
260
 
337
- > Auto-generated by cortex-agents. Last updated: 2026-02-22
261
+ ## CLI Reference
338
262
 
339
- ## 📋 Decisions (2)
263
+ ```bash
264
+ npx cortex-agents install # Install plugin, agents, and skills
265
+ npx cortex-agents configure # Interactive model selection
266
+ npx cortex-agents configure --reset # Reset to OpenCode defaults
267
+ npx cortex-agents uninstall # Clean removal of everything
268
+ npx cortex-agents status # Show installation status
269
+ ```
340
270
 
341
- | Date | Title | Status | Tags |
342
- |------|-------|--------|------|
343
- | 2026-02-22 | [Use OAuth2](decisions/2026-02-22-use-oauth2.md) | accepted | auth, security |
271
+ <br>
344
272
 
345
- ## 🚀 Features (1)
273
+ ## How It Works
346
274
 
347
- | Date | Title | Status | Tags |
348
- |------|-------|--------|------|
349
- | 2026-02-22 | [User Auth](features/2026-02-22-user-auth.md) | implemented | auth |
275
+ ### The Build Agent Workflow
350
276
 
351
- ## 🔄 Flows (1)
277
+ Every time the build agent starts, it follows a structured pre-implementation checklist:
352
278
 
353
- | Date | Title | Tags |
354
- |------|-------|------|
355
- | 2026-02-22 | [Login Flow](flows/2026-02-22-login-flow.md) | auth |
279
+ ```
280
+ Step 1 branch_status Am I on a protected branch?
281
+ Step 2 cortex_status Is .cortex initialized?
282
+ Step 3 plan_list / plan_load Is there a plan for this work?
283
+ Step 4 Ask: strategy Branch or worktree?
284
+ Step 4b Ask: launch mode Stay / terminal / PTY / background?
285
+ Step 5 Execute Create branch or launch worktree
286
+ Step 6 Implement Write code following the plan
287
+ Step 7 Ask: documentation Decision doc / feature doc / flow doc?
288
+ Step 8 session_save Record what was done and why
289
+ Step 9 task_finalize Commit, push, create PR
290
+ Step 10 Ask: cleanup Remove worktree? (if applicable)
356
291
  ```
357
292
 
358
- ---
293
+ This isn't just documentation - it's enforced by the agent's instructions. The AI follows this workflow every time.
359
294
 
360
- ## Skills
295
+ ### Agent Handover
361
296
 
362
- Load domain-specific knowledge with the `skill` tool:
297
+ When agents switch, a toast notification tells you what mode you're in:
363
298
 
364
- | Skill | Description |
365
- |-------|-------------|
366
- | **git-workflow** | Branching strategies, worktree management, collaborative workflows |
367
- | **web-development** | Full-stack patterns and best practices |
368
- | **testing-strategies** | Comprehensive testing approaches |
369
- | **security-hardening** | Security best practices and patterns |
370
- | **deployment-automation** | CI/CD pipelines and infrastructure |
371
- | **code-quality** | Refactoring patterns and maintainability |
299
+ ```
300
+ Agent: build Development mode - ready to implement
301
+ Agent: plan Planning mode - read-only analysis
302
+ Agent: debug Debug mode - troubleshooting and fixes
303
+ ```
372
304
 
373
- ---
305
+ The Plan agent creates plans with mermaid diagrams and hands off to Build. Build loads the plan and implements it. If something breaks, Debug takes over with full access.
374
306
 
375
- ## Workflow Example
307
+ <br>
376
308
 
377
- ### Feature Development
309
+ ## Requirements
378
310
 
379
- ```
380
- User: "I want to add user authentication"
381
-
382
- Plan Agent:
383
- ├── Analyzes codebase structure
384
- ├── Creates implementation plan with mermaid diagrams
385
- ├── Saves to .cortex/plans/2024-02-22-feature-user-auth.md
386
- └── Asks: "Plan saved. Switch to Build agent?"
387
-
388
- User: "Yes"
389
-
390
- Build Agent: 🔔 Toast: "Agent: build — Development mode"
391
- ├── Loads plan from .cortex/plans/
392
- ├── Checks git status (detects protected branch)
393
- ├── Asks: "Create branch or worktree?"
394
- ├── Creates feature/user-authentication
395
- ├── Implements following the plan
396
- ├── Saves session summary with key decisions
397
- ├── Asks: "Update project documentation?"
398
- └── Saves feature doc with mermaid architecture diagram
399
- ```
311
+ - [OpenCode](https://opencode.ai) >= 1.0.0
312
+ - Node.js >= 18.0.0
313
+ - Git (for branch/worktree features)
314
+ - [GitHub CLI](https://cli.github.com/) (optional, for `task_finalize` PR creation)
400
315
 
401
- ---
316
+ <br>
402
317
 
403
- ## Configuration
404
-
405
- ### opencode.json (after running `configure`)
406
-
407
- ```json
408
- {
409
- "$schema": "https://opencode.ai/config.json",
410
- "plugin": ["cortex-agents"],
411
- "agent": {
412
- "build": { "model": "anthropic/claude-sonnet-4-20250514" },
413
- "plan": { "model": "anthropic/claude-sonnet-4-20250514" },
414
- "debug": { "model": "anthropic/claude-sonnet-4-20250514" },
415
- "fullstack": { "model": "anthropic/claude-haiku-3.5" },
416
- "testing": { "model": "anthropic/claude-haiku-3.5" },
417
- "security": { "model": "anthropic/claude-haiku-3.5" },
418
- "devops": { "model": "anthropic/claude-haiku-3.5" }
419
- }
420
- }
421
- ```
318
+ ## Contributing
422
319
 
423
- > Power users can edit `opencode.json` directly for per-agent model control.
320
+ Contributions are welcome! This is an Apache-2.0 licensed project and we'd love your help.
424
321
 
425
- ### .cortex Directory
322
+ ### Getting Started
426
323
 
427
- ```
428
- <project-root>/
429
- ├── .cortex/
430
- │ ├── config.json # Project configuration
431
- │ ├── .gitignore # Ignores sessions/, keeps plans/
432
- │ ├── plans/ # Implementation plans (git tracked)
433
- │ │ └── YYYY-MM-DD-type-slug.md
434
- │ └── sessions/ # Session summaries (gitignored)
435
- │ └── YYYY-MM-DD-session-id.md
436
- └── docs/ # Project documentation (git tracked)
437
- ├── INDEX.md # Auto-generated index
438
- ├── decisions/ # Architecture Decision Records
439
- ├── features/ # Feature docs with diagrams
440
- └── flows/ # Process/data flow docs
324
+ ```bash
325
+ git clone https://github.com/ps-carvalho/cortex-agents.git
326
+ cd cortex-agents
327
+ npm install
328
+ npm run build
441
329
  ```
442
330
 
443
- ---
331
+ ### Development Workflow
444
332
 
445
- ## Branch Naming Convention
446
-
447
- | Type | Prefix | Example |
448
- |------|--------|---------|
449
- | Feature | `feature/` | `feature/user-authentication` |
450
- | Bugfix | `bugfix/` | `bugfix/login-validation` |
451
- | Hotfix | `hotfix/` | `hotfix/security-patch` |
452
- | Refactor | `refactor/` | `refactor/api-cleanup` |
453
- | Docs | `docs/` | `docs/api-reference` |
454
- | Test | `test/` | `test/e2e-coverage` |
455
-
456
- ---
333
+ ```bash
334
+ # Link for local testing
335
+ npm link
336
+ cd ~/.config/opencode && npm link cortex-agents
457
337
 
458
- ## Requirements
338
+ # Make changes, rebuild, restart OpenCode
339
+ npm run build
459
340
 
460
- - **OpenCode**: >= 1.0.0
461
- - **Node.js**: >= 18.0.0
462
- - **Git**: For branch and worktree features
341
+ # Unlink when done
342
+ cd ~/.config/opencode && npm unlink cortex-agents && npm install
343
+ ```
463
344
 
464
- ---
345
+ ### What We're Looking For
465
346
 
466
- ## Contributing
347
+ - **New skills** - Domain-specific knowledge packs (e.g., Rust, Go, DevOps for AWS)
348
+ - **New agents** - Specialized agents (e.g., reviewer, migration, docs-writer)
349
+ - **Platform support** - Improve terminal detection for Linux/Windows
350
+ - **Tool improvements** - Better PR templates, test runners, linter integration
351
+ - **Bug fixes** - Anything that doesn't work as expected
467
352
 
468
- Contributions are welcome! Please feel free to submit a Pull Request.
353
+ ### Submitting Changes
469
354
 
470
355
  1. Fork the repository
471
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
472
- 3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
473
- 4. Push to the branch (`git push origin feature/amazing-feature`)
474
- 5. Open a Pull Request
356
+ 2. Create your branch (`git checkout -b feature/amazing-feature`)
357
+ 3. Commit with conventional format (`git commit -m 'feat: add amazing feature'`)
358
+ 4. Push and open a Pull Request
475
359
 
476
- ---
360
+ <br>
477
361
 
478
362
  ## License
479
363
 
480
- [Apache-2.0](LICENSE) © OpenCode Contributors
364
+ [Apache-2.0](LICENSE)
481
365
 
482
- ---
366
+ <br>
483
367
 
484
368
  <p align="center">
485
- Built for the <a href="https://opencode.ai">OpenCode</a> community
369
+ <sub>Built for the <a href="https://opencode.ai">OpenCode</a> community</sub>
486
370
  </p>