openhermes 2.8.0 → 4.0.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/CONTEXT.md +18 -0
- package/ETHOS.md +15 -0
- package/README.md +135 -292
- package/bootstrap.mjs +174 -512
- package/harness/agents/openhermes.md +87 -0
- package/harness/codex/CONSTITUTION.md +70 -148
- package/harness/codex/ROUTING.md +126 -0
- package/harness/commands/oh-doctor.md +26 -0
- package/harness/instructions/CONVENTIONS.md +206 -206
- package/harness/instructions/RUNTIME.md +54 -31
- package/harness/skills/oh-builder/SKILL.md +98 -0
- package/harness/skills/oh-caveman/SKILL.md +33 -0
- package/harness/skills/oh-expert/SKILL.md +121 -0
- package/harness/skills/oh-freeze/SKILL.md +28 -0
- package/harness/skills/oh-gauntlet/SKILL.md +119 -0
- package/harness/skills/oh-grill/SKILL.md +77 -0
- package/harness/skills/oh-guard/SKILL.md +33 -0
- package/harness/skills/oh-handoff/SKILL.md +33 -0
- package/harness/skills/oh-health/SKILL.md +90 -0
- package/harness/skills/oh-init/SKILL.md +78 -0
- package/harness/skills/oh-investigate/SKILL.md +35 -0
- package/harness/skills/oh-issue/SKILL.md +36 -0
- package/harness/skills/oh-learn/SKILL.md +28 -0
- package/harness/skills/oh-manifest/SKILL.md +84 -0
- package/harness/skills/oh-plan-review/SKILL.md +128 -0
- package/harness/skills/oh-planner/SKILL.md +157 -0
- package/harness/skills/oh-prd/SKILL.md +35 -0
- package/harness/skills/oh-retro/SKILL.md +33 -0
- package/harness/skills/oh-review/SKILL.md +110 -0
- package/harness/skills/oh-security/SKILL.md +110 -0
- package/harness/skills/oh-ship/SKILL.md +39 -0
- package/harness/skills/oh-skill-craft/SKILL.md +107 -0
- package/harness/skills/oh-skills-link/SKILL.md +29 -0
- package/harness/skills/oh-skills-list/SKILL.md +31 -0
- package/harness/skills/oh-triage/SKILL.md +36 -0
- package/index.mjs +3 -60
- package/lib/harness-resolver.mjs +77 -0
- package/lib/logger.mjs +62 -0
- package/package.json +49 -53
- package/test/plugins-behavioral.test.mjs +64 -0
- package/test/plugins.test.mjs +62 -0
- package/autorecall.mjs +0 -237
- package/curator.mjs +0 -482
- package/harness/commands/build-fix.md +0 -60
- package/harness/commands/checkpoint.md +0 -68
- package/harness/commands/code-review.md +0 -71
- package/harness/commands/doctor.md +0 -42
- package/harness/commands/eval.md +0 -89
- package/harness/commands/go-build.md +0 -87
- package/harness/commands/go-review.md +0 -71
- package/harness/commands/harness-audit.md +0 -90
- package/harness/commands/learn.md +0 -37
- package/harness/commands/loop-start.md +0 -38
- package/harness/commands/loop-status.md +0 -30
- package/harness/commands/memory-search.md +0 -37
- package/harness/commands/model-route.md +0 -32
- package/harness/commands/ohc.md +0 -13
- package/harness/commands/orchestrate.md +0 -88
- package/harness/commands/plan.md +0 -53
- package/harness/commands/quality-gate.md +0 -35
- package/harness/commands/refactor-clean.md +0 -102
- package/harness/commands/rust-build.md +0 -78
- package/harness/commands/rust-review.md +0 -65
- package/harness/commands/security.md +0 -93
- package/harness/commands/setup-pm.md +0 -65
- package/harness/commands/skill-create.md +0 -99
- package/harness/commands/test-coverage.md +0 -80
- package/harness/commands/update-codemaps.md +0 -81
- package/harness/commands/update-docs.md +0 -67
- package/harness/commands/verify.md +0 -68
- package/harness/prompts/architect.txt +0 -189
- package/harness/prompts/build-cpp.md +0 -98
- package/harness/prompts/build-error-resolver.md +0 -44
- package/harness/prompts/build-go.md +0 -340
- package/harness/prompts/build-java.md +0 -140
- package/harness/prompts/build-kotlin.md +0 -137
- package/harness/prompts/build-rust.md +0 -108
- package/harness/prompts/code-reviewer.md +0 -40
- package/harness/prompts/doc-updater.md +0 -206
- package/harness/prompts/docs-lookup.md +0 -71
- package/harness/prompts/e2e-runner.txt +0 -317
- package/harness/prompts/explore.md +0 -42
- package/harness/prompts/harness-optimizer.md +0 -42
- package/harness/prompts/loop-operator.md +0 -53
- package/harness/prompts/planner.md +0 -37
- package/harness/prompts/refactor-cleaner.md +0 -256
- package/harness/prompts/review-cpp.md +0 -81
- package/harness/prompts/review-database.md +0 -261
- package/harness/prompts/review-go.md +0 -257
- package/harness/prompts/review-java.md +0 -113
- package/harness/prompts/review-kotlin.md +0 -143
- package/harness/prompts/review-python.md +0 -101
- package/harness/prompts/review-rust.md +0 -77
- package/harness/prompts/security-reviewer.md +0 -42
- package/harness/prompts/tdd-guide.md +0 -228
- package/harness/rules/audit.md +0 -84
- package/harness/rules/checkpointing.md +0 -75
- package/harness/rules/context-loading.md +0 -33
- package/harness/rules/credential-exposure.md +0 -0
- package/harness/rules/delegation.md +0 -80
- package/harness/rules/handoff.md +0 -267
- package/harness/rules/memory-management.md +0 -28
- package/harness/rules/precedence.md +0 -52
- package/harness/rules/promotion.md +0 -46
- package/harness/rules/ranking.md +0 -64
- package/harness/rules/retrieval.md +0 -94
- package/harness/rules/runtime-guards.md +0 -196
- package/harness/rules/self-heal.md +0 -79
- package/harness/rules/session-start.md +0 -34
- package/harness/rules/skills-management.md +0 -165
- package/harness/rules/state-drift.md +0 -192
- package/harness/rules/verification.md +0 -88
- package/harness/scripts/sync-commands.mjs +0 -259
- package/harness/skills/.bundled_manifest +0 -17
- package/harness/skills/.usage.json +0 -6
- package/harness/skills/api-design/SKILL.md +0 -523
- package/harness/skills/backend-patterns/SKILL.md +0 -598
- package/harness/skills/coding-standards/SKILL.md +0 -549
- package/harness/skills/e2e-testing/SKILL.md +0 -326
- package/harness/skills/frontend-patterns/SKILL.md +0 -642
- package/harness/skills/frontend-slides/SKILL.md +0 -184
- package/harness/skills/security-review/SKILL.md +0 -495
- package/harness/skills/strategic-compact/SKILL.md +0 -131
- package/harness/skills/tdd-workflow/SKILL.md +0 -463
- package/harness/skills/verification-loop/SKILL.md +0 -126
- package/lib/ambient-memory.mjs +0 -167
- package/lib/handoff.mjs +0 -171
- package/lib/hardening.mjs +0 -146
- package/lib/memory-tools-plugin.mjs +0 -368
- package/lib/ohc/block-sync.mjs +0 -69
- package/lib/ohc/compress/search.mjs +0 -152
- package/lib/ohc/compress/state.mjs +0 -76
- package/lib/ohc/config.mjs +0 -185
- package/lib/ohc/message-ids.mjs +0 -178
- package/lib/ohc/notify.mjs +0 -135
- package/lib/ohc/protected-patterns.mjs +0 -55
- package/lib/ohc/prune-apply.mjs +0 -134
- package/lib/ohc/pruner.mjs +0 -608
- package/lib/ohc/reaper.mjs +0 -70
- package/lib/ohc/state.mjs +0 -265
- package/lib/ohc/strategies/deduplication.mjs +0 -72
- package/lib/ohc/strategies/index.mjs +0 -2
- package/lib/ohc/strategies/purge-errors.mjs +0 -43
- package/lib/ohc/token-utils.mjs +0 -26
- package/lib/ohc/updater.mjs +0 -132
- package/lib/paths.mjs +0 -49
- package/lib/schema-validator.mjs +0 -79
- package/lib/search.mjs +0 -48
- package/schemas/audit.schema.json +0 -82
- package/schemas/backlog.schema.json +0 -63
- package/schemas/checkpoint.schema.json +0 -65
- package/schemas/constraint.schema.json +0 -62
- package/schemas/decision.schema.json +0 -63
- package/schemas/instinct.schema.json +0 -63
- package/schemas/loop-state.schema.json +0 -33
- package/schemas/mistake.schema.json +0 -64
- package/schemas/verification_receipt.schema.json +0 -88
- package/skill-builder.mjs +0 -88
|
@@ -1,206 +1,206 @@
|
|
|
1
|
-
# OpenHermes — Coding Conventions & Operational Guidelines
|
|
2
|
-
|
|
3
|
-
OpenHermes coding conventions and operational guidelines. Shared baseline for all subagents and skills.
|
|
4
|
-
|
|
5
|
-
## Security Guidelines (CRITICAL)
|
|
6
|
-
|
|
7
|
-
### Mandatory Pre-Commit Checks
|
|
8
|
-
|
|
9
|
-
- [ ] No hardcoded secrets (API keys, passwords, tokens)
|
|
10
|
-
- [ ] All user inputs validated
|
|
11
|
-
- [ ] SQL injection prevention (parameterized queries)
|
|
12
|
-
- [ ] XSS prevention (sanitized output)
|
|
13
|
-
- [ ] CSRF protection enabled
|
|
14
|
-
- [ ] Authentication/authorization verified
|
|
15
|
-
- [ ] Rate limiting on all endpoints
|
|
16
|
-
- [ ] Error messages don't leak sensitive data
|
|
17
|
-
|
|
18
|
-
### Secret Management
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
// NEVER: Hardcoded secrets
|
|
22
|
-
const apiKey = "sk-proj-xxxxx"
|
|
23
|
-
|
|
24
|
-
// ALWAYS: Environment variables
|
|
25
|
-
const apiKey = process.env.OPENAI_API_KEY
|
|
26
|
-
if (!apiKey) throw new Error('OPENAI_API_KEY not configured')
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Security Response Protocol
|
|
30
|
-
|
|
31
|
-
If security issue found:
|
|
32
|
-
1. STOP immediately
|
|
33
|
-
2. Use `security-reviewer` subagent
|
|
34
|
-
3. Fix CRITICAL issues before continuing
|
|
35
|
-
4. Rotate any exposed secrets
|
|
36
|
-
5. Review entire codebase for similar issues
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Coding Style
|
|
41
|
-
|
|
42
|
-
### Immutability (CRITICAL)
|
|
43
|
-
|
|
44
|
-
ALWAYS create new objects, NEVER mutate:
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
// WRONG: Mutation
|
|
48
|
-
function updateUser(user, name) {
|
|
49
|
-
user.name = name; return user
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// CORRECT: Immutability
|
|
53
|
-
function updateUser(user, name) {
|
|
54
|
-
return { ...user, name }
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### File Organization
|
|
59
|
-
|
|
60
|
-
MANY SMALL FILES > FEW LARGE FILES:
|
|
61
|
-
- High cohesion, low coupling
|
|
62
|
-
- 200-400 lines typical, 800 max
|
|
63
|
-
- Extract utilities from large components
|
|
64
|
-
- Organize by feature/domain, not by type
|
|
65
|
-
|
|
66
|
-
### Error Handling
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
try {
|
|
70
|
-
const result = await riskyOperation()
|
|
71
|
-
return result
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error('Operation failed:', error)
|
|
74
|
-
throw new Error('Detailed user-friendly message')
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Input Validation
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
import { z } from 'zod'
|
|
82
|
-
const schema = z.object({
|
|
83
|
-
email: z.string().email(),
|
|
84
|
-
age: z.number().int().min(0).max(150)
|
|
85
|
-
})
|
|
86
|
-
const validated = schema.parse(input)
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Code Quality Checklist
|
|
90
|
-
|
|
91
|
-
Before marking work complete:
|
|
92
|
-
- [ ] Code is readable and well-named
|
|
93
|
-
- [ ] Functions are small (<50 lines)
|
|
94
|
-
- [ ] Files are focused (<800 lines)
|
|
95
|
-
- [ ] No deep nesting (>4 levels)
|
|
96
|
-
- [ ] Proper error handling
|
|
97
|
-
- [ ] No console.log statements
|
|
98
|
-
- [ ] No hardcoded values
|
|
99
|
-
- [ ] No mutation (immutable patterns used)
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Testing Requirements
|
|
104
|
-
|
|
105
|
-
### Minimum Test Coverage: 80%
|
|
106
|
-
|
|
107
|
-
Test Types (ALL required):
|
|
108
|
-
1. **Unit Tests** — Individual functions, utilities, components
|
|
109
|
-
2. **Integration Tests** — API endpoints, database operations
|
|
110
|
-
3. **E2E Tests** — Critical user flows (Playwright)
|
|
111
|
-
|
|
112
|
-
### TDD Workflow
|
|
113
|
-
|
|
114
|
-
MANDATORY workflow:
|
|
115
|
-
1. Write test first (RED)
|
|
116
|
-
2. Run test — it should FAIL
|
|
117
|
-
3. Write minimal implementation (GREEN)
|
|
118
|
-
4. Run test — it should PASS
|
|
119
|
-
5. Refactor (IMPROVE)
|
|
120
|
-
6. Verify coverage (80%+)
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## Subagent Orchestration
|
|
125
|
-
|
|
126
|
-
| Subagent | Purpose | When to Use |
|
|
127
|
-
|----------|---------|-------------|
|
|
128
|
-
| planner | Implementation planning | Complex features, refactoring |
|
|
129
|
-
| architect | System design | Architectural decisions |
|
|
130
|
-
| tdd-guide | Test-driven development | New features, bug fixes |
|
|
131
|
-
| code-reviewer | Code review | After writing code |
|
|
132
|
-
| security-reviewer | Security analysis | Before commits |
|
|
133
|
-
| build-error-resolver | Fix build errors | When build fails |
|
|
134
|
-
| e2e-runner | E2E testing | Critical user flows |
|
|
135
|
-
| refactor-cleaner | Dead code cleanup | Code maintenance |
|
|
136
|
-
| doc-updater | Documentation | Updating docs |
|
|
137
|
-
| docs-lookup | Live doc queries | API questions |
|
|
138
|
-
| review-go | Go code review | Go projects |
|
|
139
|
-
| build-go | Go build errors | Go build failures |
|
|
140
|
-
| review-database | Database optimization | SQL, schema design |
|
|
141
|
-
| review-rust | Rust code review | Rust projects |
|
|
142
|
-
| build-rust | Rust build errors | Rust build failures |
|
|
143
|
-
| review-python | Python code review | Python projects |
|
|
144
|
-
| review-java | Java/Spring review | Java projects |
|
|
145
|
-
| build-java | Java build errors | Java build failures |
|
|
146
|
-
| review-kotlin | Kotlin/Android review | Kotlin projects |
|
|
147
|
-
| build-kotlin | Kotlin build errors | Kotlin build failures |
|
|
148
|
-
| review-cpp | C++ review | C++ projects |
|
|
149
|
-
| build-cpp | C++ build errors | C++ build failures |
|
|
150
|
-
| loop-operator | Autonomous loops | Iterative workflows |
|
|
151
|
-
|
|
152
|
-
### Immediate Subagent Usage
|
|
153
|
-
|
|
154
|
-
No user prompt needed:
|
|
155
|
-
1. Complex feature requests — Use `planner`
|
|
156
|
-
2. Code just written/modified — Use `code-reviewer`
|
|
157
|
-
3. Bug fix or new feature — Use `tdd-guide`
|
|
158
|
-
4. Architectural decision — Use `architect`
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## Performance
|
|
163
|
-
|
|
164
|
-
### Model Selection Strategy
|
|
165
|
-
|
|
166
|
-
**Haiku** (lightweight): deterministic changes, simple code gen, worker agents
|
|
167
|
-
**Sonnet** (default): main development, multi-agent orchestration, complex coding
|
|
168
|
-
**Opus** (deep reasoning): architecture decisions, security review, ambiguous requirements
|
|
169
|
-
|
|
170
|
-
### Context Window Management
|
|
171
|
-
|
|
172
|
-
Avoid last 20% of context window for:
|
|
173
|
-
- Large-scale refactoring
|
|
174
|
-
- Feature implementation spanning multiple files
|
|
175
|
-
- Debugging complex interactions
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## Git Workflow
|
|
180
|
-
|
|
181
|
-
### Commit Message Format
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
<type>: <description>
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Types: feat, fix, refactor, docs, test, chore, perf, ci
|
|
188
|
-
|
|
189
|
-
### Feature Implementation Workflow
|
|
190
|
-
|
|
191
|
-
1. **Plan** — Use `planner` to create plan with risks and phases
|
|
192
|
-
2. **TDD** — Use `tdd-guide` for red-green-refactor cycle
|
|
193
|
-
3. **Code Review** — Use `code-reviewer` immediately after writing
|
|
194
|
-
4. **Security** — Use `security-reviewer` before commits
|
|
195
|
-
5. **Commit** — Follow conventional commits format
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## Success Metrics
|
|
200
|
-
|
|
201
|
-
You are successful when:
|
|
202
|
-
- All tests pass (80%+ coverage)
|
|
203
|
-
- No security vulnerabilities
|
|
204
|
-
- Code is readable and maintainable
|
|
205
|
-
- Performance is acceptable
|
|
206
|
-
- User requirements are met
|
|
1
|
+
# OpenHermes — Coding Conventions & Operational Guidelines
|
|
2
|
+
|
|
3
|
+
OpenHermes coding conventions and operational guidelines. Shared baseline for all subagents and skills.
|
|
4
|
+
|
|
5
|
+
## Security Guidelines (CRITICAL)
|
|
6
|
+
|
|
7
|
+
### Mandatory Pre-Commit Checks
|
|
8
|
+
|
|
9
|
+
- [ ] No hardcoded secrets (API keys, passwords, tokens)
|
|
10
|
+
- [ ] All user inputs validated
|
|
11
|
+
- [ ] SQL injection prevention (parameterized queries)
|
|
12
|
+
- [ ] XSS prevention (sanitized output)
|
|
13
|
+
- [ ] CSRF protection enabled
|
|
14
|
+
- [ ] Authentication/authorization verified
|
|
15
|
+
- [ ] Rate limiting on all endpoints
|
|
16
|
+
- [ ] Error messages don't leak sensitive data
|
|
17
|
+
|
|
18
|
+
### Secret Management
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// NEVER: Hardcoded secrets
|
|
22
|
+
const apiKey = "sk-proj-xxxxx"
|
|
23
|
+
|
|
24
|
+
// ALWAYS: Environment variables
|
|
25
|
+
const apiKey = process.env.OPENAI_API_KEY
|
|
26
|
+
if (!apiKey) throw new Error('OPENAI_API_KEY not configured')
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Security Response Protocol
|
|
30
|
+
|
|
31
|
+
If security issue found:
|
|
32
|
+
1. STOP immediately
|
|
33
|
+
2. Use `security-reviewer` subagent
|
|
34
|
+
3. Fix CRITICAL issues before continuing
|
|
35
|
+
4. Rotate any exposed secrets
|
|
36
|
+
5. Review entire codebase for similar issues
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Coding Style
|
|
41
|
+
|
|
42
|
+
### Immutability (CRITICAL)
|
|
43
|
+
|
|
44
|
+
ALWAYS create new objects, NEVER mutate:
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
// WRONG: Mutation
|
|
48
|
+
function updateUser(user, name) {
|
|
49
|
+
user.name = name; return user
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// CORRECT: Immutability
|
|
53
|
+
function updateUser(user, name) {
|
|
54
|
+
return { ...user, name }
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### File Organization
|
|
59
|
+
|
|
60
|
+
MANY SMALL FILES > FEW LARGE FILES:
|
|
61
|
+
- High cohesion, low coupling
|
|
62
|
+
- 200-400 lines typical, 800 max
|
|
63
|
+
- Extract utilities from large components
|
|
64
|
+
- Organize by feature/domain, not by type
|
|
65
|
+
|
|
66
|
+
### Error Handling
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
try {
|
|
70
|
+
const result = await riskyOperation()
|
|
71
|
+
return result
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error('Operation failed:', error)
|
|
74
|
+
throw new Error('Detailed user-friendly message')
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Input Validation
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { z } from 'zod'
|
|
82
|
+
const schema = z.object({
|
|
83
|
+
email: z.string().email(),
|
|
84
|
+
age: z.number().int().min(0).max(150)
|
|
85
|
+
})
|
|
86
|
+
const validated = schema.parse(input)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Code Quality Checklist
|
|
90
|
+
|
|
91
|
+
Before marking work complete:
|
|
92
|
+
- [ ] Code is readable and well-named
|
|
93
|
+
- [ ] Functions are small (<50 lines)
|
|
94
|
+
- [ ] Files are focused (<800 lines)
|
|
95
|
+
- [ ] No deep nesting (>4 levels)
|
|
96
|
+
- [ ] Proper error handling
|
|
97
|
+
- [ ] No console.log statements
|
|
98
|
+
- [ ] No hardcoded values
|
|
99
|
+
- [ ] No mutation (immutable patterns used)
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Testing Requirements
|
|
104
|
+
|
|
105
|
+
### Minimum Test Coverage: 80%
|
|
106
|
+
|
|
107
|
+
Test Types (ALL required):
|
|
108
|
+
1. **Unit Tests** — Individual functions, utilities, components
|
|
109
|
+
2. **Integration Tests** — API endpoints, database operations
|
|
110
|
+
3. **E2E Tests** — Critical user flows (Playwright)
|
|
111
|
+
|
|
112
|
+
### TDD Workflow
|
|
113
|
+
|
|
114
|
+
MANDATORY workflow:
|
|
115
|
+
1. Write test first (RED)
|
|
116
|
+
2. Run test — it should FAIL
|
|
117
|
+
3. Write minimal implementation (GREEN)
|
|
118
|
+
4. Run test — it should PASS
|
|
119
|
+
5. Refactor (IMPROVE)
|
|
120
|
+
6. Verify coverage (80%+)
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Subagent Orchestration
|
|
125
|
+
|
|
126
|
+
| Subagent | Purpose | When to Use |
|
|
127
|
+
|----------|---------|-------------|
|
|
128
|
+
| planner | Implementation planning | Complex features, refactoring |
|
|
129
|
+
| architect | System design | Architectural decisions |
|
|
130
|
+
| tdd-guide | Test-driven development | New features, bug fixes |
|
|
131
|
+
| code-reviewer | Code review | After writing code |
|
|
132
|
+
| security-reviewer | Security analysis | Before commits |
|
|
133
|
+
| build-error-resolver | Fix build errors | When build fails |
|
|
134
|
+
| e2e-runner | E2E testing | Critical user flows |
|
|
135
|
+
| refactor-cleaner | Dead code cleanup | Code maintenance |
|
|
136
|
+
| doc-updater | Documentation | Updating docs |
|
|
137
|
+
| docs-lookup | Live doc queries | API questions |
|
|
138
|
+
| review-go | Go code review | Go projects |
|
|
139
|
+
| build-go | Go build errors | Go build failures |
|
|
140
|
+
| review-database | Database optimization | SQL, schema design |
|
|
141
|
+
| review-rust | Rust code review | Rust projects |
|
|
142
|
+
| build-rust | Rust build errors | Rust build failures |
|
|
143
|
+
| review-python | Python code review | Python projects |
|
|
144
|
+
| review-java | Java/Spring review | Java projects |
|
|
145
|
+
| build-java | Java build errors | Java build failures |
|
|
146
|
+
| review-kotlin | Kotlin/Android review | Kotlin projects |
|
|
147
|
+
| build-kotlin | Kotlin build errors | Kotlin build failures |
|
|
148
|
+
| review-cpp | C++ review | C++ projects |
|
|
149
|
+
| build-cpp | C++ build errors | C++ build failures |
|
|
150
|
+
| loop-operator | Autonomous loops | Iterative workflows |
|
|
151
|
+
|
|
152
|
+
### Immediate Subagent Usage
|
|
153
|
+
|
|
154
|
+
No user prompt needed:
|
|
155
|
+
1. Complex feature requests — Use `planner`
|
|
156
|
+
2. Code just written/modified — Use `code-reviewer`
|
|
157
|
+
3. Bug fix or new feature — Use `tdd-guide`
|
|
158
|
+
4. Architectural decision — Use `architect`
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Performance
|
|
163
|
+
|
|
164
|
+
### Model Selection Strategy
|
|
165
|
+
|
|
166
|
+
**Haiku** (lightweight): deterministic changes, simple code gen, worker agents
|
|
167
|
+
**Sonnet** (default): main development, multi-agent orchestration, complex coding
|
|
168
|
+
**Opus** (deep reasoning): architecture decisions, security review, ambiguous requirements
|
|
169
|
+
|
|
170
|
+
### Context Window Management
|
|
171
|
+
|
|
172
|
+
Avoid last 20% of context window for:
|
|
173
|
+
- Large-scale refactoring
|
|
174
|
+
- Feature implementation spanning multiple files
|
|
175
|
+
- Debugging complex interactions
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Git Workflow
|
|
180
|
+
|
|
181
|
+
### Commit Message Format
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
<type>: <description>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Types: feat, fix, refactor, docs, test, chore, perf, ci
|
|
188
|
+
|
|
189
|
+
### Feature Implementation Workflow
|
|
190
|
+
|
|
191
|
+
1. **Plan** — Use `planner` to create plan with risks and phases
|
|
192
|
+
2. **TDD** — Use `tdd-guide` for red-green-refactor cycle
|
|
193
|
+
3. **Code Review** — Use `code-reviewer` immediately after writing
|
|
194
|
+
4. **Security** — Use `security-reviewer` before commits
|
|
195
|
+
5. **Commit** — Follow conventional commits format
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Success Metrics
|
|
200
|
+
|
|
201
|
+
You are successful when:
|
|
202
|
+
- All tests pass (80%+ coverage)
|
|
203
|
+
- No security vulnerabilities
|
|
204
|
+
- Code is readable and maintainable
|
|
205
|
+
- Performance is acceptable
|
|
206
|
+
- User requirements are met
|
|
@@ -1,31 +1,54 @@
|
|
|
1
|
-
## OpenHermes Runtime
|
|
2
|
-
|
|
3
|
-
Root:
|
|
4
|
-
|
|
5
|
-
**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
1
|
+
## OpenHermes Runtime
|
|
2
|
+
|
|
3
|
+
Root: package-local harness plus repo `AGENTS.md`. `AGENTS.md` is the routing layer.
|
|
4
|
+
|
|
5
|
+
**Skills**: Load on demand through OpenCode's native `skill` tool. Do not preload all skills.
|
|
6
|
+
|
|
7
|
+
Key skills:
|
|
8
|
+
- `oh-expert` — shared AI-coding vocabulary for self-diagnosis. Load when you need to diagnose your own failures.
|
|
9
|
+
- `oh-planner` — all-arounder planner. Merges brainstorm, architecture analysis, strategy review, autoplan.
|
|
10
|
+
- `oh-builder` — all-arounder builder. Merges prototype, TDD, implementation from plan, interface design.
|
|
11
|
+
- `oh-manifest` — full build loop: plan → build → verify → loop until done or blocker.
|
|
12
|
+
- `oh-gauntlet` — rigorous multi-axis testing: unit tests, dual-axis review, edge cases, QA, canary.
|
|
13
|
+
- `oh-grill` — stress-test plans through Socratic questioning. Optionally updates CONTEXT.md, ADRs, and extracts ubiquitous language.
|
|
14
|
+
- `oh-plan-review` — multi-lens plan review: Engineering, Design, DX, Strategy perspectives.
|
|
15
|
+
- `oh-security` — security audit: secrets archaeology, supply chain, CI/CD, OWASP, STRIDE, LLM security.
|
|
16
|
+
- `oh-health` — code quality dashboard: wraps project tools, computes composite score, tracks trends.
|
|
17
|
+
- `oh-skill-craft` — create new agent skills for the harness.
|
|
18
|
+
- `oh-investigate` — systematic bug diagnosis.
|
|
19
|
+
- `oh-handoff` — compact session into structured handoff artifact.
|
|
20
|
+
- `oh-retro` — retrospective after shipping.
|
|
21
|
+
- `oh-init` — initialize project with OpenHermes harness.
|
|
22
|
+
|
|
23
|
+
**Commands**: Package-local markdown manifests in `harness/commands/` are registered through the OpenCode config hook.
|
|
24
|
+
|
|
25
|
+
**Agents**: `OpenHermes` is the default primary orchestrator. Keep built-in OpenCode agents available for planning and exploration, and add custom subagents through `harness/agents/`.
|
|
26
|
+
|
|
27
|
+
**Workflow**:
|
|
28
|
+
- Inspect first with native file tools.
|
|
29
|
+
- Delegate substantive work to subagents using structured handoff.
|
|
30
|
+
- Treat multi-file changes as planned work, not improvisation.
|
|
31
|
+
- Checkpoint before handoff. Verify after each return.
|
|
32
|
+
- Verify before claiming success.
|
|
33
|
+
|
|
34
|
+
**Orchestration discipline**:
|
|
35
|
+
- **Session pool**: Subagents run in their own sessions with isolated context. No cross-session state leakage. Each subagent reports a single result back.
|
|
36
|
+
- **Concurrency**: Parallelize independent sub-tasks. Sequentialize dependent ones. Do not parallelize phases that share mutable state.
|
|
37
|
+
- **Circuit breaker**: If a subagent fails 3 times on the same task, surface BLOCKER. Do not silently retry.
|
|
38
|
+
- **Pipelined verification**: Build → auto-verify. Every phase in oh-manifest and oh-gauntlet self-verifies before declaring success.
|
|
39
|
+
- **Background vs sync**: Independent work → background (fire-and-forget). Dependent work → sync (await result). Check task result before proceeding.
|
|
40
|
+
|
|
41
|
+
**Shared state**:
|
|
42
|
+
- `.opencode/plan.md` — produced by oh-planner, consumed by oh-builder and oh-manifest
|
|
43
|
+
- `.opencode/work-log.md` — progress tracking across subagent delegations
|
|
44
|
+
- `.opencode/todo.md` — task tracking for multi-step work
|
|
45
|
+
|
|
46
|
+
**Bootstrap**: `harness/codex/CONSTITUTION.md`, this file, `CONTEXT.md`, and `ETHOS.md` are injected into the first user message so the agent starts with the same operating model every session.
|
|
47
|
+
|
|
48
|
+
**Memory**: deferred for now. Do not invent a persistence layer.
|
|
49
|
+
|
|
50
|
+
## Conventions
|
|
51
|
+
|
|
52
|
+
Security, coding style, testing, and orchestration standards:
|
|
53
|
+
- See `CONVENTIONS.md` for the shared baseline.
|
|
54
|
+
- Skills provide the detailed walkthroughs for specialized workflows.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oh-builder
|
|
3
|
+
description: "ALL-arounder builder — prototype, TDD, implement from plan, design interfaces. Consumes plan.md, produces working code."
|
|
4
|
+
tier: 4
|
|
5
|
+
benefits-from: [oh-planner, oh-expert]
|
|
6
|
+
triggers:
|
|
7
|
+
- "build this"
|
|
8
|
+
- "implement"
|
|
9
|
+
- "write the code"
|
|
10
|
+
- "prototype"
|
|
11
|
+
- "tdd"
|
|
12
|
+
- "red-green"
|
|
13
|
+
- "design an interface"
|
|
14
|
+
- "implement phase"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# oh-builder
|
|
18
|
+
|
|
19
|
+
The ALL-arounder builder. Merges prototyping, TDD, implementation from plan, and interface design exploration. Consumes `.opencode/plan.md` from oh-planner or works standalone.
|
|
20
|
+
|
|
21
|
+
## Entry Modes
|
|
22
|
+
|
|
23
|
+
### Mode A: Prototype (exploratory)
|
|
24
|
+
When you need to answer a question before committing.
|
|
25
|
+
|
|
26
|
+
1. Determine what question the prototype answers (data model, state flow, UI direction)
|
|
27
|
+
2. Build minimal — just enough to answer the question
|
|
28
|
+
3. Let user play with it
|
|
29
|
+
4. Collect feedback
|
|
30
|
+
5. Decide: discard, iterate, or promote
|
|
31
|
+
|
|
32
|
+
**Sub-modes:**
|
|
33
|
+
- **Terminal** — for state/business logic questions
|
|
34
|
+
- **UI** — several radical design variations from one route
|
|
35
|
+
|
|
36
|
+
### Mode B: TDD (test-first implementation)
|
|
37
|
+
When building production code from a plan or spec. Red-green-refactor with vertical tracer bullets.
|
|
38
|
+
|
|
39
|
+
**Planning** (one-time):
|
|
40
|
+
- [ ] Confirm interface changes with user
|
|
41
|
+
- [ ] Prioritize behaviors to test
|
|
42
|
+
- [ ] Design for testability (public interface only)
|
|
43
|
+
- [ ] List behaviors, not implementation steps
|
|
44
|
+
|
|
45
|
+
**Loop** (repeat per behavior):
|
|
46
|
+
```
|
|
47
|
+
RED: Write one test → fails
|
|
48
|
+
GREEN: Minimal code to pass → passes
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Rules:**
|
|
52
|
+
- One test at a time
|
|
53
|
+
- Only enough code to pass current test
|
|
54
|
+
- Do not anticipate future tests
|
|
55
|
+
- Tests describe behavior through public interfaces, not implementation details
|
|
56
|
+
- Never refactor while RED
|
|
57
|
+
|
|
58
|
+
**Refactor** (after all GREEN):
|
|
59
|
+
- Extract duplication
|
|
60
|
+
- Deepen modules (complexity behind simple interfaces)
|
|
61
|
+
- Run tests after each refactor step
|
|
62
|
+
|
|
63
|
+
### Mode C: Design an Interface (exploration)
|
|
64
|
+
When the interface shape is uncertain. "Design it twice" — generate multiple radically different designs, then compare.
|
|
65
|
+
|
|
66
|
+
1. **Gather requirements** — problem, callers, key operations, constraints
|
|
67
|
+
2. **Spawn 3+ parallel sub-agents** — each with a different constraint:
|
|
68
|
+
- Agent 1: "Minimize method count — aim for 1-3 methods max"
|
|
69
|
+
- Agent 2: "Maximize flexibility — support many use cases"
|
|
70
|
+
- Agent 3: "Optimize for the most common case"
|
|
71
|
+
- Agent 4: "Take inspiration from [specific paradigm]"
|
|
72
|
+
3. **Present designs** — interface signature, usage examples, what it hides
|
|
73
|
+
4. **Compare** — simplicity, generality, implementation efficiency, depth
|
|
74
|
+
5. **Synthesize** — combine insights from multiple options
|
|
75
|
+
|
|
76
|
+
### Mode D: From Plan (plan.md exists)
|
|
77
|
+
When oh-planner produced a plan artifact. Execute phases in order.
|
|
78
|
+
|
|
79
|
+
1. Read `.opencode/plan.md`
|
|
80
|
+
2. For each phase: implement per plan spec using TDD discipline (Mode B)
|
|
81
|
+
3. Verify each phase against its verification criteria before moving on
|
|
82
|
+
4. Update `.opencode/plan.md` with completed phase status
|
|
83
|
+
|
|
84
|
+
## Anti-patterns
|
|
85
|
+
- Polishing a prototype ("it's just a prototype!" — it never is)
|
|
86
|
+
- Writing all tests first (horizontal slicing) — produces brittle, imaginary tests
|
|
87
|
+
- Anticipating future tests — write for what exists now
|
|
88
|
+
- Refactoring while RED — get to GREEN first
|
|
89
|
+
- Letting sub-agents produce similar designs — enforce radical difference
|
|
90
|
+
- Implementing without verifying against plan criteria
|
|
91
|
+
|
|
92
|
+
## Routing
|
|
93
|
+
|
|
94
|
+
| Outcome | Route |
|
|
95
|
+
|---------|-------|
|
|
96
|
+
| pass | → oh-gauntlet (test built code) |
|
|
97
|
+
| fail | → oh-builder (fix issues) |
|
|
98
|
+
| blocker | → surface to user |
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oh-caveman
|
|
3
|
+
description: "Ultra-compressed communication mode — cut token usage ~75%"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# oh-caveman
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
When context is tight, tokens are precious, or user says "caveman mode." Drops filler, articles, and pleasantries while keeping full technical accuracy.
|
|
10
|
+
|
|
11
|
+
## Mode
|
|
12
|
+
- No pleasantries, no hedging, no transitions
|
|
13
|
+
- Fragments OK. One word when enough.
|
|
14
|
+
- Short synonyms. Drop articles.
|
|
15
|
+
- Code unchanged — only prose compresses.
|
|
16
|
+
- Technical accuracy preserved at all costs.
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
Normal: "I think we should probably look at the authentication module because there might be an issue with the token refresh logic."
|
|
20
|
+
Caveman: "Check auth module — token refresh likely broken."
|
|
21
|
+
|
|
22
|
+
## Anti-patterns
|
|
23
|
+
- Compressing code (code is already dense)
|
|
24
|
+
- Omitting critical context to save tokens
|
|
25
|
+
- Being unclear to be brief (accuracy > brevity)
|
|
26
|
+
|
|
27
|
+
## Routing
|
|
28
|
+
|
|
29
|
+
| Outcome | Route |
|
|
30
|
+
|---------|-------|
|
|
31
|
+
| pass | → [return to prior skill — mode active] |
|
|
32
|
+
| fail | → [fallback to normal communication mode] |
|
|
33
|
+
| blocker | → surface to user |
|