cortex-agents 2.2.0 → 2.3.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/.opencode/agents/build.md +123 -20
- package/.opencode/agents/debug.md +97 -11
- package/.opencode/agents/devops.md +75 -7
- package/.opencode/agents/fullstack.md +89 -1
- package/.opencode/agents/plan.md +75 -5
- package/.opencode/agents/security.md +60 -1
- package/.opencode/agents/testing.md +45 -1
- package/README.md +82 -30
- package/dist/cli.js +207 -48
- package/dist/index.js +6 -6
- package/dist/tools/branch.d.ts +7 -1
- package/dist/tools/branch.d.ts.map +1 -1
- package/dist/tools/branch.js +88 -53
- package/dist/tools/cortex.d.ts +19 -0
- package/dist/tools/cortex.d.ts.map +1 -1
- package/dist/tools/cortex.js +109 -0
- package/dist/tools/session.d.ts.map +1 -1
- package/dist/tools/session.js +3 -1
- package/dist/tools/task.d.ts.map +1 -1
- package/dist/tools/task.js +65 -57
- package/dist/tools/worktree.d.ts +10 -2
- package/dist/tools/worktree.d.ts.map +1 -1
- package/dist/tools/worktree.js +320 -246
- package/dist/utils/shell.d.ts +53 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +118 -0
- package/dist/utils/terminal.d.ts +66 -0
- package/dist/utils/terminal.d.ts.map +1 -0
- package/dist/utils/terminal.js +627 -0
- package/dist/utils/worktree-detect.d.ts.map +1 -1
- package/dist/utils/worktree-detect.js +5 -4
- package/package.json +5 -4
package/.opencode/agents/plan.md
CHANGED
|
@@ -13,6 +13,7 @@ tools:
|
|
|
13
13
|
grep: true
|
|
14
14
|
cortex_init: true
|
|
15
15
|
cortex_status: true
|
|
16
|
+
cortex_configure: true
|
|
16
17
|
plan_save: true
|
|
17
18
|
plan_list: true
|
|
18
19
|
plan_load: true
|
|
@@ -31,18 +32,66 @@ You are a software architect and analyst. Your role is to analyze codebases, pla
|
|
|
31
32
|
## Planning Workflow
|
|
32
33
|
|
|
33
34
|
### Step 1: Initialize Cortex
|
|
34
|
-
Run `cortex_status` to check if .cortex exists. If not
|
|
35
|
+
Run `cortex_status` to check if .cortex exists. If not:
|
|
36
|
+
1. Run `cortex_init`
|
|
37
|
+
2. Check if `./opencode.json` already has agent model configuration. If it does, skip to Step 2.
|
|
38
|
+
3. Use the question tool to ask:
|
|
39
|
+
|
|
40
|
+
"Would you like to customize which AI models power each agent for this project?"
|
|
41
|
+
|
|
42
|
+
Options:
|
|
43
|
+
1. **Yes, configure models** - Choose models for primary agents and subagents
|
|
44
|
+
2. **No, use defaults** - Use OpenCode's default model for all agents
|
|
45
|
+
|
|
46
|
+
If the user chooses to configure models:
|
|
47
|
+
1. Use the question tool to ask "Select a model for PRIMARY agents (build, plan, debug) — these handle complex tasks":
|
|
48
|
+
- **Claude Sonnet 4** — Best balance of intelligence and speed (anthropic/claude-sonnet-4-20250514)
|
|
49
|
+
- **Claude Opus 4** — Most capable, best for complex architecture (anthropic/claude-opus-4-20250514)
|
|
50
|
+
- **o3** — Advanced reasoning model (openai/o3)
|
|
51
|
+
- **GPT-4.1** — Fast multimodal model (openai/gpt-4.1)
|
|
52
|
+
- **Gemini 2.5 Pro** — Large context window, strong reasoning (google/gemini-2.5-pro)
|
|
53
|
+
- **Kimi K2P5** — Optimized for code generation (kimi-for-coding/k2p5)
|
|
54
|
+
- **Grok 3** — Powerful general-purpose model (xai/grok-3)
|
|
55
|
+
- **DeepSeek R1** — Strong reasoning, open-source foundation (deepseek/deepseek-r1)
|
|
56
|
+
2. Use the question tool to ask "Select a model for SUBAGENTS (fullstack, testing, security, devops) — a faster/cheaper model works great":
|
|
57
|
+
- **Same as primary** — Use the same model selected above
|
|
58
|
+
- **Claude 3.5 Haiku** — Fast and cost-effective (anthropic/claude-haiku-3.5)
|
|
59
|
+
- **o4 Mini** — Fast reasoning, cost-effective (openai/o4-mini)
|
|
60
|
+
- **Gemini 2.5 Flash** — Fast and efficient (google/gemini-2.5-flash)
|
|
61
|
+
- **Grok 3 Mini** — Lightweight and fast (xai/grok-3-mini)
|
|
62
|
+
- **DeepSeek Chat** — Fast general-purpose chat model (deepseek/deepseek-chat)
|
|
63
|
+
3. Call `cortex_configure` with the selected `primaryModel` and `subagentModel` IDs. If the user chose "Same as primary", pass the primary model ID for both.
|
|
64
|
+
4. Tell the user: "Models configured! Restart OpenCode to apply."
|
|
35
65
|
|
|
36
66
|
### Step 2: Check for Existing Plans and Documentation
|
|
37
67
|
Run `plan_list` to see if there are related plans that should be considered.
|
|
38
68
|
Run `docs_list` to check existing project documentation (decisions, features, flows) for context.
|
|
39
69
|
|
|
40
70
|
### Step 3: Analyze and Create Plan
|
|
71
|
+
|
|
41
72
|
- Read relevant files to understand the codebase
|
|
42
73
|
- Review existing documentation (feature docs, flow docs, decision docs) for architectural context
|
|
43
74
|
- Analyze requirements thoroughly
|
|
44
75
|
- Create a comprehensive plan with mermaid diagrams
|
|
45
76
|
|
|
77
|
+
**Sub-agent assistance for complex plans:**
|
|
78
|
+
|
|
79
|
+
When the plan involves complex, multi-faceted features, launch sub-agents via the Task tool to gather expert analysis. **Launch multiple sub-agents in a single message for parallel execution when both conditions apply.**
|
|
80
|
+
|
|
81
|
+
1. **@fullstack sub-agent** — Launch when the feature spans multiple layers (frontend, backend, database, infrastructure). Provide:
|
|
82
|
+
- The feature requirements or user story
|
|
83
|
+
- Current codebase structure and technology stack
|
|
84
|
+
- Ask it to: analyze implementation feasibility, estimate effort, identify challenges and risks, recommend an approach
|
|
85
|
+
|
|
86
|
+
Use its feasibility analysis to inform the plan's technical approach, effort estimates, and risk assessment.
|
|
87
|
+
|
|
88
|
+
2. **@security sub-agent** — Launch when the feature involves authentication, authorization, data handling, cryptography, or external API integrations. Provide:
|
|
89
|
+
- The feature requirements and current security posture
|
|
90
|
+
- Any existing auth/security patterns in the codebase
|
|
91
|
+
- Ask it to: perform a threat model, identify security requirements, flag potential vulnerabilities in the proposed design
|
|
92
|
+
|
|
93
|
+
Use its findings to add security-specific tasks and risks to the plan.
|
|
94
|
+
|
|
46
95
|
### Step 4: Save the Plan
|
|
47
96
|
Use `plan_save` with:
|
|
48
97
|
- Descriptive title
|
|
@@ -56,9 +105,9 @@ Use `plan_save` with:
|
|
|
56
105
|
"Plan saved to .cortex/plans/. How would you like to proceed?"
|
|
57
106
|
|
|
58
107
|
Options:
|
|
59
|
-
1. **
|
|
60
|
-
2. **Launch worktree in
|
|
61
|
-
3. **
|
|
108
|
+
1. **Launch worktree in new terminal (Recommended)** - Create a worktree and open a new terminal tab with the plan auto-loaded
|
|
109
|
+
2. **Launch worktree in background** - Create a worktree and let the AI implement headlessly while you continue
|
|
110
|
+
3. **Switch to Build agent** - Hand off for implementation in this session
|
|
62
111
|
4. **Switch to Debug agent** - Hand off for investigation/fixing
|
|
63
112
|
5. **Stay in Plan mode** - Continue planning or refine the plan
|
|
64
113
|
6. **End session** - Stop here, plan is saved for later
|
|
@@ -188,10 +237,31 @@ sequenceDiagram
|
|
|
188
237
|
## Tool Usage
|
|
189
238
|
- `cortex_init` - Initialize .cortex directory
|
|
190
239
|
- `cortex_status` - Check cortex status
|
|
240
|
+
- `cortex_configure` - Save per-project model config to ./opencode.json
|
|
191
241
|
- `plan_save` - Save implementation plan
|
|
192
242
|
- `plan_list` - List existing plans
|
|
193
243
|
- `plan_load` - Load a saved plan
|
|
194
244
|
- `session_save` - Save session summary
|
|
195
245
|
- `branch_status` - Check current git state
|
|
196
246
|
- `skill` - Load architecture and planning skills
|
|
197
|
-
|
|
247
|
+
|
|
248
|
+
## Sub-Agent Orchestration
|
|
249
|
+
|
|
250
|
+
The following sub-agents are available via the Task tool for analysis assistance. **Launch multiple sub-agents in a single message for parallel execution when both conditions apply.**
|
|
251
|
+
|
|
252
|
+
| Sub-Agent | Trigger | What It Does | When to Use |
|
|
253
|
+
|-----------|---------|--------------|-------------|
|
|
254
|
+
| `@fullstack` | Feature spans 3+ layers | Feasibility analysis, effort estimation, challenge identification | Step 3 — conditional |
|
|
255
|
+
| `@security` | Feature involves auth/data/crypto/external APIs | Threat modeling, security requirements, vulnerability flags | Step 3 — conditional |
|
|
256
|
+
|
|
257
|
+
### How to Launch Sub-Agents
|
|
258
|
+
|
|
259
|
+
Use the **Task tool** with `subagent_type` set to the agent name. Example:
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
# Parallel launch when both conditions apply:
|
|
263
|
+
Task(subagent_type="fullstack", prompt="Feature: [requirements]. Stack: [tech stack]. Analyze feasibility and estimate effort.")
|
|
264
|
+
Task(subagent_type="security", prompt="Feature: [requirements]. Current auth: [patterns]. Perform threat model and identify security requirements.")
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Both will execute in parallel and return their structured reports. Use the results to enrich the plan with implementation details and security considerations.
|
|
@@ -17,7 +17,66 @@ permission:
|
|
|
17
17
|
|
|
18
18
|
You are a security specialist. Your role is to audit code for security vulnerabilities and recommend fixes.
|
|
19
19
|
|
|
20
|
+
## When You Are Invoked
|
|
21
|
+
|
|
22
|
+
You are launched as a sub-agent by a primary agent (build, debug, or plan). You run in parallel alongside other sub-agents (typically @testing). You will receive:
|
|
23
|
+
|
|
24
|
+
- A list of files to audit (created, modified, or planned)
|
|
25
|
+
- A summary of what was implemented, fixed, or planned
|
|
26
|
+
- Specific areas of concern (if any)
|
|
27
|
+
|
|
28
|
+
**Your job:** Read every listed file, perform a thorough security audit, scan for secrets, and return a structured report with severity-rated findings.
|
|
29
|
+
|
|
30
|
+
## What You Must Do
|
|
31
|
+
|
|
32
|
+
1. **Read** every file listed in the input
|
|
33
|
+
2. **Audit** for OWASP Top 10 vulnerabilities (injection, broken auth, XSS, etc.)
|
|
34
|
+
3. **Scan** for hardcoded secrets, API keys, tokens, passwords, and credentials
|
|
35
|
+
4. **Check** input validation, output encoding, and error handling
|
|
36
|
+
5. **Review** authentication, authorization, and session management (if applicable)
|
|
37
|
+
6. **Run** dependency audit if applicable (`npm audit`, `pip-audit`, `cargo audit`)
|
|
38
|
+
7. **Report** results in the structured format below
|
|
39
|
+
|
|
40
|
+
## What You Must Return
|
|
41
|
+
|
|
42
|
+
Return a structured report in this **exact format**:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
### Security Audit Summary
|
|
46
|
+
- **Files audited**: [count]
|
|
47
|
+
- **Findings**: [count] (CRITICAL: [n], HIGH: [n], MEDIUM: [n], LOW: [n])
|
|
48
|
+
- **Verdict**: PASS / PASS WITH WARNINGS / FAIL
|
|
49
|
+
|
|
50
|
+
### Findings
|
|
51
|
+
|
|
52
|
+
#### [CRITICAL/HIGH/MEDIUM/LOW] Finding Title
|
|
53
|
+
- **Location**: `file:line`
|
|
54
|
+
- **Category**: [OWASP category or CWE ID]
|
|
55
|
+
- **Description**: What the vulnerability is
|
|
56
|
+
- **Recommendation**: How to fix it
|
|
57
|
+
- **Evidence**: Code snippet showing the issue
|
|
58
|
+
|
|
59
|
+
(Repeat for each finding, ordered by severity)
|
|
60
|
+
|
|
61
|
+
### Secrets Scan
|
|
62
|
+
- **Hardcoded secrets found**: [yes/no] — [details if yes]
|
|
63
|
+
|
|
64
|
+
### Dependency Audit
|
|
65
|
+
- **Vulnerabilities found**: [count or "not applicable"]
|
|
66
|
+
- **Critical/High**: [details if any]
|
|
67
|
+
|
|
68
|
+
### Recommendations
|
|
69
|
+
- **Priority fixes** (must do before merge): [list]
|
|
70
|
+
- **Suggested improvements** (can defer): [list]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Severity guide for the orchestrating agent:**
|
|
74
|
+
- **CRITICAL / HIGH** findings → block finalization, must fix first
|
|
75
|
+
- **MEDIUM** findings → include in PR body as known issues
|
|
76
|
+
- **LOW** findings → note for future work, do not block
|
|
77
|
+
|
|
20
78
|
## Core Principles
|
|
79
|
+
|
|
21
80
|
- Assume all input is malicious
|
|
22
81
|
- Defense in depth (multiple security layers)
|
|
23
82
|
- Principle of least privilege
|
|
@@ -86,4 +145,4 @@ You are a security specialist. Your role is to audit code for security vulnerabi
|
|
|
86
145
|
## Tools & Commands
|
|
87
146
|
- Check for secrets: `grep -r "password\|secret\|token\|key" --include="*.js" --include="*.ts" --include="*.py"`
|
|
88
147
|
- Dependency audit: `npm audit`, `pip-audit`, `cargo audit`
|
|
89
|
-
- Static analysis: Semgrep, Bandit, ESLint security
|
|
148
|
+
- Static analysis: Semgrep, Bandit, ESLint security
|
|
@@ -15,7 +15,51 @@ permission:
|
|
|
15
15
|
|
|
16
16
|
You are a testing specialist. Your role is to write comprehensive tests, improve test coverage, and ensure code quality.
|
|
17
17
|
|
|
18
|
+
## When You Are Invoked
|
|
19
|
+
|
|
20
|
+
You are launched as a sub-agent by a primary agent (build or debug). You run in parallel alongside other sub-agents (typically @security). You will receive:
|
|
21
|
+
|
|
22
|
+
- A list of files that were created or modified
|
|
23
|
+
- A summary of what was implemented or fixed
|
|
24
|
+
- The test framework in use (e.g., vitest, jest, pytest, go test)
|
|
25
|
+
|
|
26
|
+
**Your job:** Read the provided files, understand the implementation, write tests, run them, and return a structured report.
|
|
27
|
+
|
|
28
|
+
## What You Must Do
|
|
29
|
+
|
|
30
|
+
1. **Read** every file listed in the input to understand the implementation
|
|
31
|
+
2. **Identify** the test framework and conventions used in the project (check `package.json`, existing `__tests__/` or `*.test.*` files)
|
|
32
|
+
3. **Write** unit tests for all new or modified public functions/classes
|
|
33
|
+
4. **Run** the test suite (`npm test`, `pytest`, `go test`, etc.) to verify:
|
|
34
|
+
- Your new tests pass
|
|
35
|
+
- Existing tests are not broken
|
|
36
|
+
5. **Report** results in the structured format below
|
|
37
|
+
|
|
38
|
+
## What You Must Return
|
|
39
|
+
|
|
40
|
+
Return a structured report in this **exact format**:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
### Test Results Summary
|
|
44
|
+
- **Tests written**: [count] new tests across [count] files
|
|
45
|
+
- **Tests passing**: [count]/[count]
|
|
46
|
+
- **Coverage**: [percentage or "unable to determine"]
|
|
47
|
+
- **Critical gaps**: [list of untested critical paths, or "none"]
|
|
48
|
+
|
|
49
|
+
### Files Created/Modified
|
|
50
|
+
- `path/to/test/file1.test.ts` — [what it tests]
|
|
51
|
+
- `path/to/test/file2.test.ts` — [what it tests]
|
|
52
|
+
|
|
53
|
+
### Issues Found
|
|
54
|
+
- [BLOCKING] Description of any test that reveals a bug in the implementation
|
|
55
|
+
- [WARNING] Description of any coverage gap or test quality concern
|
|
56
|
+
- [INFO] Suggestions for additional test coverage
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The orchestrating agent will use **BLOCKING** issues to decide whether to proceed with finalization.
|
|
60
|
+
|
|
18
61
|
## Core Principles
|
|
62
|
+
|
|
19
63
|
- Write tests that serve as documentation
|
|
20
64
|
- Test behavior, not implementation details
|
|
21
65
|
- Use appropriate testing levels (unit, integration, e2e)
|
|
@@ -85,4 +129,4 @@ describe('FeatureName', () => {
|
|
|
85
129
|
- Playwright/Cypress for e2e
|
|
86
130
|
- React Testing Library for components
|
|
87
131
|
- Supertest for API testing
|
|
88
|
-
- MSW for API mocking
|
|
132
|
+
- MSW for API mocking
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ npx cortex-agents configure # Pick your models interactively
|
|
|
43
43
|
# Restart OpenCode - done.
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
That's it. Your OpenCode session now has 7 specialized agents,
|
|
46
|
+
That's it. Your OpenCode session now has 7 specialized agents, 23 tools, and 14 domain skills.
|
|
47
47
|
|
|
48
48
|
<br>
|
|
49
49
|
|
|
@@ -78,6 +78,8 @@ Create isolated development environments and launch them instantly:
|
|
|
78
78
|
|
|
79
79
|
Plans are automatically propagated into the worktree's `.cortex/plans/` so the new session has full context.
|
|
80
80
|
|
|
81
|
+
**Cross-platform terminal support** via the terminal driver system — automatically detects and integrates with tmux, iTerm2, Terminal.app, kitty, wezterm, Konsole, and GNOME Terminal. Tabs opened by the launcher are tracked and automatically closed when the worktree is removed.
|
|
82
|
+
|
|
81
83
|
### Task Finalizer
|
|
82
84
|
|
|
83
85
|
One tool to close the loop:
|
|
@@ -120,29 +122,31 @@ Handle complex, multi-step work. Use your best model.
|
|
|
120
122
|
|
|
121
123
|
### Subagents
|
|
122
124
|
|
|
123
|
-
Focused specialists
|
|
125
|
+
Focused specialists launched **automatically** as parallel quality gates. Use a fast/cheap model.
|
|
126
|
+
|
|
127
|
+
| Agent | Role | Triggered By |
|
|
128
|
+
|-------|------|-------------|
|
|
129
|
+
| **@testing** | Writes tests, runs suite, reports coverage gaps | Build (always), Debug (always) |
|
|
130
|
+
| **@security** | OWASP audit, secrets scan, severity-rated findings | Build (always), Debug (if security-relevant) |
|
|
131
|
+
| **@fullstack** | End-to-end implementation + feasibility analysis | Build (multi-layer features), Plan (analysis) |
|
|
132
|
+
| **@devops** | Config validation, CI/CD best practices | Build (when CI/Docker/infra files change) |
|
|
124
133
|
|
|
125
|
-
|
|
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 |
|
|
134
|
+
Subagents return **structured reports** with severity levels (`BLOCKING`, `CRITICAL`, `HIGH`, `MEDIUM`, `LOW`) that the orchestrating agent uses to decide whether to proceed or fix issues first.
|
|
131
135
|
|
|
132
136
|
<br>
|
|
133
137
|
|
|
134
138
|
## Tools
|
|
135
139
|
|
|
136
|
-
|
|
140
|
+
23 tools bundled and auto-registered. No configuration needed.
|
|
137
141
|
|
|
138
142
|
<table>
|
|
139
143
|
<tr><td width="50%">
|
|
140
144
|
|
|
141
145
|
**Git Workflow**
|
|
142
146
|
- `branch_status` - Current branch + change detection
|
|
143
|
-
- `branch_create` - Convention-named branches
|
|
147
|
+
- `branch_create` - Convention-named branches (with toast notifications)
|
|
144
148
|
- `branch_switch` - Safe branch switching
|
|
145
|
-
- `worktree_create` - Isolated worktree in `.worktrees/`
|
|
149
|
+
- `worktree_create` - Isolated worktree in `.worktrees/` (with toast notifications)
|
|
146
150
|
- `worktree_launch` - Launch worktree (terminal/PTY/background)
|
|
147
151
|
- `worktree_list` / `worktree_remove` / `worktree_open`
|
|
148
152
|
|
|
@@ -151,7 +155,7 @@ Focused specialists. Invoked with `@mention`. Use a fast/cheap model.
|
|
|
151
155
|
**Planning & Sessions**
|
|
152
156
|
- `plan_save` / `plan_load` / `plan_list` / `plan_delete`
|
|
153
157
|
- `session_save` / `session_list` / `session_load`
|
|
154
|
-
- `cortex_init` / `cortex_status`
|
|
158
|
+
- `cortex_init` / `cortex_status` / `cortex_configure`
|
|
155
159
|
|
|
156
160
|
</td></tr>
|
|
157
161
|
<tr><td width="50%">
|
|
@@ -164,11 +168,12 @@ Focused specialists. Invoked with `@mention`. Use a fast/cheap model.
|
|
|
164
168
|
|
|
165
169
|
</td><td width="50%">
|
|
166
170
|
|
|
167
|
-
**Finalization**
|
|
171
|
+
**Finalization & Config**
|
|
168
172
|
- `task_finalize` - Stage, commit, push, create PR
|
|
169
173
|
- Auto-detects worktree (targets main)
|
|
170
174
|
- Auto-populates PR from `.cortex/plans/`
|
|
171
175
|
- Warns if docs are missing
|
|
176
|
+
- `cortex_configure` - Set models from within an agent session
|
|
172
177
|
|
|
173
178
|
</td></tr>
|
|
174
179
|
</table>
|
|
@@ -181,7 +186,6 @@ Focused specialists. Invoked with `@mention`. Use a fast/cheap model.
|
|
|
181
186
|
|
|
182
187
|
| Skill | Covers |
|
|
183
188
|
|-------|--------|
|
|
184
|
-
| **web-development** | Full-stack patterns, REST/GraphQL, SSR, state management |
|
|
185
189
|
| **frontend-development** | React, Vue, Svelte, CSS architecture, accessibility |
|
|
186
190
|
| **backend-development** | API design, middleware, auth, caching, queue systems |
|
|
187
191
|
| **mobile-development** | React Native, Flutter, native iOS/Android patterns |
|
|
@@ -201,10 +205,11 @@ Focused specialists. Invoked with `@mention`. Use a fast/cheap model.
|
|
|
201
205
|
|
|
202
206
|
## Model Configuration
|
|
203
207
|
|
|
204
|
-
Cortex agents are **model-agnostic**.
|
|
208
|
+
Cortex agents are **model-agnostic**. Configure globally or per-project:
|
|
205
209
|
|
|
206
210
|
```bash
|
|
207
|
-
npx cortex-agents configure
|
|
211
|
+
npx cortex-agents configure # Global (all projects)
|
|
212
|
+
npx cortex-agents configure --project # Per-project (saves to .opencode/models.json)
|
|
208
213
|
```
|
|
209
214
|
|
|
210
215
|
```
|
|
@@ -223,6 +228,19 @@ npx cortex-agents configure
|
|
|
223
228
|
Same as primary
|
|
224
229
|
```
|
|
225
230
|
|
|
231
|
+
### In-Agent Configuration
|
|
232
|
+
|
|
233
|
+
Agents can also configure models during a session via the `cortex_configure` tool — no need to leave OpenCode. The agent will prompt you to select models when `.cortex/` is first initialized.
|
|
234
|
+
|
|
235
|
+
### Per-Project vs Global
|
|
236
|
+
|
|
237
|
+
| Scope | Where | Use Case |
|
|
238
|
+
|-------|-------|----------|
|
|
239
|
+
| **Global** | `~/.config/opencode/opencode.json` | Default for all projects |
|
|
240
|
+
| **Per-project** | `.opencode/models.json` + `opencode.json` | Different models for different repos |
|
|
241
|
+
|
|
242
|
+
Per-project config takes priority. Team members get the same model settings when they clone the repo (`.opencode/models.json` is git-tracked).
|
|
243
|
+
|
|
226
244
|
### Supported Providers
|
|
227
245
|
|
|
228
246
|
| Provider | Premium | Standard | Fast |
|
|
@@ -246,6 +264,8 @@ your-project/
|
|
|
246
264
|
config.json Configuration
|
|
247
265
|
plans/ Implementation plans (git tracked)
|
|
248
266
|
sessions/ Session summaries (gitignored)
|
|
267
|
+
.opencode/
|
|
268
|
+
models.json Per-project model config (git tracked)
|
|
249
269
|
.worktrees/ Git worktrees (gitignored)
|
|
250
270
|
feature-auth/ Isolated development copy
|
|
251
271
|
bugfix-login/
|
|
@@ -261,11 +281,13 @@ your-project/
|
|
|
261
281
|
## CLI Reference
|
|
262
282
|
|
|
263
283
|
```bash
|
|
264
|
-
npx cortex-agents install
|
|
265
|
-
npx cortex-agents configure
|
|
266
|
-
npx cortex-agents configure --
|
|
267
|
-
npx cortex-agents
|
|
268
|
-
npx cortex-agents
|
|
284
|
+
npx cortex-agents install # Install plugin, agents, and skills
|
|
285
|
+
npx cortex-agents configure # Global model selection
|
|
286
|
+
npx cortex-agents configure --project # Per-project model selection
|
|
287
|
+
npx cortex-agents configure --reset # Reset global models
|
|
288
|
+
npx cortex-agents configure --project --reset # Reset per-project models
|
|
289
|
+
npx cortex-agents uninstall # Clean removal of everything
|
|
290
|
+
npx cortex-agents status # Show installation and model status
|
|
269
291
|
```
|
|
270
292
|
|
|
271
293
|
<br>
|
|
@@ -278,20 +300,50 @@ Every time the build agent starts, it follows a structured pre-implementation ch
|
|
|
278
300
|
|
|
279
301
|
```
|
|
280
302
|
Step 1 branch_status Am I on a protected branch?
|
|
281
|
-
Step 2 cortex_status Is .cortex initialized?
|
|
303
|
+
Step 2 cortex_status Is .cortex initialized? Offer model config if new project.
|
|
282
304
|
Step 3 plan_list / plan_load Is there a plan for this work?
|
|
283
|
-
Step 4 Ask: strategy
|
|
284
|
-
Step 4b Ask: launch mode
|
|
285
|
-
Step 5 Execute Create branch
|
|
305
|
+
Step 4 Ask: strategy Worktree (recommended) or branch?
|
|
306
|
+
Step 4b Ask: launch mode Terminal tab (recommended) / stay / PTY / background?
|
|
307
|
+
Step 5 Execute Create worktree/branch, auto-detect terminal
|
|
286
308
|
Step 6 Implement Write code following the plan
|
|
287
|
-
Step 7
|
|
288
|
-
Step 8
|
|
289
|
-
Step 9
|
|
290
|
-
Step 10
|
|
309
|
+
Step 7 Quality Gate Launch @testing + @security in parallel
|
|
310
|
+
Step 8 Ask: documentation Decision doc / feature doc / flow doc?
|
|
311
|
+
Step 9 session_save Record what was done and why
|
|
312
|
+
Step 10 task_finalize Commit, push, create PR
|
|
313
|
+
Step 11 Ask: cleanup Remove worktree + close terminal tab? (if applicable)
|
|
291
314
|
```
|
|
292
315
|
|
|
293
316
|
This isn't just documentation - it's enforced by the agent's instructions. The AI follows this workflow every time.
|
|
294
317
|
|
|
318
|
+
### Sub-Agent Quality Gates
|
|
319
|
+
|
|
320
|
+
After implementation (Step 7), the build agent **automatically** launches sub-agents in parallel as quality gates:
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
Build Agent completes implementation
|
|
324
|
+
|
|
|
325
|
+
+-- launches in parallel (single message) --+
|
|
326
|
+
| |
|
|
327
|
+
v v
|
|
328
|
+
@testing @security
|
|
329
|
+
Writes unit tests OWASP audit
|
|
330
|
+
Runs test suite Secrets scan
|
|
331
|
+
Reports coverage Severity ratings
|
|
332
|
+
Returns: PASS/FAIL Returns: PASS/FAIL
|
|
333
|
+
| |
|
|
334
|
+
+-------- results reviewed by Build ---------+
|
|
335
|
+
|
|
|
336
|
+
v
|
|
337
|
+
Quality Gate Summary included in PR body
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
The debug agent uses the same pattern: `@testing` for regression tests (always) and `@security` when the fix touches sensitive code.
|
|
341
|
+
|
|
342
|
+
Sub-agents use **structured return contracts** so results are actionable:
|
|
343
|
+
- `BLOCKING` / `CRITICAL` / `HIGH` findings block finalization
|
|
344
|
+
- `MEDIUM` findings are noted in the PR body
|
|
345
|
+
- `LOW` findings are deferred
|
|
346
|
+
|
|
295
347
|
### Agent Handover
|
|
296
348
|
|
|
297
349
|
When agents switch, a toast notification tells you what mode you're in:
|
|
@@ -346,7 +398,7 @@ cd ~/.config/opencode && npm unlink cortex-agents && npm install
|
|
|
346
398
|
|
|
347
399
|
- **New skills** - Domain-specific knowledge packs (e.g., Rust, Go, DevOps for AWS)
|
|
348
400
|
- **New agents** - Specialized agents (e.g., reviewer, migration, docs-writer)
|
|
349
|
-
- **
|
|
401
|
+
- **Terminal drivers** - Improve detection/support for additional terminal emulators
|
|
350
402
|
- **Tool improvements** - Better PR templates, test runners, linter integration
|
|
351
403
|
- **Bug fixes** - Anything that doesn't work as expected
|
|
352
404
|
|